@fmdzc/cli-ai 3.1.3 → 3.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -4,24 +4,28 @@
4
4
  [![License: ISC](https://img.shields.io/badge/License-ISC-blue.svg)](https://opensource.org/licenses/ISC)
5
5
  [![Node.js](https://img.shields.io/badge/Node.js-20+-green.svg)](https://nodejs.org/)
6
6
 
7
- **Natural language to shell commands. Multi-provider AI support.**
7
+ **Agentic AI assistant for your terminal.** Give it a task in plain language and it reasons, plans and executes across files, commands and code autonomously.
8
8
 
9
- Describe what you want in plain English. Get the right command. Review, execute or copy.
9
+ Built for engineers who live in the terminal. CLI AI brings agentic tool-use to DevOps workflows, system administration and everyday shell operations.
10
10
 
11
11
  Supports **Anthropic**, **OpenAI** and **OpenRouter** providers.
12
12
 
13
13
  ![CLI AI Demo](assets/cli-ai.png)
14
14
 
15
+ ## Why CLI AI
16
+
17
+ Traditional shell helpers translate a prompt into a single command. CLI AI goes further. It runs a full agentic loop: it reads your files, searches your codebase, writes edits, executes commands and chains multi-step reasoning until the task is done. You stay in control with a built-in permission system that gates every tool call.
18
+
15
19
  ## Features
16
20
 
17
- - **Multi-provider** - Anthropic, OpenAI, OpenRouter with any model support
18
- - **Natural language** - Just describe what you want to do
19
- - **Cross-platform** - Windows (PowerShell, CMD, Git Bash), macOS, Linux
20
- - **Shell-aware** - Commands tailored to your detected shell
21
- - **Interactive** - Execute, copy, edit or request alternatives
22
- - **Context-aware** - Remembers your conversation history for smarter suggestions
23
- - **Secure** - API keys stored in system keyring, never in plain text
24
- - **Risk assessment** - Color-coded safety levels for every command
21
+ - **Agentic tool-use** - Multi-turn reasoning with 7 built-in tools (bash, file read/write/edit, glob, grep and directory listing)
22
+ - **Permission system** - Allow, ask or deny gates per tool with approve-for-session support
23
+ - **Streaming markdown** - Real-time rendered responses with headings, code blocks, lists and links in the terminal
24
+ - **Multi-provider** - Anthropic, OpenAI and OpenRouter with any model ID
25
+ - **Shell-aware** - Detects your shell and tailors commands to match (bash, zsh, fish, PowerShell, cmd)
26
+ - **Cross-platform** - Windows, macOS and Linux
27
+ - **Secure key storage** - API keys stored in your system keyring, never in plain text
28
+ - **Context compaction** - Automatic conversation summarization when context grows large
25
29
 
26
30
  ## Quick Start
27
31
 
@@ -29,132 +33,92 @@ Supports **Anthropic**, **OpenAI** and **OpenRouter** providers.
29
33
  # Install globally
30
34
  npm install -g @fmdzc/cli-ai
31
35
 
32
- # Run
36
+ # Launch
33
37
  s
34
38
  # or
35
39
  cli-ai
36
40
  ```
37
41
 
38
- On first run, you'll be prompted for an API key. Get one from:
42
+ On first run you will be prompted for an API key. Get one from:
39
43
  - [Anthropic](https://console.anthropic.com/settings/keys)
40
44
  - [OpenAI](https://platform.openai.com/api-keys)
41
45
  - [OpenRouter](https://openrouter.ai/keys)
42
46
 
43
- ## Usage
47
+ ## How It Works
44
48
 
45
- Type what you want in natural language:
49
+ ```
50
+ You: "find all TODO comments in src/ and write a summary to TODO.md"
46
51
 
52
+ CLI AI:
53
+ 1. grep_search → scans src/ for TODO patterns
54
+ 2. file_read → reads matching files for context
55
+ 3. file_write → creates TODO.md with a structured summary
56
+ 4. Done.
47
57
  ```
48
- > find files larger than 100MB
49
58
 
50
- $ find . -size +100M -type f
51
- Risk: low
59
+ The agent plans and executes each step. You approve tool calls as they happen or pre-approve tools you trust.
52
60
 
53
- [1] Execute [2] Copy [3] Edit [4] Alternatives [5] Cancel
54
- ```
61
+ ## Built-in Tools
55
62
 
56
- ### Slash Commands
63
+ | Tool | Description |
64
+ | ---------------- | ------------------------------------ |
65
+ | `bash_execute` | Run shell commands |
66
+ | `file_read` | Read file contents |
67
+ | `file_write` | Create or overwrite files |
68
+ | `file_edit` | Apply targeted edits to files |
69
+ | `glob_search` | Find files by pattern |
70
+ | `grep_search` | Search file contents with regex |
71
+ | `list_directory` | List directory contents |
57
72
 
58
- Type `/` to access commands:
73
+ ## Slash Commands
59
74
 
60
75
  | Command | Description |
61
76
  | --------- | ----------------------- |
62
77
  | `/config` | Open settings panel |
63
78
  | `/help` | Show help and shortcuts |
64
- | `/clear` | Clear command history |
79
+ | `/clear` | Clear conversation |
65
80
  | `/exit` | Exit application |
66
81
 
67
- ### Keyboard Shortcuts
82
+ ## Keyboard Shortcuts
68
83
 
69
84
  **Input Mode**
70
- | Key | Action |
71
- | -------- | ----------------------- |
72
- | `/` | Open command palette |
73
- | `Enter` | Submit query |
74
- | `O` | Toggle output expansion |
75
- | `Ctrl+D` | Exit (when empty) |
76
-
77
- **Command Proposal**
78
- | Key | Action |
79
- | ------------- | ----------------- |
80
- | `1` / `Enter` | Execute command |
81
- | `2` | Copy to clipboard |
82
- | `3` | Edit command |
83
- | `4` | Show alternatives |
84
- | `5` / `Esc` | Cancel |
85
- | `?` | Explain command |
85
+ | Key | Action |
86
+ | -------- | -------------------- |
87
+ | `Enter` | Submit query |
88
+ | `/` | Open command palette |
89
+ | `Ctrl+D` | Exit (when empty) |
86
90
 
87
91
  **Settings Panel**
88
- | Key | Action |
89
- | --------- | -------------- |
90
- | `Tab` | Next section |
91
- | `Up/Down` | Navigate items |
92
- | `Enter` | Toggle/Select |
93
- | `Esc` | Close |
92
+ | Key | Action |
93
+ | ----------- | -------------- |
94
+ | `Tab` | Next section |
95
+ | `Up/Down` | Navigate items |
96
+ | `Enter` | Toggle/Select |
97
+ | `1-9` | Jump to tab |
98
+ | `Esc` | Close |
94
99
 
95
100
  ## Settings
96
101
 
97
102
  Access settings with `/config`:
98
103
 
99
- ### Provider & Model
104
+ ### Provider and Model
100
105
 
101
- Supported AI providers:
102
106
  - **Anthropic** - Claude models
103
107
  - **OpenAI** - GPT models
104
108
  - **OpenRouter** - 100+ models from various providers
105
109
 
106
- Any model from your selected provider is supported. Use the built-in presets or enter a custom model ID.
110
+ Use the built-in presets or enter a custom model ID.
107
111
 
108
112
  ### API Keys
109
113
 
110
- Manage API keys for each provider separately:
111
- - View key status (✓ Configured / ✗ Not set)
112
- - Add or change keys for any provider
113
- - Keys are stored securely per provider
114
-
115
- ### Options
116
- | Setting | Description |
117
- | ------------------- | ------------------------------------------------------- |
118
- | Context | Pass conversation history to AI for smarter suggestions |
119
- | Show explanations | Display command explanations |
120
- | Syntax highlighting | Colorize command output |
121
- | Simple mode | Minimal UI mode |
122
-
123
- ## Risk Assessment
124
-
125
- | Level | Color | Meaning |
126
- | ------ | ------ | ------------------------------ |
127
- | Low | Green | Safe, read-only commands |
128
- | Medium | Yellow | Modifies files or system state |
129
- | High | Red | Potentially destructive |
130
-
131
- ## Security
114
+ Manage API keys per provider. Keys are stored in your system keyring with an encrypted file fallback when the keyring is unavailable.
132
115
 
133
- ### API Key Storage
134
-
135
- Your API keys are stored securely using industry-standard methods. Each provider's key is stored separately.
136
-
137
- **Primary: System Keyring**
138
-
139
- | Platform | Storage Backend |
116
+ | Platform | Keyring Backend |
140
117
  | -------- | ------------------------------------------- |
141
118
  | macOS | Keychain |
142
119
  | Windows | Credential Manager |
143
120
  | Linux | Secret Service API (GNOME Keyring, KWallet) |
144
121
 
145
- The system keyring provides OS-level encryption and access control. API keys are never stored in plain text or environment variables.
146
-
147
- **Fallback: Encrypted File**
148
-
149
- If the system keyring is unavailable, keys are stored in an encrypted file at `~/.cli_ai_assistant/`. The encryption key is derived from your machine's unique identifiers (hostname + username), making the encrypted file non-portable and machine-specific.
150
-
151
- ### Key Management
152
-
153
- - **View**: See masked keys and storage method per provider in `/config`
154
- - **Add**: Configure API keys for Anthropic, OpenAI or OpenRouter
155
- - **Change**: Update any API key anytime through settings
156
- - **Status**: Green ✓ indicates configured, red ✗ indicates not set
157
-
158
122
  ## Requirements
159
123
 
160
124
  - **Node.js 20+**
@@ -0,0 +1,44 @@
1
+ import { createRequire } from 'node:module'; const require = createRequire(import.meta.url);
2
+ import{a as W,b as T,d as Mc}from"./chunk-QPVTJWSV.js";var to=T((Ny,eo)=>{"use strict";eo.exports=Qn;Qn.sync=Pl;var Zn=W("fs");function Ml(e,t){var r=t.pathExt!==void 0?t.pathExt:process.env.PATHEXT;if(!r||(r=r.split(";"),r.indexOf("")!==-1))return!0;for(var n=0;n<r.length;n++){var o=r[n].toLowerCase();if(o&&e.substr(-o.length).toLowerCase()===o)return!0}return!1}function Jn(e,t,r){return!e.isSymbolicLink()&&!e.isFile()?!1:Ml(t,r)}function Qn(e,t,r){Zn.stat(e,function(n,o){r(n,n?!1:Jn(o,e,t))})}function Pl(e,t){return Jn(Zn.statSync(e),e,t)}});var so=T((_y,io)=>{"use strict";io.exports=no;no.sync=Bl;var ro=W("fs");function no(e,t,r){ro.stat(e,function(n,o){r(n,n?!1:oo(o,t))})}function Bl(e,t){return oo(ro.statSync(e),t)}function oo(e,t){return e.isFile()&&Ll(e,t)}function Ll(e,t){var r=e.mode,n=e.uid,o=e.gid,i=t.uid!==void 0?t.uid:process.getuid&&process.getuid(),s=t.gid!==void 0?t.gid:process.getgid&&process.getgid(),a=parseInt("100",8),c=parseInt("010",8),f=parseInt("001",8),l=a|c,d=r&f||r&c&&o===s||r&a&&n===i||r&l&&i===0;return d}});var co=T((Gy,ao)=>{"use strict";var jy=W("fs"),He;process.platform==="win32"||global.TESTING_WINDOWS?He=to():He=so();ao.exports=rr;rr.sync=Fl;function rr(e,t,r){if(typeof t=="function"&&(r=t,t={}),!r){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(n,o){rr(e,t||{},function(i,s){i?o(i):n(s)})})}He(e,t||{},function(n,o){n&&(n.code==="EACCES"||t&&t.ignoreErrors)&&(n=null,o=!1),r(n,o)})}function Fl(e,t){try{return He.sync(e,t||{})}catch(r){if(t&&t.ignoreErrors||r.code==="EACCES")return!1;throw r}}});var go=T((ky,ho)=>{"use strict";var ae=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",lo=W("path"),$l=ae?";":":",fo=co(),po=e=>Object.assign(new Error(`not found: ${e}`),{code:"ENOENT"}),uo=(e,t)=>{let r=t.colon||$l,n=e.match(/\//)||ae&&e.match(/\\/)?[""]:[...ae?[process.cwd()]:[],...(t.path||process.env.PATH||"").split(r)],o=ae?t.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",i=ae?o.split(r):[""];return ae&&e.indexOf(".")!==-1&&i[0]!==""&&i.unshift(""),{pathEnv:n,pathExt:i,pathExtExe:o}},mo=(e,t,r)=>{typeof t=="function"&&(r=t,t={}),t||(t={});let{pathEnv:n,pathExt:o,pathExtExe:i}=uo(e,t),s=[],a=f=>new Promise((l,d)=>{if(f===n.length)return t.all&&s.length?l(s):d(po(e));let p=n[f],u=/^".*"$/.test(p)?p.slice(1,-1):p,m=lo.join(u,e),g=!u&&/^\.[\\\/]/.test(e)?e.slice(0,2)+m:m;l(c(g,f,0))}),c=(f,l,d)=>new Promise((p,u)=>{if(d===o.length)return p(a(l+1));let m=o[d];fo(f+m,{pathExt:i},(g,b)=>{if(!g&&b)if(t.all)s.push(f+m);else return p(f+m);return p(c(f,l,d+1))})});return r?a(0).then(f=>r(null,f),r):a(0)},Ul=(e,t)=>{t=t||{};let{pathEnv:r,pathExt:n,pathExtExe:o}=uo(e,t),i=[];for(let s=0;s<r.length;s++){let a=r[s],c=/^".*"$/.test(a)?a.slice(1,-1):a,f=lo.join(c,e),l=!c&&/^\.[\\\/]/.test(e)?e.slice(0,2)+f:f;for(let d=0;d<n.length;d++){let p=l+n[d];try{if(fo.sync(p,{pathExt:o}))if(t.all)i.push(p);else return p}catch{}}}if(t.all&&i.length)return i;if(t.nothrow)return null;throw po(e)};ho.exports=mo;mo.sync=Ul});var So=T((zy,nr)=>{"use strict";var yo=(e={})=>{let t=e.env||process.env;return(e.platform||process.platform)!=="win32"?"PATH":Object.keys(t).reverse().find(n=>n.toUpperCase()==="PATH")||"Path"};nr.exports=yo;nr.exports.default=yo});var Eo=T((Wy,xo)=>{"use strict";var bo=W("path"),vl=go(),Nl=So();function wo(e,t){let r=e.options.env||process.env,n=process.cwd(),o=e.options.cwd!=null,i=o&&process.chdir!==void 0&&!process.chdir.disabled;if(i)try{process.chdir(e.options.cwd)}catch{}let s;try{s=vl.sync(e.command,{path:r[Nl({env:r})],pathExt:t?bo.delimiter:void 0})}catch{}finally{i&&process.chdir(n)}return s&&(s=bo.resolve(o?e.options.cwd:"",s)),s}function _l(e){return wo(e)||wo(e,!0)}xo.exports=_l});var To=T((Vy,ir)=>{"use strict";var or=/([()\][%!^"`<>&|;, *?])/g;function jl(e){return e=e.replace(or,"^$1"),e}function Gl(e,t){return e=`${e}`,e=e.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),e=e.replace(/(?=(\\+?)?)\1$/,"$1$1"),e=`"${e}"`,e=e.replace(or,"^$1"),t&&(e=e.replace(or,"^$1")),e}ir.exports.command=jl;ir.exports.argument=Gl});var Ao=T((Yy,Oo)=>{"use strict";Oo.exports=/^#!(.*)/});var Io=T((qy,Do)=>{"use strict";var kl=Ao();Do.exports=(e="")=>{let t=e.match(kl);if(!t)return null;let[r,n]=t[0].replace(/#! ?/,"").split(" "),o=r.split("/").pop();return o==="env"?n:n?`${o} ${n}`:o}});var Co=T((Hy,Ro)=>{"use strict";var sr=W("fs"),zl=Io();function Wl(e){let r=Buffer.alloc(150),n;try{n=sr.openSync(e,"r"),sr.readSync(n,r,0,150,0),sr.closeSync(n)}catch{}return zl(r.toString())}Ro.exports=Wl});var Lo=T((Ky,Bo)=>{"use strict";var Vl=W("path"),Mo=Eo(),Po=To(),Yl=Co(),ql=process.platform==="win32",Hl=/\.(?:com|exe)$/i,Kl=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function Xl(e){e.file=Mo(e);let t=e.file&&Yl(e.file);return t?(e.args.unshift(e.file),e.command=t,Mo(e)):e.file}function Zl(e){if(!ql)return e;let t=Xl(e),r=!Hl.test(t);if(e.options.forceShell||r){let n=Kl.test(t);e.command=Vl.normalize(e.command),e.command=Po.command(e.command),e.args=e.args.map(i=>Po.argument(i,n));let o=[e.command].concat(e.args).join(" ");e.args=["/d","/s","/c",`"${o}"`],e.command=process.env.comspec||"cmd.exe",e.options.windowsVerbatimArguments=!0}return e}function Jl(e,t,r){t&&!Array.isArray(t)&&(r=t,t=null),t=t?t.slice(0):[],r=Object.assign({},r);let n={command:e,args:t,options:r,file:void 0,original:{command:e,args:t}};return r.shell?n:Zl(n)}Bo.exports=Jl});var Uo=T((Xy,$o)=>{"use strict";var ar=process.platform==="win32";function cr(e,t){return Object.assign(new Error(`${t} ${e.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${t} ${e.command}`,path:e.command,spawnargs:e.args})}function Ql(e,t){if(!ar)return;let r=e.emit;e.emit=function(n,o){if(n==="exit"){let i=Fo(o,t);if(i)return r.call(e,"error",i)}return r.apply(e,arguments)}}function Fo(e,t){return ar&&e===1&&!t.file?cr(t.original,"spawn"):null}function ef(e,t){return ar&&e===1&&!t.file?cr(t.original,"spawnSync"):null}$o.exports={hookChildProcess:Ql,verifyENOENT:Fo,verifyENOENTSync:ef,notFoundError:cr}});var _o=T((Zy,ce)=>{"use strict";var vo=W("child_process"),lr=Lo(),fr=Uo();function No(e,t,r){let n=lr(e,t,r),o=vo.spawn(n.command,n.args,n.options);return fr.hookChildProcess(o,n),o}function tf(e,t,r){let n=lr(e,t,r),o=vo.spawnSync(n.command,n.args,n.options);return o.error=o.error||fr.verifyENOENTSync(o.status,n),o}ce.exports=No;ce.exports.spawn=No;ce.exports.sync=tf;ce.exports._parse=lr;ce.exports._enoent=fr});function S(e){if(typeof e!="object"||e===null)return!1;let t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}import{fileURLToPath as Pc}from"url";var oe=(e,t)=>{let r=qt(Bc(e));if(typeof r!="string")throw new TypeError(`${t} must be a string or a file URL: ${r}.`);return r},Bc=e=>Yt(e)?e.toString():e,Yt=e=>typeof e!="string"&&e&&Object.getPrototypeOf(e)===String.prototype,qt=e=>e instanceof URL?Pc(e):e;var Ue=(e,t=[],r={})=>{let n=oe(e,"First argument"),[o,i]=S(t)?[[],t]:[t,r];if(!Array.isArray(o))throw new TypeError(`Second argument must be either an array of arguments or an options object: ${o}`);if(o.some(c=>typeof c=="object"&&c!==null))throw new TypeError(`Second argument must be an array of strings: ${o}`);let s=o.map(String),a=s.find(c=>c.includes("\0"));if(a!==void 0)throw new TypeError(`Arguments cannot contain null bytes ("\\0"): ${a}`);if(!S(i))throw new TypeError(`Last argument must be an options object: ${i}`);return[n,s,i]};import{ChildProcess as _c}from"child_process";import{StringDecoder as Lc}from"string_decoder";var{toString:On}=Object.prototype,An=e=>On.call(e)==="[object ArrayBuffer]",w=e=>On.call(e)==="[object Uint8Array]",N=e=>new Uint8Array(e.buffer,e.byteOffset,e.byteLength),Fc=new TextEncoder,Dn=e=>Fc.encode(e),$c=new TextDecoder,ve=e=>$c.decode(e),In=(e,t)=>Uc(e,t).join(""),Uc=(e,t)=>{if(t==="utf8"&&e.every(i=>typeof i=="string"))return e;let r=new Lc(t),n=e.map(i=>typeof i=="string"?Dn(i):i).map(i=>r.write(i)),o=r.end();return o===""?n:[...n,o]},Ee=e=>e.length===1&&w(e[0])?e[0]:Ht(vc(e)),vc=e=>e.map(t=>typeof t=="string"?Dn(t):t),Ht=e=>{let t=new Uint8Array(Nc(e)),r=0;for(let n of e)t.set(n,r),r+=n.length;return t},Nc=e=>{let t=0;for(let r of e)t+=r.length;return t};var Pn=e=>Array.isArray(e)&&Array.isArray(e.raw),Bn=(e,t)=>{let r=[];for(let[i,s]of e.entries())r=jc({templates:e,expressions:t,tokens:r,index:i,template:s});if(r.length===0)throw new TypeError("Template script must not be empty");let[n,...o]=r;return[n,o,{}]},jc=({templates:e,expressions:t,tokens:r,index:n,template:o})=>{if(o===void 0)throw new TypeError(`Invalid backslash sequence: ${e.raw[n]}`);let{nextTokens:i,leadingWhitespaces:s,trailingWhitespaces:a}=Gc(o,e.raw[n]),c=Cn(r,i,s);if(n===t.length)return c;let f=t[n],l=Array.isArray(f)?f.map(d=>Mn(d)):[Mn(f)];return Cn(c,l,a)},Gc=(e,t)=>{if(t.length===0)return{nextTokens:[],leadingWhitespaces:!1,trailingWhitespaces:!1};let r=[],n=0,o=Rn.has(t[0]);for(let s=0,a=0;s<e.length;s+=1,a+=1){let c=t[a];if(Rn.has(c))n!==s&&r.push(e.slice(n,s)),n=s+1;else if(c==="\\"){let f=t[a+1];f===`
3
+ `?(s-=1,a+=1):f==="u"&&t[a+2]==="{"?a=t.indexOf("}",a+3):a+=kc[f]??1}}let i=n===e.length;return i||r.push(e.slice(n)),{nextTokens:r,leadingWhitespaces:o,trailingWhitespaces:i}},Rn=new Set([" "," ","\r",`
4
+ `]),kc={x:3,u:5},Cn=(e,t,r)=>r||e.length===0||t.length===0?[...e,...t]:[...e.slice(0,-1),`${e.at(-1)}${t[0]}`,...t.slice(1)],Mn=e=>{let t=typeof e;if(t==="string")return e;if(t==="number")return String(e);if(S(e)&&("stdout"in e||"isMaxBuffer"in e))return zc(e);throw e instanceof _c||Object.prototype.toString.call(e)==="[object Promise]"?new TypeError("Unexpected subprocess in template expression. Please use ${await subprocess} instead of ${subprocess}."):new TypeError(`Unexpected "${t}" in template expression`)},zc=({stdout:e})=>{if(typeof e=="string")return e;if(w(e))return ve(e);throw e===void 0?new TypeError(`Missing result.stdout in template expression. This is probably due to the previous subprocess' "stdout" option.`):new TypeError(`Unexpected "${typeof e}" stdout in template expression`)};import{spawnSync as Hu}from"child_process";import{debuglog as Wc}from"util";import Kt from"process";var R=e=>Ne.includes(e),Ne=[Kt.stdin,Kt.stdout,Kt.stderr],D=["stdin","stdout","stderr"],_e=e=>D[e]??`stdio[${e}]`;var Fn=e=>{let t={...e};for(let r of Jt)t[r]=Xt(e,r);return t},Xt=(e,t)=>{let r=Array.from({length:Vc(e)+1}),n=Yc(e[t],r,t);return Zc(n,t)},Vc=({stdio:e})=>Array.isArray(e)?Math.max(e.length,D.length):D.length,Yc=(e,t,r)=>S(e)?qc(e,t,r):t.fill(e),qc=(e,t,r)=>{for(let n of Object.keys(e).sort(Hc))for(let o of Kc(n,r,t))t[o]=e[n];return t},Hc=(e,t)=>Ln(e)<Ln(t)?1:-1,Ln=e=>e==="stdout"||e==="stderr"?0:e==="all"?2:1,Kc=(e,t,r)=>{if(e==="ipc")return[r.length-1];let n=Zt(e);if(n===void 0||n===0)throw new TypeError(`"${t}.${e}" is invalid.
5
+ It must be "${t}.stdout", "${t}.stderr", "${t}.all", "${t}.ipc", or "${t}.fd3", "${t}.fd4" (and so on).`);if(n>=r.length)throw new TypeError(`"${t}.${e}" is invalid: that file descriptor does not exist.
6
+ Please set the "stdio" option to ensure that file descriptor exists.`);return n==="all"?[1,2]:[n]},Zt=e=>{if(e==="all")return e;if(D.includes(e))return D.indexOf(e);let t=Xc.exec(e);if(t!==null)return Number(t[1])},Xc=/^fd(\d+)$/,Zc=(e,t)=>e.map(r=>r===void 0?Qc[t]:r),Jc=Wc("execa").enabled?"full":"none",Qc={lines:!1,buffer:!0,maxBuffer:1e3*1e3*100,verbose:Jc,stripFinalNewline:!0},Jt=["lines","buffer","maxBuffer","verbose","stripFinalNewline"],_=(e,t)=>t==="ipc"?e.at(-1):e[t];var ie=({verbose:e},t)=>Qt(e,t)!=="none",se=({verbose:e},t)=>!["none","short"].includes(Qt(e,t)),$n=({verbose:e},t)=>{let r=Qt(e,t);return je(r)?r:void 0},Qt=(e,t)=>t===void 0?el(e):_(e,t),el=e=>e.find(t=>je(t))??Ge.findLast(t=>e.includes(t)),je=e=>typeof e=="function",Ge=["none","short","full"];import{inspect as El}from"util";import{platform as tl}from"process";import{stripVTControlCharacters as rl}from"util";var Un=(e,t)=>{let r=[e,...t],n=r.join(" "),o=r.map(i=>cl(vn(i))).join(" ");return{command:n,escapedCommand:o}},Te=e=>rl(e).split(`
7
+ `).map(t=>vn(t)).join(`
8
+ `),vn=e=>e.replaceAll(il,t=>nl(t)),nl=e=>{let t=sl[e];if(t!==void 0)return t;let r=e.codePointAt(0),n=r.toString(16);return r<=al?`\\u${n.padStart(4,"0")}`:`\\U${n}`},ol=()=>{try{return new RegExp("\\p{Separator}|\\p{Other}","gu")}catch{return/[\s\u0000-\u001F\u007F-\u009F\u00AD]/g}},il=ol(),sl={" ":" ","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t"},al=65535,cl=e=>ll.test(e)?e:tl==="win32"?`"${e.replaceAll('"','""')}"`:`'${e.replaceAll("'","'\\''")}'`,ll=/^[\w./-]+$/;import Nn from"process";function er(){let{env:e}=Nn,{TERM:t,TERM_PROGRAM:r}=e;return Nn.platform!=="win32"?t!=="linux":!!e.WT_SESSION||!!e.TERMINUS_SUBLIME||e.ConEmuTask==="{cmd::Cmder}"||r==="Terminus-Sublime"||r==="vscode"||t==="xterm-256color"||t==="alacritty"||t==="rxvt-unicode"||t==="rxvt-unicode-256color"||e.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var _n={circleQuestionMark:"(?)",questionMarkPrefix:"(?)",square:"\u2588",squareDarkShade:"\u2593",squareMediumShade:"\u2592",squareLightShade:"\u2591",squareTop:"\u2580",squareBottom:"\u2584",squareLeft:"\u258C",squareRight:"\u2590",squareCenter:"\u25A0",bullet:"\u25CF",dot:"\u2024",ellipsis:"\u2026",pointerSmall:"\u203A",triangleUp:"\u25B2",triangleUpSmall:"\u25B4",triangleDown:"\u25BC",triangleDownSmall:"\u25BE",triangleLeftSmall:"\u25C2",triangleRightSmall:"\u25B8",home:"\u2302",heart:"\u2665",musicNote:"\u266A",musicNoteBeamed:"\u266B",arrowUp:"\u2191",arrowDown:"\u2193",arrowLeft:"\u2190",arrowRight:"\u2192",arrowLeftRight:"\u2194",arrowUpDown:"\u2195",almostEqual:"\u2248",notEqual:"\u2260",lessOrEqual:"\u2264",greaterOrEqual:"\u2265",identical:"\u2261",infinity:"\u221E",subscriptZero:"\u2080",subscriptOne:"\u2081",subscriptTwo:"\u2082",subscriptThree:"\u2083",subscriptFour:"\u2084",subscriptFive:"\u2085",subscriptSix:"\u2086",subscriptSeven:"\u2087",subscriptEight:"\u2088",subscriptNine:"\u2089",oneHalf:"\xBD",oneThird:"\u2153",oneQuarter:"\xBC",oneFifth:"\u2155",oneSixth:"\u2159",oneEighth:"\u215B",twoThirds:"\u2154",twoFifths:"\u2156",threeQuarters:"\xBE",threeFifths:"\u2157",threeEighths:"\u215C",fourFifths:"\u2158",fiveSixths:"\u215A",fiveEighths:"\u215D",sevenEighths:"\u215E",line:"\u2500",lineBold:"\u2501",lineDouble:"\u2550",lineDashed0:"\u2504",lineDashed1:"\u2505",lineDashed2:"\u2508",lineDashed3:"\u2509",lineDashed4:"\u254C",lineDashed5:"\u254D",lineDashed6:"\u2574",lineDashed7:"\u2576",lineDashed8:"\u2578",lineDashed9:"\u257A",lineDashed10:"\u257C",lineDashed11:"\u257E",lineDashed12:"\u2212",lineDashed13:"\u2013",lineDashed14:"\u2010",lineDashed15:"\u2043",lineVertical:"\u2502",lineVerticalBold:"\u2503",lineVerticalDouble:"\u2551",lineVerticalDashed0:"\u2506",lineVerticalDashed1:"\u2507",lineVerticalDashed2:"\u250A",lineVerticalDashed3:"\u250B",lineVerticalDashed4:"\u254E",lineVerticalDashed5:"\u254F",lineVerticalDashed6:"\u2575",lineVerticalDashed7:"\u2577",lineVerticalDashed8:"\u2579",lineVerticalDashed9:"\u257B",lineVerticalDashed10:"\u257D",lineVerticalDashed11:"\u257F",lineDownLeft:"\u2510",lineDownLeftArc:"\u256E",lineDownBoldLeftBold:"\u2513",lineDownBoldLeft:"\u2512",lineDownLeftBold:"\u2511",lineDownDoubleLeftDouble:"\u2557",lineDownDoubleLeft:"\u2556",lineDownLeftDouble:"\u2555",lineDownRight:"\u250C",lineDownRightArc:"\u256D",lineDownBoldRightBold:"\u250F",lineDownBoldRight:"\u250E",lineDownRightBold:"\u250D",lineDownDoubleRightDouble:"\u2554",lineDownDoubleRight:"\u2553",lineDownRightDouble:"\u2552",lineUpLeft:"\u2518",lineUpLeftArc:"\u256F",lineUpBoldLeftBold:"\u251B",lineUpBoldLeft:"\u251A",lineUpLeftBold:"\u2519",lineUpDoubleLeftDouble:"\u255D",lineUpDoubleLeft:"\u255C",lineUpLeftDouble:"\u255B",lineUpRight:"\u2514",lineUpRightArc:"\u2570",lineUpBoldRightBold:"\u2517",lineUpBoldRight:"\u2516",lineUpRightBold:"\u2515",lineUpDoubleRightDouble:"\u255A",lineUpDoubleRight:"\u2559",lineUpRightDouble:"\u2558",lineUpDownLeft:"\u2524",lineUpBoldDownBoldLeftBold:"\u252B",lineUpBoldDownBoldLeft:"\u2528",lineUpDownLeftBold:"\u2525",lineUpBoldDownLeftBold:"\u2529",lineUpDownBoldLeftBold:"\u252A",lineUpDownBoldLeft:"\u2527",lineUpBoldDownLeft:"\u2526",lineUpDoubleDownDoubleLeftDouble:"\u2563",lineUpDoubleDownDoubleLeft:"\u2562",lineUpDownLeftDouble:"\u2561",lineUpDownRight:"\u251C",lineUpBoldDownBoldRightBold:"\u2523",lineUpBoldDownBoldRight:"\u2520",lineUpDownRightBold:"\u251D",lineUpBoldDownRightBold:"\u2521",lineUpDownBoldRightBold:"\u2522",lineUpDownBoldRight:"\u251F",lineUpBoldDownRight:"\u251E",lineUpDoubleDownDoubleRightDouble:"\u2560",lineUpDoubleDownDoubleRight:"\u255F",lineUpDownRightDouble:"\u255E",lineDownLeftRight:"\u252C",lineDownBoldLeftBoldRightBold:"\u2533",lineDownLeftBoldRightBold:"\u252F",lineDownBoldLeftRight:"\u2530",lineDownBoldLeftBoldRight:"\u2531",lineDownBoldLeftRightBold:"\u2532",lineDownLeftRightBold:"\u252E",lineDownLeftBoldRight:"\u252D",lineDownDoubleLeftDoubleRightDouble:"\u2566",lineDownDoubleLeftRight:"\u2565",lineDownLeftDoubleRightDouble:"\u2564",lineUpLeftRight:"\u2534",lineUpBoldLeftBoldRightBold:"\u253B",lineUpLeftBoldRightBold:"\u2537",lineUpBoldLeftRight:"\u2538",lineUpBoldLeftBoldRight:"\u2539",lineUpBoldLeftRightBold:"\u253A",lineUpLeftRightBold:"\u2536",lineUpLeftBoldRight:"\u2535",lineUpDoubleLeftDoubleRightDouble:"\u2569",lineUpDoubleLeftRight:"\u2568",lineUpLeftDoubleRightDouble:"\u2567",lineUpDownLeftRight:"\u253C",lineUpBoldDownBoldLeftBoldRightBold:"\u254B",lineUpDownBoldLeftBoldRightBold:"\u2548",lineUpBoldDownLeftBoldRightBold:"\u2547",lineUpBoldDownBoldLeftRightBold:"\u254A",lineUpBoldDownBoldLeftBoldRight:"\u2549",lineUpBoldDownLeftRight:"\u2540",lineUpDownBoldLeftRight:"\u2541",lineUpDownLeftBoldRight:"\u253D",lineUpDownLeftRightBold:"\u253E",lineUpBoldDownBoldLeftRight:"\u2542",lineUpDownLeftBoldRightBold:"\u253F",lineUpBoldDownLeftBoldRight:"\u2543",lineUpBoldDownLeftRightBold:"\u2544",lineUpDownBoldLeftBoldRight:"\u2545",lineUpDownBoldLeftRightBold:"\u2546",lineUpDoubleDownDoubleLeftDoubleRightDouble:"\u256C",lineUpDoubleDownDoubleLeftRight:"\u256B",lineUpDownLeftDoubleRightDouble:"\u256A",lineCross:"\u2573",lineBackslash:"\u2572",lineSlash:"\u2571"},jn={tick:"\u2714",info:"\u2139",warning:"\u26A0",cross:"\u2718",squareSmall:"\u25FB",squareSmallFilled:"\u25FC",circle:"\u25EF",circleFilled:"\u25C9",circleDotted:"\u25CC",circleDouble:"\u25CE",circleCircle:"\u24DE",circleCross:"\u24E7",circlePipe:"\u24BE",radioOn:"\u25C9",radioOff:"\u25EF",checkboxOn:"\u2612",checkboxOff:"\u2610",checkboxCircleOn:"\u24E7",checkboxCircleOff:"\u24BE",pointer:"\u276F",triangleUpOutline:"\u25B3",triangleLeft:"\u25C0",triangleRight:"\u25B6",lozenge:"\u25C6",lozengeOutline:"\u25C7",hamburger:"\u2630",smiley:"\u32E1",mustache:"\u0DF4",star:"\u2605",play:"\u25B6",nodejs:"\u2B22",oneSeventh:"\u2150",oneNinth:"\u2151",oneTenth:"\u2152"},fl={tick:"\u221A",info:"i",warning:"\u203C",cross:"\xD7",squareSmall:"\u25A1",squareSmallFilled:"\u25A0",circle:"( )",circleFilled:"(*)",circleDotted:"( )",circleDouble:"( )",circleCircle:"(\u25CB)",circleCross:"(\xD7)",circlePipe:"(\u2502)",radioOn:"(*)",radioOff:"( )",checkboxOn:"[\xD7]",checkboxOff:"[ ]",checkboxCircleOn:"(\xD7)",checkboxCircleOff:"( )",pointer:">",triangleUpOutline:"\u2206",triangleLeft:"\u25C4",triangleRight:"\u25BA",lozenge:"\u2666",lozengeOutline:"\u25CA",hamburger:"\u2261",smiley:"\u263A",mustache:"\u250C\u2500\u2510",star:"\u2736",play:"\u25BA",nodejs:"\u2666",oneSeventh:"1/7",oneNinth:"1/9",oneTenth:"1/10"},dl={..._n,...jn},pl={..._n,...fl},ul=er(),ml=ul?dl:pl,ke=ml,Rg=Object.entries(jn);import hl from"tty";var gl=hl?.WriteStream?.prototype?.hasColors?.()??!1,h=(e,t)=>{if(!gl)return o=>o;let r=`\x1B[${e}m`,n=`\x1B[${t}m`;return o=>{let i=o+"",s=i.indexOf(n);if(s===-1)return r+i+n;let a=r,c=0,l=(t===22?n:"")+r;for(;s!==-1;)a+=i.slice(c,s)+l,c=s+n.length,s=i.indexOf(n,c);return a+=i.slice(c)+n,a}},Pg=h(0,0),Gn=h(1,22),Bg=h(2,22),Lg=h(3,23),Fg=h(4,24),$g=h(53,55),Ug=h(7,27),vg=h(8,28),Ng=h(9,29),_g=h(30,39),jg=h(31,39),Gg=h(32,39),kg=h(33,39),zg=h(34,39),Wg=h(35,39),Vg=h(36,39),Yg=h(37,39),ze=h(90,39),qg=h(40,49),Hg=h(41,49),Kg=h(42,49),Xg=h(43,49),Zg=h(44,49),Jg=h(45,49),Qg=h(46,49),ey=h(47,49),ty=h(100,49),kn=h(91,39),ry=h(92,39),zn=h(93,39),ny=h(94,39),oy=h(95,39),iy=h(96,39),sy=h(97,39),ay=h(101,49),cy=h(102,49),ly=h(103,49),fy=h(104,49),dy=h(105,49),py=h(106,49),uy=h(107,49);var Yn=({type:e,message:t,timestamp:r,piped:n,commandId:o,result:{failed:i=!1}={},options:{reject:s=!0}})=>{let a=yl(r),c=Sl[e]({failed:i,reject:s,piped:n}),f=bl[e]({reject:s});return`${ze(`[${a}]`)} ${ze(`[${o}]`)} ${f(c)} ${f(t)}`},yl=e=>`${We(e.getHours(),2)}:${We(e.getMinutes(),2)}:${We(e.getSeconds(),2)}.${We(e.getMilliseconds(),3)}`,We=(e,t)=>String(e).padStart(t,"0"),Wn=({failed:e,reject:t})=>e?t?ke.cross:ke.warning:ke.tick,Sl={command:({piped:e})=>e?"|":"$",output:()=>" ",ipc:()=>"*",error:Wn,duration:Wn},Vn=e=>e,bl={command:()=>Gn,output:()=>Vn,ipc:()=>Vn,error:({reject:e})=>e?kn:zn,duration:()=>ze};var qn=(e,t,r)=>{let n=$n(t,r);return e.map(({verboseLine:o,verboseObject:i})=>wl(o,i,n)).filter(o=>o!==void 0).map(o=>xl(o)).join("")},wl=(e,t,r)=>{if(r===void 0)return e;let n=r(e,t);if(typeof n=="string")return n},xl=e=>e.endsWith(`
9
+ `)?e:`${e}
10
+ `;var B=({type:e,verboseMessage:t,fdNumber:r,verboseInfo:n,result:o})=>{let i=Tl({type:e,result:o,verboseInfo:n}),s=Ol(t,i),a=qn(s,n,r);a!==""&&console.warn(a.slice(0,-1))},Tl=({type:e,result:t,verboseInfo:{escapedCommand:r,commandId:n,rawOptions:{piped:o=!1,...i}}})=>({type:e,escapedCommand:r,commandId:`${n}`,timestamp:new Date,piped:o,result:t,options:i}),Ol=(e,t)=>e.split(`
11
+ `).map(r=>Al({...t,message:r})),Al=e=>({verboseLine:Yn(e),verboseObject:e}),Ve=e=>{let t=typeof e=="string"?e:El(e);return Te(t).replaceAll(" "," ".repeat(Dl))},Dl=2;var Hn=(e,t)=>{ie(t)&&B({type:"command",verboseMessage:e,verboseInfo:t})};var Kn=(e,t,r)=>{Cl(e);let n=Il(e);return{verbose:e,escapedCommand:t,commandId:n,rawOptions:r}},Il=e=>ie({verbose:e})?Rl++:void 0,Rl=0n,Cl=e=>{for(let t of e){if(t===!1)throw new TypeError(`The "verbose: false" option was renamed to "verbose: 'none'".`);if(t===!0)throw new TypeError(`The "verbose: true" option was renamed to "verbose: 'short'".`);if(!Ge.includes(t)&&!je(t)){let r=Ge.map(n=>`'${n}'`).join(", ");throw new TypeError(`The "verbose" option must not be ${t}. Allowed values are: ${r} or a function.`)}}};import{hrtime as Xn}from"process";var Ye=()=>Xn.bigint(),tr=e=>Number(Xn.bigint()-e)/1e6;var qe=(e,t,r)=>{let n=Ye(),{command:o,escapedCommand:i}=Un(e,t),s=Xt(r,"verbose"),a=Kn(s,i,{...r});return Hn(i,a),{command:o,escapedCommand:i,startTime:n,verboseInfo:a}};var Xi=Mc(_o(),1);import ud from"path";import Ki from"process";import Ze from"process";import X from"path";function Ke(e={}){let{env:t=process.env,platform:r=process.platform}=e;return r!=="win32"?"PATH":Object.keys(t).reverse().find(n=>n.toUpperCase()==="PATH")||"Path"}import{promisify as rf}from"util";import{execFile as nf,execFileSync as tS}from"child_process";import jo from"path";import{fileURLToPath as of}from"url";var oS=rf(nf);function Xe(e){return e instanceof URL?of(e):e}function Go(e){return{*[Symbol.iterator](){let t=jo.resolve(Xe(e)),r;for(;r!==t;)yield t,r=t,t=jo.resolve(t,"..")}}}var iS=10*1024*1024;var sf=({cwd:e=Ze.cwd(),path:t=Ze.env[Ke()],preferLocal:r=!0,execPath:n=Ze.execPath,addExecPath:o=!0}={})=>{let i=X.resolve(Xe(e)),s=[],a=t.split(X.delimiter);return r&&af(s,a,i),o&&cf(s,a,n,i),t===""||t===X.delimiter?`${s.join(X.delimiter)}${t}`:[...s,t].join(X.delimiter)},af=(e,t,r)=>{for(let n of Go(r)){let o=X.join(n,"node_modules/.bin");t.includes(o)||e.push(o)}},cf=(e,t,r,n)=>{let o=X.resolve(n,Xe(r),"..");t.includes(o)||e.push(o)},ko=({env:e=Ze.env,...t}={})=>{e={...e};let r=Ke({env:e});return t.path=e[r],e[r]=sf(t),e};import{setTimeout as Tf}from"timers/promises";var zo=(e,t,r)=>{let n=r?fe:le,o=e instanceof C?{}:{cause:e};return new n(t,o)},C=class extends Error{},Wo=(e,t)=>{Object.defineProperty(e.prototype,"name",{value:t,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,Yo,{value:!0,writable:!1,enumerable:!1,configurable:!1})},Vo=e=>Je(e)&&Yo in e,Yo=Symbol("isExecaError"),Je=e=>Object.prototype.toString.call(e)==="[object Error]",le=class extends Error{};Wo(le,le.name);var fe=class extends Error{};Wo(fe,fe.name);import{constants as Oe}from"os";import{constants as pf}from"os";var qo=()=>{let e=Ko-Ho+1;return Array.from({length:e},lf)},lf=(e,t)=>({name:`SIGRT${t+1}`,number:Ho+t,action:"terminate",description:"Application-specific signal (realtime)",standard:"posix"}),Ho=34,Ko=64;import{constants as ff}from"os";var Xo=[{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"}];var dr=()=>{let e=qo();return[...Xo,...e].map(df)},df=({name:e,number:t,description:r,action:n,forced:o=!1,standard:i})=>{let{signals:{[e]:s}}=ff,a=s!==void 0;return{name:e,number:a?s:t,description:r,supported:a,action:n,forced:o,standard:i}};var uf=()=>{let e=dr();return Object.fromEntries(e.map(mf))},mf=({name:e,number:t,description:r,supported:n,action:o,forced:i,standard:s})=>[e,{name:e,number:t,description:r,supported:n,action:o,forced:i,standard:s}],Zo=uf(),hf=()=>{let e=dr(),t=65,r=Array.from({length:t},(n,o)=>gf(o,e));return Object.assign({},...r)},gf=(e,t)=>{let r=yf(e,t);if(r===void 0)return{};let{name:n,description:o,supported:i,action:s,forced:a,standard:c}=r;return{[e]:{name:n,number:e,description:o,supported:i,action:s,forced:a,standard:c}}},yf=(e,t)=>{let r=t.find(({name:n})=>pf.signals[n]===e);return r!==void 0?r:t.find(n=>n.number===e)},ES=hf();var Qo=e=>{let t="option `killSignal`";if(e===0)throw new TypeError(`Invalid ${t}: 0 cannot be used.`);return ti(e,t)},ei=e=>e===0?e:ti(e,"`subprocess.kill()`'s argument"),ti=(e,t)=>{if(Number.isInteger(e))return Sf(e,t);if(typeof e=="string")return wf(e,t);throw new TypeError(`Invalid ${t} ${String(e)}: it must be a string or an integer.
12
+ ${pr()}`)},Sf=(e,t)=>{if(Jo.has(e))return Jo.get(e);throw new TypeError(`Invalid ${t} ${e}: this signal integer does not exist.
13
+ ${pr()}`)},bf=()=>new Map(Object.entries(Oe.signals).reverse().map(([e,t])=>[t,e])),Jo=bf(),wf=(e,t)=>{if(e in Oe.signals)return e;throw e.toUpperCase()in Oe.signals?new TypeError(`Invalid ${t} '${e}': please rename it to '${e.toUpperCase()}'.`):new TypeError(`Invalid ${t} '${e}': this signal name does not exist.
14
+ ${pr()}`)},pr=()=>`Available signal names: ${xf()}.
15
+ Available signal numbers: ${Ef()}.`,xf=()=>Object.keys(Oe.signals).sort().map(e=>`'${e}'`).join(", "),Ef=()=>[...new Set(Object.values(Oe.signals).sort((e,t)=>e-t))].join(", "),Qe=e=>Zo[e].description;var ri=e=>{if(e===!1)return e;if(e===!0)return Of;if(!Number.isFinite(e)||e<0)throw new TypeError(`Expected the \`forceKillAfterDelay\` option to be a non-negative integer, got \`${e}\` (${typeof e})`);return e},Of=1e3*5,ni=({kill:e,options:{forceKillAfterDelay:t,killSignal:r},onInternalError:n,context:o,controller:i},s,a)=>{let{signal:c,error:f}=Af(s,a,r);Df(f,n);let l=e(c);return If({kill:e,signal:c,forceKillAfterDelay:t,killSignal:r,killResult:l,context:o,controller:i}),l},Af=(e,t,r)=>{let[n=r,o]=Je(e)?[void 0,e]:[e,t];if(typeof n!="string"&&!Number.isInteger(n))throw new TypeError(`The first argument must be an error instance or a signal name string/integer: ${String(n)}`);if(o!==void 0&&!Je(o))throw new TypeError(`The second argument is optional. If specified, it must be an error instance: ${o}`);return{signal:ei(n),error:o}},Df=(e,t)=>{e!==void 0&&t.reject(e)},If=async({kill:e,signal:t,forceKillAfterDelay:r,killSignal:n,killResult:o,context:i,controller:s})=>{t===n&&o&&ur({kill:e,forceKillAfterDelay:r,context:i,controllerSignal:s.signal})},ur=async({kill:e,forceKillAfterDelay:t,context:r,controllerSignal:n})=>{if(t!==!1)try{await Tf(t,void 0,{signal:n}),e("SIGKILL")&&(r.isForcefullyTerminated??=!0)}catch{}};import{once as Rf}from"events";var et=async(e,t)=>{e.aborted||await Rf(e,"abort",{signal:t})};var oi=({cancelSignal:e})=>{if(e!==void 0&&Object.prototype.toString.call(e)!=="[object AbortSignal]")throw new Error(`The \`cancelSignal\` option must be an AbortSignal: ${String(e)}`)},ii=({subprocess:e,cancelSignal:t,gracefulCancel:r,context:n,controller:o})=>t===void 0||r?[]:[Cf(e,t,n,o)],Cf=async(e,t,r,{signal:n})=>{throw await et(t,n),r.terminationReason??="cancel",e.kill(),t.reason};import{scheduler as Xf}from"timers/promises";import{promisify as qf}from"util";var de=({methodName:e,isSubprocess:t,ipc:r,isConnected:n})=>{Mf(e,t,r),mr(e,t,n)},Mf=(e,t,r)=>{if(!r)throw new Error(`${M(e,t)} can only be used if the \`ipc\` option is \`true\`.`)},mr=(e,t,r)=>{if(!r)throw new Error(`${M(e,t)} cannot be used: the ${V(t)} has already exited or disconnected.`)},si=e=>{throw new Error(`${M("getOneMessage",e)} could not complete: the ${V(e)} exited or disconnected.`)},ai=e=>{throw new Error(`${M("sendMessage",e)} failed: the ${V(e)} is sending a message too, instead of listening to incoming messages.
16
+ This can be fixed by both sending a message and listening to incoming messages at the same time:
17
+
18
+ const [receivedMessage] = await Promise.all([
19
+ ${M("getOneMessage",e)},
20
+ ${M("sendMessage",e,"message, {strict: true}")},
21
+ ]);`)},tt=(e,t)=>new Error(`${M("sendMessage",t)} failed when sending an acknowledgment response to the ${V(t)}.`,{cause:e}),ci=e=>{throw new Error(`${M("sendMessage",e)} failed: the ${V(e)} is not listening to incoming messages.`)},li=e=>{throw new Error(`${M("sendMessage",e)} failed: the ${V(e)} exited without listening to incoming messages.`)},fi=()=>new Error(`\`cancelSignal\` aborted: the ${V(!0)} disconnected.`),di=()=>{throw new Error("`getCancelSignal()` cannot be used without setting the `cancelSignal` subprocess option.")},pi=({error:e,methodName:t,isSubprocess:r})=>{if(e.code==="EPIPE")throw new Error(`${M(t,r)} cannot be used: the ${V(r)} is disconnecting.`,{cause:e})},ui=({error:e,methodName:t,isSubprocess:r,message:n})=>{if(Pf(e))throw new Error(`${M(t,r)}'s argument type is invalid: the message cannot be serialized: ${String(n)}.`,{cause:e})},Pf=({code:e,message:t})=>Bf.has(e)||Lf.some(r=>t.includes(r)),Bf=new Set(["ERR_MISSING_ARGS","ERR_INVALID_ARG_TYPE"]),Lf=["could not be cloned","circular structure","call stack size exceeded"],M=(e,t,r="")=>e==="cancelSignal"?"`cancelSignal`'s `controller.abort()`":`${Ff(t)}${e}(${r})`,Ff=e=>e?"":"subprocess.",V=e=>e?"parent process":"subprocess",pe=e=>{e.connected&&e.disconnect()};var L=()=>{let e={},t=new Promise((r,n)=>{Object.assign(e,{resolve:r,reject:n})});return Object.assign(t,e)};var nt=(e,t="stdin")=>{let{options:n,fileDescriptors:o}=F.get(e),i=mi(o,t,!0),s=e.stdio[i];if(s===null)throw new TypeError(hi(i,t,n,!0));return s},ue=(e,t="stdout")=>{let{options:n,fileDescriptors:o}=F.get(e),i=mi(o,t,!1),s=i==="all"?e.all:e.stdio[i];if(s==null)throw new TypeError(hi(i,t,n,!1));return s},F=new WeakMap,mi=(e,t,r)=>{let n=$f(t,r);return Uf(n,t,r,e),n},$f=(e,t)=>{let r=Zt(e);if(r!==void 0)return r;let{validOptions:n,defaultValue:o}=t?{validOptions:'"stdin"',defaultValue:"stdin"}:{validOptions:'"stdout", "stderr", "all"',defaultValue:"stdout"};throw new TypeError(`"${Ae(t)}" must not be "${e}".
22
+ It must be ${n} or "fd3", "fd4" (and so on).
23
+ It is optional and defaults to "${o}".`)},Uf=(e,t,r,n)=>{let o=n[gi(e)];if(o===void 0)throw new TypeError(`"${Ae(r)}" must not be ${t}. That file descriptor does not exist.
24
+ Please set the "stdio" option to ensure that file descriptor exists.`);if(o.direction==="input"&&!r)throw new TypeError(`"${Ae(r)}" must not be ${t}. It must be a readable stream, not writable.`);if(o.direction!=="input"&&r)throw new TypeError(`"${Ae(r)}" must not be ${t}. It must be a writable stream, not readable.`)},hi=(e,t,r,n)=>{if(e==="all"&&!r.all)return`The "all" option must be true to use "from: 'all'".`;let{optionName:o,optionValue:i}=vf(e,r);return`The "${o}: ${rt(i)}" option is incompatible with using "${Ae(n)}: ${rt(t)}".
25
+ Please set this option with "pipe" instead.`},vf=(e,{stdin:t,stdout:r,stderr:n,stdio:o})=>{let i=gi(e);return i===0&&t!==void 0?{optionName:"stdin",optionValue:t}:i===1&&r!==void 0?{optionName:"stdout",optionValue:r}:i===2&&n!==void 0?{optionName:"stderr",optionValue:n}:{optionName:`stdio[${i}]`,optionValue:o[i]}},gi=e=>e==="all"?1:e,Ae=e=>e?"to":"from",rt=e=>typeof e=="string"?`'${e}'`:typeof e=="number"?`${e}`:"Stream";import{once as zf}from"events";import{addAbortListener as Nf}from"events";var Z=(e,t,r)=>{let n=e.getMaxListeners();n===0||n===Number.POSITIVE_INFINITY||(e.setMaxListeners(n+t),Nf(r,()=>{e.setMaxListeners(e.getMaxListeners()-t)}))};import{EventEmitter as Gf}from"events";import{once as _f}from"events";import{scheduler as jf}from"timers/promises";var ot=(e,t)=>{t&&hr(e)},hr=e=>{e.refCounted()},it=(e,t)=>{t&&gr(e)},gr=e=>{e.unrefCounted()},yi=(e,t)=>{t&&(gr(e),gr(e))},Si=(e,t)=>{t&&(hr(e),hr(e))};var bi=async({anyProcess:e,channel:t,isSubprocess:r,ipcEmitter:n},o)=>{if(Ei(o)||Oi(o))return;st.has(e)||st.set(e,[]);let i=st.get(e);if(i.push(o),!(i.length>1))for(;i.length>0;){await Ti(e,n,o),await jf.yield();let s=await xi({wrappedMessage:i[0],anyProcess:e,channel:t,isSubprocess:r,ipcEmitter:n});i.shift(),n.emit("message",s),n.emit("message:done")}},wi=async({anyProcess:e,channel:t,isSubprocess:r,ipcEmitter:n,boundOnMessage:o})=>{yr();let i=st.get(e);for(;i?.length>0;)await _f(n,"message:done");e.removeListener("message",o),Si(t,r),n.connected=!1,n.emit("disconnect")},st=new WeakMap;var Y=(e,t,r)=>{if(at.has(e))return at.get(e);let n=new Gf;return n.connected=!0,at.set(e,n),kf({ipcEmitter:n,anyProcess:e,channel:t,isSubprocess:r}),n},at=new WeakMap,kf=({ipcEmitter:e,anyProcess:t,channel:r,isSubprocess:n})=>{let o=bi.bind(void 0,{anyProcess:t,channel:r,isSubprocess:n,ipcEmitter:e});t.on("message",o),t.once("disconnect",wi.bind(void 0,{anyProcess:t,channel:r,isSubprocess:n,ipcEmitter:e,boundOnMessage:o})),yi(r,n)},ct=e=>{let t=at.get(e);return t===void 0?e.channel!==null:t.connected};var Ai=({anyProcess:e,channel:t,isSubprocess:r,message:n,strict:o})=>{if(!o)return n;let i=Y(e,t,r),s=dt(e,i);return{id:Wf++,type:ft,message:n,hasListeners:s}},Wf=0n,Di=(e,t)=>{if(!(t?.type!==ft||t.hasListeners))for(let{id:r}of e)r!==void 0&&lt[r].resolve({isDeadlock:!0,hasListeners:!1})},xi=async({wrappedMessage:e,anyProcess:t,channel:r,isSubprocess:n,ipcEmitter:o})=>{if(e?.type!==ft||!t.connected)return e;let{id:i,message:s}=e,a={id:i,type:Ri,message:dt(t,o)};try{await pt({anyProcess:t,channel:r,isSubprocess:n,ipc:!0},a)}catch(c){o.emit("strict:error",c)}return s},Ei=e=>{if(e?.type!==Ri)return!1;let{id:t,message:r}=e;return lt[t]?.resolve({isDeadlock:!1,hasListeners:r}),!0},Ii=async(e,t,r)=>{if(e?.type!==ft)return;let n=L();lt[e.id]=n;let o=new AbortController;try{let{isDeadlock:i,hasListeners:s}=await Promise.race([n,Vf(t,r,o)]);i&&ai(r),s||ci(r)}finally{o.abort(),delete lt[e.id]}},lt={},Vf=async(e,t,{signal:r})=>{Z(e,1,r),await zf(e,"disconnect",{signal:r}),li(t)},ft="execa:ipc:request",Ri="execa:ipc:response";var Ci=(e,t,r)=>{De.has(e)||De.set(e,new Set);let n=De.get(e),o=L(),i=r?t.id:void 0,s={onMessageSent:o,id:i};return n.add(s),{outgoingMessages:n,outgoingMessage:s}},Mi=({outgoingMessages:e,outgoingMessage:t})=>{e.delete(t),t.onMessageSent.resolve()},Ti=async(e,t,r)=>{for(;!dt(e,t)&&De.get(e)?.size>0;){let n=[...De.get(e)];Di(n,r),await Promise.all(n.map(({onMessageSent:o})=>o))}},De=new WeakMap,dt=(e,t)=>t.listenerCount("message")>Yf(e),Yf=e=>F.has(e)&&!_(F.get(e).options.buffer,"ipc")?1:0;var pt=({anyProcess:e,channel:t,isSubprocess:r,ipc:n},o,{strict:i=!1}={})=>{let s="sendMessage";return de({methodName:s,isSubprocess:r,ipc:n,isConnected:e.connected}),Hf({anyProcess:e,channel:t,methodName:s,isSubprocess:r,message:o,strict:i})},Hf=async({anyProcess:e,channel:t,methodName:r,isSubprocess:n,message:o,strict:i})=>{let s=Ai({anyProcess:e,channel:t,isSubprocess:n,message:o,strict:i}),a=Ci(e,s,i);try{await br({anyProcess:e,methodName:r,isSubprocess:n,wrappedMessage:s,message:o})}catch(c){throw pe(e),c}finally{Mi(a)}},br=async({anyProcess:e,methodName:t,isSubprocess:r,wrappedMessage:n,message:o})=>{let i=Kf(e);try{await Promise.all([Ii(n,e,r),i(n)])}catch(s){throw pi({error:s,methodName:t,isSubprocess:r}),ui({error:s,methodName:t,isSubprocess:r,message:o}),s}},Kf=e=>{if(Sr.has(e))return Sr.get(e);let t=qf(e.send.bind(e));return Sr.set(e,t),t},Sr=new WeakMap;var Bi=(e,t)=>{let r="cancelSignal";return mr(r,!1,e.connected),br({anyProcess:e,methodName:r,isSubprocess:!1,wrappedMessage:{type:Fi,message:t},message:t})},Li=async({anyProcess:e,channel:t,isSubprocess:r,ipc:n})=>(await Zf({anyProcess:e,channel:t,isSubprocess:r,ipc:n}),wr.signal),Zf=async({anyProcess:e,channel:t,isSubprocess:r,ipc:n})=>{if(!Pi){if(Pi=!0,!n){di();return}if(t===null){yr();return}Y(e,t,r),await Xf.yield()}},Pi=!1,Oi=e=>e?.type!==Fi?!1:(wr.abort(e.message),!0),Fi="execa:ipc:cancel",yr=()=>{wr.abort(fi())},wr=new AbortController;var $i=({gracefulCancel:e,cancelSignal:t,ipc:r,serialization:n})=>{if(e){if(t===void 0)throw new Error("The `cancelSignal` option must be defined when setting the `gracefulCancel` option.");if(!r)throw new Error("The `ipc` option cannot be false when setting the `gracefulCancel` option.");if(n==="json")throw new Error("The `serialization` option cannot be 'json' when setting the `gracefulCancel` option.")}},Ui=({subprocess:e,cancelSignal:t,gracefulCancel:r,forceKillAfterDelay:n,context:o,controller:i})=>r?[Jf({subprocess:e,cancelSignal:t,forceKillAfterDelay:n,context:o,controller:i})]:[],Jf=async({subprocess:e,cancelSignal:t,forceKillAfterDelay:r,context:n,controller:{signal:o}})=>{await et(t,o);let i=Qf(t);throw await Bi(e,i),ur({kill:e.kill,forceKillAfterDelay:r,context:n,controllerSignal:o}),n.terminationReason??="gracefulCancel",t.reason},Qf=({reason:e})=>{if(!(e instanceof DOMException))return e;let t=new Error(e.message);return Object.defineProperty(t,"stack",{value:e.stack,enumerable:!1,configurable:!0,writable:!0}),t};import{setTimeout as ed}from"timers/promises";var vi=({timeout:e})=>{if(e!==void 0&&(!Number.isFinite(e)||e<0))throw new TypeError(`Expected the \`timeout\` option to be a non-negative integer, got \`${e}\` (${typeof e})`)},Ni=(e,t,r,n)=>t===0||t===void 0?[]:[td(e,t,r,n)],td=async(e,t,r,{signal:n})=>{throw await ed(t,void 0,{signal:n}),r.terminationReason??="timeout",e.kill(),new C};import{execPath as rd,execArgv as nd}from"process";import _i from"path";var ji=({options:e})=>{if(e.node===!1)throw new TypeError('The "node" option cannot be false with `execaNode()`.');return{options:{...e,node:!0}}},Gi=(e,t,{node:r=!1,nodePath:n=rd,nodeOptions:o=nd.filter(c=>!c.startsWith("--inspect")),cwd:i,execPath:s,...a})=>{if(s!==void 0)throw new TypeError('The "execPath" option has been removed. Please use the "nodePath" option instead.');let c=oe(n,'The "nodePath" option'),f=_i.resolve(i,c),l={...a,nodePath:f,node:r,cwd:i};if(!r)return[e,t,l];if(_i.basename(e,".exe")==="node")throw new TypeError('When the "node" option is true, the first argument does not need to be "node".');return[f,[...o,e,...t],{ipc:!0,...l,shell:!1}]};import{serialize as od}from"v8";var ki=({ipcInput:e,ipc:t,serialization:r})=>{if(e!==void 0){if(!t)throw new Error("The `ipcInput` option cannot be set unless the `ipc` option is `true`.");ad[r](e)}},id=e=>{try{od(e)}catch(t){throw new Error("The `ipcInput` option is not serializable with a structured clone.",{cause:t})}},sd=e=>{try{JSON.stringify(e)}catch(t){throw new Error("The `ipcInput` option is not serializable with JSON.",{cause:t})}},ad={advanced:id,json:sd},zi=async(e,t)=>{t!==void 0&&await e.sendMessage(t)};var Vi=({encoding:e})=>{if(xr.has(e))return;let t=ld(e);if(t!==void 0)throw new TypeError(`Invalid option \`encoding: ${ut(e)}\`.
26
+ Please rename it to ${ut(t)}.`);let r=[...xr].map(n=>ut(n)).join(", ");throw new TypeError(`Invalid option \`encoding: ${ut(e)}\`.
27
+ Please rename it to one of: ${r}.`)},cd=new Set(["utf8","utf16le"]),O=new Set(["buffer","hex","base64","base64url","latin1","ascii"]),xr=new Set([...cd,...O]),ld=e=>{if(e===null)return"buffer";if(typeof e!="string")return;let t=e.toLowerCase();if(t in Wi)return Wi[t];if(xr.has(t))return t},Wi={"utf-8":"utf8","utf-16le":"utf16le","ucs-2":"utf16le",ucs2:"utf16le",binary:"latin1"},ut=e=>typeof e=="string"?`"${e}"`:String(e);import{statSync as fd}from"fs";import dd from"path";import pd from"process";var Yi=(e=qi())=>{let t=oe(e,'The "cwd" option');return dd.resolve(t)},qi=()=>{try{return pd.cwd()}catch(e){throw e.message=`The current directory does not exist.
28
+ ${e.message}`,e}},Hi=(e,t)=>{if(t===qi())return e;let r;try{r=fd(t)}catch(n){return`The "cwd" option is invalid: ${t}.
29
+ ${n.message}
30
+ ${e}`}return r.isDirectory()?e:`The "cwd" option is not a directory: ${t}.
31
+ ${e}`};var mt=(e,t,r)=>{r.cwd=Yi(r.cwd);let[n,o,i]=Gi(e,t,r),{command:s,args:a,options:c}=Xi.default._parse(n,o,i),f=Fn(c),l=md(f);return vi(l),Vi(l),ki(l),oi(l),$i(l),l.shell=qt(l.shell),l.env=hd(l),l.killSignal=Qo(l.killSignal),l.forceKillAfterDelay=ri(l.forceKillAfterDelay),l.lines=l.lines.map((d,p)=>d&&!O.has(l.encoding)&&l.buffer[p]),Ki.platform==="win32"&&ud.basename(s,".exe")==="cmd"&&a.unshift("/q"),{file:s,commandArguments:a,options:l}},md=({extendEnv:e=!0,preferLocal:t=!1,cwd:r,localDir:n=r,encoding:o="utf8",reject:i=!0,cleanup:s=!0,all:a=!1,windowsHide:c=!0,killSignal:f="SIGTERM",forceKillAfterDelay:l=!0,gracefulCancel:d=!1,ipcInput:p,ipc:u=p!==void 0||d,serialization:m="advanced",...g})=>({...g,extendEnv:e,preferLocal:t,cwd:r,localDirectory:n,encoding:o,reject:i,cleanup:s,all:a,windowsHide:c,killSignal:f,forceKillAfterDelay:l,gracefulCancel:d,ipcInput:p,ipc:u,serialization:m}),hd=({env:e,extendEnv:t,preferLocal:r,node:n,localDirectory:o,nodePath:i})=>{let s=t?{...Ki.env,...e}:e;return r||n?ko({env:s,cwd:o,execPath:i,preferLocal:r,addExecPath:n}):s};var ht=(e,t,r)=>r.shell&&t.length>0?[[e,...t].join(" "),[],r]:[e,t,r];import{inspect as Kd}from"util";function me(e){if(typeof e=="string")return gd(e);if(!(ArrayBuffer.isView(e)&&e.BYTES_PER_ELEMENT===1))throw new Error("Input must be a string or a Uint8Array");return yd(e)}var gd=e=>e.at(-1)===Zi?e.slice(0,e.at(-2)===Ji?-2:-1):e,yd=e=>e.at(-1)===Sd?e.subarray(0,e.at(-2)===bd?-2:-1):e,Zi=`
32
+ `,Sd=Zi.codePointAt(0),Ji="\r",bd=Ji.codePointAt(0);import{on as Vd}from"events";import{finished as Yd}from"stream/promises";function P(e,{checkOpen:t=!0}={}){return e!==null&&typeof e=="object"&&(e.writable||e.readable||!t||e.writable===void 0&&e.readable===void 0)&&typeof e.pipe=="function"}function Er(e,{checkOpen:t=!0}={}){return P(e,{checkOpen:t})&&(e.writable||!t)&&typeof e.write=="function"&&typeof e.end=="function"&&typeof e.writable=="boolean"&&typeof e.writableObjectMode=="boolean"&&typeof e.destroy=="function"&&typeof e.destroyed=="boolean"}function J(e,{checkOpen:t=!0}={}){return P(e,{checkOpen:t})&&(e.readable||!t)&&typeof e.read=="function"&&typeof e.readable=="boolean"&&typeof e.readableObjectMode=="boolean"&&typeof e.destroy=="function"&&typeof e.destroyed=="boolean"}function Tr(e,t){return Er(e,t)&&J(e,t)}var wd=Object.getPrototypeOf(Object.getPrototypeOf(async function*(){}).prototype),Or=class{#t;#r;#e=!1;#n=void 0;constructor(t,r){this.#t=t,this.#r=r}next(){let t=()=>this.#i();return this.#n=this.#n?this.#n.then(t,t):t(),this.#n}return(t){let r=()=>this.#o(t);return this.#n?this.#n.then(r,r):r()}async#i(){if(this.#e)return{done:!0,value:void 0};let t;try{t=await this.#t.read()}catch(r){throw this.#n=void 0,this.#e=!0,this.#t.releaseLock(),r}return t.done&&(this.#n=void 0,this.#e=!0,this.#t.releaseLock()),t}async#o(t){if(this.#e)return{done:!0,value:t};if(this.#e=!0,!this.#r){let r=this.#t.cancel(t);return this.#t.releaseLock(),await r,{done:!0,value:t}}return this.#t.releaseLock(),{done:!0,value:t}}},Ar=Symbol();function Qi(){return this[Ar].next()}Object.defineProperty(Qi,"name",{value:"next"});function es(e){return this[Ar].return(e)}Object.defineProperty(es,"name",{value:"return"});var xd=Object.create(wd,{next:{enumerable:!0,configurable:!0,writable:!0,value:Qi},return:{enumerable:!0,configurable:!0,writable:!0,value:es}});function Dr({preventCancel:e=!1}={}){let t=this.getReader(),r=new Or(t,e),n=Object.create(xd);return n[Ar]=r,n}var ts=e=>{if(J(e,{checkOpen:!1})&&Ie.on!==void 0)return Td(e);if(typeof e?.[Symbol.asyncIterator]=="function")return e;if(Ed.call(e)==="[object ReadableStream]")return Dr.call(e);throw new TypeError("The first argument must be a Readable, a ReadableStream, or an async iterable.")},{toString:Ed}=Object.prototype,Td=async function*(e){let t=new AbortController,r={};Od(e,t,r);try{for await(let[n]of Ie.on(e,"data",{signal:t.signal}))yield n}catch(n){if(r.error!==void 0)throw r.error;if(!t.signal.aborted)throw n}finally{e.destroy()}},Od=async(e,t,r)=>{try{await Ie.finished(e,{cleanup:!0,readable:!0,writable:!1,error:!1})}catch(n){r.error=n}finally{t.abort()}},Ie={};var he=async(e,{init:t,convertChunk:r,getSize:n,truncateChunk:o,addChunk:i,getFinalChunk:s,finalize:a},{maxBuffer:c=Number.POSITIVE_INFINITY}={})=>{let f=ts(e),l=t();l.length=0;try{for await(let d of f){let p=Dd(d),u=r[p](d,l);os({convertedChunk:u,state:l,getSize:n,truncateChunk:o,addChunk:i,maxBuffer:c})}return Ad({state:l,convertChunk:r,getSize:n,truncateChunk:o,addChunk:i,getFinalChunk:s,maxBuffer:c}),a(l)}catch(d){let p=typeof d=="object"&&d!==null?d:new Error(d);throw p.bufferedData=a(l),p}},Ad=({state:e,getSize:t,truncateChunk:r,addChunk:n,getFinalChunk:o,maxBuffer:i})=>{let s=o(e);s!==void 0&&os({convertedChunk:s,state:e,getSize:t,truncateChunk:r,addChunk:n,maxBuffer:i})},os=({convertedChunk:e,state:t,getSize:r,truncateChunk:n,addChunk:o,maxBuffer:i})=>{let s=r(e),a=t.length+s;if(a<=i){rs(e,t,o,a);return}let c=n(e,i-t.length);throw c!==void 0&&rs(c,t,o,i),new $},rs=(e,t,r,n)=>{t.contents=r(e,t,n),t.length=n},Dd=e=>{let t=typeof e;if(t==="string")return"string";if(t!=="object"||e===null)return"others";if(globalThis.Buffer?.isBuffer(e))return"buffer";let r=ns.call(e);return r==="[object ArrayBuffer]"?"arrayBuffer":r==="[object DataView]"?"dataView":Number.isInteger(e.byteLength)&&Number.isInteger(e.byteOffset)&&ns.call(e.buffer)==="[object ArrayBuffer]"?"typedArray":"others"},{toString:ns}=Object.prototype,$=class extends Error{name="MaxBufferError";constructor(){super("maxBuffer exceeded")}};var j=e=>e,Re=()=>{},gt=({contents:e})=>e,yt=e=>{throw new Error(`Streams in object mode are not supported: ${String(e)}`)},St=e=>e.length;async function bt(e,t){return he(e,Md,t)}var Id=()=>({contents:[]}),Rd=()=>1,Cd=(e,{contents:t})=>(t.push(e),t),Md={init:Id,convertChunk:{string:j,buffer:j,arrayBuffer:j,dataView:j,typedArray:j,others:j},getSize:Rd,truncateChunk:Re,addChunk:Cd,getFinalChunk:Re,finalize:gt};async function wt(e,t){return he(e,_d,t)}var Pd=()=>({contents:new ArrayBuffer(0)}),Bd=e=>Ld.encode(e),Ld=new TextEncoder,is=e=>new Uint8Array(e),ss=e=>new Uint8Array(e.buffer,e.byteOffset,e.byteLength),Fd=(e,t)=>e.slice(0,t),$d=(e,{contents:t,length:r},n)=>{let o=ls()?vd(t,n):Ud(t,n);return new Uint8Array(o).set(e,r),o},Ud=(e,t)=>{if(t<=e.byteLength)return e;let r=new ArrayBuffer(cs(t));return new Uint8Array(r).set(new Uint8Array(e),0),r},vd=(e,t)=>{if(t<=e.maxByteLength)return e.resize(t),e;let r=new ArrayBuffer(t,{maxByteLength:cs(t)});return new Uint8Array(r).set(new Uint8Array(e),0),r},cs=e=>as**Math.ceil(Math.log(e)/Math.log(as)),as=2,Nd=({contents:e,length:t})=>ls()?e:e.slice(0,t),ls=()=>"resize"in ArrayBuffer.prototype,_d={init:Pd,convertChunk:{string:Bd,buffer:is,arrayBuffer:is,dataView:ss,typedArray:ss,others:yt},getSize:St,truncateChunk:Fd,addChunk:$d,getFinalChunk:Re,finalize:Nd};async function Et(e,t){return he(e,Wd,t)}var jd=()=>({contents:"",textDecoder:new TextDecoder}),xt=(e,{textDecoder:t})=>t.decode(e,{stream:!0}),Gd=(e,{contents:t})=>t+e,kd=(e,t)=>e.slice(0,t),zd=({textDecoder:e})=>{let t=e.decode();return t===""?void 0:t},Wd={init:jd,convertChunk:{string:j,buffer:xt,arrayBuffer:xt,dataView:xt,typedArray:xt,others:yt},getSize:St,truncateChunk:kd,addChunk:Gd,getFinalChunk:zd,finalize:gt};Object.assign(Ie,{on:Vd,finished:Yd});var fs=({error:e,stream:t,readableObjectMode:r,lines:n,encoding:o,fdNumber:i})=>{if(!(e instanceof $))throw e;if(i==="all")return e;let s=qd(r,n,o);throw e.maxBufferInfo={fdNumber:i,unit:s},t.destroy(),e},qd=(e,t,r)=>e?"objects":t?"lines":r==="buffer"?"bytes":"characters",ds=(e,t,r)=>{if(t.length!==r)return;let n=new $;throw n.maxBufferInfo={fdNumber:"ipc"},n},ps=(e,t)=>{let{streamName:r,threshold:n,unit:o}=Hd(e,t);return`Command's ${r} was larger than ${n} ${o}`},Hd=(e,t)=>{if(e?.maxBufferInfo===void 0)return{streamName:"output",threshold:t[1],unit:"bytes"};let{maxBufferInfo:{fdNumber:r,unit:n}}=e;delete e.maxBufferInfo;let o=_(t,r);return r==="ipc"?{streamName:"IPC output",threshold:o,unit:"messages"}:{streamName:_e(r),threshold:o,unit:n}},us=(e,t,r)=>e?.code==="ENOBUFS"&&t!==null&&t.some(n=>n!==null&&n.length>Tt(r)),ms=(e,t,r)=>{if(!t)return e;let n=Tt(r);return e.length>n?e.slice(0,n):e},Tt=([,e])=>e;var gs=({stdio:e,all:t,ipcOutput:r,originalError:n,signal:o,signalDescription:i,exitCode:s,escapedCommand:a,timedOut:c,isCanceled:f,isGracefullyCanceled:l,isMaxBuffer:d,isForcefullyTerminated:p,forceKillAfterDelay:u,killSignal:m,maxBuffer:g,timeout:b,cwd:y})=>{let x=n?.code,E=Xd({originalError:n,timedOut:c,timeout:b,isMaxBuffer:d,maxBuffer:g,errorCode:x,signal:o,signalDescription:i,exitCode:s,isCanceled:f,isGracefullyCanceled:l,isForcefullyTerminated:p,forceKillAfterDelay:u,killSignal:m}),A=Jd(n,y),v=A===void 0?"":`
33
+ ${A}`,k=`${E}: ${a}${v}`,K=t===void 0?[e[2],e[1]]:[t],ne=[k,...K,...e.slice(3),r.map(z=>Qd(z)).join(`
34
+ `)].map(z=>Te(me(ep(z)))).filter(Boolean).join(`
35
+
36
+ `);return{originalMessage:A,shortMessage:k,message:ne}},Xd=({originalError:e,timedOut:t,timeout:r,isMaxBuffer:n,maxBuffer:o,errorCode:i,signal:s,signalDescription:a,exitCode:c,isCanceled:f,isGracefullyCanceled:l,isForcefullyTerminated:d,forceKillAfterDelay:p,killSignal:u})=>{let m=Zd(d,p);return t?`Command timed out after ${r} milliseconds${m}`:l?s===void 0?`Command was gracefully canceled with exit code ${c}`:d?`Command was gracefully canceled${m}`:`Command was gracefully canceled with ${s} (${a})`:f?`Command was canceled${m}`:n?`${ps(e,o)}${m}`:i!==void 0?`Command failed with ${i}${m}`:d?`Command was killed with ${u} (${Qe(u)})${m}`:s!==void 0?`Command was killed with ${s} (${a})`:c!==void 0?`Command failed with exit code ${c}`:"Command failed"},Zd=(e,t)=>e?` and was forcefully terminated after ${t} milliseconds`:"",Jd=(e,t)=>{if(e instanceof C)return;let r=Vo(e)?e.originalMessage:String(e?.message??e),n=Te(Hi(r,t));return n===""?void 0:n},Qd=e=>typeof e=="string"?e:Kd(e),ep=e=>Array.isArray(e)?e.map(t=>me(hs(t))).filter(Boolean).join(`
37
+ `):hs(e),hs=e=>typeof e=="string"?e:w(e)?ve(e):"";var Ot=({command:e,escapedCommand:t,stdio:r,all:n,ipcOutput:o,options:{cwd:i},startTime:s})=>ys({command:e,escapedCommand:t,cwd:i,durationMs:tr(s),failed:!1,timedOut:!1,isCanceled:!1,isGracefullyCanceled:!1,isTerminated:!1,isMaxBuffer:!1,isForcefullyTerminated:!1,exitCode:0,stdout:r[1],stderr:r[2],all:n,stdio:r,ipcOutput:o,pipedFrom:[]}),ge=({error:e,command:t,escapedCommand:r,fileDescriptors:n,options:o,startTime:i,isSync:s})=>Ce({error:e,command:t,escapedCommand:r,startTime:i,timedOut:!1,isCanceled:!1,isGracefullyCanceled:!1,isMaxBuffer:!1,isForcefullyTerminated:!1,stdio:Array.from({length:n.length}),ipcOutput:[],options:o,isSync:s}),Ce=({error:e,command:t,escapedCommand:r,startTime:n,timedOut:o,isCanceled:i,isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:f,signal:l,stdio:d,all:p,ipcOutput:u,options:{timeoutDuration:m,timeout:g=m,forceKillAfterDelay:b,killSignal:y,cwd:x,maxBuffer:E},isSync:A})=>{let{exitCode:v,signal:k,signalDescription:K}=rp(f,l),{originalMessage:ne,shortMessage:z,message:Vt}=gs({stdio:d,all:p,ipcOutput:u,originalError:e,signal:k,signalDescription:K,exitCode:v,escapedCommand:r,timedOut:o,isCanceled:i,isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,forceKillAfterDelay:b,killSignal:y,maxBuffer:E,timeout:g,cwd:x}),xe=zo(e,Vt,A);return Object.assign(xe,tp({error:xe,command:t,escapedCommand:r,startTime:n,timedOut:o,isCanceled:i,isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:v,signal:k,signalDescription:K,stdio:d,all:p,ipcOutput:u,cwd:x,originalMessage:ne,shortMessage:z})),xe},tp=({error:e,command:t,escapedCommand:r,startTime:n,timedOut:o,isCanceled:i,isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:f,signal:l,signalDescription:d,stdio:p,all:u,ipcOutput:m,cwd:g,originalMessage:b,shortMessage:y})=>ys({shortMessage:y,originalMessage:b,command:t,escapedCommand:r,cwd:g,durationMs:tr(n),failed:!0,timedOut:o,isCanceled:i,isGracefullyCanceled:s,isTerminated:l!==void 0,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:f,signal:l,signalDescription:d,code:e.cause?.code,stdout:p[1],stderr:p[2],all:u,stdio:p,ipcOutput:m,pipedFrom:[]}),ys=e=>Object.fromEntries(Object.entries(e).filter(([,t])=>t!==void 0)),rp=(e,t)=>{let r=e===null?void 0:e,n=t===null?void 0:t,o=n===void 0?void 0:Qe(t);return{exitCode:r,signal:n,signalDescription:o}};var Ss=e=>Number.isFinite(e)?e:0;function np(e){return{days:Math.trunc(e/864e5),hours:Math.trunc(e/36e5%24),minutes:Math.trunc(e/6e4%60),seconds:Math.trunc(e/1e3%60),milliseconds:Math.trunc(e%1e3),microseconds:Math.trunc(Ss(e*1e3)%1e3),nanoseconds:Math.trunc(Ss(e*1e6)%1e3)}}function op(e){return{days:e/86400000n,hours:e/3600000n%24n,minutes:e/60000n%60n,seconds:e/1000n%60n,milliseconds:e%1000n,microseconds:0n,nanoseconds:0n}}function Ir(e){switch(typeof e){case"number":{if(Number.isFinite(e))return np(e);break}case"bigint":return op(e)}throw new TypeError("Expected a finite number or bigint")}var ip=e=>e===0||e===0n,sp=(e,t)=>t===1||t===1n?e:`${e}s`,ap=1e-7,cp=24n*60n*60n*1000n;function Rr(e,t){let r=typeof e=="bigint";if(!r&&!Number.isFinite(e))throw new TypeError("Expected a finite number or bigint");t={...t};let n=e<0?"-":"";e=e<0?-e:e,t.colonNotation&&(t.compact=!1,t.formatSubMilliseconds=!1,t.separateMilliseconds=!1,t.verbose=!1),t.compact&&(t.unitCount=1,t.secondsDecimalDigits=0,t.millisecondsDecimalDigits=0);let o=[],i=(l,d)=>{let p=Math.floor(l*10**d+ap);return(Math.round(p)/10**d).toFixed(d)},s=(l,d,p,u)=>{if(!((o.length===0||!t.colonNotation)&&ip(l)&&!(t.colonNotation&&p==="m"))){if(u??=String(l),t.colonNotation){let m=u.includes(".")?u.split(".")[0].length:u.length,g=o.length>0?2:1;u="0".repeat(Math.max(0,g-m))+u}else u+=t.verbose?" "+sp(d,l):p;o.push(u)}},a=Ir(e),c=BigInt(a.days);if(t.hideYearAndDays?s(BigInt(c)*24n+BigInt(a.hours),"hour","h"):(t.hideYear?s(c,"day","d"):(s(c/365n,"year","y"),s(c%365n,"day","d")),s(Number(a.hours),"hour","h")),s(Number(a.minutes),"minute","m"),!t.hideSeconds)if(t.separateMilliseconds||t.formatSubMilliseconds||!t.colonNotation&&e<1e3&&!t.subSecondsAsDecimals){let l=Number(a.seconds),d=Number(a.milliseconds),p=Number(a.microseconds),u=Number(a.nanoseconds);if(s(l,"second","s"),t.formatSubMilliseconds)s(d,"millisecond","ms"),s(p,"microsecond","\xB5s"),s(u,"nanosecond","ns");else{let m=d+p/1e3+u/1e6,g=typeof t.millisecondsDecimalDigits=="number"?t.millisecondsDecimalDigits:0,b=m>=1?Math.round(m):Math.ceil(m),y=g?m.toFixed(g):b;s(Number.parseFloat(y),"millisecond","ms",y)}}else{let l=(r?Number(e%cp):e)/1e3%60,d=typeof t.secondsDecimalDigits=="number"?t.secondsDecimalDigits:1,p=i(l,d),u=t.keepDecimalsOnWholeSeconds?p:p.replace(/\.0+$/,"");s(Number.parseFloat(u),"second","s",u)}if(o.length===0)return n+"0"+(t.verbose?" milliseconds":"ms");let f=t.colonNotation?":":" ";return typeof t.unitCount=="number"&&(o=o.slice(0,Math.max(t.unitCount,1))),n+o.join(f)}var bs=(e,t)=>{e.failed&&B({type:"error",verboseMessage:e.shortMessage,verboseInfo:t,result:e})};var ws=(e,t)=>{ie(t)&&(bs(e,t),lp(e,t))},lp=(e,t)=>{let r=`(done in ${Rr(e.durationMs)})`;B({type:"duration",verboseMessage:r,verboseInfo:t,result:e})};var ye=(e,t,{reject:r})=>{if(ws(e,t),e.failed&&r)throw e;return e};import{readFileSync as qs}from"fs";var Ts=(e,t)=>Q(e)?"asyncGenerator":Ds(e)?"generator":At(e)?"fileUrl":mp(e)?"filePath":yp(e)?"webStream":P(e,{checkOpen:!1})?"native":w(e)?"uint8Array":Sp(e)?"asyncIterable":bp(e)?"iterable":Pr(e)?Os({transform:e},t):up(e)?fp(e,t):"native",fp=(e,t)=>Tr(e.transform,{checkOpen:!1})?dp(e,t):Pr(e.transform)?Os(e,t):pp(e,t),dp=(e,t)=>(As(e,t,"Duplex stream"),"duplex"),Os=(e,t)=>(As(e,t,"web TransformStream"),"webTransform"),As=({final:e,binary:t,objectMode:r},n,o)=>{xs(e,`${n}.final`,o),xs(t,`${n}.binary`,o),Cr(r,`${n}.objectMode`)},xs=(e,t,r)=>{if(e!==void 0)throw new TypeError(`The \`${t}\` option can only be defined when using a generator, not a ${r}.`)},pp=({transform:e,final:t,binary:r,objectMode:n},o)=>{if(e!==void 0&&!Es(e))throw new TypeError(`The \`${o}.transform\` option must be a generator, a Duplex stream or a web TransformStream.`);if(Tr(t,{checkOpen:!1}))throw new TypeError(`The \`${o}.final\` option must not be a Duplex stream.`);if(Pr(t))throw new TypeError(`The \`${o}.final\` option must not be a web TransformStream.`);if(t!==void 0&&!Es(t))throw new TypeError(`The \`${o}.final\` option must be a generator.`);return Cr(r,`${o}.binary`),Cr(n,`${o}.objectMode`),Q(e)||Q(t)?"asyncGenerator":"generator"},Cr=(e,t)=>{if(e!==void 0&&typeof e!="boolean")throw new TypeError(`The \`${t}\` option must use a boolean.`)},Es=e=>Q(e)||Ds(e),Q=e=>Object.prototype.toString.call(e)==="[object AsyncGeneratorFunction]",Ds=e=>Object.prototype.toString.call(e)==="[object GeneratorFunction]",up=e=>S(e)&&(e.transform!==void 0||e.final!==void 0),At=e=>Object.prototype.toString.call(e)==="[object URL]",Is=e=>At(e)&&e.protocol!=="file:",mp=e=>S(e)&&Object.keys(e).length>0&&Object.keys(e).every(t=>hp.has(t))&&Mr(e.file),hp=new Set(["file","append"]),Mr=e=>typeof e=="string",Rs=(e,t)=>e==="native"&&typeof t=="string"&&!gp.has(t),gp=new Set(["ipc","ignore","inherit","overlapped","pipe"]),Cs=e=>Object.prototype.toString.call(e)==="[object ReadableStream]",Dt=e=>Object.prototype.toString.call(e)==="[object WritableStream]",yp=e=>Cs(e)||Dt(e),Pr=e=>Cs(e?.readable)&&Dt(e?.writable),Sp=e=>Ms(e)&&typeof e[Symbol.asyncIterator]=="function",bp=e=>Ms(e)&&typeof e[Symbol.iterator]=="function",Ms=e=>typeof e=="object"&&e!==null,I=new Set(["generator","asyncGenerator","duplex","webTransform"]),It=new Set(["fileUrl","filePath","fileNumber"]),Br=new Set(["fileUrl","filePath"]),Ps=new Set([...Br,"webStream","nodeStream"]),Bs=new Set(["webTransform","duplex"]),q={generator:"a generator",asyncGenerator:"an async generator",fileUrl:"a file URL",filePath:"a file path string",fileNumber:"a file descriptor number",webStream:"a web stream",nodeStream:"a Node.js stream",webTransform:"a web TransformStream",duplex:"a Duplex stream",native:"any value",iterable:"an iterable",asyncIterable:"an async iterable",string:"a string",uint8Array:"a Uint8Array"};var Lr=(e,t,r,n)=>n==="output"?wp(e,t,r):xp(e,t,r),wp=(e,t,r)=>{let n=t!==0&&r[t-1].value.readableObjectMode;return{writableObjectMode:n,readableObjectMode:e??n}},xp=(e,t,r)=>{let n=t===0?e===!0:r[t-1].value.readableObjectMode,o=t!==r.length-1&&(e??n);return{writableObjectMode:n,readableObjectMode:o}},Ls=(e,t)=>{let r=e.findLast(({type:n})=>I.has(n));return r===void 0?!1:t==="input"?r.value.writableObjectMode:r.value.readableObjectMode};var Fs=(e,t,r,n)=>[...e.filter(({type:o})=>!I.has(o)),...Ep(e,t,r,n)],Ep=(e,t,r,{encoding:n})=>{let o=e.filter(({type:s})=>I.has(s)),i=Array.from({length:o.length});for(let[s,a]of Object.entries(o))i[s]=Tp({stdioItem:a,index:Number(s),newTransforms:i,optionName:t,direction:r,encoding:n});return Ip(i,r)},Tp=({stdioItem:e,stdioItem:{type:t},index:r,newTransforms:n,optionName:o,direction:i,encoding:s})=>t==="duplex"?Op({stdioItem:e,optionName:o}):t==="webTransform"?Ap({stdioItem:e,index:r,newTransforms:n,direction:i}):Dp({stdioItem:e,index:r,newTransforms:n,direction:i,encoding:s}),Op=({stdioItem:e,stdioItem:{value:{transform:t,transform:{writableObjectMode:r,readableObjectMode:n},objectMode:o=n}},optionName:i})=>{if(o&&!n)throw new TypeError(`The \`${i}.objectMode\` option can only be \`true\` if \`new Duplex({objectMode: true})\` is used.`);if(!o&&n)throw new TypeError(`The \`${i}.objectMode\` option cannot be \`false\` if \`new Duplex({objectMode: true})\` is used.`);return{...e,value:{transform:t,writableObjectMode:r,readableObjectMode:n}}},Ap=({stdioItem:e,stdioItem:{value:t},index:r,newTransforms:n,direction:o})=>{let{transform:i,objectMode:s}=S(t)?t:{transform:t},{writableObjectMode:a,readableObjectMode:c}=Lr(s,r,n,o);return{...e,value:{transform:i,writableObjectMode:a,readableObjectMode:c}}},Dp=({stdioItem:e,stdioItem:{value:t},index:r,newTransforms:n,direction:o,encoding:i})=>{let{transform:s,final:a,binary:c=!1,preserveNewlines:f=!1,objectMode:l}=S(t)?t:{transform:t},d=c||O.has(i),{writableObjectMode:p,readableObjectMode:u}=Lr(l,r,n,o);return{...e,value:{transform:s,final:a,binary:d,preserveNewlines:f,writableObjectMode:p,readableObjectMode:u}}},Ip=(e,t)=>t==="input"?e.reverse():e;import Fr from"process";var $s=(e,t,r)=>{let n=e.map(o=>Rp(o,t));if(n.includes("input")&&n.includes("output"))throw new TypeError(`The \`${r}\` option must not be an array of both readable and writable values.`);return n.find(Boolean)??Pp},Rp=({type:e,value:t},r)=>Cp[r]??Us[e](t),Cp=["input","output","output"],Se=()=>{},$r=()=>"input",Us={generator:Se,asyncGenerator:Se,fileUrl:Se,filePath:Se,iterable:$r,asyncIterable:$r,uint8Array:$r,webStream:e=>Dt(e)?"output":"input",nodeStream(e){return J(e,{checkOpen:!1})?Er(e,{checkOpen:!1})?void 0:"input":"output"},webTransform:Se,duplex:Se,native(e){let t=Mp(e);if(t!==void 0)return t;if(P(e,{checkOpen:!1}))return Us.nodeStream(e)}},Mp=e=>{if([0,Fr.stdin].includes(e))return"input";if([1,2,Fr.stdout,Fr.stderr].includes(e))return"output"},Pp="output";var vs=(e,t)=>t&&!e.includes("ipc")?[...e,"ipc"]:e;var Ns=({stdio:e,ipc:t,buffer:r,...n},o,i)=>{let s=Bp(e,n).map((a,c)=>_s(a,c));return i?Fp(s,r,o):vs(s,t)},Bp=(e,t)=>{if(e===void 0)return D.map(n=>t[n]);if(Lp(t))throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${D.map(n=>`\`${n}\``).join(", ")}`);if(typeof e=="string")return[e,e,e];if(!Array.isArray(e))throw new TypeError(`Expected \`stdio\` to be of type \`string\` or \`Array\`, got \`${typeof e}\``);let r=Math.max(e.length,D.length);return Array.from({length:r},(n,o)=>e[o])},Lp=e=>D.some(t=>e[t]!==void 0),_s=(e,t)=>Array.isArray(e)?e.map(r=>_s(r,t)):e??(t>=D.length?"ignore":"pipe"),Fp=(e,t,r)=>e.map((n,o)=>!t[o]&&o!==0&&!se(r,o)&&$p(n)?"ignore":n),$p=e=>e==="pipe"||Array.isArray(e)&&e.every(t=>t==="pipe");import{readFileSync as Up}from"fs";import vp from"tty";var Gs=({stdioItem:e,stdioItem:{type:t},isStdioArray:r,fdNumber:n,direction:o,isSync:i})=>!r||t!=="native"?e:i?Np({stdioItem:e,fdNumber:n,direction:o}):Gp({stdioItem:e,fdNumber:n}),Np=({stdioItem:e,stdioItem:{value:t,optionName:r},fdNumber:n,direction:o})=>{let i=_p({value:t,optionName:r,fdNumber:n,direction:o});if(i!==void 0)return i;if(P(t,{checkOpen:!1}))throw new TypeError(`The \`${r}: Stream\` option cannot both be an array and include a stream with synchronous methods.`);return e},_p=({value:e,optionName:t,fdNumber:r,direction:n})=>{let o=jp(e,r);if(o!==void 0){if(n==="output")return{type:"fileNumber",value:o,optionName:t};if(vp.isatty(o))throw new TypeError(`The \`${t}: ${rt(e)}\` option is invalid: it cannot be a TTY with synchronous methods.`);return{type:"uint8Array",value:N(Up(o)),optionName:t}}},jp=(e,t)=>{if(e==="inherit")return t;if(typeof e=="number")return e;let r=Ne.indexOf(e);if(r!==-1)return r},Gp=({stdioItem:e,stdioItem:{value:t,optionName:r},fdNumber:n})=>t==="inherit"?{type:"nodeStream",value:js(n,t,r),optionName:r}:typeof t=="number"?{type:"nodeStream",value:js(t,t,r),optionName:r}:P(t,{checkOpen:!1})?{type:"nodeStream",value:t,optionName:r}:e,js=(e,t,r)=>{let n=Ne[e];if(n===void 0)throw new TypeError(`The \`${r}: ${t}\` option is invalid: no such standard stream.`);return n};var ks=({input:e,inputFile:t},r)=>r===0?[...kp(e),...Wp(t)]:[],kp=e=>e===void 0?[]:[{type:zp(e),value:e,optionName:"input"}],zp=e=>{if(J(e,{checkOpen:!1}))return"nodeStream";if(typeof e=="string")return"string";if(w(e))return"uint8Array";throw new Error("The `input` option must be a string, a Uint8Array or a Node.js Readable stream.")},Wp=e=>e===void 0?[]:[{...Vp(e),optionName:"inputFile"}],Vp=e=>{if(At(e))return{type:"fileUrl",value:e};if(Mr(e))return{type:"filePath",value:{file:e}};throw new Error("The `inputFile` option must be a file path string or a file URL.")};var zs=e=>e.filter((t,r)=>e.every((n,o)=>t.value!==n.value||r>=o||t.type==="generator"||t.type==="asyncGenerator")),Ws=({stdioItem:{type:e,value:t,optionName:r},direction:n,fileDescriptors:o,isSync:i})=>{let s=Yp(o,e);if(s.length!==0){if(i){qp({otherStdioItems:s,type:e,value:t,optionName:r,direction:n});return}if(Ps.has(e))return Vs({otherStdioItems:s,type:e,value:t,optionName:r,direction:n});Bs.has(e)&&Kp({otherStdioItems:s,type:e,value:t,optionName:r})}},Yp=(e,t)=>e.flatMap(({direction:r,stdioItems:n})=>n.filter(o=>o.type===t).map((o=>({...o,direction:r})))),qp=({otherStdioItems:e,type:t,value:r,optionName:n,direction:o})=>{Br.has(t)&&Vs({otherStdioItems:e,type:t,value:r,optionName:n,direction:o})},Vs=({otherStdioItems:e,type:t,value:r,optionName:n,direction:o})=>{let i=e.filter(a=>Hp(a,r));if(i.length===0)return;let s=i.find(a=>a.direction!==o);return Ys(s,n,t),o==="output"?i[0].stream:void 0},Hp=({type:e,value:t},r)=>e==="filePath"?t.file===r.file:e==="fileUrl"?t.href===r.href:t===r,Kp=({otherStdioItems:e,type:t,value:r,optionName:n})=>{let o=e.find(({value:{transform:i}})=>i===r.transform);Ys(o,n,t)},Ys=(e,t,r)=>{if(e!==void 0)throw new TypeError(`The \`${e.optionName}\` and \`${t}\` options must not target ${q[r]} that is the same.`)};var Rt=(e,t,r,n)=>{let i=Ns(t,r,n).map((a,c)=>Xp({stdioOption:a,fdNumber:c,options:t,isSync:n})),s=ou({initialFileDescriptors:i,addProperties:e,options:t,isSync:n});return t.stdio=s.map(({stdioItems:a})=>au(a)),s},Xp=({stdioOption:e,fdNumber:t,options:r,isSync:n})=>{let o=_e(t),{stdioItems:i,isStdioArray:s}=Zp({stdioOption:e,fdNumber:t,options:r,optionName:o}),a=$s(i,t,o),c=i.map(d=>Gs({stdioItem:d,isStdioArray:s,fdNumber:t,direction:a,isSync:n})),f=Fs(c,o,a,r),l=Ls(f,a);return nu(f,l),{direction:a,objectMode:l,stdioItems:f}},Zp=({stdioOption:e,fdNumber:t,options:r,optionName:n})=>{let i=[...(Array.isArray(e)?e:[e]).map(c=>Jp(c,n)),...ks(r,t)],s=zs(i),a=s.length>1;return Qp(s,a,n),tu(s),{stdioItems:s,isStdioArray:a}},Jp=(e,t)=>({type:Ts(e,t),value:e,optionName:t}),Qp=(e,t,r)=>{if(e.length===0)throw new TypeError(`The \`${r}\` option must not be an empty array.`);if(t){for(let{value:n,optionName:o}of e)if(eu.has(n))throw new Error(`The \`${o}\` option must not include \`${n}\`.`)}},eu=new Set(["ignore","ipc"]),tu=e=>{for(let t of e)ru(t)},ru=({type:e,value:t,optionName:r})=>{if(Is(t))throw new TypeError(`The \`${r}: URL\` option must use the \`file:\` scheme.
38
+ For example, you can use the \`pathToFileURL()\` method of the \`url\` core module.`);if(Rs(e,t))throw new TypeError(`The \`${r}: { file: '...' }\` option must be used instead of \`${r}: '...'\`.`)},nu=(e,t)=>{if(!t)return;let r=e.find(({type:n})=>It.has(n));if(r!==void 0)throw new TypeError(`The \`${r.optionName}\` option cannot use both files and transforms in objectMode.`)},ou=({initialFileDescriptors:e,addProperties:t,options:r,isSync:n})=>{let o=[];try{for(let i of e)o.push(iu({fileDescriptor:i,fileDescriptors:o,addProperties:t,options:r,isSync:n}));return o}catch(i){throw Ur(o),i}},iu=({fileDescriptor:{direction:e,objectMode:t,stdioItems:r},fileDescriptors:n,addProperties:o,options:i,isSync:s})=>{let a=r.map(c=>su({stdioItem:c,addProperties:o,direction:e,options:i,fileDescriptors:n,isSync:s}));return{direction:e,objectMode:t,stdioItems:a}},su=({stdioItem:e,addProperties:t,direction:r,options:n,fileDescriptors:o,isSync:i})=>{let s=Ws({stdioItem:e,direction:r,fileDescriptors:o,isSync:i});return s!==void 0?{...e,stream:s}:{...e,...t[r][e.type](e,n)}},Ur=e=>{for(let{stdioItems:t}of e)for(let{stream:r}of t)r!==void 0&&!R(r)&&r.destroy()},au=e=>{if(e.length>1)return e.some(({value:n})=>n==="overlapped")?"overlapped":"pipe";let[{type:t,value:r}]=e;return t==="native"?r:"pipe"};var Ks=(e,t)=>Rt(lu,e,t,!0),U=({type:e,optionName:t})=>{Xs(t,q[e])},cu=({optionName:e,value:t})=>((t==="ipc"||t==="overlapped")&&Xs(e,`"${t}"`),{}),Xs=(e,t)=>{throw new TypeError(`The \`${e}\` option cannot be ${t} with synchronous methods.`)},Hs={generator(){},asyncGenerator:U,webStream:U,nodeStream:U,webTransform:U,duplex:U,asyncIterable:U,native:cu},lu={input:{...Hs,fileUrl:({value:e})=>({contents:[N(qs(e))]}),filePath:({value:{file:e}})=>({contents:[N(qs(e))]}),fileNumber:U,iterable:({value:e})=>({contents:[...e]}),string:({value:e})=>({contents:[e]}),uint8Array:({value:e})=>({contents:[e]})},output:{...Hs,fileUrl:({value:e})=>({path:e}),filePath:({value:{file:e,append:t}})=>({path:e,append:t}),fileNumber:({value:e})=>({path:e}),iterable:U,string:U,uint8Array:U}};var G=(e,{stripFinalNewline:t},r)=>vr(t,r)&&e!==void 0&&!Array.isArray(e)?me(e):e,vr=(e,t)=>t==="all"?e[1]||e[2]:e[t];import{Transform as Mu,getDefaultHighWaterMark as aa}from"stream";var Ct=(e,t,r,n)=>e||r?void 0:Js(t,n),_r=(e,t,r)=>r?e.flatMap(n=>Zs(n,t)):Zs(e,t),Zs=(e,t)=>{let{transform:r,final:n}=Js(t,{});return[...r(e),...n()]},Js=(e,t)=>(t.previousChunks="",{transform:fu.bind(void 0,t,e),final:pu.bind(void 0,t)}),fu=function*(e,t,r){if(typeof r!="string"){yield r;return}let{previousChunks:n}=e,o=-1;for(let i=0;i<r.length;i+=1)if(r[i]===`
39
+ `){let s=du(r,i,t,e),a=r.slice(o+1,i+1-s);n.length>0&&(a=Nr(n,a),n=""),yield a,o=i}o!==r.length-1&&(n=Nr(n,r.slice(o+1))),e.previousChunks=n},du=(e,t,r,n)=>r?0:(n.isWindowsNewline=t!==0&&e[t-1]==="\r",n.isWindowsNewline?2:1),pu=function*({previousChunks:e}){e.length>0&&(yield e)},Qs=({binary:e,preserveNewlines:t,readableObjectMode:r,state:n})=>e||t||r?void 0:{transform:uu.bind(void 0,n)},uu=function*({isWindowsNewline:e=!1},t){let{unixNewline:r,windowsNewline:n,LF:o,concatBytes:i}=typeof t=="string"?mu:gu;if(t.at(-1)===o){yield t;return}yield i(t,e?n:r)},Nr=(e,t)=>`${e}${t}`,mu={windowsNewline:`\r
40
+ `,unixNewline:`
41
+ `,LF:`
42
+ `,concatBytes:Nr},hu=(e,t)=>{let r=new Uint8Array(e.length+t.length);return r.set(e,0),r.set(t,e.length),r},gu={windowsNewline:new Uint8Array([13,10]),unixNewline:new Uint8Array([10]),LF:10,concatBytes:hu};import{Buffer as yu}from"buffer";var ea=(e,t)=>e?void 0:Su.bind(void 0,t),Su=function*(e,t){if(typeof t!="string"&&!w(t)&&!yu.isBuffer(t))throw new TypeError(`The \`${e}\` option's transform must use "objectMode: true" to receive as input: ${typeof t}.`);yield t},ta=(e,t)=>e?bu.bind(void 0,t):wu.bind(void 0,t),bu=function*(e,t){ra(e,t),yield t},wu=function*(e,t){if(ra(e,t),typeof t!="string"&&!w(t))throw new TypeError(`The \`${e}\` option's function must yield a string or an Uint8Array, not ${typeof t}.`);yield t},ra=(e,t)=>{if(t==null)throw new TypeError(`The \`${e}\` option's function must not call \`yield ${t}\`.
43
+ Instead, \`yield\` should either be called with a value, or not be called at all. For example:
44
+ if (condition) { yield value; }`)};import{Buffer as xu}from"buffer";import{StringDecoder as Eu}from"string_decoder";var Mt=(e,t,r)=>{if(r)return;if(e)return{transform:Tu.bind(void 0,new TextEncoder)};let n=new Eu(t);return{transform:Ou.bind(void 0,n),final:Au.bind(void 0,n)}},Tu=function*(e,t){xu.isBuffer(t)?yield N(t):typeof t=="string"?yield e.encode(t):yield t},Ou=function*(e,t){yield w(t)?e.write(t):t},Au=function*(e){let t=e.end();t!==""&&(yield t)};import{callbackify as na}from"util";var jr=na(async(e,t,r,n)=>{t.currentIterable=e(...r);try{for await(let o of t.currentIterable)n.push(o)}finally{delete t.currentIterable}}),Pt=async function*(e,t,r){if(r===t.length){yield e;return}let{transform:n=Iu}=t[r];for await(let o of n(e))yield*Pt(o,t,r+1)},oa=async function*(e){for(let[t,{final:r}]of Object.entries(e))yield*Du(r,Number(t),e)},Du=async function*(e,t,r){if(e!==void 0)for await(let n of e())yield*Pt(n,r,t+1)},ia=na(async({currentIterable:e},t)=>{if(e!==void 0){await(t?e.throw(t):e.return());return}if(t)throw t}),Iu=function*(e){yield e};var Gr=(e,t,r,n)=>{try{for(let o of e(...t))r.push(o);n()}catch(o){n(o)}},sa=(e,t)=>[...t.flatMap(r=>[...ee(r,e,0)]),...Me(e)],ee=function*(e,t,r){if(r===t.length){yield e;return}let{transform:n=Cu}=t[r];for(let o of n(e))yield*ee(o,t,r+1)},Me=function*(e){for(let[t,{final:r}]of Object.entries(e))yield*Ru(r,Number(t),e)},Ru=function*(e,t,r){if(e!==void 0)for(let n of e())yield*ee(n,r,t+1)},Cu=function*(e){yield e};var kr=({value:e,value:{transform:t,final:r,writableObjectMode:n,readableObjectMode:o},optionName:i},{encoding:s})=>{let a={},c=ca(e,s,i),f=Q(t),l=Q(r),d=f?jr.bind(void 0,Pt,a):Gr.bind(void 0,ee),p=f||l?jr.bind(void 0,oa,a):Gr.bind(void 0,Me),u=f||l?ia.bind(void 0,a):void 0;return{stream:new Mu({writableObjectMode:n,writableHighWaterMark:aa(n),readableObjectMode:o,readableHighWaterMark:aa(o),transform(g,b,y){d([g,c,0],this,y)},flush(g){p([c],this,g)},destroy:u})}},Bt=(e,t,r,n)=>{let o=t.filter(({type:s})=>s==="generator"),i=n?o.reverse():o;for(let{value:s,optionName:a}of i){let c=ca(s,r,a);e=sa(c,e)}return e},ca=({transform:e,final:t,binary:r,writableObjectMode:n,readableObjectMode:o,preserveNewlines:i},s,a)=>{let c={};return[{transform:ea(n,a)},Mt(r,s,n),Ct(r,i,n,c),{transform:e,final:t},{transform:ta(o,a)},Qs({binary:r,preserveNewlines:i,readableObjectMode:o,state:c})].filter(Boolean)};var la=(e,t)=>{for(let r of Pu(e))Bu(e,r,t)},Pu=e=>new Set(Object.entries(e).filter(([,{direction:t}])=>t==="input").map(([t])=>Number(t))),Bu=(e,t,r)=>{let{stdioItems:n}=e[t],o=n.filter(({contents:a})=>a!==void 0);if(o.length===0)return;if(t!==0){let[{type:a,optionName:c}]=o;throw new TypeError(`Only the \`stdin\` option, not \`${c}\`, can be ${q[a]} with synchronous methods.`)}let s=o.map(({contents:a})=>a).map(a=>Lu(a,n));r.input=Ee(s)},Lu=(e,t)=>{let r=Bt(e,t,"utf8",!0);return Fu(r),Ee(r)},Fu=e=>{let t=e.find(r=>typeof r!="string"&&!w(r));if(t!==void 0)throw new TypeError(`The \`stdin\` option is invalid: when passing objects as input, a transform must be used to serialize them to strings or Uint8Arrays: ${t}.`)};import{writeFileSync as Nu,appendFileSync as _u}from"fs";var Lt=({stdioItems:e,encoding:t,verboseInfo:r,fdNumber:n})=>n!=="all"&&se(r,n)&&!O.has(t)&&$u(n)&&(e.some(({type:o,value:i})=>o==="native"&&Uu.has(i))||e.every(({type:o})=>I.has(o))),$u=e=>e===1||e===2,Uu=new Set(["pipe","overlapped"]),fa=async(e,t,r,n)=>{for await(let o of e)vu(t)||pa(o,r,n)},da=(e,t,r)=>{for(let n of e)pa(n,t,r)},vu=e=>e._readableState.pipes.length>0,pa=(e,t,r)=>{let n=Ve(e);B({type:"output",verboseMessage:n,fdNumber:t,verboseInfo:r})};var ua=({fileDescriptors:e,syncResult:{output:t},options:r,isMaxBuffer:n,verboseInfo:o})=>{if(t===null)return{output:Array.from({length:3})};let i={},s=new Set([]);return{output:t.map((c,f)=>ju({result:c,fileDescriptors:e,fdNumber:f,state:i,outputFiles:s,isMaxBuffer:n,verboseInfo:o},r)),...i}},ju=({result:e,fileDescriptors:t,fdNumber:r,state:n,outputFiles:o,isMaxBuffer:i,verboseInfo:s},{buffer:a,encoding:c,lines:f,stripFinalNewline:l,maxBuffer:d})=>{if(e===null)return;let p=ms(e,i,d),u=N(p),{stdioItems:m,objectMode:g}=t[r],b=Gu([u],m,c,n),{serializedResult:y,finalResult:x=y}=ku({chunks:b,objectMode:g,encoding:c,lines:f,stripFinalNewline:l,fdNumber:r});zu({serializedResult:y,fdNumber:r,state:n,verboseInfo:s,encoding:c,stdioItems:m,objectMode:g});let E=a[r]?x:void 0;try{return n.error===void 0&&Wu(y,m,o),E}catch(A){return n.error=A,E}},Gu=(e,t,r,n)=>{try{return Bt(e,t,r,!1)}catch(o){return n.error=o,e}},ku=({chunks:e,objectMode:t,encoding:r,lines:n,stripFinalNewline:o,fdNumber:i})=>{if(t)return{serializedResult:e};if(r==="buffer")return{serializedResult:Ee(e)};let s=In(e,r);return n[i]?{serializedResult:s,finalResult:_r(s,!o[i],t)}:{serializedResult:s}},zu=({serializedResult:e,fdNumber:t,state:r,verboseInfo:n,encoding:o,stdioItems:i,objectMode:s})=>{if(!Lt({stdioItems:i,encoding:o,verboseInfo:n,fdNumber:t}))return;let a=_r(e,!1,s);try{da(a,t,n)}catch(c){r.error??=c}},Wu=(e,t,r)=>{for(let{path:n,append:o}of t.filter(({type:i})=>It.has(i))){let i=typeof n=="string"?n:n.toString();o||r.has(i)?_u(n,e):(r.add(i),Nu(n,e))}};var ma=([,e,t],r)=>{if(r.all)return e===void 0?t:t===void 0?e:Array.isArray(e)?Array.isArray(t)?[...e,...t]:[...e,G(t,r,"all")]:Array.isArray(t)?[G(e,r,"all"),...t]:w(e)&&w(t)?Ht([e,t]):`${e}${t}`};import{once as zr}from"events";var ha=async(e,t)=>{let[r,n]=await Vu(e);return t.isForcefullyTerminated??=!1,[r,n]},Vu=async e=>{let[t,r]=await Promise.allSettled([zr(e,"spawn"),zr(e,"exit")]);return t.status==="rejected"?[]:r.status==="rejected"?ga(e):r.value},ga=async e=>{try{return await zr(e,"exit")}catch{return ga(e)}},ya=async e=>{let[t,r]=await e;if(!Yu(t,r)&&Wr(t,r))throw new C;return[t,r]},Yu=(e,t)=>e===void 0&&t===void 0,Wr=(e,t)=>e!==0||t!==null;var Sa=({error:e,status:t,signal:r,output:n},{maxBuffer:o})=>{let i=qu(e,t,r),s=i?.code==="ETIMEDOUT",a=us(i,n,o);return{resultError:i,exitCode:t,signal:r,timedOut:s,isMaxBuffer:a}},qu=(e,t,r)=>e!==void 0?e:Wr(t,r)?new C:void 0;var ba=(e,t,r)=>{let{file:n,commandArguments:o,command:i,escapedCommand:s,startTime:a,verboseInfo:c,options:f,fileDescriptors:l}=Ku(e,t,r),d=Ju({file:n,commandArguments:o,options:f,command:i,escapedCommand:s,verboseInfo:c,fileDescriptors:l,startTime:a});return ye(d,c,f)},Ku=(e,t,r)=>{let{command:n,escapedCommand:o,startTime:i,verboseInfo:s}=qe(e,t,r),a=Xu(r),{file:c,commandArguments:f,options:l}=mt(e,t,a);Zu(l);let d=Ks(l,s);return{file:c,commandArguments:f,command:n,escapedCommand:o,startTime:i,verboseInfo:s,options:l,fileDescriptors:d}},Xu=e=>e.node&&!e.ipc?{...e,ipc:!1}:e,Zu=({ipc:e,ipcInput:t,detached:r,cancelSignal:n})=>{t&&Ft("ipcInput"),e&&Ft("ipc: true"),r&&Ft("detached: true"),n&&Ft("cancelSignal")},Ft=e=>{throw new TypeError(`The "${e}" option cannot be used with synchronous methods.`)},Ju=({file:e,commandArguments:t,options:r,command:n,escapedCommand:o,verboseInfo:i,fileDescriptors:s,startTime:a})=>{let c=Qu({file:e,commandArguments:t,options:r,command:n,escapedCommand:o,fileDescriptors:s,startTime:a});if(c.failed)return c;let{resultError:f,exitCode:l,signal:d,timedOut:p,isMaxBuffer:u}=Sa(c,r),{output:m,error:g=f}=ua({fileDescriptors:s,syncResult:c,options:r,isMaxBuffer:u,verboseInfo:i}),b=m.map((x,E)=>G(x,r,E)),y=G(ma(m,r),r,"all");return tm({error:g,exitCode:l,signal:d,timedOut:p,isMaxBuffer:u,stdio:b,all:y,options:r,command:n,escapedCommand:o,startTime:a})},Qu=({file:e,commandArguments:t,options:r,command:n,escapedCommand:o,fileDescriptors:i,startTime:s})=>{try{la(i,r);let a=em(r);return Hu(...ht(e,t,a))}catch(a){return ge({error:a,command:n,escapedCommand:o,fileDescriptors:i,options:r,startTime:s,isSync:!0})}},em=({encoding:e,maxBuffer:t,...r})=>({...r,encoding:"buffer",maxBuffer:Tt(t)}),tm=({error:e,exitCode:t,signal:r,timedOut:n,isMaxBuffer:o,stdio:i,all:s,options:a,command:c,escapedCommand:f,startTime:l})=>e===void 0?Ot({command:c,escapedCommand:f,stdio:i,all:s,ipcOutput:[],options:a,startTime:l}):Ce({error:e,command:c,escapedCommand:f,timedOut:n,isCanceled:!1,isGracefullyCanceled:!1,isMaxBuffer:o,isForcefullyTerminated:!1,exitCode:t,signal:r,stdio:i,all:s,ipcOutput:[],options:a,startTime:l,isSync:!0});import{setMaxListeners as kh}from"events";import{spawn as zh}from"child_process";import Oa from"process";import{once as Vr,on as rm}from"events";var wa=({anyProcess:e,channel:t,isSubprocess:r,ipc:n},{reference:o=!0,filter:i}={})=>(de({methodName:"getOneMessage",isSubprocess:r,ipc:n,isConnected:ct(e)}),nm({anyProcess:e,channel:t,isSubprocess:r,filter:i,reference:o})),nm=async({anyProcess:e,channel:t,isSubprocess:r,filter:n,reference:o})=>{ot(t,o);let i=Y(e,t,r),s=new AbortController;try{return await Promise.race([om(i,n,s),im(i,r,s),sm(i,r,s)])}catch(a){throw pe(e),a}finally{s.abort(),it(t,o)}},om=async(e,t,{signal:r})=>{if(t===void 0){let[n]=await Vr(e,"message",{signal:r});return n}for await(let[n]of rm(e,"message",{signal:r}))if(t(n))return n},im=async(e,t,{signal:r})=>{await Vr(e,"disconnect",{signal:r}),si(t)},sm=async(e,t,{signal:r})=>{let[n]=await Vr(e,"strict:error",{signal:r});throw tt(n,t)};import{once as Ea,on as am}from"events";var Ta=({anyProcess:e,channel:t,isSubprocess:r,ipc:n},{reference:o=!0}={})=>Yr({anyProcess:e,channel:t,isSubprocess:r,ipc:n,shouldAwait:!r,reference:o}),Yr=({anyProcess:e,channel:t,isSubprocess:r,ipc:n,shouldAwait:o,reference:i})=>{de({methodName:"getEachMessage",isSubprocess:r,ipc:n,isConnected:ct(e)}),ot(t,i);let s=Y(e,t,r),a=new AbortController,c={};return cm(e,s,a),lm({ipcEmitter:s,isSubprocess:r,controller:a,state:c}),fm({anyProcess:e,channel:t,ipcEmitter:s,isSubprocess:r,shouldAwait:o,controller:a,state:c,reference:i})},cm=async(e,t,r)=>{try{await Ea(t,"disconnect",{signal:r.signal}),r.abort()}catch{}},lm=async({ipcEmitter:e,isSubprocess:t,controller:r,state:n})=>{try{let[o]=await Ea(e,"strict:error",{signal:r.signal});n.error=tt(o,t),r.abort()}catch{}},fm=async function*({anyProcess:e,channel:t,ipcEmitter:r,isSubprocess:n,shouldAwait:o,controller:i,state:s,reference:a}){try{for await(let[c]of am(r,"message",{signal:i.signal}))xa(s),yield c}catch{xa(s)}finally{i.abort(),it(t,a),n||pe(e),o&&await e}},xa=({error:e})=>{if(e)throw e};var Aa=(e,{ipc:t})=>{Object.assign(e,Ia(e,!1,t))},Da=()=>{let e=Oa,t=!0,r=Oa.channel!==void 0;return{...Ia(e,t,r),getCancelSignal:Li.bind(void 0,{anyProcess:e,channel:e.channel,isSubprocess:t,ipc:r})}},Ia=(e,t,r)=>({sendMessage:pt.bind(void 0,{anyProcess:e,channel:e.channel,isSubprocess:t,ipc:r}),getOneMessage:wa.bind(void 0,{anyProcess:e,channel:e.channel,isSubprocess:t,ipc:r}),getEachMessage:Ta.bind(void 0,{anyProcess:e,channel:e.channel,isSubprocess:t,ipc:r})});import{ChildProcess as dm}from"child_process";import{PassThrough as pm,Readable as um,Writable as mm,Duplex as hm}from"stream";var Ra=({error:e,command:t,escapedCommand:r,fileDescriptors:n,options:o,startTime:i,verboseInfo:s})=>{Ur(n);let a=new dm;gm(a,n),Object.assign(a,{readable:ym,writable:Sm,duplex:bm});let c=ge({error:e,command:t,escapedCommand:r,fileDescriptors:n,options:o,startTime:i,isSync:!1}),f=wm(c,s,o);return{subprocess:a,promise:f}},gm=(e,t)=>{let r=Pe(),n=Pe(),o=Pe(),i=Array.from({length:t.length-3},Pe),s=Pe(),a=[r,n,o,...i];Object.assign(e,{stdin:r,stdout:n,stderr:o,all:s,stdio:a})},Pe=()=>{let e=new pm;return e.end(),e},ym=()=>new um({read(){}}),Sm=()=>new mm({write(){}}),bm=()=>new hm({read(){},write(){}}),wm=async(e,t,r)=>ye(e,t,r);import{createReadStream as Ca,createWriteStream as Ma}from"fs";import{Buffer as xm}from"buffer";import{Readable as Be,Writable as Em,Duplex as Tm}from"stream";var Ba=(e,t)=>Rt(Om,e,t,!1),Le=({type:e,optionName:t})=>{throw new TypeError(`The \`${t}\` option cannot be ${q[e]}.`)},Pa={fileNumber:Le,generator:kr,asyncGenerator:kr,nodeStream:({value:e})=>({stream:e}),webTransform({value:{transform:e,writableObjectMode:t,readableObjectMode:r}}){let n=t||r;return{stream:Tm.fromWeb(e,{objectMode:n})}},duplex:({value:{transform:e}})=>({stream:e}),native(){}},Om={input:{...Pa,fileUrl:({value:e})=>({stream:Ca(e)}),filePath:({value:{file:e}})=>({stream:Ca(e)}),webStream:({value:e})=>({stream:Be.fromWeb(e)}),iterable:({value:e})=>({stream:Be.from(e)}),asyncIterable:({value:e})=>({stream:Be.from(e)}),string:({value:e})=>({stream:Be.from(e)}),uint8Array:({value:e})=>({stream:Be.from(xm.from(e))})},output:{...Pa,fileUrl:({value:e})=>({stream:Ma(e)}),filePath:({value:{file:e,append:t}})=>({stream:Ma(e,t?{flags:"a"}:{})}),webStream:({value:e})=>({stream:Em.fromWeb(e)}),iterable:Le,asyncIterable:Le,string:Le,uint8Array:Le}};import{on as Am,once as La}from"events";import{PassThrough as Dm,getDefaultHighWaterMark as Im}from"stream";import{finished as Ua}from"stream/promises";function te(e){if(!Array.isArray(e))throw new TypeError(`Expected an array, got \`${typeof e}\`.`);for(let o of e)Hr(o);let t=e.some(({readableObjectMode:o})=>o),r=Rm(e,t),n=new qr({objectMode:t,writableHighWaterMark:r,readableHighWaterMark:r});for(let o of e)n.add(o);return n}var Rm=(e,t)=>{if(e.length===0)return Im(t);let r=e.filter(({readableObjectMode:n})=>n===t).map(({readableHighWaterMark:n})=>n);return Math.max(...r)},qr=class extends Dm{#t=new Set([]);#r=new Set([]);#e=new Set([]);#n;#i=Symbol("unpipe");#o=new WeakMap;add(t){if(Hr(t),this.#t.has(t))return;this.#t.add(t),this.#n??=Cm(this,this.#t,this.#i);let r=Bm({passThroughStream:this,stream:t,streams:this.#t,ended:this.#r,aborted:this.#e,onFinished:this.#n,unpipeEvent:this.#i});this.#o.set(t,r),t.pipe(this,{end:!1})}async remove(t){if(Hr(t),!this.#t.has(t))return!1;let r=this.#o.get(t);return r===void 0?!1:(this.#o.delete(t),t.unpipe(this),await r,!0)}},Cm=async(e,t,r)=>{$t(e,Fa);let n=new AbortController;try{await Promise.race([Mm(e,n),Pm(e,t,r,n)])}finally{n.abort(),$t(e,-Fa)}},Mm=async(e,{signal:t})=>{try{await Ua(e,{signal:t,cleanup:!0})}catch(r){throw va(e,r),r}},Pm=async(e,t,r,{signal:n})=>{for await(let[o]of Am(e,"unpipe",{signal:n}))t.has(o)&&o.emit(r)},Hr=e=>{if(typeof e?.pipe!="function")throw new TypeError(`Expected a readable stream, got: \`${typeof e}\`.`)},Bm=async({passThroughStream:e,stream:t,streams:r,ended:n,aborted:o,onFinished:i,unpipeEvent:s})=>{$t(e,$a);let a=new AbortController;try{await Promise.race([Lm(i,t,a),Fm({passThroughStream:e,stream:t,streams:r,ended:n,aborted:o,controller:a}),$m({stream:t,streams:r,ended:n,aborted:o,unpipeEvent:s,controller:a})])}finally{a.abort(),$t(e,-$a)}r.size>0&&r.size===n.size+o.size&&(n.size===0&&o.size>0?Kr(e):Um(e))},Lm=async(e,t,{signal:r})=>{try{await e,r.aborted||Kr(t)}catch(n){r.aborted||va(t,n)}},Fm=async({passThroughStream:e,stream:t,streams:r,ended:n,aborted:o,controller:{signal:i}})=>{try{await Ua(t,{signal:i,cleanup:!0,readable:!0,writable:!1}),r.has(t)&&n.add(t)}catch(s){if(i.aborted||!r.has(t))return;Na(s)?o.add(t):_a(e,s)}},$m=async({stream:e,streams:t,ended:r,aborted:n,unpipeEvent:o,controller:{signal:i}})=>{if(await La(e,o,{signal:i}),!e.readable)return La(i,"abort",{signal:i});t.delete(e),r.delete(e),n.delete(e)},Um=e=>{e.writable&&e.end()},va=(e,t)=>{Na(t)?Kr(e):_a(e,t)},Na=e=>e?.code==="ERR_STREAM_PREMATURE_CLOSE",Kr=e=>{(e.readable||e.writable)&&e.destroy()},_a=(e,t)=>{e.destroyed||(e.once("error",vm),e.destroy(t))},vm=()=>{},$t=(e,t)=>{let r=e.getMaxListeners();r!==0&&r!==Number.POSITIVE_INFINITY&&e.setMaxListeners(r+t)},Fa=2,$a=1;import{finished as ja}from"stream/promises";var be=(e,t)=>{e.pipe(t),Nm(e,t),_m(e,t)},Nm=async(e,t)=>{if(!(R(e)||R(t))){try{await ja(e,{cleanup:!0,readable:!0,writable:!1})}catch{}Xr(t)}},Xr=e=>{e.writable&&e.end()},_m=async(e,t)=>{if(!(R(e)||R(t))){try{await ja(t,{cleanup:!0,readable:!1,writable:!0})}catch{}Zr(e)}},Zr=e=>{e.readable&&e.destroy()};var Ga=(e,t,r)=>{let n=new Map;for(let[o,{stdioItems:i,direction:s}]of Object.entries(t)){for(let{stream:a}of i.filter(({type:c})=>I.has(c)))jm(e,a,s,o);for(let{stream:a}of i.filter(({type:c})=>!I.has(c)))km({subprocess:e,stream:a,direction:s,fdNumber:o,pipeGroups:n,controller:r})}for(let[o,i]of n.entries()){let s=i.length===1?i[0]:te(i);be(s,o)}},jm=(e,t,r,n)=>{r==="output"?be(e.stdio[n],t):be(t,e.stdio[n]);let o=Gm[n];o!==void 0&&(e[o]=t),e.stdio[n]=t},Gm=["stdin","stdout","stderr"],km=({subprocess:e,stream:t,direction:r,fdNumber:n,pipeGroups:o,controller:i})=>{if(t===void 0)return;zm(t,i);let[s,a]=r==="output"?[t,e.stdio[n]]:[e.stdio[n],t],c=o.get(s)??[];o.set(s,[...c,a])},zm=(e,{signal:t})=>{R(e)&&Z(e,Wm,t)},Wm=2;import{addAbortListener as qm}from"events";var re=[];re.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&re.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&re.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT");var Ut=e=>!!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",Jr=Symbol.for("signal-exit emitter"),Qr=globalThis,Vm=Object.defineProperty.bind(Object),en=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(Qr[Jr])return Qr[Jr];Vm(Qr,Jr,{value:this,writable:!1,enumerable:!1,configurable:!1})}on(t,r){this.listeners[t].push(r)}removeListener(t,r){let n=this.listeners[t],o=n.indexOf(r);o!==-1&&(o===0&&n.length===1?n.length=0:n.splice(o,1))}emit(t,r,n){if(this.emitted[t])return!1;this.emitted[t]=!0;let o=!1;for(let i of this.listeners[t])o=i(r,n)===!0||o;return t==="exit"&&(o=this.emit("afterExit",r,n)||o),o}},vt=class{},Ym=e=>({onExit(t,r){return e.onExit(t,r)},load(){return e.load()},unload(){return e.unload()}}),tn=class extends vt{onExit(){return()=>{}}load(){}unload(){}},rn=class extends vt{#t=nn.platform==="win32"?"SIGINT":"SIGHUP";#r=new en;#e;#n;#i;#o={};#s=!1;constructor(t){super(),this.#e=t,this.#o={};for(let r of re)this.#o[r]=()=>{let n=this.#e.listeners(r),{count:o}=this.#r,i=t;if(typeof i.__signal_exit_emitter__=="object"&&typeof i.__signal_exit_emitter__.count=="number"&&(o+=i.__signal_exit_emitter__.count),n.length===o){this.unload();let s=this.#r.emit("exit",null,r),a=r==="SIGHUP"?this.#t:r;s||t.kill(t.pid,a)}};this.#i=t.reallyExit,this.#n=t.emit}onExit(t,r){if(!Ut(this.#e))return()=>{};this.#s===!1&&this.load();let n=r?.alwaysLast?"afterExit":"exit";return this.#r.on(n,t),()=>{this.#r.removeListener(n,t),this.#r.listeners.exit.length===0&&this.#r.listeners.afterExit.length===0&&this.unload()}}load(){if(!this.#s){this.#s=!0,this.#r.count+=1;for(let t of re)try{let r=this.#o[t];r&&this.#e.on(t,r)}catch{}this.#e.emit=(t,...r)=>this.#c(t,...r),this.#e.reallyExit=t=>this.#a(t)}}unload(){this.#s&&(this.#s=!1,re.forEach(t=>{let r=this.#o[t];if(!r)throw new Error("Listener not defined for signal: "+t);try{this.#e.removeListener(t,r)}catch{}}),this.#e.emit=this.#n,this.#e.reallyExit=this.#i,this.#r.count-=1)}#a(t){return Ut(this.#e)?(this.#e.exitCode=t||0,this.#r.emit("exit",this.#e.exitCode,null),this.#i.call(this.#e,this.#e.exitCode)):0}#c(t,...r){let n=this.#n;if(t==="exit"&&Ut(this.#e)){typeof r[0]=="number"&&(this.#e.exitCode=r[0]);let o=n.call(this.#e,t,...r);return this.#r.emit("exit",this.#e.exitCode,null),o}else return n.call(this.#e,t,...r)}},nn=globalThis.process,{onExit:ka,load:iO,unload:sO}=Ym(Ut(nn)?new rn(nn):new tn);var za=(e,{cleanup:t,detached:r},{signal:n})=>{if(!t||r)return;let o=ka(()=>{e.kill()});qm(n,()=>{o()})};var Va=({source:e,sourcePromise:t,boundOptions:r,createNested:n},...o)=>{let i=Ye(),{destination:s,destinationStream:a,destinationError:c,from:f,unpipeSignal:l}=Hm(r,n,o),{sourceStream:d,sourceError:p}=Xm(e,f),{options:u,fileDescriptors:m}=F.get(e);return{sourcePromise:t,sourceStream:d,sourceOptions:u,sourceError:p,destination:s,destinationStream:a,destinationError:c,unpipeSignal:l,fileDescriptors:m,startTime:i}},Hm=(e,t,r)=>{try{let{destination:n,pipeOptions:{from:o,to:i,unpipeSignal:s}={}}=Km(e,t,...r),a=nt(n,i);return{destination:n,destinationStream:a,from:o,unpipeSignal:s}}catch(n){return{destinationError:n}}},Km=(e,t,r,...n)=>{if(Array.isArray(r))return{destination:t(Wa,e)(r,...n),pipeOptions:e};if(typeof r=="string"||r instanceof URL||Yt(r)){if(Object.keys(e).length>0)throw new TypeError('Please use .pipe("file", ..., options) or .pipe(execa("file", ..., options)) instead of .pipe(options)("file", ...).');let[o,i,s]=Ue(r,...n);return{destination:t(Wa)(o,i,s),pipeOptions:s}}if(F.has(r)){if(Object.keys(e).length>0)throw new TypeError("Please use .pipe(options)`command` or .pipe($(options)`command`) instead of .pipe(options)($`command`).");return{destination:r,pipeOptions:n[0]}}throw new TypeError(`The first argument must be a template string, an options object, or an Execa subprocess: ${r}`)},Wa=({options:e})=>({options:{...e,stdin:"pipe",piped:!0}}),Xm=(e,t)=>{try{return{sourceStream:ue(e,t)}}catch(r){return{sourceError:r}}};var qa=({sourceStream:e,sourceError:t,destinationStream:r,destinationError:n,fileDescriptors:o,sourceOptions:i,startTime:s})=>{let a=Zm({sourceStream:e,sourceError:t,destinationStream:r,destinationError:n});if(a!==void 0)throw on({error:a,fileDescriptors:o,sourceOptions:i,startTime:s})},Zm=({sourceStream:e,sourceError:t,destinationStream:r,destinationError:n})=>{if(t!==void 0&&n!==void 0)return n;if(n!==void 0)return Zr(e),n;if(t!==void 0)return Xr(r),t},on=({error:e,fileDescriptors:t,sourceOptions:r,startTime:n})=>ge({error:e,command:Ya,escapedCommand:Ya,fileDescriptors:t,options:r,startTime:n,isSync:!1}),Ya="source.pipe(destination)";var Ha=async e=>{let[{status:t,reason:r,value:n=r},{status:o,reason:i,value:s=i}]=await e;if(s.pipedFrom.includes(n)||s.pipedFrom.push(n),o==="rejected")throw s;if(t==="rejected")throw n;return s};import{finished as Jm}from"stream/promises";var Ka=(e,t,r)=>{let n=Nt.has(t)?eh(e,t):Qm(e,t);return Z(e,rh,r.signal),Z(t,nh,r.signal),th(t),n},Qm=(e,t)=>{let r=te([e]);return be(r,t),Nt.set(t,r),r},eh=(e,t)=>{let r=Nt.get(t);return r.add(e),r},th=async e=>{try{await Jm(e,{cleanup:!0,readable:!1,writable:!0})}catch{}Nt.delete(e)},Nt=new WeakMap,rh=2,nh=1;import{aborted as oh}from"util";var Xa=(e,t)=>e===void 0?[]:[ih(e,t)],ih=async(e,{sourceStream:t,mergedStream:r,fileDescriptors:n,sourceOptions:o,startTime:i})=>{await oh(e,t),await r.remove(t);let s=new Error("Pipe canceled by `unpipeSignal` option.");throw on({error:s,fileDescriptors:n,sourceOptions:o,startTime:i})};var _t=(e,...t)=>{if(S(t[0]))return _t.bind(void 0,{...e,boundOptions:{...e.boundOptions,...t[0]}});let{destination:r,...n}=Va(e,...t),o=sh({...n,destination:r});return o.pipe=_t.bind(void 0,{...e,source:r,sourcePromise:o,boundOptions:{}}),o},sh=async({sourcePromise:e,sourceStream:t,sourceOptions:r,sourceError:n,destination:o,destinationStream:i,destinationError:s,unpipeSignal:a,fileDescriptors:c,startTime:f})=>{let l=ah(e,o);qa({sourceStream:t,sourceError:n,destinationStream:i,destinationError:s,fileDescriptors:c,sourceOptions:r,startTime:f});let d=new AbortController;try{let p=Ka(t,i,d);return await Promise.race([Ha(l),...Xa(a,{sourceStream:t,mergedStream:p,sourceOptions:r,fileDescriptors:c,startTime:f})])}finally{d.abort()}},ah=(e,t)=>Promise.allSettled([e,t]);import{setImmediate as mh}from"timers/promises";import{on as ch}from"events";import{getDefaultHighWaterMark as lh}from"stream";var jt=({subprocessStdout:e,subprocess:t,binary:r,shouldEncode:n,encoding:o,preserveNewlines:i})=>{let s=new AbortController;return fh(t,s),Ja({stream:e,controller:s,binary:r,shouldEncode:!e.readableObjectMode&&n,encoding:o,shouldSplit:!e.readableObjectMode,preserveNewlines:i})},fh=async(e,t)=>{try{await e}catch{}finally{t.abort()}},sn=({stream:e,onStreamEnd:t,lines:r,encoding:n,stripFinalNewline:o,allMixed:i})=>{let s=new AbortController;dh(t,s,e);let a=e.readableObjectMode&&!i;return Ja({stream:e,controller:s,binary:n==="buffer",shouldEncode:!a,encoding:n,shouldSplit:!a&&r,preserveNewlines:!o})},dh=async(e,t,r)=>{try{await e}catch{r.destroy()}finally{t.abort()}},Ja=({stream:e,controller:t,binary:r,shouldEncode:n,encoding:o,shouldSplit:i,preserveNewlines:s})=>{let a=ch(e,"data",{signal:t.signal,highWaterMark:Za,highWatermark:Za});return ph({onStdoutChunk:a,controller:t,binary:r,shouldEncode:n,encoding:o,shouldSplit:i,preserveNewlines:s})},an=lh(!0),Za=an,ph=async function*({onStdoutChunk:e,controller:t,binary:r,shouldEncode:n,encoding:o,shouldSplit:i,preserveNewlines:s}){let a=uh({binary:r,shouldEncode:n,encoding:o,shouldSplit:i,preserveNewlines:s});try{for await(let[c]of e)yield*ee(c,a,0)}catch(c){if(!t.signal.aborted)throw c}finally{yield*Me(a)}},uh=({binary:e,shouldEncode:t,encoding:r,shouldSplit:n,preserveNewlines:o})=>[Mt(e,r,!t),Ct(e,o,!n,{})].filter(Boolean);var Qa=async({stream:e,onStreamEnd:t,fdNumber:r,encoding:n,buffer:o,maxBuffer:i,lines:s,allMixed:a,stripFinalNewline:c,verboseInfo:f,streamInfo:l})=>{let d=hh({stream:e,onStreamEnd:t,fdNumber:r,encoding:n,allMixed:a,verboseInfo:f,streamInfo:l});if(!o){await Promise.all([gh(e),d]);return}let p=vr(c,r),u=sn({stream:e,onStreamEnd:t,lines:s,encoding:n,stripFinalNewline:p,allMixed:a}),[m]=await Promise.all([yh({stream:e,iterable:u,fdNumber:r,encoding:n,maxBuffer:i,lines:s}),d]);return m},hh=async({stream:e,onStreamEnd:t,fdNumber:r,encoding:n,allMixed:o,verboseInfo:i,streamInfo:{fileDescriptors:s}})=>{if(!Lt({stdioItems:s[r]?.stdioItems,encoding:n,verboseInfo:i,fdNumber:r}))return;let a=sn({stream:e,onStreamEnd:t,lines:!0,encoding:n,stripFinalNewline:!0,allMixed:o});await fa(a,e,r,i)},gh=async e=>{await mh(),e.readableFlowing===null&&e.resume()},yh=async({stream:e,stream:{readableObjectMode:t},iterable:r,fdNumber:n,encoding:o,maxBuffer:i,lines:s})=>{try{return t||s?await bt(r,{maxBuffer:i}):o==="buffer"?new Uint8Array(await wt(r,{maxBuffer:i})):await Et(r,{maxBuffer:i})}catch(a){return ec(fs({error:a,stream:e,readableObjectMode:t,lines:s,encoding:o,fdNumber:n}))}},cn=async e=>{try{return await e}catch(t){return ec(t)}},ec=({bufferedData:e})=>An(e)?new Uint8Array(e):e;import{finished as Sh}from"stream/promises";var Fe=async(e,t,r,{isSameDirection:n,stopOnExit:o=!1}={})=>{let i=bh(e,r),s=new AbortController;try{await Promise.race([...o?[r.exitPromise]:[],Sh(e,{cleanup:!0,signal:s.signal})])}catch(a){i.stdinCleanedUp||Eh(a,t,r,n)}finally{s.abort()}},bh=(e,{originalStreams:[t],subprocess:r})=>{let n={stdinCleanedUp:!1};return e===t&&wh(e,r,n),n},wh=(e,t,r)=>{let{_destroy:n}=e;e._destroy=(...o)=>{xh(t,r),n.call(e,...o)}},xh=({exitCode:e,signalCode:t},r)=>{(e!==null||t!==null)&&(r.stdinCleanedUp=!0)},Eh=(e,t,r,n)=>{if(!Th(e,t,r,n))throw e},Th=(e,t,r,n=!0)=>r.propagating?tc(e)||Gt(e):(r.propagating=!0,ln(r,t)===n?tc(e):Gt(e)),ln=({fileDescriptors:e},t)=>t!=="all"&&e[t].direction==="input",Gt=e=>e?.code==="ERR_STREAM_PREMATURE_CLOSE",tc=e=>e?.code==="EPIPE";var rc=({subprocess:e,encoding:t,buffer:r,maxBuffer:n,lines:o,stripFinalNewline:i,verboseInfo:s,streamInfo:a})=>e.stdio.map((c,f)=>fn({stream:c,fdNumber:f,encoding:t,buffer:r[f],maxBuffer:n[f],lines:o[f],allMixed:!1,stripFinalNewline:i,verboseInfo:s,streamInfo:a})),fn=async({stream:e,fdNumber:t,encoding:r,buffer:n,maxBuffer:o,lines:i,allMixed:s,stripFinalNewline:a,verboseInfo:c,streamInfo:f})=>{if(!e)return;let l=Fe(e,t,f);if(ln(f,t)){await l;return}let[d]=await Promise.all([Qa({stream:e,onStreamEnd:l,fdNumber:t,encoding:r,buffer:n,maxBuffer:o,lines:i,allMixed:s,stripFinalNewline:a,verboseInfo:c,streamInfo:f}),l]);return d};var nc=({stdout:e,stderr:t},{all:r})=>r&&(e||t)?te([e,t].filter(Boolean)):void 0,oc=({subprocess:e,encoding:t,buffer:r,maxBuffer:n,lines:o,stripFinalNewline:i,verboseInfo:s,streamInfo:a})=>fn({...Oh(e,r),fdNumber:"all",encoding:t,maxBuffer:n[1]+n[2],lines:o[1]||o[2],allMixed:Ah(e),stripFinalNewline:i,verboseInfo:s,streamInfo:a}),Oh=({stdout:e,stderr:t,all:r},[,n,o])=>{let i=n||o;return i?n?o?{stream:r,buffer:i}:{stream:e,buffer:i}:{stream:t,buffer:i}:{stream:r,buffer:i}},Ah=({all:e,stdout:t,stderr:r})=>e&&t&&r&&t.readableObjectMode!==r.readableObjectMode;import{once as Dh}from"events";var ic=e=>se(e,"ipc"),sc=(e,t)=>{let r=Ve(e);B({type:"ipc",verboseMessage:r,fdNumber:"ipc",verboseInfo:t})};var ac=async({subprocess:e,buffer:t,maxBuffer:r,ipc:n,ipcOutput:o,verboseInfo:i})=>{if(!n)return o;let s=ic(i),a=_(t,"ipc"),c=_(r,"ipc");for await(let f of Yr({anyProcess:e,channel:e.channel,isSubprocess:!1,ipc:n,shouldAwait:!1,reference:!0}))a&&(ds(e,o,c),o.push(f)),s&&sc(f,i);return o},cc=async(e,t)=>(await Promise.allSettled([e]),t);var lc=async({subprocess:e,options:{encoding:t,buffer:r,maxBuffer:n,lines:o,timeoutDuration:i,cancelSignal:s,gracefulCancel:a,forceKillAfterDelay:c,stripFinalNewline:f,ipc:l,ipcInput:d},context:p,verboseInfo:u,fileDescriptors:m,originalStreams:g,onInternalError:b,controller:y})=>{let x=ha(e,p),E={originalStreams:g,fileDescriptors:m,subprocess:e,exitPromise:x,propagating:!1},A=rc({subprocess:e,encoding:t,buffer:r,maxBuffer:n,lines:o,stripFinalNewline:f,verboseInfo:u,streamInfo:E}),v=oc({subprocess:e,encoding:t,buffer:r,maxBuffer:n,lines:o,stripFinalNewline:f,verboseInfo:u,streamInfo:E}),k=[],K=ac({subprocess:e,buffer:r,maxBuffer:n,ipc:l,ipcOutput:k,verboseInfo:u}),ne=Ih(g,e,E),z=Rh(m,E);try{return await Promise.race([Promise.all([{},ya(x),Promise.all(A),v,K,zi(e,d),...ne,...z]),b,Ch(e,y),...Ni(e,i,p,y),...ii({subprocess:e,cancelSignal:s,gracefulCancel:a,context:p,controller:y}),...Ui({subprocess:e,cancelSignal:s,gracefulCancel:a,forceKillAfterDelay:c,context:p,controller:y})])}catch(Vt){return p.terminationReason??="other",Promise.all([{error:Vt},x,Promise.all(A.map(xe=>cn(xe))),cn(v),cc(K,k),Promise.allSettled(ne),Promise.allSettled(z)])}},Ih=(e,t,r)=>e.map((n,o)=>n===t.stdio[o]?void 0:Fe(n,o,r)),Rh=(e,t)=>e.flatMap(({stdioItems:r},n)=>r.filter(({value:o,stream:i=o})=>P(i,{checkOpen:!1})&&!R(i)).map(({type:o,value:i,stream:s=i})=>Fe(s,n,t,{isSameDirection:I.has(o),stopOnExit:o==="native"}))),Ch=async(e,{signal:t})=>{let[r]=await Dh(e,"error",{signal:t});throw r};var fc=()=>({readableDestroy:new WeakMap,writableFinal:new WeakMap,writableDestroy:new WeakMap}),$e=(e,t,r)=>{let n=e[r];n.has(t)||n.set(t,[]);let o=n.get(t),i=L();return o.push(i),{resolve:i.resolve.bind(i),promises:o}},we=async({resolve:e,promises:t},r)=>{e();let[n]=await Promise.race([Promise.allSettled([!0,r]),Promise.all([!1,...t])]);return!n};import{Readable as Mh}from"stream";import{callbackify as Ph}from"util";import{finished as dc}from"stream/promises";var dn=async e=>{if(e!==void 0)try{await pn(e)}catch{}},pc=async e=>{if(e!==void 0)try{await un(e)}catch{}},pn=async e=>{await dc(e,{cleanup:!0,readable:!1,writable:!0})},un=async e=>{await dc(e,{cleanup:!0,readable:!0,writable:!1})},kt=async(e,t)=>{if(await e,t)throw t},zt=(e,t,r)=>{r&&!Gt(r)?e.destroy(r):t&&e.destroy()};var uc=({subprocess:e,concurrentStreams:t,encoding:r},{from:n,binary:o=!0,preserveNewlines:i=!0}={})=>{let s=o||O.has(r),{subprocessStdout:a,waitReadableDestroy:c}=mn(e,n,t),{readableEncoding:f,readableObjectMode:l,readableHighWaterMark:d}=hn(a,s),{read:p,onStdoutDataDone:u}=gn({subprocessStdout:a,subprocess:e,binary:s,encoding:r,preserveNewlines:i}),m=new Mh({read:p,destroy:Ph(Sn.bind(void 0,{subprocessStdout:a,subprocess:e,waitReadableDestroy:c})),highWaterMark:d,objectMode:l,encoding:f});return yn({subprocessStdout:a,onStdoutDataDone:u,readable:m,subprocess:e}),m},mn=(e,t,r)=>{let n=ue(e,t),o=$e(r,n,"readableDestroy");return{subprocessStdout:n,waitReadableDestroy:o}},hn=({readableEncoding:e,readableObjectMode:t,readableHighWaterMark:r},n)=>n?{readableEncoding:e,readableObjectMode:t,readableHighWaterMark:r}:{readableEncoding:e,readableObjectMode:!0,readableHighWaterMark:an},gn=({subprocessStdout:e,subprocess:t,binary:r,encoding:n,preserveNewlines:o})=>{let i=L(),s=jt({subprocessStdout:e,subprocess:t,binary:r,shouldEncode:!r,encoding:n,preserveNewlines:o});return{read(){Bh(this,s,i)},onStdoutDataDone:i}},Bh=async(e,t,r)=>{try{let{value:n,done:o}=await t.next();o?r.resolve():e.push(n)}catch{}},yn=async({subprocessStdout:e,onStdoutDataDone:t,readable:r,subprocess:n,subprocessStdin:o})=>{try{await un(e),await n,await dn(o),await t,r.readable&&r.push(null)}catch(i){await dn(o),mc(r,i)}},Sn=async({subprocessStdout:e,subprocess:t,waitReadableDestroy:r},n)=>{await we(r,t)&&(mc(e,n),await kt(t,n))},mc=(e,t)=>{zt(e,e.readable,t)};import{Writable as Lh}from"stream";import{callbackify as hc}from"util";var gc=({subprocess:e,concurrentStreams:t},{to:r}={})=>{let{subprocessStdin:n,waitWritableFinal:o,waitWritableDestroy:i}=bn(e,r,t),s=new Lh({...wn(n,e,o),destroy:hc(En.bind(void 0,{subprocessStdin:n,subprocess:e,waitWritableFinal:o,waitWritableDestroy:i})),highWaterMark:n.writableHighWaterMark,objectMode:n.writableObjectMode});return xn(n,s),s},bn=(e,t,r)=>{let n=nt(e,t),o=$e(r,n,"writableFinal"),i=$e(r,n,"writableDestroy");return{subprocessStdin:n,waitWritableFinal:o,waitWritableDestroy:i}},wn=(e,t,r)=>({write:Fh.bind(void 0,e),final:hc($h.bind(void 0,e,t,r))}),Fh=(e,t,r,n)=>{e.write(t,r)?n():e.once("drain",n)},$h=async(e,t,r)=>{await we(r,t)&&(e.writable&&e.end(),await t)},xn=async(e,t,r)=>{try{await pn(e),t.writable&&t.end()}catch(n){await pc(r),yc(t,n)}},En=async({subprocessStdin:e,subprocess:t,waitWritableFinal:r,waitWritableDestroy:n},o)=>{await we(r,t),await we(n,t)&&(yc(e,o),await kt(t,o))},yc=(e,t)=>{zt(e,e.writable,t)};import{Duplex as Uh}from"stream";import{callbackify as vh}from"util";var Sc=({subprocess:e,concurrentStreams:t,encoding:r},{from:n,to:o,binary:i=!0,preserveNewlines:s=!0}={})=>{let a=i||O.has(r),{subprocessStdout:c,waitReadableDestroy:f}=mn(e,n,t),{subprocessStdin:l,waitWritableFinal:d,waitWritableDestroy:p}=bn(e,o,t),{readableEncoding:u,readableObjectMode:m,readableHighWaterMark:g}=hn(c,a),{read:b,onStdoutDataDone:y}=gn({subprocessStdout:c,subprocess:e,binary:a,encoding:r,preserveNewlines:s}),x=new Uh({read:b,...wn(l,e,d),destroy:vh(Nh.bind(void 0,{subprocessStdout:c,subprocessStdin:l,subprocess:e,waitReadableDestroy:f,waitWritableFinal:d,waitWritableDestroy:p})),readableHighWaterMark:g,writableHighWaterMark:l.writableHighWaterMark,readableObjectMode:m,writableObjectMode:l.writableObjectMode,encoding:u});return yn({subprocessStdout:c,onStdoutDataDone:y,readable:x,subprocess:e,subprocessStdin:l}),xn(l,x,c),x},Nh=async({subprocessStdout:e,subprocessStdin:t,subprocess:r,waitReadableDestroy:n,waitWritableFinal:o,waitWritableDestroy:i},s)=>{await Promise.all([Sn({subprocessStdout:e,subprocess:r,waitReadableDestroy:n},s),En({subprocessStdin:t,subprocess:r,waitWritableFinal:o,waitWritableDestroy:i},s)])};var Tn=(e,t,{from:r,binary:n=!1,preserveNewlines:o=!1}={})=>{let i=n||O.has(t),s=ue(e,r),a=jt({subprocessStdout:s,subprocess:e,binary:i,shouldEncode:!0,encoding:t,preserveNewlines:o});return _h(a,s,e)},_h=async function*(e,t,r){try{yield*e}finally{t.readable&&t.destroy(),await r}};var bc=(e,{encoding:t})=>{let r=fc();e.readable=uc.bind(void 0,{subprocess:e,concurrentStreams:r,encoding:t}),e.writable=gc.bind(void 0,{subprocess:e,concurrentStreams:r}),e.duplex=Sc.bind(void 0,{subprocess:e,concurrentStreams:r,encoding:t}),e.iterable=Tn.bind(void 0,e,t),e[Symbol.asyncIterator]=Tn.bind(void 0,e,t,{})};var wc=(e,t)=>{for(let[r,n]of Gh){let o=n.value.bind(t);Reflect.defineProperty(e,r,{...n,value:o})}},jh=(async()=>{})().constructor.prototype,Gh=["then","catch","finally"].map(e=>[e,Reflect.getOwnPropertyDescriptor(jh,e)]);var xc=(e,t,r,n)=>{let{file:o,commandArguments:i,command:s,escapedCommand:a,startTime:c,verboseInfo:f,options:l,fileDescriptors:d}=Wh(e,t,r),{subprocess:p,promise:u}=Yh({file:o,commandArguments:i,options:l,startTime:c,verboseInfo:f,command:s,escapedCommand:a,fileDescriptors:d});return p.pipe=_t.bind(void 0,{source:p,sourcePromise:u,boundOptions:{},createNested:n}),wc(p,u),F.set(p,{options:l,fileDescriptors:d}),p},Wh=(e,t,r)=>{let{command:n,escapedCommand:o,startTime:i,verboseInfo:s}=qe(e,t,r),{file:a,commandArguments:c,options:f}=mt(e,t,r),l=Vh(f),d=Ba(l,s);return{file:a,commandArguments:c,command:n,escapedCommand:o,startTime:i,verboseInfo:s,options:l,fileDescriptors:d}},Vh=({timeout:e,signal:t,...r})=>{if(t!==void 0)throw new TypeError('The "signal" option has been renamed to "cancelSignal" instead.');return{...r,timeoutDuration:e}},Yh=({file:e,commandArguments:t,options:r,startTime:n,verboseInfo:o,command:i,escapedCommand:s,fileDescriptors:a})=>{let c;try{c=zh(...ht(e,t,r))}catch(m){return Ra({error:m,command:i,escapedCommand:s,fileDescriptors:a,options:r,startTime:n,verboseInfo:o})}let f=new AbortController;kh(Number.POSITIVE_INFINITY,f.signal);let l=[...c.stdio];Ga(c,a,f),za(c,r,f);let d={},p=L();c.kill=ni.bind(void 0,{kill:c.kill.bind(c),options:r,onInternalError:p,context:d,controller:f}),c.all=nc(c,r),bc(c,r),Aa(c,r);let u=qh({subprocess:c,options:r,startTime:n,verboseInfo:o,fileDescriptors:a,originalStreams:l,command:i,escapedCommand:s,context:d,onInternalError:p,controller:f});return{subprocess:c,promise:u}},qh=async({subprocess:e,options:t,startTime:r,verboseInfo:n,fileDescriptors:o,originalStreams:i,command:s,escapedCommand:a,context:c,onInternalError:f,controller:l})=>{let[d,[p,u],m,g,b]=await lc({subprocess:e,options:t,context:c,verboseInfo:n,fileDescriptors:o,originalStreams:i,onInternalError:f,controller:l});l.abort(),f.resolve();let y=m.map((A,v)=>G(A,t,v)),x=G(g,t,"all"),E=Hh({errorInfo:d,exitCode:p,signal:u,stdio:y,all:x,ipcOutput:b,context:c,options:t,command:s,escapedCommand:a,startTime:r});return ye(E,n,t)},Hh=({errorInfo:e,exitCode:t,signal:r,stdio:n,all:o,ipcOutput:i,context:s,options:a,command:c,escapedCommand:f,startTime:l})=>"error"in e?Ce({error:e.error,command:c,escapedCommand:f,timedOut:s.terminationReason==="timeout",isCanceled:s.terminationReason==="cancel"||s.terminationReason==="gracefulCancel",isGracefullyCanceled:s.terminationReason==="gracefulCancel",isMaxBuffer:e.error instanceof $,isForcefullyTerminated:s.isForcefullyTerminated,exitCode:t,signal:r,stdio:n,all:o,ipcOutput:i,options:a,startTime:l,isSync:!1}):Ot({command:c,escapedCommand:f,stdio:n,all:o,ipcOutput:i,options:a,startTime:l});var Wt=(e,t)=>{let r=Object.fromEntries(Object.entries(t).map(([n,o])=>[n,Kh(n,e[n],o)]));return{...e,...r}},Kh=(e,t,r)=>Xh.has(e)&&S(t)&&S(r)?{...t,...r}:r,Xh=new Set(["env",...Jt]);var H=(e,t,r,n)=>{let o=(s,a,c)=>H(s,a,r,c),i=(...s)=>Zh({mapArguments:e,deepOptions:r,boundOptions:t,setBoundExeca:n,createNested:o},...s);return n!==void 0&&n(i,o,t),i},Zh=({mapArguments:e,deepOptions:t={},boundOptions:r={},setBoundExeca:n,createNested:o},i,...s)=>{if(S(i))return o(e,Wt(r,i),n);let{file:a,commandArguments:c,options:f,isSync:l}=Jh({mapArguments:e,firstArgument:i,nextArguments:s,deepOptions:t,boundOptions:r});return l?ba(a,c,f):xc(a,c,f,o)},Jh=({mapArguments:e,firstArgument:t,nextArguments:r,deepOptions:n,boundOptions:o})=>{let i=Pn(t)?Bn(t,r):[t,...r],[s,a,c]=Ue(...i),f=Wt(Wt(n,o),c),{file:l=s,commandArguments:d=a,options:p=f,isSync:u=!1}=e({file:s,commandArguments:a,options:f});return{file:l,commandArguments:d,options:p,isSync:u}};var Ec=({file:e,commandArguments:t})=>Oc(e,t),Tc=({file:e,commandArguments:t})=>({...Oc(e,t),isSync:!0}),Oc=(e,t)=>{if(t.length>0)throw new TypeError(`The command and its arguments must be passed as a single string: ${e} ${t}.`);let[r,...n]=Ac(e);return{file:r,commandArguments:n}},Ac=e=>{if(typeof e!="string")throw new TypeError(`The command must be a string: ${String(e)}.`);let t=e.trim();if(t==="")return[];let r=[];for(let n of t.split(Qh)){let o=r.at(-1);o&&o.endsWith("\\")?r[r.length-1]=`${o.slice(0,-1)} ${n}`:r.push(n)}return r},Qh=/ +/g;var Dc=(e,t,r)=>{e.sync=t(eg,r),e.s=e.sync},Ic=({options:e})=>Rc(e),eg=({options:e})=>({...Rc(e),isSync:!0}),Rc=e=>({options:{...tg(e),...e}}),tg=({input:e,inputFile:t,stdio:r})=>e===void 0&&t===void 0&&r===void 0?{stdin:"inherit"}:{},Cc={preferLocal:!0};var KD=H(()=>({})),XD=H(()=>({isSync:!0})),ZD=H(Ec),JD=H(Tc),QD=H(ji),eI=H(Ic,{},Cc,Dc),{sendMessage:tI,getOneMessage:rI,getEachMessage:nI,getCancelSignal:oI}=Da();export{eI as $,le as ExecaError,fe as ExecaSyncError,KD as execa,ZD as execaCommand,JD as execaCommandSync,QD as execaNode,XD as execaSync,oI as getCancelSignal,nI as getEachMessage,rI as getOneMessage,Ac as parseCommandString,tI as sendMessage};