@raycast/api
Version:
Build extensions for Raycast with React and Node.js.
23 lines (22 loc) • 122 kB
JavaScript
"use strict";var Ql=Object.create;var Xe=Object.defineProperty;var ef=Object.getOwnPropertyDescriptor;var tf=Object.getOwnPropertyNames;var rf=Object.getPrototypeOf,nf=Object.prototype.hasOwnProperty;var D=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),of=(e,t)=>{for(var r in t)Xe(e,r,{get:t[r],enumerable:!0})},to=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of tf(t))!nf.call(e,o)&&o!==r&&Xe(e,o,{get:()=>t[o],enumerable:!(n=ef(t,o))||n.enumerable});return e};var T=(e,t,r)=>(r=e!=null?Ql(rf(e)):{},to(t||!e||!e.__esModule?Xe(r,"default",{value:e,enumerable:!0}):r,e)),sf=e=>to(Xe({},"__esModule",{value:!0}),e);var co=D((Cg,ao)=>{var df=require("node:tty"),pf=df?.WriteStream?.prototype?.hasColors?.()??!1,g=(e,t)=>{if(!pf)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;for(;s!==-1;)a+=i.slice(c,s)+r,c=s+n.length,s=i.indexOf(n,c);return a+=i.slice(c)+n,a}},h={};h.reset=g(0,0);h.bold=g(1,22);h.dim=g(2,22);h.italic=g(3,23);h.underline=g(4,24);h.overline=g(53,55);h.inverse=g(7,27);h.hidden=g(8,28);h.strikethrough=g(9,29);h.black=g(30,39);h.red=g(31,39);h.green=g(32,39);h.yellow=g(33,39);h.blue=g(34,39);h.magenta=g(35,39);h.cyan=g(36,39);h.white=g(37,39);h.gray=g(90,39);h.bgBlack=g(40,49);h.bgRed=g(41,49);h.bgGreen=g(42,49);h.bgYellow=g(43,49);h.bgBlue=g(44,49);h.bgMagenta=g(45,49);h.bgCyan=g(46,49);h.bgWhite=g(47,49);h.bgGray=g(100,49);h.redBright=g(91,39);h.greenBright=g(92,39);h.yellowBright=g(93,39);h.blueBright=g(94,39);h.magentaBright=g(95,39);h.cyanBright=g(96,39);h.whiteBright=g(97,39);h.bgRedBright=g(101,49);h.bgGreenBright=g(102,49);h.bgYellowBright=g(103,49);h.bgBlueBright=g(104,49);h.bgMagentaBright=g(105,49);h.bgCyanBright=g(106,49);h.bgWhiteBright=g(107,49);ao.exports=h});var Ko=D((pS,Ho)=>{Ho.exports=qo;qo.sync=cd;var Vo=require("fs");function ad(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 Yo(e,t,r){return!e.isSymbolicLink()&&!e.isFile()?!1:ad(t,r)}function qo(e,t,r){Vo.stat(e,function(n,o){r(n,n?!1:Yo(o,e,t))})}function cd(e,t){return Yo(Vo.statSync(e),e,t)}});var ei=D((uS,Qo)=>{Qo.exports=Jo;Jo.sync=ld;var Xo=require("fs");function Jo(e,t,r){Xo.stat(e,function(n,o){r(n,n?!1:Zo(o,t))})}function ld(e,t){return Zo(Xo.statSync(e),t)}function Zo(e,t){return e.isFile()&&fd(e,t)}function fd(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 ri=D((hS,ti)=>{var mS=require("fs"),ut;process.platform==="win32"||global.TESTING_WINDOWS?ut=Ko():ut=ei();ti.exports=Pr;Pr.sync=dd;function Pr(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){Pr(e,t||{},function(i,s){i?o(i):n(s)})})}ut(e,t||{},function(n,o){n&&(n.code==="EACCES"||t&&t.ignoreErrors)&&(n=null,o=!1),r(n,o)})}function dd(e,t){try{return ut.sync(e,t||{})}catch(r){if(t&&t.ignoreErrors||r.code==="EACCES")return!1;throw r}}});var li=D((gS,ci)=>{var he=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",ni=require("path"),pd=he?";":":",oi=ri(),ii=e=>Object.assign(new Error(`not found: ${e}`),{code:"ENOENT"}),si=(e,t)=>{let r=t.colon||pd,n=e.match(/\//)||he&&e.match(/\\/)?[""]:[...he?[process.cwd()]:[],...(t.path||process.env.PATH||"").split(r)],o=he?t.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",i=he?o.split(r):[""];return he&&e.indexOf(".")!==-1&&i[0]!==""&&i.unshift(""),{pathEnv:n,pathExt:i,pathExtExe:o}},ai=(e,t,r)=>{typeof t=="function"&&(r=t,t={}),t||(t={});let{pathEnv:n,pathExt:o,pathExtExe:i}=si(e,t),s=[],a=f=>new Promise((l,d)=>{if(f===n.length)return t.all&&s.length?l(s):d(ii(e));let p=n[f],u=/^".*"$/.test(p)?p.slice(1,-1):p,m=ni.join(u,e),S=!u&&/^\.[\\\/]/.test(e)?e.slice(0,2)+m:m;l(c(S,f,0))}),c=(f,l,d)=>new Promise((p,u)=>{if(d===o.length)return p(a(l+1));let m=o[d];oi(f+m,{pathExt:i},(S,E)=>{if(!S&&E)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)},ud=(e,t)=>{t=t||{};let{pathEnv:r,pathExt:n,pathExtExe:o}=si(e,t),i=[];for(let s=0;s<r.length;s++){let a=r[s],c=/^".*"$/.test(a)?a.slice(1,-1):a,f=ni.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(oi.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 ii(e)};ci.exports=ai;ai.sync=ud});var di=D((yS,Br)=>{"use strict";var fi=(e={})=>{let t=e.env||process.env;return(e.platform||process.platform)!=="win32"?"PATH":Object.keys(t).reverse().find(n=>n.toUpperCase()==="PATH")||"Path"};Br.exports=fi;Br.exports.default=fi});var hi=D((SS,mi)=>{"use strict";var pi=require("path"),md=li(),hd=di();function ui(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=md.sync(e.command,{path:r[hd({env:r})],pathExt:t?pi.delimiter:void 0})}catch{}finally{i&&process.chdir(n)}return s&&(s=pi.resolve(o?e.options.cwd:"",s)),s}function gd(e){return ui(e)||ui(e,!0)}mi.exports=gd});var gi=D((bS,Fr)=>{"use strict";var Lr=/([()\][%!^"`<>&|;, *?])/g;function yd(e){return e=e.replace(Lr,"^$1"),e}function Sd(e,t){return e=`${e}`,e=e.replace(/(\\*)"/g,'$1$1\\"'),e=e.replace(/(\\*)$/,"$1$1"),e=`"${e}"`,e=e.replace(Lr,"^$1"),t&&(e=e.replace(Lr,"^$1")),e}Fr.exports.command=yd;Fr.exports.argument=Sd});var Si=D((wS,yi)=>{"use strict";yi.exports=/^#!(.*)/});var wi=D((xS,bi)=>{"use strict";var bd=Si();bi.exports=(e="")=>{let t=e.match(bd);if(!t)return null;let[r,n]=t[0].replace(/#! ?/,"").split(" "),o=r.split("/").pop();return o==="env"?n:n?`${o} ${n}`:o}});var Ei=D((ES,xi)=>{"use strict";var $r=require("fs"),wd=wi();function xd(e){let r=Buffer.alloc(150),n;try{n=$r.openSync(e,"r"),$r.readSync(n,r,0,150,0),$r.closeSync(n)}catch{}return wd(r.toString())}xi.exports=xd});var Ii=D((TS,Oi)=>{"use strict";var Ed=require("path"),Ti=hi(),Ai=gi(),Td=Ei(),Ad=process.platform==="win32",Od=/\.(?:com|exe)$/i,Id=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function Dd(e){e.file=Ti(e);let t=e.file&&Td(e.file);return t?(e.args.unshift(e.file),e.command=t,Ti(e)):e.file}function Rd(e){if(!Ad)return e;let t=Dd(e),r=!Od.test(t);if(e.options.forceShell||r){let n=Id.test(t);e.command=Ed.normalize(e.command),e.command=Ai.command(e.command),e.args=e.args.map(i=>Ai.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 Cd(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:Rd(n)}Oi.exports=Cd});var Ci=D((AS,Ri)=>{"use strict";var Ur=process.platform==="win32";function vr(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 Md(e,t){if(!Ur)return;let r=e.emit;e.emit=function(n,o){if(n==="exit"){let i=Di(o,t,"spawn");if(i)return r.call(e,"error",i)}return r.apply(e,arguments)}}function Di(e,t){return Ur&&e===1&&!t.file?vr(t.original,"spawn"):null}function Pd(e,t){return Ur&&e===1&&!t.file?vr(t.original,"spawnSync"):null}Ri.exports={hookChildProcess:Md,verifyENOENT:Di,verifyENOENTSync:Pd,notFoundError:vr}});var Bi=D((OS,ge)=>{"use strict";var Mi=require("child_process"),Nr=Ii(),_r=Ci();function Pi(e,t,r){let n=Nr(e,t,r),o=Mi.spawn(n.command,n.args,n.options);return _r.hookChildProcess(o,n),o}function Bd(e,t,r){let n=Nr(e,t,r),o=Mi.spawnSync(n.command,n.args,n.options);return o.error=o.error||_r.verifyENOENTSync(o.status,n),o}ge.exports=Pi;ge.exports.spawn=Pi;ge.exports.sync=Bd;ge.exports._parse=Nr;ge.exports._enoent=_r});var Tg={};of(Tg,{default:()=>dr});module.exports=sf(Tg);var Zl=require("@oclif/core");var X=require("@oclif/core");var Pe=T(require("node:fs")),ur=T(require("node:path")),no=T(require("node:os"));var ro={production:{url:"https://www.raycast.com",clientID:"KqAdcGhNfBKiUpfjD3nU3VNgh1t0iMPoX2hYEkN9d4I"},staging:{url:"https://www.rayca.st",clientID:"KqAdcGhNfBKiUpfjD3nU3VNgh1t0iMPoX2hYEkN9d4I"},development:{url:"http://localhost:3000",clientID:"rOCD_LhnXFObSLu9v7788qOGu25FZDqEzGjet4Q45ZY"}}[process.env.API_ENV||"production"],af="e69bae0ec90f5e838555",z={},oo;function io(e){oo=e;try{z=JSON.parse(Pe.readFileSync(ur.join(ff(),"config.json"),"utf8"))}catch(t){if(t instanceof Error&&t.code==="ENOENT")return;throw new Error(`Failed to read config file: ${t}`)}}function cf(e){switch(e){case"raycastApiURL":return process.env.RAY_APIURL||z.APIURL||ro.url;case"raycastAccessToken":return process.env.RAY_TOKEN||z.Token||z.AccessToken||"";case"raycastClientId":return process.env.RAY_CLIENT_ID||z.ClientID||ro.clientID;case"githubClientId":return process.env.RAY_GithubClientID||z.GithubClientID||af;case"githubAccessToken":return process.env.GITHUB_ACCESS_TOKEN||z.GithubAccessToken||"";case"flavorName":return process.env.RAY_Target||(typeof z.Target>"u"?so("release"):z.Target)}}function so(e){switch(e){case"debug":return"debug";case"internal":return"internal";case"release":return"";case"x":return"x";case"x-internal":return"x-internal";case"x-debug":return"x-debug";case void 0:return cf("flavorName")}}function lf(){let e=so(oo);return e==""?"raycast":`raycast-${e}`}function ff(){let e=ur.join(no.default.homedir(),".config",lf());return Pe.mkdirSync(e,{recursive:!0}),e}var w=T(co());var oe=[];oe.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&oe.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&oe.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT");var Je=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",mr=Symbol.for("signal-exit emitter"),hr=globalThis,uf=Object.defineProperty.bind(Object),gr=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(hr[mr])return hr[mr];uf(hr,mr,{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}},Ze=class{},mf=e=>({onExit(t,r){return e.onExit(t,r)},load(){return e.load()},unload(){return e.unload()}}),yr=class extends Ze{onExit(){return()=>{}}load(){}unload(){}},Sr=class extends Ze{#t=br.platform==="win32"?"SIGINT":"SIGHUP";#r=new gr;#e;#n;#i;#o={};#s=!1;constructor(t){super(),this.#e=t,this.#o={};for(let r of oe)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(!Je(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 oe)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,oe.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 Je(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"&&Je(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)}},br=globalThis.process,{onExit:lo,load:Bg,unload:Lg}=mf(Je(br)?new Sr(br):new yr);var wr=T(require("node:process"),1);function xr(){let{env:e}=wr.default,{TERM:t,TERM_PROGRAM:r}=e;return wr.default.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 Ug=(0,w.blue)((0,w.dim)("internal only"));var ie={wait:`\u{1F550}${(0,w.blue)("wait")} - `,info:`${process.env.GITHUB_ACTIONS==="true"?"\u2139\uFE0F":"\u2139\uFE0F "}${(0,w.cyan)("info")} - `,success:`\u2705${(0,w.green)("ready")} - `,warn:`${process.env.GITHUB_ACTIONS==="true"?"\u26A0\uFE0F":"\u26A0\uFE0F "}${(0,w.yellow)("warn")} - `,error:`\u{1F4A5}${(0,w.red)("error")} - `,event:`\u26A1\uFE0F${(0,w.magenta)("event")} - `,paymentPrompt:`\u{1F4B0}${(0,w.yellowBright)("plan")} - `},hf=!0;function fo(e,t){e||(ie.wait=`${(0,w.blue)("wait")} - `,ie.info=`${(0,w.cyan)("info")} - `,ie.success=`${(0,w.green)("ready")} - `,ie.warn=`${(0,w.yellow)("warn")} - `,ie.error=`${(0,w.red)("error")} - `,ie.event=`${(0,w.magenta)("event")} - `,ie.paymentPrompt=`${(0,w.yellowBright)("plan")} - `),t&&(hf=!1)}var Qe=class extends X.Command{static baseFlags={"exit-on-error":X.Flags.boolean({default:!0,helpGroup:"GLOBAL",aliases:["exitOnError"],deprecateAliases:!0,summary:"Always exit with non-zero code on error",allowNo:!0}),emoji:X.Flags.boolean({default:!1,helpGroup:"GLOBAL",summary:"Prefix output with emojis \u{1F308}"}),help:X.Flags.boolean({default:!1,helpGroup:"GLOBAL",summary:"Show the help message for the command"}),"non-interactive":X.Flags.boolean({char:"I",default:!1,helpGroup:"GLOBAL",summary:"Disable interactive outputs, useful for CI"}),target:X.Flags.option({char:"t",description:"Raycast app target",helpGroup:"GLOBAL",multiple:!1,options:["debug","internal","release","x","x-debug","x-internal"],hidden:!0})()};flags;args;async init(){await super.init(),process.on("SIGINT",()=>process.exit(1));let{args:t,flags:r}=await this.parse({flags:this.ctor.flags,baseFlags:super.ctor.baseFlags,enableJsonFlag:this.ctor.enableJsonFlag,args:this.ctor.args,strict:this.ctor.strict});this.flags=r,this.args=t,io(this.flags.target),fo(this.flags.emoji,this.flags["non-interactive"])}error(t,r){return r?.message&&t instanceof Error&&(t.message=`${r.message} (${t.message})`,delete r.message),super.error(t,r)}async catch(t){return super.catch(t)}async finally(t){return super.finally(t)}};function x(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)}var po=require("node:url"),pe=(e,t)=>{let r=Tr(gf(e));if(typeof r!="string")throw new TypeError(`${t} must be a string or a file URL: ${r}.`);return r},gf=e=>Er(e)?e.toString():e,Er=e=>typeof e!="string"&&e&&Object.getPrototypeOf(e)===String.prototype,Tr=e=>e instanceof URL?(0,po.fileURLToPath)(e):e;var et=(e,t=[],r={})=>{let n=pe(e,"First argument"),[o,i]=x(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(!x(i))throw new TypeError(`Last argument must be an options object: ${i}`);return[n,s,i]};var xo=require("node:child_process");var uo=require("node:string_decoder"),{toString:mo}=Object.prototype,ho=e=>mo.call(e)==="[object ArrayBuffer]",A=e=>mo.call(e)==="[object Uint8Array]",W=e=>new Uint8Array(e.buffer,e.byteOffset,e.byteLength),yf=new TextEncoder,go=e=>yf.encode(e),Sf=new TextDecoder,tt=e=>Sf.decode(e),yo=(e,t)=>bf(e,t).join(""),bf=(e,t)=>{if(t==="utf8"&&e.every(i=>typeof i=="string"))return e;let r=new uo.StringDecoder(t),n=e.map(i=>typeof i=="string"?go(i):i).map(i=>r.write(i)),o=r.end();return o===""?n:[...n,o]},Be=e=>e.length===1&&A(e[0])?e[0]:Ar(wf(e)),wf=e=>e.map(t=>typeof t=="string"?go(t):t),Ar=e=>{let t=new Uint8Array(xf(e)),r=0;for(let n of e)t.set(n,r),r+=n.length;return t},xf=e=>{let t=0;for(let r of e)t+=r.length;return t};var Eo=e=>Array.isArray(e)&&Array.isArray(e.raw),To=(e,t)=>{let r=[];for(let[i,s]of e.entries())r=Ef({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,{}]},Ef=({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}=Tf(o,e.raw[n]),c=bo(r,i,s);if(n===t.length)return c;let f=t[n],l=Array.isArray(f)?f.map(d=>wo(d)):[wo(f)];return bo(c,l,a)},Tf=(e,t)=>{if(t.length===0)return{nextTokens:[],leadingWhitespaces:!1,trailingWhitespaces:!1};let r=[],n=0,o=So.has(t[0]);for(let s=0,a=0;s<e.length;s+=1,a+=1){let c=t[a];if(So.has(c))n!==s&&r.push(e.slice(n,s)),n=s+1;else if(c==="\\"){let f=t[a+1];f==="u"&&t[a+2]==="{"?a=t.indexOf("}",a+3):a+=Af[f]??1}}let i=n===e.length;return i||r.push(e.slice(n)),{nextTokens:r,leadingWhitespaces:o,trailingWhitespaces:i}},So=new Set([" "," ","\r",`
`]),Af={x:3,u:5},bo=(e,t,r)=>r||e.length===0||t.length===0?[...e,...t]:[...e.slice(0,-1),`${e.at(-1)}${t[0]}`,...t.slice(1)],wo=e=>{let t=typeof e;if(t==="string")return e;if(t==="number")return String(e);if(x(e)&&("stdout"in e||"isMaxBuffer"in e))return Of(e);throw e instanceof xo.ChildProcess||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`)},Of=({stdout:e})=>{if(typeof e=="string")return e;if(A(e))return tt(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`)};var Lc=require("node:child_process");var Oo=require("node:util");var rt=T(require("node:process"),1),B=e=>nt.includes(e),nt=[rt.default.stdin,rt.default.stdout,rt.default.stderr],M=["stdin","stdout","stderr"],ot=e=>M[e]??`stdio[${e}]`;var Io=e=>{let t={...e};for(let r of Dr)t[r]=Or(e,r);return t},Or=(e,t)=>{let r=Array.from({length:If(e)+1}),n=Df(e[t],r,t);return Bf(n,t)},If=({stdio:e})=>Array.isArray(e)?Math.max(e.length,M.length):M.length,Df=(e,t,r)=>x(e)?Rf(e,t,r):t.fill(e),Rf=(e,t,r)=>{for(let n of Object.keys(e).sort(Cf))for(let o of Mf(n,r,t))t[o]=e[n];return t},Cf=(e,t)=>Ao(e)<Ao(t)?1:-1,Ao=e=>e==="stdout"||e==="stderr"?0:e==="all"?2:1,Mf=(e,t,r)=>{if(e==="ipc")return[r.length-1];let n=Ir(e);if(n===void 0||n===0)throw new TypeError(`"${t}.${e}" is invalid.
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.
Please set the "stdio" option to ensure that file descriptor exists.`);return n==="all"?[1,2]:[n]},Ir=e=>{if(e==="all")return e;if(M.includes(e))return M.indexOf(e);let t=Pf.exec(e);if(t!==null)return Number(t[1])},Pf=/^fd(\d+)$/,Bf=(e,t)=>e.map(r=>r===void 0?Ff[t]:r),Lf=(0,Oo.debuglog)("execa").enabled?"full":"none",Ff={lines:!1,buffer:!0,maxBuffer:1e3*1e3*100,verbose:Lf,stripFinalNewline:!0},Dr=["lines","buffer","maxBuffer","verbose","stripFinalNewline"],V=(e,t)=>t==="ipc"?e.at(-1):e[t];var ue=({verbose:e},t)=>Rr(e,t)!=="none",me=({verbose:e},t)=>!["none","short"].includes(Rr(e,t)),Do=({verbose:e},t)=>{let r=Rr(e,t);return it(r)?r:void 0},Rr=(e,t)=>t===void 0?$f(e):V(e,t),$f=e=>e.find(t=>it(t))??st.findLast(t=>e.includes(t)),it=e=>typeof e=="function",st=["none","short","full"];var Go=require("node:util");var Ro=require("node:process"),Co=require("node:util"),Mo=(e,t)=>{let r=[e,...t],n=r.join(" "),o=r.map(i=>kf(Po(i))).join(" ");return{command:n,escapedCommand:o}},Le=e=>(0,Co.stripVTControlCharacters)(e).split(`
`).map(t=>Po(t)).join(`
`),Po=e=>e.replaceAll(Nf,t=>Uf(t)),Uf=e=>{let t=_f[e];if(t!==void 0)return t;let r=e.codePointAt(0),n=r.toString(16);return r<=jf?`\\u${n.padStart(4,"0")}`:`\\U${n}`},vf=()=>{try{return new RegExp("\\p{Separator}|\\p{Other}","gu")}catch{return/[\s\u0000-\u001F\u007F-\u009F\u00AD]/g}},Nf=vf(),_f={" ":" ","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t"},jf=65535,kf=e=>Gf.test(e)?e:Ro.platform==="win32"?`"${e.replaceAll('"','""')}"`:`'${e.replaceAll("'","'\\''")}'`,Gf=/^[\w./-]+$/;var Bo={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"},Lo={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"},zf={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"},Wf={...Bo,...Lo},Vf={...Bo,...zf},Yf=xr(),qf=Yf?Wf:Vf,at=qf,iy=Object.entries(Lo);var Fo=T(require("node:tty"),1),Hf=Fo.default?.WriteStream?.prototype?.hasColors?.()??!1,y=(e,t)=>{if(!Hf)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;for(;s!==-1;)a+=i.slice(c,s)+r,c=s+n.length,s=i.indexOf(n,c);return a+=i.slice(c)+n,a}},ay=y(0,0),$o=y(1,22),cy=y(2,22),ly=y(3,23),fy=y(4,24),dy=y(53,55),py=y(7,27),uy=y(8,28),my=y(9,29),hy=y(30,39),gy=y(31,39),yy=y(32,39),Sy=y(33,39),by=y(34,39),wy=y(35,39),xy=y(36,39),Ey=y(37,39),ct=y(90,39),Ty=y(40,49),Ay=y(41,49),Oy=y(42,49),Iy=y(43,49),Dy=y(44,49),Ry=y(45,49),Cy=y(46,49),My=y(47,49),Py=y(100,49),Uo=y(91,39),By=y(92,39),vo=y(93,39),Ly=y(94,39),Fy=y(95,39),$y=y(96,39),Uy=y(97,39),vy=y(101,49),Ny=y(102,49),_y=y(103,49),jy=y(104,49),ky=y(105,49),Gy=y(106,49),zy=y(107,49);var jo=({type:e,message:t,timestamp:r,piped:n,commandId:o,result:{failed:i=!1}={},options:{reject:s=!0}})=>{let a=Kf(r),c=Xf[e]({failed:i,reject:s,piped:n}),f=Jf[e]({reject:s});return`${ct(`[${a}]`)} ${ct(`[${o}]`)} ${f(c)} ${f(t)}`},Kf=e=>`${lt(e.getHours(),2)}:${lt(e.getMinutes(),2)}:${lt(e.getSeconds(),2)}.${lt(e.getMilliseconds(),3)}`,lt=(e,t)=>String(e).padStart(t,"0"),No=({failed:e,reject:t})=>e?t?at.cross:at.warning:at.tick,Xf={command:({piped:e})=>e?"|":"$",output:()=>" ",ipc:()=>"*",error:No,duration:No},_o=e=>e,Jf={command:()=>$o,output:()=>_o,ipc:()=>_o,error:({reject:e})=>e?Uo:vo,duration:()=>ct};var ko=(e,t,r)=>{let n=Do(t,r);return e.map(({verboseLine:o,verboseObject:i})=>Zf(o,i,n)).filter(o=>o!==void 0).map(o=>Qf(o)).join("")},Zf=(e,t,r)=>{if(r===void 0)return e;let n=r(e,t);if(typeof n=="string")return n},Qf=e=>e.endsWith(`
`)?e:`${e}
`;var U=({type:e,verboseMessage:t,fdNumber:r,verboseInfo:n,result:o})=>{let i=ed({type:e,result:o,verboseInfo:n}),s=td(t,i),a=ko(s,n,r);a!==""&&console.warn(a.slice(0,-1))},ed=({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}),td=(e,t)=>e.split(`
`).map(r=>rd({...t,message:r})),rd=e=>({verboseLine:jo(e),verboseObject:e}),ft=e=>{let t=typeof e=="string"?e:(0,Go.inspect)(e);return Le(t).replaceAll(" "," ".repeat(nd))},nd=2;var zo=(e,t)=>{ue(t)&&U({type:"command",verboseMessage:e,verboseInfo:t})};var Wo=(e,t,r)=>{sd(e);let n=od(e);return{verbose:e,escapedCommand:t,commandId:n,rawOptions:r}},od=e=>ue({verbose:e})?id++:void 0,id=0n,sd=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(!st.includes(t)&&!it(t)){let r=st.map(n=>`'${n}'`).join(", ");throw new TypeError(`The "verbose" option must not be ${t}. Allowed values are: ${r} or a function.`)}}};var Cr=require("node:process"),dt=()=>Cr.hrtime.bigint(),Mr=e=>Number(Cr.hrtime.bigint()-e)/1e6;var pt=(e,t,r)=>{let n=dt(),{command:o,escapedCommand:i}=Mo(e,t),s=Or(r,"verbose"),a=Wo(s,i,{...r});return zo(i,a),{command:o,escapedCommand:i,startTime:n,verboseInfo:a}};var oa=T(require("node:path"),1),en=T(require("node:process"),1),ia=T(Bi(),1);var Fe=T(require("node:process"),1),J=T(require("node:path"),1);function mt(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"}var Li=require("node:util"),kr=require("node:child_process"),jr=T(require("node:path"),1),Fi=require("node:url"),DS=(0,Li.promisify)(kr.execFile);function ht(e){return e instanceof URL?(0,Fi.fileURLToPath)(e):e}function $i(e){return{*[Symbol.iterator](){let t=jr.default.resolve(ht(e)),r;for(;r!==t;)yield t,r=t,t=jr.default.resolve(t,"..")}}}var RS=10*1024*1024;var Ld=({cwd:e=Fe.default.cwd(),path:t=Fe.default.env[mt()],preferLocal:r=!0,execPath:n=Fe.default.execPath,addExecPath:o=!0}={})=>{let i=J.default.resolve(ht(e)),s=[],a=t.split(J.default.delimiter);return r&&Fd(s,a,i),o&&$d(s,a,n,i),t===""||t===J.default.delimiter?`${s.join(J.default.delimiter)}${t}`:[...s,t].join(J.default.delimiter)},Fd=(e,t,r)=>{for(let n of $i(r)){let o=J.default.join(n,"node_modules/.bin");t.includes(o)||e.push(o)}},$d=(e,t,r,n)=>{let o=J.default.resolve(n,ht(r),"..");t.includes(o)||e.push(o)},Ui=({env:e=Fe.default.env,...t}={})=>{e={...e};let r=mt({env:e});return t.path=e[r],e[r]=Ld(t),e};var Zi=require("node:timers/promises");var vi=(e,t,r)=>{let n=r?Ue:$e,o=e instanceof L?{}:{cause:e};return new n(t,o)},L=class extends Error{},Ni=(e,t)=>{Object.defineProperty(e.prototype,"name",{value:t,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,ji,{value:!0,writable:!1,enumerable:!1,configurable:!1})},_i=e=>gt(e)&&ji in e,ji=Symbol("isExecaError"),gt=e=>Object.prototype.toString.call(e)==="[object Error]",$e=class extends Error{};Ni($e,$e.name);var Ue=class extends Error{};Ni(Ue,Ue.name);var ye=require("node:os");var Yi=require("node:os");var ki=()=>{let e=zi-Gi+1;return Array.from({length:e},Ud)},Ud=(e,t)=>({name:`SIGRT${t+1}`,number:Gi+t,action:"terminate",description:"Application-specific signal (realtime)",standard:"posix"}),Gi=34,zi=64;var Vi=require("node:os");var Wi=[{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 Gr=()=>{let e=ki();return[...Wi,...e].map(vd)},vd=({name:e,number:t,description:r,action:n,forced:o=!1,standard:i})=>{let{signals:{[e]:s}}=Vi.constants,a=s!==void 0;return{name:e,number:a?s:t,description:r,supported:a,action:n,forced:o,standard:i}};var Nd=()=>{let e=Gr();return Object.fromEntries(e.map(_d))},_d=({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}],qi=Nd(),jd=()=>{let e=Gr(),t=65,r=Array.from({length:t},(n,o)=>kd(o,e));return Object.assign({},...r)},kd=(e,t)=>{let r=Gd(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}}},Gd=(e,t)=>{let r=t.find(({name:n})=>Yi.constants.signals[n]===e);return r!==void 0?r:t.find(n=>n.number===e)},kS=jd();var Ki=e=>{let t="option `killSignal`";if(e===0)throw new TypeError(`Invalid ${t}: 0 cannot be used.`);return Ji(e,t)},Xi=e=>e===0?e:Ji(e,"`subprocess.kill()`'s argument"),Ji=(e,t)=>{if(Number.isInteger(e))return zd(e,t);if(typeof e=="string")return Vd(e,t);throw new TypeError(`Invalid ${t} ${String(e)}: it must be a string or an integer.
${zr()}`)},zd=(e,t)=>{if(Hi.has(e))return Hi.get(e);throw new TypeError(`Invalid ${t} ${e}: this signal integer does not exist.
${zr()}`)},Wd=()=>new Map(Object.entries(ye.constants.signals).reverse().map(([e,t])=>[t,e])),Hi=Wd(),Vd=(e,t)=>{if(e in ye.constants.signals)return e;throw e.toUpperCase()in ye.constants.signals?new TypeError(`Invalid ${t} '${e}': please rename it to '${e.toUpperCase()}'.`):new TypeError(`Invalid ${t} '${e}': this signal name does not exist.
${zr()}`)},zr=()=>`Available signal names: ${Yd()}.
Available signal numbers: ${qd()}.`,Yd=()=>Object.keys(ye.constants.signals).sort().map(e=>`'${e}'`).join(", "),qd=()=>[...new Set(Object.values(ye.constants.signals).sort((e,t)=>e-t))].join(", "),yt=e=>qi[e].description;var Qi=e=>{if(e===!1)return e;if(e===!0)return Hd;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},Hd=1e3*5,es=({kill:e,options:{forceKillAfterDelay:t,killSignal:r},onInternalError:n,context:o,controller:i},s,a)=>{let{signal:c,error:f}=Kd(s,a,r);Xd(f,n);let l=e(c);return Jd({kill:e,signal:c,forceKillAfterDelay:t,killSignal:r,killResult:l,context:o,controller:i}),l},Kd=(e,t,r)=>{let[n=r,o]=gt(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&&!gt(o))throw new TypeError(`The second argument is optional. If specified, it must be an error instance: ${o}`);return{signal:Xi(n),error:o}},Xd=(e,t)=>{e!==void 0&&t.reject(e)},Jd=async({kill:e,signal:t,forceKillAfterDelay:r,killSignal:n,killResult:o,context:i,controller:s})=>{t===n&&o&&Wr({kill:e,forceKillAfterDelay:r,context:i,controllerSignal:s.signal})},Wr=async({kill:e,forceKillAfterDelay:t,context:r,controllerSignal:n})=>{if(t!==!1)try{await(0,Zi.setTimeout)(t,void 0,{signal:n}),e("SIGKILL")&&(r.isForcefullyTerminated??=!0)}catch{}};var ts=require("node:events"),St=async(e,t)=>{e.aborted||await(0,ts.once)(e,"abort",{signal:t})};var rs=({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)}`)},ns=({subprocess:e,cancelSignal:t,gracefulCancel:r,context:n,controller:o})=>t===void 0||r?[]:[Zd(e,t,n,o)],Zd=async(e,t,r,{signal:n})=>{throw await St(t,n),r.terminationReason??="cancel",e.kill(),t.reason};var Us=require("node:timers/promises");var Fs=require("node:util");var Se=({methodName:e,isSubprocess:t,ipc:r,isConnected:n})=>{Qd(e,t,r),Vr(e,t,n)},Qd=(e,t,r)=>{if(!r)throw new Error(`${F(e,t)} can only be used if the \`ipc\` option is \`true\`.`)},Vr=(e,t,r)=>{if(!r)throw new Error(`${F(e,t)} cannot be used: the ${Z(t)} has already exited or disconnected.`)},os=e=>{throw new Error(`${F("getOneMessage",e)} could not complete: the ${Z(e)} exited or disconnected.`)},is=e=>{throw new Error(`${F("sendMessage",e)} failed: the ${Z(e)} is sending a message too, instead of listening to incoming messages.
This can be fixed by both sending a message and listening to incoming messages at the same time:
const [receivedMessage] = await Promise.all([
${F("getOneMessage",e)},
${F("sendMessage",e,"message, {strict: true}")},
]);`)},bt=(e,t)=>new Error(`${F("sendMessage",t)} failed when sending an acknowledgment response to the ${Z(t)}.`,{cause:e}),ss=e=>{throw new Error(`${F("sendMessage",e)} failed: the ${Z(e)} is not listening to incoming messages.`)},as=e=>{throw new Error(`${F("sendMessage",e)} failed: the ${Z(e)} exited without listening to incoming messages.`)},cs=()=>new Error(`\`cancelSignal\` aborted: the ${Z(!0)} disconnected.`),ls=()=>{throw new Error("`getCancelSignal()` cannot be used without setting the `cancelSignal` subprocess option.")},fs=({error:e,methodName:t,isSubprocess:r})=>{if(e.code==="EPIPE")throw new Error(`${F(t,r)} cannot be used: the ${Z(r)} is disconnecting.`,{cause:e})},ds=({error:e,methodName:t,isSubprocess:r,message:n})=>{if(ep(e))throw new Error(`${F(t,r)}'s argument type is invalid: the message cannot be serialized: ${String(n)}.`,{cause:e})},ep=({code:e,message:t})=>tp.has(e)||rp.some(r=>t.includes(r)),tp=new Set(["ERR_MISSING_ARGS","ERR_INVALID_ARG_TYPE"]),rp=["could not be cloned","circular structure","call stack size exceeded"],F=(e,t,r="")=>e==="cancelSignal"?"`cancelSignal`'s `controller.abort()`":`${np(t)}${e}(${r})`,np=e=>e?"":"subprocess.",Z=e=>e?"parent process":"subprocess",be=e=>{e.connected&&e.disconnect()};var v=()=>{let e={},t=new Promise((r,n)=>{Object.assign(e,{resolve:r,reject:n})});return Object.assign(t,e)};var xt=(e,t="stdin")=>{let{options:n,fileDescriptors:o}=N.get(e),i=ps(o,t,!0),s=e.stdio[i];if(s===null)throw new TypeError(us(i,t,n,!0));return s},we=(e,t="stdout")=>{let{options:n,fileDescriptors:o}=N.get(e),i=ps(o,t,!1),s=i==="all"?e.all:e.stdio[i];if(s==null)throw new TypeError(us(i,t,n,!1));return s},N=new WeakMap,ps=(e,t,r)=>{let n=op(t,r);return ip(n,t,r,e),n},op=(e,t)=>{let r=Ir(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(`"${ve(t)}" must not be "${e}".
It must be ${n} or "fd3", "fd4" (and so on).
It is optional and defaults to "${o}".`)},ip=(e,t,r,n)=>{let o=n[ms(e)];if(o===void 0)throw new TypeError(`"${ve(r)}" must not be ${t}. That file descriptor does not exist.
Please set the "stdio" option to ensure that file descriptor exists.`);if(o.direction==="input"&&!r)throw new TypeError(`"${ve(r)}" must not be ${t}. It must be a readable stream, not writable.`);if(o.direction!=="input"&&r)throw new TypeError(`"${ve(r)}" must not be ${t}. It must be a writable stream, not readable.`)},us=(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}=sp(e,r);return`The "${o}: ${wt(i)}" option is incompatible with using "${ve(n)}: ${wt(t)}".
Please set this option with "pipe" instead.`},sp=(e,{stdin:t,stdout:r,stderr:n,stdio:o})=>{let i=ms(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]}},ms=e=>e==="all"?1:e,ve=e=>e?"to":"from",wt=e=>typeof e=="string"?`'${e}'`:typeof e=="number"?`${e}`:"Stream";var Ds=require("node:events");var hs=require("node:events"),se=(e,t,r)=>{let n=e.getMaxListeners();n===0||n===Number.POSITIVE_INFINITY||(e.setMaxListeners(n+t),(0,hs.addAbortListener)(r,()=>{e.setMaxListeners(e.getMaxListeners()-t)}))};var Is=require("node:events");var Ss=require("node:events"),bs=require("node:timers/promises");var Et=(e,t)=>{t&&Yr(e)},Yr=e=>{e.refCounted()},Tt=(e,t)=>{t&&qr(e)},qr=e=>{e.unrefCounted()},gs=(e,t)=>{t&&(qr(e),qr(e))},ys=(e,t)=>{t&&(Yr(e),Yr(e))};var ws=async({anyProcess:e,channel:t,isSubprocess:r,ipcEmitter:n},o)=>{if(Ts(o)||Os(o))return;At.has(e)||At.set(e,[]);let i=At.get(e);if(i.push(o),!(i.length>1))for(;i.length>0;){await As(e,n,o),await bs.scheduler.yield();let s=await Es({wrappedMessage:i[0],anyProcess:e,channel:t,isSubprocess:r,ipcEmitter:n});i.shift(),n.emit("message",s),n.emit("message:done")}},xs=async({anyProcess:e,channel:t,isSubprocess:r,ipcEmitter:n,boundOnMessage:o})=>{Hr();let i=At.get(e);for(;i?.length>0;)await(0,Ss.once)(n,"message:done");e.removeListener("message",o),ys(t,r),n.connected=!1,n.emit("disconnect")},At=new WeakMap;var Q=(e,t,r)=>{if(Ot.has(e))return Ot.get(e);let n=new Is.EventEmitter;return n.connected=!0,Ot.set(e,n),ap({ipcEmitter:n,anyProcess:e,channel:t,isSubprocess:r}),n},Ot=new WeakMap,ap=({ipcEmitter:e,anyProcess:t,channel:r,isSubprocess:n})=>{let o=ws.bind(void 0,{anyProcess:t,channel:r,isSubprocess:n,ipcEmitter:e});t.on("message",o),t.once("disconnect",xs.bind(void 0,{anyProcess:t,channel:r,isSubprocess:n,ipcEmitter:e,boundOnMessage:o})),gs(r,n)},It=e=>{let t=Ot.get(e);return t===void 0?e.channel!==null:t.connected};var Rs=({anyProcess:e,channel:t,isSubprocess:r,message:n,strict:o})=>{if(!o)return n;let i=Q(e,t,r),s=Ct(e,i);return{id:cp++,type:Rt,message:n,hasListeners:s}},cp=0n,Cs=(e,t)=>{if(!(t?.type!==Rt||t.hasListeners))for(let{id:r}of e)r!==void 0&&Dt[r].resolve({isDeadlock:!0,hasListeners:!1})},Es=async({wrappedMessage:e,anyProcess:t,channel:r,isSubprocess:n,ipcEmitter:o})=>{if(e?.type!==Rt||!t.connected)return e;let{id:i,message:s}=e,a={id:i,type:Ps,message:Ct(t,o)};try{await Mt({anyProcess:t,channel:r,isSubprocess:n,ipc:!0},a)}catch(c){o.emit("strict:error",c)}return s},Ts=e=>{if(e?.type!==Ps)return!1;let{id:t,message:r}=e;return Dt[t]?.resolve({isDeadlock:!1,hasListeners:r}),!0},Ms=async(e,t,r)=>{if(e?.type!==Rt)return;let n=v();Dt[e.id]=n;let o=new AbortController;try{let{isDeadlock:i,hasListeners:s}=await Promise.race([n,lp(t,r,o)]);i&&is(r),s||ss(r)}finally{o.abort(),delete Dt[e.id]}},Dt={},lp=async(e,t,{signal:r})=>{se(e,1,r),await(0,Ds.once)(e,"disconnect",{signal:r}),as(t)},Rt="execa:ipc:request",Ps="execa:ipc:response";var Bs=(e,t,r)=>{Ne.has(e)||Ne.set(e,new Set);let n=Ne.get(e),o=v(),i=r?t.id:void 0,s={onMessageSent:o,id:i};return n.add(s),{outgoingMessages:n,outgoingMessage:s}},Ls=({outgoingMessages:e,outgoingMessage:t})=>{e.delete(t),t.onMessageSent.resolve()},As=async(e,t,r)=>{for(;!Ct(e,t)&&Ne.get(e)?.size>0;){let n=[...Ne.get(e)];Cs(n,r),await Promise.all(n.map(({onMessageSent:o})=>o))}},Ne=new WeakMap,Ct=(e,t)=>t.listenerCount("message")>fp(e),fp=e=>N.has(e)&&!V(N.get(e).options.buffer,"ipc")?1:0;var Mt=({anyProcess:e,channel:t,isSubprocess:r,ipc:n},o,{strict:i=!1}={})=>{let s="sendMessage";return Se({methodName:s,isSubprocess:r,ipc:n,isConnected:e.connected}),dp({anyProcess:e,channel:t,methodName:s,isSubprocess:r,message:o,strict:i})},dp=async({anyProcess:e,channel:t,methodName:r,isSubprocess:n,message:o,strict:i})=>{let s=Rs({anyProcess:e,channel:t,isSubprocess:n,message:o,strict:i}),a=Bs(e,s,i);try{await Xr({anyProcess:e,methodName:r,isSubprocess:n,wrappedMessage:s,message:o})}catch(c){throw be(e),c}finally{Ls(a)}},Xr=async({anyProcess:e,methodName:t,isSubprocess:r,wrappedMessage:n,message:o})=>{let i=pp(e);try{await Promise.all([Ms(n,e,r),i(n)])}catch(s){throw fs({error:s,methodName:t,isSubprocess:r}),ds({error:s,methodName:t,isSubprocess:r,message:o}),s}},pp=e=>{if(Kr.has(e))return Kr.get(e);let t=(0,Fs.promisify)(e.send.bind(e));return Kr.set(e,t),t},Kr=new WeakMap;var vs=(e,t)=>{let r="cancelSignal";return Vr(r,!1,e.connected),Xr({anyProcess:e,methodName:r,isSubprocess:!1,wrappedMessage:{type:_s,message:t},message:t})},Ns=async({anyProcess:e,channel:t,isSubprocess:r,ipc:n})=>(await up({anyProcess:e,channel:t,isSubprocess:r,ipc:n}),Jr.signal),up=async({anyProcess:e,channel:t,isSubprocess:r,ipc:n})=>{if(!$s){if($s=!0,!n){ls();return}if(t===null){Hr();return}Q(e,t,r),await Us.scheduler.yield()}},$s=!1,Os=e=>e?.type!==_s?!1:(Jr.abort(e.message),!0),_s="execa:ipc:cancel",Hr=()=>{Jr.abort(cs())},Jr=new AbortController;var js=({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.")}},ks=({subprocess:e,cancelSignal:t,gracefulCancel:r,forceKillAfterDelay:n,context:o,controller:i})=>r?[mp({subprocess:e,cancelSignal:t,forceKillAfterDelay:n,context:o,control