eve
Version:
Filesystem-first framework for durable backend AI agents that run anywhere.
4 lines • 379 kB
JavaScript
import{createRequire as e}from"node:module";import{Buffer as t}from"node:buffer";import*as n from"node:crypto";import{KeyObject as r,constants as i,createCipheriv as a,createDecipheriv as o,createHash as s,createHmac as c,createPrivateKey as l,createPublicKey as u,createSecretKey as d,diffieHellman as f,generateKeyPair as p,getCiphers as m,pbkdf2 as h,privateDecrypt as g,publicEncrypt as _,randomFillSync as v,timingSafeEqual as y}from"node:crypto";import*as b from"node:util";import{deprecate as x,promisify as S}from"node:util";import*as ee from"node:http";import*as C from"node:https";import{once as te}from"node:events";var ne=Object.create,w=Object.defineProperty,re=Object.getOwnPropertyDescriptor,ie=Object.getOwnPropertyNames,ae=Object.getPrototypeOf,oe=Object.prototype.hasOwnProperty,T=(e,t)=>()=>(e&&(t=e(e=0)),t),E=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),se=(e,t)=>{let n={};for(var r in e)w(n,r,{get:e[r],enumerable:!0});return t||w(n,Symbol.toStringTag,{value:`Module`}),n},ce=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=ie(t),a=0,o=i.length,s;a<o;a++)s=i[a],!oe.call(e,s)&&s!==n&&w(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=re(t,s))||r.enumerable});return e},le=(e,t,n)=>(n=e==null?{}:ne(ae(e)),ce(t||!e||!e.__esModule?w(n,`default`,{value:e,enumerable:!0}):n,e)),ue=e=>oe.call(e,`module.exports`)?e[`module.exports`]:ce(w({},`__esModule`,{value:!0}),e),D=e(import.meta.url),de=E(((e,t)=>{var n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,o=(e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})},s=(e,t,o,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of i(t))!a.call(e,c)&&c!==o&&n(e,c,{get:()=>t[c],enumerable:!(s=r(t,c))||s.enumerable});return e},c=e=>s(n({},`__esModule`,{value:!0}),e),l={};o(l,{version:()=>u}),t.exports=c(l);let u=`3.8.0`;0&&(t.exports={version:u})})),fe=E(((e,t)=>{var n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,o=(e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})},s=(e,t,o,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of i(t))!a.call(e,c)&&c!==o&&n(e,c,{get:()=>t[c],enumerable:!(s=r(t,c))||s.enumerable});return e},c=e=>s(n({},`__esModule`,{value:!0}),e),l={};o(l,{exchangeVercelOidcToken:()=>p}),t.exports=c(l);var u=de();let d=new class{constructor(e){this.maxEntries=e,this.entries=new Map}get(e){let t=this.entries.get(e);if(t!==void 0){if(t.expiresAt<=Date.now()){this.entries.delete(e);return}return this.entries.delete(e),this.entries.set(e,t),t.token}}set({key:e,token:t,expiresAt:n}){for(this.entries.delete(e),this.entries.set(e,{token:t,expiresAt:n});this.entries.size>this.maxEntries;){let e=this.entries.keys().next().value;if(e===void 0)break;this.entries.delete(e)}}}(1e3);async function f(e){let t=JSON.stringify([e.token,e.audience,e.jti]),n=await crypto.subtle.digest(`SHA-256`,new TextEncoder().encode(t));return Array.from(new Uint8Array(n)).map(e=>e.toString(16).padStart(2,`0`)).join(``)}async function p(e){let t=await f(e);if(!e.skipCache){let e=d.get(t);if(e!==void 0)return e}let n=await fetch(`https://oidc.vercel.com/~token`,{method:`POST`,headers:{"Content-Type":`application/json`,Accept:`application/json`,"User-Agent":`@vercel/oidc@${u.version}`},body:JSON.stringify({token:e.token,aud:e.audience,...e.jti?{jti:e.jti}:void 0})});if(!n.ok)throw Error(`Failed to exchange token: ${await m(n)}`);let r;try{r=await n.json()}catch{throw Error(`Failed to exchange token: response was not valid JSON`)}if(!r||typeof r!=`object`||!(`token`in r)||typeof r.token!=`string`)throw Error(`Failed to exchange token: response did not contain a token`);let{token:i}=r,a=`expiry`in r&&typeof r.expiry==`number`?r.expiry:void 0;if(a!==void 0){let e=a*1e3;e>Date.now()&&d.set({key:t,token:i,expiresAt:e})}return i}async function m(e){try{let t=await e.json();if(t&&typeof t==`object`&&`error`in t&&typeof t.error==`string`)return t.error}catch{}return e.statusText||`HTTP ${e.status}`}0&&(t.exports={exchangeVercelOidcToken:p})})),pe=E(((e,t)=>{var n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,o=(e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})},s=(e,t,o,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of i(t))!a.call(e,c)&&c!==o&&n(e,c,{get:()=>t[c],enumerable:!(s=r(t,c))||s.enumerable});return e},c=e=>s(n({},`__esModule`,{value:!0}),e),l={};o(l,{SYMBOL_FOR_REQ_CONTEXT:()=>u,getContext:()=>d}),t.exports=c(l);let u=Symbol.for(`@vercel/request-context`);function d(){return globalThis[u]?.get?.()??{}}0&&(t.exports={SYMBOL_FOR_REQ_CONTEXT:u,getContext:d})})),me=E(((e,t)=>{var n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,o=(e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})},s=(e,t,o,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of i(t))!a.call(e,c)&&c!==o&&n(e,c,{get:()=>t[c],enumerable:!(s=r(t,c))||s.enumerable});return e},c=e=>s(n({},`__esModule`,{value:!0}),e),l={};o(l,{getVercelOidcTokenSync:()=>d}),t.exports=c(l);var u=pe();function d(){let e=(0,u.getContext)().headers?.[`x-vercel-oidc-token`]??process.env.VERCEL_OIDC_TOKEN;if(!e)throw Error(`The 'x-vercel-oidc-token' header is missing from the request.`);return e}0&&(t.exports={getVercelOidcTokenSync:d})})),he=E(((e,t)=>{var n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,o=(e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})},s=(e,t,o,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of i(t))!a.call(e,c)&&c!==o&&n(e,c,{get:()=>t[c],enumerable:!(s=r(t,c))||s.enumerable});return e},c=e=>s(n({},`__esModule`,{value:!0}),e),l={};o(l,{VercelOidcTokenError:()=>u}),t.exports=c(l);var u=class extends Error{constructor(e,t){super(e),this.name=`VercelOidcTokenError`,this.cause=t}toString(){return this.cause?`${this.name}: ${this.message}: ${this.cause}`:`${this.name}: ${this.message}`}};0&&(t.exports={VercelOidcTokenError:u})})),ge=E(((e,t)=>{var n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,o=(e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})},s=(e,t,o,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of i(t))!a.call(e,c)&&c!==o&&n(e,c,{get:()=>t[c],enumerable:!(s=r(t,c))||s.enumerable});return e},c=e=>s(n({},`__esModule`,{value:!0}),e),l={};o(l,{VercelCliError:()=>d,assertValidCwd:()=>p,getCliNotFoundMessage:()=>f,toVercelCliError:()=>m}),t.exports=c(l);var u=D(`node:fs/promises`),d=class extends Error{constructor(e){super(e.message),this.name=`VercelCliError`,this.code=e.code,this.invocation=e.invocation,this.stdout=e.stdout,this.stderr=e.stderr,this.exitCode=e.exitCode,e.cause!==void 0&&(this.cause=e.cause)}};function f(e){let t=[],{localBinSearch:n}=e;n.stopReason===`project-root-marker`?t.push(`Local bin lookup stopped at ${JSON.stringify(n.stoppedAt)} (${JSON.stringify(n.markerPath)}).`):n.stopReason===`filesystem-root`&&t.push(`No project root marker was found from ${JSON.stringify(n.searchRoot)}; local bin lookup reached the filesystem root.`);for(let e of n.skippedNodeModules)t.push(`Skipped ${JSON.stringify(e.directory)}: ${e.reason}.`);for(let n of e.skippedLocalBins)t.push(`Skipped ${JSON.stringify(n.candidate)}: ${n.reason}.`);return t.length===0?`Unable to find a usable Vercel CLI installation.`:[`Unable to find a usable Vercel CLI installation.`,...t].join(`
`)}async function p(e){try{if(!(await(0,u.stat)(e)).isDirectory())throw Error(`not a directory`)}catch{throw new d({code:`VERCEL_CLI_INVALID_CWD`,message:`Working directory ${JSON.stringify(e)} does not exist or is not a directory.`})}}function m(e,t){if(typeof t==`object`&&t){let n=t;if(n.code===`ENOENT`)return new d({code:`VERCEL_CLI_NOT_FOUND`,message:`Unable to find Vercel CLI command ${JSON.stringify(e.command)}.`,invocation:e,cause:t});if(n.code===`EACCES`||n.code===`EPERM`)return new d({code:`VERCEL_CLI_PERMISSION_DENIED`,message:`Permission denied while executing Vercel CLI command ${JSON.stringify(e.command)}.`,invocation:e,cause:t});if(n.timedOut)return new d({code:`VERCEL_CLI_TIMED_OUT`,message:`Timed out while executing Vercel CLI command ${JSON.stringify(e.command)}.`,invocation:e,stdout:n.stdout,stderr:n.stderr,cause:t});if(n.isCanceled)return new d({code:`VERCEL_CLI_CANCELED`,message:`Canceled while executing Vercel CLI command ${JSON.stringify(e.command)}.`,invocation:e,stdout:n.stdout,stderr:n.stderr,cause:t});if(n.signal)return new d({code:`VERCEL_CLI_SIGNALED`,message:`Vercel CLI command ${JSON.stringify(e.command)} exited due to signal ${n.signal}.`,invocation:e,stdout:n.stdout,stderr:n.stderr,cause:t});if(typeof n.exitCode==`number`)return new d({code:`VERCEL_CLI_ERRORED`,message:n.shortMessage??n.message??`Vercel CLI command ${JSON.stringify(e.command)} exited with code ${n.exitCode}.`,invocation:e,stdout:n.stdout,stderr:n.stderr,exitCode:n.exitCode,cause:t})}return new d({code:`VERCEL_CLI_EXEC_FAILED`,message:`Could not execute Vercel CLI command ${JSON.stringify(e.command)}.`,invocation:e,cause:t})}0&&(t.exports={VercelCliError:d,assertValidCwd:p,getCliNotFoundMessage:f,toVercelCliError:m})})),_e=E(((e,t)=>{t.exports=a,a.sync=o;var n=D(`fs`);function r(e,t){var n=t.pathExt===void 0?process.env.PATHEXT:t.pathExt;if(!n||(n=n.split(`;`),n.indexOf(``)!==-1))return!0;for(var r=0;r<n.length;r++){var i=n[r].toLowerCase();if(i&&e.substr(-i.length).toLowerCase()===i)return!0}return!1}function i(e,t,n){return!e.isSymbolicLink()&&!e.isFile()?!1:r(t,n)}function a(e,t,r){n.stat(e,function(n,a){r(n,n?!1:i(a,e,t))})}function o(e,t){return i(n.statSync(e),e,t)}})),ve=E(((e,t)=>{t.exports=r,r.sync=i;var n=D(`fs`);function r(e,t,r){n.stat(e,function(e,n){r(e,e?!1:a(n,t))})}function i(e,t){return a(n.statSync(e),t)}function a(e,t){return e.isFile()&&o(e,t)}function o(e,t){var n=e.mode,r=e.uid,i=e.gid,a=t.uid===void 0?process.getuid&&process.getuid():t.uid,o=t.gid===void 0?process.getgid&&process.getgid():t.gid,s=64,c=8,l=1,u=s|c;return n&l||n&c&&i===o||n&s&&r===a||n&u&&a===0}})),ye=E(((e,t)=>{D(`fs`);var n=process.platform===`win32`||global.TESTING_WINDOWS?_e():ve();t.exports=r,r.sync=i;function r(e,t,i){if(typeof t==`function`&&(i=t,t={}),!i){if(typeof Promise!=`function`)throw TypeError(`callback not provided`);return new Promise(function(n,i){r(e,t||{},function(e,t){e?i(e):n(t)})})}n(e,t||{},function(e,n){e&&(e.code===`EACCES`||t&&t.ignoreErrors)&&(e=null,n=!1),i(e,n)})}function i(e,t){try{return n.sync(e,t||{})}catch(e){if(t&&t.ignoreErrors||e.code===`EACCES`)return!1;throw e}}})),be=E(((e,t)=>{let n=process.platform===`win32`||process.env.OSTYPE===`cygwin`||process.env.OSTYPE===`msys`,r=D(`path`),i=n?`;`:`:`,a=ye(),o=e=>Object.assign(Error(`not found: ${e}`),{code:`ENOENT`}),s=(e,t)=>{let r=t.colon||i,a=e.match(/\//)||n&&e.match(/\\/)?[``]:[...n?[process.cwd()]:[],...(t.path||process.env.PATH||``).split(r)],o=n?t.pathExt||process.env.PATHEXT||`.EXE;.CMD;.BAT;.COM`:``,s=n?o.split(r):[``];return n&&e.indexOf(`.`)!==-1&&s[0]!==``&&s.unshift(``),{pathEnv:a,pathExt:s,pathExtExe:o}},c=(e,t,n)=>{typeof t==`function`&&(n=t,t={}),t||={};let{pathEnv:i,pathExt:c,pathExtExe:l}=s(e,t),u=[],d=n=>new Promise((a,s)=>{if(n===i.length)return t.all&&u.length?a(u):s(o(e));let c=i[n],l=/^".*"$/.test(c)?c.slice(1,-1):c,d=r.join(l,e);a(f(!l&&/^\.[\\\/]/.test(e)?e.slice(0,2)+d:d,n,0))}),f=(e,n,r)=>new Promise((i,o)=>{if(r===c.length)return i(d(n+1));let s=c[r];a(e+s,{pathExt:l},(a,o)=>{if(!a&&o)if(t.all)u.push(e+s);else return i(e+s);return i(f(e,n,r+1))})});return n?d(0).then(e=>n(null,e),n):d(0)};t.exports=c,c.sync=(e,t)=>{t||={};let{pathEnv:n,pathExt:i,pathExtExe:c}=s(e,t),l=[];for(let o=0;o<n.length;o++){let s=n[o],u=/^".*"$/.test(s)?s.slice(1,-1):s,d=r.join(u,e),f=!u&&/^\.[\\\/]/.test(e)?e.slice(0,2)+d:d;for(let e=0;e<i.length;e++){let n=f+i[e];try{if(a.sync(n,{pathExt:c}))if(t.all)l.push(n);else return n}catch{}}}if(t.all&&l.length)return l;if(t.nothrow)return null;throw o(e)}})),xe=E(((e,t)=>{let n=(e={})=>{let t=e.env||process.env;return(e.platform||process.platform)===`win32`?Object.keys(t).reverse().find(e=>e.toUpperCase()===`PATH`)||`Path`:`PATH`};t.exports=n,t.exports.default=n})),Se=E(((e,t)=>{let n=D(`path`),r=be(),i=xe();function a(e,t){let a=e.options.env||process.env,o=process.cwd(),s=e.options.cwd!=null,c=s&&process.chdir!==void 0&&!process.chdir.disabled;if(c)try{process.chdir(e.options.cwd)}catch{}let l;try{l=r.sync(e.command,{path:a[i({env:a})],pathExt:t?n.delimiter:void 0})}catch{}finally{c&&process.chdir(o)}return l&&=n.resolve(s?e.options.cwd:``,l),l}function o(e){return a(e)||a(e,!0)}t.exports=o})),Ce=E(((e,t)=>{let n=/([()\][%!^"`<>&|;, *?])/g;function r(e){return e=e.replace(n,`^$1`),e}function i(e,t){return e=`${e}`,e=e.replace(/(?=(\\+?)?)\1"/g,`$1$1\\"`),e=e.replace(/(?=(\\+?)?)\1$/,`$1$1`),e=`"${e}"`,e=e.replace(n,`^$1`),t&&(e=e.replace(n,`^$1`)),e}t.exports.command=r,t.exports.argument=i})),we=E(((e,t)=>{t.exports=/^#!(.*)/})),Te=E(((e,t)=>{let n=we();t.exports=(e=``)=>{let t=e.match(n);if(!t)return null;let[r,i]=t[0].replace(/#! ?/,``).split(` `),a=r.split(`/`).pop();return a===`env`?i:i?`${a} ${i}`:a}})),Ee=E(((e,t)=>{let n=D(`fs`),r=Te();function i(e){let t=Buffer.alloc(150),i;try{i=n.openSync(e,`r`),n.readSync(i,t,0,150,0),n.closeSync(i)}catch{}return r(t.toString())}t.exports=i})),De=E(((e,t)=>{let n=D(`path`),r=Se(),i=Ce(),a=Ee(),o=process.platform===`win32`,s=/\.(?:com|exe)$/i,c=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function l(e){e.file=r(e);let t=e.file&&a(e.file);return t?(e.args.unshift(e.file),e.command=t,r(e)):e.file}function u(e){if(!o)return e;let t=l(e),r=!s.test(t);if(e.options.forceShell||r){let r=c.test(t);e.command=n.normalize(e.command),e.command=i.command(e.command),e.args=e.args.map(e=>i.argument(e,r)),e.args=[`/d`,`/s`,`/c`,`"${[e.command].concat(e.args).join(` `)}"`],e.command=process.env.comspec||`cmd.exe`,e.options.windowsVerbatimArguments=!0}return e}function d(e,t,n){t&&!Array.isArray(t)&&(n=t,t=null),t=t?t.slice(0):[],n=Object.assign({},n);let r={command:e,args:t,options:n,file:void 0,original:{command:e,args:t}};return n.shell?r:u(r)}t.exports=d})),Oe=E(((e,t)=>{let n=process.platform===`win32`;function r(e,t){return Object.assign(Error(`${t} ${e.command} ENOENT`),{code:`ENOENT`,errno:`ENOENT`,syscall:`${t} ${e.command}`,path:e.command,spawnargs:e.args})}function i(e,t){if(!n)return;let r=e.emit;e.emit=function(n,i){if(n===`exit`){let n=a(i,t);if(n)return r.call(e,`error`,n)}return r.apply(e,arguments)}}function a(e,t){return n&&e===1&&!t.file?r(t.original,`spawn`):null}function o(e,t){return n&&e===1&&!t.file?r(t.original,`spawnSync`):null}t.exports={hookChildProcess:i,verifyENOENT:a,verifyENOENTSync:o,notFoundError:r}})),ke=E(((e,t)=>{let n=D(`child_process`),r=De(),i=Oe();function a(e,t,a){let o=r(e,t,a),s=n.spawn(o.command,o.args,o.options);return i.hookChildProcess(s,o),s}function o(e,t,a){let o=r(e,t,a),s=n.spawnSync(o.command,o.args,o.options);return s.error=s.error||i.verifyENOENTSync(s.status,o),s}t.exports=a,t.exports.spawn=a,t.exports.sync=o,t.exports._parse=r,t.exports._enoent=i})),Ae=E(((e,t)=>{t.exports=e=>{let t=typeof e==`string`?`
`:10,n=typeof e==`string`?`\r`:13;return e[e.length-1]===t&&(e=e.slice(0,e.length-1)),e[e.length-1]===n&&(e=e.slice(0,e.length-1)),e}})),je=E(((e,t)=>{let n=D(`path`),r=xe(),i=e=>{e={cwd:process.cwd(),path:process.env[r()],execPath:process.execPath,...e};let t,i=n.resolve(e.cwd),a=[];for(;t!==i;)a.push(n.join(i,`node_modules/.bin`)),t=i,i=n.resolve(i,`..`);let o=n.resolve(e.cwd,e.execPath,`..`);return a.push(o),a.concat(e.path).join(n.delimiter)};t.exports=i,t.exports.default=i,t.exports.env=e=>{e={env:process.env,...e};let n={...e.env},i=r({env:n});return e.path=n[i],n[i]=t.exports(e),n}})),Me=E(((e,t)=>{let n=(e,t)=>{for(let n of Reflect.ownKeys(t))Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n));return e};t.exports=n,t.exports.default=n})),Ne=E(((e,t)=>{let n=Me(),r=new WeakMap,i=(e,t={})=>{if(typeof e!=`function`)throw TypeError(`Expected a function`);let i,a=0,o=e.displayName||e.name||`<anonymous>`,s=function(...n){if(r.set(s,++a),a===1)i=e.apply(this,n),e=null;else if(t.throw===!0)throw Error(`Function \`${o}\` can only be called once`);return i};return n(s,e),r.set(s,a),s};t.exports=i,t.exports.default=i,t.exports.callCount=e=>{if(!r.has(e))throw Error(`The given function \`${e.name}\` is not wrapped by the \`onetime\` package`);return r.get(e)}})),Pe=E((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.SIGNALS=void 0,e.SIGNALS=[{name:`SIGHUP`,number:1,action:`terminate`,description:`Terminal closed`,standard:`posix`},{name:`SIGINT`,number:2,action:`terminate`,description:`User interruption with CTRL-C`,standard:`ansi`},{name:`SIGQUIT`,number:3,action:`core`,description:`User interruption with CTRL-\\`,standard:`posix`},{name:`SIGILL`,number:4,action:`core`,description:`Invalid machine instruction`,standard:`ansi`},{name:`SIGTRAP`,number:5,action:`core`,description:`Debugger breakpoint`,standard:`posix`},{name:`SIGABRT`,number:6,action:`core`,description:`Aborted`,standard:`ansi`},{name:`SIGIOT`,number:6,action:`core`,description:`Aborted`,standard:`bsd`},{name:`SIGBUS`,number:7,action:`core`,description:`Bus error due to misaligned, non-existing address or paging error`,standard:`bsd`},{name:`SIGEMT`,number:7,action:`terminate`,description:`Command should be emulated but is not implemented`,standard:`other`},{name:`SIGFPE`,number:8,action:`core`,description:`Floating point arithmetic error`,standard:`ansi`},{name:`SIGKILL`,number:9,action:`terminate`,description:`Forced termination`,standard:`posix`,forced:!0},{name:`SIGUSR1`,number:10,action:`terminate`,description:`Application-specific signal`,standard:`posix`},{name:`SIGSEGV`,number:11,action:`core`,description:`Segmentation fault`,standard:`ansi`},{name:`SIGUSR2`,number:12,action:`terminate`,description:`Application-specific signal`,standard:`posix`},{name:`SIGPIPE`,number:13,action:`terminate`,description:`Broken pipe or socket`,standard:`posix`},{name:`SIGALRM`,number:14,action:`terminate`,description:`Timeout or timer`,standard:`posix`},{name:`SIGTERM`,number:15,action:`terminate`,description:`Termination`,standard:`ansi`},{name:`SIGSTKFLT`,number:16,action:`terminate`,description:`Stack is empty or overflowed`,standard:`other`},{name:`SIGCHLD`,number:17,action:`ignore`,description:`Child process terminated, paused or unpaused`,standard:`posix`},{name:`SIGCLD`,number:17,action:`ignore`,description:`Child process terminated, paused or unpaused`,standard:`other`},{name:`SIGCONT`,number:18,action:`unpause`,description:`Unpaused`,standard:`posix`,forced:!0},{name:`SIGSTOP`,number:19,action:`pause`,description:`Paused`,standard:`posix`,forced:!0},{name:`SIGTSTP`,number:20,action:`pause`,description:`Paused using CTRL-Z or "suspend"`,standard:`posix`},{name:`SIGTTIN`,number:21,action:`pause`,description:`Background process cannot read terminal input`,standard:`posix`},{name:`SIGBREAK`,number:21,action:`terminate`,description:`User interruption with CTRL-BREAK`,standard:`other`},{name:`SIGTTOU`,number:22,action:`pause`,description:`Background process cannot write to terminal output`,standard:`posix`},{name:`SIGURG`,number:23,action:`ignore`,description:`Socket received out-of-band data`,standard:`bsd`},{name:`SIGXCPU`,number:24,action:`core`,description:`Process timed out`,standard:`bsd`},{name:`SIGXFSZ`,number:25,action:`core`,description:`File too big`,standard:`bsd`},{name:`SIGVTALRM`,number:26,action:`terminate`,description:`Timeout or timer`,standard:`bsd`},{name:`SIGPROF`,number:27,action:`terminate`,description:`Timeout or timer`,standard:`bsd`},{name:`SIGWINCH`,number:28,action:`ignore`,description:`Terminal window size changed`,standard:`bsd`},{name:`SIGIO`,number:29,action:`terminate`,description:`I/O is available`,standard:`other`},{name:`SIGPOLL`,number:29,action:`terminate`,description:`Watched event`,standard:`other`},{name:`SIGINFO`,number:29,action:`ignore`,description:`Request for process information`,standard:`other`},{name:`SIGPWR`,number:30,action:`terminate`,description:`Device running out of power`,standard:`systemv`},{name:`SIGSYS`,number:31,action:`core`,description:`Invalid system call`,standard:`other`},{name:`SIGUNUSED`,number:31,action:`terminate`,description:`Invalid system call`,standard:`other`}]})),Fe=E((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.SIGRTMAX=e.getRealtimeSignals=void 0,e.getRealtimeSignals=function(){let e=r-n+1;return Array.from({length:e},t)};let t=function(e,t){return{name:`SIGRT${t+1}`,number:n+t,action:`terminate`,description:`Application-specific signal (realtime)`,standard:`posix`}},n=34,r=64;e.SIGRTMAX=64})),Ie=E((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getSignals=void 0;var t=D(`os`),n=Pe(),r=Fe();e.getSignals=function(){let e=(0,r.getRealtimeSignals)();return[...n.SIGNALS,...e].map(i)};let i=function({name:e,number:n,description:r,action:i,forced:a=!1,standard:o}){let{signals:{[e]:s}}=t.constants,c=s!==void 0;return{name:e,number:c?s:n,description:r,supported:c,action:i,forced:a,standard:o}}})),Le=E((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.signalsByNumber=e.signalsByName=void 0;var t=D(`os`),n=Ie(),r=Fe();let i=function(){return(0,n.getSignals)().reduce(a,{})},a=function(e,{name:t,number:n,description:r,supported:i,action:a,forced:o,standard:s}){return{...e,[t]:{name:t,number:n,description:r,supported:i,action:a,forced:o,standard:s}}};e.signalsByName=i();let o=function(){let e=(0,n.getSignals)(),t=r.SIGRTMAX+1,i=Array.from({length:t},(t,n)=>s(n,e));return Object.assign({},...i)},s=function(e,t){let n=c(e,t);if(n===void 0)return{};let{name:r,description:i,supported:a,action:o,forced:s,standard:l}=n;return{[e]:{name:r,number:e,description:i,supported:a,action:o,forced:s,standard:l}}},c=function(e,n){let r=n.find(({name:n})=>t.constants.signals[n]===e);return r===void 0?n.find(t=>t.number===e):r};e.signalsByNumber=o()})),Re=E(((e,t)=>{let{signalsByName:n}=Le(),r=({timedOut:e,timeout:t,errorCode:n,signal:r,signalDescription:i,exitCode:a,isCanceled:o})=>e?`timed out after ${t} milliseconds`:o?`was canceled`:n===void 0?r===void 0?a===void 0?`failed`:`failed with exit code ${a}`:`was killed with ${r} (${i})`:`failed with ${n}`;t.exports=({stdout:e,stderr:t,all:i,error:a,signal:o,exitCode:s,command:c,escapedCommand:l,timedOut:u,isCanceled:d,killed:f,parsed:{options:{timeout:p}}})=>{s=s===null?void 0:s,o=o===null?void 0:o;let m=o===void 0?void 0:n[o].description,h=`Command ${r({timedOut:u,timeout:p,errorCode:a&&a.code,signal:o,signalDescription:m,exitCode:s,isCanceled:d})}: ${c}`,g=Object.prototype.toString.call(a)===`[object Error]`,_=g?`${h}\n${a.message}`:h,v=[_,t,e].filter(Boolean).join(`
`);return g?(a.originalMessage=a.message,a.message=v):a=Error(v),a.shortMessage=_,a.command=c,a.escapedCommand=l,a.exitCode=s,a.signal=o,a.signalDescription=m,a.stdout=e,a.stderr=t,i!==void 0&&(a.all=i),`bufferedData`in a&&delete a.bufferedData,a.failed=!0,a.timedOut=!!u,a.isCanceled=d,a.killed=f&&!u,a}})),ze=E(((e,t)=>{let n=[`stdin`,`stdout`,`stderr`],r=e=>n.some(t=>e[t]!==void 0),i=e=>{if(!e)return;let{stdio:t}=e;if(t===void 0)return n.map(t=>e[t]);if(r(e))throw Error(`It's not possible to provide \`stdio\` in combination with one of ${n.map(e=>`\`${e}\``).join(`, `)}`);if(typeof t==`string`)return t;if(!Array.isArray(t))throw TypeError(`Expected \`stdio\` to be of type \`string\` or \`Array\`, got \`${typeof t}\``);let i=Math.max(t.length,n.length);return Array.from({length:i},(e,n)=>t[n])};t.exports=i,t.exports.node=e=>{let t=i(e);return t===`ipc`?`ipc`:t===void 0||typeof t==`string`?[t,t,t,`ipc`]:t.includes(`ipc`)?t:[...t,`ipc`]}})),Be=E(((e,t)=>{t.exports=[`SIGABRT`,`SIGALRM`,`SIGHUP`,`SIGINT`,`SIGTERM`],process.platform!==`win32`&&t.exports.push(`SIGVTALRM`,`SIGXCPU`,`SIGXFSZ`,`SIGUSR2`,`SIGTRAP`,`SIGSYS`,`SIGQUIT`,`SIGIOT`),process.platform===`linux`&&t.exports.push(`SIGIO`,`SIGPOLL`,`SIGPWR`,`SIGSTKFLT`,`SIGUNUSED`)})),Ve=E(((e,t)=>{var n=global.process;let r=function(e){return e&&typeof e==`object`&&typeof e.removeListener==`function`&&typeof e.emit==`function`&&typeof e.reallyExit==`function`&&typeof e.listeners==`function`&&typeof e.kill==`function`&&typeof e.pid==`number`&&typeof e.on==`function`};if(!r(n))t.exports=function(){return function(){}};else{var i=D(`assert`),a=Be(),o=/^win/i.test(n.platform),s=D(`events`);typeof s!=`function`&&(s=s.EventEmitter);var c;n.__signal_exit_emitter__?c=n.__signal_exit_emitter__:(c=n.__signal_exit_emitter__=new s,c.count=0,c.emitted={}),c.infinite||(c.setMaxListeners(1/0),c.infinite=!0),t.exports=function(e,t){if(!r(global.process))return function(){};i.equal(typeof e,`function`,`a callback must be provided for exit handler`),f===!1&&p();var n=`exit`;return t&&t.alwaysLast&&(n=`afterexit`),c.on(n,e),function(){c.removeListener(n,e),c.listeners(`exit`).length===0&&c.listeners(`afterexit`).length===0&&l()}};var l=function(){!f||!r(global.process)||(f=!1,a.forEach(function(e){try{n.removeListener(e,d[e])}catch{}}),n.emit=g,n.reallyExit=m,--c.count)};t.exports.unload=l;var u=function(e,t,n){c.emitted[e]||(c.emitted[e]=!0,c.emit(e,t,n))},d={};a.forEach(function(e){d[e]=function(){r(global.process)&&n.listeners(e).length===c.count&&(l(),u(`exit`,null,e),u(`afterexit`,null,e),o&&e===`SIGHUP`&&(e=`SIGINT`),n.kill(n.pid,e))}}),t.exports.signals=function(){return a};var f=!1,p=function(){f||!r(global.process)||(f=!0,c.count+=1,a=a.filter(function(e){try{return n.on(e,d[e]),!0}catch{return!1}}),n.emit=_,n.reallyExit=h)};t.exports.load=p;var m=n.reallyExit,h=function(e){r(global.process)&&(n.exitCode=e||0,u(`exit`,n.exitCode,null),u(`afterexit`,n.exitCode,null),m.call(n,n.exitCode))},g=n.emit,_=function(e,t){if(e===`exit`&&r(global.process)){t!==void 0&&(n.exitCode=t);var i=g.apply(this,arguments);return u(`exit`,n.exitCode,null),u(`afterexit`,n.exitCode,null),i}else return g.apply(this,arguments)}}})),He=E(((e,t)=>{let n=D(`os`),r=Ve(),i=(e,t=`SIGTERM`,n={})=>{let r=e(t);return a(e,t,n,r),r},a=(e,t,n,r)=>{if(!o(t,n,r))return;let i=c(n),a=setTimeout(()=>{e(`SIGKILL`)},i);a.unref&&a.unref()},o=(e,{forceKillAfterTimeout:t},n)=>s(e)&&t!==!1&&n,s=e=>e===n.constants.signals.SIGTERM||typeof e==`string`&&e.toUpperCase()===`SIGTERM`,c=({forceKillAfterTimeout:e=!0})=>{if(e===!0)return 5e3;if(!Number.isFinite(e)||e<0)throw TypeError(`Expected the \`forceKillAfterTimeout\` option to be a non-negative integer, got \`${e}\` (${typeof e})`);return e},l=(e,t)=>{e.kill()&&(t.isCanceled=!0)},u=(e,t,n)=>{e.kill(t),n(Object.assign(Error(`Timed out`),{timedOut:!0,signal:t}))};t.exports={spawnedKill:i,spawnedCancel:l,setupTimeout:(e,{timeout:t,killSignal:n=`SIGTERM`},r)=>{if(t===0||t===void 0)return r;let i,a=new Promise((r,a)=>{i=setTimeout(()=>{u(e,n,a)},t)}),o=r.finally(()=>{clearTimeout(i)});return Promise.race([a,o])},validateTimeout:({timeout:e})=>{if(e!==void 0&&(!Number.isFinite(e)||e<0))throw TypeError(`Expected the \`timeout\` option to be a non-negative integer, got \`${e}\` (${typeof e})`)},setExitHandler:async(e,{cleanup:t,detached:n},i)=>{if(!t||n)return i;let a=r(()=>{e.kill()});return i.finally(()=>{a()})}}})),Ue=E(((e,t)=>{let n=e=>typeof e==`object`&&!!e&&typeof e.pipe==`function`;n.writable=e=>n(e)&&e.writable!==!1&&typeof e._write==`function`&&typeof e._writableState==`object`,n.readable=e=>n(e)&&e.readable!==!1&&typeof e._read==`function`&&typeof e._readableState==`object`,n.duplex=e=>n.writable(e)&&n.readable(e),n.transform=e=>n.duplex(e)&&typeof e._transform==`function`,t.exports=n})),We=E(((e,t)=>{let{PassThrough:n}=D(`stream`);t.exports=e=>{e={...e};let{array:t}=e,{encoding:r}=e,i=r===`buffer`,a=!1;t?a=!(r||i):r||=`utf8`,i&&(r=null);let o=new n({objectMode:a});r&&o.setEncoding(r);let s=0,c=[];return o.on(`data`,e=>{c.push(e),a?s=c.length:s+=e.length}),o.getBufferedValue=()=>t?c:i?Buffer.concat(c,s):c.join(``),o.getBufferedLength=()=>s,o}})),Ge=E(((e,t)=>{let{constants:n}=D(`buffer`),r=D(`stream`),{promisify:i}=D(`util`),a=We(),o=i(r.pipeline);var s=class extends Error{constructor(){super(`maxBuffer exceeded`),this.name=`MaxBufferError`}};async function c(e,t){if(!e)throw Error(`Expected a stream`);t={maxBuffer:1/0,...t};let{maxBuffer:r}=t,i=a(t);return await new Promise((t,a)=>{let c=e=>{e&&i.getBufferedLength()<=n.MAX_LENGTH&&(e.bufferedData=i.getBufferedValue()),a(e)};(async()=>{try{await o(e,i),t()}catch(e){c(e)}})(),i.on(`data`,()=>{i.getBufferedLength()>r&&c(new s)})}),i.getBufferedValue()}t.exports=c,t.exports.buffer=(e,t)=>c(e,{...t,encoding:`buffer`}),t.exports.array=(e,t)=>c(e,{...t,array:!0}),t.exports.MaxBufferError=s})),Ke=E(((e,t)=>{let{PassThrough:n}=D(`stream`);t.exports=function(){var e=[],t=new n({objectMode:!0});return t.setMaxListeners(0),t.add=r,t.isEmpty=i,t.on(`unpipe`,a),Array.prototype.slice.call(arguments).forEach(r),t;function r(n){return Array.isArray(n)?(n.forEach(r),this):(e.push(n),n.once(`end`,a.bind(null,n)),n.once(`error`,t.emit.bind(t,`error`)),n.pipe(t,{end:!1}),this)}function i(){return e.length==0}function a(n){e=e.filter(function(e){return e!==n}),!e.length&&t.readable&&t.end()}}})),qe=E(((e,t)=>{let n=Ue(),r=Ge(),i=Ke(),a=(e,t)=>{t===void 0||e.stdin===void 0||(n(t)?t.pipe(e.stdin):e.stdin.end(t))},o=(e,{all:t})=>{if(!t||!e.stdout&&!e.stderr)return;let n=i();return e.stdout&&n.add(e.stdout),e.stderr&&n.add(e.stderr),n},s=async(e,t)=>{if(e){e.destroy();try{return await t}catch(e){return e.bufferedData}}},c=(e,{encoding:t,buffer:n,maxBuffer:i})=>{if(!(!e||!n))return t?r(e,{encoding:t,maxBuffer:i}):r.buffer(e,{maxBuffer:i})};t.exports={handleInput:a,makeAllStream:o,getSpawnedResult:async({stdout:e,stderr:t,all:n},{encoding:r,buffer:i,maxBuffer:a},o)=>{let l=c(e,{encoding:r,buffer:i,maxBuffer:a}),u=c(t,{encoding:r,buffer:i,maxBuffer:a}),d=c(n,{encoding:r,buffer:i,maxBuffer:a*2});try{return await Promise.all([o,l,u,d])}catch(r){return Promise.all([{error:r,signal:r.signal,timedOut:r.timedOut},s(e,l),s(t,u),s(n,d)])}},validateInputSync:({input:e})=>{if(n(e))throw TypeError("The `input` option cannot be a stream in sync mode")}}})),Je=E(((e,t)=>{let n=(async()=>{})().constructor.prototype,r=[`then`,`catch`,`finally`].map(e=>[e,Reflect.getOwnPropertyDescriptor(n,e)]);t.exports={mergePromise:(e,t)=>{for(let[n,i]of r){let r=typeof t==`function`?(...e)=>Reflect.apply(i.value,t(),e):i.value.bind(t);Reflect.defineProperty(e,n,{...i,value:r})}return e},getSpawnedPromise:e=>new Promise((t,n)=>{e.on(`exit`,(e,n)=>{t({exitCode:e,signal:n})}),e.on(`error`,e=>{n(e)}),e.stdin&&e.stdin.on(`error`,e=>{n(e)})})}})),Ye=E(((e,t)=>{let n=(e,t=[])=>Array.isArray(t)?[e,...t]:[e],r=/^[\w.-]+$/,i=/"/g,a=e=>typeof e!=`string`||r.test(e)?e:`"${e.replace(i,`\\"`)}"`,o=(e,t)=>n(e,t).join(` `),s=(e,t)=>n(e,t).map(e=>a(e)).join(` `),c=/ +/g;t.exports={joinCommand:o,getEscapedCommand:s,parseCommand:e=>{let t=[];for(let n of e.trim().split(c)){let e=t[t.length-1];e&&e.endsWith(`\\`)?t[t.length-1]=`${e.slice(0,-1)} ${n}`:t.push(n)}return t}}})),Xe=E(((e,t)=>{let n=D(`path`),r=D(`child_process`),i=ke(),a=Ae(),o=je(),s=Ne(),c=Re(),l=ze(),{spawnedKill:u,spawnedCancel:d,setupTimeout:f,validateTimeout:p,setExitHandler:m}=He(),{handleInput:h,getSpawnedResult:g,makeAllStream:_,validateInputSync:v}=qe(),{mergePromise:y,getSpawnedPromise:b}=Je(),{joinCommand:x,parseCommand:S,getEscapedCommand:ee}=Ye(),C=({env:e,extendEnv:t,preferLocal:n,localDir:r,execPath:i})=>{let a=t?{...process.env,...e}:e;return n?o.env({env:a,cwd:r,execPath:i}):a},te=(e,t,r={})=>{let a=i._parse(e,t,r);return e=a.command,t=a.args,r=a.options,r={maxBuffer:1e8,buffer:!0,stripFinalNewline:!0,extendEnv:!0,preferLocal:!1,localDir:r.cwd||process.cwd(),execPath:process.execPath,encoding:`utf8`,reject:!0,cleanup:!0,all:!1,windowsHide:!0,...r},r.env=C(r),r.stdio=l(r),process.platform===`win32`&&n.basename(e,`.exe`)===`cmd`&&t.unshift(`/q`),{file:e,args:t,options:r,parsed:a}},ne=(e,t,n)=>typeof t!=`string`&&!Buffer.isBuffer(t)?n===void 0?void 0:``:e.stripFinalNewline?a(t):t,w=(e,t,n)=>{let i=te(e,t,n),a=x(e,t),o=ee(e,t);p(i.options);let l;try{l=r.spawn(i.file,i.args,i.options)}catch(e){return y(new r.ChildProcess,Promise.reject(c({error:e,stdout:``,stderr:``,all:``,command:a,escapedCommand:o,parsed:i,timedOut:!1,isCanceled:!1,killed:!1})))}let v=b(l),S=f(l,i.options,v),C=m(l,i.options,S),w={isCanceled:!1};l.kill=u.bind(null,l.kill.bind(l)),l.cancel=d.bind(null,l,w);let re=s(async()=>{let[{error:e,exitCode:t,signal:n,timedOut:r},s,u,d]=await g(l,i.options,C),f=ne(i.options,s),p=ne(i.options,u),m=ne(i.options,d);if(e||t!==0||n!==null){let s=c({error:e,exitCode:t,signal:n,stdout:f,stderr:p,all:m,command:a,escapedCommand:o,parsed:i,timedOut:r,isCanceled:w.isCanceled,killed:l.killed});if(!i.options.reject)return s;throw s}return{command:a,escapedCommand:o,exitCode:0,stdout:f,stderr:p,all:m,failed:!1,timedOut:!1,isCanceled:!1,killed:!1}});return h(l,i.options.input),l.all=_(l,i.options),y(l,re)};t.exports=w,t.exports.sync=(e,t,n)=>{let i=te(e,t,n),a=x(e,t),o=ee(e,t);v(i.options);let s;try{s=r.spawnSync(i.file,i.args,i.options)}catch(e){throw c({error:e,stdout:``,stderr:``,all:``,command:a,escapedCommand:o,parsed:i,timedOut:!1,isCanceled:!1,killed:!1})}let l=ne(i.options,s.stdout,s.error),u=ne(i.options,s.stderr,s.error);if(s.error||s.status!==0||s.signal!==null){let e=c({stdout:l,stderr:u,error:s.error,signal:s.signal,exitCode:s.status,command:a,escapedCommand:o,parsed:i,timedOut:s.error&&s.error.code===`ETIMEDOUT`,isCanceled:!1,killed:s.signal!==null});if(!i.options.reject)return e;throw e}return{command:a,escapedCommand:o,exitCode:0,stdout:l,stderr:u,failed:!1,timedOut:!1,isCanceled:!1,killed:!1}},t.exports.command=(e,t)=>{let[n,...r]=S(e);return w(n,r,t)},t.exports.commandSync=(e,t)=>{let[n,...r]=S(e);return w.sync(n,r,t)},t.exports.node=(e,t,n={})=>{t&&!Array.isArray(t)&&typeof t==`object`&&(n=t,t=[]);let r=l.node(n),i=process.execArgv.filter(e=>!e.startsWith(`--inspect`)),{nodePath:a=process.execPath,nodeOptions:o=i}=n;return w(a,[...o,e,...Array.isArray(t)?t:[]],{...n,stdin:void 0,stdout:void 0,stderr:void 0,stdio:r,shell:!1})}})),Ze=E(((e,t)=>{var n=Object.create,r=Object.defineProperty,i=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,o=Object.getPrototypeOf,s=Object.prototype.hasOwnProperty,c=(e,t)=>{for(var n in t)r(e,n,{get:t[n],enumerable:!0})},l=(e,t,n,o)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of a(t))!s.call(e,c)&&c!==n&&r(e,c,{get:()=>t[c],enumerable:!(o=i(t,c))||o.enumerable});return e},u=(e,t,i)=>(i=e==null?{}:n(o(e)),l(t||!e||!e.__esModule?r(i,`default`,{value:e,enumerable:!0}):i,e)),d=e=>l(r({},`__esModule`,{value:!0}),e),f={};c(f,{getEnvPath:()=>g,prependPathEntries:()=>m,setEnvPath:()=>_,splitPath:()=>h}),t.exports=d(f);var p=u(D(`node:path`));function m(e,t){let n=e.split(p.default.delimiter).filter(Boolean),r=[];for(let e of t)!n.includes(e)&&!r.includes(e)&&r.push(e);return r.length===0?e:e===``||e===p.default.delimiter?`${r.join(p.default.delimiter)}${e}`:[...r,e].join(p.default.delimiter)}function h(e){return e.split(p.default.delimiter).filter(Boolean)}function g(e=process.env){if(process.platform!==`win32`)return e.PATH??``;let t=Object.keys(e).filter(e=>e.toLowerCase()===`path`);for(let n=t.length-1;n>=0;n--){let r=e[t[n]];if(r!==void 0)return r}return``}function _(e=process.env,t){if(process.platform!==`win32`)return{...e,PATH:t};let n={...e};for(let e of Object.keys(n))e!==`PATH`&&e.toLowerCase()===`path`&&delete n[e];return n.PATH=t,n}0&&(t.exports={getEnvPath:g,prependPathEntries:m,setEnvPath:_,splitPath:h})})),Qe=E(((e,t)=>{var n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,o=(e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})},s=(e,t,o,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of i(t))!a.call(e,c)&&c!==o&&n(e,c,{get:()=>t[c],enumerable:!(s=r(t,c))||s.enumerable});return e},c=e=>s(n({},`__esModule`,{value:!0}),e),l={};o(l,{getErrorMessage:()=>u,isMissingPathError:()=>d}),t.exports=c(l);function u(e){return e instanceof Error?e.message:String(e)}function d(e){return typeof e==`object`&&!!e&&`code`in e&&(e.code===`ENOENT`||e.code===`ENOTDIR`)}0&&(t.exports={getErrorMessage:u,isMissingPathError:d})})),$e=E(((e,t)=>{var n=Object.create,r=Object.defineProperty,i=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,o=Object.getPrototypeOf,s=Object.prototype.hasOwnProperty,c=(e,t)=>{for(var n in t)r(e,n,{get:t[n],enumerable:!0})},l=(e,t,n,o)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of a(t))!s.call(e,c)&&c!==n&&r(e,c,{get:()=>t[c],enumerable:!(o=i(t,c))||o.enumerable});return e},u=(e,t,i)=>(i=e==null?{}:n(o(e)),l(t||!e||!e.__esModule?r(i,`default`,{value:e,enumerable:!0}):i,e)),d=e=>l(r({},`__esModule`,{value:!0}),e),f={};c(f,{getCanonicalPath:()=>g,getCommandBase:()=>x,getDirectoriesBetween:()=>_,isNodeScript:()=>y,isSubpath:()=>b,statIfExists:()=>v}),t.exports=d(f);var p=D(`node:fs/promises`),m=u(D(`node:path`)),h=Qe();async function g(e){try{return await(0,p.realpath)(e)}catch{return e}}function _(e,t){let n=[],r=m.default.resolve(t),i=m.default.resolve(e);for(;;){if(n.push(r),r===i)return n.reverse();let e=m.default.dirname(r);if(e===r)return[];r=e}}async function v(e){try{return{stats:await(0,p.stat)(e)}}catch(e){return(0,h.isMissingPathError)(e)?{missing:!0}:{reason:`could not inspect: ${(0,h.getErrorMessage)(e)}`}}}function y(e){return[`.js`,`.cjs`,`.mjs`].includes(m.default.extname(e))}function b(e,t){let n=m.default.relative(e,t);return n===``||n!==``&&!n.startsWith(`..`)&&!m.default.isAbsolute(n)}function x(e){let t=m.default.extname(e).toLowerCase();return process.platform===`win32`&&[`.cmd`,`.exe`].includes(t)?m.default.basename(e,t):m.default.basename(e)}0&&(t.exports={getCanonicalPath:g,getCommandBase:x,getDirectoriesBetween:_,isNodeScript:y,isSubpath:b,statIfExists:v})})),et=E(((e,t)=>{var n=Object.create,r=Object.defineProperty,i=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,o=Object.getPrototypeOf,s=Object.prototype.hasOwnProperty,c=(e,t)=>{for(var n in t)r(e,n,{get:t[n],enumerable:!0})},l=(e,t,n,o)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of a(t))!s.call(e,c)&&c!==n&&r(e,c,{get:()=>t[c],enumerable:!(o=i(t,c))||o.enumerable});return e},u=(e,t,i)=>(i=e==null?{}:n(o(e)),l(t||!e||!e.__esModule?r(i,`default`,{value:e,enumerable:!0}):i,e)),d=e=>l(r({},`__esModule`,{value:!0}),e),f={};c(f,{getSkippedNodeModulesReason:()=>_,getUnsafeDirectoryReason:()=>S,getUnsafePackageBinReason:()=>y,getUnsafePackageDirectoryReason:()=>b,getUnsafePackageFileReason:()=>x,getUnsafeStatsReason:()=>C}),t.exports=d(f);var p=D(`node:fs/promises`),m=u(D(`node:path`)),h=Qe(),g=$e();async function _(e,t){let n=m.default.dirname(e);t??=[n];for(let e of t){let t;try{t=await S(e)}catch(e){t=`could not inspect: ${(0,h.getErrorMessage)(e)}`}if(t)return`${e} is ${t}`}let r=await(0,g.statIfExists)(e);return`missing`in r?null:`reason`in r?r.reason:r.stats.isDirectory()?C(r.stats)||await v(m.default.join(e,`.bin`)):`not a directory`}async function v(e){let t=await(0,g.statIfExists)(e);if(`missing`in t)return null;if(`reason`in t)return`${e} ${t.reason}`;if(!t.stats.isDirectory())return`${e} is not a directory`;let n=C(t.stats);return n?`${e} is ${n}`:null}async function y(e,t,n){return await b(e,t)||await x(t,n)}async function b(e,t){let n=(0,g.getDirectoriesBetween)(e,t);if(n.length===0)return`${t} resolves outside local node_modules`;for(let e of n){let t=await S(e);if(t)return`${e} is ${t}`}return null}async function x(e,t){let n=(0,g.getDirectoriesBetween)(e,m.default.dirname(t));if(n.length===0)return`${t} resolves outside package`;for(let e of n){let t=await S(e);if(t)return`${e} is ${t}`}let r=await ee(t);return r?`${t} is ${r}`:null}async function S(e){let t=await(0,p.stat)(e);return t.isDirectory()?C(t):`not a directory`}async function ee(e){let t=await(0,p.stat)(e);return t.isFile()?C(t):`not a file`}function C(e){let t=process.geteuid??process.getuid;if(typeof t!=`function`)return null;let n=t();return e.mode&18?e.mode&2?`world-writable`:`group-writable`:e.uid===n?null:`owned by uid ${e.uid}, current uid is ${n}`}0&&(t.exports={getSkippedNodeModulesReason:_,getUnsafeDirectoryReason:S,getUnsafePackageBinReason:y,getUnsafePackageDirectoryReason:b,getUnsafePackageFileReason:x,getUnsafeStatsReason:C})})),tt=E(((e,t)=>{var n=Object.create,r=Object.defineProperty,i=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,o=Object.getPrototypeOf,s=Object.prototype.hasOwnProperty,c=(e,t)=>{for(var n in t)r(e,n,{get:t[n],enumerable:!0})},l=(e,t,n,o)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of a(t))!s.call(e,c)&&c!==n&&r(e,c,{get:()=>t[c],enumerable:!(o=i(t,c))||o.enumerable});return e},u=(e,t,i)=>(i=e==null?{}:n(o(e)),l(t||!e||!e.__esModule?r(i,`default`,{value:e,enumerable:!0}):i,e)),d=e=>l(r({},`__esModule`,{value:!0}),e),f={};c(f,{clearCachedCliInvocation:()=>C,clearVercelCliLookupCache:()=>ee,findVercelCli:()=>b,getLocalBinSearch:()=>E,resolveCachedCliInvocation:()=>x,toVercelCliInvocation:()=>S}),t.exports=d(f);var p=D(`node:fs/promises`),m=u(D(`node:path`)),h=Ze(),g=Qe(),_=$e(),v=et();let y=new Map;async function b(e={}){let t=await x(m.default.resolve(e.cwd??process.cwd()),e.path??(0,h.getEnvPath)(process.env));return t.found?S(t):null}function x(e,t){let n=_e(e,t);if(y.has(n))return y.get(n);let r=te(e,t).catch(e=>{throw y.delete(n),e});return y.set(n,r),r}function S(e){return{command:e.command,commandArgs:e.commandArgs,source:e.source}}function ee(){y.clear()}function C(e,t){y.delete(_e(e,t))}async function te(e,t){let n=await E(e),r={localBinSearch:n.diagnostics,skippedLocalBins:[]},i=(0,h.prependPathEntries)(t,n.directories);for(let t of T()){let a=await ne(t,i,e,n,r);if(a)return(0,_.isNodeScript)(a.realPath)?{found:!0,command:process.execPath,commandArgs:[a.realPath],source:a.source,diagnostics:r}:{found:!0,command:a.realPath,commandArgs:[],source:a.source,diagnostics:r}}return{found:!1,diagnostics:r}}async function ne(e,t,n,r,i){for(let a of(0,h.splitPath)(t)){let t=w(a,e,n);try{if(await re(t,r,i)){let n=await ae(e,t,r,i);if(n)return n}}catch{}}return null}function w(e,t,n){let r=m.default.isAbsolute(e)?e:m.default.resolve(n,e);return m.default.join(r,t)}async function re(e,t,n){try{return await(0,p.access)(e,process.platform===`win32`?p.constants.F_OK:p.constants.F_OK|p.constants.X_OK),!0}catch(r){return(0,g.isMissingPathError)(r)||await ie(e,r,t,n),!1}}async function ie(e,t,n,r){let i=await de(e,n.directories);i&&oe(r,e,`reason`in i?i.reason:`local bin is not accessible: ${(0,g.getErrorMessage)(t)}`)}async function ae(e,t,n,r){if(!(await(0,p.stat)(t)).isFile())return null;let i=await(0,p.realpath)(t),a=await de(t,n.directories);if(!a)return{realPath:i,source:`path`};if(`reason`in a)return oe(r,t,a.reason),null;let o=await fe(e,a.directory);return`reason`in o?(oe(r,t,o.reason),null):{realPath:o.binPath,source:`local-bin`}}function oe(e,t,n){e.skippedLocalBins.push({candidate:t,reason:n})}function T(){let e=[`vercel`];if(process.platform!==`win32`)return e;let t=[`.cmd`,`.exe`,``];return e.flatMap(e=>t.map(t=>`${e}${t}`))}async function E(e){let t=await(0,_.getCanonicalPath)(m.default.resolve(e)),n=await se(t),r=[],i=[];for(let e of n.directories){let a=m.default.join(e,`node_modules`),o=n.stopReason===`project-root-marker`?(0,_.getDirectoriesBetween)(n.stoppedAt,e):(0,_.getDirectoriesBetween)(e,t),s=await(0,v.getSkippedNodeModulesReason)(a,o);if(s){r.push({directory:a,reason:s});continue}i.push(m.default.join(a,`.bin`))}return{directories:i,diagnostics:{searchRoot:t,stoppedAt:n.stoppedAt,stopReason:n.stopReason,markerPath:n.markerPath,skippedNodeModules:r}}}async function se(e){let t=[],n=m.default.resolve(e);for(;;){t.push(n);let e=await ce(n);if(e)return{directories:t,stoppedAt:n,stopReason:`project-root-marker`,markerPath:e.path};let r=m.default.dirname(n);if(r===n)return{directories:t,stoppedAt:n,stopReason:`filesystem-root`};n=r}}async function ce(e){let t=m.default.join(e,`.git`);try{return await(0,p.stat)(t),{path:t}}catch{}return null}async function le(e,t){let n=m.default.resolve(e),r=n;try{r=m.default.join(await(0,p.realpath)(m.default.dirname(n)),m.default.basename(n))}catch{}for(let e of t){try{e=await(0,p.realpath)(e)}catch{}if(r.startsWith(`${e}${m.default.sep}`))return e}return null}async function ue(e){let t=m.default.resolve(m.default.dirname(e)),n=[t];try{let e=await(0,p.realpath)(t);n.includes(e)||n.push(e)}catch{}for(let e of n)if(m.default.basename(e)===`.bin`&&m.default.basename(m.default.dirname(e))===`node_modules`)return e;return null}async function de(e,t){let n=await le(e,t);if(n)return{directory:n};let r=await ue(e);if(!r)return null;let i=m.default.dirname(r),a=await(0,v.getSkippedNodeModulesReason)(i);return a?{reason:`local node_modules is ${a}`}:{reason:`local bin is outside project lookup boundary`}}async function fe(e,t){let n=(0,_.getCommandBase)(e),r=m.default.dirname(t);if(n!==`vercel`||m.default.basename(r)!==`node_modules`)return{reason:`not a local vercel bin`};try{let e=await pe(r);if(`reason`in e)return e;let t=await me(e.realPackageDirectory);return`reason`in t?t:(e.packageJson=t.packageJson,await he(e,n))}catch(e){return{reason:`could not validate local vercel package: ${(0,g.getErrorMessage)(e)}`}}}async function pe(e){let t=m.default.join(e,`vercel`),n=await(0,p.realpath)(e),r=await(0,p.realpath)(t);if(!(0,_.isSubpath)(n,r))return{reason:`local vercel package resolves outside local node_modules`};let i=await(0,v.getUnsafePackageDirectoryReason)(n,r);return i?{reason:`local vercel package is unsafe: ${i}`}:{realNodeModulesDirectory:n,realPackageDirectory:r,packageJson:{}}}async function me(e){let t=m.default.join(e,`package.json`),n=await(0,p.realpath)(t);if(!(0,_.isSubpath)(e,n))return{reason:`local vercel package.json resolves outside package`};let r=await(0,v.getUnsafePackageFileReason)(e,n);if(r)return{reason:`local vercel package.json is unsafe: ${r}`};let i=JSON.parse(await(0,p.readFile)(n,`utf8`));return i.name===`vercel`?{packageJson:i}:{reason:`local vercel package.json does not have name "vercel"`}}async function he(e,t){let{packageJson:n,realNodeModulesDirectory:r,realPackageDirectory:i}=e,a=ge(n,t);if(!a)return{reason:`local vercel package does not declare bin.vercel`};let o=m.default.resolve(i,a),s=await(0,p.realpath)(o);if(!(0,_.isSubpath)(i,s))return{reason:`local vercel package bin resolves outside package`};let c=await(0,v.getUnsafePackageBinReason)(r,i,s);if(c)return{reason:`local vercel package bin is unsafe: ${c}`};if(process.platform!==`win32`&&!(0,_.isNodeScript)(s))try{await(0,p.access)(s,p.constants.F_OK|p.constants.X_OK)}catch(e){return{reason:`local vercel package bin is not executable: ${(0,g.getErrorMessage)(e)}`}}return{binPath:s}}function ge(e,t){let n=e.bin;if(typeof n==`string`)return t===`vercel`?n:null;if(n&&typeof n==`object`){let e=n[t];if(typeof e==`string`)return e}return null}function _e(e,t){return`${e}\0${t}`}0&&(t.exports={clearCachedCliInvocation:C,clearVercelCliLookupCache:ee,findVercelCli:b,getLocalBinSearch:E,resolveCachedCliInvocation:x,toVercelCliInvocation:S})})),nt=E(((e,t)=>{var n=Object.create,r=Object.defineProperty,i=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,o=Object.getPrototypeOf,s=Object.prototype.hasOwnProperty,c=(e,t)=>{for(var n in t)r(e,n,{get:t[n],enumerable:!0})},l=(e,t,n,o)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of a(t))!s.call(e,c)&&c!==n&&r(e,c,{get:()=>t[c],enumerable:!(o=i(t,c))||o.enumerable});return e},u=(e,t,i)=>(i=e==null?{}:n(o(e)),l(t||!e||!e.__esModule?r(i,`default`,{value:e,enumerable:!0}):i,e)),d=e=>l(r({},`__esModule`,{value:!0}),e),f={};c(f,{execVercelCli:()=>v}),t.exports=d(f);var p=u(D(`node:path`)),m=u(Xe()),h=Ze(),g=ge(),_=tt();async function v(e,t={}){let n=p.default.resolve(t.cwd??process.cwd());await(0,g.assertValidCwd)(n);let r=x(t.env),i=(0,h.getEnvPath)(r);try{return await y(e,t,n,r,i)}catch(a){if(a instanceof g.VercelCliError&&a.code===`VERCEL_CLI_NOT_FOUND`)return(0,_.clearCachedCliInvocation)(n,i),await y(e,t,n,r,i);throw a}}async function y(e,t,n,r,i){let a=await b(n,i);try{let i={input:t.input,stdio:t.stdio,stdin:t.stdin,stdout:t.stdout,stderr:t.stderr,timeout:t.timeout,cwd:n,env:await S(n,r),windowsHide:!0};t.signal&&(i.signal=t.signal);let{stdout:o,stderr:s}=await(0,m.default)(a.command,[...a.commandArgs,...e],i);return{stdout:o,stderr:s,invocation:a}}catch(e){throw(0,g.toVercelCliError)(a,e)}}async function b(e,t){let n=await(0,_.resolveCachedCliInvocation)(e,t);if(!n.found)throw new g.VercelCliError({code:`VERCEL_CLI_NOT_FOUND`,message:(0,g.getCliNotFoundMessage)(n.diagnostics)});return(0,_.toVercelCliInvocation)(n)}function x(e){return e?{...process.env,...e}:process.env}async function S(e,t=process.env){let n=await ee(e,(0,h.getEnvPath)(t));return(0,h.setEnvPath)(t,(0,h.prependPathEntries)(n,[p.default.dirname(process.execPath)]))}async function ee(e,t=``){return(0,h.prependPathEntries)(t,(await(0,_.getLocalBinSearch)(e)).directories)}0&&(t.exports={execVercelCli:v})})),rt=E(((e,t)=>{var n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,o=(e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})},s=(e,t,o,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of i(t))!a.call(e,c)&&c!==o&&n(e,c,{get:()=>t[c],enumerable:!(s=r(t,c))||s.enumerable});return e},c=e=>s(n({},`__esModule`,{value:!0}),e),l={};o(l,{VercelCliError:()=>u.VercelCliError,clearVercelCliLookupCache:()=>f.clearVercelCliLookupCache,execVercelCli:()=>d.execVercelCli,findVercelCli:()=>f.findVercelCli}),t.exports=c(l);var u=ge(),d=nt(),f=tt();0&&(t