@negoziator/ai-commit 2.85.2 → 2.87.0
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/dist/{anthropic-DKFivN8P.mjs → anthropic-DGATt1dI.mjs} +1 -1
- package/dist/{azure-openai-CJVuAngo.mjs → azure-openai-BT_M34R2.mjs} +1 -1
- package/dist/cli-BreDAZvH.mjs +131 -0
- package/dist/cli.mjs +1 -1
- package/dist/{custom-ovATWSsO.mjs → custom-Cxe97j5h.mjs} +1 -1
- package/dist/{ollama-DSU6gWD-.mjs → ollama-BH86IIn-.mjs} +1 -1
- package/dist/{openai-Cmj5bzOh.mjs → openai-B3aeSqgJ.mjs} +1 -1
- package/package.json +1 -1
- package/dist/cli-ixAE_R3f.mjs +0 -131
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
var vc=Object.defineProperty;var o=(e,t)=>vc(e,"name",{value:t,configurable:!0});var Ve,He,Ke;import Ac from"tty";import{fileURLToPath as bo}from"node:url";import{ChildProcess as Co,execFile as $c,spawnSync as Bc,spawn as Tc}from"node:child_process";import{StringDecoder as So}from"node:string_decoder";import{debuglog as Ic,stripVTControlCharacters as Oc,inspect as vo,promisify as Ao,callbackify as Re,aborted as Rc,styleText as C}from"node:util";import O,{platform as _c,hrtime as $o,execPath as xc,execArgv as Mc,stdout as cn,stdin as Bo}from"node:process";import To,{ReadStream as Io}from"node:tty";import K from"node:path";import Pc from"child_process";import ce from"path";import ln from"fs";import{setTimeout as Oo,scheduler as Ro,setImmediate as Lc}from"node:timers/promises";import{constants as me}from"node:os";import{once as z,addAbortListener as _o,EventEmitter as Nc,on as mt,setMaxListeners as kc}from"node:events";import{serialize as Uc}from"node:v8";import{statSync as jc,readFileSync as dn,appendFileSync as Wc,writeFileSync as Gc,createWriteStream as xo,createReadStream as Mo}from"node:fs";import{Transform as zc,getDefaultHighWaterMark as gt,Duplex as fn,Writable as hn,Readable as ge,PassThrough as Po}from"node:stream";import{Buffer as Dn}from"node:buffer";import{finished as le}from"node:stream/promises";import*as Ft from"node:readline";import Vc from"node:readline";import W from"fs/promises";import Hc from"os";import{fileURLToPath as Kc,pathToFileURL as qc}from"url";var Yc=Object.defineProperty,M=o((e,t)=>Yc(e,"name",{value:t,configurable:!0}),"l");const Zc="known-flag",Jc="unknown-flag",Xc="argument",Lo=M(e=>(typeof e=="object"||typeof e=="function")&&e!==null&&"~standard"in e,"isStandardSchema"),Qc=M(e=>(t=>{const n=e["~standard"].validate(t);if(n instanceof Promise)throw new TypeError("Async schemas are not supported");if(n.issues)throw new Error(n.issues[0]?.message??"Validation failed");return n.value}),"schemaToParser"),el=/\B([A-Z])/g,tl=M(e=>e.replaceAll(el,"-$1").toLowerCase(),"camelToKebab"),{hasOwnProperty:nl}=Object.prototype,_e=M((e,t)=>nl.call(e,t),"hasOwn"),wt=M(e=>Lo(e)?[Qc(e),!1]:typeof e=="function"?[e,!1]:Array.isArray(e)?[wt(e[0])[0],!0]:wt(e.type),"parseFlagType"),No=M((e,t)=>e===Boolean?t!=="false":t,"normalizeBoolean"),ko=M((e,t)=>typeof t=="boolean"?t:e===Number&&t===""?Number.NaN:e(t),"applyParser"),rl=/[\s.:=]/,ol=M(e=>{const t=`Flag name "${e}"`;if(e.length===0)throw new Error(`${t} cannot be empty`);const n=e.match(rl);if(n)throw new Error(`${t} cannot contain "${n?.[0]}"`)},"validateFlagName"),pn=M((e,t,n)=>{if(_e(e,t))throw new Error(`Duplicate flags named "${t}"`);e[t]=n},"setFlag"),il=M(e=>{const t={};for(const n in e){if(!_e(e,n))continue;ol(n);const r=e[n],i=[[],...wt(r),r];pn(t,n,i);const s=tl(n);if(n!==s&&pn(t,s,i),"alias"in r&&typeof r.alias=="string"){const{alias:a}=r,u=`Flag alias "${a}" for flag "${n}"`;if(n.length===1)throw new Error(`${u} cannot be defined for a single-character flag`);if(a.length===0)throw new Error(`${u} cannot be empty`);if(a.length>1)throw new Error(`${u} must be a single character`);pn(t,a,i)}}return t},"createRegistry"),sl=M((e,t)=>{const n={};for(const r in e){if(!_e(e,r))continue;const[i,,s,a]=t[r];if(i.length===0&&!Lo(a)&&"default"in a){let{default:u}=a;typeof u=="function"&&(u=u()),n[r]=u}else n[r]=s?i:i.pop()}return n},"finalizeFlags"),yt="--",al=3,ul=/^-{1,2}\w/,Uo=M(e=>{if(!ul.test(e))return;const t=!e.startsWith(yt);let n=e.slice(t?1:2),r,i=-1;for(const s of["=",":","."]){const a=n.indexOf(s);a!==-1&&(i===-1||a<i)&&(i=a)}return i!==-1&&(r=n.slice(i+1),n=n.slice(0,i)),[n,r,t]},"parseFlagArgv"),jo=M((e,{onFlag:t,onArgument:n})=>{let r;const i=M((s,a)=>{if(typeof r!="function")return!0;r(s,a),r=void 0},"triggerValueCallback");for(let s=0;s<e.length;s+=1){const a=e[s];if(a===yt){i();const c=e.slice(s+1);n?.(c,[s],!0);break}const u=Uo(a);if(u){if(i(),!t)continue;const[c,l,d]=u;if(d)for(let f=0;f<c.length;f+=1){i();const h=f===c.length-1;r=t(c[f],h?l:void 0,[s,f+1,h])}else r=t(c,l,[s])}else i(a,[s])&&n?.([a],[s])}i()},"argvIterator"),Wo=M((e,t)=>{for(let n=t.length-1;n>=0;n-=1){const[r,i,s]=t[n];if(i){const a=e[r];let u=a.slice(0,i);if(s||(u+=a.slice(i+1)),u!=="-"){e[r]=u;continue}}e.splice(r,1)}},"spliceFromArgv"),mn=M((e,t)=>Object.assign(e,{[yt]:t}),"createPositionalArgumentsFromParts");M(e=>{const t=e.indexOf(yt);if(t===-1)return mn([...e],[]);const n=e.slice(0,t),r=e.slice(t+1);return mn([...n,...r],r)},"createPositionalArguments");const cl=M((e,t=process.argv.slice(2),{ignore:n,booleanNegation:r}={})=>{const i=[],s=il(e),a={},u=[];let c=[];return jo(t,{onFlag(l,d,f){const h=f.length===al,D=(h||l.length>1)&&_e(s,l);let p;if(!D&&r&&!h&&l.length>3&&l.startsWith("no-")){const m=l.slice(3);_e(s,m)&&s[m][1]===Boolean&&(p=m)}if(!n?.(D||p?Zc:Jc,l,d)){if(D){const[m,g]=s[l],F=No(g,d),w=M((E,y)=>{i.push(f),y&&i.push(y),m.push(ko(g,E||""))},"getFollowingValue");return F===void 0?w:w(F)}if(p){s[p][0].push(!1),i.push(f);return}_e(a,l)||(a[l]=[]),a[l].push(d===void 0?!0:d),i.push(f)}},onArgument:M((l,d,f)=>{n?.(Xc,t[d[0]])||(u.push(...l),f?(c=l,t.splice(d[0])):i.push(d))},"onArgument")}),Wo(t,i),{flags:sl(e,s),unknownFlags:a,_:mn(u,c)}},"typeFlag");M((e,t,n=process.argv.slice(2))=>{const r=new Set(e.split(",").map(c=>Uo(c)?.[0])),[i,s]=wt(t),a=[],u=[];return jo(n,{onFlag:M((c,l,d)=>{if(!r.has(c)||!s&&a.length>0)return;const f=No(i,l),h=M((D,p)=>{u.push(d),p&&u.push(p),a.push(ko(i,D||""))},"getFollowingValue");return f===void 0?h:h(f)},"onFlag")}),Wo(n,u),s?a:a[0]},"getFlag");var ll=Object.defineProperty,v=o((e,t)=>ll(e,"name",{value:t,configurable:!0}),"n$2");const dl=v(e=>{const t=process.stdout.columns??Number.POSITIVE_INFINITY;return typeof e=="function"&&(e=e(t)),e||(e={}),Array.isArray(e)?{columns:e,stdoutColumns:t}:{columns:e.columns??[],stdoutColumns:e.stdoutColumns??t}},"getOptions");function Go({onlyFirst:e=!1}={}){const t=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");return new RegExp(t,e?void 0:"g")}o(Go,"j"),v(Go,"ansiRegex");const fl=Go();function gn(e){if(typeof e!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof e}\``);return e.replace(fl,"")}o(gn,"w"),v(gn,"stripAnsi");function zo(e){return e===161||e===164||e===167||e===168||e===170||e===173||e===174||e>=176&&e<=180||e>=182&&e<=186||e>=188&&e<=191||e===198||e===208||e===215||e===216||e>=222&&e<=225||e===230||e>=232&&e<=234||e===236||e===237||e===240||e===242||e===243||e>=247&&e<=250||e===252||e===254||e===257||e===273||e===275||e===283||e===294||e===295||e===299||e>=305&&e<=307||e===312||e>=319&&e<=322||e===324||e>=328&&e<=331||e===333||e===338||e===339||e===358||e===359||e===363||e===462||e===464||e===466||e===468||e===470||e===472||e===474||e===476||e===593||e===609||e===708||e===711||e>=713&&e<=715||e===717||e===720||e>=728&&e<=731||e===733||e===735||e>=768&&e<=879||e>=913&&e<=929||e>=931&&e<=937||e>=945&&e<=961||e>=963&&e<=969||e===1025||e>=1040&&e<=1103||e===1105||e===8208||e>=8211&&e<=8214||e===8216||e===8217||e===8220||e===8221||e>=8224&&e<=8226||e>=8228&&e<=8231||e===8240||e===8242||e===8243||e===8245||e===8251||e===8254||e===8308||e===8319||e>=8321&&e<=8324||e===8364||e===8451||e===8453||e===8457||e===8467||e===8470||e===8481||e===8482||e===8486||e===8491||e===8531||e===8532||e>=8539&&e<=8542||e>=8544&&e<=8555||e>=8560&&e<=8569||e===8585||e>=8592&&e<=8601||e===8632||e===8633||e===8658||e===8660||e===8679||e===8704||e===8706||e===8707||e===8711||e===8712||e===8715||e===8719||e===8721||e===8725||e===8730||e>=8733&&e<=8736||e===8739||e===8741||e>=8743&&e<=8748||e===8750||e>=8756&&e<=8759||e===8764||e===8765||e===8776||e===8780||e===8786||e===8800||e===8801||e>=8804&&e<=8807||e===8810||e===8811||e===8814||e===8815||e===8834||e===8835||e===8838||e===8839||e===8853||e===8857||e===8869||e===8895||e===8978||e>=9312&&e<=9449||e>=9451&&e<=9547||e>=9552&&e<=9587||e>=9600&&e<=9615||e>=9618&&e<=9621||e===9632||e===9633||e>=9635&&e<=9641||e===9650||e===9651||e===9654||e===9655||e===9660||e===9661||e===9664||e===9665||e>=9670&&e<=9672||e===9675||e>=9678&&e<=9681||e>=9698&&e<=9701||e===9711||e===9733||e===9734||e===9737||e===9742||e===9743||e===9756||e===9758||e===9792||e===9794||e===9824||e===9825||e>=9827&&e<=9829||e>=9831&&e<=9834||e===9836||e===9837||e===9839||e===9886||e===9887||e===9919||e>=9926&&e<=9933||e>=9935&&e<=9939||e>=9941&&e<=9953||e===9955||e===9960||e===9961||e>=9963&&e<=9969||e===9972||e>=9974&&e<=9977||e===9979||e===9980||e===9982||e===9983||e===10045||e>=10102&&e<=10111||e>=11094&&e<=11097||e>=12872&&e<=12879||e>=57344&&e<=63743||e>=65024&&e<=65039||e===65533||e>=127232&&e<=127242||e>=127248&&e<=127277||e>=127280&&e<=127337||e>=127344&&e<=127373||e===127375||e===127376||e>=127387&&e<=127404||e>=917760&&e<=917999||e>=983040&&e<=1048573||e>=1048576&&e<=1114109}o(zo,"P$1"),v(zo,"isAmbiguous");function Vo(e){return e===12288||e>=65281&&e<=65376||e>=65504&&e<=65510}o(Vo,"z$1"),v(Vo,"isFullWidth");function Ho(e){return e>=4352&&e<=4447||e===8986||e===8987||e===9001||e===9002||e>=9193&&e<=9196||e===9200||e===9203||e===9725||e===9726||e===9748||e===9749||e>=9776&&e<=9783||e>=9800&&e<=9811||e===9855||e>=9866&&e<=9871||e===9875||e===9889||e===9898||e===9899||e===9917||e===9918||e===9924||e===9925||e===9934||e===9940||e===9962||e===9970||e===9971||e===9973||e===9978||e===9981||e===9989||e===9994||e===9995||e===10024||e===10060||e===10062||e>=10067&&e<=10069||e===10071||e>=10133&&e<=10135||e===10160||e===10175||e===11035||e===11036||e===11088||e===11093||e>=11904&&e<=11929||e>=11931&&e<=12019||e>=12032&&e<=12245||e>=12272&&e<=12287||e>=12289&&e<=12350||e>=12353&&e<=12438||e>=12441&&e<=12543||e>=12549&&e<=12591||e>=12593&&e<=12686||e>=12688&&e<=12773||e>=12783&&e<=12830||e>=12832&&e<=12871||e>=12880&&e<=42124||e>=42128&&e<=42182||e>=43360&&e<=43388||e>=44032&&e<=55203||e>=63744&&e<=64255||e>=65040&&e<=65049||e>=65072&&e<=65106||e>=65108&&e<=65126||e>=65128&&e<=65131||e>=94176&&e<=94180||e===94192||e===94193||e>=94208&&e<=100343||e>=100352&&e<=101589||e>=101631&&e<=101640||e>=110576&&e<=110579||e>=110581&&e<=110587||e===110589||e===110590||e>=110592&&e<=110882||e===110898||e>=110928&&e<=110930||e===110933||e>=110948&&e<=110951||e>=110960&&e<=111355||e>=119552&&e<=119638||e>=119648&&e<=119670||e===126980||e===127183||e===127374||e>=127377&&e<=127386||e>=127488&&e<=127490||e>=127504&&e<=127547||e>=127552&&e<=127560||e===127568||e===127569||e>=127584&&e<=127589||e>=127744&&e<=127776||e>=127789&&e<=127797||e>=127799&&e<=127868||e>=127870&&e<=127891||e>=127904&&e<=127946||e>=127951&&e<=127955||e>=127968&&e<=127984||e===127988||e>=127992&&e<=128062||e===128064||e>=128066&&e<=128252||e>=128255&&e<=128317||e>=128331&&e<=128334||e>=128336&&e<=128359||e===128378||e===128405||e===128406||e===128420||e>=128507&&e<=128591||e>=128640&&e<=128709||e===128716||e>=128720&&e<=128722||e>=128725&&e<=128727||e>=128732&&e<=128735||e===128747||e===128748||e>=128756&&e<=128764||e>=128992&&e<=129003||e===129008||e>=129292&&e<=129338||e>=129340&&e<=129349||e>=129351&&e<=129535||e>=129648&&e<=129660||e>=129664&&e<=129673||e>=129679&&e<=129734||e>=129742&&e<=129756||e>=129759&&e<=129769||e>=129776&&e<=129784||e>=131072&&e<=196605||e>=196608&&e<=262141}o(Ho,"G$1"),v(Ho,"isWide");function Ko(e){if(!Number.isSafeInteger(e))throw new TypeError(`Expected a code point, got \`${typeof e}\`.`)}o(Ko,"Z$1"),v(Ko,"validate");function qo(e,{ambiguousAsWide:t=!1}={}){return Ko(e),Vo(e)||Ho(e)||t&&zo(e)?2:1}o(qo,"V$2"),v(qo,"eastAsianWidth");var hl=v(()=>/[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26D3\uFE0F?(?:\u200D\uD83D\uDCA5)?|\u26F9(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF43\uDF45-\uDF4A\uDF4C-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uDDE6\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|\uDDE7\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|\uDDE8\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF7\uDDFA-\uDDFF]|\uDDE9\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|\uDDEA\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|\uDDEB\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|\uDDEC\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|\uDDED\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|\uDDEE\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|\uDDEF\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|\uDDF0\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|\uDDF1\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|\uDDF2\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|\uDDF3\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|\uDDF4\uD83C\uDDF2|\uDDF5\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|\uDDF6\uD83C\uDDE6|\uDDF7\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|\uDDF8\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|\uDDF9\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|\uDDFA\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF]|\uDDFB\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|\uDDFC\uD83C[\uDDEB\uDDF8]|\uDDFD\uD83C\uDDF0|\uDDFE\uD83C[\uDDEA\uDDF9]|\uDDFF\uD83C[\uDDE6\uDDF2\uDDFC]|\uDF44(?:\u200D\uD83D\uDFEB)?|\uDF4B(?:\u200D\uD83D\uDFE9)?|\uDFC3(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\uD83D(?:[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3]\uFE0F?|[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4\uDEB5](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE41\uDE43\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC08(?:\u200D\u2B1B)?|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC26(?:\u200D(?:\u2B1B|\uD83D\uDD25))?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE])))?))?|\uDC6F(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDD75(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?|\uDE42(?:\u200D[\u2194\u2195]\uFE0F?)?|\uDEB6(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE89\uDE8F-\uDEC2\uDEC6\uDECE-\uDEDC\uDEDF-\uDEE9]|\uDD3C(?:\u200D[\u2640\u2642]\uFE0F?|\uD83C[\uDFFB-\uDFFF])?|\uDDCE(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1|\uDDD1\u200D\uD83E\uDDD2(?:\u200D\uD83E\uDDD2)?|\uDDD2(?:\u200D\uD83E\uDDD2)?))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g,"emojiRegex");const Dl=new Intl.Segmenter,pl=new RegExp("^\\p{Default_Ignorable_Code_Point}$","u");function de(e,t={}){if(typeof e!="string"||e.length===0)return 0;const{ambiguousIsNarrow:n=!0,countAnsiEscapeCodes:r=!1}=t;if(r||(e=gn(e)),e.length===0)return 0;let i=0;const s={ambiguousAsWide:!n};for(const{segment:a}of Dl.segment(e)){const u=a.codePointAt(0);if(!(u<=31||u>=127&&u<=159)&&!(u>=8203&&u<=8207||u===65279)&&!(u>=768&&u<=879||u>=6832&&u<=6911||u>=7616&&u<=7679||u>=8400&&u<=8447||u>=65056&&u<=65071)&&!(u>=55296&&u<=57343)&&!(u>=65024&&u<=65039)&&!pl.test(a)){if(hl().test(a)){i+=2;continue}i+=qo(u,s)}}return i}o(de,"d"),v(de,"stringWidth");const Yo=v(e=>Math.max(...e.split(`
|
|
2
|
+
`).map(t=>de(t))),"getLongestLineWidth"),ml=v(e=>{const t=[];for(const n of e){const{length:r}=n,i=r-t.length;for(let s=0;s<i;s+=1)t.push(0);for(let s=0;s<r;s+=1){const a=Yo(n[s]);a>t[s]&&(t[s]=a)}}return t},"getColumnContentWidths"),Zo=/^\d+%$/,Jo={width:"auto",align:"left",contentWidth:0,paddingLeft:0,paddingRight:0,paddingTop:0,paddingBottom:0,horizontalPadding:0,paddingLeftString:"",paddingRightString:""},gl=v((e,t)=>{const n=[];for(let r=0;r<e.length;r+=1){const i=t[r]??"auto";if(typeof i=="number"||i==="auto"||i==="content-width"||typeof i=="string"&&Zo.test(i)){n.push({...Jo,width:i,contentWidth:e[r]});continue}if(i&&typeof i=="object"){const s={...Jo,...i,contentWidth:e[r]};s.horizontalPadding=s.paddingLeft+s.paddingRight,n.push(s);continue}throw new Error(`Invalid column width: ${JSON.stringify(i)}`)}return n},"initColumns"),Fl=v((e,t)=>{for(const n of e){const{width:r}=n;if(r==="content-width"&&(n.width=n.contentWidth),r==="auto"){const c=Math.min(20,n.contentWidth);n.width=c,n.autoOverflow=n.contentWidth-c}if(typeof r=="string"&&Zo.test(r)){const c=Number.parseFloat(r.slice(0,-1))/100;n.width=Math.floor(t*c)-(n.paddingLeft+n.paddingRight)}const{horizontalPadding:i}=n,s=1,a=s+i;if(a>=t){const c=a-t,l=Math.ceil(n.paddingLeft/i*c),d=c-l;n.paddingLeft-=l,n.paddingRight-=d,n.horizontalPadding=n.paddingLeft+n.paddingRight}n.paddingLeftString=n.paddingLeft?" ".repeat(n.paddingLeft):"",n.paddingRightString=n.paddingRight?" ".repeat(n.paddingRight):"";const u=t-n.horizontalPadding;n.width=Math.max(Math.min(n.width,u),s)}},"resolveColumnWidths"),Xo=v(()=>Object.assign([],{columns:0}),"makeRow"),wl=v((e,t)=>{const n=[Xo()];let[r]=n;for(const i of e){const s=i.width+i.horizontalPadding;r.columns+s>t&&(r=Xo(),n.push(r)),r.push(i),r.columns+=s}for(const i of n){const s=i.reduce((h,D)=>h+D.width+D.horizontalPadding,0);let a=t-s;if(a===0)continue;const u=i.filter(h=>"autoOverflow"in h),c=u.filter(h=>h.autoOverflow>0),l=c.reduce((h,D)=>h+D.autoOverflow,0),d=Math.min(l,a);for(const h of c){const D=Math.floor(h.autoOverflow/l*d);h.width+=D,a-=D}const f=Math.floor(a/u.length);for(let h=0;h<u.length;h+=1){const D=u[h];h===u.length-1?D.width+=a:D.width+=f,a-=f}}return n},"balanceAuto"),yl=v((e,t,n)=>{const r=gl(n,t);return Fl(r,e),wl(r,e)},"computeColumnWidths"),Fn=10,Qo=v((e=0)=>t=>`\x1B[${t+e}m`,"wrapAnsi16"),ei=v((e=0)=>t=>`\x1B[${38+e};5;${t}m`,"wrapAnsi256"),ti=v((e=0)=>(t,n,r)=>`\x1B[${38+e};2;${t};${n};${r}m`,"wrapAnsi16m"),x={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};Object.keys(x.modifier);const El=Object.keys(x.color),bl=Object.keys(x.bgColor);[...El,...bl];function ni(){const e=new Map;for(const[t,n]of Object.entries(x)){for(const[r,i]of Object.entries(n))x[r]={open:`\x1B[${i[0]}m`,close:`\x1B[${i[1]}m`},n[r]=x[r],e.set(i[0],i[1]);Object.defineProperty(x,t,{value:n,enumerable:!1})}return Object.defineProperty(x,"codes",{value:e,enumerable:!1}),x.color.close="\x1B[39m",x.bgColor.close="\x1B[49m",x.color.ansi=Qo(),x.color.ansi256=ei(),x.color.ansi16m=ti(),x.bgColor.ansi=Qo(Fn),x.bgColor.ansi256=ei(Fn),x.bgColor.ansi16m=ti(Fn),Object.defineProperties(x,{rgbToAnsi256:{value:v((t,n,r)=>t===n&&n===r?t<8?16:t>248?231:Math.round((t-8)/247*24)+232:16+36*Math.round(t/255*5)+6*Math.round(n/255*5)+Math.round(r/255*5),"value"),enumerable:!1},hexToRgb:{value:v(t=>{const n=/[a-f\d]{6}|[a-f\d]{3}/i.exec(t.toString(16));if(!n)return[0,0,0];let[r]=n;r.length===3&&(r=[...r].map(s=>s+s).join(""));const i=Number.parseInt(r,16);return[i>>16&255,i>>8&255,i&255]},"value"),enumerable:!1},hexToAnsi256:{value:v(t=>x.rgbToAnsi256(...x.hexToRgb(t)),"value"),enumerable:!1},ansi256ToAnsi:{value:v(t=>{if(t<8)return 30+t;if(t<16)return 90+(t-8);let n,r,i;if(t>=232)n=((t-232)*10+8)/255,r=n,i=n;else{t-=16;const u=t%36;n=Math.floor(t/36)/5,r=Math.floor(u/6)/5,i=u%6/5}const s=Math.max(n,r,i)*2;if(s===0)return 30;let a=30+(Math.round(i)<<2|Math.round(r)<<1|Math.round(n));return s===2&&(a+=60),a},"value"),enumerable:!1},rgbToAnsi:{value:v((t,n,r)=>x.ansi256ToAnsi(x.rgbToAnsi256(t,n,r)),"value"),enumerable:!1},hexToAnsi:{value:v(t=>x.ansi256ToAnsi(x.hexToAnsi256(t)),"value"),enumerable:!1}}),x}o(ni,"FD"),v(ni,"assembleStyles");const Cl=ni(),Et=new Set(["\x1B","\x9B"]),Sl=39,wn="\x07",ri="[",vl="]",oi="m",bt=`${vl}8;;`,ii=v(e=>`${Et.values().next().value}${ri}${e}${oi}`,"wrapAnsiCode"),si=v(e=>`${Et.values().next().value}${bt}${e}${wn}`,"wrapAnsiHyperlink"),Al=v(e=>e.split(" ").map(t=>de(t)),"wordLengths"),yn=v((e,t,n)=>{const r=[...t];let i=!1,s=!1,a=de(gn(e.at(-1)));for(const[u,c]of r.entries()){const l=de(c);if(a+l<=n?e[e.length-1]+=c:(e.push(c),a=0),Et.has(c)&&(i=!0,s=r.slice(u+1,u+1+bt.length).join("")===bt),i){s?c===wn&&(i=!1,s=!1):c===oi&&(i=!1);continue}a+=l,a===n&&u<r.length-1&&(e.push(""),a=0)}!a&&e.at(-1).length>0&&e.length>1&&(e[e.length-2]+=e.pop())},"wrapWord"),$l=v(e=>{const t=e.split(" ");let n=t.length;for(;n>0&&!(de(t[n-1])>0);)n--;return n===t.length?e:t.slice(0,n).join(" ")+t.slice(n).join("")},"stringVisibleTrimSpacesRight"),Bl=v((e,t,n={})=>{if(n.trim!==!1&&e.trim()==="")return"";let r="",i,s;const a=Al(e);let u=[""];for(const[f,h]of e.split(" ").entries()){n.trim!==!1&&(u[u.length-1]=u.at(-1).trimStart());let D=de(u.at(-1));if(f!==0&&(D>=t&&(n.wordWrap===!1||n.trim===!1)&&(u.push(""),D=0),(D>0||n.trim===!1)&&(u[u.length-1]+=" ",D++)),n.hard&&a[f]>t){const p=t-D,m=1+Math.floor((a[f]-p-1)/t);Math.floor((a[f]-1)/t)<m&&u.push(""),yn(u,h,t);continue}if(D+a[f]>t&&D>0&&a[f]>0){if(n.wordWrap===!1&&D<t){yn(u,h,t);continue}u.push("")}if(D+a[f]>t&&n.wordWrap===!1){yn(u,h,t);continue}u[u.length-1]+=h}n.trim!==!1&&(u=u.map(f=>$l(f)));const c=u.join(`
|
|
3
|
+
`),l=[...c];let d=0;for(const[f,h]of l.entries()){if(r+=h,Et.has(h)){const{groups:p}=new RegExp(`(?:\\${ri}(?<code>\\d+)m|\\${bt}(?<uri>.*)${wn})`).exec(c.slice(d))||{groups:{}};if(p.code!==void 0){const m=Number.parseFloat(p.code);i=m===Sl?void 0:m}else p.uri!==void 0&&(s=p.uri.length===0?void 0:p.uri)}const D=Cl.codes.get(Number(i));l[f+1]===`
|
|
4
|
+
`?(s&&(r+=si("")),i&&D&&(r+=ii(D))):h===`
|
|
5
|
+
`&&(i&&D&&(r+=ii(i)),s&&(r+=si(s))),d+=h.length}return r},"exec");function ai(e,t,n){return String(e).normalize().replaceAll(`\r
|
|
6
|
+
`,`
|
|
7
|
+
`).split(`
|
|
8
|
+
`).map(r=>Bl(r,t,n)).join(`
|
|
9
|
+
`)}o(ai,"BD"),v(ai,"wrapAnsi");const ui=v(e=>Array.from({length:e}).fill(""),"emptyLines"),Tl=v((e,t)=>{const n=[];let r=0;for(const i of e){let s=0;const a=i.map(c=>{let l=t[r]??"";r+=1,c.preprocess&&(l=c.preprocess(l)),Yo(l)>c.width&&(l=ai(l,c.width,{hard:!0}));let d=l.split(`
|
|
10
|
+
`);if(c.postprocess){const{postprocess:f}=c;d=d.map((h,D)=>f.call(c,h,D))}return c.paddingTop&&d.unshift(...ui(c.paddingTop)),c.paddingBottom&&d.push(...ui(c.paddingBottom)),d.length>s&&(s=d.length),{...c,lines:d}}),u=[];for(let c=0;c<s;c+=1){const l=a.map(d=>{const f=d.lines[c]??"",h=Number.isFinite(d.width)?" ".repeat(d.width-de(f)):"";let D=d.paddingLeftString;return d.align==="right"&&(D+=h),D+=f,d.align==="left"&&(D+=h),D+d.paddingRightString}).join("");u.push(l)}n.push(u.join(`
|
|
11
|
+
`))}return n.join(`
|
|
12
|
+
`)},"renderRow"),Il=v((e,t)=>{if(!e||e.length===0)return"";const n=ml(e),r=n.length;if(r===0)return"";const{stdoutColumns:i,columns:s}=dl(t);if(s.length>r)throw new Error(`${s.length} columns defined, but only ${r} columns found`);const a=yl(i,s,n);return e.map(u=>Tl(a,u)).join(`
|
|
13
|
+
`)},"terminalColumns"),Ol=["<",">","=",">=","<="],Rl=v(e=>{if(!Ol.includes(e))throw new TypeError(`Invalid breakpoint operator: ${e}`)},"assertOperator"),_l=v(e=>{const t=Object.keys(e).map(n=>{const[r,i]=n.split(" ");Rl(r);const s=Number.parseInt(i,10);if(Number.isNaN(s))throw new TypeError(`Invalid breakpoint value: ${i}`);const a=e[n];return{operator:r,breakpoint:s,value:a}}).sort((n,r)=>r.breakpoint-n.breakpoint);return n=>t.find(({operator:r,breakpoint:i})=>r==="="&&n===i||r===">"&&n>i||r==="<"&&n<i||r===">="&&n>=i||r==="<="&&n<=i)?.value},"breakpoints");var xl=Object.defineProperty,T=o((e,t)=>xl(e,"name",{value:t,configurable:!0}),"o$1");const ie=new Uint32Array(65536),Ml=T((e,t)=>{const n=e.length,r=t.length,i=1<<n-1;let s=-1,a=0,u=n,c=n;for(;c--;)ie[e.charCodeAt(c)]|=1<<c;for(c=0;c<r;c++){let l=ie[t.charCodeAt(c)];const d=l|a;l|=(l&s)+s^s,a|=~(l|s),s&=l,a&i&&u++,s&i&&u--,a=a<<1|1,s=s<<1|~(d|a),a&=d}for(c=n;c--;)ie[e.charCodeAt(c)]=0;return u},"myers_32"),Pl=T((e,t)=>{const n=t.length,r=e.length,i=[],s=[],a=Math.ceil(n/32),u=Math.ceil(r/32);for(let p=0;p<a;p++)s[p]=-1,i[p]=0;let c=0;for(;c<u-1;c++){let p=0,m=-1;const g=c*32,F=Math.min(32,r)+g;for(let w=g;w<F;w++)ie[e.charCodeAt(w)]|=1<<w;for(let w=0;w<n;w++){const E=ie[t.charCodeAt(w)],y=s[w/32|0]>>>w&1,b=i[w/32|0]>>>w&1,S=E|p,$=((E|b)&m)+m^m|E|b;let B=p|~($|m),I=m&$;B>>>31^y&&(s[w/32|0]^=1<<w),I>>>31^b&&(i[w/32|0]^=1<<w),B=B<<1|y,I=I<<1|b,m=I|~(S|B),p=B&S}for(let w=g;w<F;w++)ie[e.charCodeAt(w)]=0}let l=0,d=-1;const f=c*32,h=Math.min(32,r-f)+f;for(let p=f;p<h;p++)ie[e.charCodeAt(p)]|=1<<p;let D=r;for(let p=0;p<n;p++){const m=ie[t.charCodeAt(p)],g=s[p/32|0]>>>p&1,F=i[p/32|0]>>>p&1,w=m|l,E=((m|F)&d)+d^d|m|F;let y=l|~(E|d),b=d&E;D+=y>>>r-1&1,D-=b>>>r-1&1,y>>>31^g&&(s[p/32|0]^=1<<p),b>>>31^F&&(i[p/32|0]^=1<<p),y=y<<1|g,b=b<<1|F,d=b|~(w|y),l=y&w}for(let p=f;p<h;p++)ie[e.charCodeAt(p)]=0;return D},"myers_x"),ci=T((e,t)=>{if(e.length<t.length){const n=t;t=e,e=n}return t.length===0?e.length:e.length<=32?Ml(e,t):Pl(e,t)},"distance"),Ll=T((e,t)=>{let n=1/0,r=0;for(let i=0;i<t.length;i++){const s=ci(e,t[i]);s<n&&(n=s,r=i)}return t[r]},"closest"),Nl=T(e=>e.replaceAll(/[\W_]([a-z\d])?/gi,(t,n)=>n?n.toUpperCase():""),"camelCase"),kl=T(e=>e.replaceAll(/\B([A-Z])/g,"-$1").toLowerCase(),"kebabCase"),Ul={"> 80":[{width:"content-width",paddingLeft:2,paddingRight:8},{width:"auto"}],"> 40":[{width:"auto",paddingLeft:2,paddingRight:8,preprocess:T(e=>e.trim(),"preprocess")},{width:"100%",paddingLeft:2,paddingBottom:1}],"> 0":{stdoutColumns:1e3,columns:[{width:"content-width",paddingLeft:2,paddingRight:8},{width:"content-width"}]}};function li(e){let t=!1;return{type:"table",data:{tableData:Object.keys(e).sort((n,r)=>n.localeCompare(r)).map(n=>{const r=e[n],i="alias"in r;return i&&(t=!0),{name:n,flag:r,flagFormatted:`--${kl(n)}`,aliasesEnabled:t,aliasFormatted:i?`-${r.alias}`:void 0}}).map(n=>(n.aliasesEnabled=t,[{type:"flagName",data:n},{type:"flagDescription",data:n}])),tableBreakpoints:Ul}}}o(li,"z"),T(li,"renderFlags");const di=T(e=>!e||(e.version??(e.help?e.help.version:void 0)),"getVersion"),fi=T(e=>{const t="parent"in e&&e.parent?.name;return(t?`${t} `:"")+e.name},"getName");function hi(e){const t=[];e.name&&t.push(fi(e));const n=di(e)??("parent"in e&&di(e.parent));if(n&&t.push(`v${n}`),t.length!==0)return{id:"name",type:"text",data:`${t.join(" ")}
|
|
14
|
+
`}}o(hi,"K"),T(hi,"getNameAndVersion");function Di(e){const{help:t}=e;if(!(!t||!t.description))return{id:"description",type:"text",data:`${t.description}
|
|
15
|
+
`}}o(Di,"Z"),T(Di,"getDescription");function pi(e){const t=e.help||{};if("usage"in t)return t.usage?{id:"usage",type:"section",data:{title:"Usage:",body:Array.isArray(t.usage)?t.usage.join(`
|
|
16
|
+
`):t.usage}}:void 0;if(e.name){const n=[],r=[fi(e)];if(e.flags&&Object.keys(e.flags).length>0&&r.push("[flags...]"),e.parameters&&e.parameters.length>0){const{parameters:i}=e,s=i.indexOf("--"),a=s!==-1&&i.slice(s+1).some(u=>u.startsWith("<"));r.push(i.map(u=>u!=="--"?u:a?"--":"[--]").join(" "))}if(r.length>1&&n.push(r.join(" ")),"commands"in e&&e.commands?.length&&n.push(`${e.name} <command>`),n.length>0)return{id:"usage",type:"section",data:{title:"Usage:",body:n.join(`
|
|
17
|
+
`)}}}}o(pi,"G"),T(pi,"getUsage");function mi(e){return!("commands"in e)||!e.commands?.length?void 0:{id:"commands",type:"section",data:{title:"Commands:",body:{type:"table",data:{tableData:e.commands.map(t=>{const{help:n}=t.options;return[t.options.name,typeof n=="object"&&n.description||""]}),tableOptions:[{width:"content-width",paddingLeft:2,paddingRight:8}]}},indentBody:0}}}o(mi,"Q"),T(mi,"getCommands");function gi(e){if(!(!e.flags||Object.keys(e.flags).length===0))return{id:"flags",type:"section",data:{title:"Flags:",body:li(e.flags),indentBody:0}}}o(gi,"X"),T(gi,"getFlags");function Fi(e){const{help:t}=e;if(!t||!t.examples||t.examples.length===0)return;let{examples:n}=t;if(Array.isArray(n)&&(n=n.join(`
|
|
18
|
+
`)),n)return{id:"examples",type:"section",data:{title:"Examples:",body:n}}}o(Fi,"Y"),T(Fi,"getExamples");function wi(e){if(!("alias"in e)||!e.alias)return;const{alias:t}=e;return{id:"aliases",type:"section",data:{title:"Aliases:",body:Array.isArray(t)?t.join(", "):t}}}o(wi,"ee"),T(wi,"getAliases");const jl=T(e=>[hi,Di,pi,mi,gi,Fi,wi].map(t=>t(e)).filter(Boolean),"generateHelp"),Wl=Ac.WriteStream.prototype.hasColors(),yi=(Ve=class{text(t){return t}bold(t){return Wl?`\x1B[1m${t}\x1B[22m`:t.toLocaleUpperCase()}indentText({text:t,spaces:n}){return t.replaceAll(/^/gm," ".repeat(n))}heading(t){return this.bold(t)}section({title:t,body:n,indentBody:r=2}){return`${(t?`${this.heading(t)}
|
|
19
|
+
`:"")+(n?this.indentText({text:this.render(n),spaces:r}):"")}
|
|
20
|
+
`}table({tableData:t,tableOptions:n,tableBreakpoints:r}){return Il(t.map(i=>i.map(s=>this.render(s))),r?_l(r):n)}flagParameter(t){return t===Boolean?"":t===String?"<string>":t===Number?"<number>":Array.isArray(t)?this.flagParameter(t[0]):"<value>"}flagOperator(t){return" "}flagName(t){const{flag:n,flagFormatted:r,aliasesEnabled:i,aliasFormatted:s}=t;let a="";if(s?a+=`${s}, `:i&&(a+=" "),a+=r,"placeholder"in n&&typeof n.placeholder=="string")a+=`${this.flagOperator(t)}${n.placeholder}`;else{const u=this.flagParameter("type"in n?n.type:n);u&&(a+=`${this.flagOperator(t)}${u}`)}return a}flagDefault(t){return JSON.stringify(t)}flagDescription({flag:t}){let n="description"in t?t.description??"":"";if("default"in t){let{default:r}=t;typeof r=="function"&&(r=r()),r&&(n+=` (default: ${this.flagDefault(r)})`)}return n}render(t){if(typeof t=="string")return t;if(Array.isArray(t))return t.map(n=>this.render(n)).join(`
|
|
21
|
+
`);if("type"in t&&this[t.type]){const n=this[t.type];if(typeof n=="function")return n.call(this,t.data)}throw new Error(`Invalid node type: ${JSON.stringify(t)}`)}},o(Ve,"_ne"),Ve);T(yi,"Renderers");let Gl=yi;const Ei=T(e=>e.length>0&&!e.includes(" "),"isValidScriptName"),{stringify:Q}=JSON,zl=/[|\\{}()[\]^$+*?.]/;function En(e){const t=[];let n,r;for(const i of e){if(r)throw new Error(`Invalid parameter: Spread parameter ${Q(r)} must be last`);const s=i[0],a=i.at(-1);let u;if(s==="<"&&a===">"&&(u=!0,n))throw new Error(`Invalid parameter: Required parameter ${Q(i)} cannot come after optional parameter ${Q(n)}`);if(s==="["&&a==="]"&&(u=!1,n=i),u===void 0)throw new Error(`Invalid parameter: ${Q(i)}. Must be wrapped in <> (required parameter) or [] (optional parameter)`);let c=i.slice(1,-1);const l=c.slice(-3)==="...";l&&(r=i,c=c.slice(0,-3));const d=c.match(zl);if(d)throw new Error(`Invalid parameter: ${Q(i)}. Invalid character found ${Q(d[0])}`);t.push({name:c,required:u,spread:l})}return t}o(En,"P"),T(En,"parseParameters");function bn(e,t,n,r){for(let i=0;i<t.length;i+=1){const{name:s,required:a,spread:u}=t[i],c=Nl(s);if(c in e)throw new Error(`Invalid parameter: ${Q(s)} is used more than once.`);const l=u?n.slice(i):n[i];if(u&&(i=t.length),a&&(!l||u&&l.length===0))return console.error(`Error: Missing required parameter ${Q(s)}
|
|
22
|
+
`),r(),process.exit(1);e[c]=l}}o(bn,"S"),T(bn,"mapParametersToArguments");function bi(e){return e!==!1}o(bi,"se"),T(bi,"helpEnabled");const Vl=T(e=>{const t=[];for(const[n,r]of Object.entries(e))if(t.push(n),r&&typeof r=="object"&&"alias"in r){const{alias:i}=r;typeof i=="string"&&i?t.push(i):Array.isArray(i)&&t.push(...i.filter(Boolean))}return t},"getKnownFlagNames"),Hl=T((e,t)=>{if(e.length<3||t.length===0)return;const n=Ll(e,t);return ci(e,n)<=2?n:void 0},"findClosestFlag"),Kl=T((e,t)=>{const n=Object.keys(e);if(n.length!==0){for(const r of n){const i=Hl(r,t),s=i?` (Did you mean --${i}?)`:"";console.error(`Error: Unknown flag: --${r}.${s}`)}process.exit(1)}},"handleUnknownFlags");function Cn(e,t,n,r){const i={...t.flags},s=t.version&&!("version"in i);s&&(i.version={type:Boolean,description:"Show version"});const{help:a}=t,u=bi(a);u&&!("help"in i)&&(i.help={type:Boolean,alias:"h",description:"Show help"});const c=cl(i,r,{ignore:t.ignoreArgv,booleanNegation:t.booleanFlagNegation??t.parent?.booleanFlagNegation}),l=T(()=>{console.log(t.version)},"showVersion");if(s&&c.flags.version===!0)return l(),process.exit(0);const d=new Gl,f=u&&a?.render?a.render:m=>d.render(m),h=T(m=>{const g=jl({...t,...m?{help:m}:{},flags:i});console.log(f(g,d))},"showHelp");if(u&&c.flags.help===!0)return h(),process.exit(0);if((t.strictFlags??t.parent?.strictFlags)&&Kl(c.unknownFlags,Vl(i)),t.parameters){let{parameters:m}=t,g=c._;const F=m.indexOf("--"),w=m.slice(F+1),E=Object.create(null);let y=[];F>-1&&w.length>0&&(m=m.slice(0,F),y=c._["--"],g=g.slice(0,-y.length||void 0)),bn(E,En(m),g,h),F>-1&&w.length>0&&bn(E,En(w),y,h),Object.assign(c._,E)}const D={...c,showVersion:l,showHelp:h},p={command:e,...D};if(typeof n=="function"){const m=n(D);if(m&&"then"in m)return Object.assign(Promise.resolve(m),p)}return p}o(Cn,"I$1"),T(Cn,"cliBase");function Ci(e,t){const n=new Map;for(const r of t){const i=[r.options.name],{alias:s}=r.options;s&&(Array.isArray(s)?i.push(...s):i.push(s));for(const a of i){if(n.has(a))throw new Error(`Duplicate command name found: ${Q(a)}`);n.set(a,r)}}return n.get(e)}o(Ci,"ce"),T(Ci,"getCommand");function Si(e,t,n=process.argv.slice(2)){if(!e)throw new Error("Options is required");if("name"in e&&(!e.name||e.name!==e.name.trim()))throw new Error(`Invalid script name: ${Q(e.name)}`);const r=n[0];if(e.commands&&r&&Ei(r)){const i=Ci(r,e.commands);if(i)return Cn(i.options.name,{...i.options,parent:e},i.callback,n.slice(1))}return Cn(void 0,e,t,n)}o(Si,"fe"),T(Si,"cli");function Sn(e,t){if(!e)throw new Error("Command options are required");const{name:n}=e;if(n===void 0)throw new Error("Command name is required");if(!Ei(n))throw new Error(`Invalid command name ${JSON.stringify(n)}. Command names must be one word.`);return{options:e,callback:t}}o(Sn,"de"),T(Sn,"command");var ql="2.87.0",Yl="Writes your git commit messages for you with AI",vn={version:ql,description:Yl};function Y(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}o(Y,"isPlainObject");const An=o((e,t)=>{const n=Ai(Zl(e));if(typeof n!="string")throw new TypeError(`${t} must be a string or a file URL: ${n}.`);return n},"safeNormalizeFileUrl"),Zl=o(e=>vi(e)?e.toString():e,"normalizeDenoExecPath"),vi=o(e=>typeof e!="string"&&e&&Object.getPrototypeOf(e)===String.prototype,"isDenoExecPath"),Ai=o(e=>e instanceof URL?bo(e):e,"normalizeFileUrl"),$i=o((e,t=[],n={})=>{const r=An(e,"First argument"),[i,s]=Y(t)?[[],t]:[t,n];if(!Array.isArray(i))throw new TypeError(`Second argument must be either an array of arguments or an options object: ${i}`);if(i.some(c=>typeof c=="object"&&c!==null))throw new TypeError(`Second argument must be an array of strings: ${i}`);const a=i.map(String),u=a.find(c=>c.includes("\0"));if(u!==void 0)throw new TypeError(`Arguments cannot contain null bytes ("\\0"): ${u}`);if(!Y(s))throw new TypeError(`Last argument must be an options object: ${s}`);return[r,a,s]},"normalizeParameters"),{toString:Bi}=Object.prototype,Jl=o(e=>Bi.call(e)==="[object ArrayBuffer]","isArrayBuffer"),J=o(e=>Bi.call(e)==="[object Uint8Array]","isUint8Array"),Ye=o(e=>new Uint8Array(e.buffer,e.byteOffset,e.byteLength),"bufferToUint8Array"),Xl=new TextEncoder,Ti=o(e=>Xl.encode(e),"stringToUint8Array"),Ql=new TextDecoder,Ii=o(e=>Ql.decode(e),"uint8ArrayToString"),ed=o((e,t)=>td(e,t).join(""),"joinToString"),td=o((e,t)=>{if(t==="utf8"&&e.every(s=>typeof s=="string"))return e;const n=new So(t),r=e.map(s=>typeof s=="string"?Ti(s):s).map(s=>n.write(s)),i=n.end();return i===""?r:[...r,i]},"uint8ArraysToStrings"),$n=o(e=>e.length===1&&J(e[0])?e[0]:Oi(nd(e)),"joinToUint8Array"),nd=o(e=>e.map(t=>typeof t=="string"?Ti(t):t),"stringsToUint8Arrays"),Oi=o(e=>{const t=new Uint8Array(rd(e));let n=0;for(const r of e)t.set(r,n),n+=r.length;return t},"concatUint8Arrays"),rd=o(e=>{let t=0;for(const n of e)t+=n.length;return t},"getJoinLength"),od=o(e=>Array.isArray(e)&&Array.isArray(e.raw),"isTemplateString"),id=o((e,t)=>{let n=[];for(const[s,a]of e.entries())n=sd({templates:e,expressions:t,tokens:n,index:s,template:a});if(n.length===0)throw new TypeError("Template script must not be empty");const[r,...i]=n;return[r,i,{}]},"parseTemplates"),sd=o(({templates:e,expressions:t,tokens:n,index:r,template:i})=>{if(i===void 0)throw new TypeError(`Invalid backslash sequence: ${e.raw[r]}`);const{nextTokens:s,leadingWhitespaces:a,trailingWhitespaces:u}=ad(i,e.raw[r]),c=_i(n,s,a);if(r===t.length)return c;const l=t[r],d=Array.isArray(l)?l.map(f=>xi(f)):[xi(l)];return _i(c,d,u)},"parseTemplate"),ad=o((e,t)=>{if(t.length===0)return{nextTokens:[],leadingWhitespaces:!1,trailingWhitespaces:!1};const n=[];let r=0;const i=Ri.has(t[0]);for(let a=0,u=0;a<e.length;a+=1,u+=1){const c=t[u];if(Ri.has(c))r!==a&&n.push(e.slice(r,a)),r=a+1;else if(c==="\\"){const l=t[u+1];l===`
|
|
23
|
+
`?(a-=1,u+=1):l==="u"&&t[u+2]==="{"?u=t.indexOf("}",u+3):u+=ud[l]??1}}const s=r===e.length;return s||n.push(e.slice(r)),{nextTokens:n,leadingWhitespaces:i,trailingWhitespaces:s}},"splitByWhitespaces"),Ri=new Set([" "," ","\r",`
|
|
24
|
+
`]),ud={x:3,u:5},_i=o((e,t,n)=>n||e.length===0||t.length===0?[...e,...t]:[...e.slice(0,-1),`${e.at(-1)}${t[0]}`,...t.slice(1)],"concatTokens"),xi=o(e=>{const t=typeof e;if(t==="string")return e;if(t==="number")return String(e);if(Y(e)&&("stdout"in e||"isMaxBuffer"in e))return cd(e);throw e instanceof Co||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`)},"parseExpression"),cd=o(({stdout:e})=>{if(typeof e=="string")return e;if(J(e))return Ii(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`)},"getSubprocessResult"),Fe=o(e=>Bn.includes(e),"isStandardStream"),Bn=[O.stdin,O.stdout,O.stderr],ee=["stdin","stdout","stderr"],Mi=o(e=>ee[e]??`stdio[${e}]`,"getStreamName"),ld=o(e=>{const t={...e};for(const n of ki)t[n]=Pi(e,n);return t},"normalizeFdSpecificOptions"),Pi=o((e,t)=>{const n=Array.from({length:dd(e)+1}),r=fd(e[t],n,t);return gd(r,t)},"normalizeFdSpecificOption"),dd=o(({stdio:e})=>Array.isArray(e)?Math.max(e.length,ee.length):ee.length,"getStdioLength"),fd=o((e,t,n)=>Y(e)?hd(e,t,n):t.fill(e),"normalizeFdSpecificValue"),hd=o((e,t,n)=>{for(const r of Object.keys(e).sort(Dd))for(const i of pd(r,n,t))t[i]=e[r];return t},"normalizeOptionObject"),Dd=o((e,t)=>Li(e)<Li(t)?1:-1,"compareFdName"),Li=o(e=>e==="stdout"||e==="stderr"?0:e==="all"?2:1,"getFdNameOrder"),pd=o((e,t,n)=>{if(e==="ipc")return[n.length-1];const r=Ni(e);if(r===void 0||r===0)throw new TypeError(`"${t}.${e}" is invalid.
|
|
25
|
+
It must be "${t}.stdout", "${t}.stderr", "${t}.all", "${t}.ipc", or "${t}.fd3", "${t}.fd4" (and so on).`);if(r>=n.length)throw new TypeError(`"${t}.${e}" is invalid: that file descriptor does not exist.
|
|
26
|
+
Please set the "stdio" option to ensure that file descriptor exists.`);return r==="all"?[1,2]:[r]},"parseFdName"),Ni=o(e=>{if(e==="all")return e;if(ee.includes(e))return ee.indexOf(e);const t=md.exec(e);if(t!==null)return Number(t[1])},"parseFd"),md=/^fd(\d+)$/,gd=o((e,t)=>e.map(n=>n===void 0?wd[t]:n),"addDefaultValue$1"),Fd=Ic("execa").enabled?"full":"none",wd={lines:!1,buffer:!0,maxBuffer:1e3*1e3*100,verbose:Fd,stripFinalNewline:!0},ki=["lines","buffer","maxBuffer","verbose","stripFinalNewline"],Ze=o((e,t)=>t==="ipc"?e.at(-1):e[t],"getFdSpecificValue"),Tn=o(({verbose:e},t)=>On(e,t)!=="none","isVerbose"),In=o(({verbose:e},t)=>!["none","short"].includes(On(e,t)),"isFullVerbose"),yd=o(({verbose:e},t)=>{const n=On(e,t);return Rn(n)?n:void 0},"getVerboseFunction"),On=o((e,t)=>t===void 0?Ed(e):Ze(e,t),"getFdVerbose"),Ed=o(e=>e.find(t=>Rn(t))??_n.findLast(t=>e.includes(t)),"getFdGenericVerbose"),Rn=o(e=>typeof e=="function","isVerboseFunction"),_n=["none","short","full"],bd=o((e,t)=>{const n=[e,...t],r=n.join(" "),i=n.map(s=>Bd(Ui(s))).join(" ");return{command:r,escapedCommand:i}},"joinCommand"),xn=o(e=>Oc(e).split(`
|
|
27
|
+
`).map(t=>Ui(t)).join(`
|
|
28
|
+
`),"escapeLines"),Ui=o(e=>e.replaceAll(vd,t=>Cd(t)),"escapeControlCharacters"),Cd=o(e=>{const t=Ad[e];if(t!==void 0)return t;const n=e.codePointAt(0),r=n.toString(16);return n<=$d?`\\u${r.padStart(4,"0")}`:`\\U${r}`},"escapeControlCharacter"),Sd=o(()=>{try{return new RegExp("\\p{Separator}|\\p{Other}","gu")}catch{return/[\s\u0000-\u001F\u007F-\u009F\u00AD]/g}},"getSpecialCharRegExp"),vd=Sd(),Ad={" ":" ","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t"},$d=65535,Bd=o(e=>Td.test(e)?e:_c==="win32"?`"${e.replaceAll('"','""')}"`:`'${e.replaceAll("'","'\\''")}'`,"quoteString"),Td=/^[\w./-]+$/;function Id(){const{env:e}=O,{TERM:t,TERM_PROGRAM:n}=e;return O.platform!=="win32"?t!=="linux":!!e.WT_SESSION||!!e.TERMINUS_SUBLIME||e.ConEmuTask==="{cmd::Cmder}"||n==="Terminus-Sublime"||n==="vscode"||t==="xterm-256color"||t==="alacritty"||t==="rxvt-unicode"||t==="rxvt-unicode-256color"||e.TERMINAL_EMULATOR==="JetBrains-JediTerm"}o(Id,"isUnicodeSupported$1");const ji={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"},Od={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"},Rd={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"},_d={...ji,...Od},xd={...ji,...Rd},Md=Id(),Mn=Md?_d:xd,Pd=To?.WriteStream?.prototype?.hasColors?.()??!1,Ct=o((e,t)=>{if(!Pd)return i=>i;const n=`\x1B[${e}m`,r=`\x1B[${t}m`;return i=>{const s=i+"";let a=s.indexOf(r);if(a===-1)return n+s+r;let u=n,c=0;const d=(t===22?r:"")+n;for(;a!==-1;)u+=s.slice(c,a)+d,c=a+r.length,a=s.indexOf(r,c);return u+=s.slice(c)+r,u}},"format"),Ld=Ct(1,22),Pn=Ct(90,39),Nd=Ct(91,39),kd=Ct(93,39),Ud=o(({type:e,message:t,timestamp:n,piped:r,commandId:i,result:{failed:s=!1}={},options:{reject:a=!0}})=>{const u=jd(n),c=Wd[e]({failed:s,reject:a,piped:r}),l=Gd[e]({reject:a});return`${Pn(`[${u}]`)} ${Pn(`[${i}]`)} ${l(c)} ${l(t)}`},"defaultVerboseFunction"),jd=o(e=>`${St(e.getHours(),2)}:${St(e.getMinutes(),2)}:${St(e.getSeconds(),2)}.${St(e.getMilliseconds(),3)}`,"serializeTimestamp"),St=o((e,t)=>String(e).padStart(t,"0"),"padField"),Wi=o(({failed:e,reject:t})=>e?t?Mn.cross:Mn.warning:Mn.tick,"getFinalIcon"),Wd={command:o(({piped:e})=>e?"|":"$","command"),output:o(()=>" ","output"),ipc:o(()=>"*","ipc"),error:Wi,duration:Wi},Gi=o(e=>e,"identity$1"),Gd={command:o(()=>Ld,"command"),output:o(()=>Gi,"output"),ipc:o(()=>Gi,"ipc"),error:o(({reject:e})=>e?Nd:kd,"error"),duration:o(()=>Pn,"duration")},zd=o((e,t,n)=>{const r=yd(t,n);return e.map(({verboseLine:i,verboseObject:s})=>Vd(i,s,r)).filter(i=>i!==void 0).map(i=>Hd(i)).join("")},"applyVerboseOnLines"),Vd=o((e,t,n)=>{if(n===void 0)return e;const r=n(e,t);if(typeof r=="string")return r},"applyVerboseFunction"),Hd=o(e=>e.endsWith(`
|
|
29
|
+
`)?e:`${e}
|
|
30
|
+
`,"appendNewline"),Je=o(({type:e,verboseMessage:t,fdNumber:n,verboseInfo:r,result:i})=>{const s=Kd({type:e,result:i,verboseInfo:r}),a=qd(t,s),u=zd(a,r,n);u!==""&&console.warn(u.slice(0,-1))},"verboseLog"),Kd=o(({type:e,result:t,verboseInfo:{escapedCommand:n,commandId:r,rawOptions:{piped:i=!1,...s}}})=>({type:e,escapedCommand:n,commandId:`${r}`,timestamp:new Date,piped:i,result:t,options:s}),"getVerboseObject"),qd=o((e,t)=>e.split(`
|
|
31
|
+
`).map(n=>Yd({...t,message:n})),"getPrintedLines"),Yd=o(e=>({verboseLine:Ud(e),verboseObject:e}),"getPrintedLine"),zi=o(e=>{const t=typeof e=="string"?e:vo(e);return xn(t).replaceAll(" "," ".repeat(Zd))},"serializeVerboseMessage"),Zd=2,Jd=o((e,t)=>{Tn(t)&&Je({type:"command",verboseMessage:e,verboseInfo:t})},"logCommand"),Xd=o((e,t,n)=>{tf(e);const r=Qd(e);return{verbose:e,escapedCommand:t,commandId:r,rawOptions:n}},"getVerboseInfo"),Qd=o(e=>Tn({verbose:e})?ef++:void 0,"getCommandId");let ef=0n;const tf=o(e=>{for(const 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(!_n.includes(t)&&!Rn(t)){const n=_n.map(r=>`'${r}'`).join(", ");throw new TypeError(`The "verbose" option must not be ${t}. Allowed values are: ${n} or a function.`)}}},"validateVerbose"),Vi=o(()=>$o.bigint(),"getStartTime"),Hi=o(e=>Number($o.bigint()-e)/1e6,"getDurationMs"),Ki=o((e,t,n)=>{const r=Vi(),{command:i,escapedCommand:s}=bd(e,t),a=Pi(n,"verbose"),u=Xd(a,s,{...n});return Jd(s,u),{command:i,escapedCommand:s,startTime:r,verboseInfo:u}},"handleCommand");var nf=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function qi(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}o(qi,"getDefaultExportFromCjs");var we={exports:{}},Ln,Yi;function rf(){if(Yi)return Ln;Yi=1,Ln=r,r.sync=i;var e=ln;function t(s,a){var u=a.pathExt!==void 0?a.pathExt:process.env.PATHEXT;if(!u||(u=u.split(";"),u.indexOf("")!==-1))return!0;for(var c=0;c<u.length;c++){var l=u[c].toLowerCase();if(l&&s.substr(-l.length).toLowerCase()===l)return!0}return!1}o(t,"checkPathExt");function n(s,a,u){return!s.isSymbolicLink()&&!s.isFile()?!1:t(a,u)}o(n,"checkStat");function r(s,a,u){e.stat(s,function(c,l){u(c,c?!1:n(l,s,a))})}o(r,"isexe");function i(s,a){return n(e.statSync(s),s,a)}return o(i,"sync"),Ln}o(rf,"requireWindows");var Nn,Zi;function of(){if(Zi)return Nn;Zi=1,Nn=t,t.sync=n;var e=ln;function t(s,a,u){e.stat(s,function(c,l){u(c,c?!1:r(l,a))})}o(t,"isexe");function n(s,a){return r(e.statSync(s),a)}o(n,"sync");function r(s,a){return s.isFile()&&i(s,a)}o(r,"checkStat");function i(s,a){var u=s.mode,c=s.uid,l=s.gid,d=a.uid!==void 0?a.uid:process.getuid&&process.getuid(),f=a.gid!==void 0?a.gid:process.getgid&&process.getgid(),h=parseInt("100",8),D=parseInt("010",8),p=parseInt("001",8),m=h|D,g=u&p||u&D&&l===f||u&h&&c===d||u&m&&d===0;return g}return o(i,"checkMode"),Nn}o(of,"requireMode");var kn,Ji;function sf(){if(Ji)return kn;Ji=1;var e;process.platform==="win32"||nf.TESTING_WINDOWS?e=rf():e=of(),kn=t,t.sync=n;function t(r,i,s){if(typeof i=="function"&&(s=i,i={}),!s){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(a,u){t(r,i||{},function(c,l){c?u(c):a(l)})})}e(r,i||{},function(a,u){a&&(a.code==="EACCES"||i&&i.ignoreErrors)&&(a=null,u=!1),s(a,u)})}o(t,"isexe");function n(r,i){try{return e.sync(r,i||{})}catch(s){if(i&&i.ignoreErrors||s.code==="EACCES")return!1;throw s}}return o(n,"sync"),kn}o(sf,"requireIsexe");var Un,Xi;function af(){if(Xi)return Un;Xi=1;const e=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",t=ce,n=e?";":":",r=sf(),i=o(c=>Object.assign(new Error(`not found: ${c}`),{code:"ENOENT"}),"getNotFoundError"),s=o((c,l)=>{const d=l.colon||n,f=c.match(/\//)||e&&c.match(/\\/)?[""]:[...e?[process.cwd()]:[],...(l.path||process.env.PATH||"").split(d)],h=e?l.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",D=e?h.split(d):[""];return e&&c.indexOf(".")!==-1&&D[0]!==""&&D.unshift(""),{pathEnv:f,pathExt:D,pathExtExe:h}},"getPathInfo"),a=o((c,l,d)=>{typeof l=="function"&&(d=l,l={}),l||(l={});const{pathEnv:f,pathExt:h,pathExtExe:D}=s(c,l),p=[],m=o(F=>new Promise((w,E)=>{if(F===f.length)return l.all&&p.length?w(p):E(i(c));const y=f[F],b=/^".*"$/.test(y)?y.slice(1,-1):y,S=t.join(b,c),$=!b&&/^\.[\\\/]/.test(c)?c.slice(0,2)+S:S;w(g($,F,0))}),"step"),g=o((F,w,E)=>new Promise((y,b)=>{if(E===h.length)return y(m(w+1));const S=h[E];r(F+S,{pathExt:D},($,B)=>{if(!$&&B)if(l.all)p.push(F+S);else return y(F+S);return y(g(F,w,E+1))})}),"subStep");return d?m(0).then(F=>d(null,F),d):m(0)},"which"),u=o((c,l)=>{l=l||{};const{pathEnv:d,pathExt:f,pathExtExe:h}=s(c,l),D=[];for(let p=0;p<d.length;p++){const m=d[p],g=/^".*"$/.test(m)?m.slice(1,-1):m,F=t.join(g,c),w=!g&&/^\.[\\\/]/.test(c)?c.slice(0,2)+F:F;for(let E=0;E<f.length;E++){const y=w+f[E];try{if(r.sync(y,{pathExt:h}))if(l.all)D.push(y);else return y}catch{}}}if(l.all&&D.length)return D;if(l.nothrow)return null;throw i(c)},"whichSync");return Un=a,a.sync=u,Un}o(af,"requireWhich");var vt={exports:{}},Qi;function uf(){if(Qi)return vt.exports;Qi=1;const e=o((t={})=>{const n=t.env||process.env;return(t.platform||process.platform)!=="win32"?"PATH":Object.keys(n).reverse().find(i=>i.toUpperCase()==="PATH")||"Path"},"pathKey");return vt.exports=e,vt.exports.default=e,vt.exports}o(uf,"requirePathKey");var jn,es;function cf(){if(es)return jn;es=1;const e=ce,t=af(),n=uf();function r(s,a){const u=s.options.env||process.env,c=process.cwd(),l=s.options.cwd!=null,d=l&&process.chdir!==void 0&&!process.chdir.disabled;if(d)try{process.chdir(s.options.cwd)}catch{}let f;try{f=t.sync(s.command,{path:u[n({env:u})],pathExt:a?e.delimiter:void 0})}catch{}finally{d&&process.chdir(c)}return f&&(f=e.resolve(l?s.options.cwd:"",f)),f}o(r,"resolveCommandAttempt");function i(s){return r(s)||r(s,!0)}return o(i,"resolveCommand"),jn=i,jn}o(cf,"requireResolveCommand");var At={},ts;function lf(){if(ts)return At;ts=1;const e=/([()\][%!^"`<>&|;, *?])/g;function t(r){return r=r.replace(e,"^$1"),r}o(t,"escapeCommand");function n(r,i){return r=`${r}`,r=r.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),r=r.replace(/(?=(\\+?)?)\1$/,"$1$1"),r=`"${r}"`,r=r.replace(e,"^$1"),i&&(r=r.replace(e,"^$1")),r}return o(n,"escapeArgument"),At.command=t,At.argument=n,At}o(lf,"require_escape");var Wn,ns;function df(){return ns||(ns=1,Wn=/^#!(.*)/),Wn}o(df,"requireShebangRegex");var Gn,rs;function ff(){if(rs)return Gn;rs=1;const e=df();return Gn=o((t="")=>{const n=t.match(e);if(!n)return null;const[r,i]=n[0].replace(/#! ?/,"").split(" "),s=r.split("/").pop();return s==="env"?i:i?`${s} ${i}`:s},"shebangCommand"),Gn}o(ff,"requireShebangCommand");var zn,os;function hf(){if(os)return zn;os=1;const e=ln,t=ff();function n(r){const s=Buffer.alloc(150);let a;try{a=e.openSync(r,"r"),e.readSync(a,s,0,150,0),e.closeSync(a)}catch{}return t(s.toString())}return o(n,"readShebang"),zn=n,zn}o(hf,"requireReadShebang");var Vn,is;function Df(){if(is)return Vn;is=1;const e=ce,t=cf(),n=lf(),r=hf(),i=process.platform==="win32",s=/\.(?:com|exe)$/i,a=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function u(d){d.file=t(d);const f=d.file&&r(d.file);return f?(d.args.unshift(d.file),d.command=f,t(d)):d.file}o(u,"detectShebang");function c(d){if(!i)return d;const f=u(d),h=!s.test(f);if(d.options.forceShell||h){const D=a.test(f);d.command=e.normalize(d.command),d.command=n.command(d.command),d.args=d.args.map(m=>n.argument(m,D));const p=[d.command].concat(d.args).join(" ");d.args=["/d","/s","/c",`"${p}"`],d.command=process.env.comspec||"cmd.exe",d.options.windowsVerbatimArguments=!0}return d}o(c,"parseNonShell");function l(d,f,h){f&&!Array.isArray(f)&&(h=f,f=null),f=f?f.slice(0):[],h=Object.assign({},h);const D={command:d,args:f,options:h,file:void 0,original:{command:d,args:f}};return h.shell?D:c(D)}return o(l,"parse"),Vn=l,Vn}o(Df,"requireParse");var Hn,ss;function pf(){if(ss)return Hn;ss=1;const e=process.platform==="win32";function t(s,a){return Object.assign(new Error(`${a} ${s.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${a} ${s.command}`,path:s.command,spawnargs:s.args})}o(t,"notFoundError");function n(s,a){if(!e)return;const u=s.emit;s.emit=function(c,l){if(c==="exit"){const d=r(l,a);if(d)return u.call(s,"error",d)}return u.apply(s,arguments)}}o(n,"hookChildProcess");function r(s,a){return e&&s===1&&!a.file?t(a.original,"spawn"):null}o(r,"verifyENOENT");function i(s,a){return e&&s===1&&!a.file?t(a.original,"spawnSync"):null}return o(i,"verifyENOENTSync"),Hn={hookChildProcess:n,verifyENOENT:r,verifyENOENTSync:i,notFoundError:t},Hn}o(pf,"requireEnoent");var as;function mf(){if(as)return we.exports;as=1;const e=Pc,t=Df(),n=pf();function r(s,a,u){const c=t(s,a,u),l=e.spawn(c.command,c.args,c.options);return n.hookChildProcess(l,c),l}o(r,"spawn");function i(s,a,u){const c=t(s,a,u),l=e.spawnSync(c.command,c.args,c.options);return l.error=l.error||n.verifyENOENTSync(l.status,c),l}return o(i,"spawnSync"),we.exports=r,we.exports.spawn=r,we.exports.sync=i,we.exports._parse=t,we.exports._enoent=n,we.exports}o(mf,"requireCrossSpawn");var gf=mf(),Ff=qi(gf);function us(e={}){const{env:t=process.env,platform:n=process.platform}=e;return n!=="win32"?"PATH":Object.keys(t).reverse().find(r=>r.toUpperCase()==="PATH")||"Path"}o(us,"pathKey"),Ao($c);function Kn(e){return e instanceof URL?bo(e):e}o(Kn,"toPath");function wf(e){return{*[Symbol.iterator](){let t=K.resolve(Kn(e)),n;for(;n!==t;)yield t,n=t,t=K.resolve(t,"..")}}}o(wf,"traversePathUp");const yf=o(({cwd:e=O.cwd(),path:t=O.env[us()],preferLocal:n=!0,execPath:r=O.execPath,addExecPath:i=!0}={})=>{const s=K.resolve(Kn(e)),a=[],u=t.split(K.delimiter);return n&&Ef(a,u,s),i&&bf(a,u,r,s),t===""||t===K.delimiter?`${a.join(K.delimiter)}${t}`:[...a,t].join(K.delimiter)},"npmRunPath"),Ef=o((e,t,n)=>{for(const r of wf(n)){const i=K.join(r,"node_modules/.bin");t.includes(i)||e.push(i)}},"applyPreferLocal"),bf=o((e,t,n,r)=>{const i=K.resolve(r,Kn(n),"..");t.includes(i)||e.push(i)},"applyExecPath"),Cf=o(({env:e=O.env,...t}={})=>{e={...e};const n=us({env:e});return t.path=e[n],e[n]=yf(t),e},"npmRunPathEnv"),Sf=o((e,t,n)=>{const r=n?Qe:Xe,i=e instanceof ye?{}:{cause:e};return new r(t,i)},"getFinalError"),co=class co extends Error{};o(co,"DiscardedError");let ye=co;const cs=o((e,t)=>{Object.defineProperty(e.prototype,"name",{value:t,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,ls,{value:!0,writable:!1,enumerable:!1,configurable:!1})},"setErrorName"),vf=o(e=>qn(e)&&ls in e,"isExecaError"),ls=Symbol("isExecaError"),qn=o(e=>Object.prototype.toString.call(e)==="[object Error]","isErrorInstance"),lo=class lo extends Error{};o(lo,"ExecaError");let Xe=lo;cs(Xe,Xe.name);const fo=class fo extends Error{};o(fo,"ExecaSyncError");let Qe=fo;cs(Qe,Qe.name);const Af=o(()=>{const e=fs-ds+1;return Array.from({length:e},$f)},"getRealtimeSignals"),$f=o((e,t)=>({name:`SIGRT${t+1}`,number:ds+t,action:"terminate",description:"Application-specific signal (realtime)",standard:"posix"}),"getRealtimeSignal"),ds=34,fs=64,Bf=[{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"}],hs=o(()=>{const e=Af();return[...Bf,...e].map(Tf)},"getSignals"),Tf=o(({name:e,number:t,description:n,action:r,forced:i=!1,standard:s})=>{const{signals:{[e]:a}}=me,u=a!==void 0;return{name:e,number:u?a:t,description:n,supported:u,action:r,forced:i,standard:s}},"normalizeSignal$1"),If=o(()=>{const e=hs();return Object.fromEntries(e.map(Of))},"getSignalsByName"),Of=o(({name:e,number:t,description:n,supported:r,action:i,forced:s,standard:a})=>[e,{name:e,number:t,description:n,supported:r,action:i,forced:s,standard:a}],"getSignalByName"),Rf=If(),_f=o(()=>{const e=hs(),t=fs+1,n=Array.from({length:t},(r,i)=>xf(i,e));return Object.assign({},...n)},"getSignalsByNumber"),xf=o((e,t)=>{const n=Mf(e,t);if(n===void 0)return{};const{name:r,description:i,supported:s,action:a,forced:u,standard:c}=n;return{[e]:{name:r,number:e,description:i,supported:s,action:a,forced:u,standard:c}}},"getSignalByNumber"),Mf=o((e,t)=>{const n=t.find(({name:r})=>me.signals[r]===e);return n!==void 0?n:t.find(r=>r.number===e)},"findSignalByNumber");_f();const Pf=o(e=>{const t="option `killSignal`";if(e===0)throw new TypeError(`Invalid ${t}: 0 cannot be used.`);return Ds(e,t)},"normalizeKillSignal"),Lf=o(e=>e===0?e:Ds(e,"`subprocess.kill()`'s argument"),"normalizeSignalArgument"),Ds=o((e,t)=>{if(Number.isInteger(e))return Nf(e,t);if(typeof e=="string")return Uf(e,t);throw new TypeError(`Invalid ${t} ${String(e)}: it must be a string or an integer.
|
|
32
|
+
${Yn()}`)},"normalizeSignal"),Nf=o((e,t)=>{if(ps.has(e))return ps.get(e);throw new TypeError(`Invalid ${t} ${e}: this signal integer does not exist.
|
|
33
|
+
${Yn()}`)},"normalizeSignalInteger"),kf=o(()=>new Map(Object.entries(me.signals).reverse().map(([e,t])=>[t,e])),"getSignalsIntegerToName"),ps=kf(),Uf=o((e,t)=>{if(e in me.signals)return e;throw e.toUpperCase()in me.signals?new TypeError(`Invalid ${t} '${e}': please rename it to '${e.toUpperCase()}'.`):new TypeError(`Invalid ${t} '${e}': this signal name does not exist.
|
|
34
|
+
${Yn()}`)},"normalizeSignalName"),Yn=o(()=>`Available signal names: ${jf()}.
|
|
35
|
+
Available signal numbers: ${Wf()}.`,"getAvailableSignals"),jf=o(()=>Object.keys(me.signals).sort().map(e=>`'${e}'`).join(", "),"getAvailableSignalNames"),Wf=o(()=>[...new Set(Object.values(me.signals).sort((e,t)=>e-t))].join(", "),"getAvailableSignalIntegers"),ms=o(e=>Rf[e].description,"getSignalDescription"),Gf=o(e=>{if(e===!1)return e;if(e===!0)return zf;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},"normalizeForceKillAfterDelay"),zf=1e3*5,Vf=o(({kill:e,options:{forceKillAfterDelay:t,killSignal:n},onInternalError:r,context:i,controller:s},a,u)=>{const{signal:c,error:l}=Hf(a,u,n);Kf(l,r);const d=e(c);return qf({kill:e,signal:c,forceKillAfterDelay:t,killSignal:n,killResult:d,context:i,controller:s}),d},"subprocessKill"),Hf=o((e,t,n)=>{const[r=n,i]=qn(e)?[void 0,e]:[e,t];if(typeof r!="string"&&!Number.isInteger(r))throw new TypeError(`The first argument must be an error instance or a signal name string/integer: ${String(r)}`);if(i!==void 0&&!qn(i))throw new TypeError(`The second argument is optional. If specified, it must be an error instance: ${i}`);return{signal:Lf(r),error:i}},"parseKillArguments"),Kf=o((e,t)=>{e!==void 0&&t.reject(e)},"emitKillError"),qf=o(async({kill:e,signal:t,forceKillAfterDelay:n,killSignal:r,killResult:i,context:s,controller:a})=>{t===r&&i&&gs({kill:e,forceKillAfterDelay:n,context:s,controllerSignal:a.signal})},"setKillTimeout"),gs=o(async({kill:e,forceKillAfterDelay:t,context:n,controllerSignal:r})=>{if(t!==!1)try{await Oo(t,void 0,{signal:r}),e("SIGKILL")&&(n.isForcefullyTerminated??(n.isForcefullyTerminated=!0))}catch{}},"killOnTimeout"),Fs=o(async(e,t)=>{e.aborted||await z(e,"abort",{signal:t})},"onAbortedSignal"),Yf=o(({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)}`)},"validateCancelSignal"),Zf=o(({subprocess:e,cancelSignal:t,gracefulCancel:n,context:r,controller:i})=>t===void 0||n?[]:[Jf(e,t,r,i)],"throwOnCancel"),Jf=o(async(e,t,n,{signal:r})=>{throw await Fs(t,r),n.terminationReason??(n.terminationReason="cancel"),e.kill(),t.reason},"terminateOnCancel"),Zn=o(({methodName:e,isSubprocess:t,ipc:n,isConnected:r})=>{Xf(e,t,n),ws(e,t,r)},"validateIpcMethod"),Xf=o((e,t,n)=>{if(!n)throw new Error(`${X(e,t)} can only be used if the \`ipc\` option is \`true\`.`)},"validateIpcOption"),ws=o((e,t,n)=>{if(!n)throw new Error(`${X(e,t)} cannot be used: the ${fe(t)} has already exited or disconnected.`)},"validateConnection"),Qf=o(e=>{throw new Error(`${X("getOneMessage",e)} could not complete: the ${fe(e)} exited or disconnected.`)},"throwOnEarlyDisconnect"),eh=o(e=>{throw new Error(`${X("sendMessage",e)} failed: the ${fe(e)} is sending a message too, instead of listening to incoming messages.
|
|
36
|
+
This can be fixed by both sending a message and listening to incoming messages at the same time:
|
|
37
|
+
|
|
38
|
+
const [receivedMessage] = await Promise.all([
|
|
39
|
+
${X("getOneMessage",e)},
|
|
40
|
+
${X("sendMessage",e,"message, {strict: true}")},
|
|
41
|
+
]);`)},"throwOnStrictDeadlockError"),ys=o((e,t)=>new Error(`${X("sendMessage",t)} failed when sending an acknowledgment response to the ${fe(t)}.`,{cause:e}),"getStrictResponseError"),th=o(e=>{throw new Error(`${X("sendMessage",e)} failed: the ${fe(e)} is not listening to incoming messages.`)},"throwOnMissingStrict"),nh=o(e=>{throw new Error(`${X("sendMessage",e)} failed: the ${fe(e)} exited without listening to incoming messages.`)},"throwOnStrictDisconnect"),rh=o(()=>new Error(`\`cancelSignal\` aborted: the ${fe(!0)} disconnected.`),"getAbortDisconnectError"),oh=o(()=>{throw new Error("`getCancelSignal()` cannot be used without setting the `cancelSignal` subprocess option.")},"throwOnMissingParent"),ih=o(({error:e,methodName:t,isSubprocess:n})=>{if(e.code==="EPIPE")throw new Error(`${X(t,n)} cannot be used: the ${fe(n)} is disconnecting.`,{cause:e})},"handleEpipeError"),sh=o(({error:e,methodName:t,isSubprocess:n,message:r})=>{if(ah(e))throw new Error(`${X(t,n)}'s argument type is invalid: the message cannot be serialized: ${String(r)}.`,{cause:e})},"handleSerializationError"),ah=o(({code:e,message:t})=>uh.has(e)||ch.some(n=>t.includes(n)),"isSerializationError"),uh=new Set(["ERR_MISSING_ARGS","ERR_INVALID_ARG_TYPE"]),ch=["could not be cloned","circular structure","call stack size exceeded"],X=o((e,t,n="")=>e==="cancelSignal"?"`cancelSignal`'s `controller.abort()`":`${lh(t)}${e}(${n})`,"getMethodName"),lh=o(e=>e?"":"subprocess.","getNamespaceName"),fe=o(e=>e?"parent process":"subprocess","getOtherProcessName"),Jn=o(e=>{e.connected&&e.disconnect()},"disconnect"),et=o(()=>{const e={},t=new Promise((n,r)=>{Object.assign(e,{resolve:n,reject:r})});return Object.assign(t,e)},"createDeferred"),Es=o((e,t="stdin")=>{const{options:r,fileDescriptors:i}=Ee.get(e),s=bs(i,t,!0),a=e.stdio[s];if(a===null)throw new TypeError(Cs(s,t,r,!0));return a},"getToStream"),Xn=o((e,t="stdout")=>{const{options:r,fileDescriptors:i}=Ee.get(e),s=bs(i,t,!1),a=s==="all"?e.all:e.stdio[s];if(a==null)throw new TypeError(Cs(s,t,r,!1));return a},"getFromStream"),Ee=new WeakMap,bs=o((e,t,n)=>{const r=dh(t,n);return fh(r,t,n,e),r},"getFdNumber"),dh=o((e,t)=>{const n=Ni(e);if(n!==void 0)return n;const{validOptions:r,defaultValue:i}=t?{validOptions:'"stdin"',defaultValue:"stdin"}:{validOptions:'"stdout", "stderr", "all"',defaultValue:"stdout"};throw new TypeError(`"${tt(t)}" must not be "${e}".
|
|
42
|
+
It must be ${r} or "fd3", "fd4" (and so on).
|
|
43
|
+
It is optional and defaults to "${i}".`)},"parseFdNumber"),fh=o((e,t,n,r)=>{const i=r[Ss(e)];if(i===void 0)throw new TypeError(`"${tt(n)}" must not be ${t}. That file descriptor does not exist.
|
|
44
|
+
Please set the "stdio" option to ensure that file descriptor exists.`);if(i.direction==="input"&&!n)throw new TypeError(`"${tt(n)}" must not be ${t}. It must be a readable stream, not writable.`);if(i.direction!=="input"&&n)throw new TypeError(`"${tt(n)}" must not be ${t}. It must be a writable stream, not readable.`)},"validateFdNumber"),Cs=o((e,t,n,r)=>{if(e==="all"&&!n.all)return`The "all" option must be true to use "from: 'all'".`;const{optionName:i,optionValue:s}=hh(e,n);return`The "${i}: ${Qn(s)}" option is incompatible with using "${tt(r)}: ${Qn(t)}".
|
|
45
|
+
Please set this option with "pipe" instead.`},"getInvalidStdioOptionMessage"),hh=o((e,{stdin:t,stdout:n,stderr:r,stdio:i})=>{const s=Ss(e);return s===0&&t!==void 0?{optionName:"stdin",optionValue:t}:s===1&&n!==void 0?{optionName:"stdout",optionValue:n}:s===2&&r!==void 0?{optionName:"stderr",optionValue:r}:{optionName:`stdio[${s}]`,optionValue:i[s]}},"getInvalidStdioOption"),Ss=o(e=>e==="all"?1:e,"getUsedDescriptor"),tt=o(e=>e?"to":"from","getOptionName"),Qn=o(e=>typeof e=="string"?`'${e}'`:typeof e=="number"?`${e}`:"Stream","serializeOptionValue"),$t=o((e,t,n)=>{const r=e.getMaxListeners();r===0||r===Number.POSITIVE_INFINITY||(e.setMaxListeners(r+t),_o(n,()=>{e.setMaxListeners(e.getMaxListeners()-t)}))},"incrementMaxListeners"),vs=o((e,t)=>{t&&er(e)},"addReference"),er=o(e=>{e.refCounted()},"addReferenceCount"),As=o((e,t)=>{t&&tr(e)},"removeReference"),tr=o(e=>{e.unrefCounted()},"removeReferenceCount"),Dh=o((e,t)=>{t&&(tr(e),tr(e))},"undoAddedReferences"),ph=o((e,t)=>{t&&(er(e),er(e))},"redoAddedReferences"),mh=o(async({anyProcess:e,channel:t,isSubprocess:n,ipcEmitter:r},i)=>{if(Ch(i)||Mh(i))return;Bt.has(e)||Bt.set(e,[]);const s=Bt.get(e);if(s.push(i),!(s.length>1))for(;s.length>0;){await Bh(e,r,i),await Ro.yield();const a=await bh({wrappedMessage:s[0],anyProcess:e,channel:t,isSubprocess:n,ipcEmitter:r});s.shift(),r.emit("message",a),r.emit("message:done")}},"onMessage"),gh=o(async({anyProcess:e,channel:t,isSubprocess:n,ipcEmitter:r,boundOnMessage:i})=>{_s();const s=Bt.get(e);for(;s?.length>0;)await z(r,"message:done");e.removeListener("message",i),ph(t,n),r.connected=!1,r.emit("disconnect")},"onDisconnect"),Bt=new WeakMap,Tt=o((e,t,n)=>{if(It.has(e))return It.get(e);const r=new Nc;return r.connected=!0,It.set(e,r),Fh({ipcEmitter:r,anyProcess:e,channel:t,isSubprocess:n}),r},"getIpcEmitter"),It=new WeakMap,Fh=o(({ipcEmitter:e,anyProcess:t,channel:n,isSubprocess:r})=>{const i=mh.bind(void 0,{anyProcess:t,channel:n,isSubprocess:r,ipcEmitter:e});t.on("message",i),t.once("disconnect",gh.bind(void 0,{anyProcess:t,channel:n,isSubprocess:r,ipcEmitter:e,boundOnMessage:i})),Dh(n,r)},"forwardEvents"),$s=o(e=>{const t=It.get(e);return t===void 0?e.channel!==null:t.connected},"isConnected"),wh=o(({anyProcess:e,channel:t,isSubprocess:n,message:r,strict:i})=>{if(!i)return r;const s=Tt(e,t,n),a=nr(e,s);return{id:yh++,type:Rt,message:r,hasListeners:a}},"handleSendStrict");let yh=0n;const Eh=o((e,t)=>{if(!(t?.type!==Rt||t.hasListeners))for(const{id:n}of e)n!==void 0&&Ot[n].resolve({isDeadlock:!0,hasListeners:!1})},"validateStrictDeadlock"),bh=o(async({wrappedMessage:e,anyProcess:t,channel:n,isSubprocess:r,ipcEmitter:i})=>{if(e?.type!==Rt||!t.connected)return e;const{id:s,message:a}=e,u={id:s,type:Bs,message:nr(t,i)};try{await Ts({anyProcess:t,channel:n,isSubprocess:r,ipc:!0},u)}catch(c){i.emit("strict:error",c)}return a},"handleStrictRequest"),Ch=o(e=>{if(e?.type!==Bs)return!1;const{id:t,message:n}=e;return Ot[t]?.resolve({isDeadlock:!1,hasListeners:n}),!0},"handleStrictResponse"),Sh=o(async(e,t,n)=>{if(e?.type!==Rt)return;const r=et();Ot[e.id]=r;const i=new AbortController;try{const{isDeadlock:s,hasListeners:a}=await Promise.race([r,vh(t,n,i)]);s&&eh(n),a||th(n)}finally{i.abort(),delete Ot[e.id]}},"waitForStrictResponse"),Ot={},vh=o(async(e,t,{signal:n})=>{$t(e,1,n),await z(e,"disconnect",{signal:n}),nh(t)},"throwOnDisconnect$1"),Rt="execa:ipc:request",Bs="execa:ipc:response",Ah=o((e,t,n)=>{nt.has(e)||nt.set(e,new Set);const r=nt.get(e),i=et(),s=n?t.id:void 0,a={onMessageSent:i,id:s};return r.add(a),{outgoingMessages:r,outgoingMessage:a}},"startSendMessage"),$h=o(({outgoingMessages:e,outgoingMessage:t})=>{e.delete(t),t.onMessageSent.resolve()},"endSendMessage"),Bh=o(async(e,t,n)=>{for(;!nr(e,t)&&nt.get(e)?.size>0;){const r=[...nt.get(e)];Eh(r,n),await Promise.all(r.map(({onMessageSent:i})=>i))}},"waitForOutgoingMessages"),nt=new WeakMap,nr=o((e,t)=>t.listenerCount("message")>Th(e),"hasMessageListeners"),Th=o(e=>Ee.has(e)&&!Ze(Ee.get(e).options.buffer,"ipc")?1:0,"getMinListenerCount"),Ts=o(({anyProcess:e,channel:t,isSubprocess:n,ipc:r},i,{strict:s=!1}={})=>{const a="sendMessage";return Zn({methodName:a,isSubprocess:n,ipc:r,isConnected:e.connected}),Ih({anyProcess:e,channel:t,methodName:a,isSubprocess:n,message:i,strict:s})},"sendMessage"),Ih=o(async({anyProcess:e,channel:t,methodName:n,isSubprocess:r,message:i,strict:s})=>{const a=wh({anyProcess:e,channel:t,isSubprocess:r,message:i,strict:s}),u=Ah(e,a,s);try{await Is({anyProcess:e,methodName:n,isSubprocess:r,wrappedMessage:a,message:i})}catch(c){throw Jn(e),c}finally{$h(u)}},"sendMessageAsync"),Is=o(async({anyProcess:e,methodName:t,isSubprocess:n,wrappedMessage:r,message:i})=>{const s=Oh(e);try{await Promise.all([Sh(r,e,n),s(r)])}catch(a){throw ih({error:a,methodName:t,isSubprocess:n}),sh({error:a,methodName:t,isSubprocess:n,message:i}),a}},"sendOneMessage"),Oh=o(e=>{if(rr.has(e))return rr.get(e);const t=Ao(e.send.bind(e));return rr.set(e,t),t},"getSendMethod"),rr=new WeakMap,Rh=o((e,t)=>{const n="cancelSignal";return ws(n,!1,e.connected),Is({anyProcess:e,methodName:n,isSubprocess:!1,wrappedMessage:{type:Rs,message:t},message:t})},"sendAbort"),_h=o(async({anyProcess:e,channel:t,isSubprocess:n,ipc:r})=>(await xh({anyProcess:e,channel:t,isSubprocess:n,ipc:r}),or.signal),"getCancelSignal"),xh=o(async({anyProcess:e,channel:t,isSubprocess:n,ipc:r})=>{if(!Os){if(Os=!0,!r){oh();return}if(t===null){_s();return}Tt(e,t,n),await Ro.yield()}},"startIpc");let Os=!1;const Mh=o(e=>e?.type!==Rs?!1:(or.abort(e.message),!0),"handleAbort"),Rs="execa:ipc:cancel",_s=o(()=>{or.abort(rh())},"abortOnDisconnect"),or=new AbortController,Ph=o(({gracefulCancel:e,cancelSignal:t,ipc:n,serialization:r})=>{if(e){if(t===void 0)throw new Error("The `cancelSignal` option must be defined when setting the `gracefulCancel` option.");if(!n)throw new Error("The `ipc` option cannot be false when setting the `gracefulCancel` option.");if(r==="json")throw new Error("The `serialization` option cannot be 'json' when setting the `gracefulCancel` option.")}},"validateGracefulCancel"),Lh=o(({subprocess:e,cancelSignal:t,gracefulCancel:n,forceKillAfterDelay:r,context:i,controller:s})=>n?[Nh({subprocess:e,cancelSignal:t,forceKillAfterDelay:r,context:i,controller:s})]:[],"throwOnGracefulCancel"),Nh=o(async({subprocess:e,cancelSignal:t,forceKillAfterDelay:n,context:r,controller:{signal:i}})=>{await Fs(t,i);const s=kh(t);throw await Rh(e,s),gs({kill:e.kill,forceKillAfterDelay:n,context:r,controllerSignal:i}),r.terminationReason??(r.terminationReason="gracefulCancel"),t.reason},"sendOnAbort"),kh=o(({reason:e})=>{if(!(e instanceof DOMException))return e;const t=new Error(e.message);return Object.defineProperty(t,"stack",{value:e.stack,enumerable:!1,configurable:!0,writable:!0}),t},"getReason"),Uh=o(({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})`)},"validateTimeout"),jh=o((e,t,n,r)=>t===0||t===void 0?[]:[Wh(e,t,n,r)],"throwOnTimeout"),Wh=o(async(e,t,n,{signal:r})=>{throw await Oo(t,void 0,{signal:r}),n.terminationReason??(n.terminationReason="timeout"),e.kill(),new ye},"killAfterTimeout"),Gh=o(({options:e})=>{if(e.node===!1)throw new TypeError('The "node" option cannot be false with `execaNode()`.');return{options:{...e,node:!0}}},"mapNode"),zh=o((e,t,{node:n=!1,nodePath:r=xc,nodeOptions:i=Mc.filter(c=>!c.startsWith("--inspect")),cwd:s,execPath:a,...u})=>{if(a!==void 0)throw new TypeError('The "execPath" option has been removed. Please use the "nodePath" option instead.');const c=An(r,'The "nodePath" option'),l=K.resolve(s,c),d={...u,nodePath:l,node:n,cwd:s};if(!n)return[e,t,d];if(K.basename(e,".exe")==="node")throw new TypeError('When the "node" option is true, the first argument does not need to be "node".');return[l,[...i,e,...t],{ipc:!0,...d,shell:!1}]},"handleNodeOption"),Vh=o(({ipcInput:e,ipc:t,serialization:n})=>{if(e!==void 0){if(!t)throw new Error("The `ipcInput` option cannot be set unless the `ipc` option is `true`.");qh[n](e)}},"validateIpcInputOption"),Hh=o(e=>{try{Uc(e)}catch(t){throw new Error("The `ipcInput` option is not serializable with a structured clone.",{cause:t})}},"validateAdvancedInput"),Kh=o(e=>{try{JSON.stringify(e)}catch(t){throw new Error("The `ipcInput` option is not serializable with JSON.",{cause:t})}},"validateJsonInput"),qh={advanced:Hh,json:Kh},Yh=o(async(e,t)=>{t!==void 0&&await e.sendMessage(t)},"sendIpcInput"),Zh=o(({encoding:e})=>{if(ir.has(e))return;const t=Xh(e);if(t!==void 0)throw new TypeError(`Invalid option \`encoding: ${_t(e)}\`.
|
|
46
|
+
Please rename it to ${_t(t)}.`);const n=[...ir].map(r=>_t(r)).join(", ");throw new TypeError(`Invalid option \`encoding: ${_t(e)}\`.
|
|
47
|
+
Please rename it to one of: ${n}.`)},"validateEncoding"),Jh=new Set(["utf8","utf16le"]),be=new Set(["buffer","hex","base64","base64url","latin1","ascii"]),ir=new Set([...Jh,...be]),Xh=o(e=>{if(e===null)return"buffer";if(typeof e!="string")return;const t=e.toLowerCase();if(t in xs)return xs[t];if(ir.has(t))return t},"getCorrectEncoding"),xs={"utf-8":"utf8","utf-16le":"utf16le","ucs-2":"utf16le",ucs2:"utf16le",binary:"latin1"},_t=o(e=>typeof e=="string"?`"${e}"`:String(e),"serializeEncoding"),Qh=o((e=Ms())=>{const t=An(e,'The "cwd" option');return K.resolve(t)},"normalizeCwd"),Ms=o(()=>{try{return O.cwd()}catch(e){throw e.message=`The current directory does not exist.
|
|
48
|
+
${e.message}`,e}},"getDefaultCwd"),eD=o((e,t)=>{if(t===Ms())return e;let n;try{n=jc(t)}catch(r){return`The "cwd" option is invalid: ${t}.
|
|
49
|
+
${r.message}
|
|
50
|
+
${e}`}return n.isDirectory()?e:`The "cwd" option is not a directory: ${t}.
|
|
51
|
+
${e}`},"fixCwdError"),Ps=o((e,t,n)=>{n.cwd=Qh(n.cwd);const[r,i,s]=zh(e,t,n),{command:a,args:u,options:c}=Ff._parse(r,i,s),l=ld(c),d=tD(l);return Uh(d),Zh(d),Vh(d),Yf(d),Ph(d),d.shell=Ai(d.shell),d.env=nD(d),d.killSignal=Pf(d.killSignal),d.forceKillAfterDelay=Gf(d.forceKillAfterDelay),d.lines=d.lines.map((f,h)=>f&&!be.has(d.encoding)&&d.buffer[h]),O.platform==="win32"&&K.basename(a,".exe")==="cmd"&&u.unshift("/q"),{file:a,commandArguments:u,options:d}},"normalizeOptions"),tD=o(({extendEnv:e=!0,preferLocal:t=!1,cwd:n,localDir:r=n,encoding:i="utf8",reject:s=!0,cleanup:a=!0,all:u=!1,windowsHide:c=!0,killSignal:l="SIGTERM",forceKillAfterDelay:d=!0,gracefulCancel:f=!1,ipcInput:h,ipc:D=h!==void 0||f,serialization:p="advanced",...m})=>({...m,extendEnv:e,preferLocal:t,cwd:n,localDirectory:r,encoding:i,reject:s,cleanup:a,all:u,windowsHide:c,killSignal:l,forceKillAfterDelay:d,gracefulCancel:f,ipcInput:h,ipc:D,serialization:p}),"addDefaultOptions"),nD=o(({env:e,extendEnv:t,preferLocal:n,node:r,localDirectory:i,nodePath:s})=>{const a=t?{...O.env,...e}:e;return n||r?Cf({env:a,cwd:i,execPath:s,preferLocal:n,addExecPath:r}):a},"getEnv"),Ls=o((e,t,n)=>n.shell&&t.length>0?[[e,...t].join(" "),[],n]:[e,t,n],"concatenateShell");function sr(e){if(typeof e=="string")return rD(e);if(!(ArrayBuffer.isView(e)&&e.BYTES_PER_ELEMENT===1))throw new Error("Input must be a string or a Uint8Array");return oD(e)}o(sr,"stripFinalNewline");const rD=o(e=>e.at(-1)===Ns?e.slice(0,e.at(-2)===ks?-2:-1):e,"stripFinalNewlineString"),oD=o(e=>e.at(-1)===iD?e.subarray(0,e.at(-2)===sD?-2:-1):e,"stripFinalNewlineBinary"),Ns=`
|
|
52
|
+
`,iD=Ns.codePointAt(0),ks="\r",sD=ks.codePointAt(0);function Ce(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"}o(Ce,"isStream");function Us(e,{checkOpen:t=!0}={}){return Ce(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"}o(Us,"isWritableStream$1");function xt(e,{checkOpen:t=!0}={}){return Ce(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"}o(xt,"isReadableStream$1");function js(e,t){return Us(e,t)&&xt(e,t)}o(js,"isDuplexStream");var Ws=o(e=>{throw TypeError(e)},"__typeError$2"),ar=o((e,t,n)=>t.has(e)||Ws("Cannot "+n),"__accessCheck$2"),V=o((e,t,n)=>(ar(e,t,"read from private field"),n?n.call(e):t.get(e)),"__privateGet$2"),rt=o((e,t,n)=>t.has(e)?Ws("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),"__privateAdd$2"),he=o((e,t,n,r)=>(ar(e,t,"write to private field"),t.set(e,n),n),"__privateSet$2"),Gs=o((e,t,n)=>(ar(e,t,"access private method"),n),"__privateMethod$1"),se,Mt,Se,te,Pt,zs,Vs;const aD=Object.getPrototypeOf(Object.getPrototypeOf(async function*(){}).prototype);let uD=(He=class{constructor(t,n){rt(this,Pt),rt(this,se),rt(this,Mt),rt(this,Se,!1),rt(this,te),he(this,se,t),he(this,Mt,n)}next(){const t=o(()=>Gs(this,Pt,zs).call(this),"e");return he(this,te,V(this,te)?V(this,te).then(t,t):t()),V(this,te)}return(t){const n=o(()=>Gs(this,Pt,Vs).call(this,t),"t");return V(this,te)?V(this,te).then(n,n):n()}},o(He,"c"),He);se=new WeakMap,Mt=new WeakMap,Se=new WeakMap,te=new WeakMap,Pt=new WeakSet,zs=o(async function(){if(V(this,Se))return{done:!0,value:void 0};let e;try{e=await V(this,se).read()}catch(t){throw he(this,te,void 0),he(this,Se,!0),V(this,se).releaseLock(),t}return e.done&&(he(this,te,void 0),he(this,Se,!0),V(this,se).releaseLock()),e},"s_fn"),Vs=o(async function(e){if(V(this,Se))return{done:!0,value:e};if(he(this,Se,!0),!V(this,Mt)){const t=V(this,se).cancel(e);return V(this,se).releaseLock(),await t,{done:!0,value:e}}return V(this,se).releaseLock(),{done:!0,value:e}},"i_fn");const ur=Symbol();function Hs(){return this[ur].next()}o(Hs,"i"),Object.defineProperty(Hs,"name",{value:"next"});function Ks(e){return this[ur].return(e)}o(Ks,"o"),Object.defineProperty(Ks,"name",{value:"return"});const cD=Object.create(aD,{next:{enumerable:!0,configurable:!0,writable:!0,value:Hs},return:{enumerable:!0,configurable:!0,writable:!0,value:Ks}});function lD({preventCancel:e=!1}={}){const t=this.getReader(),n=new uD(t,e),r=Object.create(cD);return r[ur]=n,r}o(lD,"h");const dD=o(e=>{if(xt(e,{checkOpen:!1})&&cr.on!==void 0)return hD(e);if(typeof e?.[Symbol.asyncIterator]=="function")return e;if(fD.call(e)==="[object ReadableStream]")return lD.call(e);throw new TypeError("The first argument must be a Readable, a ReadableStream, or an async iterable.")},"getAsyncIterable"),{toString:fD}=Object.prototype,hD=o(async function*(e){const t=new AbortController,n={};DD(e,t,n);try{for await(const[r]of cr.on(e,"data",{signal:t.signal}))yield r}catch(r){if(n.error!==void 0)throw n.error;if(!t.signal.aborted)throw r}finally{e.destroy()}},"getStreamIterable"),DD=o(async(e,t,n)=>{try{await cr.finished(e,{cleanup:!0,readable:!0,writable:!1,error:!1})}catch(r){n.error=r}finally{t.abort()}},"handleStreamEnd"),cr={};var pD=Object.defineProperty,mD=o((e,t,n)=>t in e?pD(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,"__defNormalProp$2"),gD=o((e,t,n)=>mD(e,t+"",n),"__publicField$2");const lr=o(async(e,{init:t,convertChunk:n,getSize:r,truncateChunk:i,addChunk:s,getFinalChunk:a,finalize:u},{maxBuffer:c=Number.POSITIVE_INFINITY}={})=>{const l=dD(e),d=t();d.length=0;try{for await(const f of l){const h=wD(f),D=n[h](f,d);qs({convertedChunk:D,state:d,getSize:r,truncateChunk:i,addChunk:s,maxBuffer:c})}return FD({state:d,convertChunk:n,getSize:r,truncateChunk:i,addChunk:s,getFinalChunk:a,maxBuffer:c}),u(d)}catch(f){const h=typeof f=="object"&&f!==null?f:new Error(f);throw h.bufferedData=u(d),h}},"getStreamContents$1"),FD=o(({state:e,getSize:t,truncateChunk:n,addChunk:r,getFinalChunk:i,maxBuffer:s})=>{const a=i(e);a!==void 0&&qs({convertedChunk:a,state:e,getSize:t,truncateChunk:n,addChunk:r,maxBuffer:s})},"appendFinalChunk"),qs=o(({convertedChunk:e,state:t,getSize:n,truncateChunk:r,addChunk:i,maxBuffer:s})=>{const a=n(e),u=t.length+a;if(u<=s){Ys(e,t,i,u);return}const c=r(e,s-t.length);throw c!==void 0&&Ys(c,t,i,s),new xe},"appendChunk"),Ys=o((e,t,n,r)=>{t.contents=n(e,t,r),t.length=r},"addNewChunk"),wD=o(e=>{const t=typeof e;if(t==="string")return"string";if(t!=="object"||e===null)return"others";if(globalThis.Buffer?.isBuffer(e))return"buffer";const n=Zs.call(e);return n==="[object ArrayBuffer]"?"arrayBuffer":n==="[object DataView]"?"dataView":Number.isInteger(e.byteLength)&&Number.isInteger(e.byteOffset)&&Zs.call(e.buffer)==="[object ArrayBuffer]"?"typedArray":"others"},"getChunkType"),{toString:Zs}=Object.prototype,ho=class ho extends Error{constructor(){super("maxBuffer exceeded"),gD(this,"name","MaxBufferError")}};o(ho,"MaxBufferError");let xe=ho;const ve=o(e=>e,"identity"),dr=o(()=>{},"noop$1"),Js=o(({contents:e})=>e,"getContentsProperty"),Xs=o(e=>{throw new Error(`Streams in object mode are not supported: ${String(e)}`)},"throwObjectStream"),Qs=o(e=>e.length,"getLengthProperty");async function yD(e,t){return lr(e,SD,t)}o(yD,"getStreamAsArray");const ED=o(()=>({contents:[]}),"initArray"),bD=o(()=>1,"increment"),CD=o((e,{contents:t})=>(t.push(e),t),"addArrayChunk"),SD={init:ED,convertChunk:{string:ve,buffer:ve,arrayBuffer:ve,dataView:ve,typedArray:ve,others:ve},getSize:bD,truncateChunk:dr,addChunk:CD,getFinalChunk:dr,finalize:Js};async function vD(e,t){return lr(e,xD,t)}o(vD,"getStreamAsArrayBuffer");const AD=o(()=>({contents:new ArrayBuffer(0)}),"initArrayBuffer"),$D=o(e=>BD.encode(e),"useTextEncoder"),BD=new TextEncoder,ea=o(e=>new Uint8Array(e),"useUint8Array"),ta=o(e=>new Uint8Array(e.buffer,e.byteOffset,e.byteLength),"useUint8ArrayWithOffset"),TD=o((e,t)=>e.slice(0,t),"truncateArrayBufferChunk"),ID=o((e,{contents:t,length:n},r)=>{const i=oa()?RD(t,r):OD(t,r);return new Uint8Array(i).set(e,n),i},"addArrayBufferChunk"),OD=o((e,t)=>{if(t<=e.byteLength)return e;const n=new ArrayBuffer(na(t));return new Uint8Array(n).set(new Uint8Array(e),0),n},"resizeArrayBufferSlow"),RD=o((e,t)=>{if(t<=e.maxByteLength)return e.resize(t),e;const n=new ArrayBuffer(t,{maxByteLength:na(t)});return new Uint8Array(n).set(new Uint8Array(e),0),n},"resizeArrayBuffer"),na=o(e=>ra**Math.ceil(Math.log(e)/Math.log(ra)),"getNewContentsLength"),ra=2,_D=o(({contents:e,length:t})=>oa()?e:e.slice(0,t),"finalizeArrayBuffer"),oa=o(()=>"resize"in ArrayBuffer.prototype,"hasArrayBufferResize"),xD={init:AD,convertChunk:{string:$D,buffer:ea,arrayBuffer:ea,dataView:ta,typedArray:ta,others:Xs},getSize:Qs,truncateChunk:TD,addChunk:ID,getFinalChunk:dr,finalize:_D};async function MD(e,t){return lr(e,UD,t)}o(MD,"getStreamAsString");const PD=o(()=>({contents:"",textDecoder:new TextDecoder}),"initString"),Lt=o((e,{textDecoder:t})=>t.decode(e,{stream:!0}),"useTextDecoder"),LD=o((e,{contents:t})=>t+e,"addStringChunk"),ND=o((e,t)=>e.slice(0,t),"truncateStringChunk"),kD=o(({textDecoder:e})=>{const t=e.decode();return t===""?void 0:t},"getFinalStringChunk"),UD={init:PD,convertChunk:{string:ve,buffer:Lt,arrayBuffer:Lt,dataView:Lt,typedArray:Lt,others:Xs},getSize:Qs,truncateChunk:ND,addChunk:LD,getFinalChunk:kD,finalize:Js},jD=o(({error:e,stream:t,readableObjectMode:n,lines:r,encoding:i,fdNumber:s})=>{if(!(e instanceof xe))throw e;if(s==="all")return e;const a=WD(n,r,i);throw e.maxBufferInfo={fdNumber:s,unit:a},t.destroy(),e},"handleMaxBuffer"),WD=o((e,t,n)=>e?"objects":t?"lines":n==="buffer"?"bytes":"characters","getMaxBufferUnit"),GD=o((e,t,n)=>{if(t.length!==n)return;const r=new xe;throw r.maxBufferInfo={fdNumber:"ipc"},r},"checkIpcMaxBuffer"),zD=o((e,t)=>{const{streamName:n,threshold:r,unit:i}=VD(e,t);return`Command's ${n} was larger than ${r} ${i}`},"getMaxBufferMessage"),VD=o((e,t)=>{if(e?.maxBufferInfo===void 0)return{streamName:"output",threshold:t[1],unit:"bytes"};const{maxBufferInfo:{fdNumber:n,unit:r}}=e;delete e.maxBufferInfo;const i=Ze(t,n);return n==="ipc"?{streamName:"IPC output",threshold:i,unit:"messages"}:{streamName:Mi(n),threshold:i,unit:r}},"getMaxBufferInfo"),HD=o((e,t,n)=>e?.code==="ENOBUFS"&&t!==null&&t.some(r=>r!==null&&r.length>fr(n)),"isMaxBufferSync"),KD=o((e,t,n)=>{if(!t)return e;const r=fr(n);return e.length>r?e.slice(0,r):e},"truncateMaxBufferSync"),fr=o(([,e])=>e,"getMaxBufferSync"),qD=o(({stdio:e,all:t,ipcOutput:n,originalError:r,signal:i,signalDescription:s,exitCode:a,escapedCommand:u,timedOut:c,isCanceled:l,isGracefullyCanceled:d,isMaxBuffer:f,isForcefullyTerminated:h,forceKillAfterDelay:D,killSignal:p,maxBuffer:m,timeout:g,cwd:F})=>{const w=r?.code,E=YD({originalError:r,timedOut:c,timeout:g,isMaxBuffer:f,maxBuffer:m,errorCode:w,signal:i,signalDescription:s,exitCode:a,isCanceled:l,isGracefullyCanceled:d,isForcefullyTerminated:h,forceKillAfterDelay:D,killSignal:p}),y=JD(r,F),b=y===void 0?"":`
|
|
53
|
+
${y}`,S=`${E}: ${u}${b}`,$=t===void 0?[e[2],e[1]]:[t],B=[S,...$,...e.slice(3),n.map(I=>XD(I)).join(`
|
|
54
|
+
`)].map(I=>xn(sr(QD(I)))).filter(Boolean).join(`
|
|
55
|
+
|
|
56
|
+
`);return{originalMessage:y,shortMessage:S,message:B}},"createMessages"),YD=o(({originalError:e,timedOut:t,timeout:n,isMaxBuffer:r,maxBuffer:i,errorCode:s,signal:a,signalDescription:u,exitCode:c,isCanceled:l,isGracefullyCanceled:d,isForcefullyTerminated:f,forceKillAfterDelay:h,killSignal:D})=>{const p=ZD(f,h);return t?`Command timed out after ${n} milliseconds${p}`:d?a===void 0?`Command was gracefully canceled with exit code ${c}`:f?`Command was gracefully canceled${p}`:`Command was gracefully canceled with ${a} (${u})`:l?`Command was canceled${p}`:r?`${zD(e,i)}${p}`:s!==void 0?`Command failed with ${s}${p}`:f?`Command was killed with ${D} (${ms(D)})${p}`:a!==void 0?`Command was killed with ${a} (${u})`:c!==void 0?`Command failed with exit code ${c}`:"Command failed"},"getErrorPrefix"),ZD=o((e,t)=>e?` and was forcefully terminated after ${t} milliseconds`:"","getForcefulSuffix"),JD=o((e,t)=>{if(e instanceof ye)return;const n=vf(e)?e.originalMessage:String(e?.message??e),r=xn(eD(n,t));return r===""?void 0:r},"getOriginalMessage"),XD=o(e=>typeof e=="string"?e:vo(e),"serializeIpcMessage"),QD=o(e=>Array.isArray(e)?e.map(t=>sr(ia(t))).filter(Boolean).join(`
|
|
57
|
+
`):ia(e),"serializeMessagePart"),ia=o(e=>typeof e=="string"?e:J(e)?Ii(e):"","serializeMessageItem"),sa=o(({command:e,escapedCommand:t,stdio:n,all:r,ipcOutput:i,options:{cwd:s},startTime:a})=>aa({command:e,escapedCommand:t,cwd:s,durationMs:Hi(a),failed:!1,timedOut:!1,isCanceled:!1,isGracefullyCanceled:!1,isTerminated:!1,isMaxBuffer:!1,isForcefullyTerminated:!1,exitCode:0,stdout:n[1],stderr:n[2],all:r,stdio:n,ipcOutput:i,pipedFrom:[]}),"makeSuccessResult"),hr=o(({error:e,command:t,escapedCommand:n,fileDescriptors:r,options:i,startTime:s,isSync:a})=>Dr({error:e,command:t,escapedCommand:n,startTime:s,timedOut:!1,isCanceled:!1,isGracefullyCanceled:!1,isMaxBuffer:!1,isForcefullyTerminated:!1,stdio:Array.from({length:r.length}),ipcOutput:[],options:i,isSync:a}),"makeEarlyError"),Dr=o(({error:e,command:t,escapedCommand:n,startTime:r,timedOut:i,isCanceled:s,isGracefullyCanceled:a,isMaxBuffer:u,isForcefullyTerminated:c,exitCode:l,signal:d,stdio:f,all:h,ipcOutput:D,options:{timeoutDuration:p,timeout:m=p,forceKillAfterDelay:g,killSignal:F,cwd:w,maxBuffer:E},isSync:y})=>{const{exitCode:b,signal:S,signalDescription:$}=tp(l,d),{originalMessage:B,shortMessage:I,message:G}=qD({stdio:f,all:h,ipcOutput:D,originalError:e,signal:S,signalDescription:$,exitCode:b,escapedCommand:n,timedOut:i,isCanceled:s,isGracefullyCanceled:a,isMaxBuffer:u,isForcefullyTerminated:c,forceKillAfterDelay:g,killSignal:F,maxBuffer:E,timeout:m,cwd:w}),L=Sf(e,G,y);return Object.assign(L,ep({error:L,command:t,escapedCommand:n,startTime:r,timedOut:i,isCanceled:s,isGracefullyCanceled:a,isMaxBuffer:u,isForcefullyTerminated:c,exitCode:b,signal:S,signalDescription:$,stdio:f,all:h,ipcOutput:D,cwd:w,originalMessage:B,shortMessage:I})),L},"makeError"),ep=o(({error:e,command:t,escapedCommand:n,startTime:r,timedOut:i,isCanceled:s,isGracefullyCanceled:a,isMaxBuffer:u,isForcefullyTerminated:c,exitCode:l,signal:d,signalDescription:f,stdio:h,all:D,ipcOutput:p,cwd:m,originalMessage:g,shortMessage:F})=>aa({shortMessage:F,originalMessage:g,command:t,escapedCommand:n,cwd:m,durationMs:Hi(r),failed:!0,timedOut:i,isCanceled:s,isGracefullyCanceled:a,isTerminated:d!==void 0,isMaxBuffer:u,isForcefullyTerminated:c,exitCode:l,signal:d,signalDescription:f,code:e.cause?.code,stdout:h[1],stderr:h[2],all:D,stdio:h,ipcOutput:p,pipedFrom:[]}),"getErrorProperties"),aa=o(e=>Object.fromEntries(Object.entries(e).filter(([,t])=>t!==void 0)),"omitUndefinedProperties"),tp=o((e,t)=>{const n=e===null?void 0:e,r=t===null?void 0:t,i=r===void 0?void 0:ms(t);return{exitCode:n,signal:r,signalDescription:i}},"normalizeExitPayload"),ua=o(e=>Number.isFinite(e)?e:0,"toZeroIfInfinity");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(ua(e*1e3)%1e3),nanoseconds:Math.trunc(ua(e*1e6)%1e3)}}o(np,"parseNumber");function rp(e){return{days:e/86400000n,hours:e/3600000n%24n,minutes:e/60000n%60n,seconds:e/1000n%60n,milliseconds:e%1000n,microseconds:0n,nanoseconds:0n}}o(rp,"parseBigint");function op(e){switch(typeof e){case"number":{if(Number.isFinite(e))return np(e);break}case"bigint":return rp(e)}throw new TypeError("Expected a finite number or bigint")}o(op,"parseMilliseconds");const ip=o(e=>e===0||e===0n,"isZero"),sp=o((e,t)=>t===1||t===1n?e:`${e}s`,"pluralize"),ap=1e-7,up=24n*60n*60n*1000n;function cp(e,t){const n=typeof e=="bigint";if(!n&&!Number.isFinite(e))throw new TypeError("Expected a finite number or bigint");t={...t};const r=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 i=[];const s=o((d,f)=>{const h=Math.floor(d*10**f+ap);return(Math.round(h)/10**f).toFixed(f)},"floorDecimals"),a=o((d,f,h,D)=>{if(!((i.length===0||!t.colonNotation)&&ip(d)&&!(t.colonNotation&&h==="m"))){if(D??(D=String(d)),t.colonNotation){const p=D.includes(".")?D.split(".")[0].length:D.length,m=i.length>0?2:1;D="0".repeat(Math.max(0,m-p))+D}else D+=t.verbose?" "+sp(f,d):h;i.push(D)}},"add"),u=op(e),c=BigInt(u.days);if(t.hideYearAndDays?a(BigInt(c)*24n+BigInt(u.hours),"hour","h"):(t.hideYear?a(c,"day","d"):(a(c/365n,"year","y"),a(c%365n,"day","d")),a(Number(u.hours),"hour","h")),a(Number(u.minutes),"minute","m"),!t.hideSeconds)if(t.separateMilliseconds||t.formatSubMilliseconds||!t.colonNotation&&e<1e3&&!t.subSecondsAsDecimals){const d=Number(u.seconds),f=Number(u.milliseconds),h=Number(u.microseconds),D=Number(u.nanoseconds);if(a(d,"second","s"),t.formatSubMilliseconds)a(f,"millisecond","ms"),a(h,"microsecond","\xB5s"),a(D,"nanosecond","ns");else{const p=f+h/1e3+D/1e6,m=typeof t.millisecondsDecimalDigits=="number"?t.millisecondsDecimalDigits:0,g=p>=1?Math.round(p):Math.ceil(p),F=m?p.toFixed(m):g;a(Number.parseFloat(F),"millisecond","ms",F)}}else{const d=(n?Number(e%up):e)/1e3%60,f=typeof t.secondsDecimalDigits=="number"?t.secondsDecimalDigits:1,h=s(d,f),D=t.keepDecimalsOnWholeSeconds?h:h.replace(/\.0+$/,"");a(Number.parseFloat(D),"second","s",D)}if(i.length===0)return r+"0"+(t.verbose?" milliseconds":"ms");const l=t.colonNotation?":":" ";return typeof t.unitCount=="number"&&(i=i.slice(0,Math.max(t.unitCount,1))),r+i.join(l)}o(cp,"prettyMilliseconds");const lp=o((e,t)=>{e.failed&&Je({type:"error",verboseMessage:e.shortMessage,verboseInfo:t,result:e})},"logError"),dp=o((e,t)=>{Tn(t)&&(lp(e,t),fp(e,t))},"logResult"),fp=o((e,t)=>{const n=`(done in ${cp(e.durationMs)})`;Je({type:"duration",verboseMessage:n,verboseInfo:t,result:e})},"logDuration"),pr=o((e,t,{reject:n})=>{if(dp(e,t),e.failed&&n)throw e;return e},"handleResult"),hp=o((e,t)=>Me(e)?"asyncGenerator":ha(e)?"generator":gr(e)?"fileUrl":wp(e)?"filePath":Cp(e)?"webStream":Ce(e,{checkOpen:!1})?"native":J(e)?"uint8Array":Sp(e)?"asyncIterable":vp(e)?"iterable":wr(e)?ca({},t):gp(e)?Dp(e,t):"native","getStdioItemType"),Dp=o((e,t)=>js(e.transform,{checkOpen:!1})?pp(e,t):wr(e.transform)?ca(e,t):mp(e,t),"getTransformObjectType"),pp=o((e,t)=>(la(e,t,"Duplex stream"),"duplex"),"getDuplexType"),ca=o((e,t)=>(la(e,t,"web TransformStream"),"webTransform"),"getTransformStreamType"),la=o(({final:e,binary:t,objectMode:n},r,i)=>{da(e,`${r}.final`,i),da(t,`${r}.binary`,i),mr(n,`${r}.objectMode`)},"validateNonGeneratorType"),da=o((e,t,n)=>{if(e!==void 0)throw new TypeError(`The \`${t}\` option can only be defined when using a generator, not a ${n}.`)},"checkUndefinedOption"),mp=o(({transform:e,final:t,binary:n,objectMode:r},i)=>{if(e!==void 0&&!fa(e))throw new TypeError(`The \`${i}.transform\` option must be a generator, a Duplex stream or a web TransformStream.`);if(js(t,{checkOpen:!1}))throw new TypeError(`The \`${i}.final\` option must not be a Duplex stream.`);if(wr(t))throw new TypeError(`The \`${i}.final\` option must not be a web TransformStream.`);if(t!==void 0&&!fa(t))throw new TypeError(`The \`${i}.final\` option must be a generator.`);return mr(n,`${i}.binary`),mr(r,`${i}.objectMode`),Me(e)||Me(t)?"asyncGenerator":"generator"},"getGeneratorObjectType"),mr=o((e,t)=>{if(e!==void 0&&typeof e!="boolean")throw new TypeError(`The \`${t}\` option must use a boolean.`)},"checkBooleanOption"),fa=o(e=>Me(e)||ha(e),"isGenerator"),Me=o(e=>Object.prototype.toString.call(e)==="[object AsyncGeneratorFunction]","isAsyncGenerator"),ha=o(e=>Object.prototype.toString.call(e)==="[object GeneratorFunction]","isSyncGenerator"),gp=o(e=>Y(e)&&(e.transform!==void 0||e.final!==void 0),"isTransformOptions"),gr=o(e=>Object.prototype.toString.call(e)==="[object URL]","isUrl"),Fp=o(e=>gr(e)&&e.protocol!=="file:","isRegularUrl"),wp=o(e=>Y(e)&&Object.keys(e).length>0&&Object.keys(e).every(t=>yp.has(t))&&Da(e.file),"isFilePathObject"),yp=new Set(["file","append"]),Da=o(e=>typeof e=="string","isFilePathString"),Ep=o((e,t)=>e==="native"&&typeof t=="string"&&!bp.has(t),"isUnknownStdioString"),bp=new Set(["ipc","ignore","inherit","overlapped","pipe"]),pa=o(e=>Object.prototype.toString.call(e)==="[object ReadableStream]","isReadableStream"),Fr=o(e=>Object.prototype.toString.call(e)==="[object WritableStream]","isWritableStream"),Cp=o(e=>pa(e)||Fr(e),"isWebStream"),wr=o(e=>pa(e?.readable)&&Fr(e?.writable),"isTransformStream"),Sp=o(e=>ma(e)&&typeof e[Symbol.asyncIterator]=="function","isAsyncIterableObject"),vp=o(e=>ma(e)&&typeof e[Symbol.iterator]=="function","isIterableObject"),ma=o(e=>typeof e=="object"&&e!==null,"isObject"),Ae=new Set(["generator","asyncGenerator","duplex","webTransform"]),ga=new Set(["fileUrl","filePath","fileNumber"]),Fa=new Set(["fileUrl","filePath"]),Ap=new Set([...Fa,"webStream","nodeStream"]),$p=new Set(["webTransform","duplex"]),Nt={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"},wa=o((e,t,n,r)=>r==="output"?Bp(e,t,n):Tp(e,t,n),"getTransformObjectModes"),Bp=o((e,t,n)=>{const r=t!==0&&n[t-1].value.readableObjectMode;return{writableObjectMode:r,readableObjectMode:e??r}},"getOutputObjectModes"),Tp=o((e,t,n)=>{const r=t===0?e===!0:n[t-1].value.readableObjectMode,i=t!==n.length-1&&(e??r);return{writableObjectMode:r,readableObjectMode:i}},"getInputObjectModes"),Ip=o((e,t)=>{const n=e.findLast(({type:r})=>Ae.has(r));return n===void 0?!1:t==="input"?n.value.writableObjectMode:n.value.readableObjectMode},"getFdObjectMode"),Op=o((e,t,n,r)=>[...e.filter(({type:i})=>!Ae.has(i)),...Rp(e,t,n,r)],"normalizeTransforms"),Rp=o((e,t,n,{encoding:r})=>{const i=e.filter(({type:a})=>Ae.has(a)),s=Array.from({length:i.length});for(const[a,u]of Object.entries(i))s[a]=_p({stdioItem:u,index:Number(a),newTransforms:s,optionName:t,direction:n,encoding:r});return Lp(s,n)},"getTransforms"),_p=o(({stdioItem:e,stdioItem:{type:t},index:n,newTransforms:r,optionName:i,direction:s,encoding:a})=>t==="duplex"?xp({stdioItem:e,optionName:i}):t==="webTransform"?Mp({stdioItem:e,index:n,newTransforms:r,direction:s}):Pp({stdioItem:e,index:n,newTransforms:r,direction:s,encoding:a}),"normalizeTransform"),xp=o(({stdioItem:e,stdioItem:{value:{transform:t,transform:{writableObjectMode:n,readableObjectMode:r},objectMode:i=r}},optionName:s})=>{if(i&&!r)throw new TypeError(`The \`${s}.objectMode\` option can only be \`true\` if \`new Duplex({objectMode: true})\` is used.`);if(!i&&r)throw new TypeError(`The \`${s}.objectMode\` option cannot be \`false\` if \`new Duplex({objectMode: true})\` is used.`);return{...e,value:{transform:t,writableObjectMode:n,readableObjectMode:r}}},"normalizeDuplex"),Mp=o(({stdioItem:e,stdioItem:{value:t},index:n,newTransforms:r,direction:i})=>{const{transform:s,objectMode:a}=Y(t)?t:{transform:t},{writableObjectMode:u,readableObjectMode:c}=wa(a,n,r,i);return{...e,value:{transform:s,writableObjectMode:u,readableObjectMode:c}}},"normalizeTransformStream"),Pp=o(({stdioItem:e,stdioItem:{value:t},index:n,newTransforms:r,direction:i,encoding:s})=>{const{transform:a,final:u,binary:c=!1,preserveNewlines:l=!1,objectMode:d}=Y(t)?t:{transform:t},f=c||be.has(s),{writableObjectMode:h,readableObjectMode:D}=wa(d,n,r,i);return{...e,value:{transform:a,final:u,binary:f,preserveNewlines:l,writableObjectMode:h,readableObjectMode:D}}},"normalizeGenerator"),Lp=o((e,t)=>t==="input"?e.reverse():e,"sortTransforms"),Np=o((e,t,n)=>{const r=e.map(i=>kp(i,t));if(r.includes("input")&&r.includes("output"))throw new TypeError(`The \`${n}\` option must not be an array of both readable and writable values.`);return r.find(Boolean)??Wp},"getStreamDirection"),kp=o(({type:e,value:t},n)=>Up[n]??ya[e](t),"getStdioItemDirection"),Up=["input","output","output"],Pe=o(()=>{},"anyDirection"),yr=o(()=>"input","alwaysInput"),ya={generator:Pe,asyncGenerator:Pe,fileUrl:Pe,filePath:Pe,iterable:yr,asyncIterable:yr,uint8Array:yr,webStream:o(e=>Fr(e)?"output":"input","webStream"),nodeStream(e){return xt(e,{checkOpen:!1})?Us(e,{checkOpen:!1})?void 0:"input":"output"},webTransform:Pe,duplex:Pe,native(e){const t=jp(e);if(t!==void 0)return t;if(Ce(e,{checkOpen:!1}))return ya.nodeStream(e)}},jp=o(e=>{if([0,O.stdin].includes(e))return"input";if([1,2,O.stdout,O.stderr].includes(e))return"output"},"getStandardStreamDirection"),Wp="output",Gp=o((e,t)=>t&&!e.includes("ipc")?[...e,"ipc"]:e,"normalizeIpcStdioArray"),zp=o(({stdio:e,ipc:t,buffer:n,...r},i,s)=>{const a=Vp(e,r).map((u,c)=>Ea(u,c));return s?Kp(a,n,i):Gp(a,t)},"normalizeStdioOption"),Vp=o((e,t)=>{if(e===void 0)return ee.map(r=>t[r]);if(Hp(t))throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${ee.map(r=>`\`${r}\``).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}\``);const n=Math.max(e.length,ee.length);return Array.from({length:n},(r,i)=>e[i])},"getStdioArray"),Hp=o(e=>ee.some(t=>e[t]!==void 0),"hasAlias"),Ea=o((e,t)=>Array.isArray(e)?e.map(n=>Ea(n,t)):e??(t>=ee.length?"ignore":"pipe"),"addDefaultValue"),Kp=o((e,t,n)=>e.map((r,i)=>!t[i]&&i!==0&&!In(n,i)&&qp(r)?"ignore":r),"normalizeStdioSync"),qp=o(e=>e==="pipe"||Array.isArray(e)&&e.every(t=>t==="pipe"),"isOutputPipeOnly"),Yp=o(({stdioItem:e,stdioItem:{type:t},isStdioArray:n,fdNumber:r,direction:i,isSync:s})=>!n||t!=="native"?e:s?Zp({stdioItem:e,fdNumber:r,direction:i}):Qp({stdioItem:e,fdNumber:r}),"handleNativeStream"),Zp=o(({stdioItem:e,stdioItem:{value:t,optionName:n},fdNumber:r,direction:i})=>{const s=Jp({value:t,optionName:n,fdNumber:r,direction:i});if(s!==void 0)return s;if(Ce(t,{checkOpen:!1}))throw new TypeError(`The \`${n}: Stream\` option cannot both be an array and include a stream with synchronous methods.`);return e},"handleNativeStreamSync"),Jp=o(({value:e,optionName:t,fdNumber:n,direction:r})=>{const i=Xp(e,n);if(i!==void 0){if(r==="output")return{type:"fileNumber",value:i,optionName:t};if(To.isatty(i))throw new TypeError(`The \`${t}: ${Qn(e)}\` option is invalid: it cannot be a TTY with synchronous methods.`);return{type:"uint8Array",value:Ye(dn(i)),optionName:t}}},"getTargetFd"),Xp=o((e,t)=>{if(e==="inherit")return t;if(typeof e=="number")return e;const n=Bn.indexOf(e);if(n!==-1)return n},"getTargetFdNumber"),Qp=o(({stdioItem:e,stdioItem:{value:t,optionName:n},fdNumber:r})=>t==="inherit"?{type:"nodeStream",value:ba(r,t,n),optionName:n}:typeof t=="number"?{type:"nodeStream",value:ba(t,t,n),optionName:n}:Ce(t,{checkOpen:!1})?{type:"nodeStream",value:t,optionName:n}:e,"handleNativeStreamAsync"),ba=o((e,t,n)=>{const r=Bn[e];if(r===void 0)throw new TypeError(`The \`${n}: ${t}\` option is invalid: no such standard stream.`);return r},"getStandardStream"),em=o(({input:e,inputFile:t},n)=>n===0?[...tm(e),...rm(t)]:[],"handleInputOptions"),tm=o(e=>e===void 0?[]:[{type:nm(e),value:e,optionName:"input"}],"handleInputOption"),nm=o(e=>{if(xt(e,{checkOpen:!1}))return"nodeStream";if(typeof e=="string")return"string";if(J(e))return"uint8Array";throw new Error("The `input` option must be a string, a Uint8Array or a Node.js Readable stream.")},"getInputType"),rm=o(e=>e===void 0?[]:[{...om(e),optionName:"inputFile"}],"handleInputFileOption"),om=o(e=>{if(gr(e))return{type:"fileUrl",value:e};if(Da(e))return{type:"filePath",value:{file:e}};throw new Error("The `inputFile` option must be a file path string or a file URL.")},"getInputFileType"),im=o(e=>e.filter((t,n)=>e.every((r,i)=>t.value!==r.value||n>=i||t.type==="generator"||t.type==="asyncGenerator")),"filterDuplicates"),sm=o(({stdioItem:{type:e,value:t,optionName:n},direction:r,fileDescriptors:i,isSync:s})=>{const a=am(i,e);if(a.length!==0){if(s){um({otherStdioItems:a,type:e,value:t,optionName:n,direction:r});return}if(Ap.has(e))return Ca({otherStdioItems:a,type:e,value:t,optionName:n,direction:r});$p.has(e)&&lm({otherStdioItems:a,type:e,value:t,optionName:n})}},"getDuplicateStream"),am=o((e,t)=>e.flatMap(({direction:n,stdioItems:r})=>r.filter(i=>i.type===t).map((i=>({...i,direction:n})))),"getOtherStdioItems"),um=o(({otherStdioItems:e,type:t,value:n,optionName:r,direction:i})=>{Fa.has(t)&&Ca({otherStdioItems:e,type:t,value:n,optionName:r,direction:i})},"validateDuplicateStreamSync"),Ca=o(({otherStdioItems:e,type:t,value:n,optionName:r,direction:i})=>{const s=e.filter(u=>cm(u,n));if(s.length===0)return;const a=s.find(u=>u.direction!==i);return Sa(a,r,t),i==="output"?s[0].stream:void 0},"getDuplicateStreamInstance"),cm=o(({type:e,value:t},n)=>e==="filePath"?t.file===n.file:e==="fileUrl"?t.href===n.href:t===n,"hasSameValue"),lm=o(({otherStdioItems:e,type:t,value:n,optionName:r})=>{const i=e.find(({value:{transform:s}})=>s===n.transform);Sa(i,r,t)},"validateDuplicateTransform"),Sa=o((e,t,n)=>{if(e!==void 0)throw new TypeError(`The \`${e.optionName}\` and \`${t}\` options must not target ${Nt[n]} that is the same.`)},"throwOnDuplicateStream"),va=o((e,t,n,r)=>{const s=zp(t,n,r).map((u,c)=>dm({stdioOption:u,fdNumber:c,options:t,isSync:r})),a=wm({initialFileDescriptors:s,addProperties:e,options:t,isSync:r});return t.stdio=a.map(({stdioItems:u})=>bm(u)),a},"handleStdio"),dm=o(({stdioOption:e,fdNumber:t,options:n,isSync:r})=>{const i=Mi(t),{stdioItems:s,isStdioArray:a}=fm({stdioOption:e,fdNumber:t,options:n,optionName:i}),u=Np(s,t,i),c=s.map(f=>Yp({stdioItem:f,isStdioArray:a,fdNumber:t,direction:u,isSync:r})),l=Op(c,i,u,n),d=Ip(l,u);return Fm(l,d),{direction:u,objectMode:d,stdioItems:l}},"getFileDescriptor"),fm=o(({stdioOption:e,fdNumber:t,options:n,optionName:r})=>{const s=[...(Array.isArray(e)?e:[e]).map(c=>hm(c,r)),...em(n,t)],a=im(s),u=a.length>1;return Dm(a,u,r),mm(a),{stdioItems:a,isStdioArray:u}},"initializeStdioItems"),hm=o((e,t)=>({type:hp(e,t),value:e,optionName:t}),"initializeStdioItem"),Dm=o((e,t,n)=>{if(e.length===0)throw new TypeError(`The \`${n}\` option must not be an empty array.`);if(t){for(const{value:r,optionName:i}of e)if(pm.has(r))throw new Error(`The \`${i}\` option must not include \`${r}\`.`)}},"validateStdioArray"),pm=new Set(["ignore","ipc"]),mm=o(e=>{for(const t of e)gm(t)},"validateStreams"),gm=o(({type:e,value:t,optionName:n})=>{if(Fp(t))throw new TypeError(`The \`${n}: URL\` option must use the \`file:\` scheme.
|
|
58
|
+
For example, you can use the \`pathToFileURL()\` method of the \`url\` core module.`);if(Ep(e,t))throw new TypeError(`The \`${n}: { file: '...' }\` option must be used instead of \`${n}: '...'\`.`)},"validateFileStdio"),Fm=o((e,t)=>{if(!t)return;const n=e.find(({type:r})=>ga.has(r));if(n!==void 0)throw new TypeError(`The \`${n.optionName}\` option cannot use both files and transforms in objectMode.`)},"validateFileObjectMode"),wm=o(({initialFileDescriptors:e,addProperties:t,options:n,isSync:r})=>{const i=[];try{for(const s of e)i.push(ym({fileDescriptor:s,fileDescriptors:i,addProperties:t,options:n,isSync:r}));return i}catch(s){throw Aa(i),s}},"getFinalFileDescriptors"),ym=o(({fileDescriptor:{direction:e,objectMode:t,stdioItems:n},fileDescriptors:r,addProperties:i,options:s,isSync:a})=>{const u=n.map(c=>Em({stdioItem:c,addProperties:i,direction:e,options:s,fileDescriptors:r,isSync:a}));return{direction:e,objectMode:t,stdioItems:u}},"getFinalFileDescriptor"),Em=o(({stdioItem:e,addProperties:t,direction:n,options:r,fileDescriptors:i,isSync:s})=>{const a=sm({stdioItem:e,direction:n,fileDescriptors:i,isSync:s});return a!==void 0?{...e,stream:a}:{...e,...t[n][e.type](e,r)}},"addStreamProperties"),Aa=o(e=>{for(const{stdioItems:t}of e)for(const{stream:n}of t)n!==void 0&&!Fe(n)&&n.destroy()},"cleanupCustomStreams"),bm=o(e=>{if(e.length>1)return e.some(({value:r})=>r==="overlapped")?"overlapped":"pipe";const[{type:t,value:n}]=e;return t==="native"?n:"pipe"},"forwardStdio"),Cm=o((e,t)=>va(vm,e,t,!0),"handleStdioSync"),ne=o(({type:e,optionName:t})=>{$a(t,Nt[e])},"forbiddenIfSync"),Sm=o(({optionName:e,value:t})=>((t==="ipc"||t==="overlapped")&&$a(e,`"${t}"`),{}),"forbiddenNativeIfSync"),$a=o((e,t)=>{throw new TypeError(`The \`${e}\` option cannot be ${t} with synchronous methods.`)},"throwInvalidSyncValue"),Ba={generator(){},asyncGenerator:ne,webStream:ne,nodeStream:ne,webTransform:ne,duplex:ne,asyncIterable:ne,native:Sm},vm={input:{...Ba,fileUrl:o(({value:e})=>({contents:[Ye(dn(e))]}),"fileUrl"),filePath:o(({value:{file:e}})=>({contents:[Ye(dn(e))]}),"filePath"),fileNumber:ne,iterable:o(({value:e})=>({contents:[...e]}),"iterable"),string:o(({value:e})=>({contents:[e]}),"string"),uint8Array:o(({value:e})=>({contents:[e]}),"uint8Array")},output:{...Ba,fileUrl:o(({value:e})=>({path:e}),"fileUrl"),filePath:o(({value:{file:e,append:t}})=>({path:e,append:t}),"filePath"),fileNumber:o(({value:e})=>({path:e}),"fileNumber"),iterable:ne,string:ne,uint8Array:ne}},Le=o((e,{stripFinalNewline:t},n)=>Ta(t,n)&&e!==void 0&&!Array.isArray(e)?sr(e):e,"stripNewline"),Ta=o((e,t)=>t==="all"?e[1]||e[2]:e[t],"getStripFinalNewline"),Ia=o((e,t,n,r)=>e||n?void 0:_a(t,r),"getSplitLinesGenerator"),Oa=o((e,t,n)=>n?e.flatMap(r=>Ra(r,t)):Ra(e,t),"splitLinesSync"),Ra=o((e,t)=>{const{transform:n,final:r}=_a(t,{});return[...n(e),...r()]},"splitLinesItemSync"),_a=o((e,t)=>(t.previousChunks="",{transform:Am.bind(void 0,t,e),final:Bm.bind(void 0,t)}),"initializeSplitLines"),Am=o(function*(e,t,n){if(typeof n!="string"){yield n;return}let{previousChunks:r}=e,i=-1;for(let s=0;s<n.length;s+=1)if(n[s]===`
|
|
59
|
+
`){const a=$m(n,s,t,e);let u=n.slice(i+1,s+1-a);r.length>0&&(u=Er(r,u),r=""),yield u,i=s}i!==n.length-1&&(r=Er(r,n.slice(i+1))),e.previousChunks=r},"splitGenerator"),$m=o((e,t,n,r)=>n?0:(r.isWindowsNewline=t!==0&&e[t-1]==="\r",r.isWindowsNewline?2:1),"getNewlineLength"),Bm=o(function*({previousChunks:e}){e.length>0&&(yield e)},"linesFinal"),Tm=o(({binary:e,preserveNewlines:t,readableObjectMode:n,state:r})=>e||t||n?void 0:{transform:Im.bind(void 0,r)},"getAppendNewlineGenerator"),Im=o(function*({isWindowsNewline:e=!1},t){const{unixNewline:n,windowsNewline:r,LF:i,concatBytes:s}=typeof t=="string"?Om:_m;if(t.at(-1)===i){yield t;return}yield s(t,e?r:n)},"appendNewlineGenerator"),Er=o((e,t)=>`${e}${t}`,"concatString"),Om={windowsNewline:`\r
|
|
60
|
+
`,unixNewline:`
|
|
61
|
+
`,LF:`
|
|
62
|
+
`,concatBytes:Er},Rm=o((e,t)=>{const n=new Uint8Array(e.length+t.length);return n.set(e,0),n.set(t,e.length),n},"concatUint8Array"),_m={windowsNewline:new Uint8Array([13,10]),unixNewline:new Uint8Array([10]),LF:10,concatBytes:Rm},xm=o((e,t)=>e?void 0:Mm.bind(void 0,t),"getValidateTransformInput"),Mm=o(function*(e,t){if(typeof t!="string"&&!J(t)&&!Dn.isBuffer(t))throw new TypeError(`The \`${e}\` option's transform must use "objectMode: true" to receive as input: ${typeof t}.`);yield t},"validateStringTransformInput"),Pm=o((e,t)=>e?Lm.bind(void 0,t):Nm.bind(void 0,t),"getValidateTransformReturn"),Lm=o(function*(e,t){xa(e,t),yield t},"validateObjectTransformReturn"),Nm=o(function*(e,t){if(xa(e,t),typeof t!="string"&&!J(t))throw new TypeError(`The \`${e}\` option's function must yield a string or an Uint8Array, not ${typeof t}.`);yield t},"validateStringTransformReturn"),xa=o((e,t)=>{if(t==null)throw new TypeError(`The \`${e}\` option's function must not call \`yield ${t}\`.
|
|
63
|
+
Instead, \`yield\` should either be called with a value, or not be called at all. For example:
|
|
64
|
+
if (condition) { yield value; }`)},"validateEmptyReturn"),Ma=o((e,t,n)=>{if(n)return;if(e)return{transform:km.bind(void 0,new TextEncoder)};const r=new So(t);return{transform:Um.bind(void 0,r),final:jm.bind(void 0,r)}},"getEncodingTransformGenerator"),km=o(function*(e,t){Dn.isBuffer(t)?yield Ye(t):typeof t=="string"?yield e.encode(t):yield t},"encodingUint8ArrayGenerator"),Um=o(function*(e,t){yield J(t)?e.write(t):t},"encodingStringGenerator"),jm=o(function*(e){const t=e.end();t!==""&&(yield t)},"encodingStringFinal"),Pa=Re(async(e,t,n,r)=>{t.currentIterable=e(...n);try{for await(const i of t.currentIterable)r.push(i)}finally{delete t.currentIterable}}),br=o(async function*(e,t,n){if(n===t.length){yield e;return}const{transform:r=Vm}=t[n];for await(const i of r(e))yield*br(i,t,n+1)},"transformChunk"),Wm=o(async function*(e){for(const[t,{final:n}]of Object.entries(e))yield*Gm(n,Number(t),e)},"finalChunks"),Gm=o(async function*(e,t,n){if(e!==void 0)for await(const r of e())yield*br(r,n,t+1)},"generatorFinalChunks"),zm=Re(async({currentIterable:e},t)=>{if(e!==void 0){await(t?e.throw(t):e.return());return}if(t)throw t}),Vm=o(function*(e){yield e},"identityGenerator$1"),La=o((e,t,n,r)=>{try{for(const i of e(...t))n.push(i);r()}catch(i){r(i)}},"pushChunksSync"),Hm=o((e,t)=>[...t.flatMap(n=>[...ot(n,e,0)]),...Cr(e)],"runTransformSync"),ot=o(function*(e,t,n){if(n===t.length){yield e;return}const{transform:r=qm}=t[n];for(const i of r(e))yield*ot(i,t,n+1)},"transformChunkSync"),Cr=o(function*(e){for(const[t,{final:n}]of Object.entries(e))yield*Km(n,Number(t),e)},"finalChunksSync"),Km=o(function*(e,t,n){if(e!==void 0)for(const r of e())yield*ot(r,n,t+1)},"generatorFinalChunksSync"),qm=o(function*(e){yield e},"identityGenerator"),Na=o(({value:e,value:{transform:t,final:n,writableObjectMode:r,readableObjectMode:i},optionName:s},{encoding:a})=>{const u={},c=Ua(e,a,s),l=Me(t),d=Me(n),f=l?Pa.bind(void 0,br,u):La.bind(void 0,ot),h=l||d?Pa.bind(void 0,Wm,u):La.bind(void 0,Cr),D=l||d?zm.bind(void 0,u):void 0;return{stream:new zc({writableObjectMode:r,writableHighWaterMark:gt(r),readableObjectMode:i,readableHighWaterMark:gt(i),transform(m,g,F){f([m,c,0],this,F)},flush(m){h([c],this,m)},destroy:D})}},"generatorToStream"),ka=o((e,t,n,r)=>{const i=t.filter(({type:a})=>a==="generator"),s=r?i.reverse():i;for(const{value:a,optionName:u}of s){const c=Ua(a,n,u);e=Hm(c,e)}return e},"runGeneratorsSync"),Ua=o(({transform:e,final:t,binary:n,writableObjectMode:r,readableObjectMode:i,preserveNewlines:s},a,u)=>{const c={};return[{transform:xm(r,u)},Ma(n,a,r),Ia(n,s,r,c),{transform:e,final:t},{transform:Pm(i,u)},Tm({binary:n,preserveNewlines:s,readableObjectMode:i,state:c})].filter(Boolean)},"addInternalGenerators"),Ym=o((e,t)=>{for(const n of Zm(e))Jm(e,n,t)},"addInputOptionsSync"),Zm=o(e=>new Set(Object.entries(e).filter(([,{direction:t}])=>t==="input").map(([t])=>Number(t))),"getInputFdNumbers"),Jm=o((e,t,n)=>{const{stdioItems:r}=e[t],i=r.filter(({contents:u})=>u!==void 0);if(i.length===0)return;if(t!==0){const[{type:u,optionName:c}]=i;throw new TypeError(`Only the \`stdin\` option, not \`${c}\`, can be ${Nt[u]} with synchronous methods.`)}const a=i.map(({contents:u})=>u).map(u=>Xm(u,r));n.input=$n(a)},"addInputOptionSync"),Xm=o((e,t)=>{const n=ka(e,t,"utf8",!0);return Qm(n),$n(n)},"applySingleInputGeneratorsSync"),Qm=o(e=>{const t=e.find(n=>typeof n!="string"&&!J(n));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}.`)},"validateSerializable"),ja=o(({stdioItems:e,encoding:t,verboseInfo:n,fdNumber:r})=>r!=="all"&&In(n,r)&&!be.has(t)&&eg(r)&&(e.some(({type:i,value:s})=>i==="native"&&tg.has(s))||e.every(({type:i})=>Ae.has(i))),"shouldLogOutput"),eg=o(e=>e===1||e===2,"fdUsesVerbose"),tg=new Set(["pipe","overlapped"]),ng=o(async(e,t,n,r)=>{for await(const i of e)og(t)||Wa(i,n,r)},"logLines"),rg=o((e,t,n)=>{for(const r of e)Wa(r,t,n)},"logLinesSync"),og=o(e=>e._readableState.pipes.length>0,"isPipingStream"),Wa=o((e,t,n)=>{const r=zi(e);Je({type:"output",verboseMessage:r,fdNumber:t,verboseInfo:n})},"logLine"),ig=o(({fileDescriptors:e,syncResult:{output:t},options:n,isMaxBuffer:r,verboseInfo:i})=>{if(t===null)return{output:Array.from({length:3})};const s={},a=new Set([]);return{output:t.map((c,l)=>sg({result:c,fileDescriptors:e,fdNumber:l,state:s,outputFiles:a,isMaxBuffer:r,verboseInfo:i},n)),...s}},"transformOutputSync"),sg=o(({result:e,fileDescriptors:t,fdNumber:n,state:r,outputFiles:i,isMaxBuffer:s,verboseInfo:a},{buffer:u,encoding:c,lines:l,stripFinalNewline:d,maxBuffer:f})=>{if(e===null)return;const h=KD(e,s,f),D=Ye(h),{stdioItems:p,objectMode:m}=t[n],g=ag([D],p,c,r),{serializedResult:F,finalResult:w=F}=ug({chunks:g,objectMode:m,encoding:c,lines:l,stripFinalNewline:d,fdNumber:n});cg({serializedResult:F,fdNumber:n,state:r,verboseInfo:a,encoding:c,stdioItems:p,objectMode:m});const E=u[n]?w:void 0;try{return r.error===void 0&&lg(F,p,i),E}catch(y){return r.error=y,E}},"transformOutputResultSync"),ag=o((e,t,n,r)=>{try{return ka(e,t,n,!1)}catch(i){return r.error=i,e}},"runOutputGeneratorsSync"),ug=o(({chunks:e,objectMode:t,encoding:n,lines:r,stripFinalNewline:i,fdNumber:s})=>{if(t)return{serializedResult:e};if(n==="buffer")return{serializedResult:$n(e)};const a=ed(e,n);return r[s]?{serializedResult:a,finalResult:Oa(a,!i[s],t)}:{serializedResult:a}},"serializeChunks"),cg=o(({serializedResult:e,fdNumber:t,state:n,verboseInfo:r,encoding:i,stdioItems:s,objectMode:a})=>{if(!ja({stdioItems:s,encoding:i,verboseInfo:r,fdNumber:t}))return;const u=Oa(e,!1,a);try{rg(u,t,r)}catch(c){n.error??(n.error=c)}},"logOutputSync"),lg=o((e,t,n)=>{for(const{path:r,append:i}of t.filter(({type:s})=>ga.has(s))){const s=typeof r=="string"?r:r.toString();i||n.has(s)?Wc(r,e):(n.add(s),Gc(r,e))}},"writeToFiles"),dg=o(([,e,t],n)=>{if(n.all)return e===void 0?t:t===void 0?e:Array.isArray(e)?Array.isArray(t)?[...e,...t]:[...e,Le(t,n,"all")]:Array.isArray(t)?[Le(e,n,"all"),...t]:J(e)&&J(t)?Oi([e,t]):`${e}${t}`},"getAllSync"),fg=o(async(e,t)=>{const[n,r]=await hg(e);return t.isForcefullyTerminated??(t.isForcefullyTerminated=!1),[n,r]},"waitForExit"),hg=o(async e=>{const[t,n]=await Promise.allSettled([z(e,"spawn"),z(e,"exit")]);return t.status==="rejected"?[]:n.status==="rejected"?Ga(e):n.value},"waitForExitOrError"),Ga=o(async e=>{try{return await z(e,"exit")}catch{return Ga(e)}},"waitForSubprocessExit"),Dg=o(async e=>{const[t,n]=await e;if(!pg(t,n)&&za(t,n))throw new ye;return[t,n]},"waitForSuccessfulExit"),pg=o((e,t)=>e===void 0&&t===void 0,"isSubprocessErrorExit"),za=o((e,t)=>e!==0||t!==null,"isFailedExit"),mg=o(({error:e,status:t,signal:n,output:r},{maxBuffer:i})=>{const s=gg(e,t,n),a=s?.code==="ETIMEDOUT",u=HD(s,r,i);return{resultError:s,exitCode:t,signal:n,timedOut:a,isMaxBuffer:u}},"getExitResultSync"),gg=o((e,t,n)=>e!==void 0?e:za(t,n)?new ye:void 0,"getResultError"),Fg=o((e,t,n)=>{const{file:r,commandArguments:i,command:s,escapedCommand:a,startTime:u,verboseInfo:c,options:l,fileDescriptors:d}=wg(e,t,n),f=bg({file:r,commandArguments:i,options:l,command:s,escapedCommand:a,verboseInfo:c,fileDescriptors:d,startTime:u});return pr(f,c,l)},"execaCoreSync"),wg=o((e,t,n)=>{const{command:r,escapedCommand:i,startTime:s,verboseInfo:a}=Ki(e,t,n),u=yg(n),{file:c,commandArguments:l,options:d}=Ps(e,t,u);Eg(d);const f=Cm(d,a);return{file:c,commandArguments:l,command:r,escapedCommand:i,startTime:s,verboseInfo:a,options:d,fileDescriptors:f}},"handleSyncArguments"),yg=o(e=>e.node&&!e.ipc?{...e,ipc:!1}:e,"normalizeSyncOptions"),Eg=o(({ipc:e,ipcInput:t,detached:n,cancelSignal:r})=>{t&&kt("ipcInput"),e&&kt("ipc: true"),n&&kt("detached: true"),r&&kt("cancelSignal")},"validateSyncOptions"),kt=o(e=>{throw new TypeError(`The "${e}" option cannot be used with synchronous methods.`)},"throwInvalidSyncOption"),bg=o(({file:e,commandArguments:t,options:n,command:r,escapedCommand:i,verboseInfo:s,fileDescriptors:a,startTime:u})=>{const c=Cg({file:e,commandArguments:t,options:n,command:r,escapedCommand:i,fileDescriptors:a,startTime:u});if(c.failed)return c;const{resultError:l,exitCode:d,signal:f,timedOut:h,isMaxBuffer:D}=mg(c,n),{output:p,error:m=l}=ig({fileDescriptors:a,syncResult:c,options:n,isMaxBuffer:D,verboseInfo:s}),g=p.map((w,E)=>Le(w,n,E)),F=Le(dg(p,n),n,"all");return vg({error:m,exitCode:d,signal:f,timedOut:h,isMaxBuffer:D,stdio:g,all:F,options:n,command:r,escapedCommand:i,startTime:u})},"spawnSubprocessSync"),Cg=o(({file:e,commandArguments:t,options:n,command:r,escapedCommand:i,fileDescriptors:s,startTime:a})=>{try{Ym(s,n);const u=Sg(n);return Bc(...Ls(e,t,u))}catch(u){return hr({error:u,command:r,escapedCommand:i,fileDescriptors:s,options:n,startTime:a,isSync:!0})}},"runSubprocessSync"),Sg=o(({encoding:e,maxBuffer:t,...n})=>({...n,encoding:"buffer",maxBuffer:fr(t)}),"normalizeSpawnSyncOptions"),vg=o(({error:e,exitCode:t,signal:n,timedOut:r,isMaxBuffer:i,stdio:s,all:a,options:u,command:c,escapedCommand:l,startTime:d})=>e===void 0?sa({command:c,escapedCommand:l,stdio:s,all:a,ipcOutput:[],options:u,startTime:d}):Dr({error:e,command:c,escapedCommand:l,timedOut:r,isCanceled:!1,isGracefullyCanceled:!1,isMaxBuffer:i,isForcefullyTerminated:!1,exitCode:t,signal:n,stdio:s,all:a,ipcOutput:[],options:u,startTime:d,isSync:!0}),"getSyncResult"),Ag=o(({anyProcess:e,channel:t,isSubprocess:n,ipc:r},{reference:i=!0,filter:s}={})=>(Zn({methodName:"getOneMessage",isSubprocess:n,ipc:r,isConnected:$s(e)}),$g({anyProcess:e,channel:t,isSubprocess:n,filter:s,reference:i})),"getOneMessage"),$g=o(async({anyProcess:e,channel:t,isSubprocess:n,filter:r,reference:i})=>{vs(t,i);const s=Tt(e,t,n),a=new AbortController;try{return await Promise.race([Bg(s,r,a),Tg(s,n,a),Ig(s,n,a)])}catch(u){throw Jn(e),u}finally{a.abort(),As(t,i)}},"getOneMessageAsync"),Bg=o(async(e,t,{signal:n})=>{if(t===void 0){const[r]=await z(e,"message",{signal:n});return r}for await(const[r]of mt(e,"message",{signal:n}))if(t(r))return r},"getMessage"),Tg=o(async(e,t,{signal:n})=>{await z(e,"disconnect",{signal:n}),Qf(t)},"throwOnDisconnect"),Ig=o(async(e,t,{signal:n})=>{const[r]=await z(e,"strict:error",{signal:n});throw ys(r,t)},"throwOnStrictError"),Og=o(({anyProcess:e,channel:t,isSubprocess:n,ipc:r},{reference:i=!0}={})=>Va({anyProcess:e,channel:t,isSubprocess:n,ipc:r,shouldAwait:!n,reference:i}),"getEachMessage"),Va=o(({anyProcess:e,channel:t,isSubprocess:n,ipc:r,shouldAwait:i,reference:s})=>{Zn({methodName:"getEachMessage",isSubprocess:n,ipc:r,isConnected:$s(e)}),vs(t,s);const a=Tt(e,t,n),u=new AbortController,c={};return Rg(e,a,u),_g({ipcEmitter:a,isSubprocess:n,controller:u,state:c}),xg({anyProcess:e,channel:t,ipcEmitter:a,isSubprocess:n,shouldAwait:i,controller:u,state:c,reference:s})},"loopOnMessages"),Rg=o(async(e,t,n)=>{try{await z(t,"disconnect",{signal:n.signal}),n.abort()}catch{}},"stopOnDisconnect"),_g=o(async({ipcEmitter:e,isSubprocess:t,controller:n,state:r})=>{try{const[i]=await z(e,"strict:error",{signal:n.signal});r.error=ys(i,t),n.abort()}catch{}},"abortOnStrictError"),xg=o(async function*({anyProcess:e,channel:t,ipcEmitter:n,isSubprocess:r,shouldAwait:i,controller:s,state:a,reference:u}){try{for await(const[c]of mt(n,"message",{signal:s.signal}))Ha(a),yield c}catch{Ha(a)}finally{s.abort(),As(t,u),r||Jn(e),i&&await e}},"iterateOnMessages"),Ha=o(({error:e})=>{if(e)throw e},"throwIfStrictError"),Mg=o((e,{ipc:t})=>{Object.assign(e,Ka(e,!1,t))},"addIpcMethods"),Pg=o(()=>{const e=O,t=!0,n=O.channel!==void 0;return{...Ka(e,t,n),getCancelSignal:_h.bind(void 0,{anyProcess:e,channel:e.channel,isSubprocess:t,ipc:n})}},"getIpcExport"),Ka=o((e,t,n)=>({sendMessage:Ts.bind(void 0,{anyProcess:e,channel:e.channel,isSubprocess:t,ipc:n}),getOneMessage:Ag.bind(void 0,{anyProcess:e,channel:e.channel,isSubprocess:t,ipc:n}),getEachMessage:Og.bind(void 0,{anyProcess:e,channel:e.channel,isSubprocess:t,ipc:n})}),"getIpcMethods"),Lg=o(({error:e,command:t,escapedCommand:n,fileDescriptors:r,options:i,startTime:s,verboseInfo:a})=>{Aa(r);const u=new Co;Ng(u,r),Object.assign(u,{readable:kg,writable:Ug,duplex:jg});const c=hr({error:e,command:t,escapedCommand:n,fileDescriptors:r,options:i,startTime:s,isSync:!1}),l=Wg(c,a,i);return{subprocess:u,promise:l}},"handleEarlyError"),Ng=o((e,t)=>{const n=it(),r=it(),i=it(),s=Array.from({length:t.length-3},it),a=it(),u=[n,r,i,...s];Object.assign(e,{stdin:n,stdout:r,stderr:i,all:a,stdio:u})},"createDummyStreams"),it=o(()=>{const e=new Po;return e.end(),e},"createDummyStream"),kg=o(()=>new ge({read(){}}),"readable"),Ug=o(()=>new hn({write(){}}),"writable"),jg=o(()=>new fn({read(){},write(){}}),"duplex"),Wg=o(async(e,t,n)=>pr(e,t,n),"handleDummyPromise"),Gg=o((e,t)=>va(zg,e,t,!1),"handleStdioAsync"),st=o(({type:e,optionName:t})=>{throw new TypeError(`The \`${t}\` option cannot be ${Nt[e]}.`)},"forbiddenIfAsync"),qa={fileNumber:st,generator:Na,asyncGenerator:Na,nodeStream:o(({value:e})=>({stream:e}),"nodeStream"),webTransform({value:{transform:e,writableObjectMode:t,readableObjectMode:n}}){const r=t||n;return{stream:fn.fromWeb(e,{objectMode:r})}},duplex:o(({value:{transform:e}})=>({stream:e}),"duplex"),native(){}},zg={input:{...qa,fileUrl:o(({value:e})=>({stream:Mo(e)}),"fileUrl"),filePath:o(({value:{file:e}})=>({stream:Mo(e)}),"filePath"),webStream:o(({value:e})=>({stream:ge.fromWeb(e)}),"webStream"),iterable:o(({value:e})=>({stream:ge.from(e)}),"iterable"),asyncIterable:o(({value:e})=>({stream:ge.from(e)}),"asyncIterable"),string:o(({value:e})=>({stream:ge.from(e)}),"string"),uint8Array:o(({value:e})=>({stream:ge.from(Dn.from(e))}),"uint8Array")},output:{...qa,fileUrl:o(({value:e})=>({stream:xo(e)}),"fileUrl"),filePath:o(({value:{file:e,append:t}})=>({stream:xo(e,t?{flags:"a"}:{})}),"filePath"),webStream:o(({value:e})=>({stream:hn.fromWeb(e)}),"webStream"),iterable:st,asyncIterable:st,string:st,uint8Array:st}};var Ya=o(e=>{throw TypeError(e)},"__typeError$1"),Za=o((e,t,n)=>t.has(e)||Ya("Cannot "+n),"__accessCheck$1"),H=o((e,t,n)=>(Za(e,t,"read from private field"),n?n.call(e):t.get(e)),"__privateGet$1"),Ne=o((e,t,n)=>t.has(e)?Ya("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),"__privateAdd$1"),Vg=o((e,t,n,r)=>(Za(e,t,"write to private field"),t.set(e,n),n),"__privateSet$1"),$e,Sr,vr,at,Ut,ut;function Ar(e){if(!Array.isArray(e))throw new TypeError(`Expected an array, got \`${typeof e}\`.`);for(const i of e)Br(i);const t=e.some(({readableObjectMode:i})=>i),n=Hg(e,t),r=new $r({objectMode:t,writableHighWaterMark:n,readableHighWaterMark:n});for(const i of e)r.add(i);return r}o(Ar,"mergeStreams");const Hg=o((e,t)=>{if(e.length===0)return gt(t);const n=e.filter(({readableObjectMode:r})=>r===t).map(({readableHighWaterMark:r})=>r);return Math.max(...n)},"getHighWaterMark"),Do=class Do extends Po{constructor(){super(...arguments),Ne(this,$e,new Set([])),Ne(this,Sr,new Set([])),Ne(this,vr,new Set([])),Ne(this,at),Ne(this,Ut,Symbol("unpipe")),Ne(this,ut,new WeakMap)}add(t){if(Br(t),H(this,$e).has(t))return;H(this,$e).add(t),H(this,at)??Vg(this,at,Kg(this,H(this,$e),H(this,Ut)));const n=Zg({passThroughStream:this,stream:t,streams:H(this,$e),ended:H(this,Sr),aborted:H(this,vr),onFinished:H(this,at),unpipeEvent:H(this,Ut)});H(this,ut).set(t,n),t.pipe(this,{end:!1})}async remove(t){if(Br(t),!H(this,$e).has(t))return!1;const n=H(this,ut).get(t);return n===void 0?!1:(H(this,ut).delete(t),t.unpipe(this),await n,!0)}};o(Do,"MergedStream");let $r=Do;$e=new WeakMap,Sr=new WeakMap,vr=new WeakMap,at=new WeakMap,Ut=new WeakMap,ut=new WeakMap;const Kg=o(async(e,t,n)=>{jt(e,eu);const r=new AbortController;try{await Promise.race([qg(e,r),Yg(e,t,n,r)])}finally{r.abort(),jt(e,-eu)}},"onMergedStreamFinished"),qg=o(async(e,{signal:t})=>{try{await le(e,{signal:t,cleanup:!0})}catch(n){throw Ja(e,n),n}},"onMergedStreamEnd"),Yg=o(async(e,t,n,{signal:r})=>{for await(const[i]of mt(e,"unpipe",{signal:r}))t.has(i)&&i.emit(n)},"onInputStreamsUnpipe"),Br=o(e=>{if(typeof e?.pipe!="function")throw new TypeError(`Expected a readable stream, got: \`${typeof e}\`.`)},"validateStream"),Zg=o(async({passThroughStream:e,stream:t,streams:n,ended:r,aborted:i,onFinished:s,unpipeEvent:a})=>{jt(e,tu);const u=new AbortController;try{await Promise.race([Jg(s,t,u),Xg({passThroughStream:e,stream:t,streams:n,ended:r,aborted:i,controller:u}),Qg({stream:t,streams:n,ended:r,aborted:i,unpipeEvent:a,controller:u})])}finally{u.abort(),jt(e,-tu)}n.size>0&&n.size===r.size+i.size&&(r.size===0&&i.size>0?Tr(e):e0(e))},"endWhenStreamsDone"),Jg=o(async(e,t,{signal:n})=>{try{await e,n.aborted||Tr(t)}catch(r){n.aborted||Ja(t,r)}},"afterMergedStreamFinished"),Xg=o(async({passThroughStream:e,stream:t,streams:n,ended:r,aborted:i,controller:{signal:s}})=>{try{await le(t,{signal:s,cleanup:!0,readable:!0,writable:!1}),n.has(t)&&r.add(t)}catch(a){if(s.aborted||!n.has(t))return;Xa(a)?i.add(t):Qa(e,a)}},"onInputStreamEnd"),Qg=o(async({stream:e,streams:t,ended:n,aborted:r,unpipeEvent:i,controller:{signal:s}})=>{if(await z(e,i,{signal:s}),!e.readable)return z(s,"abort",{signal:s});t.delete(e),n.delete(e),r.delete(e)},"onInputStreamUnpipe"),e0=o(e=>{e.writable&&e.end()},"endStream"),Ja=o((e,t)=>{Xa(t)?Tr(e):Qa(e,t)},"errorOrAbortStream"),Xa=o(e=>e?.code==="ERR_STREAM_PREMATURE_CLOSE","isAbortError"),Tr=o(e=>{(e.readable||e.writable)&&e.destroy()},"abortStream"),Qa=o((e,t)=>{e.destroyed||(e.once("error",t0),e.destroy(t))},"errorStream"),t0=o(()=>{},"noop"),jt=o((e,t)=>{const n=e.getMaxListeners();n!==0&&n!==Number.POSITIVE_INFINITY&&e.setMaxListeners(n+t)},"updateMaxListeners"),eu=2,tu=1,Wt=o((e,t)=>{e.pipe(t),n0(e,t),r0(e,t)},"pipeStreams"),n0=o(async(e,t)=>{if(!(Fe(e)||Fe(t))){try{await le(e,{cleanup:!0,readable:!0,writable:!1})}catch{}nu(t)}},"onSourceFinish"),nu=o(e=>{e.writable&&e.end()},"endDestinationStream"),r0=o(async(e,t)=>{if(!(Fe(e)||Fe(t))){try{await le(t,{cleanup:!0,readable:!1,writable:!0})}catch{}ru(e)}},"onDestinationFinish"),ru=o(e=>{e.readable&&e.destroy()},"abortSourceStream"),o0=o((e,t,n)=>{const r=new Map;for(const[i,{stdioItems:s,direction:a}]of Object.entries(t)){for(const{stream:u}of s.filter(({type:c})=>Ae.has(c)))i0(e,u,a,i);for(const{stream:u}of s.filter(({type:c})=>!Ae.has(c)))a0({subprocess:e,stream:u,direction:a,fdNumber:i,pipeGroups:r,controller:n})}for(const[i,s]of r.entries()){const a=s.length===1?s[0]:Ar(s);Wt(a,i)}},"pipeOutputAsync"),i0=o((e,t,n,r)=>{n==="output"?Wt(e.stdio[r],t):Wt(t,e.stdio[r]);const i=s0[r];i!==void 0&&(e[i]=t),e.stdio[r]=t},"pipeTransform"),s0=["stdin","stdout","stderr"],a0=o(({subprocess:e,stream:t,direction:n,fdNumber:r,pipeGroups:i,controller:s})=>{if(t===void 0)return;u0(t,s);const[a,u]=n==="output"?[t,e.stdio[r]]:[e.stdio[r],t],c=i.get(a)??[];i.set(a,[...c,u])},"pipeStdioItem"),u0=o((e,{signal:t})=>{Fe(e)&&$t(e,c0,t)},"setStandardStreamMaxListeners"),c0=2,ke=[];ke.push("SIGHUP","SIGINT","SIGTERM"),process.platform!=="win32"&&ke.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT"),process.platform==="linux"&&ke.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT");var l0=Object.defineProperty,ou=o(e=>{throw TypeError(e)},"__typeError"),d0=o((e,t,n)=>t in e?l0(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,"__defNormalProp$1"),Gt=o((e,t,n)=>d0(e,typeof t!="symbol"?t+"":t,n),"__publicField$1"),Ir=o((e,t,n)=>t.has(e)||ou("Cannot "+n),"__accessCheck"),A=o((e,t,n)=>(Ir(e,t,"read from private field"),n?n.call(e):t.get(e)),"__privateGet"),De=o((e,t,n)=>t.has(e)?ou("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),"__privateAdd"),Ue=o((e,t,n,r)=>(Ir(e,t,"write to private field"),t.set(e,n),n),"__privateSet"),iu=o((e,t,n)=>(Ir(e,t,"access private method"),n),"__privateMethod"),Or,Z,N,ct,lt,je,Be,zt,su,au;const Vt=o(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","processOk"),Rr=Symbol.for("signal-exit emitter"),_r=globalThis,f0=Object.defineProperty.bind(Object),po=class po{constructor(){if(Gt(this,"emitted",{afterExit:!1,exit:!1}),Gt(this,"listeners",{afterExit:[],exit:[]}),Gt(this,"count",0),Gt(this,"id",Math.random()),_r[Rr])return _r[Rr];f0(_r,Rr,{value:this,writable:!1,enumerable:!1,configurable:!1})}on(t,n){this.listeners[t].push(n)}removeListener(t,n){const r=this.listeners[t],i=r.indexOf(n);i!==-1&&(i===0&&r.length===1?r.length=0:r.splice(i,1))}emit(t,n,r){if(this.emitted[t])return!1;this.emitted[t]=!0;let i=!1;for(const s of this.listeners[t])i=s(n,r)===!0||i;return t==="exit"&&(i=this.emit("afterExit",n,r)||i),i}};o(po,"Emitter");let xr=po;const mo=class mo{};o(mo,"SignalExitBase");let Ht=mo;const h0=o(e=>({onExit(t,n){return e.onExit(t,n)},load(){return e.load()},unload(){return e.unload()}}),"signalExitWrap"),go=class go extends Ht{onExit(){return()=>{}}load(){}unload(){}};o(go,"SignalExitFallback");let Mr=go;const Fo=class Fo extends Ht{constructor(t){super(),De(this,zt),De(this,Or,Lr.platform==="win32"?"SIGINT":"SIGHUP"),De(this,Z,new xr),De(this,N),De(this,ct),De(this,lt),De(this,je,{}),De(this,Be,!1),Ue(this,N,t),Ue(this,je,{});for(const n of ke)A(this,je)[n]=()=>{const r=A(this,N).listeners(n);let{count:i}=A(this,Z);const s=t;if(typeof s.__signal_exit_emitter__=="object"&&typeof s.__signal_exit_emitter__.count=="number"&&(i+=s.__signal_exit_emitter__.count),r.length===i){this.unload();const a=A(this,Z).emit("exit",null,n),u=n==="SIGHUP"?A(this,Or):n;a||t.kill(t.pid,u)}};Ue(this,lt,t.reallyExit),Ue(this,ct,t.emit)}onExit(t,n){if(!Vt(A(this,N)))return()=>{};A(this,Be)===!1&&this.load();const r=n?.alwaysLast?"afterExit":"exit";return A(this,Z).on(r,t),()=>{A(this,Z).removeListener(r,t),A(this,Z).listeners.exit.length===0&&A(this,Z).listeners.afterExit.length===0&&this.unload()}}load(){if(!A(this,Be)){Ue(this,Be,!0),A(this,Z).count+=1;for(const t of ke)try{const n=A(this,je)[t];n&&A(this,N).on(t,n)}catch{}A(this,N).emit=(t,...n)=>iu(this,zt,au).call(this,t,...n),A(this,N).reallyExit=t=>iu(this,zt,su).call(this,t)}}unload(){A(this,Be)&&(Ue(this,Be,!1),ke.forEach(t=>{const n=A(this,je)[t];if(!n)throw new Error("Listener not defined for signal: "+t);try{A(this,N).removeListener(t,n)}catch{}}),A(this,N).emit=A(this,ct),A(this,N).reallyExit=A(this,lt),A(this,Z).count-=1)}};o(Fo,"SignalExit");let Pr=Fo;Or=new WeakMap,Z=new WeakMap,N=new WeakMap,ct=new WeakMap,lt=new WeakMap,je=new WeakMap,Be=new WeakMap,zt=new WeakSet,su=o(function(e){return Vt(A(this,N))?(A(this,N).exitCode=e||0,A(this,Z).emit("exit",A(this,N).exitCode,null),A(this,lt).call(A(this,N),A(this,N).exitCode)):0},"processReallyExit_fn"),au=o(function(e,...t){const n=A(this,ct);if(e==="exit"&&Vt(A(this,N))){typeof t[0]=="number"&&(A(this,N).exitCode=t[0]);const r=n.call(A(this,N),e,...t);return A(this,Z).emit("exit",A(this,N).exitCode,null),r}else return n.call(A(this,N),e,...t)},"processEmit_fn");const Lr=globalThis.process,{onExit:D0}=h0(Vt(Lr)?new Pr(Lr):new Mr),p0=o((e,{cleanup:t,detached:n},{signal:r})=>{if(!t||n)return;const i=D0(()=>{e.kill()});_o(r,()=>{i()})},"cleanupOnExit"),m0=o(({source:e,sourcePromise:t,boundOptions:n,createNested:r},...i)=>{const s=Vi(),{destination:a,destinationStream:u,destinationError:c,from:l,unpipeSignal:d}=g0(n,r,i),{sourceStream:f,sourceError:h}=w0(e,l),{options:D,fileDescriptors:p}=Ee.get(e);return{sourcePromise:t,sourceStream:f,sourceOptions:D,sourceError:h,destination:a,destinationStream:u,destinationError:c,unpipeSignal:d,fileDescriptors:p,startTime:s}},"normalizePipeArguments"),g0=o((e,t,n)=>{try{const{destination:r,pipeOptions:{from:i,to:s,unpipeSignal:a}={}}=F0(e,t,...n),u=Es(r,s);return{destination:r,destinationStream:u,from:i,unpipeSignal:a}}catch(r){return{destinationError:r}}},"getDestinationStream"),F0=o((e,t,n,...r)=>{if(Array.isArray(n))return{destination:t(uu,e)(n,...r),pipeOptions:e};if(typeof n=="string"||n instanceof URL||vi(n)){if(Object.keys(e).length>0)throw new TypeError('Please use .pipe("file", ..., options) or .pipe(execa("file", ..., options)) instead of .pipe(options)("file", ...).');const[i,s,a]=$i(n,...r);return{destination:t(uu)(i,s,a),pipeOptions:a}}if(Ee.has(n)){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:n,pipeOptions:r[0]}}throw new TypeError(`The first argument must be a template string, an options object, or an Execa subprocess: ${n}`)},"getDestination"),uu=o(({options:e})=>({options:{...e,stdin:"pipe",piped:!0}}),"mapDestinationArguments"),w0=o((e,t)=>{try{return{sourceStream:Xn(e,t)}}catch(n){return{sourceError:n}}},"getSourceStream"),y0=o(({sourceStream:e,sourceError:t,destinationStream:n,destinationError:r,fileDescriptors:i,sourceOptions:s,startTime:a})=>{const u=E0({sourceStream:e,sourceError:t,destinationStream:n,destinationError:r});if(u!==void 0)throw cu({error:u,fileDescriptors:i,sourceOptions:s,startTime:a})},"handlePipeArgumentsError"),E0=o(({sourceStream:e,sourceError:t,destinationStream:n,destinationError:r})=>{if(t!==void 0&&r!==void 0)return r;if(r!==void 0)return ru(e),r;if(t!==void 0)return nu(n),t},"getPipeArgumentsError"),cu=o(({error:e,fileDescriptors:t,sourceOptions:n,startTime:r})=>hr({error:e,command:lu,escapedCommand:lu,fileDescriptors:t,options:n,startTime:r,isSync:!1}),"createNonCommandError"),lu="source.pipe(destination)",b0=o(async e=>{const[{status:t,reason:n,value:r=n},{status:i,reason:s,value:a=s}]=await e;if(a.pipedFrom.includes(r)||a.pipedFrom.push(r),i==="rejected")throw a;if(t==="rejected")throw r;return a},"waitForBothSubprocesses"),C0=o((e,t,n)=>{const r=Kt.has(t)?v0(e,t):S0(e,t);return $t(e,$0,n.signal),$t(t,B0,n.signal),A0(t),r},"pipeSubprocessStream"),S0=o((e,t)=>{const n=Ar([e]);return Wt(n,t),Kt.set(t,n),n},"pipeFirstSubprocessStream"),v0=o((e,t)=>{const n=Kt.get(t);return n.add(e),n},"pipeMoreSubprocessStream"),A0=o(async e=>{try{await le(e,{cleanup:!0,readable:!1,writable:!0})}catch{}Kt.delete(e)},"cleanupMergedStreamsMap"),Kt=new WeakMap,$0=2,B0=1,T0=o((e,t)=>e===void 0?[]:[I0(e,t)],"unpipeOnAbort"),I0=o(async(e,{sourceStream:t,mergedStream:n,fileDescriptors:r,sourceOptions:i,startTime:s})=>{await Rc(e,t),await n.remove(t);const a=new Error("Pipe canceled by `unpipeSignal` option.");throw cu({error:a,fileDescriptors:r,sourceOptions:i,startTime:s})},"unpipeOnSignalAbort"),Nr=o((e,...t)=>{if(Y(t[0]))return Nr.bind(void 0,{...e,boundOptions:{...e.boundOptions,...t[0]}});const{destination:n,...r}=m0(e,...t),i=O0({...r,destination:n});return i.pipe=Nr.bind(void 0,{...e,source:n,sourcePromise:i,boundOptions:{}}),i},"pipeToSubprocess"),O0=o(async({sourcePromise:e,sourceStream:t,sourceOptions:n,sourceError:r,destination:i,destinationStream:s,destinationError:a,unpipeSignal:u,fileDescriptors:c,startTime:l})=>{const d=R0(e,i);y0({sourceStream:t,sourceError:r,destinationStream:s,destinationError:a,fileDescriptors:c,sourceOptions:n,startTime:l});const f=new AbortController;try{const h=C0(t,s,f);return await Promise.race([b0(d),...T0(u,{sourceStream:t,mergedStream:h,sourceOptions:n,fileDescriptors:c,startTime:l})])}finally{f.abort()}},"handlePipePromise"),R0=o((e,t)=>Promise.allSettled([e,t]),"getSubprocessPromises"),du=o(({subprocessStdout:e,subprocess:t,binary:n,shouldEncode:r,encoding:i,preserveNewlines:s})=>{const a=new AbortController;return _0(t,a),hu({stream:e,controller:a,binary:n,shouldEncode:!e.readableObjectMode&&r,encoding:i,shouldSplit:!e.readableObjectMode,preserveNewlines:s})},"iterateOnSubprocessStream"),_0=o(async(e,t)=>{try{await e}catch{}finally{t.abort()}},"stopReadingOnExit"),fu=o(({stream:e,onStreamEnd:t,lines:n,encoding:r,stripFinalNewline:i,allMixed:s})=>{const a=new AbortController;x0(t,a,e);const u=e.readableObjectMode&&!s;return hu({stream:e,controller:a,binary:r==="buffer",shouldEncode:!u,encoding:r,shouldSplit:!u&&n,preserveNewlines:!i})},"iterateForResult"),x0=o(async(e,t,n)=>{try{await e}catch{n.destroy()}finally{t.abort()}},"stopReadingOnStreamEnd"),hu=o(({stream:e,controller:t,binary:n,shouldEncode:r,encoding:i,shouldSplit:s,preserveNewlines:a})=>{const u=mt(e,"data",{signal:t.signal,highWaterMark:pu,highWatermark:pu});return M0({onStdoutChunk:u,controller:t,binary:n,shouldEncode:r,encoding:i,shouldSplit:s,preserveNewlines:a})},"iterateOnStream"),Du=gt(!0),pu=Du,M0=o(async function*({onStdoutChunk:e,controller:t,binary:n,shouldEncode:r,encoding:i,shouldSplit:s,preserveNewlines:a}){const u=P0({binary:n,shouldEncode:r,encoding:i,shouldSplit:s,preserveNewlines:a});try{for await(const[c]of e)yield*ot(c,u,0)}catch(c){if(!t.signal.aborted)throw c}finally{yield*Cr(u)}},"iterateOnData"),P0=o(({binary:e,shouldEncode:t,encoding:n,shouldSplit:r,preserveNewlines:i})=>[Ma(e,n,!t),Ia(e,i,!r,{})].filter(Boolean),"getGenerators"),L0=o(async({stream:e,onStreamEnd:t,fdNumber:n,encoding:r,buffer:i,maxBuffer:s,lines:a,allMixed:u,stripFinalNewline:c,verboseInfo:l,streamInfo:d})=>{const f=N0({stream:e,onStreamEnd:t,fdNumber:n,encoding:r,allMixed:u,verboseInfo:l,streamInfo:d});if(!i){await Promise.all([k0(e),f]);return}const h=Ta(c,n),D=fu({stream:e,onStreamEnd:t,lines:a,encoding:r,stripFinalNewline:h,allMixed:u}),[p]=await Promise.all([U0({stream:e,iterable:D,fdNumber:n,encoding:r,maxBuffer:s,lines:a}),f]);return p},"getStreamOutput"),N0=o(async({stream:e,onStreamEnd:t,fdNumber:n,encoding:r,allMixed:i,verboseInfo:s,streamInfo:{fileDescriptors:a}})=>{if(!ja({stdioItems:a[n]?.stdioItems,encoding:r,verboseInfo:s,fdNumber:n}))return;const u=fu({stream:e,onStreamEnd:t,lines:!0,encoding:r,stripFinalNewline:!0,allMixed:i});await ng(u,e,n,s)},"logOutputAsync"),k0=o(async e=>{await Lc(),e.readableFlowing===null&&e.resume()},"resumeStream"),U0=o(async({stream:e,stream:{readableObjectMode:t},iterable:n,fdNumber:r,encoding:i,maxBuffer:s,lines:a})=>{try{return t||a?await yD(n,{maxBuffer:s}):i==="buffer"?new Uint8Array(await vD(n,{maxBuffer:s})):await MD(n,{maxBuffer:s})}catch(u){return gu(jD({error:u,stream:e,readableObjectMode:t,lines:a,encoding:i,fdNumber:r}))}},"getStreamContents"),mu=o(async e=>{try{return await e}catch(t){return gu(t)}},"getBufferedData"),gu=o(({bufferedData:e})=>Jl(e)?new Uint8Array(e):e,"handleBufferedData"),kr=o(async(e,t,n,{isSameDirection:r,stopOnExit:i=!1}={})=>{const s=j0(e,n),a=new AbortController;try{await Promise.race([...i?[n.exitPromise]:[],le(e,{cleanup:!0,signal:a.signal})])}catch(u){s.stdinCleanedUp||z0(u,t,n,r)}finally{a.abort()}},"waitForStream"),j0=o((e,{originalStreams:[t],subprocess:n})=>{const r={stdinCleanedUp:!1};return e===t&&W0(e,n,r),r},"handleStdinDestroy"),W0=o((e,t,n)=>{const{_destroy:r}=e;e._destroy=(...i)=>{G0(t,n),r.call(e,...i)}},"spyOnStdinDestroy"),G0=o(({exitCode:e,signalCode:t},n)=>{(e!==null||t!==null)&&(n.stdinCleanedUp=!0)},"setStdinCleanedUp"),z0=o((e,t,n,r)=>{if(!V0(e,t,n,r))throw e},"handleStreamError"),V0=o((e,t,n,r=!0)=>n.propagating?wu(e)||Ur(e):(n.propagating=!0,Fu(n,t)===r?wu(e):Ur(e)),"shouldIgnoreStreamError"),Fu=o(({fileDescriptors:e},t)=>t!=="all"&&e[t].direction==="input","isInputFileDescriptor"),Ur=o(e=>e?.code==="ERR_STREAM_PREMATURE_CLOSE","isStreamAbort"),wu=o(e=>e?.code==="EPIPE","isStreamEpipe"),H0=o(({subprocess:e,encoding:t,buffer:n,maxBuffer:r,lines:i,stripFinalNewline:s,verboseInfo:a,streamInfo:u})=>e.stdio.map((c,l)=>yu({stream:c,fdNumber:l,encoding:t,buffer:n[l],maxBuffer:r[l],lines:i[l],allMixed:!1,stripFinalNewline:s,verboseInfo:a,streamInfo:u})),"waitForStdioStreams"),yu=o(async({stream:e,fdNumber:t,encoding:n,buffer:r,maxBuffer:i,lines:s,allMixed:a,stripFinalNewline:u,verboseInfo:c,streamInfo:l})=>{if(!e)return;const d=kr(e,t,l);if(Fu(l,t)){await d;return}const[f]=await Promise.all([L0({stream:e,onStreamEnd:d,fdNumber:t,encoding:n,buffer:r,maxBuffer:i,lines:s,allMixed:a,stripFinalNewline:u,verboseInfo:c,streamInfo:l}),d]);return f},"waitForSubprocessStream"),K0=o(({stdout:e,stderr:t},{all:n})=>n&&(e||t)?Ar([e,t].filter(Boolean)):void 0,"makeAllStream"),q0=o(({subprocess:e,encoding:t,buffer:n,maxBuffer:r,lines:i,stripFinalNewline:s,verboseInfo:a,streamInfo:u})=>yu({...Y0(e,n),fdNumber:"all",encoding:t,maxBuffer:r[1]+r[2],lines:i[1]||i[2],allMixed:Z0(e),stripFinalNewline:s,verboseInfo:a,streamInfo:u}),"waitForAllStream"),Y0=o(({stdout:e,stderr:t,all:n},[,r,i])=>{const s=r||i;return s?r?i?{stream:n,buffer:s}:{stream:e,buffer:s}:{stream:t,buffer:s}:{stream:n,buffer:s}},"getAllStream"),Z0=o(({all:e,stdout:t,stderr:n})=>e&&t&&n&&t.readableObjectMode!==n.readableObjectMode,"getAllMixed"),J0=o(e=>In(e,"ipc"),"shouldLogIpc"),X0=o((e,t)=>{const n=zi(e);Je({type:"ipc",verboseMessage:n,fdNumber:"ipc",verboseInfo:t})},"logIpcOutput"),Q0=o(async({subprocess:e,buffer:t,maxBuffer:n,ipc:r,ipcOutput:i,verboseInfo:s})=>{if(!r)return i;const a=J0(s),u=Ze(t,"ipc"),c=Ze(n,"ipc");for await(const l of Va({anyProcess:e,channel:e.channel,isSubprocess:!1,ipc:r,shouldAwait:!1,reference:!0}))u&&(GD(e,i,c),i.push(l)),a&&X0(l,s);return i},"waitForIpcOutput"),e2=o(async(e,t)=>(await Promise.allSettled([e]),t),"getBufferedIpcOutput"),t2=o(async({subprocess:e,options:{encoding:t,buffer:n,maxBuffer:r,lines:i,timeoutDuration:s,cancelSignal:a,gracefulCancel:u,forceKillAfterDelay:c,stripFinalNewline:l,ipc:d,ipcInput:f},context:h,verboseInfo:D,fileDescriptors:p,originalStreams:m,onInternalError:g,controller:F})=>{const w=fg(e,h),E={originalStreams:m,fileDescriptors:p,subprocess:e,exitPromise:w,propagating:!1},y=H0({subprocess:e,encoding:t,buffer:n,maxBuffer:r,lines:i,stripFinalNewline:l,verboseInfo:D,streamInfo:E}),b=q0({subprocess:e,encoding:t,buffer:n,maxBuffer:r,lines:i,stripFinalNewline:l,verboseInfo:D,streamInfo:E}),S=[],$=Q0({subprocess:e,buffer:n,maxBuffer:r,ipc:d,ipcOutput:S,verboseInfo:D}),B=n2(m,e,E),I=r2(p,E);try{return await Promise.race([Promise.all([{},Dg(w),Promise.all(y),b,$,Yh(e,f),...B,...I]),g,o2(e,F),...jh(e,s,h,F),...Zf({subprocess:e,cancelSignal:a,gracefulCancel:u,context:h,controller:F}),...Lh({subprocess:e,cancelSignal:a,gracefulCancel:u,forceKillAfterDelay:c,context:h,controller:F})])}catch(G){return h.terminationReason??(h.terminationReason="other"),Promise.all([{error:G},w,Promise.all(y.map(L=>mu(L))),mu(b),e2($,S),Promise.allSettled(B),Promise.allSettled(I)])}},"waitForSubprocessResult"),n2=o((e,t,n)=>e.map((r,i)=>r===t.stdio[i]?void 0:kr(r,i,n)),"waitForOriginalStreams"),r2=o((e,t)=>e.flatMap(({stdioItems:n},r)=>n.filter(({value:i,stream:s=i})=>Ce(s,{checkOpen:!1})&&!Fe(s)).map(({type:i,value:s,stream:a=s})=>kr(a,r,t,{isSameDirection:Ae.has(i),stopOnExit:i==="native"}))),"waitForCustomStreamsEnd"),o2=o(async(e,{signal:t})=>{const[n]=await z(e,"error",{signal:t});throw n},"throwOnSubprocessError"),i2=o(()=>({readableDestroy:new WeakMap,writableFinal:new WeakMap,writableDestroy:new WeakMap}),"initializeConcurrentStreams"),jr=o((e,t,n)=>{const r=e[n];r.has(t)||r.set(t,[]);const i=r.get(t),s=et();return i.push(s),{resolve:s.resolve.bind(s),promises:i}},"addConcurrentStream"),qt=o(async({resolve:e,promises:t},n)=>{e();const[r]=await Promise.race([Promise.allSettled([!0,n]),Promise.all([!1,...t])]);return!r},"waitForConcurrentStreams"),Eu=o(async e=>{if(e!==void 0)try{await bu(e)}catch{}},"safeWaitForSubprocessStdin"),s2=o(async e=>{if(e!==void 0)try{await Cu(e)}catch{}},"safeWaitForSubprocessStdout"),bu=o(async e=>{await le(e,{cleanup:!0,readable:!1,writable:!0})},"waitForSubprocessStdin"),Cu=o(async e=>{await le(e,{cleanup:!0,readable:!0,writable:!1})},"waitForSubprocessStdout"),Su=o(async(e,t)=>{if(await e,t)throw t},"waitForSubprocess"),vu=o((e,t,n)=>{n&&!Ur(n)?e.destroy(n):t&&e.destroy()},"destroyOtherStream"),a2=o(({subprocess:e,concurrentStreams:t,encoding:n},{from:r,binary:i=!0,preserveNewlines:s=!0}={})=>{const a=i||be.has(n),{subprocessStdout:u,waitReadableDestroy:c}=Au(e,r,t),{readableEncoding:l,readableObjectMode:d,readableHighWaterMark:f}=$u(u,a),{read:h,onStdoutDataDone:D}=Bu({subprocessStdout:u,subprocess:e,binary:a,encoding:n,preserveNewlines:s}),p=new ge({read:h,destroy:Re(Iu.bind(void 0,{subprocessStdout:u,subprocess:e,waitReadableDestroy:c})),highWaterMark:f,objectMode:d,encoding:l});return Tu({subprocessStdout:u,onStdoutDataDone:D,readable:p,subprocess:e}),p},"createReadable"),Au=o((e,t,n)=>{const r=Xn(e,t),i=jr(n,r,"readableDestroy");return{subprocessStdout:r,waitReadableDestroy:i}},"getSubprocessStdout"),$u=o(({readableEncoding:e,readableObjectMode:t,readableHighWaterMark:n},r)=>r?{readableEncoding:e,readableObjectMode:t,readableHighWaterMark:n}:{readableEncoding:e,readableObjectMode:!0,readableHighWaterMark:Du},"getReadableOptions"),Bu=o(({subprocessStdout:e,subprocess:t,binary:n,encoding:r,preserveNewlines:i})=>{const s=et(),a=du({subprocessStdout:e,subprocess:t,binary:n,shouldEncode:!n,encoding:r,preserveNewlines:i});return{read(){u2(this,a,s)},onStdoutDataDone:s}},"getReadableMethods"),u2=o(async(e,t,n)=>{try{const{value:r,done:i}=await t.next();i?n.resolve():e.push(r)}catch{}},"onRead"),Tu=o(async({subprocessStdout:e,onStdoutDataDone:t,readable:n,subprocess:r,subprocessStdin:i})=>{try{await Cu(e),await r,await Eu(i),await t,n.readable&&n.push(null)}catch(s){await Eu(i),Ou(n,s)}},"onStdoutFinished"),Iu=o(async({subprocessStdout:e,subprocess:t,waitReadableDestroy:n},r)=>{await qt(n,t)&&(Ou(e,r),await Su(t,r))},"onReadableDestroy"),Ou=o((e,t)=>{vu(e,e.readable,t)},"destroyOtherReadable"),c2=o(({subprocess:e,concurrentStreams:t},{to:n}={})=>{const{subprocessStdin:r,waitWritableFinal:i,waitWritableDestroy:s}=Ru(e,n,t),a=new hn({..._u(r,e,i),destroy:Re(Mu.bind(void 0,{subprocessStdin:r,subprocess:e,waitWritableFinal:i,waitWritableDestroy:s})),highWaterMark:r.writableHighWaterMark,objectMode:r.writableObjectMode});return xu(r,a),a},"createWritable"),Ru=o((e,t,n)=>{const r=Es(e,t),i=jr(n,r,"writableFinal"),s=jr(n,r,"writableDestroy");return{subprocessStdin:r,waitWritableFinal:i,waitWritableDestroy:s}},"getSubprocessStdin"),_u=o((e,t,n)=>({write:l2.bind(void 0,e),final:Re(d2.bind(void 0,e,t,n))}),"getWritableMethods"),l2=o((e,t,n,r)=>{e.write(t,n)?r():e.once("drain",r)},"onWrite"),d2=o(async(e,t,n)=>{await qt(n,t)&&(e.writable&&e.end(),await t)},"onWritableFinal"),xu=o(async(e,t,n)=>{try{await bu(e),t.writable&&t.end()}catch(r){await s2(n),Pu(t,r)}},"onStdinFinished"),Mu=o(async({subprocessStdin:e,subprocess:t,waitWritableFinal:n,waitWritableDestroy:r},i)=>{await qt(n,t),await qt(r,t)&&(Pu(e,i),await Su(t,i))},"onWritableDestroy"),Pu=o((e,t)=>{vu(e,e.writable,t)},"destroyOtherWritable"),f2=o(({subprocess:e,concurrentStreams:t,encoding:n},{from:r,to:i,binary:s=!0,preserveNewlines:a=!0}={})=>{const u=s||be.has(n),{subprocessStdout:c,waitReadableDestroy:l}=Au(e,r,t),{subprocessStdin:d,waitWritableFinal:f,waitWritableDestroy:h}=Ru(e,i,t),{readableEncoding:D,readableObjectMode:p,readableHighWaterMark:m}=$u(c,u),{read:g,onStdoutDataDone:F}=Bu({subprocessStdout:c,subprocess:e,binary:u,encoding:n,preserveNewlines:a}),w=new fn({read:g,..._u(d,e,f),destroy:Re(h2.bind(void 0,{subprocessStdout:c,subprocessStdin:d,subprocess:e,waitReadableDestroy:l,waitWritableFinal:f,waitWritableDestroy:h})),readableHighWaterMark:m,writableHighWaterMark:d.writableHighWaterMark,readableObjectMode:p,writableObjectMode:d.writableObjectMode,encoding:D});return Tu({subprocessStdout:c,onStdoutDataDone:F,readable:w,subprocess:e,subprocessStdin:d}),xu(d,w,c),w},"createDuplex"),h2=o(async({subprocessStdout:e,subprocessStdin:t,subprocess:n,waitReadableDestroy:r,waitWritableFinal:i,waitWritableDestroy:s},a)=>{await Promise.all([Iu({subprocessStdout:e,subprocess:n,waitReadableDestroy:r},a),Mu({subprocessStdin:t,subprocess:n,waitWritableFinal:i,waitWritableDestroy:s},a)])},"onDuplexDestroy"),Lu=o((e,t,{from:n,binary:r=!1,preserveNewlines:i=!1}={})=>{const s=r||be.has(t),a=Xn(e,n),u=du({subprocessStdout:a,subprocess:e,binary:s,shouldEncode:!0,encoding:t,preserveNewlines:i});return D2(u,a,e)},"createIterable"),D2=o(async function*(e,t,n){try{yield*e}finally{t.readable&&t.destroy(),await n}},"iterateOnStdoutData"),p2=o((e,{encoding:t})=>{const n=i2();e.readable=a2.bind(void 0,{subprocess:e,concurrentStreams:n,encoding:t}),e.writable=c2.bind(void 0,{subprocess:e,concurrentStreams:n}),e.duplex=f2.bind(void 0,{subprocess:e,concurrentStreams:n,encoding:t}),e.iterable=Lu.bind(void 0,e,t),e[Symbol.asyncIterator]=Lu.bind(void 0,e,t,{})},"addConvertedStreams"),m2=o((e,t)=>{for(const[n,r]of F2){const i=r.value.bind(t);Reflect.defineProperty(e,n,{...r,value:i})}},"mergePromise"),g2=(async()=>{})().constructor.prototype,F2=["then","catch","finally"].map(e=>[e,Reflect.getOwnPropertyDescriptor(g2,e)]),w2=o((e,t,n,r)=>{const{file:i,commandArguments:s,command:a,escapedCommand:u,startTime:c,verboseInfo:l,options:d,fileDescriptors:f}=y2(e,t,n),{subprocess:h,promise:D}=b2({file:i,commandArguments:s,options:d,startTime:c,verboseInfo:l,command:a,escapedCommand:u,fileDescriptors:f});return h.pipe=Nr.bind(void 0,{source:h,sourcePromise:D,boundOptions:{},createNested:r}),m2(h,D),Ee.set(h,{options:d,fileDescriptors:f}),h},"execaCoreAsync"),y2=o((e,t,n)=>{const{command:r,escapedCommand:i,startTime:s,verboseInfo:a}=Ki(e,t,n),{file:u,commandArguments:c,options:l}=Ps(e,t,n),d=E2(l),f=Gg(d,a);return{file:u,commandArguments:c,command:r,escapedCommand:i,startTime:s,verboseInfo:a,options:d,fileDescriptors:f}},"handleAsyncArguments"),E2=o(({timeout:e,signal:t,...n})=>{if(t!==void 0)throw new TypeError('The "signal" option has been renamed to "cancelSignal" instead.');return{...n,timeoutDuration:e}},"handleAsyncOptions"),b2=o(({file:e,commandArguments:t,options:n,startTime:r,verboseInfo:i,command:s,escapedCommand:a,fileDescriptors:u})=>{let c;try{c=Tc(...Ls(e,t,n))}catch(p){return Lg({error:p,command:s,escapedCommand:a,fileDescriptors:u,options:n,startTime:r,verboseInfo:i})}const l=new AbortController;kc(Number.POSITIVE_INFINITY,l.signal);const d=[...c.stdio];o0(c,u,l),p0(c,n,l);const f={},h=et();c.kill=Vf.bind(void 0,{kill:c.kill.bind(c),options:n,onInternalError:h,context:f,controller:l}),c.all=K0(c,n),p2(c,n),Mg(c,n);const D=C2({subprocess:c,options:n,startTime:r,verboseInfo:i,fileDescriptors:u,originalStreams:d,command:s,escapedCommand:a,context:f,onInternalError:h,controller:l});return{subprocess:c,promise:D}},"spawnSubprocessAsync"),C2=o(async({subprocess:e,options:t,startTime:n,verboseInfo:r,fileDescriptors:i,originalStreams:s,command:a,escapedCommand:u,context:c,onInternalError:l,controller:d})=>{const[f,[h,D],p,m,g]=await t2({subprocess:e,options:t,context:c,verboseInfo:r,fileDescriptors:i,originalStreams:s,onInternalError:l,controller:d});d.abort(),l.resolve();const F=p.map((y,b)=>Le(y,t,b)),w=Le(m,t,"all"),E=S2({errorInfo:f,exitCode:h,signal:D,stdio:F,all:w,ipcOutput:g,context:c,options:t,command:a,escapedCommand:u,startTime:n});return pr(E,r,t)},"handlePromise"),S2=o(({errorInfo:e,exitCode:t,signal:n,stdio:r,all:i,ipcOutput:s,context:a,options:u,command:c,escapedCommand:l,startTime:d})=>"error"in e?Dr({error:e.error,command:c,escapedCommand:l,timedOut:a.terminationReason==="timeout",isCanceled:a.terminationReason==="cancel"||a.terminationReason==="gracefulCancel",isGracefullyCanceled:a.terminationReason==="gracefulCancel",isMaxBuffer:e.error instanceof xe,isForcefullyTerminated:a.isForcefullyTerminated,exitCode:t,signal:n,stdio:r,all:i,ipcOutput:s,options:u,startTime:d,isSync:!1}):sa({command:c,escapedCommand:l,stdio:r,all:i,ipcOutput:s,options:u,startTime:d}),"getAsyncResult"),Wr=o((e,t)=>{const n=Object.fromEntries(Object.entries(t).map(([r,i])=>[r,v2(r,e[r],i)]));return{...e,...n}},"mergeOptions"),v2=o((e,t,n)=>A2.has(e)&&Y(t)&&Y(n)?{...t,...n}:n,"mergeOption"),A2=new Set(["env",...ki]),Te=o((e,t,n,r)=>{const i=o((a,u,c)=>Te(a,u,n,c),"createNested"),s=o((...a)=>$2({mapArguments:e,deepOptions:n,boundOptions:t,setBoundExeca:r,createNested:i},...a),"boundExeca");return r!==void 0&&r(s,i,t),s},"createExeca"),$2=o(({mapArguments:e,deepOptions:t={},boundOptions:n={},setBoundExeca:r,createNested:i},s,...a)=>{if(Y(s))return i(e,Wr(n,s),r);const{file:u,commandArguments:c,options:l,isSync:d}=B2({mapArguments:e,firstArgument:s,nextArguments:a,deepOptions:t,boundOptions:n});return d?Fg(u,c,l):w2(u,c,l,i)},"callBoundExeca"),B2=o(({mapArguments:e,firstArgument:t,nextArguments:n,deepOptions:r,boundOptions:i})=>{const s=od(t)?id(t,n):[t,...n],[a,u,c]=$i(...s),l=Wr(Wr(r,i),c),{file:d=a,commandArguments:f=u,options:h=l,isSync:D=!1}=e({file:a,commandArguments:u,options:l});return{file:d,commandArguments:f,options:h,isSync:D}},"parseArguments"),T2=o(({file:e,commandArguments:t})=>Nu(e,t),"mapCommandAsync"),I2=o(({file:e,commandArguments:t})=>({...Nu(e,t),isSync:!0}),"mapCommandSync"),Nu=o((e,t)=>{if(t.length>0)throw new TypeError(`The command and its arguments must be passed as a single string: ${e} ${t}.`);const[n,...r]=O2(e);return{file:n,commandArguments:r}},"parseCommand"),O2=o(e=>{if(typeof e!="string")throw new TypeError(`The command must be a string: ${String(e)}.`);const t=e.trim();if(t==="")return[];const n=[];for(const r of t.split(R2)){const i=n.at(-1);i&&i.endsWith("\\")?n[n.length-1]=`${i.slice(0,-1)} ${r}`:n.push(r)}return n},"parseCommandString"),R2=/ +/g,_2=o((e,t,n)=>{e.sync=t(M2,n),e.s=e.sync},"setScriptSync"),x2=o(({options:e})=>ku(e),"mapScriptAsync"),M2=o(({options:e})=>({...ku(e),isSync:!0}),"mapScriptSync"),ku=o(e=>({options:{...P2(e),...e}}),"getScriptOptions"),P2=o(({input:e,inputFile:t,stdio:n})=>e===void 0&&t===void 0&&n===void 0?{stdin:"inherit"}:{},"getScriptStdinOption"),L2={preferLocal:!0},We=Te(()=>({}));Te(()=>({isSync:!0})),Te(T2),Te(I2),Te(Gh),Te(x2,{},L2,_2),Pg();let Ie=!0;const Ge=typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{};let dt=0;if(Ge.process&&Ge.process.env&&Ge.process.stdout){const{FORCE_COLOR:e,NODE_DISABLE_COLORS:t,NO_COLOR:n,TERM:r,COLORTERM:i}=Ge.process.env;t||n||e==="0"?Ie=!1:e==="1"||e==="2"||e==="3"?Ie=!0:r==="dumb"?Ie=!1:"CI"in Ge.process.env&&["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE","DRONE"].some(s=>s in Ge.process.env)?Ie=!0:Ie=process.stdout.isTTY,Ie&&(process.platform==="win32"||i&&(i==="truecolor"||i==="24bit")?dt=3:r&&(r.endsWith("-256color")||r.endsWith("256"))?dt=2:dt=1)}let Uu={enabled:Ie,supportLevel:dt};function ft(e,t,n=1){const r=`\x1B[${e}m`,i=`\x1B[${t}m`,s=new RegExp(`\\x1b\\[${t}m`,"g");return a=>Uu.enabled&&Uu.supportLevel>=n?r+(""+a).replace(s,r)+i:""+a}o(ft,"kolorist");const Gr=ft(2,22),ju=ft(30,39),Yt=ft(31,39),ht=ft(32,39),Wu=ft(46,49),N2=(()=>{const e=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g;return t=>{let n=0;for(e.lastIndex=0;e.test(t);)n+=1;return t.length-n}})(),k2=o(e=>e===12288||e>=65281&&e<=65376||e>=65504&&e<=65510,"isFullWidth"),U2=o(e=>e===8987||e===9001||e>=12272&&e<=12287||e>=12289&&e<=12350||e>=12441&&e<=12543||e>=12549&&e<=12591||e>=12593&&e<=12686||e>=12688&&e<=12771||e>=12783&&e<=12830||e>=12832&&e<=12871||e>=12880&&e<=19903||e>=65040&&e<=65049||e>=65072&&e<=65106||e>=65108&&e<=65126||e>=65128&&e<=65131||e>=127488&&e<=127490||e>=127504&&e<=127547||e>=127552&&e<=127560||e>=131072&&e<=196605||e>=196608&&e<=262141,"isWideNotCJKTNotEmoji"),j2=/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]|\u001b\]8;[^;]*;.*?(?:\u0007|\u001b\u005c)/y,W2=/[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y,Gu=/(?:(?![\uFF61-\uFF9F\uFF00-\uFFEF])[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}\p{Script=Tangut}]){1,1000}/yu,G2=/\t{1,1000}/y,zu=new RegExp("[\\u{1F1E6}-\\u{1F1FF}]{2}|\\u{1F3F4}[\\u{E0061}-\\u{E007A}]{2}[\\u{E0030}-\\u{E0039}\\u{E0061}-\\u{E007A}]{1,3}\\u{E007F}|(?:\\p{Emoji}\\uFE0F\\u20E3?|\\p{Emoji_Modifier_Base}\\p{Emoji_Modifier}?|\\p{Emoji_Presentation})(?:\\u200D(?:\\p{Emoji_Modifier_Base}\\p{Emoji_Modifier}?|\\p{Emoji_Presentation}|\\p{Emoji}\\uFE0F\\u20E3?))*","yu"),z2=/(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y,V2=new RegExp("\\p{M}+","gu"),H2={limit:1/0,ellipsis:""},Vu=o((e,t={},n={})=>{const r=t.limit??1/0,i=t.ellipsis??"",s=t?.ellipsisWidth??(i?Vu(i,H2,n).width:0),a=0,u=n.controlWidth??0,c=n.tabWidth??8,l=n.emojiWidth??2,d=2,f=n.regularWidth??1,h=n.wideWidth??d,D=[[z2,f],[j2,a],[W2,u],[G2,c],[zu,l],[Gu,h]];let p=0,m=0,g=e.length,F=0,w=!1,E=g,y=Math.max(0,r-s),b=0,S=0,$=0,B=0;e:for(;;){if(S>b||m>=g&&m>p){const I=e.slice(b,S)||e.slice(p,m);F=0;for(const G of I.replaceAll(V2,"")){const L=G.codePointAt(0)||0;if(k2(L)?B=d:U2(L)?B=h:B=f,$+B>y&&(E=Math.min(E,Math.max(b,p)+F)),$+B>r){w=!0;break e}F+=G.length,$+=B}b=S=0}if(m>=g)break e;for(let I=0,G=D.length;I<G;I++){const[L,Dt]=D[I];if(L.lastIndex=m,L.test(e)){if(F=L===Gu?N2(e.slice(m,L.lastIndex)):L===zu?1:L.lastIndex-m,B=F*Dt,$+B>y&&(E=Math.min(E,m+Math.floor((y-$)/Dt))),$+B>r){w=!0;break e}$+=B,b=p,S=m,m=p=L.lastIndex;continue e}}m+=1}return{width:w?y:$,index:w?E:g,truncated:w,ellipsed:w&&r>=s}},"getStringTruncatedWidth"),K2={limit:1/0,ellipsis:"",ellipsisWidth:0},pe=o((e,t={})=>Vu(e,K2,t).width,"fastStringWidth"),Zt="\x1B",Hu="\x9B",q2=39,zr="\x07",Ku="[",Y2="]",qu="m",Vr=`${Y2}8;;`,Yu=new RegExp(`(?:\\${Ku}(?<code>\\d+)m|\\${Vr}(?<uri>.*)${zr})`,"y"),Zu=o(e=>{if(e>=30&&e<=37||e>=90&&e<=97)return 39;if(e>=40&&e<=47||e>=100&&e<=107)return 49;if(e===1||e===2)return 22;if(e===3)return 23;if(e===4)return 24;if(e===7)return 27;if(e===8)return 28;if(e===9)return 29;if(e===0)return 0},"getClosingCode"),Ju=o(e=>`${Zt}${Ku}${e}${qu}`,"wrapAnsiCode"),Xu=o(e=>`${Zt}${Vr}${e}${zr}`,"wrapAnsiHyperlink"),Hr=o((e,t,n)=>{const r=t[Symbol.iterator]();let i=!1,s=!1,a=e.at(-1),u=a===void 0?0:pe(a),c=r.next(),l=r.next(),d=0;for(;!c.done;){const f=c.value,h=pe(f);u+h<=n?e[e.length-1]+=f:(e.push(f),u=0),(f===Zt||f===Hu)&&(i=!0,s=t.startsWith(Vr,d+1)),i?s?f===zr&&(i=!1,s=!1):f===qu&&(i=!1):(u+=h,u===n&&!l.done&&(e.push(""),u=0)),c=l,l=r.next(),d+=f.length}a=e.at(-1),!u&&a!==void 0&&a.length&&e.length>1&&(e[e.length-2]+=e.pop())},"wrapWord"),Z2=o(e=>{const t=e.split(" ");let n=t.length;for(;n&&!pe(t[n-1]);)n--;return n===t.length?e:t.slice(0,n).join(" ")+t.slice(n).join("")},"stringVisibleTrimSpacesRight"),J2=o((e,t,n={})=>{if(n.trim!==!1&&e.trim()==="")return"";let r="",i,s;const a=e.split(" ");let u=[""],c=0;for(let f=0;f<a.length;f++){const h=a[f];if(n.trim!==!1){const p=u.at(-1)??"",m=p.trimStart();p.length!==m.length&&(u[u.length-1]=m,c=pe(m))}f!==0&&(c>=t&&(n.wordWrap===!1||n.trim===!1)&&(u.push(""),c=0),(c||n.trim===!1)&&(u[u.length-1]+=" ",c++));const D=pe(h);if(n.hard&&D>t){const p=t-c,m=1+Math.floor((D-p-1)/t);Math.floor((D-1)/t)<m&&u.push(""),Hr(u,h,t),c=pe(u.at(-1)??"");continue}if(c+D>t&&c&&D){if(n.wordWrap===!1&&c<t){Hr(u,h,t),c=pe(u.at(-1)??"");continue}u.push(""),c=0}if(c+D>t&&n.wordWrap===!1){Hr(u,h,t),c=pe(u.at(-1)??"");continue}u[u.length-1]+=h,c+=D}n.trim!==!1&&(u=u.map(f=>Z2(f)));const l=u.join(`
|
|
65
|
+
`);let d=!1;for(let f=0;f<l.length;f++){const h=l[f];if(r+=h,d)d=!1;else if(d=h>="\uD800"&&h<="\uDBFF",d)continue;if(h===Zt||h===Hu){Yu.lastIndex=f+1;const p=Yu.exec(l)?.groups;if(p?.code!==void 0){const m=Number.parseFloat(p.code);i=m===q2?void 0:m}else p?.uri!==void 0&&(s=p.uri.length===0?void 0:p.uri)}if(l[f+1]===`
|
|
66
|
+
`){s&&(r+=Xu(""));const D=i?Zu(i):void 0;i&&D&&(r+=Ju(D))}else h===`
|
|
67
|
+
`&&(i&&Zu(i)&&(r+=Ju(i)),s&&(r+=Xu(s)))}return r},"exec"),X2=/\r?\n/;function ze(e,t,n){return String(e).normalize().split(X2).map(r=>J2(r,t,n)).join(`
|
|
68
|
+
`)}o(ze,"wrapAnsi");var Kr,Qu;function Q2(){if(Qu)return Kr;Qu=1;const e="\x1B",t=`${e}[`,n="\x07",r={to(a,u){return u?`${t}${u+1};${a+1}H`:`${t}${a+1}G`},move(a,u){let c="";return a<0?c+=`${t}${-a}D`:a>0&&(c+=`${t}${a}C`),u<0?c+=`${t}${-u}A`:u>0&&(c+=`${t}${u}B`),c},up:o((a=1)=>`${t}${a}A`,"up"),down:o((a=1)=>`${t}${a}B`,"down"),forward:o((a=1)=>`${t}${a}C`,"forward"),backward:o((a=1)=>`${t}${a}D`,"backward"),nextLine:o((a=1)=>`${t}E`.repeat(a),"nextLine"),prevLine:o((a=1)=>`${t}F`.repeat(a),"prevLine"),left:`${t}G`,hide:`${t}?25l`,show:`${t}?25h`,save:`${e}7`,restore:`${e}8`},i={up:o((a=1)=>`${t}S`.repeat(a),"up"),down:o((a=1)=>`${t}T`.repeat(a),"down")},s={screen:`${t}2J`,up:o((a=1)=>`${t}1J`.repeat(a),"up"),down:o((a=1)=>`${t}J`.repeat(a),"down"),line:`${t}2K`,lineEnd:`${t}K`,lineStart:`${t}1K`,lines(a){let u="";for(let c=0;c<a;c++)u+=this.line+(c<a-1?r.up():"");return a&&(u+=r.left),u}};return Kr={cursor:r,scroll:i,erase:s,beep:n},Kr}o(Q2,"requireSrc");var U=Q2(),eF=Object.defineProperty,tF=o((e,t,n)=>t in e?eF(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,"__defNormalProp"),j=o((e,t,n)=>tF(e,typeof t!="symbol"?t+"":t,n),"__publicField");function Jt(e,t,n){if(!n.some(a=>!a.disabled))return e;const r=e+t,i=Math.max(n.length-1,0),s=r<0?i:r>i?0:r;return n[s]?.disabled?Jt(s,t<0?-1:1,n):s}o(Jt,"findCursor");const nF=["up","down","left","right","space","enter","cancel"],ae={actions:new Set(nF),aliases:new Map([["k","up"],["j","down"],["h","left"],["l","right"],["","cancel"],["escape","cancel"]]),messages:{cancel:"Canceled",error:"Something went wrong"},withGuide:!0};function qr(e,t){if(typeof e=="string")return ae.aliases.get(e)===t;for(const n of e)if(n!==void 0&&qr(n,t))return!0;return!1}o(qr,"isActionKey");function rF(e,t){if(e===t)return;const n=e.split(`
|
|
69
|
+
`),r=t.split(`
|
|
70
|
+
`),i=Math.max(n.length,r.length),s=[];for(let a=0;a<i;a++)n[a]!==r[a]&&s.push(a);return{lines:s,numLinesBefore:n.length,numLinesAfter:r.length,numLines:i}}o(rF,"diffLines");const oF=globalThis.process.platform.startsWith("win"),Yr=Symbol("clack:cancel");function ec(e){return e===Yr}o(ec,"isCancel");function Xt(e,t){const n=e;n.isTTY&&n.setRawMode(t)}o(Xt,"setRawMode");function iF({input:e=Bo,output:t=cn,overwrite:n=!0,hideCursor:r=!0}={}){const i=Ft.createInterface({input:e,output:t,prompt:"",tabSize:1});Ft.emitKeypressEvents(e,i),e instanceof Io&&e.isTTY&&e.setRawMode(!0);const s=o((a,{name:u,sequence:c})=>{const l=String(a);if(qr([l,u,c],"cancel")){r&&t.write(U.cursor.show),process.exit(0);return}if(!n)return;const d=u==="return"?0:-1,f=u==="return"?-1:0;Ft.moveCursor(t,d,f,()=>{Ft.clearLine(t,1,()=>{e.once("keypress",s)})})},"n3");return r&&t.write(U.cursor.hide),e.once("keypress",s),()=>{e.off("keypress",s),r&&t.write(U.cursor.show),e instanceof Io&&e.isTTY&&!oF&&e.setRawMode(!1),i.terminal=!1,i.close()}}o(iF,"block");const Zr=o(e=>"columns"in e&&typeof e.columns=="number"?e.columns:80,"getColumns"),tc=o(e=>"rows"in e&&typeof e.rows=="number"?e.rows:20,"getRows");function Qt(e,t,n,r=n,i=n,s){const a=Zr(e??cn);return ze(t,a-n.length,{hard:!0,trim:!1}).split(`
|
|
71
|
+
`).map((u,c,l)=>{const d=u;return c===0?`${r}${d}`:c===l.length-1?`${i}${d}`:`${n}${d}`}).join(`
|
|
72
|
+
`)}o(Qt,"wrapTextWithPrefix");function sF(e,t){if("~standard"in e){const n=e["~standard"].validate(t);if(n instanceof Promise)throw new TypeError("Schema validation must be synchronous. Update `validate()` and remove any asynchronous logic.");return n.issues?.at(0)?.message}return e(t)}o(sF,"runValidation");const wo=class wo{constructor(t,n=!0){j(this,"input"),j(this,"output"),j(this,"_abortSignal"),j(this,"rl"),j(this,"opts"),j(this,"_render"),j(this,"_track",!1),j(this,"_prevFrame",""),j(this,"_subscribers",new Map),j(this,"_cursor",0),j(this,"state","initial"),j(this,"error",""),j(this,"value"),j(this,"userInput","");const{input:r=Bo,output:i=cn,render:s,signal:a,...u}=t;this.opts=u,this.onKeypress=this.onKeypress.bind(this),this.close=this.close.bind(this),this.render=this.render.bind(this),this._render=s.bind(this),this._track=n,this._abortSignal=a,this.input=r,this.output=i}unsubscribe(){this._subscribers.clear()}setSubscriber(t,n){const r=this._subscribers.get(t)??[];r.push(n),this._subscribers.set(t,r)}on(t,n){this.setSubscriber(t,{cb:n})}once(t,n){this.setSubscriber(t,{cb:n,once:!0})}emit(t,...n){const r=this._subscribers.get(t)??[],i=[];for(const s of r)s.cb(...n),s.once&&i.push(()=>r.splice(r.indexOf(s),1));for(const s of i)s()}prompt(){return new Promise(t=>{if(this._abortSignal){if(this._abortSignal.aborted)return this.state="cancel",this.close(),t(Yr);this._abortSignal.addEventListener("abort",()=>{this.state="cancel",this.close()},{once:!0})}this.rl=Vc.createInterface({input:this.input,tabSize:2,prompt:"",escapeCodeTimeout:50,terminal:!0}),this.rl.prompt(),this.opts.initialUserInput!==void 0&&this._setUserInput(this.opts.initialUserInput,!0),this.input.on("keypress",this.onKeypress),Xt(this.input,!0),this.output.on("resize",this.render),this.render(),this.once("submit",()=>{this.output.write(U.cursor.show),this.output.off("resize",this.render),Xt(this.input,!1),t(this.value)}),this.once("cancel",()=>{this.output.write(U.cursor.show),this.output.off("resize",this.render),Xt(this.input,!1),t(Yr)})})}_isActionKey(t,n){return t===" "}_shouldSubmit(t,n){return!0}_setValue(t){this.value=t,this.emit("value",this.value)}_setUserInput(t,n){this.userInput=t??"",this.emit("userInput",this.userInput),n&&this._track&&this.rl&&(this.rl.write(this.userInput),this._cursor=this.rl.cursor)}_clearUserInput(){this.rl?.write(null,{ctrl:!0,name:"u"}),this._setUserInput("")}onKeypress(t,n){if(this._track&&n.name!=="return"&&(n.name&&this._isActionKey(t,n)&&this.rl?.write(null,{ctrl:!0,name:"h"}),this._cursor=this.rl?.cursor??0,this._setUserInput(this.rl?.line)),this.state==="error"&&(this.state="active"),n?.name&&(!this._track&&ae.aliases.has(n.name)&&this.emit("cursor",ae.aliases.get(n.name)),ae.actions.has(n.name)&&this.emit("cursor",n.name)),t&&(t.toLowerCase()==="y"||t.toLowerCase()==="n")&&this.emit("confirm",t.toLowerCase()==="y"),this.emit("key",t,n),n?.name==="return"&&this._shouldSubmit(t,n)){if(this.opts.validate){const r=sF(this.opts.validate,this.value);r&&(this.error=r instanceof Error?r.message:r,this.state="error",this.rl?.write(this.userInput))}this.state!=="error"&&(this.state="submit")}qr([t,n?.name,n?.sequence],"cancel")&&(this.state="cancel"),(this.state==="submit"||this.state==="cancel")&&this.emit("finalize"),this.render(),(this.state==="submit"||this.state==="cancel")&&this.close()}close(){this.input.unpipe(),this.input.removeListener("keypress",this.onKeypress),this.output.write(`
|
|
73
|
+
`),Xt(this.input,!1),this.rl?.close(),this.rl=void 0,this.emit(`${this.state}`,this.value),this.unsubscribe()}restoreCursor(){const t=ze(this._prevFrame,process.stdout.columns,{hard:!0,trim:!1}).split(`
|
|
74
|
+
`).length-1;this.output.write(U.cursor.move(-999,t*-1))}render(){const t=ze(this._render(this)??"",process.stdout.columns,{hard:!0,trim:!1});if(t!==this._prevFrame){if(this.state==="initial")this.output.write(U.cursor.hide);else{const n=rF(this._prevFrame,t),r=tc(this.output);if(this.restoreCursor(),n){const i=Math.max(0,n.numLinesAfter-r),s=Math.max(0,n.numLinesBefore-r);let a=n.lines.find(u=>u>=i);if(a===void 0){this._prevFrame=t;return}if(n.lines.length===1){this.output.write(U.cursor.move(0,a-s)),this.output.write(U.erase.lines(1));const u=t.split(`
|
|
75
|
+
`);this.output.write(u[a]),this._prevFrame=t,this.output.write(U.cursor.move(0,u.length-a-1));return}else if(n.lines.length>1){if(i<s)a=i;else{const c=a-s;c>0&&this.output.write(U.cursor.move(0,c))}this.output.write(U.erase.down());const u=t.split(`
|
|
76
|
+
`).slice(a);this.output.write(u.join(`
|
|
77
|
+
`)),this._prevFrame=t;return}}this.output.write(U.erase.down())}this.output.write(t),this.state==="initial"&&(this.state="active"),this._prevFrame=t}}};o(wo,"V");let en=wo;const yo=class yo extends en{get cursor(){return this.value?0:1}get _value(){return this.cursor===0}constructor(t){super(t,!1),this.value=!!t.initialValue,this.on("userInput",()=>{this.value=this._value}),this.on("confirm",n=>{this.output.write(U.cursor.move(0,-1)),this.value=n,this.state="submit",this.close()}),this.on("cursor",()=>{this.value=!this.value})}};o(yo,"r");let Jr=yo,aF=(Ke=class extends en{constructor(t){super(t,!1),j(this,"options"),j(this,"cursor",0),this.options=t.options;const n=this.options.findIndex(({value:i})=>i===t.initialValue),r=n===-1?0:n;this.cursor=this.options[r]?.disabled?Jt(r,1,this.options):r,this.changeValue(),this.on("cursor",i=>{switch(i){case"left":case"up":this.cursor=Jt(this.cursor,-1,this.options);break;case"down":case"right":this.cursor=Jt(this.cursor,1,this.options);break}this.changeValue()})}get _selectedValue(){return this.options[this.cursor]}changeValue(){const t=this._selectedValue;this.value=t===void 0?void 0:t.value}},o(Ke,"n"),Ke);function uF(){return O.platform!=="win32"?O.env.TERM!=="linux":!!O.env.CI||!!O.env.WT_SESSION||!!O.env.TERMINUS_SUBLIME||O.env.ConEmuTask==="{cmd::Cmder}"||O.env.TERM_PROGRAM==="Terminus-Sublime"||O.env.TERM_PROGRAM==="vscode"||O.env.TERM==="xterm-256color"||O.env.TERM==="alacritty"||O.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}o(uF,"isUnicodeSupported");const Xr=uF(),cF=o(()=>process.env.CI==="true","isCI"),ue=o((e,t)=>Xr?e:t,"unicodeOr"),lF=ue("\u25C6","*"),nc=ue("\u25A0","x"),rc=ue("\u25B2","x"),oc=ue("\u25C7","o"),dF=ue("\u250C","T"),k=ue("\u2502","|"),tn=ue("\u2514","\u2014"),Qr=ue("\u25CF",">"),nn=ue("\u25CB"," "),ic=o(e=>{switch(e){case"initial":case"active":return C("cyan",lF);case"cancel":return C("red",nc);case"error":return C("yellow",rc);case"submit":return C("green",oc)}},"symbol"),fF=o(e=>{switch(e){case"initial":case"active":return C("cyan",k);case"cancel":return C("red",k);case"error":return C("yellow",k);case"submit":return C("green",k)}},"symbolBar");function hF(e,t){const n=[`${t?`${C("cyan",k)} `:""}${e.join(" \u2022 ")}`];return t&&n.push(C("cyan",tn)),n}o(hF,"formatInstructionFooter");const sc=o((e,t,n,r,i,s=!1)=>{let a=t,u=0;if(s)for(let c=r-1;c>=n;c--){const l=e[c];if(l&&(a-=l.length),u++,a<=i)break}else for(let c=n;c<r;c++){const l=e[c];if(l&&(a-=l.length),u++,a<=i)break}return{lineCount:a,removals:u}},"I"),DF=o(({cursor:e,options:t,style:n,output:r=process.stdout,maxItems:i=Number.POSITIVE_INFINITY,columnPadding:s=0,rowPadding:a=4})=>{const u=Zr(r)-s,c=tc(r),l=C("dim","..."),d=Math.max(c-a,0),f=Math.max(Math.min(i,d),5);let h=0;e>=f-3&&(h=Math.max(Math.min(e-f+3,t.length-f),0));let D=f<t.length&&h>0,p=f<t.length&&h+f<t.length;const m=Math.min(h+f,t.length),g=[];let F=0;D&&F++,p&&F++;const w=h+(D?1:0),E=m-(p?1:0);for(let b=w;b<E;b++){const S=t[b],$=S?n(S,b===e):"",B=ze($,u,{hard:!0,trim:!1}).split(`
|
|
78
|
+
`);g.push(B),F+=B.length}if(F>d){let b=0,S=0,$=F;const B=e-w;let I=d;const G=o(()=>sc(g,$,0,B,I),"L"),L=o(()=>sc(g,$,B+1,g.length,I,!0),"E2");D?({lineCount:$,removals:b}=G(),$>I&&(p||(I-=1),{lineCount:$,removals:S}=L())):(p||(I-=1),{lineCount:$,removals:S}=L(),$>I&&(I-=1,{lineCount:$,removals:b}=G())),b>0&&(D=!0,g.splice(0,b)),S>0&&(p=!0,g.splice(g.length-S,S))}const y=[];D&&y.push(l);for(const b of g)for(const S of b)y.push(S);return p&&y.push(l),y},"limitOptions"),pF=o(e=>{const t=e.active??"Yes",n=e.inactive??"No";return new Jr({active:t,inactive:n,signal:e.signal,input:e.input,output:e.output,initialValue:e.initialValue??!0,render(){const r=e.withGuide??ae.withGuide,i=`${ic(this.state)} `,s=r?`${C("gray",k)} `:"",a=Qt(e.output,e.message,s,i),u=`${r?`${C("gray",k)}
|
|
79
|
+
`:""}${a}
|
|
80
|
+
`,c=this.value?t:n;switch(this.state){case"submit":{const l=r?`${C("gray",k)} `:"";return`${u}${l}${C("dim",c)}`}case"cancel":{const l=r?`${C("gray",k)} `:"";return`${u}${l}${C(["strikethrough","dim"],c)}${r?`
|
|
81
|
+
${C("gray",k)}`:""}`}default:{const l=r?`${C("cyan",k)} `:"",d=r?C("cyan",tn):"";return`${u}${l}${this.value?`${C("green",Qr)} ${t}`:`${C("dim",nn)} ${C("dim",t)}`}${e.vertical?r?`
|
|
82
|
+
${C("cyan",k)} `:`
|
|
83
|
+
`:` ${C("dim","/")} `}${this.value?`${C("dim",nn)} ${C("dim",n)}`:`${C("green",Qr)} ${n}`}
|
|
84
|
+
${d}
|
|
85
|
+
`}}}}).prompt()},"confirm");`${C("dim","\u2191/\u2193")}`,`${C("dim","Space:")}`,`${C("dim","Enter:")}`;const ac=o((e="",t)=>{const n=process.stdout,r=`${C("gray",dF)} `;n.write(`${r}${e}
|
|
86
|
+
`)},"intro"),Oe=o((e="",t)=>{const n=process.stdout,r=`${C("gray",k)}
|
|
87
|
+
${C("gray",tn)} `;n.write(`${r}${e}
|
|
88
|
+
|
|
89
|
+
`)},"outro"),mF=o(e=>C("magenta",e),"W"),eo=o(({indicator:e="dots",onCancel:t,output:n=process.stdout,cancelMessage:r,errorMessage:i,frames:s=Xr?["\u25D2","\u25D0","\u25D3","\u25D1"]:["\u2022","o","O","0"],delay:a=Xr?80:120,signal:u,...c}={})=>{const l=cF();let d,f,h=!1,D=!1,p="",m,g=performance.now();const F=Zr(n),w=c?.styleFrame??mF,E=o(P=>{const q=P>1?i??ae.messages.error:r??ae.messages.cancel;D=P===1,h&&(qe(q,P),D&&typeof t=="function"&&t())},"g"),y=o(()=>E(2),"f"),b=o(()=>E(1),"i2"),S=o(()=>{process.on("uncaughtExceptionMonitor",y),process.on("unhandledRejection",y),process.on("SIGINT",b),process.on("SIGTERM",b),process.on("exit",E),u&&u.addEventListener("abort",b)},"A2"),$=o(()=>{process.removeListener("uncaughtExceptionMonitor",y),process.removeListener("unhandledRejection",y),process.removeListener("SIGINT",b),process.removeListener("SIGTERM",b),process.removeListener("exit",E),u&&u.removeEventListener("abort",b)},"H"),B=o(()=>{if(m===void 0)return;l&&n.write(`
|
|
90
|
+
`);const P=ze(m,F,{hard:!0,trim:!1}).split(`
|
|
91
|
+
`);P.length>1&&n.write(U.cursor.up(P.length-1)),n.write(U.cursor.to(0)),n.write(U.erase.down())},"y"),I=o(P=>P.replace(/\.+$/,""),"C2"),G=o(P=>{const q=(performance.now()-P)/1e3,re=Math.floor(q/60),oe=Math.floor(q%60);return re>0?`[${re}m ${oe}s]`:`[${oe}s]`},"_"),L=c.withGuide??ae.withGuide,Dt=o((P="")=>{h=!0,d=iF({output:n}),p=I(P),g=performance.now(),L&&n.write(`${C("gray",k)}
|
|
92
|
+
`);let q=0,re=0;S(),f=setInterval(()=>{if(l&&p===m)return;B(),m=p;const oe=w(s[q]);let pt;if(l)pt=`${oe} ${p}...`;else if(e==="timer")pt=`${oe} ${p} ${G(g)}`;else{const Sc=".".repeat(Math.floor(re)).slice(0,3);pt=`${oe} ${p}${Sc}`}const Cc=ze(pt,F,{hard:!0,trim:!1});n.write(Cc),q=q+1<s.length?q+1:0,re=re<4?re+.125:0},a)},"P2"),qe=o((P="",q=0,re=!1)=>{if(!h)return;h=!1,clearInterval(f),B();const oe=q===0?C("green",oc):q===1?C("red",nc):C("red",rc);p=P??p,re||(e==="timer"?n.write(`${oe} ${p} ${G(g)}
|
|
93
|
+
`):n.write(`${oe} ${p}
|
|
94
|
+
`)),$(),d()},"a");return{start:Dt,stop:o((P="")=>qe(P,0),"stop"),message:o((P="")=>{p=I(P??p)},"message"),cancel:o((P="")=>qe(P,1),"cancel"),error:o((P="")=>qe(P,2),"error"),clear:o(()=>qe("",0,!0),"clear"),get isCancelled(){return D}}},"spinner"),gF=[`${C("dim","\u2191/\u2193")} to navigate`,`${C("dim","Enter:")} confirm`],rn=o((e,t)=>e.includes(`
|
|
95
|
+
`)?e.split(`
|
|
96
|
+
`).map(n=>t(n)).join(`
|
|
97
|
+
`):t(e),"c"),FF=o(e=>{const t=o((r,i)=>{if(r===void 0)return"";const s=r.label??String(r.value);switch(i){case"disabled":return`${C("gray",nn)} ${rn(s,a=>C("gray",a))}${r.hint?` ${C("dim",`(${r.hint??"disabled"})`)}`:""}`;case"selected":return`${rn(s,a=>C("dim",a))}`;case"active":return`${C("green",Qr)} ${s}${r.hint?` ${C("dim",`(${r.hint})`)}`:""}`;case"cancelled":return`${rn(s,a=>C(["strikethrough","dim"],a))}`;default:return`${C("dim",nn)} ${rn(s,a=>C("dim",a))}`}},"o"),n=e.showInstructions??!0;return new aF({options:e.options,signal:e.signal,input:e.input,output:e.output,initialValue:e.initialValue,render(){const r=e.withGuide??ae.withGuide,i=`${ic(this.state)} `,s=`${fF(this.state)} `,a=Qt(e.output,e.message,s,i),u=`${r?`${C("gray",k)}
|
|
98
|
+
`:""}${a}
|
|
99
|
+
`;switch(this.state){case"submit":{const c=r?`${C("gray",k)} `:"",l=Qt(e.output,t(this.options[this.cursor],"selected"),c);return`${u}${l}`}case"cancel":{const c=r?`${C("gray",k)} `:"",l=Qt(e.output,t(this.options[this.cursor],"cancelled"),c);return`${u}${l}${r?`
|
|
100
|
+
${C("gray",k)}`:""}`}default:{const c=r?`${C("cyan",k)} `:"",l=u.split(`
|
|
101
|
+
`).length,d=n?hF(gF,r):r?[C("cyan",tn)]:[],f=d.join(`
|
|
102
|
+
`),h=d.length+1;return`${u}${c}${DF({output:e.output,cursor:this.cursor,options:this.options,maxItems:e.maxItems,columnPadding:c.length,rowPadding:l+h,style:o((D,p)=>t(D,D.disabled?"disabled":p?"active":"inactive"),"style")}).join(`
|
|
103
|
+
${c}`)}
|
|
104
|
+
${f}
|
|
105
|
+
`}}}}).prompt()},"select");`${C("gray",k)}`;const Eo=class Eo extends Error{};o(Eo,"KnownError");let R=Eo;const to=" ",on=o(e=>{e instanceof Error&&!(e instanceof R)&&(e.stack&&console.error(Gr(e.stack.split(`
|
|
106
|
+
`).slice(1).join(`
|
|
107
|
+
`))),console.error(`
|
|
108
|
+
${to}${Gr(`aicommit v${vn.version}`)}`),console.error(`
|
|
109
|
+
${to}Please open a Bug report with the information above:`),console.error(`${to}https://github.com/NegoZiatoR/ai-commit/issues/new/choose`))},"handleCliError"),no=o(async()=>{const{stdout:e,failed:t}=await We("git",["rev-parse","--show-toplevel"],{reject:!1});if(t)throw new R("The current directory must be a Git repository!");return e},"assertGitRepo"),ro=o(e=>`:(exclude)${e}`,"excludeFromDiff"),uc=["package-lock.json","*.lock"].map(ro),cc=o(async e=>{const t=["diff","--cached","--diff-algorithm=minimal"],{stdout:n}=await We("git",[...t,"--name-only",...uc,...e?e.map(ro):[]]);if(!n)return;const{stdout:r}=await We("git",[...t,...uc,...e?e.map(ro):[]]);return{files:n.split(`
|
|
110
|
+
`),diff:r}},"getStagedDiff"),wF=o(e=>`Detected ${e.length.toLocaleString()} staged file${e.length>1?"s":""}`,"getDetectedMessage");var oo,lc;function yF(){if(lc)return oo;lc=1;const{hasOwnProperty:e}=Object.prototype,t=o((u,c={})=>{typeof c=="string"&&(c={section:c}),c.align=c.align===!0,c.newline=c.newline===!0,c.sort=c.sort===!0,c.whitespace=c.whitespace===!0||c.align===!0,c.platform=c.platform||typeof process<"u"&&process.platform,c.bracketedArray=c.bracketedArray!==!1;const l=c.platform==="win32"?`\r
|
|
111
|
+
`:`
|
|
112
|
+
`,d=c.whitespace?" = ":"=",f=[],h=c.sort?Object.keys(u).sort():Object.keys(u);let D=0;c.align&&(D=s(h.filter(g=>u[g]===null||Array.isArray(u[g])||typeof u[g]!="object").map(g=>Array.isArray(u[g])?`${g}[]`:g).concat([""]).reduce((g,F)=>s(g).length>=s(F).length?g:F)).length);let p="";const m=c.bracketedArray?"[]":"";for(const g of h){const F=u[g];if(F&&Array.isArray(F))for(const w of F)p+=s(`${g}${m}`).padEnd(D," ")+d+s(w)+l;else F&&typeof F=="object"?f.push(g):p+=s(g).padEnd(D," ")+d+s(F)+l}c.section&&p.length&&(p="["+s(c.section)+"]"+(c.newline?l+l:l)+p);for(const g of f){const F=n(g,".").join("\\."),w=(c.section?c.section+".":"")+F,E=t(u[g],{...c,section:w});p.length&&E.length&&(p+=l),p+=E}return p},"encode");function n(u,c){var l=0,d=0,f=0,h=[];do if(f=u.indexOf(c,l),f!==-1){if(l=f+c.length,f>0&&u[f-1]==="\\")continue;h.push(u.slice(d,f)),d=f+c.length}while(f!==-1);return h.push(u.slice(d)),h}o(n,"splitSections");const r=o((u,c={})=>{c.bracketedArray=c.bracketedArray!==!1;const l=Object.create(null);let d=l,f=null;const h=/^\[([^\]]*)\]\s*$|^([^=]+)(=(.*))?$/i,D=u.split(/[\r\n]+/g),p={};for(const g of D){if(!g||g.match(/^\s*[;#]/)||g.match(/^\s*$/))continue;const F=g.match(h);if(!F)continue;if(F[1]!==void 0){if(f=a(F[1]),f==="__proto__"){d=Object.create(null);continue}d=l[f]=l[f]||Object.create(null);continue}const w=a(F[2]);let E;c.bracketedArray?E=w.length>2&&w.slice(-2)==="[]":(p[w]=(p?.[w]||0)+1,E=p[w]>1);const y=E&&w.endsWith("[]")?w.slice(0,-2):w;if(y==="__proto__")continue;const b=F[3]?a(F[4]):!0,S=b==="true"||b==="false"||b==="null"?JSON.parse(b):b;E&&(e.call(d,y)?Array.isArray(d[y])||(d[y]=[d[y]]):d[y]=[]),Array.isArray(d[y])?d[y].push(S):d[y]=S}const m=[];for(const g of Object.keys(l)){if(!e.call(l,g)||typeof l[g]!="object"||Array.isArray(l[g]))continue;const F=n(g,".");d=l;const w=F.pop(),E=w.replace(/\\\./g,".");for(const y of F)y!=="__proto__"&&((!e.call(d,y)||typeof d[y]!="object")&&(d[y]=Object.create(null)),d=d[y]);d===l&&E===w||(d[E]=l[g],m.push(g))}for(const g of m)delete l[g];return l},"decode"),i=o(u=>u.startsWith('"')&&u.endsWith('"')||u.startsWith("'")&&u.endsWith("'"),"isQuoted"),s=o(u=>typeof u!="string"||u.match(/[=\r\n]/)||u.match(/^\[/)||u.length>1&&i(u)||u!==u.trim()?JSON.stringify(u):u.split(";").join("\\;").split("#").join("\\#"),"safe"),a=o(u=>{if(u=(u||"").trim(),i(u)){u.charAt(0)==="'"&&(u=u.slice(1,-1));try{u=JSON.parse(u)}catch{}}else{let c=!1,l="";for(let d=0,f=u.length;d<f;d++){const h=u.charAt(d);if(c)"\\;#".indexOf(h)!==-1?l+=h:l+="\\"+h,c=!1;else{if(";#".indexOf(h)!==-1)break;h==="\\"?c=!0:l+=h}}return c&&(l+="\\"),l.trim()}return u},"unsafe");return oo={parse:r,decode:r,stringify:t,encode:t,safe:s,unsafe:a},oo}o(yF,"requireIni");var EF=yF(),dc=qi(EF);const sn=o(e=>W.lstat(e).then(()=>!0,()=>!1),"fileExists"),io=o(async e=>{try{let t;try{t=e||await no()}catch(a){if(a instanceof R&&a.message.includes("Git repository"))return;throw a}const n=ce.join(t,".ai-commit.json");if(!await sn(n))return;const i=await W.readFile(n,"utf8");return JSON.parse(i)}catch(t){if(t instanceof R)throw t;return}},"getProjectConfig");function bF(e){const t={},n=e.split(`
|
|
113
|
+
`);for(const r of n){const i=r.trim();if(!i||i.startsWith("#"))continue;const s=i.match(/^([A-Z_][A-Z0-9_]*)\s*=\s*(.*)$/i);if(!s)continue;const[,a,u]=s;let c=u.trim();(c.startsWith('"')&&c.endsWith('"')||c.startsWith("'")&&c.endsWith("'"))&&(c=c.slice(1,-1)),t[a]=c}return t}o(bF,"parseEnvContent");async function fc(e){const{filename:t=".env",directory:n=process.cwd(),override:r=!1}=e||{},i=ce.join(n,t);if(!await sn(i))return{};try{const a=await W.readFile(i,"utf8"),u=bF(a);for(const[c,l]of Object.entries(u))(r||process.env[c]===void 0)&&(process.env[c]=l);return u}catch{return{}}}o(fc,"loadEnvFile");async function CF(){process.env.NODE_ENV==="test"?await fc({filename:".env.local"}):await fc({filename:".env"})}o(CF,"loadEnvironment");const hc=["openai","anthropic","azure-openai","ollama","custom"],SF=["","conventional"],{hasOwnProperty:vF}=Object.prototype,Dc=o((e,t)=>vF.call(e,t),"hasOwn"),_=o((e,t,n)=>{if(!t)throw new R(`Invalid config property ${e}: ${n}`)},"parseAssert"),an={provider(e){return e?(_("provider",hc.includes(e),`Must be one of: ${hc.join(", ")}`),e):"openai"},OPENAI_KEY(e){if(e)return _("OPENAI_KEY",e.startsWith("sk-"),'Must start with "sk-"'),e},ANTHROPIC_KEY(e){if(e)return _("ANTHROPIC_KEY",e.startsWith("sk-ant-"),'Must start with "sk-ant-"'),e},AZURE_OPENAI_KEY(e){return e},AZURE_ENDPOINT(e){if(e)return _("AZURE_ENDPOINT",/^https?:\/\//.test(e),"Must be a valid URL"),e},OLLAMA_ENDPOINT(e){return e?(_("OLLAMA_ENDPOINT",/^https?:\/\//.test(e),"Must be a valid URL"),e):"http://localhost:11434"},CUSTOM_ENDPOINT(e){if(e)return _("CUSTOM_ENDPOINT",/^https?:\/\//.test(e),"Must be a valid URL"),e},CUSTOM_KEY(e){return e},locale(e){return e?(_("locale",e,"Cannot be empty"),_("locale",/^[a-z-]+$/i.test(e),"Must be a valid locale (letters and dashes/underscores). You can consult the list of codes in: https://wikipedia.org/wiki/List_of_ISO_639-1_codes"),e):"en"},generate(e){if(!e)return 1;_("generate",/^\d+$/.test(e),"Must be an integer");const t=Number(e);return _("generate",t>0,"Must be greater than 0"),_("generate",t<=5,"Must be less or equal to 5"),t},type(e){return e?(_("type",SF.includes(e),"Invalid commit type"),e):""},proxy(e){if(!(!e||e.length===0))return _("proxy",/^https?:\/\//.test(e),"Must be a valid URL"),e},model(e){return!e||e.length===0?"gpt-4o-mini":e},timeout(e){if(!e)return 1e4;_("timeout",/^\d+$/.test(e),"Must be an integer");const t=Number(e);return _("timeout",t>=500,"Must be greater than 500ms"),t},temperature(e){if(!e)return .2;_("temperature",/^(2|\d)(\.\d{1,2})?$/.test(e),"Must be decimal between 0 and 2");const t=Number(e);return _("temperature",t>0,"Must be greater than 0"),_("temperature",t<=2,"Must be less than or equal to 2"),t},"max-length"(e){if(!e)return 50;_("max-length",/^\d+$/.test(e),"Must be an integer");const t=Number(e);return _("max-length",t>=20,"Must be greater than 20 characters"),t},"max-completion-tokens"(e){if(!e)return 1e4;_("max-completion-tokens",/^\d+$/.test(e),"Must be an integer");const t=Number(e);return _("max-completion-tokens",t>0,"Must be greater than 0"),t},"auto-confirm"(e){return e?typeof e=="boolean"?e:(_("auto-confirm",/^(?:true|false)$/.test(e),"Must be a boolean"),e==="true"):!1},"prepend-reference"(e){return e?typeof e=="boolean"?e:(_("prepend-reference",/^(?:true|false)$/.test(e),"Must be a boolean"),e==="true"):!1},signoff(e){return e?typeof e=="boolean"?e:(_("signoff",/^(?:true|false)$/.test(e),"Must be a boolean"),e==="true"):!1}},so=ce.join(Hc.homedir(),".aicommit"),pc=o(async()=>{if(!await sn(so))return Object.create(null);const t=await W.readFile(so,"utf8");return dc.parse(t)},"readConfigFile"),AF=o(e=>{const t=e.provider;switch(t){case"openai":if(!e.OPENAI_KEY)throw new R("Please set your OpenAI API key via `aicommit config set OPENAI_KEY=<your token>`");break;case"anthropic":if(!e.ANTHROPIC_KEY)throw new R("Please set your Anthropic API key via `aicommit config set ANTHROPIC_KEY=<your token>`\nGet your API key from: https://console.anthropic.com/");break;case"azure-openai":if(!e.AZURE_OPENAI_KEY)throw new R("Please set your Azure OpenAI API key via `aicommit config set AZURE_OPENAI_KEY=<your token>`");if(!e.AZURE_ENDPOINT)throw new R("Please set your Azure OpenAI endpoint via `aicommit config set AZURE_ENDPOINT=<your endpoint>`");break;case"ollama":break;case"custom":if(!e.CUSTOM_ENDPOINT)throw new R("Please set your custom endpoint via `aicommit config set CUSTOM_ENDPOINT=<your endpoint>`");break;default:throw new R(`Unknown provider: ${t}`)}},"validateProviderConfig"),ao=o(async(e,t)=>{await CF();const n=await pc(),r=await io(),i={};for(const a of Object.keys(an)){const u=an[a];let c=r?.[a]??e?.[a]??process.env[a]??n[a];if(typeof c=="boolean"&&(c=c.toString()),t)try{i[a]=u(c)}catch{}else i[a]=u(c)}const s=i;return t||AF(s),s},"getConfig"),$F=o(async e=>{const t=await pc();for(const[n,r]of e){if(!Dc(an,n))throw new R(`Invalid config property: ${n}`);const i=an[n](r);t[n]=i}await W.writeFile(so,dc.stringify(t),"utf8")},"setConfigs"),mc={openai:o(()=>import("./openai-B3aeSqgJ.mjs"),"openai"),anthropic:o(()=>import("./anthropic-DGATt1dI.mjs"),"anthropic"),"azure-openai":o(()=>import("./azure-openai-BT_M34R2.mjs"),"azure-openai"),ollama:o(()=>import("./ollama-BH86IIn-.mjs"),"ollama"),custom:o(()=>import("./custom-Cxe97j5h.mjs"),"custom")};async function gc(e,t){const n=mc[e];if(!n)throw new R(`Unknown provider type: ${e}. Supported providers: ${Object.keys(mc).join(", ")}`);try{const i=(await n()).default;return new i(t)}catch(r){throw r instanceof R?r:r.code==="ERR_MODULE_NOT_FOUND"?new R(`Provider "${e}" is not yet implemented. Currently supported: openai`):new R(`Failed to initialize provider "${e}": ${r.message}`)}}o(gc,"createProvider");var BF=o(async(e,t,n,r,i)=>(async()=>{ac(Wu(ju(" aicommit "))),await no();const s=eo();n&&await We("git",["add","--update"]),s.start("Detecting staged files");const a=await cc(t);if(!a)throw s.stop("Detecting staged files"),new R("No staged changes found. Stage your changes manually, or automatically stage all changes with the `--all` flag.");s.stop(`${wF(a.files)}:
|
|
114
|
+
${a.files.map(D=>` ${D}`).join(`
|
|
115
|
+
`)}`);const{env:u}=process,c=await ao({OPENAI_KEY:u.OPENAI_KEY||u.OPENAI_API_KEY,proxy:u.https_proxy||u.HTTPS_PROXY||u.http_proxy||u.HTTP_PROXY,generate:e?.toString(),type:r?.toString()}),l=eo();l.start("The AI is analyzing your changes");let d;try{const D={model:c.model,locale:c.locale,maxLength:c["max-length"],type:c.type,timeout:c.timeout,temperature:c.temperature,maxCompletionTokens:c["max-completion-tokens"],proxy:c.proxy};let p;switch(c.provider){case"openai":p={...D,apiKey:c.OPENAI_KEY};break;case"anthropic":p={...D,apiKey:c.ANTHROPIC_KEY};break;case"azure-openai":p={...D,apiKey:c.AZURE_OPENAI_KEY,endpoint:c.AZURE_ENDPOINT};break;case"ollama":p={...D,endpoint:c.OLLAMA_ENDPOINT};break;case"custom":p={...D,endpoint:c.CUSTOM_ENDPOINT,apiKey:c.CUSTOM_KEY};break;default:p={...D,apiKey:c.OPENAI_KEY}}const m=await gc(c.provider,p),g=await io();d=(await m.generateCommitMessage({diff:a.diff,completions:c.generate,projectConfig:g})).messages}finally{l.stop("Changes analyzed")}if(d.length===0)throw new R("No commit messages were generated. Try again.");let f;if(d.length===1){[f]=d;let D;if(c["auto-confirm"]?(D=!0,Oe(`${ht("\u2714")} Auto confirmed commit message.
|
|
116
|
+
|
|
117
|
+
${f}
|
|
118
|
+
`)):D=await pF({message:`Use this commit message?
|
|
119
|
+
|
|
120
|
+
${f}
|
|
121
|
+
`}),!D||ec(D)){Oe("Commit cancelled");return}}else{const D=await FF({message:`Pick a commit message to use: ${Gr("(Ctrl+c to exit)")}`,options:d.map(p=>({label:p,value:p}))});if(ec(D)){Oe("Commit cancelled");return}f=D}if(c["prepend-reference"]){const{stdout:D}=await We("git",["branch","--show-current"]),p=D.match(/([a-zA-Z])+-([0-9]+)/)?.[0];p?.length&&(f=`${p?.toUpperCase()}: ${f}`)}const h=["commit","-m",f,...i];c.signoff&&h.push("--signoff"),await We("git",h),Oe(`${ht("\u2714")} Successfully committed!`)})().catch(s=>{Oe(`${Yt("\u2716")} ${s.message}`),on(s),process.exit(1)}),"aicommit");const[uo,TF]=process.argv.slice(2);var IF=o(()=>(async()=>{if(!uo)throw new R('Commit message file path is missing. This file should be called from the "prepare-commit-msg" git hook');if(TF)return;const e=await cc();if(!e)return;ac(Wu(ju(" aicommit ")));const{env:t}=process,n=await ao({proxy:t.https_proxy||t.HTTPS_PROXY||t.http_proxy||t.HTTP_PROXY}),r=eo();r.start("The AI is analyzing your changes");let i;try{const l={model:n.model,locale:n.locale,maxLength:n["max-length"],type:n.type,timeout:n.timeout,temperature:n.temperature,maxCompletionTokens:n["max-completion-tokens"],proxy:n.proxy};let d;switch(n.provider){case"openai":d={...l,apiKey:n.OPENAI_KEY};break;case"anthropic":d={...l,apiKey:n.ANTHROPIC_KEY};break;case"azure-openai":d={...l,apiKey:n.AZURE_OPENAI_KEY,endpoint:n.AZURE_ENDPOINT};break;case"ollama":d={...l,endpoint:n.OLLAMA_ENDPOINT};break;case"custom":d={...l,endpoint:n.CUSTOM_ENDPOINT,apiKey:n.CUSTOM_KEY};break;default:d={...l,apiKey:n.OPENAI_KEY}}const f=await gc(n.provider,d),h=await io();i=(await f.generateCommitMessage({diff:e.diff,completions:n.generate,projectConfig:h})).messages}finally{r.stop("Changes analyzed")}const a=await W.readFile(uo,"utf8")!=="",u=i.length>1;let c="";a&&(c=`# \u{1F916} AI generated commit${u?"s":""}
|
|
122
|
+
`),u?(a&&(c+=`# Select one of the following messages by uncommeting:
|
|
123
|
+
`),c+=`
|
|
124
|
+
${i.map(l=>`# ${l}`).join(`
|
|
125
|
+
`)}`):(a&&(c+=`# Edit the message below and commit:
|
|
126
|
+
`),c+=`
|
|
127
|
+
${i[0]}
|
|
128
|
+
`),await W.appendFile(uo,c),Oe(`${ht("\u2714")} Saved commit message!`)})().catch(e=>{Oe(`${Yt("\u2716")} ${e.message}`),on(e),process.exit(1)}),"prepareCommitMessageHook"),OF=Sn({name:"config",parameters:["<mode>","<key=value...>"]},e=>{(async()=>{const{mode:t,keyValue:n}=e._;if(t==="get"){const r=await ao({},!0);for(const i of n)Dc(r,i)&&console.log(`${i}=${r[i]}`);return}if(t==="set"){await $F(n.map(r=>r.split("=")));return}throw new R(`Invalid mode: ${t}`)})().catch(t=>{console.error(`${Yt("\u2716")} ${t.message}`),on(t),process.exit(1)})});const Fc="prepare-commit-msg",wc=`.git/hooks/${Fc}`,un=Kc(new URL("cli.mjs",import.meta.url)),RF=process.argv[1].replace(/\\/g,"/").endsWith(`/${wc}`),yc=process.platform==="win32",Ec=`
|
|
129
|
+
#!/usr/bin/env node
|
|
130
|
+
import(${JSON.stringify(qc(un))})
|
|
131
|
+
`.trim();var _F=Sn({name:"hook",parameters:["<install/uninstall>"]},e=>{(async()=>{const t=await no(),{installUninstall:n}=e._,r=ce.join(t,wc),i=await sn(r);if(n==="install"){if(i){if(await W.realpath(r).catch(()=>{})===un){console.warn("The hook is already installed");return}throw new R(`A different ${Fc} hook seems to be installed. Please remove it before installing aicommit.`)}await W.mkdir(ce.dirname(r),{recursive:!0}),yc?await W.writeFile(r,Ec):(await W.symlink(un,r,"file"),await W.chmod(r,493)),console.log(`${ht("\u2714")} Hook installed`);return}if(n==="uninstall"){if(!i){console.warn("Hook is not installed");return}if(yc){if(await W.readFile(r,"utf8")!==Ec){console.warn("Hook is not installed");return}}else if(await W.realpath(r)!==un){console.warn("Hook is not installed");return}await W.rm(r),console.log(`${ht("\u2714")} Hook uninstalled`);return}throw new R(`Invalid mode: ${n}`)})().catch(t=>{console.error(`${Yt("\u2716")} ${t.message}`),on(t),process.exit(1)})});const bc=process.argv.slice(2);Si({name:"aicommit",version:vn.version,flags:{generate:{type:Number,description:"Number of messages to generate (Warning: generating multiple costs more) (default: 1)",alias:"g"},exclude:{type:[String],description:"Files to exclude from AI analysis",alias:"x"},all:{type:Boolean,description:"Automatically stage changes in tracked files for the commit",alias:"a",default:!1},type:{type:String,description:"Type of commit message to generate",alias:"t"}},commands:[OF,_F],help:{description:vn.description},ignoreArgv:o(e=>e==="unknown-flag"||e==="argument","ignoreArgv")},e=>{RF?IF():BF(e.flags.generate,e.flags.exclude,e.flags.all,e.flags.type,bc)},bc);export{R as K};
|