aicommits 1.7.0 → 1.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +9 -0
  2. package/dist/cli.mjs +62 -59
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -180,6 +180,15 @@ To clear the proxy option, you can use the command (note the empty value after t
180
180
  aicommits config set proxy=
181
181
  ```
182
182
 
183
+ #### model
184
+
185
+ Default: `gpt-3.5-turbo`
186
+
187
+ The Chat Completions (`/v1/chat/completions`) model to use. Consult the list of models available in the [OpenAI Documentation](https://platform.openai.com/docs/models/model-endpoint-compatibility).
188
+
189
+ > Tip: If you have access, try upgrading to [`gpt-4`](https://platform.openai.com/docs/models/gpt-4) for next-level code analysis. It can handle double the input size, but comes at a higher cost. Check out OpenAI's website to learn more.
190
+
191
+
183
192
  ## How it works
184
193
 
185
194
  This CLI tool runs `git diff` to grab all your latest code changes, sends them to OpenAI's GPT-3, then returns the AI generated commit message.
package/dist/cli.mjs CHANGED
@@ -1,89 +1,92 @@
1
1
  #!/usr/bin/env node
2
- import le from"tty";import{Buffer as wn}from"node:buffer";import W from"node:path";import It from"node:child_process";import b,{stdin as Tt,stdout as Pt}from"node:process";import Bn from"child_process";import X from"path";import Te from"fs";import $n from"node:url";import vn,{constants as _t}from"node:os";import Rt from"assert";import kt from"events";import An from"buffer";import Pe from"stream";import Mt from"util";import*as fe from"node:readline";import jt from"node:readline";import{WriteStream as xn}from"node:tty";import O from"fs/promises";import Lt from"os";import Sn from"https";import{encoding_for_model as On}from"@dqbd/tiktoken";import In from"net";import Tn from"tls";import Pn,{fileURLToPath as _n}from"url";const Rn="known-flag",kn="unknown-flag",Mn="argument",{stringify:Z}=JSON,jn=/\B([A-Z])/g,Ln=e=>e.replace(jn,"-$1").toLowerCase(),{hasOwnProperty:Nn}=Object.prototype,Q=(e,t)=>Nn.call(e,t),Gn=e=>Array.isArray(e),Nt=e=>typeof e=="function"?[e,!1]:Gn(e)?[e[0],!0]:Nt(e.type),Un=(e,t)=>e===Boolean?t!=="false":t,Wn=(e,t)=>typeof t=="boolean"?t:e===Number&&t===""?Number.NaN:e(t),qn=/[\s.:=]/,Hn=e=>{const t=`Flag name ${Z(e)}`;if(e.length===0)throw new Error(`${t} cannot be empty`);if(e.length===1)throw new Error(`${t} must be longer than a character`);const n=e.match(qn);if(n)throw new Error(`${t} cannot contain ${Z(n?.[0])}`)},zn=e=>{const t={},n=(u,r)=>{if(Q(t,u))throw new Error(`Duplicate flags named ${Z(u)}`);t[u]=r};for(const u in e){if(!Q(e,u))continue;Hn(u);const r=e[u],o=[[],...Nt(r),r];n(u,o);const s=Ln(u);if(u!==s&&n(s,o),"alias"in r&&typeof r.alias=="string"){const{alias:i}=r,D=`Flag alias ${Z(i)} for flag ${Z(u)}`;if(i.length===0)throw new Error(`${D} cannot be empty`);if(i.length>1)throw new Error(`${D} must be a single character`);n(i,o)}}return t},Kn=(e,t)=>{const n={};for(const u in e){if(!Q(e,u))continue;const[r,,o,s]=t[u];if(r.length===0&&"default"in s){let{default:i}=s;typeof i=="function"&&(i=i()),n[u]=i}else n[u]=o?r:r.pop()}return n},de="--",Vn=/[.:=]/,Yn=/^-{1,2}\w/,Jn=e=>{if(!Yn.test(e))return;const t=!e.startsWith(de);let n=e.slice(t?1:2),u;const r=n.match(Vn);if(r){const{index:o}=r;u=n.slice(o+1),n=n.slice(0,o)}return[n,u,t]},Xn=(e,{onFlag:t,onArgument:n})=>{let u;const r=(o,s)=>{if(typeof u!="function")return!0;u(o,s),u=void 0};for(let o=0;o<e.length;o+=1){const s=e[o];if(s===de){r();const D=e.slice(o+1);n?.(D,[o],!0);break}const i=Jn(s);if(i){if(r(),!t)continue;const[D,l,f]=i;if(f)for(let a=0;a<D.length;a+=1){r();const c=a===D.length-1;u=t(D[a],c?l:void 0,[o,a+1,c])}else u=t(D,l,[o])}else r(s,[o])&&n?.([s],[o])}r()},Zn=(e,t)=>{for(const[n,u,r]of t.reverse()){if(u){const o=e[n];let s=o.slice(0,u);if(r||(s+=o.slice(u+1)),s!=="-"){e[n]=s;continue}}e.splice(n,1)}},Qn=(e,t=process.argv.slice(2),{ignore:n}={})=>{const u=[],r=zn(e),o={},s=[];return s[de]=[],Xn(t,{onFlag(i,D,l){const f=Q(r,i);if(!n?.(f?Rn:kn,i,D)){if(f){const[a,c]=r[i],d=Un(c,D),p=(m,h)=>{u.push(l),h&&u.push(h),a.push(Wn(c,m||""))};return d===void 0?p:p(d)}Q(o,i)||(o[i]=[]),o[i].push(D===void 0?!0:D),u.push(l)}},onArgument(i,D,l){n?.(Mn,t[D[0]])||(s.push(...i),l?(s[de]=i,t.splice(D[0])):u.push(D))}}),Zn(t,u),{flags:Kn(e,r),unknownFlags:o,_:s}};var er=Object.create,pe=Object.defineProperty,tr=Object.defineProperties,ur=Object.getOwnPropertyDescriptor,nr=Object.getOwnPropertyDescriptors,rr=Object.getOwnPropertyNames,Gt=Object.getOwnPropertySymbols,or=Object.getPrototypeOf,Ut=Object.prototype.hasOwnProperty,sr=Object.prototype.propertyIsEnumerable,Wt=(e,t,n)=>t in e?pe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ce=(e,t)=>{for(var n in t||(t={}))Ut.call(t,n)&&Wt(e,n,t[n]);if(Gt)for(var n of Gt(t))sr.call(t,n)&&Wt(e,n,t[n]);return e},_e=(e,t)=>tr(e,nr(t)),ir=e=>pe(e,"__esModule",{value:!0}),Dr=(e,t)=>()=>(e&&(t=e(e=0)),t),ar=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),cr=(e,t,n,u)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of rr(t))!Ut.call(e,r)&&(n||r!=="default")&&pe(e,r,{get:()=>t[r],enumerable:!(u=ur(t,r))||u.enumerable});return e},lr=(e,t)=>cr(ir(pe(e!=null?er(or(e)):{},"default",!t&&e&&e.__esModule?{get:()=>e.default,enumerable:!0}:{value:e,enumerable:!0})),e),A=Dr(()=>{}),fr=ar((e,t)=>{A(),t.exports=function(){return/\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67)\uDB40\uDC7F|(?:\uD83E\uDDD1\uD83C\uDFFF\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFC-\uDFFF])|\uD83D\uDC68(?:\uD83C\uDFFB(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|[\u2695\u2696\u2708]\uFE0F|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))?|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])\uFE0F|\u200D(?:(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D[\uDC66\uDC67])|\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC)?|(?:\uD83D\uDC69(?:\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69]))|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC69(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83E\uDDD1(?:\u200D(?:\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDE36\u200D\uD83C\uDF2B|\uD83C\uDFF3\uFE0F\u200D\u26A7|\uD83D\uDC3B\u200D\u2744|(?:(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\uD83C\uDFF4\u200D\u2620|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])\u200D[\u2640\u2642]|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u2600-\u2604\u260E\u2611\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26B0\u26B1\u26C8\u26CF\u26D1\u26D3\u26E9\u26F0\u26F1\u26F4\u26F7\u26F8\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u3030\u303D\u3297\u3299]|\uD83C[\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]|\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|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDE35\u200D\uD83D\uDCAB|\uD83D\uDE2E\u200D\uD83D\uDCA8|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83E\uDDD1(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83D\uDC69(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF6\uD83C\uDDE6|\uD83C\uDDF4\uD83C\uDDF2|\uD83D\uDC08\u200D\u2B1B|\u2764\uFE0F\u200D(?:\uD83D\uDD25|\uD83E\uDE79)|\uD83D\uDC41\uFE0F|\uD83C\uDFF3\uFE0F|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|[#\*0-9]\uFE0F\u20E3|\u2764\uFE0F|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|\uD83C\uDFF4|(?:[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\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]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270C\u270D]|\uD83D[\uDD74\uDD90])(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC08\uDC15\uDC3B\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE2E\uDE35\uDE36\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5]|\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD]|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF]|[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\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-\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0D\uDD0E\uDD10-\uDD17\uDD1D\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78\uDD7A-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCB\uDDD0\uDDE0-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6]|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26A7\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5-\uDED7\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDD77\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g}});A(),A(),A();var dr=e=>{var t,n,u;let r=(t=process.stdout.columns)!=null?t:Number.POSITIVE_INFINITY;return typeof e=="function"&&(e=e(r)),e||(e={}),Array.isArray(e)?{columns:e,stdoutColumns:r}:{columns:(n=e.columns)!=null?n:[],stdoutColumns:(u=e.stdoutColumns)!=null?u:r}};A(),A(),A(),A(),A();function pr({onlyFirst:e=!1}={}){let t=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))"].join("|");return new RegExp(t,e?void 0:"g")}function qt(e){if(typeof e!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof e}\``);return e.replace(pr(),"")}A();function Cr(e){return Number.isInteger(e)?e>=4352&&(e<=4447||e===9001||e===9002||11904<=e&&e<=12871&&e!==12351||12880<=e&&e<=19903||19968<=e&&e<=42182||43360<=e&&e<=43388||44032<=e&&e<=55203||63744<=e&&e<=64255||65040<=e&&e<=65049||65072<=e&&e<=65131||65281<=e&&e<=65376||65504<=e&&e<=65510||110592<=e&&e<=110593||127488<=e&&e<=127569||131072<=e&&e<=262141):!1}var mr=lr(fr(),1);function k(e){if(typeof e!="string"||e.length===0||(e=qt(e),e.length===0))return 0;e=e.replace((0,mr.default)()," ");let t=0;for(let n=0;n<e.length;n++){let u=e.codePointAt(n);u<=31||u>=127&&u<=159||u>=768&&u<=879||(u>65535&&n++,t+=Cr(u)?2:1)}return t}var Ht=e=>Math.max(...e.split(`
3
- `).map(k)),hr=e=>{let t=[];for(let n of e){let{length:u}=n,r=u-t.length;for(let o=0;o<r;o+=1)t.push(0);for(let o=0;o<u;o+=1){let s=Ht(n[o]);s>t[o]&&(t[o]=s)}}return t};A();var zt=/^\d+%$/,Kt={width:"auto",align:"left",contentWidth:0,paddingLeft:0,paddingRight:0,paddingTop:0,paddingBottom:0,horizontalPadding:0,paddingLeftString:"",paddingRightString:""},Fr=(e,t)=>{var n;let u=[];for(let r=0;r<e.length;r+=1){let o=(n=t[r])!=null?n:"auto";if(typeof o=="number"||o==="auto"||o==="content-width"||typeof o=="string"&&zt.test(o)){u.push(_e(Ce({},Kt),{width:o,contentWidth:e[r]}));continue}if(o&&typeof o=="object"){let s=_e(Ce(Ce({},Kt),o),{contentWidth:e[r]});s.horizontalPadding=s.paddingLeft+s.paddingRight,u.push(s);continue}throw new Error(`Invalid column width: ${JSON.stringify(o)}`)}return u};function gr(e,t){for(let n of e){let{width:u}=n;if(u==="content-width"&&(n.width=n.contentWidth),u==="auto"){let D=Math.min(20,n.contentWidth);n.width=D,n.autoOverflow=n.contentWidth-D}if(typeof u=="string"&&zt.test(u)){let D=Number.parseFloat(u.slice(0,-1))/100;n.width=Math.floor(t*D)-(n.paddingLeft+n.paddingRight)}let{horizontalPadding:r}=n,o=1,s=o+r;if(s>=t){let D=s-t,l=Math.ceil(n.paddingLeft/r*D),f=D-l;n.paddingLeft-=l,n.paddingRight-=f,n.horizontalPadding=n.paddingLeft+n.paddingRight}n.paddingLeftString=n.paddingLeft?" ".repeat(n.paddingLeft):"",n.paddingRightString=n.paddingRight?" ".repeat(n.paddingRight):"";let i=t-n.horizontalPadding;n.width=Math.max(Math.min(n.width,i),o)}}var Vt=()=>Object.assign([],{columns:0});function Er(e,t){let n=[Vt()],[u]=n;for(let r of e){let o=r.width+r.horizontalPadding;u.columns+o>t&&(u=Vt(),n.push(u)),u.push(r),u.columns+=o}for(let r of n){let o=r.reduce((c,d)=>c+d.width+d.horizontalPadding,0),s=t-o;if(s===0)continue;let i=r.filter(c=>"autoOverflow"in c),D=i.filter(c=>c.autoOverflow>0),l=D.reduce((c,d)=>c+d.autoOverflow,0),f=Math.min(l,s);for(let c of D){let d=Math.floor(c.autoOverflow/l*f);c.width+=d,s-=d}let a=Math.floor(s/i.length);for(let c=0;c<i.length;c+=1){let d=i[c];c===i.length-1?d.width+=s:d.width+=a,s-=a}}return n}function yr(e,t,n){let u=Fr(n,t);return gr(u,e),Er(u,e)}A(),A(),A();var Re=10,Yt=(e=0)=>t=>`\x1B[${t+e}m`,Jt=(e=0)=>t=>`\x1B[${38+e};5;${t}m`,Xt=(e=0)=>(t,n,u)=>`\x1B[${38+e};2;${t};${n};${u}m`;function br(){let e=new Map,t={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],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],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};t.color.gray=t.color.blackBright,t.bgColor.bgGray=t.bgColor.bgBlackBright,t.color.grey=t.color.blackBright,t.bgColor.bgGrey=t.bgColor.bgBlackBright;for(let[n,u]of Object.entries(t)){for(let[r,o]of Object.entries(u))t[r]={open:`\x1B[${o[0]}m`,close:`\x1B[${o[1]}m`},u[r]=t[r],e.set(o[0],o[1]);Object.defineProperty(t,n,{value:u,enumerable:!1})}return Object.defineProperty(t,"codes",{value:e,enumerable:!1}),t.color.close="\x1B[39m",t.bgColor.close="\x1B[49m",t.color.ansi=Yt(),t.color.ansi256=Jt(),t.color.ansi16m=Xt(),t.bgColor.ansi=Yt(Re),t.bgColor.ansi256=Jt(Re),t.bgColor.ansi16m=Xt(Re),Object.defineProperties(t,{rgbToAnsi256:{value:(n,u,r)=>n===u&&u===r?n<8?16:n>248?231:Math.round((n-8)/247*24)+232:16+36*Math.round(n/255*5)+6*Math.round(u/255*5)+Math.round(r/255*5),enumerable:!1},hexToRgb:{value:n=>{let u=/(?<colorString>[a-f\d]{6}|[a-f\d]{3})/i.exec(n.toString(16));if(!u)return[0,0,0];let{colorString:r}=u.groups;r.length===3&&(r=r.split("").map(s=>s+s).join(""));let o=Number.parseInt(r,16);return[o>>16&255,o>>8&255,o&255]},enumerable:!1},hexToAnsi256:{value:n=>t.rgbToAnsi256(...t.hexToRgb(n)),enumerable:!1},ansi256ToAnsi:{value:n=>{if(n<8)return 30+n;if(n<16)return 90+(n-8);let u,r,o;if(n>=232)u=((n-232)*10+8)/255,r=u,o=u;else{n-=16;let D=n%36;u=Math.floor(n/36)/5,r=Math.floor(D/6)/5,o=D%6/5}let s=Math.max(u,r,o)*2;if(s===0)return 30;let i=30+(Math.round(o)<<2|Math.round(r)<<1|Math.round(u));return s===2&&(i+=60),i},enumerable:!1},rgbToAnsi:{value:(n,u,r)=>t.ansi256ToAnsi(t.rgbToAnsi256(n,u,r)),enumerable:!1},hexToAnsi:{value:n=>t.ansi256ToAnsi(t.hexToAnsi256(n)),enumerable:!1}}),t}var wr=br(),Br=wr,me=new Set(["\x1B","\x9B"]),$r=39,ke="\x07",Zt="[",vr="]",Qt="m",Me=`${vr}8;;`,eu=e=>`${me.values().next().value}${Zt}${e}${Qt}`,tu=e=>`${me.values().next().value}${Me}${e}${ke}`,Ar=e=>e.split(" ").map(t=>k(t)),je=(e,t,n)=>{let u=[...t],r=!1,o=!1,s=k(qt(e[e.length-1]));for(let[i,D]of u.entries()){let l=k(D);if(s+l<=n?e[e.length-1]+=D:(e.push(D),s=0),me.has(D)&&(r=!0,o=u.slice(i+1).join("").startsWith(Me)),r){o?D===ke&&(r=!1,o=!1):D===Qt&&(r=!1);continue}s+=l,s===n&&i<u.length-1&&(e.push(""),s=0)}!s&&e[e.length-1].length>0&&e.length>1&&(e[e.length-2]+=e.pop())},xr=e=>{let t=e.split(" "),n=t.length;for(;n>0&&!(k(t[n-1])>0);)n--;return n===t.length?e:t.slice(0,n).join(" ")+t.slice(n).join("")},Sr=(e,t,n={})=>{if(n.trim!==!1&&e.trim()==="")return"";let u="",r,o,s=Ar(e),i=[""];for(let[l,f]of e.split(" ").entries()){n.trim!==!1&&(i[i.length-1]=i[i.length-1].trimStart());let a=k(i[i.length-1]);if(l!==0&&(a>=t&&(n.wordWrap===!1||n.trim===!1)&&(i.push(""),a=0),(a>0||n.trim===!1)&&(i[i.length-1]+=" ",a++)),n.hard&&s[l]>t){let c=t-a,d=1+Math.floor((s[l]-c-1)/t);Math.floor((s[l]-1)/t)<d&&i.push(""),je(i,f,t);continue}if(a+s[l]>t&&a>0&&s[l]>0){if(n.wordWrap===!1&&a<t){je(i,f,t);continue}i.push("")}if(a+s[l]>t&&n.wordWrap===!1){je(i,f,t);continue}i[i.length-1]+=f}n.trim!==!1&&(i=i.map(l=>xr(l)));let D=[...i.join(`
4
- `)];for(let[l,f]of D.entries()){if(u+=f,me.has(f)){let{groups:c}=new RegExp(`(?:\\${Zt}(?<code>\\d+)m|\\${Me}(?<uri>.*)${ke})`).exec(D.slice(l).join(""))||{groups:{}};if(c.code!==void 0){let d=Number.parseFloat(c.code);r=d===$r?void 0:d}else c.uri!==void 0&&(o=c.uri.length===0?void 0:c.uri)}let a=Br.codes.get(Number(r));D[l+1]===`
5
- `?(o&&(u+=tu("")),r&&a&&(u+=eu(a))):f===`
6
- `&&(r&&a&&(u+=eu(r)),o&&(u+=tu(o)))}return u};function Or(e,t,n){return String(e).normalize().replace(/\r\n/g,`
2
+ import le from"tty";import{Buffer as $n}from"node:buffer";import W from"node:path";import Pt from"node:child_process";import b,{stdin as _t,stdout as Rt}from"node:process";import vn from"child_process";import X from"path";import Pe from"fs";import An from"node:url";import xn,{constants as kt}from"node:os";import Mt from"assert";import jt from"events";import Sn from"buffer";import _e from"stream";import Lt from"util";import*as fe from"node:readline";import Nt from"node:readline";import{WriteStream as On}from"node:tty";import O from"fs/promises";import Gt from"os";import In from"https";import{encoding_for_model as Tn}from"@dqbd/tiktoken";import Pn from"net";import _n from"tls";import Rn,{fileURLToPath as kn,pathToFileURL as Mn}from"url";const jn="known-flag",Ln="unknown-flag",Nn="argument",{stringify:Z}=JSON,Gn=/\B([A-Z])/g,Un=e=>e.replace(Gn,"-$1").toLowerCase(),{hasOwnProperty:Wn}=Object.prototype,Q=(e,t)=>Wn.call(e,t),Hn=e=>Array.isArray(e),Ut=e=>typeof e=="function"?[e,!1]:Hn(e)?[e[0],!0]:Ut(e.type),qn=(e,t)=>e===Boolean?t!=="false":t,zn=(e,t)=>typeof t=="boolean"?t:e===Number&&t===""?Number.NaN:e(t),Kn=/[\s.:=]/,Vn=e=>{const t=`Flag name ${Z(e)}`;if(e.length===0)throw new Error(`${t} cannot be empty`);if(e.length===1)throw new Error(`${t} must be longer than a character`);const n=e.match(Kn);if(n)throw new Error(`${t} cannot contain ${Z(n?.[0])}`)},Yn=e=>{const t={},n=(u,r)=>{if(Q(t,u))throw new Error(`Duplicate flags named ${Z(u)}`);t[u]=r};for(const u in e){if(!Q(e,u))continue;Vn(u);const r=e[u],o=[[],...Ut(r),r];n(u,o);const s=Un(u);if(u!==s&&n(s,o),"alias"in r&&typeof r.alias=="string"){const{alias:D}=r,i=`Flag alias ${Z(D)} for flag ${Z(u)}`;if(D.length===0)throw new Error(`${i} cannot be empty`);if(D.length>1)throw new Error(`${i} must be a single character`);n(D,o)}}return t},Jn=(e,t)=>{const n={};for(const u in e){if(!Q(e,u))continue;const[r,,o,s]=t[u];if(r.length===0&&"default"in s){let{default:D}=s;typeof D=="function"&&(D=D()),n[u]=D}else n[u]=o?r:r.pop()}return n},de="--",Xn=/[.:=]/,Zn=/^-{1,2}\w/,Qn=e=>{if(!Zn.test(e))return;const t=!e.startsWith(de);let n=e.slice(t?1:2),u;const r=n.match(Xn);if(r){const{index:o}=r;u=n.slice(o+1),n=n.slice(0,o)}return[n,u,t]},er=(e,{onFlag:t,onArgument:n})=>{let u;const r=(o,s)=>{if(typeof u!="function")return!0;u(o,s),u=void 0};for(let o=0;o<e.length;o+=1){const s=e[o];if(s===de){r();const i=e.slice(o+1);n?.(i,[o],!0);break}const D=Qn(s);if(D){if(r(),!t)continue;const[i,l,f]=D;if(f)for(let a=0;a<i.length;a+=1){r();const c=a===i.length-1;u=t(i[a],c?l:void 0,[o,a+1,c])}else u=t(i,l,[o])}else r(s,[o])&&n?.([s],[o])}r()},tr=(e,t)=>{for(const[n,u,r]of t.reverse()){if(u){const o=e[n];let s=o.slice(0,u);if(r||(s+=o.slice(u+1)),s!=="-"){e[n]=s;continue}}e.splice(n,1)}},ur=(e,t=process.argv.slice(2),{ignore:n}={})=>{const u=[],r=Yn(e),o={},s=[];return s[de]=[],er(t,{onFlag(D,i,l){const f=Q(r,D);if(!n?.(f?jn:Ln,D,i)){if(f){const[a,c]=r[D],d=qn(c,i),p=(m,h)=>{u.push(l),h&&u.push(h),a.push(zn(c,m||""))};return d===void 0?p:p(d)}Q(o,D)||(o[D]=[]),o[D].push(i===void 0?!0:i),u.push(l)}},onArgument(D,i,l){n?.(Nn,t[i[0]])||(s.push(...D),l?(s[de]=D,t.splice(i[0])):u.push(i))}}),tr(t,u),{flags:Jn(e,r),unknownFlags:o,_:s}};var nr=Object.create,pe=Object.defineProperty,rr=Object.defineProperties,or=Object.getOwnPropertyDescriptor,sr=Object.getOwnPropertyDescriptors,ir=Object.getOwnPropertyNames,Wt=Object.getOwnPropertySymbols,Dr=Object.getPrototypeOf,Ht=Object.prototype.hasOwnProperty,ar=Object.prototype.propertyIsEnumerable,qt=(e,t,n)=>t in e?pe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ce=(e,t)=>{for(var n in t||(t={}))Ht.call(t,n)&&qt(e,n,t[n]);if(Wt)for(var n of Wt(t))ar.call(t,n)&&qt(e,n,t[n]);return e},Re=(e,t)=>rr(e,sr(t)),cr=e=>pe(e,"__esModule",{value:!0}),lr=(e,t)=>()=>(e&&(t=e(e=0)),t),fr=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),dr=(e,t,n,u)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of ir(t))!Ht.call(e,r)&&(n||r!=="default")&&pe(e,r,{get:()=>t[r],enumerable:!(u=or(t,r))||u.enumerable});return e},pr=(e,t)=>dr(cr(pe(e!=null?nr(Dr(e)):{},"default",!t&&e&&e.__esModule?{get:()=>e.default,enumerable:!0}:{value:e,enumerable:!0})),e),A=lr(()=>{}),Cr=fr((e,t)=>{A(),t.exports=function(){return/\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67)\uDB40\uDC7F|(?:\uD83E\uDDD1\uD83C\uDFFF\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFC-\uDFFF])|\uD83D\uDC68(?:\uD83C\uDFFB(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|[\u2695\u2696\u2708]\uFE0F|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))?|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])\uFE0F|\u200D(?:(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D[\uDC66\uDC67])|\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC)?|(?:\uD83D\uDC69(?:\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69]))|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC69(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83E\uDDD1(?:\u200D(?:\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDE36\u200D\uD83C\uDF2B|\uD83C\uDFF3\uFE0F\u200D\u26A7|\uD83D\uDC3B\u200D\u2744|(?:(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\uD83C\uDFF4\u200D\u2620|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])\u200D[\u2640\u2642]|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u2600-\u2604\u260E\u2611\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26B0\u26B1\u26C8\u26CF\u26D1\u26D3\u26E9\u26F0\u26F1\u26F4\u26F7\u26F8\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u3030\u303D\u3297\u3299]|\uD83C[\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]|\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|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDE35\u200D\uD83D\uDCAB|\uD83D\uDE2E\u200D\uD83D\uDCA8|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83E\uDDD1(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83D\uDC69(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF6\uD83C\uDDE6|\uD83C\uDDF4\uD83C\uDDF2|\uD83D\uDC08\u200D\u2B1B|\u2764\uFE0F\u200D(?:\uD83D\uDD25|\uD83E\uDE79)|\uD83D\uDC41\uFE0F|\uD83C\uDFF3\uFE0F|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|[#\*0-9]\uFE0F\u20E3|\u2764\uFE0F|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|\uD83C\uDFF4|(?:[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\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]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270C\u270D]|\uD83D[\uDD74\uDD90])(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC08\uDC15\uDC3B\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE2E\uDE35\uDE36\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5]|\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD]|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF]|[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\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-\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0D\uDD0E\uDD10-\uDD17\uDD1D\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78\uDD7A-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCB\uDDD0\uDDE0-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6]|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26A7\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5-\uDED7\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDD77\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g}});A(),A(),A();var mr=e=>{var t,n,u;let r=(t=process.stdout.columns)!=null?t:Number.POSITIVE_INFINITY;return typeof e=="function"&&(e=e(r)),e||(e={}),Array.isArray(e)?{columns:e,stdoutColumns:r}:{columns:(n=e.columns)!=null?n:[],stdoutColumns:(u=e.stdoutColumns)!=null?u:r}};A(),A(),A(),A(),A();function hr({onlyFirst:e=!1}={}){let t=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))"].join("|");return new RegExp(t,e?void 0:"g")}function zt(e){if(typeof e!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof e}\``);return e.replace(hr(),"")}A();function Fr(e){return Number.isInteger(e)?e>=4352&&(e<=4447||e===9001||e===9002||11904<=e&&e<=12871&&e!==12351||12880<=e&&e<=19903||19968<=e&&e<=42182||43360<=e&&e<=43388||44032<=e&&e<=55203||63744<=e&&e<=64255||65040<=e&&e<=65049||65072<=e&&e<=65131||65281<=e&&e<=65376||65504<=e&&e<=65510||110592<=e&&e<=110593||127488<=e&&e<=127569||131072<=e&&e<=262141):!1}var gr=pr(Cr(),1);function k(e){if(typeof e!="string"||e.length===0||(e=zt(e),e.length===0))return 0;e=e.replace((0,gr.default)()," ");let t=0;for(let n=0;n<e.length;n++){let u=e.codePointAt(n);u<=31||u>=127&&u<=159||u>=768&&u<=879||(u>65535&&n++,t+=Fr(u)?2:1)}return t}var Kt=e=>Math.max(...e.split(`
3
+ `).map(k)),Er=e=>{let t=[];for(let n of e){let{length:u}=n,r=u-t.length;for(let o=0;o<r;o+=1)t.push(0);for(let o=0;o<u;o+=1){let s=Kt(n[o]);s>t[o]&&(t[o]=s)}}return t};A();var Vt=/^\d+%$/,Yt={width:"auto",align:"left",contentWidth:0,paddingLeft:0,paddingRight:0,paddingTop:0,paddingBottom:0,horizontalPadding:0,paddingLeftString:"",paddingRightString:""},yr=(e,t)=>{var n;let u=[];for(let r=0;r<e.length;r+=1){let o=(n=t[r])!=null?n:"auto";if(typeof o=="number"||o==="auto"||o==="content-width"||typeof o=="string"&&Vt.test(o)){u.push(Re(Ce({},Yt),{width:o,contentWidth:e[r]}));continue}if(o&&typeof o=="object"){let s=Re(Ce(Ce({},Yt),o),{contentWidth:e[r]});s.horizontalPadding=s.paddingLeft+s.paddingRight,u.push(s);continue}throw new Error(`Invalid column width: ${JSON.stringify(o)}`)}return u};function br(e,t){for(let n of e){let{width:u}=n;if(u==="content-width"&&(n.width=n.contentWidth),u==="auto"){let i=Math.min(20,n.contentWidth);n.width=i,n.autoOverflow=n.contentWidth-i}if(typeof u=="string"&&Vt.test(u)){let i=Number.parseFloat(u.slice(0,-1))/100;n.width=Math.floor(t*i)-(n.paddingLeft+n.paddingRight)}let{horizontalPadding:r}=n,o=1,s=o+r;if(s>=t){let i=s-t,l=Math.ceil(n.paddingLeft/r*i),f=i-l;n.paddingLeft-=l,n.paddingRight-=f,n.horizontalPadding=n.paddingLeft+n.paddingRight}n.paddingLeftString=n.paddingLeft?" ".repeat(n.paddingLeft):"",n.paddingRightString=n.paddingRight?" ".repeat(n.paddingRight):"";let D=t-n.horizontalPadding;n.width=Math.max(Math.min(n.width,D),o)}}var Jt=()=>Object.assign([],{columns:0});function wr(e,t){let n=[Jt()],[u]=n;for(let r of e){let o=r.width+r.horizontalPadding;u.columns+o>t&&(u=Jt(),n.push(u)),u.push(r),u.columns+=o}for(let r of n){let o=r.reduce((c,d)=>c+d.width+d.horizontalPadding,0),s=t-o;if(s===0)continue;let D=r.filter(c=>"autoOverflow"in c),i=D.filter(c=>c.autoOverflow>0),l=i.reduce((c,d)=>c+d.autoOverflow,0),f=Math.min(l,s);for(let c of i){let d=Math.floor(c.autoOverflow/l*f);c.width+=d,s-=d}let a=Math.floor(s/D.length);for(let c=0;c<D.length;c+=1){let d=D[c];c===D.length-1?d.width+=s:d.width+=a,s-=a}}return n}function Br(e,t,n){let u=yr(n,t);return br(u,e),wr(u,e)}A(),A(),A();var ke=10,Xt=(e=0)=>t=>`\x1B[${t+e}m`,Zt=(e=0)=>t=>`\x1B[${38+e};5;${t}m`,Qt=(e=0)=>(t,n,u)=>`\x1B[${38+e};2;${t};${n};${u}m`;function $r(){let e=new Map,t={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],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],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};t.color.gray=t.color.blackBright,t.bgColor.bgGray=t.bgColor.bgBlackBright,t.color.grey=t.color.blackBright,t.bgColor.bgGrey=t.bgColor.bgBlackBright;for(let[n,u]of Object.entries(t)){for(let[r,o]of Object.entries(u))t[r]={open:`\x1B[${o[0]}m`,close:`\x1B[${o[1]}m`},u[r]=t[r],e.set(o[0],o[1]);Object.defineProperty(t,n,{value:u,enumerable:!1})}return Object.defineProperty(t,"codes",{value:e,enumerable:!1}),t.color.close="\x1B[39m",t.bgColor.close="\x1B[49m",t.color.ansi=Xt(),t.color.ansi256=Zt(),t.color.ansi16m=Qt(),t.bgColor.ansi=Xt(ke),t.bgColor.ansi256=Zt(ke),t.bgColor.ansi16m=Qt(ke),Object.defineProperties(t,{rgbToAnsi256:{value:(n,u,r)=>n===u&&u===r?n<8?16:n>248?231:Math.round((n-8)/247*24)+232:16+36*Math.round(n/255*5)+6*Math.round(u/255*5)+Math.round(r/255*5),enumerable:!1},hexToRgb:{value:n=>{let u=/(?<colorString>[a-f\d]{6}|[a-f\d]{3})/i.exec(n.toString(16));if(!u)return[0,0,0];let{colorString:r}=u.groups;r.length===3&&(r=r.split("").map(s=>s+s).join(""));let o=Number.parseInt(r,16);return[o>>16&255,o>>8&255,o&255]},enumerable:!1},hexToAnsi256:{value:n=>t.rgbToAnsi256(...t.hexToRgb(n)),enumerable:!1},ansi256ToAnsi:{value:n=>{if(n<8)return 30+n;if(n<16)return 90+(n-8);let u,r,o;if(n>=232)u=((n-232)*10+8)/255,r=u,o=u;else{n-=16;let i=n%36;u=Math.floor(n/36)/5,r=Math.floor(i/6)/5,o=i%6/5}let s=Math.max(u,r,o)*2;if(s===0)return 30;let D=30+(Math.round(o)<<2|Math.round(r)<<1|Math.round(u));return s===2&&(D+=60),D},enumerable:!1},rgbToAnsi:{value:(n,u,r)=>t.ansi256ToAnsi(t.rgbToAnsi256(n,u,r)),enumerable:!1},hexToAnsi:{value:n=>t.ansi256ToAnsi(t.hexToAnsi256(n)),enumerable:!1}}),t}var vr=$r(),Ar=vr,me=new Set(["\x1B","\x9B"]),xr=39,Me="\x07",eu="[",Sr="]",tu="m",je=`${Sr}8;;`,uu=e=>`${me.values().next().value}${eu}${e}${tu}`,nu=e=>`${me.values().next().value}${je}${e}${Me}`,Or=e=>e.split(" ").map(t=>k(t)),Le=(e,t,n)=>{let u=[...t],r=!1,o=!1,s=k(zt(e[e.length-1]));for(let[D,i]of u.entries()){let l=k(i);if(s+l<=n?e[e.length-1]+=i:(e.push(i),s=0),me.has(i)&&(r=!0,o=u.slice(D+1).join("").startsWith(je)),r){o?i===Me&&(r=!1,o=!1):i===tu&&(r=!1);continue}s+=l,s===n&&D<u.length-1&&(e.push(""),s=0)}!s&&e[e.length-1].length>0&&e.length>1&&(e[e.length-2]+=e.pop())},Ir=e=>{let t=e.split(" "),n=t.length;for(;n>0&&!(k(t[n-1])>0);)n--;return n===t.length?e:t.slice(0,n).join(" ")+t.slice(n).join("")},Tr=(e,t,n={})=>{if(n.trim!==!1&&e.trim()==="")return"";let u="",r,o,s=Or(e),D=[""];for(let[l,f]of e.split(" ").entries()){n.trim!==!1&&(D[D.length-1]=D[D.length-1].trimStart());let a=k(D[D.length-1]);if(l!==0&&(a>=t&&(n.wordWrap===!1||n.trim===!1)&&(D.push(""),a=0),(a>0||n.trim===!1)&&(D[D.length-1]+=" ",a++)),n.hard&&s[l]>t){let c=t-a,d=1+Math.floor((s[l]-c-1)/t);Math.floor((s[l]-1)/t)<d&&D.push(""),Le(D,f,t);continue}if(a+s[l]>t&&a>0&&s[l]>0){if(n.wordWrap===!1&&a<t){Le(D,f,t);continue}D.push("")}if(a+s[l]>t&&n.wordWrap===!1){Le(D,f,t);continue}D[D.length-1]+=f}n.trim!==!1&&(D=D.map(l=>Ir(l)));let i=[...D.join(`
4
+ `)];for(let[l,f]of i.entries()){if(u+=f,me.has(f)){let{groups:c}=new RegExp(`(?:\\${eu}(?<code>\\d+)m|\\${je}(?<uri>.*)${Me})`).exec(i.slice(l).join(""))||{groups:{}};if(c.code!==void 0){let d=Number.parseFloat(c.code);r=d===xr?void 0:d}else c.uri!==void 0&&(o=c.uri.length===0?void 0:c.uri)}let a=Ar.codes.get(Number(r));i[l+1]===`
5
+ `?(o&&(u+=nu("")),r&&a&&(u+=uu(a))):f===`
6
+ `&&(r&&a&&(u+=uu(r)),o&&(u+=nu(o)))}return u};function Pr(e,t,n){return String(e).normalize().replace(/\r\n/g,`
7
7
  `).split(`
8
- `).map(u=>Sr(u,t,n)).join(`
9
- `)}var uu=e=>Array.from({length:e}).fill("");function Ir(e,t){let n=[],u=0;for(let r of e){let o=0,s=r.map(D=>{var l;let f=(l=t[u])!=null?l:"";u+=1,D.preprocess&&(f=D.preprocess(f)),Ht(f)>D.width&&(f=Or(f,D.width,{hard:!0}));let a=f.split(`
10
- `);if(D.postprocess){let{postprocess:c}=D;a=a.map((d,p)=>c.call(D,d,p))}return D.paddingTop&&a.unshift(...uu(D.paddingTop)),D.paddingBottom&&a.push(...uu(D.paddingBottom)),a.length>o&&(o=a.length),_e(Ce({},D),{lines:a})}),i=[];for(let D=0;D<o;D+=1){let l=s.map(f=>{var a;let c=(a=f.lines[D])!=null?a:"",d=Number.isFinite(f.width)?" ".repeat(f.width-k(c)):"",p=f.paddingLeftString;return f.align==="right"&&(p+=d),p+=c,f.align==="left"&&(p+=d),p+f.paddingRightString}).join("");i.push(l)}n.push(i.join(`
8
+ `).map(u=>Tr(u,t,n)).join(`
9
+ `)}var ru=e=>Array.from({length:e}).fill("");function _r(e,t){let n=[],u=0;for(let r of e){let o=0,s=r.map(i=>{var l;let f=(l=t[u])!=null?l:"";u+=1,i.preprocess&&(f=i.preprocess(f)),Kt(f)>i.width&&(f=Pr(f,i.width,{hard:!0}));let a=f.split(`
10
+ `);if(i.postprocess){let{postprocess:c}=i;a=a.map((d,p)=>c.call(i,d,p))}return i.paddingTop&&a.unshift(...ru(i.paddingTop)),i.paddingBottom&&a.push(...ru(i.paddingBottom)),a.length>o&&(o=a.length),Re(Ce({},i),{lines:a})}),D=[];for(let i=0;i<o;i+=1){let l=s.map(f=>{var a;let c=(a=f.lines[i])!=null?a:"",d=Number.isFinite(f.width)?" ".repeat(f.width-k(c)):"",p=f.paddingLeftString;return f.align==="right"&&(p+=d),p+=c,f.align==="left"&&(p+=d),p+f.paddingRightString}).join("");D.push(l)}n.push(D.join(`
11
11
  `))}return n.join(`
12
- `)}function Tr(e,t){if(!e||e.length===0)return"";let n=hr(e),u=n.length;if(u===0)return"";let{stdoutColumns:r,columns:o}=dr(t);if(o.length>u)throw new Error(`${o.length} columns defined, but only ${u} columns found`);let s=yr(r,o,n);return e.map(i=>Ir(s,i)).join(`
13
- `)}A();var Pr=["<",">","=",">=","<="];function _r(e){if(!Pr.includes(e))throw new TypeError(`Invalid breakpoint operator: ${e}`)}function Rr(e){let t=Object.keys(e).map(n=>{let[u,r]=n.split(" ");_r(u);let o=Number.parseInt(r,10);if(Number.isNaN(o))throw new TypeError(`Invalid breakpoint value: ${r}`);let s=e[n];return{operator:u,breakpoint:o,value:s}}).sort((n,u)=>u.breakpoint-n.breakpoint);return n=>{var u;return(u=t.find(({operator:r,breakpoint:o})=>r==="="&&n===o||r===">"&&n>o||r==="<"&&n<o||r===">="&&n>=o||r==="<="&&n<=o))==null?void 0:u.value}}const kr=e=>e.replace(/[\W_]([a-z\d])?/gi,(t,n)=>n?n.toUpperCase():""),Mr=e=>e.replace(/\B([A-Z])/g,"-$1").toLowerCase(),jr={"> 80":[{width:"content-width",paddingLeft:2,paddingRight:8},{width:"auto"}],"> 40":[{width:"auto",paddingLeft:2,paddingRight:8,preprocess:e=>e.trim()},{width:"100%",paddingLeft:2,paddingBottom:1}],"> 0":{stdoutColumns:1e3,columns:[{width:"content-width",paddingLeft:2,paddingRight:8},{width:"content-width"}]}};function Lr(e){let t=!1;return{type:"table",data:{tableData:Object.keys(e).sort((n,u)=>n.localeCompare(u)).map(n=>{const u=e[n],r="alias"in u;return r&&(t=!0),{name:n,flag:u,flagFormatted:`--${Mr(n)}`,aliasesEnabled:t,aliasFormatted:r?`-${u.alias}`:void 0}}).map(n=>(n.aliasesEnabled=t,[{type:"flagName",data:n},{type:"flagDescription",data:n}])),tableBreakpoints:jr}}}const nu=e=>!e||(e.version??(e.help?e.help.version:void 0)),ru=e=>{const t="parent"in e&&e.parent?.name;return(t?`${t} `:"")+e.name};function Nr(e){const t=[];e.name&&t.push(ru(e));const n=nu(e)??("parent"in e&&nu(e.parent));if(n&&t.push(`v${n}`),t.length!==0)return{id:"name",type:"text",data:`${t.join(" ")}
14
- `}}function Gr(e){const{help:t}=e;if(!(!t||!t.description))return{id:"description",type:"text",data:`${t.description}
15
- `}}function Ur(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=[],u=[ru(e)];if(e.flags&&Object.keys(e.flags).length>0&&u.push("[flags...]"),e.parameters&&e.parameters.length>0){const{parameters:r}=e,o=r.indexOf("--"),s=o>-1&&r.slice(o+1).some(i=>i.startsWith("<"));u.push(r.map(i=>i!=="--"?i:s?"--":"[--]").join(" "))}if(u.length>1&&n.push(u.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
- `)}}}}function Wr(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=>[t.options.name,t.options.help?t.options.help.description:""]),tableOptions:[{width:"content-width",paddingLeft:2,paddingRight:8}]}},indentBody:0}}}function qr(e){if(!(!e.flags||Object.keys(e.flags).length===0))return{id:"flags",type:"section",data:{title:"Flags:",body:Lr(e.flags),indentBody:0}}}function Hr(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}}}function zr(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}}}const Kr=e=>[Nr,Gr,Ur,Wr,qr,Hr,zr].map(t=>t(e)).filter(Boolean),Vr=le.WriteStream.prototype.hasColors();class Yr{text(t){return t}bold(t){return Vr?`\x1B[1m${t}\x1B[22m`:t.toLocaleUpperCase()}indentText({text:t,spaces:n}){return t.replace(/^/gm," ".repeat(n))}heading(t){return this.bold(t)}section({title:t,body:n,indentBody:u=2}){return`${(t?`${this.heading(t)}
12
+ `)}function Rr(e,t){if(!e||e.length===0)return"";let n=Er(e),u=n.length;if(u===0)return"";let{stdoutColumns:r,columns:o}=mr(t);if(o.length>u)throw new Error(`${o.length} columns defined, but only ${u} columns found`);let s=Br(r,o,n);return e.map(D=>_r(s,D)).join(`
13
+ `)}A();var kr=["<",">","=",">=","<="];function Mr(e){if(!kr.includes(e))throw new TypeError(`Invalid breakpoint operator: ${e}`)}function jr(e){let t=Object.keys(e).map(n=>{let[u,r]=n.split(" ");Mr(u);let o=Number.parseInt(r,10);if(Number.isNaN(o))throw new TypeError(`Invalid breakpoint value: ${r}`);let s=e[n];return{operator:u,breakpoint:o,value:s}}).sort((n,u)=>u.breakpoint-n.breakpoint);return n=>{var u;return(u=t.find(({operator:r,breakpoint:o})=>r==="="&&n===o||r===">"&&n>o||r==="<"&&n<o||r===">="&&n>=o||r==="<="&&n<=o))==null?void 0:u.value}}const Lr=e=>e.replace(/[\W_]([a-z\d])?/gi,(t,n)=>n?n.toUpperCase():""),Nr=e=>e.replace(/\B([A-Z])/g,"-$1").toLowerCase(),Gr={"> 80":[{width:"content-width",paddingLeft:2,paddingRight:8},{width:"auto"}],"> 40":[{width:"auto",paddingLeft:2,paddingRight:8,preprocess:e=>e.trim()},{width:"100%",paddingLeft:2,paddingBottom:1}],"> 0":{stdoutColumns:1e3,columns:[{width:"content-width",paddingLeft:2,paddingRight:8},{width:"content-width"}]}};function Ur(e){let t=!1;return{type:"table",data:{tableData:Object.keys(e).sort((n,u)=>n.localeCompare(u)).map(n=>{const u=e[n],r="alias"in u;return r&&(t=!0),{name:n,flag:u,flagFormatted:`--${Nr(n)}`,aliasesEnabled:t,aliasFormatted:r?`-${u.alias}`:void 0}}).map(n=>(n.aliasesEnabled=t,[{type:"flagName",data:n},{type:"flagDescription",data:n}])),tableBreakpoints:Gr}}}const ou=e=>!e||(e.version??(e.help?e.help.version:void 0)),su=e=>{const t="parent"in e&&e.parent?.name;return(t?`${t} `:"")+e.name};function Wr(e){const t=[];e.name&&t.push(su(e));const n=ou(e)??("parent"in e&&ou(e.parent));if(n&&t.push(`v${n}`),t.length!==0)return{id:"name",type:"text",data:`${t.join(" ")}
14
+ `}}function Hr(e){const{help:t}=e;if(!(!t||!t.description))return{id:"description",type:"text",data:`${t.description}
15
+ `}}function qr(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=[],u=[su(e)];if(e.flags&&Object.keys(e.flags).length>0&&u.push("[flags...]"),e.parameters&&e.parameters.length>0){const{parameters:r}=e,o=r.indexOf("--"),s=o>-1&&r.slice(o+1).some(D=>D.startsWith("<"));u.push(r.map(D=>D!=="--"?D:s?"--":"[--]").join(" "))}if(u.length>1&&n.push(u.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
+ `)}}}}function zr(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=>[t.options.name,t.options.help?t.options.help.description:""]),tableOptions:[{width:"content-width",paddingLeft:2,paddingRight:8}]}},indentBody:0}}}function Kr(e){if(!(!e.flags||Object.keys(e.flags).length===0))return{id:"flags",type:"section",data:{title:"Flags:",body:Ur(e.flags),indentBody:0}}}function Vr(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}}}function Yr(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}}}const Jr=e=>[Wr,Hr,qr,zr,Kr,Vr,Yr].map(t=>t(e)).filter(Boolean),Xr=le.WriteStream.prototype.hasColors();class Zr{text(t){return t}bold(t){return Xr?`\x1B[1m${t}\x1B[22m`:t.toLocaleUpperCase()}indentText({text:t,spaces:n}){return t.replace(/^/gm," ".repeat(n))}heading(t){return this.bold(t)}section({title:t,body:n,indentBody:u=2}){return`${(t?`${this.heading(t)}
19
19
  `:"")+(n?this.indentText({text:this.render(n),spaces:u}):"")}
20
- `}table({tableData:t,tableOptions:n,tableBreakpoints:u}){return Tr(t.map(r=>r.map(o=>this.render(o))),u?Rr(u):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:u,aliasesEnabled:r,aliasFormatted:o}=t;let s="";if(o?s+=`${o}, `:r&&(s+=" "),s+=u,"placeholder"in n&&typeof n.placeholder=="string")s+=`${this.flagOperator(t)}${n.placeholder}`;else{const i=this.flagParameter("type"in n?n.type:n);i&&(s+=`${this.flagOperator(t)}${i}`)}return s}flagDefault(t){return JSON.stringify(t)}flagDescription({flag:t}){let n="description"in t?t.description??"":"";if("default"in t){let{default:u}=t;typeof u=="function"&&(u=u()),u&&(n+=` (default: ${this.flagDefault(u)})`)}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)}`)}}const Le=/^[\w.-]+$/,{stringify:I}=JSON,Jr=/[|\\{}()[\]^$+*?.]/;function Ne(e){const t=[];let n,u;for(const r of e){if(u)throw new Error(`Invalid parameter: Spread parameter ${I(u)} must be last`);const o=r[0],s=r[r.length-1];let i;if(o==="<"&&s===">"&&(i=!0,n))throw new Error(`Invalid parameter: Required parameter ${I(r)} cannot come after optional parameter ${I(n)}`);if(o==="["&&s==="]"&&(i=!1,n=r),i===void 0)throw new Error(`Invalid parameter: ${I(r)}. Must be wrapped in <> (required parameter) or [] (optional parameter)`);let D=r.slice(1,-1);const l=D.slice(-3)==="...";l&&(u=r,D=D.slice(0,-3));const f=D.match(Jr);if(f)throw new Error(`Invalid parameter: ${I(r)}. Invalid character found ${I(f[0])}`);t.push({name:D,required:i,spread:l})}return t}function Ge(e,t,n,u){for(let r=0;r<t.length;r+=1){const{name:o,required:s,spread:i}=t[r],D=kr(o);if(D in e)throw new Error(`Invalid parameter: ${I(o)} is used more than once.`);const l=i?n.slice(r):n[r];if(i&&(r=t.length),s&&(!l||i&&l.length===0))return console.error(`Error: Missing required parameter ${I(o)}
22
- `),u(),process.exit(1);e[D]=l}}function Xr(e){return e===void 0||e!==!1}function ou(e,t,n,u){const r={...t.flags},o=t.version;o&&(r.version={type:Boolean,description:"Show version"});const{help:s}=t,i=Xr(s);i&&!("help"in r)&&(r.help={type:Boolean,alias:"h",description:"Show help"});const D=Qn(r,u,{ignore:t.ignoreArgv}),l=()=>{console.log(t.version)};if(o&&D.flags.version===!0)return l(),process.exit(0);const f=new Yr,a=i&&s?.render?s.render:p=>f.render(p),c=p=>{const m=Kr({...t,...p?{help:p}:{},flags:r});console.log(a(m,f))};if(i&&D.flags.help===!0)return c(),process.exit(0);if(t.parameters){let{parameters:p}=t,m=D._;const h=p.indexOf("--"),F=p.slice(h+1),B=Object.create(null);if(h>-1&&F.length>0){p=p.slice(0,h);const T=D._["--"];m=m.slice(0,-T.length||void 0),Ge(B,Ne(p),m,c),Ge(B,Ne(F),T,c)}else Ge(B,Ne(p),m,c);Object.assign(D._,B)}const d={...D,showVersion:l,showHelp:c};return typeof n=="function"&&n(d),{command:e,...d}}function Zr(e,t){const n=new Map;for(const u of t){const r=[u.options.name],{alias:o}=u.options;o&&(Array.isArray(o)?r.push(...o):r.push(o));for(const s of r){if(n.has(s))throw new Error(`Duplicate command name found: ${I(s)}`);n.set(s,u)}}return n.get(e)}function Qr(e,t,n=process.argv.slice(2)){if(!e)throw new Error("Options is required");if("name"in e&&(!e.name||!Le.test(e.name)))throw new Error(`Invalid script name: ${I(e.name)}`);const u=n[0];if(e.commands&&Le.test(u)){const r=Zr(u,e.commands);if(r)return ou(r.options.name,{...r.options,parent:e},r.callback,n.slice(1))}return ou(void 0,e,t,n)}function su(e,t){if(!e)throw new Error("Command options are required");const{name:n}=e;if(e.name===void 0)throw new Error("Command name is required");if(!Le.test(n))throw new Error(`Invalid command name ${JSON.stringify(n)}. Command names must be one word.`);return{options:e,callback:t}}var iu="1.7.0",eo="Writes your git commit messages for you with AI",w=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},M={},to={get exports(){return M},set exports(e){M=e}},Ue,Du;function uo(){if(Du)return Ue;Du=1,Ue=u,u.sync=r;var e=Te;function t(o,s){var i=s.pathExt!==void 0?s.pathExt:process.env.PATHEXT;if(!i||(i=i.split(";"),i.indexOf("")!==-1))return!0;for(var D=0;D<i.length;D++){var l=i[D].toLowerCase();if(l&&o.substr(-l.length).toLowerCase()===l)return!0}return!1}function n(o,s,i){return!o.isSymbolicLink()&&!o.isFile()?!1:t(s,i)}function u(o,s,i){e.stat(o,function(D,l){i(D,D?!1:n(l,o,s))})}function r(o,s){return n(e.statSync(o),o,s)}return Ue}var We,au;function no(){if(au)return We;au=1,We=t,t.sync=n;var e=Te;function t(o,s,i){e.stat(o,function(D,l){i(D,D?!1:u(l,s))})}function n(o,s){return u(e.statSync(o),s)}function u(o,s){return o.isFile()&&r(o,s)}function r(o,s){var i=o.mode,D=o.uid,l=o.gid,f=s.uid!==void 0?s.uid:process.getuid&&process.getuid(),a=s.gid!==void 0?s.gid:process.getgid&&process.getgid(),c=parseInt("100",8),d=parseInt("010",8),p=parseInt("001",8),m=c|d,h=i&p||i&d&&l===a||i&c&&D===f||i&m&&f===0;return h}return We}var he;process.platform==="win32"||w.TESTING_WINDOWS?he=uo():he=no();var ro=qe;qe.sync=oo;function qe(e,t,n){if(typeof t=="function"&&(n=t,t={}),!n){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(u,r){qe(e,t||{},function(o,s){o?r(o):u(s)})})}he(e,t||{},function(u,r){u&&(u.code==="EACCES"||t&&t.ignoreErrors)&&(u=null,r=!1),n(u,r)})}function oo(e,t){try{return he.sync(e,t||{})}catch(n){if(t&&t.ignoreErrors||n.code==="EACCES")return!1;throw n}}const q=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",cu=X,so=q?";":":",lu=ro,fu=e=>Object.assign(new Error(`not found: ${e}`),{code:"ENOENT"}),du=(e,t)=>{const n=t.colon||so,u=e.match(/\//)||q&&e.match(/\\/)?[""]:[...q?[process.cwd()]:[],...(t.path||process.env.PATH||"").split(n)],r=q?t.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",o=q?r.split(n):[""];return q&&e.indexOf(".")!==-1&&o[0]!==""&&o.unshift(""),{pathEnv:u,pathExt:o,pathExtExe:r}},pu=(e,t,n)=>{typeof t=="function"&&(n=t,t={}),t||(t={});const{pathEnv:u,pathExt:r,pathExtExe:o}=du(e,t),s=[],i=l=>new Promise((f,a)=>{if(l===u.length)return t.all&&s.length?f(s):a(fu(e));const c=u[l],d=/^".*"$/.test(c)?c.slice(1,-1):c,p=cu.join(d,e),m=!d&&/^\.[\\\/]/.test(e)?e.slice(0,2)+p:p;f(D(m,l,0))}),D=(l,f,a)=>new Promise((c,d)=>{if(a===r.length)return c(i(f+1));const p=r[a];lu(l+p,{pathExt:o},(m,h)=>{if(!m&&h)if(t.all)s.push(l+p);else return c(l+p);return c(D(l,f,a+1))})});return n?i(0).then(l=>n(null,l),n):i(0)},io=(e,t)=>{t=t||{};const{pathEnv:n,pathExt:u,pathExtExe:r}=du(e,t),o=[];for(let s=0;s<n.length;s++){const i=n[s],D=/^".*"$/.test(i)?i.slice(1,-1):i,l=cu.join(D,e),f=!D&&/^\.[\\\/]/.test(e)?e.slice(0,2)+l:l;for(let a=0;a<u.length;a++){const c=f+u[a];try{if(lu.sync(c,{pathExt:r}))if(t.all)o.push(c);else return c}catch{}}}if(t.all&&o.length)return o;if(t.nothrow)return null;throw fu(e)};var Do=pu;pu.sync=io;var Fe={},ao={get exports(){return Fe},set exports(e){Fe=e}};const Cu=(e={})=>{const t=e.env||process.env;return(e.platform||process.platform)!=="win32"?"PATH":Object.keys(t).reverse().find(u=>u.toUpperCase()==="PATH")||"Path"};ao.exports=Cu,Fe.default=Cu;const mu=X,co=Do,lo=Fe;function hu(e,t){const n=e.options.env||process.env,u=process.cwd(),r=e.options.cwd!=null,o=r&&process.chdir!==void 0&&!process.chdir.disabled;if(o)try{process.chdir(e.options.cwd)}catch{}let s;try{s=co.sync(e.command,{path:n[lo({env:n})],pathExt:t?mu.delimiter:void 0})}catch{}finally{o&&process.chdir(u)}return s&&(s=mu.resolve(r?e.options.cwd:"",s)),s}function fo(e){return hu(e)||hu(e,!0)}var po=fo,He={};const ze=/([()\][%!^"`<>&|;, *?])/g;function Co(e){return e=e.replace(ze,"^$1"),e}function mo(e,t){return e=`${e}`,e=e.replace(/(\\*)"/g,'$1$1\\"'),e=e.replace(/(\\*)$/,"$1$1"),e=`"${e}"`,e=e.replace(ze,"^$1"),t&&(e=e.replace(ze,"^$1")),e}He.command=Co,He.argument=mo;var ho=/^#!(.*)/;const Fo=ho;var go=(e="")=>{const t=e.match(Fo);if(!t)return null;const[n,u]=t[0].replace(/#! ?/,"").split(" "),r=n.split("/").pop();return r==="env"?u:u?`${r} ${u}`:r};const Ke=Te,Eo=go;function yo(e){const n=Buffer.alloc(150);let u;try{u=Ke.openSync(e,"r"),Ke.readSync(u,n,0,150,0),Ke.closeSync(u)}catch{}return Eo(n.toString())}var bo=yo;const wo=X,Fu=po,gu=He,Bo=bo,$o=process.platform==="win32",vo=/\.(?:com|exe)$/i,Ao=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function xo(e){e.file=Fu(e);const t=e.file&&Bo(e.file);return t?(e.args.unshift(e.file),e.command=t,Fu(e)):e.file}function So(e){if(!$o)return e;const t=xo(e),n=!vo.test(t);if(e.options.forceShell||n){const u=Ao.test(t);e.command=wo.normalize(e.command),e.command=gu.command(e.command),e.args=e.args.map(o=>gu.argument(o,u));const r=[e.command].concat(e.args).join(" ");e.args=["/d","/s","/c",`"${r}"`],e.command=process.env.comspec||"cmd.exe",e.options.windowsVerbatimArguments=!0}return e}function Oo(e,t,n){t&&!Array.isArray(t)&&(n=t,t=null),t=t?t.slice(0):[],n=Object.assign({},n);const u={command:e,args:t,options:n,file:void 0,original:{command:e,args:t}};return n.shell?u:So(u)}var Io=Oo;const Ve=process.platform==="win32";function Ye(e,t){return Object.assign(new Error(`${t} ${e.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${t} ${e.command}`,path:e.command,spawnargs:e.args})}function To(e,t){if(!Ve)return;const n=e.emit;e.emit=function(u,r){if(u==="exit"){const o=Eu(r,t);if(o)return n.call(e,"error",o)}return n.apply(e,arguments)}}function Eu(e,t){return Ve&&e===1&&!t.file?Ye(t.original,"spawn"):null}function Po(e,t){return Ve&&e===1&&!t.file?Ye(t.original,"spawnSync"):null}var _o={hookChildProcess:To,verifyENOENT:Eu,verifyENOENTSync:Po,notFoundError:Ye};const yu=Bn,Je=Io,Xe=_o;function bu(e,t,n){const u=Je(e,t,n),r=yu.spawn(u.command,u.args,u.options);return Xe.hookChildProcess(r,u),r}function Ro(e,t,n){const u=Je(e,t,n),r=yu.spawnSync(u.command,u.args,u.options);return r.error=r.error||Xe.verifyENOENTSync(r.status,u),r}to.exports=bu,M.spawn=bu,M.sync=Ro,M._parse=Je,M._enoent=Xe;function ko(e){const t=typeof e=="string"?`
20
+ `}table({tableData:t,tableOptions:n,tableBreakpoints:u}){return Rr(t.map(r=>r.map(o=>this.render(o))),u?jr(u):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:u,aliasesEnabled:r,aliasFormatted:o}=t;let s="";if(o?s+=`${o}, `:r&&(s+=" "),s+=u,"placeholder"in n&&typeof n.placeholder=="string")s+=`${this.flagOperator(t)}${n.placeholder}`;else{const D=this.flagParameter("type"in n?n.type:n);D&&(s+=`${this.flagOperator(t)}${D}`)}return s}flagDefault(t){return JSON.stringify(t)}flagDescription({flag:t}){let n="description"in t?t.description??"":"";if("default"in t){let{default:u}=t;typeof u=="function"&&(u=u()),u&&(n+=` (default: ${this.flagDefault(u)})`)}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)}`)}}const Ne=/^[\w.-]+$/,{stringify:I}=JSON,Qr=/[|\\{}()[\]^$+*?.]/;function Ge(e){const t=[];let n,u;for(const r of e){if(u)throw new Error(`Invalid parameter: Spread parameter ${I(u)} must be last`);const o=r[0],s=r[r.length-1];let D;if(o==="<"&&s===">"&&(D=!0,n))throw new Error(`Invalid parameter: Required parameter ${I(r)} cannot come after optional parameter ${I(n)}`);if(o==="["&&s==="]"&&(D=!1,n=r),D===void 0)throw new Error(`Invalid parameter: ${I(r)}. Must be wrapped in <> (required parameter) or [] (optional parameter)`);let i=r.slice(1,-1);const l=i.slice(-3)==="...";l&&(u=r,i=i.slice(0,-3));const f=i.match(Qr);if(f)throw new Error(`Invalid parameter: ${I(r)}. Invalid character found ${I(f[0])}`);t.push({name:i,required:D,spread:l})}return t}function Ue(e,t,n,u){for(let r=0;r<t.length;r+=1){const{name:o,required:s,spread:D}=t[r],i=Lr(o);if(i in e)throw new Error(`Invalid parameter: ${I(o)} is used more than once.`);const l=D?n.slice(r):n[r];if(D&&(r=t.length),s&&(!l||D&&l.length===0))return console.error(`Error: Missing required parameter ${I(o)}
22
+ `),u(),process.exit(1);e[i]=l}}function eo(e){return e===void 0||e!==!1}function iu(e,t,n,u){const r={...t.flags},o=t.version;o&&(r.version={type:Boolean,description:"Show version"});const{help:s}=t,D=eo(s);D&&!("help"in r)&&(r.help={type:Boolean,alias:"h",description:"Show help"});const i=ur(r,u,{ignore:t.ignoreArgv}),l=()=>{console.log(t.version)};if(o&&i.flags.version===!0)return l(),process.exit(0);const f=new Zr,a=D&&s?.render?s.render:p=>f.render(p),c=p=>{const m=Jr({...t,...p?{help:p}:{},flags:r});console.log(a(m,f))};if(D&&i.flags.help===!0)return c(),process.exit(0);if(t.parameters){let{parameters:p}=t,m=i._;const h=p.indexOf("--"),F=p.slice(h+1),B=Object.create(null);if(h>-1&&F.length>0){p=p.slice(0,h);const P=i._["--"];m=m.slice(0,-P.length||void 0),Ue(B,Ge(p),m,c),Ue(B,Ge(F),P,c)}else Ue(B,Ge(p),m,c);Object.assign(i._,B)}const d={...i,showVersion:l,showHelp:c};return typeof n=="function"&&n(d),{command:e,...d}}function to(e,t){const n=new Map;for(const u of t){const r=[u.options.name],{alias:o}=u.options;o&&(Array.isArray(o)?r.push(...o):r.push(o));for(const s of r){if(n.has(s))throw new Error(`Duplicate command name found: ${I(s)}`);n.set(s,u)}}return n.get(e)}function uo(e,t,n=process.argv.slice(2)){if(!e)throw new Error("Options is required");if("name"in e&&(!e.name||!Ne.test(e.name)))throw new Error(`Invalid script name: ${I(e.name)}`);const u=n[0];if(e.commands&&Ne.test(u)){const r=to(u,e.commands);if(r)return iu(r.options.name,{...r.options,parent:e},r.callback,n.slice(1))}return iu(void 0,e,t,n)}function Du(e,t){if(!e)throw new Error("Command options are required");const{name:n}=e;if(e.name===void 0)throw new Error("Command name is required");if(!Ne.test(n))throw new Error(`Invalid command name ${JSON.stringify(n)}. Command names must be one word.`);return{options:e,callback:t}}var au="1.8.1",no="Writes your git commit messages for you with AI",w=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},M={},ro={get exports(){return M},set exports(e){M=e}},We,cu;function oo(){if(cu)return We;cu=1,We=u,u.sync=r;var e=Pe;function t(o,s){var D=s.pathExt!==void 0?s.pathExt:process.env.PATHEXT;if(!D||(D=D.split(";"),D.indexOf("")!==-1))return!0;for(var i=0;i<D.length;i++){var l=D[i].toLowerCase();if(l&&o.substr(-l.length).toLowerCase()===l)return!0}return!1}function n(o,s,D){return!o.isSymbolicLink()&&!o.isFile()?!1:t(s,D)}function u(o,s,D){e.stat(o,function(i,l){D(i,i?!1:n(l,o,s))})}function r(o,s){return n(e.statSync(o),o,s)}return We}var He,lu;function so(){if(lu)return He;lu=1,He=t,t.sync=n;var e=Pe;function t(o,s,D){e.stat(o,function(i,l){D(i,i?!1:u(l,s))})}function n(o,s){return u(e.statSync(o),s)}function u(o,s){return o.isFile()&&r(o,s)}function r(o,s){var D=o.mode,i=o.uid,l=o.gid,f=s.uid!==void 0?s.uid:process.getuid&&process.getuid(),a=s.gid!==void 0?s.gid:process.getgid&&process.getgid(),c=parseInt("100",8),d=parseInt("010",8),p=parseInt("001",8),m=c|d,h=D&p||D&d&&l===a||D&c&&i===f||D&m&&f===0;return h}return He}var he;process.platform==="win32"||w.TESTING_WINDOWS?he=oo():he=so();var io=qe;qe.sync=Do;function qe(e,t,n){if(typeof t=="function"&&(n=t,t={}),!n){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(u,r){qe(e,t||{},function(o,s){o?r(o):u(s)})})}he(e,t||{},function(u,r){u&&(u.code==="EACCES"||t&&t.ignoreErrors)&&(u=null,r=!1),n(u,r)})}function Do(e,t){try{return he.sync(e,t||{})}catch(n){if(t&&t.ignoreErrors||n.code==="EACCES")return!1;throw n}}const H=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",fu=X,ao=H?";":":",du=io,pu=e=>Object.assign(new Error(`not found: ${e}`),{code:"ENOENT"}),Cu=(e,t)=>{const n=t.colon||ao,u=e.match(/\//)||H&&e.match(/\\/)?[""]:[...H?[process.cwd()]:[],...(t.path||process.env.PATH||"").split(n)],r=H?t.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",o=H?r.split(n):[""];return H&&e.indexOf(".")!==-1&&o[0]!==""&&o.unshift(""),{pathEnv:u,pathExt:o,pathExtExe:r}},mu=(e,t,n)=>{typeof t=="function"&&(n=t,t={}),t||(t={});const{pathEnv:u,pathExt:r,pathExtExe:o}=Cu(e,t),s=[],D=l=>new Promise((f,a)=>{if(l===u.length)return t.all&&s.length?f(s):a(pu(e));const c=u[l],d=/^".*"$/.test(c)?c.slice(1,-1):c,p=fu.join(d,e),m=!d&&/^\.[\\\/]/.test(e)?e.slice(0,2)+p:p;f(i(m,l,0))}),i=(l,f,a)=>new Promise((c,d)=>{if(a===r.length)return c(D(f+1));const p=r[a];du(l+p,{pathExt:o},(m,h)=>{if(!m&&h)if(t.all)s.push(l+p);else return c(l+p);return c(i(l,f,a+1))})});return n?D(0).then(l=>n(null,l),n):D(0)},co=(e,t)=>{t=t||{};const{pathEnv:n,pathExt:u,pathExtExe:r}=Cu(e,t),o=[];for(let s=0;s<n.length;s++){const D=n[s],i=/^".*"$/.test(D)?D.slice(1,-1):D,l=fu.join(i,e),f=!i&&/^\.[\\\/]/.test(e)?e.slice(0,2)+l:l;for(let a=0;a<u.length;a++){const c=f+u[a];try{if(du.sync(c,{pathExt:r}))if(t.all)o.push(c);else return c}catch{}}}if(t.all&&o.length)return o;if(t.nothrow)return null;throw pu(e)};var lo=mu;mu.sync=co;var Fe={},fo={get exports(){return Fe},set exports(e){Fe=e}};const hu=(e={})=>{const t=e.env||process.env;return(e.platform||process.platform)!=="win32"?"PATH":Object.keys(t).reverse().find(u=>u.toUpperCase()==="PATH")||"Path"};fo.exports=hu,Fe.default=hu;const Fu=X,po=lo,Co=Fe;function gu(e,t){const n=e.options.env||process.env,u=process.cwd(),r=e.options.cwd!=null,o=r&&process.chdir!==void 0&&!process.chdir.disabled;if(o)try{process.chdir(e.options.cwd)}catch{}let s;try{s=po.sync(e.command,{path:n[Co({env:n})],pathExt:t?Fu.delimiter:void 0})}catch{}finally{o&&process.chdir(u)}return s&&(s=Fu.resolve(r?e.options.cwd:"",s)),s}function mo(e){return gu(e)||gu(e,!0)}var ho=mo,ze={};const Ke=/([()\][%!^"`<>&|;, *?])/g;function Fo(e){return e=e.replace(Ke,"^$1"),e}function go(e,t){return e=`${e}`,e=e.replace(/(\\*)"/g,'$1$1\\"'),e=e.replace(/(\\*)$/,"$1$1"),e=`"${e}"`,e=e.replace(Ke,"^$1"),t&&(e=e.replace(Ke,"^$1")),e}ze.command=Fo,ze.argument=go;var Eo=/^#!(.*)/;const yo=Eo;var bo=(e="")=>{const t=e.match(yo);if(!t)return null;const[n,u]=t[0].replace(/#! ?/,"").split(" "),r=n.split("/").pop();return r==="env"?u:u?`${r} ${u}`:r};const Ve=Pe,wo=bo;function Bo(e){const n=Buffer.alloc(150);let u;try{u=Ve.openSync(e,"r"),Ve.readSync(u,n,0,150,0),Ve.closeSync(u)}catch{}return wo(n.toString())}var $o=Bo;const vo=X,Eu=ho,yu=ze,Ao=$o,xo=process.platform==="win32",So=/\.(?:com|exe)$/i,Oo=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function Io(e){e.file=Eu(e);const t=e.file&&Ao(e.file);return t?(e.args.unshift(e.file),e.command=t,Eu(e)):e.file}function To(e){if(!xo)return e;const t=Io(e),n=!So.test(t);if(e.options.forceShell||n){const u=Oo.test(t);e.command=vo.normalize(e.command),e.command=yu.command(e.command),e.args=e.args.map(o=>yu.argument(o,u));const r=[e.command].concat(e.args).join(" ");e.args=["/d","/s","/c",`"${r}"`],e.command=process.env.comspec||"cmd.exe",e.options.windowsVerbatimArguments=!0}return e}function Po(e,t,n){t&&!Array.isArray(t)&&(n=t,t=null),t=t?t.slice(0):[],n=Object.assign({},n);const u={command:e,args:t,options:n,file:void 0,original:{command:e,args:t}};return n.shell?u:To(u)}var _o=Po;const Ye=process.platform==="win32";function Je(e,t){return Object.assign(new Error(`${t} ${e.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${t} ${e.command}`,path:e.command,spawnargs:e.args})}function Ro(e,t){if(!Ye)return;const n=e.emit;e.emit=function(u,r){if(u==="exit"){const o=bu(r,t);if(o)return n.call(e,"error",o)}return n.apply(e,arguments)}}function bu(e,t){return Ye&&e===1&&!t.file?Je(t.original,"spawn"):null}function ko(e,t){return Ye&&e===1&&!t.file?Je(t.original,"spawnSync"):null}var Mo={hookChildProcess:Ro,verifyENOENT:bu,verifyENOENTSync:ko,notFoundError:Je};const wu=vn,Xe=_o,Ze=Mo;function Bu(e,t,n){const u=Xe(e,t,n),r=wu.spawn(u.command,u.args,u.options);return Ze.hookChildProcess(r,u),r}function jo(e,t,n){const u=Xe(e,t,n),r=wu.spawnSync(u.command,u.args,u.options);return r.error=r.error||Ze.verifyENOENTSync(r.status,u),r}ro.exports=Bu,M.spawn=Bu,M.sync=jo,M._parse=Xe,M._enoent=Ze;function Lo(e){const t=typeof e=="string"?`
23
23
  `:`
24
- `.charCodeAt(),n=typeof e=="string"?"\r":"\r".charCodeAt();return e[e.length-1]===t&&(e=e.slice(0,-1)),e[e.length-1]===n&&(e=e.slice(0,-1)),e}function wu(e={}){const{env:t=process.env,platform:n=process.platform}=e;return n!=="win32"?"PATH":Object.keys(t).reverse().find(u=>u.toUpperCase()==="PATH")||"Path"}function Mo(e={}){const{cwd:t=b.cwd(),path:n=b.env[wu()],execPath:u=b.execPath}=e;let r;const o=t instanceof URL?$n.fileURLToPath(t):t;let s=W.resolve(o);const i=[];for(;r!==s;)i.push(W.join(s,"node_modules/.bin")),r=s,s=W.resolve(s,"..");return i.push(W.resolve(o,u,"..")),[...i,n].join(W.delimiter)}function jo({env:e=b.env,...t}={}){e={...e};const n=wu({env:e});return t.path=e[n],e[n]=Mo(t),e}const Lo=(e,t,n,u)=>{if(n==="length"||n==="prototype"||n==="arguments"||n==="caller")return;const r=Object.getOwnPropertyDescriptor(e,n),o=Object.getOwnPropertyDescriptor(t,n);!No(r,o)&&u||Object.defineProperty(e,n,o)},No=function(e,t){return e===void 0||e.configurable||e.writable===t.writable&&e.enumerable===t.enumerable&&e.configurable===t.configurable&&(e.writable||e.value===t.value)},Go=(e,t)=>{const n=Object.getPrototypeOf(t);n!==Object.getPrototypeOf(e)&&Object.setPrototypeOf(e,n)},Uo=(e,t)=>`/* Wrapped ${e}*/
25
- ${t}`,Wo=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),qo=Object.getOwnPropertyDescriptor(Function.prototype.toString,"name"),Ho=(e,t,n)=>{const u=n===""?"":`with ${n.trim()}() `,r=Uo.bind(null,u,t.toString());Object.defineProperty(r,"name",qo),Object.defineProperty(e,"toString",{...Wo,value:r})};function zo(e,t,{ignoreNonConfigurable:n=!1}={}){const{name:u}=e;for(const r of Reflect.ownKeys(t))Lo(e,t,r,n);return Go(e,t),Ho(e,t,u),e}const ge=new WeakMap,Bu=(e,t={})=>{if(typeof e!="function")throw new TypeError("Expected a function");let n,u=0;const r=e.displayName||e.name||"<anonymous>",o=function(...s){if(ge.set(o,++u),u===1)n=e.apply(this,s),e=null;else if(t.throw===!0)throw new Error(`Function \`${r}\` can only be called once`);return n};return zo(o,e),ge.set(o,u),o};Bu.callCount=e=>{if(!ge.has(e))throw new Error(`The given function \`${e.name}\` is not wrapped by the \`onetime\` package`);return ge.get(e)};const Ko=function(){const e=vu-$u+1;return Array.from({length:e},Vo)},Vo=function(e,t){return{name:`SIGRT${t+1}`,number:$u+t,action:"terminate",description:"Application-specific signal (realtime)",standard:"posix"}},$u=34,vu=64,Yo=[{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"}],Au=function(){const e=Ko();return[...Yo,...e].map(Jo)},Jo=function({name:e,number:t,description:n,action:u,forced:r=!1,standard:o}){const{signals:{[e]:s}}=_t,i=s!==void 0;return{name:e,number:i?s:t,description:n,supported:i,action:u,forced:r,standard:o}},Xo=function(){const e=Au();return Object.fromEntries(e.map(Zo))},Zo=function({name:e,number:t,description:n,supported:u,action:r,forced:o,standard:s}){return[e,{name:e,number:t,description:n,supported:u,action:r,forced:o,standard:s}]},Qo=Xo(),es=function(){const e=Au(),t=vu+1,n=Array.from({length:t},(u,r)=>ts(r,e));return Object.assign({},...n)},ts=function(e,t){const n=us(e,t);if(n===void 0)return{};const{name:u,description:r,supported:o,action:s,forced:i,standard:D}=n;return{[e]:{name:u,number:e,description:r,supported:o,action:s,forced:i,standard:D}}},us=function(e,t){const n=t.find(({name:u})=>_t.signals[u]===e);return n!==void 0?n:t.find(u=>u.number===e)};es();const ns=({timedOut:e,timeout:t,errorCode:n,signal:u,signalDescription:r,exitCode:o,isCanceled:s})=>e?`timed out after ${t} milliseconds`:s?"was canceled":n!==void 0?`failed with ${n}`:u!==void 0?`was killed with ${u} (${r})`:o!==void 0?`failed with exit code ${o}`:"failed",xu=({stdout:e,stderr:t,all:n,error:u,signal:r,exitCode:o,command:s,escapedCommand:i,timedOut:D,isCanceled:l,killed:f,parsed:{options:{timeout:a}}})=>{o=o===null?void 0:o,r=r===null?void 0:r;const c=r===void 0?void 0:Qo[r].description,d=u&&u.code,m=`Command ${ns({timedOut:D,timeout:a,errorCode:d,signal:r,signalDescription:c,exitCode:o,isCanceled:l})}: ${s}`,h=Object.prototype.toString.call(u)==="[object Error]",F=h?`${m}
24
+ `.charCodeAt(),n=typeof e=="string"?"\r":"\r".charCodeAt();return e[e.length-1]===t&&(e=e.slice(0,-1)),e[e.length-1]===n&&(e=e.slice(0,-1)),e}function $u(e={}){const{env:t=process.env,platform:n=process.platform}=e;return n!=="win32"?"PATH":Object.keys(t).reverse().find(u=>u.toUpperCase()==="PATH")||"Path"}function No(e={}){const{cwd:t=b.cwd(),path:n=b.env[$u()],execPath:u=b.execPath}=e;let r;const o=t instanceof URL?An.fileURLToPath(t):t;let s=W.resolve(o);const D=[];for(;r!==s;)D.push(W.join(s,"node_modules/.bin")),r=s,s=W.resolve(s,"..");return D.push(W.resolve(o,u,"..")),[...D,n].join(W.delimiter)}function Go({env:e=b.env,...t}={}){e={...e};const n=$u({env:e});return t.path=e[n],e[n]=No(t),e}const Uo=(e,t,n,u)=>{if(n==="length"||n==="prototype"||n==="arguments"||n==="caller")return;const r=Object.getOwnPropertyDescriptor(e,n),o=Object.getOwnPropertyDescriptor(t,n);!Wo(r,o)&&u||Object.defineProperty(e,n,o)},Wo=function(e,t){return e===void 0||e.configurable||e.writable===t.writable&&e.enumerable===t.enumerable&&e.configurable===t.configurable&&(e.writable||e.value===t.value)},Ho=(e,t)=>{const n=Object.getPrototypeOf(t);n!==Object.getPrototypeOf(e)&&Object.setPrototypeOf(e,n)},qo=(e,t)=>`/* Wrapped ${e}*/
25
+ ${t}`,zo=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),Ko=Object.getOwnPropertyDescriptor(Function.prototype.toString,"name"),Vo=(e,t,n)=>{const u=n===""?"":`with ${n.trim()}() `,r=qo.bind(null,u,t.toString());Object.defineProperty(r,"name",Ko),Object.defineProperty(e,"toString",{...zo,value:r})};function Yo(e,t,{ignoreNonConfigurable:n=!1}={}){const{name:u}=e;for(const r of Reflect.ownKeys(t))Uo(e,t,r,n);return Ho(e,t),Vo(e,t,u),e}const ge=new WeakMap,vu=(e,t={})=>{if(typeof e!="function")throw new TypeError("Expected a function");let n,u=0;const r=e.displayName||e.name||"<anonymous>",o=function(...s){if(ge.set(o,++u),u===1)n=e.apply(this,s),e=null;else if(t.throw===!0)throw new Error(`Function \`${r}\` can only be called once`);return n};return Yo(o,e),ge.set(o,u),o};vu.callCount=e=>{if(!ge.has(e))throw new Error(`The given function \`${e.name}\` is not wrapped by the \`onetime\` package`);return ge.get(e)};const Jo=function(){const e=xu-Au+1;return Array.from({length:e},Xo)},Xo=function(e,t){return{name:`SIGRT${t+1}`,number:Au+t,action:"terminate",description:"Application-specific signal (realtime)",standard:"posix"}},Au=34,xu=64,Zo=[{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"}],Su=function(){const e=Jo();return[...Zo,...e].map(Qo)},Qo=function({name:e,number:t,description:n,action:u,forced:r=!1,standard:o}){const{signals:{[e]:s}}=kt,D=s!==void 0;return{name:e,number:D?s:t,description:n,supported:D,action:u,forced:r,standard:o}},es=function(){const e=Su();return Object.fromEntries(e.map(ts))},ts=function({name:e,number:t,description:n,supported:u,action:r,forced:o,standard:s}){return[e,{name:e,number:t,description:n,supported:u,action:r,forced:o,standard:s}]},us=es(),ns=function(){const e=Su(),t=xu+1,n=Array.from({length:t},(u,r)=>rs(r,e));return Object.assign({},...n)},rs=function(e,t){const n=os(e,t);if(n===void 0)return{};const{name:u,description:r,supported:o,action:s,forced:D,standard:i}=n;return{[e]:{name:u,number:e,description:r,supported:o,action:s,forced:D,standard:i}}},os=function(e,t){const n=t.find(({name:u})=>kt.signals[u]===e);return n!==void 0?n:t.find(u=>u.number===e)};ns();const ss=({timedOut:e,timeout:t,errorCode:n,signal:u,signalDescription:r,exitCode:o,isCanceled:s})=>e?`timed out after ${t} milliseconds`:s?"was canceled":n!==void 0?`failed with ${n}`:u!==void 0?`was killed with ${u} (${r})`:o!==void 0?`failed with exit code ${o}`:"failed",Ou=({stdout:e,stderr:t,all:n,error:u,signal:r,exitCode:o,command:s,escapedCommand:D,timedOut:i,isCanceled:l,killed:f,parsed:{options:{timeout:a}}})=>{o=o===null?void 0:o,r=r===null?void 0:r;const c=r===void 0?void 0:us[r].description,d=u&&u.code,m=`Command ${ss({timedOut:i,timeout:a,errorCode:d,signal:r,signalDescription:c,exitCode:o,isCanceled:l})}: ${s}`,h=Object.prototype.toString.call(u)==="[object Error]",F=h?`${m}
26
26
  ${u.message}`:m,B=[F,t,e].filter(Boolean).join(`
27
- `);return h?(u.originalMessage=u.message,u.message=B):u=new Error(B),u.shortMessage=F,u.command=s,u.escapedCommand=i,u.exitCode=o,u.signal=r,u.signalDescription=c,u.stdout=e,u.stderr=t,n!==void 0&&(u.all=n),"bufferedData"in u&&delete u.bufferedData,u.failed=!0,u.timedOut=Boolean(D),u.isCanceled=l,u.killed=f&&!D,u},Ee=["stdin","stdout","stderr"],rs=e=>Ee.some(t=>e[t]!==void 0),os=e=>{if(!e)return;const{stdio:t}=e;if(t===void 0)return Ee.map(u=>e[u]);if(rs(e))throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${Ee.map(u=>`\`${u}\``).join(", ")}`);if(typeof t=="string")return t;if(!Array.isArray(t))throw new TypeError(`Expected \`stdio\` to be of type \`string\` or \`Array\`, got \`${typeof t}\``);const n=Math.max(t.length,Ee.length);return Array.from({length:n},(u,r)=>t[r])};var H={},Su={get exports(){return H},set exports(e){H=e}},ye={},ss={get exports(){return ye},set exports(e){ye=e}},Ou;function is(){return Ou||(Ou=1,function(e){e.exports=["SIGABRT","SIGALRM","SIGHUP","SIGINT","SIGTERM"],process.platform!=="win32"&&e.exports.push("SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT"),process.platform==="linux"&&e.exports.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT","SIGUNUSED")}(ss)),ye}var g=w.process;const j=function(e){return e&&typeof e=="object"&&typeof e.removeListener=="function"&&typeof e.emit=="function"&&typeof e.reallyExit=="function"&&typeof e.listeners=="function"&&typeof e.kill=="function"&&typeof e.pid=="number"&&typeof e.on=="function"};if(!j(g))Su.exports=function(){return function(){}};else{var Ds=Rt,ee=is(),as=/^win/i.test(g.platform),be=kt;typeof be!="function"&&(be=be.EventEmitter);var $;g.__signal_exit_emitter__?$=g.__signal_exit_emitter__:($=g.__signal_exit_emitter__=new be,$.count=0,$.emitted={}),$.infinite||($.setMaxListeners(1/0),$.infinite=!0),Su.exports=function(e,t){if(!j(w.process))return function(){};Ds.equal(typeof e,"function","a callback must be provided for exit handler"),te===!1&&Iu();var n="exit";t&&t.alwaysLast&&(n="afterexit");var u=function(){$.removeListener(n,e),$.listeners("exit").length===0&&$.listeners("afterexit").length===0&&Ze()};return $.on(n,e),u};var Ze=function(){!te||!j(w.process)||(te=!1,ee.forEach(function(t){try{g.removeListener(t,Qe[t])}catch{}}),g.emit=et,g.reallyExit=Tu,$.count-=1)};H.unload=Ze;var z=function(t,n,u){$.emitted[t]||($.emitted[t]=!0,$.emit(t,n,u))},Qe={};ee.forEach(function(e){Qe[e]=function(){if(j(w.process)){var n=g.listeners(e);n.length===$.count&&(Ze(),z("exit",null,e),z("afterexit",null,e),as&&e==="SIGHUP"&&(e="SIGINT"),g.kill(g.pid,e))}}}),H.signals=function(){return ee};var te=!1,Iu=function(){te||!j(w.process)||(te=!0,$.count+=1,ee=ee.filter(function(t){try{return g.on(t,Qe[t]),!0}catch{return!1}}),g.emit=ls,g.reallyExit=cs)};H.load=Iu;var Tu=g.reallyExit,cs=function(t){j(w.process)&&(g.exitCode=t||0,z("exit",g.exitCode,null),z("afterexit",g.exitCode,null),Tu.call(g,g.exitCode))},et=g.emit,ls=function(t,n){if(t==="exit"&&j(w.process)){n!==void 0&&(g.exitCode=n);var u=et.apply(this,arguments);return z("exit",g.exitCode,null),z("afterexit",g.exitCode,null),u}else return et.apply(this,arguments)}}const fs=1e3*5,ds=(e,t="SIGTERM",n={})=>{const u=e(t);return ps(e,t,n,u),u},ps=(e,t,n,u)=>{if(!Cs(t,n,u))return;const r=hs(n),o=setTimeout(()=>{e("SIGKILL")},r);o.unref&&o.unref()},Cs=(e,{forceKillAfterTimeout:t},n)=>ms(e)&&t!==!1&&n,ms=e=>e===vn.constants.signals.SIGTERM||typeof e=="string"&&e.toUpperCase()==="SIGTERM",hs=({forceKillAfterTimeout:e=!0})=>{if(e===!0)return fs;if(!Number.isFinite(e)||e<0)throw new TypeError(`Expected the \`forceKillAfterTimeout\` option to be a non-negative integer, got \`${e}\` (${typeof e})`);return e},Fs=(e,t)=>{e.kill()&&(t.isCanceled=!0)},gs=(e,t,n)=>{e.kill(t),n(Object.assign(new Error("Timed out"),{timedOut:!0,signal:t}))},Es=(e,{timeout:t,killSignal:n="SIGTERM"},u)=>{if(t===0||t===void 0)return u;let r;const o=new Promise((i,D)=>{r=setTimeout(()=>{gs(e,n,D)},t)}),s=u.finally(()=>{clearTimeout(r)});return Promise.race([o,s])},ys=({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})`)},bs=async(e,{cleanup:t,detached:n},u)=>{if(!t||n)return u;const r=H(()=>{e.kill()});return u.finally(()=>{r()})};function ws(e){return e!==null&&typeof e=="object"&&typeof e.pipe=="function"}var L={},Bs={get exports(){return L},set exports(e){L=e}};const{PassThrough:$s}=Pe;var vs=e=>{e={...e};const{array:t}=e;let{encoding:n}=e;const u=n==="buffer";let r=!1;t?r=!(n||u):n=n||"utf8",u&&(n=null);const o=new $s({objectMode:r});n&&o.setEncoding(n);let s=0;const i=[];return o.on("data",D=>{i.push(D),r?s=i.length:s+=D.length}),o.getBufferedValue=()=>t?i:u?Buffer.concat(i,s):i.join(""),o.getBufferedLength=()=>s,o};const{constants:As}=An,xs=Pe,{promisify:Ss}=Mt,Os=vs,Is=Ss(xs.pipeline);class Pu extends Error{constructor(){super("maxBuffer exceeded"),this.name="MaxBufferError"}}async function tt(e,t){if(!e)throw new Error("Expected a stream");t={maxBuffer:1/0,...t};const{maxBuffer:n}=t,u=Os(t);return await new Promise((r,o)=>{const s=i=>{i&&u.getBufferedLength()<=As.MAX_LENGTH&&(i.bufferedData=u.getBufferedValue()),o(i)};(async()=>{try{await Is(e,u),r()}catch(i){s(i)}})(),u.on("data",()=>{u.getBufferedLength()>n&&s(new Pu)})}),u.getBufferedValue()}Bs.exports=tt,L.buffer=(e,t)=>tt(e,{...t,encoding:"buffer"}),L.array=(e,t)=>tt(e,{...t,array:!0}),L.MaxBufferError=Pu;const{PassThrough:Ts}=Pe;var Ps=function(){var e=[],t=new Ts({objectMode:!0});return t.setMaxListeners(0),t.add=n,t.isEmpty=u,t.on("unpipe",r),Array.prototype.slice.call(arguments).forEach(n),t;function n(o){return Array.isArray(o)?(o.forEach(n),this):(e.push(o),o.once("end",r.bind(null,o)),o.once("error",t.emit.bind(t,"error")),o.pipe(t,{end:!1}),this)}function u(){return e.length==0}function r(o){e=e.filter(function(s){return s!==o}),!e.length&&t.readable&&t.end()}};const _s=(e,t)=>{t!==void 0&&(ws(t)?t.pipe(e.stdin):e.stdin.end(t))},Rs=(e,{all:t})=>{if(!t||!e.stdout&&!e.stderr)return;const n=Ps();return e.stdout&&n.add(e.stdout),e.stderr&&n.add(e.stderr),n},ut=async(e,t)=>{if(!(!e||t===void 0)){e.destroy();try{return await t}catch(n){return n.bufferedData}}},nt=(e,{encoding:t,buffer:n,maxBuffer:u})=>{if(!(!e||!n))return t?L(e,{encoding:t,maxBuffer:u}):L.buffer(e,{maxBuffer:u})},ks=async({stdout:e,stderr:t,all:n},{encoding:u,buffer:r,maxBuffer:o},s)=>{const i=nt(e,{encoding:u,buffer:r,maxBuffer:o}),D=nt(t,{encoding:u,buffer:r,maxBuffer:o}),l=nt(n,{encoding:u,buffer:r,maxBuffer:o*2});try{return await Promise.all([s,i,D,l])}catch(f){return Promise.all([{error:f,signal:f.signal,timedOut:f.timedOut},ut(e,i),ut(t,D),ut(n,l)])}},Ms=(async()=>{})().constructor.prototype,js=["then","catch","finally"].map(e=>[e,Reflect.getOwnPropertyDescriptor(Ms,e)]),_u=(e,t)=>{for(const[n,u]of js){const r=typeof t=="function"?(...o)=>Reflect.apply(u.value,t(),o):u.value.bind(t);Reflect.defineProperty(e,n,{...u,value:r})}return e},Ls=e=>new Promise((t,n)=>{e.on("exit",(u,r)=>{t({exitCode:u,signal:r})}),e.on("error",u=>{n(u)}),e.stdin&&e.stdin.on("error",u=>{n(u)})}),Ru=(e,t=[])=>Array.isArray(t)?[e,...t]:[e],Ns=/^[\w.-]+$/,Gs=/"/g,Us=e=>typeof e!="string"||Ns.test(e)?e:`"${e.replace(Gs,'\\"')}"`,Ws=(e,t)=>Ru(e,t).join(" "),qs=(e,t)=>Ru(e,t).map(n=>Us(n)).join(" "),Hs=1e3*1e3*100,zs=({env:e,extendEnv:t,preferLocal:n,localDir:u,execPath:r})=>{const o=t?{...b.env,...e}:e;return n?jo({env:o,cwd:u,execPath:r}):o},Ks=(e,t,n={})=>{const u=M._parse(e,t,n);return e=u.command,t=u.args,n=u.options,n={maxBuffer:Hs,buffer:!0,stripFinalNewline:!0,extendEnv:!0,preferLocal:!1,localDir:n.cwd||b.cwd(),execPath:b.execPath,encoding:"utf8",reject:!0,cleanup:!0,all:!1,windowsHide:!0,...n},n.env=zs(n),n.stdio=os(n),b.platform==="win32"&&W.basename(e,".exe")==="cmd"&&t.unshift("/q"),{file:e,args:t,options:n,parsed:u}},rt=(e,t,n)=>typeof t!="string"&&!wn.isBuffer(t)?n===void 0?void 0:"":e.stripFinalNewline?ko(t):t;function ue(e,t,n){const u=Ks(e,t,n),r=Ws(e,t),o=qs(e,t);ys(u.options);let s;try{s=It.spawn(u.file,u.args,u.options)}catch(d){const p=new It.ChildProcess,m=Promise.reject(xu({error:d,stdout:"",stderr:"",all:"",command:r,escapedCommand:o,parsed:u,timedOut:!1,isCanceled:!1,killed:!1}));return _u(p,m)}const i=Ls(s),D=Es(s,u.options,i),l=bs(s,u.options,D),f={isCanceled:!1};s.kill=ds.bind(null,s.kill.bind(s)),s.cancel=Fs.bind(null,s,f);const c=Bu(async()=>{const[{error:d,exitCode:p,signal:m,timedOut:h},F,B,T]=await ks(s,u.options,l),ce=rt(u.options,F),R=rt(u.options,B),Ie=rt(u.options,T);if(d||p!==0||m!==null){const U=xu({error:d,exitCode:p,signal:m,stdout:ce,stderr:R,all:Ie,command:r,escapedCommand:o,parsed:u,timedOut:h,isCanceled:f.isCanceled||(u.options.signal?u.options.signal.aborted:!1),killed:s.killed});if(!u.options.reject)return U;throw U}return{command:r,escapedCommand:o,exitCode:0,stdout:ce,stderr:R,all:Ie,failed:!1,timedOut:!1,isCanceled:!1,killed:!1}});return _s(s,u.options.input),s.all=Rs(s,u.options),_u(s,c)}let N=!0;const K=typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{};let ku=0;if(K.process&&K.process.env&&K.process.stdout){const{FORCE_COLOR:e,NODE_DISABLE_COLORS:t,NO_COLOR:n,TERM:u}=K.process.env;t||n||e==="0"?N=!1:e==="1"||e==="2"||e==="3"?N=!0:u==="dumb"?N=!1:"CI"in K.process.env&&["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE","DRONE"].some(r=>r in K.process.env)?N=!0:N=process.stdout.isTTY,N&&(ku=u&&u.endsWith("-256color")?2:1)}let Mu={enabled:N,supportLevel:ku};function ne(e,t,n=1){const u=`\x1B[${e}m`,r=`\x1B[${t}m`,o=new RegExp(`\\x1b\\[${t}m`,"g");return s=>Mu.enabled&&Mu.supportLevel>=n?u+(""+s).replace(o,u)+r:""+s}const ot=ne(2,22),ju=ne(30,39),we=ne(31,39),Be=ne(32,39),Lu=ne(46,49),st="\x1B",y=`${st}[`,Vs="\x07",it={to(e,t){return t?`${y}${t+1};${e+1}H`:`${y}${e+1}G`},move(e,t){let n="";return e<0?n+=`${y}${-e}D`:e>0&&(n+=`${y}${e}C`),t<0?n+=`${y}${-t}A`:t>0&&(n+=`${y}${t}B`),n},up:(e=1)=>`${y}${e}A`,down:(e=1)=>`${y}${e}B`,forward:(e=1)=>`${y}${e}C`,backward:(e=1)=>`${y}${e}D`,nextLine:(e=1)=>`${y}E`.repeat(e),prevLine:(e=1)=>`${y}F`.repeat(e),left:`${y}G`,hide:`${y}?25l`,show:`${y}?25h`,save:`${st}7`,restore:`${st}8`},Ys={up:(e=1)=>`${y}S`.repeat(e),down:(e=1)=>`${y}T`.repeat(e)},Js={screen:`${y}2J`,up:(e=1)=>`${y}1J`.repeat(e),down:(e=1)=>`${y}J`.repeat(e),line:`${y}2K`,lineEnd:`${y}K`,lineStart:`${y}1K`,lines(e){let t="";for(let n=0;n<e;n++)t+=this.line+(n<e-1?it.up():"");return e&&(t+=it.left),t}};var v={cursor:it,scroll:Ys,erase:Js,beep:Vs},C={},Xs={get exports(){return C},set exports(e){C=e}};let Zs=le,Qs=!("NO_COLOR"in process.env||process.argv.includes("--no-color"))&&("FORCE_COLOR"in process.env||process.argv.includes("--color")||process.platform==="win32"||Zs.isatty(1)&&process.env.TERM!=="dumb"||"CI"in process.env),E=(e,t,n=e)=>u=>{let r=""+u,o=r.indexOf(t,e.length);return~o?e+Nu(r,t,n,o)+t:e+r+t},Nu=(e,t,n,u)=>{let r=e.substring(0,u)+n,o=e.substring(u+t.length),s=o.indexOf(t);return~s?r+Nu(o,t,n,s):r+o},Gu=(e=Qs)=>({isColorSupported:e,reset:e?t=>`\x1B[0m${t}\x1B[0m`:String,bold:e?E("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"):String,dim:e?E("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"):String,italic:e?E("\x1B[3m","\x1B[23m"):String,underline:e?E("\x1B[4m","\x1B[24m"):String,inverse:e?E("\x1B[7m","\x1B[27m"):String,hidden:e?E("\x1B[8m","\x1B[28m"):String,strikethrough:e?E("\x1B[9m","\x1B[29m"):String,black:e?E("\x1B[30m","\x1B[39m"):String,red:e?E("\x1B[31m","\x1B[39m"):String,green:e?E("\x1B[32m","\x1B[39m"):String,yellow:e?E("\x1B[33m","\x1B[39m"):String,blue:e?E("\x1B[34m","\x1B[39m"):String,magenta:e?E("\x1B[35m","\x1B[39m"):String,cyan:e?E("\x1B[36m","\x1B[39m"):String,white:e?E("\x1B[37m","\x1B[39m"):String,gray:e?E("\x1B[90m","\x1B[39m"):String,bgBlack:e?E("\x1B[40m","\x1B[49m"):String,bgRed:e?E("\x1B[41m","\x1B[49m"):String,bgGreen:e?E("\x1B[42m","\x1B[49m"):String,bgYellow:e?E("\x1B[43m","\x1B[49m"):String,bgBlue:e?E("\x1B[44m","\x1B[49m"):String,bgMagenta:e?E("\x1B[45m","\x1B[49m"):String,bgCyan:e?E("\x1B[46m","\x1B[49m"):String,bgWhite:e?E("\x1B[47m","\x1B[49m"):String});Xs.exports=Gu(),C.createColors=Gu;function ei(e,t){if(e===t)return;const n=e.split(`
27
+ `);return h?(u.originalMessage=u.message,u.message=B):u=new Error(B),u.shortMessage=F,u.command=s,u.escapedCommand=D,u.exitCode=o,u.signal=r,u.signalDescription=c,u.stdout=e,u.stderr=t,n!==void 0&&(u.all=n),"bufferedData"in u&&delete u.bufferedData,u.failed=!0,u.timedOut=Boolean(i),u.isCanceled=l,u.killed=f&&!i,u},Ee=["stdin","stdout","stderr"],is=e=>Ee.some(t=>e[t]!==void 0),Ds=e=>{if(!e)return;const{stdio:t}=e;if(t===void 0)return Ee.map(u=>e[u]);if(is(e))throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${Ee.map(u=>`\`${u}\``).join(", ")}`);if(typeof t=="string")return t;if(!Array.isArray(t))throw new TypeError(`Expected \`stdio\` to be of type \`string\` or \`Array\`, got \`${typeof t}\``);const n=Math.max(t.length,Ee.length);return Array.from({length:n},(u,r)=>t[r])};var q={},Iu={get exports(){return q},set exports(e){q=e}},ye={},as={get exports(){return ye},set exports(e){ye=e}},Tu;function cs(){return Tu||(Tu=1,function(e){e.exports=["SIGABRT","SIGALRM","SIGHUP","SIGINT","SIGTERM"],process.platform!=="win32"&&e.exports.push("SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT"),process.platform==="linux"&&e.exports.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT","SIGUNUSED")}(as)),ye}var g=w.process;const j=function(e){return e&&typeof e=="object"&&typeof e.removeListener=="function"&&typeof e.emit=="function"&&typeof e.reallyExit=="function"&&typeof e.listeners=="function"&&typeof e.kill=="function"&&typeof e.pid=="number"&&typeof e.on=="function"};if(!j(g))Iu.exports=function(){return function(){}};else{var ls=Mt,ee=cs(),fs=/^win/i.test(g.platform),be=jt;typeof be!="function"&&(be=be.EventEmitter);var $;g.__signal_exit_emitter__?$=g.__signal_exit_emitter__:($=g.__signal_exit_emitter__=new be,$.count=0,$.emitted={}),$.infinite||($.setMaxListeners(1/0),$.infinite=!0),Iu.exports=function(e,t){if(!j(w.process))return function(){};ls.equal(typeof e,"function","a callback must be provided for exit handler"),te===!1&&Pu();var n="exit";t&&t.alwaysLast&&(n="afterexit");var u=function(){$.removeListener(n,e),$.listeners("exit").length===0&&$.listeners("afterexit").length===0&&Qe()};return $.on(n,e),u};var Qe=function(){!te||!j(w.process)||(te=!1,ee.forEach(function(t){try{g.removeListener(t,et[t])}catch{}}),g.emit=tt,g.reallyExit=_u,$.count-=1)};q.unload=Qe;var z=function(t,n,u){$.emitted[t]||($.emitted[t]=!0,$.emit(t,n,u))},et={};ee.forEach(function(e){et[e]=function(){if(j(w.process)){var n=g.listeners(e);n.length===$.count&&(Qe(),z("exit",null,e),z("afterexit",null,e),fs&&e==="SIGHUP"&&(e="SIGINT"),g.kill(g.pid,e))}}}),q.signals=function(){return ee};var te=!1,Pu=function(){te||!j(w.process)||(te=!0,$.count+=1,ee=ee.filter(function(t){try{return g.on(t,et[t]),!0}catch{return!1}}),g.emit=ps,g.reallyExit=ds)};q.load=Pu;var _u=g.reallyExit,ds=function(t){j(w.process)&&(g.exitCode=t||0,z("exit",g.exitCode,null),z("afterexit",g.exitCode,null),_u.call(g,g.exitCode))},tt=g.emit,ps=function(t,n){if(t==="exit"&&j(w.process)){n!==void 0&&(g.exitCode=n);var u=tt.apply(this,arguments);return z("exit",g.exitCode,null),z("afterexit",g.exitCode,null),u}else return tt.apply(this,arguments)}}const Cs=1e3*5,ms=(e,t="SIGTERM",n={})=>{const u=e(t);return hs(e,t,n,u),u},hs=(e,t,n,u)=>{if(!Fs(t,n,u))return;const r=Es(n),o=setTimeout(()=>{e("SIGKILL")},r);o.unref&&o.unref()},Fs=(e,{forceKillAfterTimeout:t},n)=>gs(e)&&t!==!1&&n,gs=e=>e===xn.constants.signals.SIGTERM||typeof e=="string"&&e.toUpperCase()==="SIGTERM",Es=({forceKillAfterTimeout:e=!0})=>{if(e===!0)return Cs;if(!Number.isFinite(e)||e<0)throw new TypeError(`Expected the \`forceKillAfterTimeout\` option to be a non-negative integer, got \`${e}\` (${typeof e})`);return e},ys=(e,t)=>{e.kill()&&(t.isCanceled=!0)},bs=(e,t,n)=>{e.kill(t),n(Object.assign(new Error("Timed out"),{timedOut:!0,signal:t}))},ws=(e,{timeout:t,killSignal:n="SIGTERM"},u)=>{if(t===0||t===void 0)return u;let r;const o=new Promise((D,i)=>{r=setTimeout(()=>{bs(e,n,i)},t)}),s=u.finally(()=>{clearTimeout(r)});return Promise.race([o,s])},Bs=({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})`)},$s=async(e,{cleanup:t,detached:n},u)=>{if(!t||n)return u;const r=q(()=>{e.kill()});return u.finally(()=>{r()})};function vs(e){return e!==null&&typeof e=="object"&&typeof e.pipe=="function"}var L={},As={get exports(){return L},set exports(e){L=e}};const{PassThrough:xs}=_e;var Ss=e=>{e={...e};const{array:t}=e;let{encoding:n}=e;const u=n==="buffer";let r=!1;t?r=!(n||u):n=n||"utf8",u&&(n=null);const o=new xs({objectMode:r});n&&o.setEncoding(n);let s=0;const D=[];return o.on("data",i=>{D.push(i),r?s=D.length:s+=i.length}),o.getBufferedValue=()=>t?D:u?Buffer.concat(D,s):D.join(""),o.getBufferedLength=()=>s,o};const{constants:Os}=Sn,Is=_e,{promisify:Ts}=Lt,Ps=Ss,_s=Ts(Is.pipeline);class Ru extends Error{constructor(){super("maxBuffer exceeded"),this.name="MaxBufferError"}}async function ut(e,t){if(!e)throw new Error("Expected a stream");t={maxBuffer:1/0,...t};const{maxBuffer:n}=t,u=Ps(t);return await new Promise((r,o)=>{const s=D=>{D&&u.getBufferedLength()<=Os.MAX_LENGTH&&(D.bufferedData=u.getBufferedValue()),o(D)};(async()=>{try{await _s(e,u),r()}catch(D){s(D)}})(),u.on("data",()=>{u.getBufferedLength()>n&&s(new Ru)})}),u.getBufferedValue()}As.exports=ut,L.buffer=(e,t)=>ut(e,{...t,encoding:"buffer"}),L.array=(e,t)=>ut(e,{...t,array:!0}),L.MaxBufferError=Ru;const{PassThrough:Rs}=_e;var ks=function(){var e=[],t=new Rs({objectMode:!0});return t.setMaxListeners(0),t.add=n,t.isEmpty=u,t.on("unpipe",r),Array.prototype.slice.call(arguments).forEach(n),t;function n(o){return Array.isArray(o)?(o.forEach(n),this):(e.push(o),o.once("end",r.bind(null,o)),o.once("error",t.emit.bind(t,"error")),o.pipe(t,{end:!1}),this)}function u(){return e.length==0}function r(o){e=e.filter(function(s){return s!==o}),!e.length&&t.readable&&t.end()}};const Ms=(e,t)=>{t!==void 0&&(vs(t)?t.pipe(e.stdin):e.stdin.end(t))},js=(e,{all:t})=>{if(!t||!e.stdout&&!e.stderr)return;const n=ks();return e.stdout&&n.add(e.stdout),e.stderr&&n.add(e.stderr),n},nt=async(e,t)=>{if(!(!e||t===void 0)){e.destroy();try{return await t}catch(n){return n.bufferedData}}},rt=(e,{encoding:t,buffer:n,maxBuffer:u})=>{if(!(!e||!n))return t?L(e,{encoding:t,maxBuffer:u}):L.buffer(e,{maxBuffer:u})},Ls=async({stdout:e,stderr:t,all:n},{encoding:u,buffer:r,maxBuffer:o},s)=>{const D=rt(e,{encoding:u,buffer:r,maxBuffer:o}),i=rt(t,{encoding:u,buffer:r,maxBuffer:o}),l=rt(n,{encoding:u,buffer:r,maxBuffer:o*2});try{return await Promise.all([s,D,i,l])}catch(f){return Promise.all([{error:f,signal:f.signal,timedOut:f.timedOut},nt(e,D),nt(t,i),nt(n,l)])}},Ns=(async()=>{})().constructor.prototype,Gs=["then","catch","finally"].map(e=>[e,Reflect.getOwnPropertyDescriptor(Ns,e)]),ku=(e,t)=>{for(const[n,u]of Gs){const r=typeof t=="function"?(...o)=>Reflect.apply(u.value,t(),o):u.value.bind(t);Reflect.defineProperty(e,n,{...u,value:r})}return e},Us=e=>new Promise((t,n)=>{e.on("exit",(u,r)=>{t({exitCode:u,signal:r})}),e.on("error",u=>{n(u)}),e.stdin&&e.stdin.on("error",u=>{n(u)})}),Mu=(e,t=[])=>Array.isArray(t)?[e,...t]:[e],Ws=/^[\w.-]+$/,Hs=/"/g,qs=e=>typeof e!="string"||Ws.test(e)?e:`"${e.replace(Hs,'\\"')}"`,zs=(e,t)=>Mu(e,t).join(" "),Ks=(e,t)=>Mu(e,t).map(n=>qs(n)).join(" "),Vs=1e3*1e3*100,Ys=({env:e,extendEnv:t,preferLocal:n,localDir:u,execPath:r})=>{const o=t?{...b.env,...e}:e;return n?Go({env:o,cwd:u,execPath:r}):o},Js=(e,t,n={})=>{const u=M._parse(e,t,n);return e=u.command,t=u.args,n=u.options,n={maxBuffer:Vs,buffer:!0,stripFinalNewline:!0,extendEnv:!0,preferLocal:!1,localDir:n.cwd||b.cwd(),execPath:b.execPath,encoding:"utf8",reject:!0,cleanup:!0,all:!1,windowsHide:!0,...n},n.env=Ys(n),n.stdio=Ds(n),b.platform==="win32"&&W.basename(e,".exe")==="cmd"&&t.unshift("/q"),{file:e,args:t,options:n,parsed:u}},ot=(e,t,n)=>typeof t!="string"&&!$n.isBuffer(t)?n===void 0?void 0:"":e.stripFinalNewline?Lo(t):t;function ue(e,t,n){const u=Js(e,t,n),r=zs(e,t),o=Ks(e,t);Bs(u.options);let s;try{s=Pt.spawn(u.file,u.args,u.options)}catch(d){const p=new Pt.ChildProcess,m=Promise.reject(Ou({error:d,stdout:"",stderr:"",all:"",command:r,escapedCommand:o,parsed:u,timedOut:!1,isCanceled:!1,killed:!1}));return ku(p,m)}const D=Us(s),i=ws(s,u.options,D),l=$s(s,u.options,i),f={isCanceled:!1};s.kill=ms.bind(null,s.kill.bind(s)),s.cancel=ys.bind(null,s,f);const c=vu(async()=>{const[{error:d,exitCode:p,signal:m,timedOut:h},F,B,P]=await Ls(s,u.options,l),ce=ot(u.options,F),R=ot(u.options,B),Te=ot(u.options,P);if(d||p!==0||m!==null){const U=Ou({error:d,exitCode:p,signal:m,stdout:ce,stderr:R,all:Te,command:r,escapedCommand:o,parsed:u,timedOut:h,isCanceled:f.isCanceled||(u.options.signal?u.options.signal.aborted:!1),killed:s.killed});if(!u.options.reject)return U;throw U}return{command:r,escapedCommand:o,exitCode:0,stdout:ce,stderr:R,all:Te,failed:!1,timedOut:!1,isCanceled:!1,killed:!1}});return Ms(s,u.options.input),s.all=js(s,u.options),ku(s,c)}let N=!0;const K=typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{};let ju=0;if(K.process&&K.process.env&&K.process.stdout){const{FORCE_COLOR:e,NODE_DISABLE_COLORS:t,NO_COLOR:n,TERM:u}=K.process.env;t||n||e==="0"?N=!1:e==="1"||e==="2"||e==="3"?N=!0:u==="dumb"?N=!1:"CI"in K.process.env&&["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE","DRONE"].some(r=>r in K.process.env)?N=!0:N=process.stdout.isTTY,N&&(ju=u&&u.endsWith("-256color")?2:1)}let Lu={enabled:N,supportLevel:ju};function ne(e,t,n=1){const u=`\x1B[${e}m`,r=`\x1B[${t}m`,o=new RegExp(`\\x1b\\[${t}m`,"g");return s=>Lu.enabled&&Lu.supportLevel>=n?u+(""+s).replace(o,u)+r:""+s}const st=ne(2,22),Nu=ne(30,39),we=ne(31,39),Be=ne(32,39),Gu=ne(46,49),it="\x1B",y=`${it}[`,Xs="\x07",Dt={to(e,t){return t?`${y}${t+1};${e+1}H`:`${y}${e+1}G`},move(e,t){let n="";return e<0?n+=`${y}${-e}D`:e>0&&(n+=`${y}${e}C`),t<0?n+=`${y}${-t}A`:t>0&&(n+=`${y}${t}B`),n},up:(e=1)=>`${y}${e}A`,down:(e=1)=>`${y}${e}B`,forward:(e=1)=>`${y}${e}C`,backward:(e=1)=>`${y}${e}D`,nextLine:(e=1)=>`${y}E`.repeat(e),prevLine:(e=1)=>`${y}F`.repeat(e),left:`${y}G`,hide:`${y}?25l`,show:`${y}?25h`,save:`${it}7`,restore:`${it}8`},Zs={up:(e=1)=>`${y}S`.repeat(e),down:(e=1)=>`${y}T`.repeat(e)},Qs={screen:`${y}2J`,up:(e=1)=>`${y}1J`.repeat(e),down:(e=1)=>`${y}J`.repeat(e),line:`${y}2K`,lineEnd:`${y}K`,lineStart:`${y}1K`,lines(e){let t="";for(let n=0;n<e;n++)t+=this.line+(n<e-1?Dt.up():"");return e&&(t+=Dt.left),t}};var v={cursor:Dt,scroll:Zs,erase:Qs,beep:Xs},C={},ei={get exports(){return C},set exports(e){C=e}};let ti=le,ui=!("NO_COLOR"in process.env||process.argv.includes("--no-color"))&&("FORCE_COLOR"in process.env||process.argv.includes("--color")||process.platform==="win32"||ti.isatty(1)&&process.env.TERM!=="dumb"||"CI"in process.env),E=(e,t,n=e)=>u=>{let r=""+u,o=r.indexOf(t,e.length);return~o?e+Uu(r,t,n,o)+t:e+r+t},Uu=(e,t,n,u)=>{let r=e.substring(0,u)+n,o=e.substring(u+t.length),s=o.indexOf(t);return~s?r+Uu(o,t,n,s):r+o},Wu=(e=ui)=>({isColorSupported:e,reset:e?t=>`\x1B[0m${t}\x1B[0m`:String,bold:e?E("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"):String,dim:e?E("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"):String,italic:e?E("\x1B[3m","\x1B[23m"):String,underline:e?E("\x1B[4m","\x1B[24m"):String,inverse:e?E("\x1B[7m","\x1B[27m"):String,hidden:e?E("\x1B[8m","\x1B[28m"):String,strikethrough:e?E("\x1B[9m","\x1B[29m"):String,black:e?E("\x1B[30m","\x1B[39m"):String,red:e?E("\x1B[31m","\x1B[39m"):String,green:e?E("\x1B[32m","\x1B[39m"):String,yellow:e?E("\x1B[33m","\x1B[39m"):String,blue:e?E("\x1B[34m","\x1B[39m"):String,magenta:e?E("\x1B[35m","\x1B[39m"):String,cyan:e?E("\x1B[36m","\x1B[39m"):String,white:e?E("\x1B[37m","\x1B[39m"):String,gray:e?E("\x1B[90m","\x1B[39m"):String,bgBlack:e?E("\x1B[40m","\x1B[49m"):String,bgRed:e?E("\x1B[41m","\x1B[49m"):String,bgGreen:e?E("\x1B[42m","\x1B[49m"):String,bgYellow:e?E("\x1B[43m","\x1B[49m"):String,bgBlue:e?E("\x1B[44m","\x1B[49m"):String,bgMagenta:e?E("\x1B[45m","\x1B[49m"):String,bgCyan:e?E("\x1B[46m","\x1B[49m"):String,bgWhite:e?E("\x1B[47m","\x1B[49m"):String});ei.exports=Wu(),C.createColors=Wu;function ni(e,t){if(e===t)return;const n=e.split(`
28
28
  `),u=t.split(`
29
- `),r=[];for(let o=0;o<Math.max(n.length,u.length);o++)n[o]!==u[o]&&r.push(o);return r}const Uu=Symbol("clack:cancel");function Wu(e){return e===Uu}function $e(e,t){e.isTTY&&e.setRawMode(t)}const qu=new Map([["k","up"],["j","down"],["h","left"],["l","right"]]),ti=new Set(["up","down","left","right","space","enter"]);class Hu{constructor({render:t,input:n=Tt,output:u=Pt,...r},o=!0){this._track=!1,this._cursor=0,this.state="initial",this.error="",this.subscribers=new Map,this._prevFrame="",this.opts=r,this.onKeypress=this.onKeypress.bind(this),this.close=this.close.bind(this),this.render=this.render.bind(this),this._render=t.bind(this),this._track=o,this.input=n,this.output=u}prompt(){const t=new xn(0);return t._write=(n,u,r)=>{this._track&&(this.value=this.rl.line.replace(/\t/g,""),this._cursor=this.rl.cursor,this.emit("value",this.value)),r()},this.input.pipe(t),this.rl=jt.createInterface({input:this.input,output:t,tabSize:2,prompt:"",escapeCodeTimeout:50}),jt.emitKeypressEvents(this.input,this.rl),this.rl.prompt(),this.opts.initialValue!==void 0&&this._track&&this.rl.write(this.opts.initialValue),this.input.on("keypress",this.onKeypress),$e(this.input,!0),this.render(),new Promise((n,u)=>{this.once("submit",()=>{this.output.write(v.cursor.show),$e(this.input,!1),n(this.value)}),this.once("cancel",()=>{this.output.write(v.cursor.show),$e(this.input,!1),n(Uu)})})}on(t,n){const u=this.subscribers.get(t)??[];u.push({cb:n}),this.subscribers.set(t,u)}once(t,n){const u=this.subscribers.get(t)??[];u.push({cb:n,once:!0}),this.subscribers.set(t,u)}emit(t,...n){const u=this.subscribers.get(t)??[],r=[];for(const o of u)o.cb(...n),o.once&&r.push(()=>u.splice(u.indexOf(o),1));for(const o of r)o()}unsubscribe(){this.subscribers.clear()}onKeypress(t,n){if(this.state==="error"&&(this.state="active"),n?.name&&!this._track&&qu.has(n.name)&&this.emit("cursor",qu.get(n.name)),n?.name&&ti.has(n.name)&&this.emit("cursor",n.name),t&&(t.toLowerCase()==="y"||t.toLowerCase()==="n")&&this.emit("confirm",t.toLowerCase()==="y"),t&&this.emit("key",t.toLowerCase()),n?.name==="return"){if(this.opts.validate){const u=this.opts.validate(this.value);u&&(this.error=u,this.state="error",this.rl.write(this.value))}this.state!=="error"&&(this.state="submit")}t===""&&(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(`
29
+ `),r=[];for(let o=0;o<Math.max(n.length,u.length);o++)n[o]!==u[o]&&r.push(o);return r}const Hu=Symbol("clack:cancel");function qu(e){return e===Hu}function $e(e,t){e.isTTY&&e.setRawMode(t)}const zu=new Map([["k","up"],["j","down"],["h","left"],["l","right"]]),ri=new Set(["up","down","left","right","space","enter"]);class Ku{constructor({render:t,input:n=_t,output:u=Rt,...r},o=!0){this._track=!1,this._cursor=0,this.state="initial",this.error="",this.subscribers=new Map,this._prevFrame="",this.opts=r,this.onKeypress=this.onKeypress.bind(this),this.close=this.close.bind(this),this.render=this.render.bind(this),this._render=t.bind(this),this._track=o,this.input=n,this.output=u}prompt(){const t=new On(0);return t._write=(n,u,r)=>{this._track&&(this.value=this.rl.line.replace(/\t/g,""),this._cursor=this.rl.cursor,this.emit("value",this.value)),r()},this.input.pipe(t),this.rl=Nt.createInterface({input:this.input,output:t,tabSize:2,prompt:"",escapeCodeTimeout:50}),Nt.emitKeypressEvents(this.input,this.rl),this.rl.prompt(),this.opts.initialValue!==void 0&&this._track&&this.rl.write(this.opts.initialValue),this.input.on("keypress",this.onKeypress),$e(this.input,!0),this.render(),new Promise((n,u)=>{this.once("submit",()=>{this.output.write(v.cursor.show),$e(this.input,!1),n(this.value)}),this.once("cancel",()=>{this.output.write(v.cursor.show),$e(this.input,!1),n(Hu)})})}on(t,n){const u=this.subscribers.get(t)??[];u.push({cb:n}),this.subscribers.set(t,u)}once(t,n){const u=this.subscribers.get(t)??[];u.push({cb:n,once:!0}),this.subscribers.set(t,u)}emit(t,...n){const u=this.subscribers.get(t)??[],r=[];for(const o of u)o.cb(...n),o.once&&r.push(()=>u.splice(u.indexOf(o),1));for(const o of r)o()}unsubscribe(){this.subscribers.clear()}onKeypress(t,n){if(this.state==="error"&&(this.state="active"),n?.name&&!this._track&&zu.has(n.name)&&this.emit("cursor",zu.get(n.name)),n?.name&&ri.has(n.name)&&this.emit("cursor",n.name),t&&(t.toLowerCase()==="y"||t.toLowerCase()==="n")&&this.emit("confirm",t.toLowerCase()==="y"),t&&this.emit("key",t.toLowerCase()),n?.name==="return"){if(this.opts.validate){const u=this.opts.validate(this.value);u&&(this.error=u,this.state="error",this.rl.write(this.value))}this.state!=="error"&&(this.state="submit")}t===""&&(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(`
30
30
  `),$e(this.input,!1),this.rl.close(),this.emit(`${this.state}`,this.value),this.unsubscribe()}restoreCursor(){const t=this._prevFrame.split(`
31
- `).length-1;this.output.write(v.cursor.move(-999,t*-1))}render(){const t=this._render(this)??"";if(t!==this._prevFrame){if(this.state==="initial")this.output.write(v.cursor.hide);else{const n=ei(this._prevFrame,t);if(this.restoreCursor(),n&&n?.length===1){const u=n[0];this.output.write(v.cursor.move(0,u)),this.output.write(v.erase.lines(1));const r=t.split(`
31
+ `).length-1;this.output.write(v.cursor.move(-999,t*-1))}render(){const t=this._render(this)??"";if(t!==this._prevFrame){if(this.state==="initial")this.output.write(v.cursor.hide);else{const n=ni(this._prevFrame,t);if(this.restoreCursor(),n&&n?.length===1){const u=n[0];this.output.write(v.cursor.move(0,u)),this.output.write(v.erase.lines(1));const r=t.split(`
32
32
  `);this.output.write(r[u]),this._prevFrame=t,this.output.write(v.cursor.move(0,r.length-u-1));return}else if(n&&n?.length>1){const u=n[0];this.output.write(v.cursor.move(0,u)),this.output.write(v.erase.down());const r=t.split(`
33
33
  `).slice(u);this.output.write(r.join(`
34
- `)),this._prevFrame=t;return}this.output.write(v.erase.down())}this.output.write(t),this.state==="initial"&&(this.state="active"),this._prevFrame=t}}}class ui extends Hu{get cursor(){return this.value?0:1}get _value(){return this.cursor===0}constructor(t){super(t,!1),this.value=!!t.initialValue,this.on("value",()=>{this.value=this._value}),this.on("confirm",n=>{this.output.write(v.cursor.move(0,-1)),this.value=n,this.state="submit",this.close()}),this.on("cursor",()=>{this.value=!this.value})}}class ni extends Hu{constructor(t){super(t,!1),this.cursor=0,this.options=t.options,this.cursor=this.options.findIndex(({value:n})=>n===t.initialValue),this.cursor===-1&&(this.cursor=0),this.changeValue(),this.on("cursor",n=>{switch(n){case"left":case"up":this.cursor=this.cursor===0?this.options.length-1:this.cursor-1;break;case"down":case"right":this.cursor=this.cursor===this.options.length-1?0:this.cursor+1;break}this.changeValue()})}get _value(){return this.options[this.cursor]}changeValue(){this.value=this._value.value}}function ri({input:e=Tt,output:t=Pt,overwrite:n=!0,hideCursor:u=!0}={}){const r=fe.createInterface({input:e,output:t,prompt:"",tabSize:1});fe.emitKeypressEvents(e,r),e.isTTY&&e.setRawMode(!0);const o=(s,{name:i})=>{if(String(s)===""&&process.exit(0),!n)return;let D=i==="return"?0:-1,l=i==="return"?-1:0;fe.moveCursor(t,D,l,()=>{fe.clearLine(t,1,()=>{e.once("keypress",o)})})};return u&&process.stdout.write(v.cursor.hide),e.once("keypress",o),()=>{e.off("keypress",o),u&&process.stdout.write(v.cursor.show),r.terminal=!1,r.close()}}function oi(){return b.platform!=="win32"?b.env.TERM!=="linux":Boolean(b.env.CI)||Boolean(b.env.WT_SESSION)||Boolean(b.env.TERMINUS_SUBLIME)||b.env.ConEmuTask==="{cmd::Cmder}"||b.env.TERM_PROGRAM==="Terminus-Sublime"||b.env.TERM_PROGRAM==="vscode"||b.env.TERM==="xterm-256color"||b.env.TERM==="alacritty"||b.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}const Dt=oi(),P=(e,t)=>Dt?e:t,si=P("\u25C6","*"),ii=P("\u25A0","x"),Di=P("\u25B2","x"),zu=P("\u25C7","o"),ai=P("\u250C","T"),S=P("\u2502","|"),at=P("\u2514","\u2014"),ct=P("\u25CF",">"),lt=P("\u25CB"," "),Ku=e=>{switch(e){case"initial":case"active":return C.cyan(si);case"cancel":return C.red(ii);case"error":return C.yellow(Di);case"submit":return C.green(zu)}},ci=e=>{const t=e.active??"Yes",n=e.inactive??"No";return new ui({active:t,inactive:n,initialValue:e.initialValue??!0,render(){const u=`${C.gray(S)}
35
- ${Ku(this.state)} ${e.message}
34
+ `)),this._prevFrame=t;return}this.output.write(v.erase.down())}this.output.write(t),this.state==="initial"&&(this.state="active"),this._prevFrame=t}}}class oi extends Ku{get cursor(){return this.value?0:1}get _value(){return this.cursor===0}constructor(t){super(t,!1),this.value=!!t.initialValue,this.on("value",()=>{this.value=this._value}),this.on("confirm",n=>{this.output.write(v.cursor.move(0,-1)),this.value=n,this.state="submit",this.close()}),this.on("cursor",()=>{this.value=!this.value})}}class si extends Ku{constructor(t){super(t,!1),this.cursor=0,this.options=t.options,this.cursor=this.options.findIndex(({value:n})=>n===t.initialValue),this.cursor===-1&&(this.cursor=0),this.changeValue(),this.on("cursor",n=>{switch(n){case"left":case"up":this.cursor=this.cursor===0?this.options.length-1:this.cursor-1;break;case"down":case"right":this.cursor=this.cursor===this.options.length-1?0:this.cursor+1;break}this.changeValue()})}get _value(){return this.options[this.cursor]}changeValue(){this.value=this._value.value}}function ii({input:e=_t,output:t=Rt,overwrite:n=!0,hideCursor:u=!0}={}){const r=fe.createInterface({input:e,output:t,prompt:"",tabSize:1});fe.emitKeypressEvents(e,r),e.isTTY&&e.setRawMode(!0);const o=(s,{name:D})=>{if(String(s)===""&&process.exit(0),!n)return;let i=D==="return"?0:-1,l=D==="return"?-1:0;fe.moveCursor(t,i,l,()=>{fe.clearLine(t,1,()=>{e.once("keypress",o)})})};return u&&process.stdout.write(v.cursor.hide),e.once("keypress",o),()=>{e.off("keypress",o),u&&process.stdout.write(v.cursor.show),r.terminal=!1,r.close()}}function Di(){return b.platform!=="win32"?b.env.TERM!=="linux":Boolean(b.env.CI)||Boolean(b.env.WT_SESSION)||Boolean(b.env.TERMINUS_SUBLIME)||b.env.ConEmuTask==="{cmd::Cmder}"||b.env.TERM_PROGRAM==="Terminus-Sublime"||b.env.TERM_PROGRAM==="vscode"||b.env.TERM==="xterm-256color"||b.env.TERM==="alacritty"||b.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}const at=Di(),_=(e,t)=>at?e:t,ai=_("\u25C6","*"),ci=_("\u25A0","x"),li=_("\u25B2","x"),Vu=_("\u25C7","o"),fi=_("\u250C","T"),S=_("\u2502","|"),ct=_("\u2514","\u2014"),lt=_("\u25CF",">"),ft=_("\u25CB"," "),Yu=e=>{switch(e){case"initial":case"active":return C.cyan(ai);case"cancel":return C.red(ci);case"error":return C.yellow(li);case"submit":return C.green(Vu)}},di=e=>{const t=e.active??"Yes",n=e.inactive??"No";return new oi({active:t,inactive:n,initialValue:e.initialValue??!0,render(){const u=`${C.gray(S)}
35
+ ${Yu(this.state)} ${e.message}
36
36
  `,r=this.value?t:n;switch(this.state){case"submit":return`${u}${C.gray(S)} ${C.dim(r)}`;case"cancel":return`${u}${C.gray(S)} ${C.strikethrough(C.dim(r))}
37
- ${C.gray(S)}`;default:return`${u}${C.cyan(S)} ${this.value?`${C.green(ct)} ${t}`:`${C.dim(lt)} ${C.dim(t)}`} ${C.dim("/")} ${this.value?`${C.dim(lt)} ${C.dim(n)}`:`${C.green(ct)} ${n}`}
38
- ${C.cyan(at)}
39
- `}}}).prompt()},li=e=>{const t=(n,u)=>{const r=n.label??String(n.value);return u==="active"?`${C.green(ct)} ${r} ${n.hint?C.dim(`(${n.hint})`):""}`:u==="selected"?`${C.dim(r)}`:u==="cancelled"?`${C.strikethrough(C.dim(r))}`:`${C.dim(lt)} ${C.dim(r)}`};return new ni({options:e.options,initialValue:e.initialValue,render(){const n=`${C.gray(S)}
40
- ${Ku(this.state)} ${e.message}
37
+ ${C.gray(S)}`;default:return`${u}${C.cyan(S)} ${this.value?`${C.green(lt)} ${t}`:`${C.dim(ft)} ${C.dim(t)}`} ${C.dim("/")} ${this.value?`${C.dim(ft)} ${C.dim(n)}`:`${C.green(lt)} ${n}`}
38
+ ${C.cyan(ct)}
39
+ `}}}).prompt()},pi=e=>{const t=(n,u)=>{const r=n.label??String(n.value);return u==="active"?`${C.green(lt)} ${r} ${n.hint?C.dim(`(${n.hint})`):""}`:u==="selected"?`${C.dim(r)}`:u==="cancelled"?`${C.strikethrough(C.dim(r))}`:`${C.dim(ft)} ${C.dim(r)}`};return new si({options:e.options,initialValue:e.initialValue,render(){const n=`${C.gray(S)}
40
+ ${Yu(this.state)} ${e.message}
41
41
  `;switch(this.state){case"submit":return`${n}${C.gray(S)} ${t(this.options[this.cursor],"selected")}`;case"cancel":return`${n}${C.gray(S)} ${t(this.options[this.cursor],"cancelled")}
42
42
  ${C.gray(S)}`;default:return`${n}${C.cyan(S)} ${this.options.map((u,r)=>t(u,r===this.cursor?"active":"inactive")).join(`
43
43
  ${C.cyan(S)} `)}
44
- ${C.cyan(at)}
45
- `}}}).prompt()},Vu=(e="")=>{process.stdout.write(`${C.gray(ai)} ${e}
44
+ ${C.cyan(ct)}
45
+ `}}}).prompt()},Ju=(e="")=>{process.stdout.write(`${C.gray(fi)} ${e}
46
46
  `)},V=(e="")=>{process.stdout.write(`${C.gray(S)}
47
- ${C.gray(at)} ${e}
47
+ ${C.gray(ct)} ${e}
48
48
 
49
- `)},ft=Dt?["\u25D2","\u25D0","\u25D3","\u25D1"]:["\u2022","o","O","0"],dt=()=>{let e,t;const n=Dt?80:120;return{start(u=""){u=u.replace(/\.?\.?\.$/,""),e=ri(),process.stdout.write(`${C.gray(S)}
49
+ `)},dt=at?["\u25D2","\u25D0","\u25D3","\u25D1"]:["\u2022","o","O","0"],pt=()=>{let e,t;const n=at?80:120;return{start(u=""){u=u.replace(/\.?\.?\.$/,""),e=ii(),process.stdout.write(`${C.gray(S)}
50
50
  ${C.magenta("\u25CB")} ${u}
51
- `);let r=0,o=0;t=setInterval(()=>{let s=ft[r];process.stdout.write(v.cursor.move(-999,-1)),process.stdout.write(`${C.magenta(s)} ${u}${Math.floor(o)>=1?".".repeat(Math.floor(o)).slice(0,3):""}
52
- `),r=r===ft.length-1?0:r+1,o=o===ft.length?0:o+.125},n)},stop(u=""){process.stdout.write(v.cursor.move(-999,-2)),process.stdout.write(v.erase.down(2)),clearInterval(t),process.stdout.write(`${C.gray(S)}
53
- ${C.green(zu)} ${u}
54
- `),e()}}};class x extends Error{}const pt=" ",ve=e=>{e instanceof Error&&!(e instanceof x)&&(e.stack&&console.error(ot(e.stack.split(`
51
+ `);let r=0,o=0;t=setInterval(()=>{let s=dt[r];process.stdout.write(v.cursor.move(-999,-1)),process.stdout.write(`${C.magenta(s)} ${u}${Math.floor(o)>=1?".".repeat(Math.floor(o)).slice(0,3):""}
52
+ `),r=r===dt.length-1?0:r+1,o=o===dt.length?0:o+.125},n)},stop(u=""){process.stdout.write(v.cursor.move(-999,-2)),process.stdout.write(v.erase.down(2)),clearInterval(t),process.stdout.write(`${C.gray(S)}
53
+ ${C.green(Vu)} ${u}
54
+ `),e()}}};class x extends Error{}const Ct=" ",ve=e=>{e instanceof Error&&!(e instanceof x)&&(e.stack&&console.error(st(e.stack.split(`
55
55
  `).slice(1).join(`
56
56
  `))),console.error(`
57
- ${pt}${ot(`aicommits v${iu}`)}`),console.error(`
58
- ${pt}Please open a Bug report with the information above:`),console.error(`${pt}https://github.com/Nutlope/aicommits/issues/new/choose`))},Yu=async()=>{const{stdout:e}=await ue("git",["rev-parse","--is-inside-work-tree"],{reject:!1});if(e!=="true")throw new x("The current directory must be a Git repository!")},Ct=e=>`:(exclude)${e}`,Ju=["package-lock.json","pnpm-lock.yaml","*.lock"].map(Ct),Xu=async e=>{const t=["diff","--cached"],{stdout:n}=await ue("git",[...t,"--name-only",...Ju,...e?e.map(Ct):[]]);if(!n)return;const{stdout:u}=await ue("git",[...t,...Ju,...e?e.map(Ct):[]]);return{files:n.split(`
59
- `),diff:u}},fi=e=>`Detected ${e.length.toLocaleString()} staged file${e.length>1?"s":""}`,{hasOwnProperty:mt}=Object.prototype,Ae=typeof process<"u"&&process.platform==="win32"?`\r
57
+ ${Ct}${st(`aicommits v${au}`)}`),console.error(`
58
+ ${Ct}Please open a Bug report with the information above:`),console.error(`${Ct}https://github.com/Nutlope/aicommits/issues/new/choose`))},Xu=async()=>{const{stdout:e}=await ue("git",["rev-parse","--is-inside-work-tree"],{reject:!1});if(e!=="true")throw new x("The current directory must be a Git repository!")},mt=e=>`:(exclude)${e}`,Zu=["package-lock.json","pnpm-lock.yaml","*.lock"].map(mt),Qu=async e=>{const t=["diff","--cached","--diff-algorithm=minimal"],{stdout:n}=await ue("git",[...t,"--name-only",...Zu,...e?e.map(mt):[]]);if(!n)return;const{stdout:u}=await ue("git",[...t,...Zu,...e?e.map(mt):[]]);return{files:n.split(`
59
+ `),diff:u}},Ci=e=>`Detected ${e.length.toLocaleString()} staged file${e.length>1?"s":""}`,{hasOwnProperty:ht}=Object.prototype,Ae=typeof process<"u"&&process.platform==="win32"?`\r
60
60
  `:`
61
- `,ht=(e,t)=>{const n=[];let u="";typeof t=="string"?t={section:t,whitespace:!1}:(t=t||Object.create(null),t.whitespace=t.whitespace===!0);const r=t.whitespace?" = ":"=";for(const o of Object.keys(e)){const s=e[o];if(s&&Array.isArray(s))for(const i of s)u+=Y(o+"[]")+r+Y(i)+Ae;else s&&typeof s=="object"?n.push(o):u+=Y(o)+r+Y(s)+Ae}t.section&&u.length&&(u="["+Y(t.section)+"]"+Ae+u);for(const o of n){const s=Zu(o).join("\\."),i=(t.section?t.section+".":"")+s,{whitespace:D}=t,l=ht(e[o],{section:i,whitespace:D});u.length&&l.length&&(u+=Ae),u+=l}return u},Zu=e=>e.replace(/\1/g,"LITERAL\\1LITERAL").replace(/\\\./g,"").split(/\./).map(t=>t.replace(/\1/g,"\\.").replace(/\2LITERAL\\1LITERAL\2/g,"")),Qu=e=>{const t=Object.create(null);let n=t,u=null;const r=/^\[([^\]]*)\]$|^([^=]+)(=(.*))?$/i,o=e.split(/[\r\n]+/g);for(const i of o){if(!i||i.match(/^\s*[;#]/))continue;const D=i.match(r);if(!D)continue;if(D[1]!==void 0){if(u=xe(D[1]),u==="__proto__"){n=Object.create(null);continue}n=t[u]=t[u]||Object.create(null);continue}const l=xe(D[2]),f=l.length>2&&l.slice(-2)==="[]",a=f?l.slice(0,-2):l;if(a==="__proto__")continue;const c=D[3]?xe(D[4]):!0,d=c==="true"||c==="false"||c==="null"?JSON.parse(c):c;f&&(mt.call(n,a)?Array.isArray(n[a])||(n[a]=[n[a]]):n[a]=[]),Array.isArray(n[a])?n[a].push(d):n[a]=d}const s=[];for(const i of Object.keys(t)){if(!mt.call(t,i)||typeof t[i]!="object"||Array.isArray(t[i]))continue;const D=Zu(i);n=t;const l=D.pop(),f=l.replace(/\\\./g,".");for(const a of D)a!=="__proto__"&&((!mt.call(n,a)||typeof n[a]!="object")&&(n[a]=Object.create(null)),n=n[a]);n===t&&f===l||(n[f]=t[i],s.push(i))}for(const i of s)delete t[i];return t},en=e=>e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'"),Y=e=>typeof e!="string"||e.match(/[=\r\n]/)||e.match(/^\[/)||e.length>1&&en(e)||e!==e.trim()?JSON.stringify(e):e.split(";").join("\\;").split("#").join("\\#"),xe=(e,t)=>{if(e=(e||"").trim(),en(e)){e.charAt(0)==="'"&&(e=e.slice(1,-1));try{e=JSON.parse(e)}catch{}}else{let n=!1,u="";for(let r=0,o=e.length;r<o;r++){const s=e.charAt(r);if(n)"\\;#".indexOf(s)!==-1?u+=s:u+="\\"+s,n=!1;else{if(";#".indexOf(s)!==-1)break;s==="\\"?n=!0:u+=s}}return n&&(u+="\\"),u.trim()}return e};var tn={parse:Qu,decode:Qu,stringify:ht,encode:ht,safe:Y,unsafe:xe};const un=e=>O.lstat(e).then(()=>!0,()=>!1),{hasOwnProperty:di}=Object.prototype,nn=(e,t)=>di.call(e,t),G=(e,t,n)=>{if(!t)throw new x(`Invalid config property ${e}: ${n}`)},Se={OPENAI_KEY(e){if(!e)throw new x("Please set your OpenAI API key via `aicommits config set OPENAI_KEY=<your token>`");return G("OPENAI_KEY",e.startsWith("sk-"),'Must start with "sk-"'),e},locale(e){return e?(G("locale",e,"Cannot be empty"),G("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;G("generate",/^\d+$/.test(e),"Must be an integer");const t=Number(e);return G("generate",t>0,"Must be greater than 0"),G("generate",t<=5,"Must be less or equal to 5"),t},proxy(e){if(!(!e||e.length===0))return G("proxy",/^https?:\/\//.test(e),"Must be a valid URL"),e}},Ft=X.join(Lt.homedir(),".aicommits"),rn=async()=>{if(!await un(Ft))return Object.create(null);const t=await O.readFile(Ft,"utf8");return tn.parse(t)},gt=async e=>{const t=await rn(),n={};for(const u of Object.keys(Se)){const r=Se[u],o=e?.[u]??t[u];n[u]=r(o)}return n},pi=async e=>{const t=await rn();for(const[n,u]of e){if(!nn(Se,n))throw new x(`Invalid config property: ${n}`);const r=Se[n](u);t[n]=r}await O.writeFile(Ft,tn.stringify(t),"utf8")};var Et={},re={},Ci={get exports(){return re},set exports(e){re=e}},oe={},mi={get exports(){return oe},set exports(e){oe=e}},yt,on;function hi(){if(on)return yt;on=1;var e=1e3,t=e*60,n=t*60,u=n*24,r=u*7,o=u*365.25;yt=function(f,a){a=a||{};var c=typeof f;if(c==="string"&&f.length>0)return s(f);if(c==="number"&&isFinite(f))return a.long?D(f):i(f);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(f))};function s(f){if(f=String(f),!(f.length>100)){var a=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(f);if(a){var c=parseFloat(a[1]),d=(a[2]||"ms").toLowerCase();switch(d){case"years":case"year":case"yrs":case"yr":case"y":return c*o;case"weeks":case"week":case"w":return c*r;case"days":case"day":case"d":return c*u;case"hours":case"hour":case"hrs":case"hr":case"h":return c*n;case"minutes":case"minute":case"mins":case"min":case"m":return c*t;case"seconds":case"second":case"secs":case"sec":case"s":return c*e;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return c;default:return}}}}function i(f){var a=Math.abs(f);return a>=u?Math.round(f/u)+"d":a>=n?Math.round(f/n)+"h":a>=t?Math.round(f/t)+"m":a>=e?Math.round(f/e)+"s":f+"ms"}function D(f){var a=Math.abs(f);return a>=u?l(f,a,u,"day"):a>=n?l(f,a,n,"hour"):a>=t?l(f,a,t,"minute"):a>=e?l(f,a,e,"second"):f+" ms"}function l(f,a,c,d){var p=a>=c*1.5;return Math.round(f/c)+" "+d+(p?"s":"")}return yt}var bt,sn;function Dn(){if(sn)return bt;sn=1;function e(t){u.debug=u,u.default=u,u.coerce=l,u.disable=s,u.enable=o,u.enabled=i,u.humanize=hi(),u.destroy=f,Object.keys(t).forEach(a=>{u[a]=t[a]}),u.names=[],u.skips=[],u.formatters={};function n(a){let c=0;for(let d=0;d<a.length;d++)c=(c<<5)-c+a.charCodeAt(d),c|=0;return u.colors[Math.abs(c)%u.colors.length]}u.selectColor=n;function u(a){let c,d=null,p,m;function h(...F){if(!h.enabled)return;const B=h,T=Number(new Date),ce=T-(c||T);B.diff=ce,B.prev=c,B.curr=T,c=T,F[0]=u.coerce(F[0]),typeof F[0]!="string"&&F.unshift("%O");let R=0;F[0]=F[0].replace(/%([a-zA-Z%])/g,(U,yn)=>{if(U==="%%")return"%";R++;const Ot=u.formatters[yn];if(typeof Ot=="function"){const bn=F[R];U=Ot.call(B,bn),F.splice(R,1),R--}return U}),u.formatArgs.call(B,F),(B.log||u.log).apply(B,F)}return h.namespace=a,h.useColors=u.useColors(),h.color=u.selectColor(a),h.extend=r,h.destroy=u.destroy,Object.defineProperty(h,"enabled",{enumerable:!0,configurable:!1,get:()=>d!==null?d:(p!==u.namespaces&&(p=u.namespaces,m=u.enabled(a)),m),set:F=>{d=F}}),typeof u.init=="function"&&u.init(h),h}function r(a,c){const d=u(this.namespace+(typeof c>"u"?":":c)+a);return d.log=this.log,d}function o(a){u.save(a),u.namespaces=a,u.names=[],u.skips=[];let c;const d=(typeof a=="string"?a:"").split(/[\s,]+/),p=d.length;for(c=0;c<p;c++)d[c]&&(a=d[c].replace(/\*/g,".*?"),a[0]==="-"?u.skips.push(new RegExp("^"+a.slice(1)+"$")):u.names.push(new RegExp("^"+a+"$")))}function s(){const a=[...u.names.map(D),...u.skips.map(D).map(c=>"-"+c)].join(",");return u.enable(""),a}function i(a){if(a[a.length-1]==="*")return!0;let c,d;for(c=0,d=u.skips.length;c<d;c++)if(u.skips[c].test(a))return!1;for(c=0,d=u.names.length;c<d;c++)if(u.names[c].test(a))return!0;return!1}function D(a){return a.toString().substring(2,a.toString().length-2).replace(/\.\*\?$/,"*")}function l(a){return a instanceof Error?a.stack||a.message:a}function f(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return u.enable(u.load()),u}return bt=e,bt}var an;function Fi(){return an||(an=1,function(e,t){t.formatArgs=u,t.save=r,t.load=o,t.useColors=n,t.storage=s(),t.destroy=(()=>{let D=!1;return()=>{D||(D=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function n(){return typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs)?!0:typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)?!1:typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function u(D){if(D[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+D[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const l="color: "+this.color;D.splice(1,0,l,"color: inherit");let f=0,a=0;D[0].replace(/%[a-zA-Z%]/g,c=>{c!=="%%"&&(f++,c==="%c"&&(a=f))}),D.splice(a,0,l)}t.log=console.debug||console.log||(()=>{});function r(D){try{D?t.storage.setItem("debug",D):t.storage.removeItem("debug")}catch{}}function o(){let D;try{D=t.storage.getItem("debug")}catch{}return!D&&typeof process<"u"&&"env"in process&&(D=process.env.DEBUG),D}function s(){try{return localStorage}catch{}}e.exports=Dn()(t);const{formatters:i}=e.exports;i.j=function(D){try{return JSON.stringify(D)}catch(l){return"[UnexpectedJSONParseError]: "+l.message}}}(mi,oe)),oe}var se={},gi={get exports(){return se},set exports(e){se=e}},wt,cn;function Ei(){return cn||(cn=1,wt=(e,t=process.argv)=>{const n=e.startsWith("-")?"":e.length===1?"-":"--",u=t.indexOf(n+e),r=t.indexOf("--");return u!==-1&&(r===-1||u<r)}),wt}var Bt,ln;function yi(){if(ln)return Bt;ln=1;const e=Lt,t=le,n=Ei(),{env:u}=process;let r;n("no-color")||n("no-colors")||n("color=false")||n("color=never")?r=0:(n("color")||n("colors")||n("color=true")||n("color=always"))&&(r=1),"FORCE_COLOR"in u&&(u.FORCE_COLOR==="true"?r=1:u.FORCE_COLOR==="false"?r=0:r=u.FORCE_COLOR.length===0?1:Math.min(parseInt(u.FORCE_COLOR,10),3));function o(D){return D===0?!1:{level:D,hasBasic:!0,has256:D>=2,has16m:D>=3}}function s(D,l){if(r===0)return 0;if(n("color=16m")||n("color=full")||n("color=truecolor"))return 3;if(n("color=256"))return 2;if(D&&!l&&r===void 0)return 0;const f=r||0;if(u.TERM==="dumb")return f;if(process.platform==="win32"){const a=e.release().split(".");return Number(a[0])>=10&&Number(a[2])>=10586?Number(a[2])>=14931?3:2:1}if("CI"in u)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some(a=>a in u)||u.CI_NAME==="codeship"?1:f;if("TEAMCITY_VERSION"in u)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(u.TEAMCITY_VERSION)?1:0;if(u.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in u){const a=parseInt((u.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(u.TERM_PROGRAM){case"iTerm.app":return a>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(u.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(u.TERM)||"COLORTERM"in u?1:f}function i(D){const l=s(D,D&&D.isTTY);return o(l)}return Bt={supportsColor:i,stdout:o(s(!0,t.isatty(1))),stderr:o(s(!0,t.isatty(2)))},Bt}var fn;function bi(){return fn||(fn=1,function(e,t){const n=le,u=Mt;t.init=f,t.log=i,t.formatArgs=o,t.save=D,t.load=l,t.useColors=r,t.destroy=u.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."),t.colors=[6,2,3,4,5,1];try{const c=yi();c&&(c.stderr||c).level>=2&&(t.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch{}t.inspectOpts=Object.keys(process.env).filter(c=>/^debug_/i.test(c)).reduce((c,d)=>{const p=d.substring(6).toLowerCase().replace(/_([a-z])/g,(h,F)=>F.toUpperCase());let m=process.env[d];return/^(yes|on|true|enabled)$/i.test(m)?m=!0:/^(no|off|false|disabled)$/i.test(m)?m=!1:m==="null"?m=null:m=Number(m),c[p]=m,c},{});function r(){return"colors"in t.inspectOpts?Boolean(t.inspectOpts.colors):n.isatty(process.stderr.fd)}function o(c){const{namespace:d,useColors:p}=this;if(p){const m=this.color,h="\x1B[3"+(m<8?m:"8;5;"+m),F=` ${h};1m${d} \x1B[0m`;c[0]=F+c[0].split(`
61
+ `,Ft=(e,t)=>{const n=[];let u="";typeof t=="string"?t={section:t,whitespace:!1}:(t=t||Object.create(null),t.whitespace=t.whitespace===!0);const r=t.whitespace?" = ":"=";for(const o of Object.keys(e)){const s=e[o];if(s&&Array.isArray(s))for(const D of s)u+=Y(o+"[]")+r+Y(D)+Ae;else s&&typeof s=="object"?n.push(o):u+=Y(o)+r+Y(s)+Ae}t.section&&u.length&&(u="["+Y(t.section)+"]"+Ae+u);for(const o of n){const s=en(o).join("\\."),D=(t.section?t.section+".":"")+s,{whitespace:i}=t,l=Ft(e[o],{section:D,whitespace:i});u.length&&l.length&&(u+=Ae),u+=l}return u},en=e=>e.replace(/\1/g,"LITERAL\\1LITERAL").replace(/\\\./g,"").split(/\./).map(t=>t.replace(/\1/g,"\\.").replace(/\2LITERAL\\1LITERAL\2/g,"")),tn=e=>{const t=Object.create(null);let n=t,u=null;const r=/^\[([^\]]*)\]$|^([^=]+)(=(.*))?$/i,o=e.split(/[\r\n]+/g);for(const D of o){if(!D||D.match(/^\s*[;#]/))continue;const i=D.match(r);if(!i)continue;if(i[1]!==void 0){if(u=xe(i[1]),u==="__proto__"){n=Object.create(null);continue}n=t[u]=t[u]||Object.create(null);continue}const l=xe(i[2]),f=l.length>2&&l.slice(-2)==="[]",a=f?l.slice(0,-2):l;if(a==="__proto__")continue;const c=i[3]?xe(i[4]):!0,d=c==="true"||c==="false"||c==="null"?JSON.parse(c):c;f&&(ht.call(n,a)?Array.isArray(n[a])||(n[a]=[n[a]]):n[a]=[]),Array.isArray(n[a])?n[a].push(d):n[a]=d}const s=[];for(const D of Object.keys(t)){if(!ht.call(t,D)||typeof t[D]!="object"||Array.isArray(t[D]))continue;const i=en(D);n=t;const l=i.pop(),f=l.replace(/\\\./g,".");for(const a of i)a!=="__proto__"&&((!ht.call(n,a)||typeof n[a]!="object")&&(n[a]=Object.create(null)),n=n[a]);n===t&&f===l||(n[f]=t[D],s.push(D))}for(const D of s)delete t[D];return t},un=e=>e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'"),Y=e=>typeof e!="string"||e.match(/[=\r\n]/)||e.match(/^\[/)||e.length>1&&un(e)||e!==e.trim()?JSON.stringify(e):e.split(";").join("\\;").split("#").join("\\#"),xe=(e,t)=>{if(e=(e||"").trim(),un(e)){e.charAt(0)==="'"&&(e=e.slice(1,-1));try{e=JSON.parse(e)}catch{}}else{let n=!1,u="";for(let r=0,o=e.length;r<o;r++){const s=e.charAt(r);if(n)"\\;#".indexOf(s)!==-1?u+=s:u+="\\"+s,n=!1;else{if(";#".indexOf(s)!==-1)break;s==="\\"?n=!0:u+=s}}return n&&(u+="\\"),u.trim()}return e};var nn={parse:tn,decode:tn,stringify:Ft,encode:Ft,safe:Y,unsafe:xe};const rn=e=>O.lstat(e).then(()=>!0,()=>!1),{hasOwnProperty:mi}=Object.prototype,on=(e,t)=>mi.call(e,t),G=(e,t,n)=>{if(!t)throw new x(`Invalid config property ${e}: ${n}`)},Se={OPENAI_KEY(e){if(!e)throw new x("Please set your OpenAI API key via `aicommits config set OPENAI_KEY=<your token>`");return G("OPENAI_KEY",e.startsWith("sk-"),'Must start with "sk-"'),e},locale(e){return e?(G("locale",e,"Cannot be empty"),G("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;G("generate",/^\d+$/.test(e),"Must be an integer");const t=Number(e);return G("generate",t>0,"Must be greater than 0"),G("generate",t<=5,"Must be less or equal to 5"),t},proxy(e){if(!(!e||e.length===0))return G("proxy",/^https?:\/\//.test(e),"Must be a valid URL"),e},model(e){return!e||e.length===0?"gpt-3.5-turbo":e}},gt=X.join(Gt.homedir(),".aicommits"),sn=async()=>{if(!await rn(gt))return Object.create(null);const t=await O.readFile(gt,"utf8");return nn.parse(t)},Et=async e=>{const t=await sn(),n={};for(const u of Object.keys(Se)){const r=Se[u],o=e?.[u]??t[u];n[u]=r(o)}return n},hi=async e=>{const t=await sn();for(const[n,u]of e){if(!on(Se,n))throw new x(`Invalid config property: ${n}`);const r=Se[n](u);t[n]=r}await O.writeFile(gt,nn.stringify(t),"utf8")};var yt={},re={},Fi={get exports(){return re},set exports(e){re=e}},oe={},gi={get exports(){return oe},set exports(e){oe=e}},bt,Dn;function Ei(){if(Dn)return bt;Dn=1;var e=1e3,t=e*60,n=t*60,u=n*24,r=u*7,o=u*365.25;bt=function(f,a){a=a||{};var c=typeof f;if(c==="string"&&f.length>0)return s(f);if(c==="number"&&isFinite(f))return a.long?i(f):D(f);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(f))};function s(f){if(f=String(f),!(f.length>100)){var a=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(f);if(a){var c=parseFloat(a[1]),d=(a[2]||"ms").toLowerCase();switch(d){case"years":case"year":case"yrs":case"yr":case"y":return c*o;case"weeks":case"week":case"w":return c*r;case"days":case"day":case"d":return c*u;case"hours":case"hour":case"hrs":case"hr":case"h":return c*n;case"minutes":case"minute":case"mins":case"min":case"m":return c*t;case"seconds":case"second":case"secs":case"sec":case"s":return c*e;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return c;default:return}}}}function D(f){var a=Math.abs(f);return a>=u?Math.round(f/u)+"d":a>=n?Math.round(f/n)+"h":a>=t?Math.round(f/t)+"m":a>=e?Math.round(f/e)+"s":f+"ms"}function i(f){var a=Math.abs(f);return a>=u?l(f,a,u,"day"):a>=n?l(f,a,n,"hour"):a>=t?l(f,a,t,"minute"):a>=e?l(f,a,e,"second"):f+" ms"}function l(f,a,c,d){var p=a>=c*1.5;return Math.round(f/c)+" "+d+(p?"s":"")}return bt}var wt,an;function cn(){if(an)return wt;an=1;function e(t){u.debug=u,u.default=u,u.coerce=l,u.disable=s,u.enable=o,u.enabled=D,u.humanize=Ei(),u.destroy=f,Object.keys(t).forEach(a=>{u[a]=t[a]}),u.names=[],u.skips=[],u.formatters={};function n(a){let c=0;for(let d=0;d<a.length;d++)c=(c<<5)-c+a.charCodeAt(d),c|=0;return u.colors[Math.abs(c)%u.colors.length]}u.selectColor=n;function u(a){let c,d=null,p,m;function h(...F){if(!h.enabled)return;const B=h,P=Number(new Date),ce=P-(c||P);B.diff=ce,B.prev=c,B.curr=P,c=P,F[0]=u.coerce(F[0]),typeof F[0]!="string"&&F.unshift("%O");let R=0;F[0]=F[0].replace(/%([a-zA-Z%])/g,(U,wn)=>{if(U==="%%")return"%";R++;const Tt=u.formatters[wn];if(typeof Tt=="function"){const Bn=F[R];U=Tt.call(B,Bn),F.splice(R,1),R--}return U}),u.formatArgs.call(B,F),(B.log||u.log).apply(B,F)}return h.namespace=a,h.useColors=u.useColors(),h.color=u.selectColor(a),h.extend=r,h.destroy=u.destroy,Object.defineProperty(h,"enabled",{enumerable:!0,configurable:!1,get:()=>d!==null?d:(p!==u.namespaces&&(p=u.namespaces,m=u.enabled(a)),m),set:F=>{d=F}}),typeof u.init=="function"&&u.init(h),h}function r(a,c){const d=u(this.namespace+(typeof c>"u"?":":c)+a);return d.log=this.log,d}function o(a){u.save(a),u.namespaces=a,u.names=[],u.skips=[];let c;const d=(typeof a=="string"?a:"").split(/[\s,]+/),p=d.length;for(c=0;c<p;c++)d[c]&&(a=d[c].replace(/\*/g,".*?"),a[0]==="-"?u.skips.push(new RegExp("^"+a.slice(1)+"$")):u.names.push(new RegExp("^"+a+"$")))}function s(){const a=[...u.names.map(i),...u.skips.map(i).map(c=>"-"+c)].join(",");return u.enable(""),a}function D(a){if(a[a.length-1]==="*")return!0;let c,d;for(c=0,d=u.skips.length;c<d;c++)if(u.skips[c].test(a))return!1;for(c=0,d=u.names.length;c<d;c++)if(u.names[c].test(a))return!0;return!1}function i(a){return a.toString().substring(2,a.toString().length-2).replace(/\.\*\?$/,"*")}function l(a){return a instanceof Error?a.stack||a.message:a}function f(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return u.enable(u.load()),u}return wt=e,wt}var ln;function yi(){return ln||(ln=1,function(e,t){t.formatArgs=u,t.save=r,t.load=o,t.useColors=n,t.storage=s(),t.destroy=(()=>{let i=!1;return()=>{i||(i=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function n(){return typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs)?!0:typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)?!1:typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function u(i){if(i[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+i[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const l="color: "+this.color;i.splice(1,0,l,"color: inherit");let f=0,a=0;i[0].replace(/%[a-zA-Z%]/g,c=>{c!=="%%"&&(f++,c==="%c"&&(a=f))}),i.splice(a,0,l)}t.log=console.debug||console.log||(()=>{});function r(i){try{i?t.storage.setItem("debug",i):t.storage.removeItem("debug")}catch{}}function o(){let i;try{i=t.storage.getItem("debug")}catch{}return!i&&typeof process<"u"&&"env"in process&&(i=process.env.DEBUG),i}function s(){try{return localStorage}catch{}}e.exports=cn()(t);const{formatters:D}=e.exports;D.j=function(i){try{return JSON.stringify(i)}catch(l){return"[UnexpectedJSONParseError]: "+l.message}}}(gi,oe)),oe}var se={},bi={get exports(){return se},set exports(e){se=e}},Bt,fn;function wi(){return fn||(fn=1,Bt=(e,t=process.argv)=>{const n=e.startsWith("-")?"":e.length===1?"-":"--",u=t.indexOf(n+e),r=t.indexOf("--");return u!==-1&&(r===-1||u<r)}),Bt}var $t,dn;function Bi(){if(dn)return $t;dn=1;const e=Gt,t=le,n=wi(),{env:u}=process;let r;n("no-color")||n("no-colors")||n("color=false")||n("color=never")?r=0:(n("color")||n("colors")||n("color=true")||n("color=always"))&&(r=1),"FORCE_COLOR"in u&&(u.FORCE_COLOR==="true"?r=1:u.FORCE_COLOR==="false"?r=0:r=u.FORCE_COLOR.length===0?1:Math.min(parseInt(u.FORCE_COLOR,10),3));function o(i){return i===0?!1:{level:i,hasBasic:!0,has256:i>=2,has16m:i>=3}}function s(i,l){if(r===0)return 0;if(n("color=16m")||n("color=full")||n("color=truecolor"))return 3;if(n("color=256"))return 2;if(i&&!l&&r===void 0)return 0;const f=r||0;if(u.TERM==="dumb")return f;if(process.platform==="win32"){const a=e.release().split(".");return Number(a[0])>=10&&Number(a[2])>=10586?Number(a[2])>=14931?3:2:1}if("CI"in u)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some(a=>a in u)||u.CI_NAME==="codeship"?1:f;if("TEAMCITY_VERSION"in u)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(u.TEAMCITY_VERSION)?1:0;if(u.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in u){const a=parseInt((u.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(u.TERM_PROGRAM){case"iTerm.app":return a>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(u.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(u.TERM)||"COLORTERM"in u?1:f}function D(i){const l=s(i,i&&i.isTTY);return o(l)}return $t={supportsColor:D,stdout:o(s(!0,t.isatty(1))),stderr:o(s(!0,t.isatty(2)))},$t}var pn;function $i(){return pn||(pn=1,function(e,t){const n=le,u=Lt;t.init=f,t.log=D,t.formatArgs=o,t.save=i,t.load=l,t.useColors=r,t.destroy=u.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."),t.colors=[6,2,3,4,5,1];try{const c=Bi();c&&(c.stderr||c).level>=2&&(t.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch{}t.inspectOpts=Object.keys(process.env).filter(c=>/^debug_/i.test(c)).reduce((c,d)=>{const p=d.substring(6).toLowerCase().replace(/_([a-z])/g,(h,F)=>F.toUpperCase());let m=process.env[d];return/^(yes|on|true|enabled)$/i.test(m)?m=!0:/^(no|off|false|disabled)$/i.test(m)?m=!1:m==="null"?m=null:m=Number(m),c[p]=m,c},{});function r(){return"colors"in t.inspectOpts?Boolean(t.inspectOpts.colors):n.isatty(process.stderr.fd)}function o(c){const{namespace:d,useColors:p}=this;if(p){const m=this.color,h="\x1B[3"+(m<8?m:"8;5;"+m),F=` ${h};1m${d} \x1B[0m`;c[0]=F+c[0].split(`
62
62
  `).join(`
63
- `+F),c.push(h+"m+"+e.exports.humanize(this.diff)+"\x1B[0m")}else c[0]=s()+d+" "+c[0]}function s(){return t.inspectOpts.hideDate?"":new Date().toISOString()+" "}function i(...c){return process.stderr.write(u.format(...c)+`
64
- `)}function D(c){c?process.env.DEBUG=c:delete process.env.DEBUG}function l(){return process.env.DEBUG}function f(c){c.inspectOpts={};const d=Object.keys(t.inspectOpts);for(let p=0;p<d.length;p++)c.inspectOpts[d[p]]=t.inspectOpts[d[p]]}e.exports=Dn()(t);const{formatters:a}=e.exports;a.o=function(c){return this.inspectOpts.colors=this.useColors,u.inspect(c,this.inspectOpts).split(`
65
- `).map(d=>d.trim()).join(" ")},a.O=function(c){return this.inspectOpts.colors=this.useColors,u.inspect(c,this.inspectOpts)}}(gi,se)),se}(function(e){typeof process>"u"||process.type==="renderer"||process.browser===!0||process.__nwjs?e.exports=Fi():e.exports=bi()})(Ci);var $t={};Object.defineProperty($t,"__esModule",{value:!0});function wi(e){return function(t,n){return new Promise((u,r)=>{e.call(this,t,n,(o,s)=>{o?r(o):u(s)})})}}$t.default=wi;var dn=w&&w.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};const Bi=kt,$i=dn(re),vi=dn($t),ie=$i.default("agent-base");function Ai(e){return Boolean(e)&&typeof e.addRequest=="function"}function vt(){const{stack:e}=new Error;return typeof e!="string"?!1:e.split(`
66
- `).some(t=>t.indexOf("(https.js:")!==-1||t.indexOf("node:https:")!==-1)}function Oe(e,t){return new Oe.Agent(e,t)}(function(e){class t extends Bi.EventEmitter{constructor(u,r){super();let o=r;typeof u=="function"?this.callback=u:u&&(o=u),this.timeout=null,o&&typeof o.timeout=="number"&&(this.timeout=o.timeout),this.maxFreeSockets=1,this.maxSockets=1,this.maxTotalSockets=1/0,this.sockets={},this.freeSockets={},this.requests={},this.options={}}get defaultPort(){return typeof this.explicitDefaultPort=="number"?this.explicitDefaultPort:vt()?443:80}set defaultPort(u){this.explicitDefaultPort=u}get protocol(){return typeof this.explicitProtocol=="string"?this.explicitProtocol:vt()?"https:":"http:"}set protocol(u){this.explicitProtocol=u}callback(u,r,o){throw new Error('"agent-base" has no default implementation, you must subclass and override `callback()`')}addRequest(u,r){const o=Object.assign({},r);typeof o.secureEndpoint!="boolean"&&(o.secureEndpoint=vt()),o.host==null&&(o.host="localhost"),o.port==null&&(o.port=o.secureEndpoint?443:80),o.protocol==null&&(o.protocol=o.secureEndpoint?"https:":"http:"),o.host&&o.path&&delete o.path,delete o.agent,delete o.hostname,delete o._defaultAgent,delete o.defaultPort,delete o.createConnection,u._last=!0,u.shouldKeepAlive=!1;let s=!1,i=null;const D=o.timeout||this.timeout,l=d=>{u._hadError||(u.emit("error",d),u._hadError=!0)},f=()=>{i=null,s=!0;const d=new Error(`A "socket" was not created for HTTP request before ${D}ms`);d.code="ETIMEOUT",l(d)},a=d=>{s||(i!==null&&(clearTimeout(i),i=null),l(d))},c=d=>{if(s)return;if(i!=null&&(clearTimeout(i),i=null),Ai(d)){ie("Callback returned another Agent instance %o",d.constructor.name),d.addRequest(u,o);return}if(d){d.once("free",()=>{this.freeSocket(d,o)}),u.onSocket(d);return}const p=new Error(`no Duplex stream was returned to agent-base for \`${u.method} ${u.path}\``);l(p)};if(typeof this.callback!="function"){l(new Error("`callback` is not defined"));return}this.promisifiedCallback||(this.callback.length>=3?(ie("Converting legacy callback function to promise"),this.promisifiedCallback=vi.default(this.callback)):this.promisifiedCallback=this.callback),typeof D=="number"&&D>0&&(i=setTimeout(f,D)),"port"in o&&typeof o.port!="number"&&(o.port=Number(o.port));try{ie("Resolving socket for %o request: %o",o.protocol,`${u.method} ${u.path}`),Promise.resolve(this.promisifiedCallback(u,o)).then(c,a)}catch(d){Promise.reject(d).catch(a)}}freeSocket(u,r){ie("Freeing socket %o %o",u.constructor.name,r),u.destroy()}destroy(){ie("Destroying agent %o",this.constructor.name)}}e.Agent=t,e.prototype=e.Agent.prototype})(Oe||(Oe={}));var xi=Oe,At={},Si=w&&w.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(At,"__esModule",{value:!0});const Oi=Si(re),De=Oi.default("https-proxy-agent:parse-proxy-response");function Ii(e){return new Promise((t,n)=>{let u=0;const r=[];function o(){const a=e.read();a?f(a):e.once("readable",o)}function s(){e.removeListener("end",D),e.removeListener("error",l),e.removeListener("close",i),e.removeListener("readable",o)}function i(a){De("onclose had error %o",a)}function D(){De("onend")}function l(a){s(),De("onerror %o",a),n(a)}function f(a){r.push(a),u+=a.length;const c=Buffer.concat(r,u);if(c.indexOf(`\r
63
+ `+F),c.push(h+"m+"+e.exports.humanize(this.diff)+"\x1B[0m")}else c[0]=s()+d+" "+c[0]}function s(){return t.inspectOpts.hideDate?"":new Date().toISOString()+" "}function D(...c){return process.stderr.write(u.format(...c)+`
64
+ `)}function i(c){c?process.env.DEBUG=c:delete process.env.DEBUG}function l(){return process.env.DEBUG}function f(c){c.inspectOpts={};const d=Object.keys(t.inspectOpts);for(let p=0;p<d.length;p++)c.inspectOpts[d[p]]=t.inspectOpts[d[p]]}e.exports=cn()(t);const{formatters:a}=e.exports;a.o=function(c){return this.inspectOpts.colors=this.useColors,u.inspect(c,this.inspectOpts).split(`
65
+ `).map(d=>d.trim()).join(" ")},a.O=function(c){return this.inspectOpts.colors=this.useColors,u.inspect(c,this.inspectOpts)}}(bi,se)),se}(function(e){typeof process>"u"||process.type==="renderer"||process.browser===!0||process.__nwjs?e.exports=yi():e.exports=$i()})(Fi);var vt={};Object.defineProperty(vt,"__esModule",{value:!0});function vi(e){return function(t,n){return new Promise((u,r)=>{e.call(this,t,n,(o,s)=>{o?r(o):u(s)})})}}vt.default=vi;var Cn=w&&w.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};const Ai=jt,xi=Cn(re),Si=Cn(vt),ie=xi.default("agent-base");function Oi(e){return Boolean(e)&&typeof e.addRequest=="function"}function At(){const{stack:e}=new Error;return typeof e!="string"?!1:e.split(`
66
+ `).some(t=>t.indexOf("(https.js:")!==-1||t.indexOf("node:https:")!==-1)}function Oe(e,t){return new Oe.Agent(e,t)}(function(e){class t extends Ai.EventEmitter{constructor(u,r){super();let o=r;typeof u=="function"?this.callback=u:u&&(o=u),this.timeout=null,o&&typeof o.timeout=="number"&&(this.timeout=o.timeout),this.maxFreeSockets=1,this.maxSockets=1,this.maxTotalSockets=1/0,this.sockets={},this.freeSockets={},this.requests={},this.options={}}get defaultPort(){return typeof this.explicitDefaultPort=="number"?this.explicitDefaultPort:At()?443:80}set defaultPort(u){this.explicitDefaultPort=u}get protocol(){return typeof this.explicitProtocol=="string"?this.explicitProtocol:At()?"https:":"http:"}set protocol(u){this.explicitProtocol=u}callback(u,r,o){throw new Error('"agent-base" has no default implementation, you must subclass and override `callback()`')}addRequest(u,r){const o=Object.assign({},r);typeof o.secureEndpoint!="boolean"&&(o.secureEndpoint=At()),o.host==null&&(o.host="localhost"),o.port==null&&(o.port=o.secureEndpoint?443:80),o.protocol==null&&(o.protocol=o.secureEndpoint?"https:":"http:"),o.host&&o.path&&delete o.path,delete o.agent,delete o.hostname,delete o._defaultAgent,delete o.defaultPort,delete o.createConnection,u._last=!0,u.shouldKeepAlive=!1;let s=!1,D=null;const i=o.timeout||this.timeout,l=d=>{u._hadError||(u.emit("error",d),u._hadError=!0)},f=()=>{D=null,s=!0;const d=new Error(`A "socket" was not created for HTTP request before ${i}ms`);d.code="ETIMEOUT",l(d)},a=d=>{s||(D!==null&&(clearTimeout(D),D=null),l(d))},c=d=>{if(s)return;if(D!=null&&(clearTimeout(D),D=null),Oi(d)){ie("Callback returned another Agent instance %o",d.constructor.name),d.addRequest(u,o);return}if(d){d.once("free",()=>{this.freeSocket(d,o)}),u.onSocket(d);return}const p=new Error(`no Duplex stream was returned to agent-base for \`${u.method} ${u.path}\``);l(p)};if(typeof this.callback!="function"){l(new Error("`callback` is not defined"));return}this.promisifiedCallback||(this.callback.length>=3?(ie("Converting legacy callback function to promise"),this.promisifiedCallback=Si.default(this.callback)):this.promisifiedCallback=this.callback),typeof i=="number"&&i>0&&(D=setTimeout(f,i)),"port"in o&&typeof o.port!="number"&&(o.port=Number(o.port));try{ie("Resolving socket for %o request: %o",o.protocol,`${u.method} ${u.path}`),Promise.resolve(this.promisifiedCallback(u,o)).then(c,a)}catch(d){Promise.reject(d).catch(a)}}freeSocket(u,r){ie("Freeing socket %o %o",u.constructor.name,r),u.destroy()}destroy(){ie("Destroying agent %o",this.constructor.name)}}e.Agent=t,e.prototype=e.Agent.prototype})(Oe||(Oe={}));var Ii=Oe,xt={},Ti=w&&w.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(xt,"__esModule",{value:!0});const Pi=Ti(re),De=Pi.default("https-proxy-agent:parse-proxy-response");function _i(e){return new Promise((t,n)=>{let u=0;const r=[];function o(){const a=e.read();a?f(a):e.once("readable",o)}function s(){e.removeListener("end",i),e.removeListener("error",l),e.removeListener("close",D),e.removeListener("readable",o)}function D(a){De("onclose had error %o",a)}function i(){De("onend")}function l(a){s(),De("onerror %o",a),n(a)}function f(a){r.push(a),u+=a.length;const c=Buffer.concat(r,u);if(c.indexOf(`\r
67
67
  \r
68
68
  `)===-1){De("have not received end of HTTP headers yet..."),o();return}const p=c.toString("ascii",0,c.indexOf(`\r
69
- `)),m=+p.split(" ")[1];De("got proxy server response: %o",p),t({statusCode:m,buffered:c})}e.on("error",l),e.on("close",i),e.on("end",D),o()})}At.default=Ii;var Ti=w&&w.__awaiter||function(e,t,n,u){function r(o){return o instanceof n?o:new n(function(s){s(o)})}return new(n||(n=Promise))(function(o,s){function i(f){try{l(u.next(f))}catch(a){s(a)}}function D(f){try{l(u.throw(f))}catch(a){s(a)}}function l(f){f.done?o(f.value):r(f.value).then(i,D)}l((u=u.apply(e,t||[])).next())})},J=w&&w.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Et,"__esModule",{value:!0});const pn=J(In),Cn=J(Tn),Pi=J(Pn),_i=J(Rt),Ri=J(re),ki=xi,Mi=J(At),ae=Ri.default("https-proxy-agent:agent");class ji extends ki.Agent{constructor(t){let n;if(typeof t=="string"?n=Pi.default.parse(t):n=t,!n)throw new Error("an HTTP(S) proxy server `host` and `port` must be specified!");ae("creating new HttpsProxyAgent instance: %o",n),super(n);const u=Object.assign({},n);this.secureProxy=n.secureProxy||Gi(u.protocol),u.host=u.hostname||u.host,typeof u.port=="string"&&(u.port=parseInt(u.port,10)),!u.port&&u.host&&(u.port=this.secureProxy?443:80),this.secureProxy&&!("ALPNProtocols"in u)&&(u.ALPNProtocols=["http 1.1"]),u.host&&u.path&&(delete u.path,delete u.pathname),this.proxy=u}callback(t,n){return Ti(this,void 0,void 0,function*(){const{proxy:u,secureProxy:r}=this;let o;r?(ae("Creating `tls.Socket`: %o",u),o=Cn.default.connect(u)):(ae("Creating `net.Socket`: %o",u),o=pn.default.connect(u));const s=Object.assign({},u.headers);let D=`CONNECT ${`${n.host}:${n.port}`} HTTP/1.1\r
70
- `;u.auth&&(s["Proxy-Authorization"]=`Basic ${Buffer.from(u.auth).toString("base64")}`);let{host:l,port:f,secureEndpoint:a}=n;Ni(f,a)||(l+=`:${f}`),s.Host=l,s.Connection="close";for(const h of Object.keys(s))D+=`${h}: ${s[h]}\r
71
- `;const c=Mi.default(o);o.write(`${D}\r
72
- `);const{statusCode:d,buffered:p}=yield c;if(d===200){if(t.once("socket",Li),n.secureEndpoint){ae("Upgrading socket connection to TLS");const h=n.servername||n.host;return Cn.default.connect(Object.assign(Object.assign({},Ui(n,"host","hostname","path","port")),{socket:o,servername:h}))}return o}o.destroy();const m=new pn.default.Socket({writable:!1});return m.readable=!0,t.once("socket",h=>{ae("replaying proxy buffer for failed request"),_i.default(h.listenerCount("data")>0),h.push(p),h.push(null)}),m})}}Et.default=ji;function Li(e){e.resume()}function Ni(e,t){return Boolean(!t&&e===80||t&&e===443)}function Gi(e){return typeof e=="string"?/^https:?$/i.test(e):!1}function Ui(e,...t){const n={};let u;for(u in e)t.includes(u)||(n[u]=e[u]);return n}var Wi=w&&w.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};const xt=Wi(Et);function St(e){return new xt.default(e)}(function(e){e.HttpsProxyAgent=xt.default,e.prototype=xt.default.prototype})(St||(St={}));var qi=St;const Hi=async(e,t,n,u,r)=>new Promise((o,s)=>{const i=JSON.stringify(u),D=Sn.request({port:443,hostname:e,path:t,method:"POST",headers:{...n,"Content-Type":"application/json","Content-Length":Buffer.byteLength(i)},timeout:1e4,agent:r?qi(r):void 0},l=>{const f=[];l.on("data",a=>f.push(a)),l.on("end",()=>{o({request:D,response:l,data:Buffer.concat(f).toString()})})});D.on("error",s),D.on("timeout",()=>{D.destroy(),s(new x("Request timed out"))}),D.write(i),D.end()}),zi=async(e,t,n)=>{const{response:u,data:r}=await Hi("api.openai.com","/v1/chat/completions",{Authorization:`Bearer ${e}`},t,n);if(!u.statusCode||u.statusCode<200||u.statusCode>299){let o=`OpenAI API Error: ${u.statusCode} - ${u.statusMessage}`;throw r&&(o+=`
69
+ `)),m=+p.split(" ")[1];De("got proxy server response: %o",p),t({statusCode:m,buffered:c})}e.on("error",l),e.on("close",D),e.on("end",i),o()})}xt.default=_i;var Ri=w&&w.__awaiter||function(e,t,n,u){function r(o){return o instanceof n?o:new n(function(s){s(o)})}return new(n||(n=Promise))(function(o,s){function D(f){try{l(u.next(f))}catch(a){s(a)}}function i(f){try{l(u.throw(f))}catch(a){s(a)}}function l(f){f.done?o(f.value):r(f.value).then(D,i)}l((u=u.apply(e,t||[])).next())})},J=w&&w.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(yt,"__esModule",{value:!0});const mn=J(Pn),hn=J(_n),ki=J(Rn),Mi=J(Mt),ji=J(re),Li=Ii,Ni=J(xt),ae=ji.default("https-proxy-agent:agent");class Gi extends Li.Agent{constructor(t){let n;if(typeof t=="string"?n=ki.default.parse(t):n=t,!n)throw new Error("an HTTP(S) proxy server `host` and `port` must be specified!");ae("creating new HttpsProxyAgent instance: %o",n),super(n);const u=Object.assign({},n);this.secureProxy=n.secureProxy||Hi(u.protocol),u.host=u.hostname||u.host,typeof u.port=="string"&&(u.port=parseInt(u.port,10)),!u.port&&u.host&&(u.port=this.secureProxy?443:80),this.secureProxy&&!("ALPNProtocols"in u)&&(u.ALPNProtocols=["http 1.1"]),u.host&&u.path&&(delete u.path,delete u.pathname),this.proxy=u}callback(t,n){return Ri(this,void 0,void 0,function*(){const{proxy:u,secureProxy:r}=this;let o;r?(ae("Creating `tls.Socket`: %o",u),o=hn.default.connect(u)):(ae("Creating `net.Socket`: %o",u),o=mn.default.connect(u));const s=Object.assign({},u.headers);let i=`CONNECT ${`${n.host}:${n.port}`} HTTP/1.1\r
70
+ `;u.auth&&(s["Proxy-Authorization"]=`Basic ${Buffer.from(u.auth).toString("base64")}`);let{host:l,port:f,secureEndpoint:a}=n;Wi(f,a)||(l+=`:${f}`),s.Host=l,s.Connection="close";for(const h of Object.keys(s))i+=`${h}: ${s[h]}\r
71
+ `;const c=Ni.default(o);o.write(`${i}\r
72
+ `);const{statusCode:d,buffered:p}=yield c;if(d===200){if(t.once("socket",Ui),n.secureEndpoint){ae("Upgrading socket connection to TLS");const h=n.servername||n.host;return hn.default.connect(Object.assign(Object.assign({},qi(n,"host","hostname","path","port")),{socket:o,servername:h}))}return o}o.destroy();const m=new mn.default.Socket({writable:!1});return m.readable=!0,t.once("socket",h=>{ae("replaying proxy buffer for failed request"),Mi.default(h.listenerCount("data")>0),h.push(p),h.push(null)}),m})}}yt.default=Gi;function Ui(e){e.resume()}function Wi(e,t){return Boolean(!t&&e===80||t&&e===443)}function Hi(e){return typeof e=="string"?/^https:?$/i.test(e):!1}function qi(e,...t){const n={};let u;for(u in e)t.includes(u)||(n[u]=e[u]);return n}var zi=w&&w.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};const St=zi(yt);function Ot(e){return new St.default(e)}(function(e){e.HttpsProxyAgent=St.default,e.prototype=St.default.prototype})(Ot||(Ot={}));var Ki=Ot;const Vi=async(e,t,n,u,r)=>new Promise((o,s)=>{const D=JSON.stringify(u),i=In.request({port:443,hostname:e,path:t,method:"POST",headers:{...n,"Content-Type":"application/json","Content-Length":Buffer.byteLength(D)},timeout:1e4,agent:r?Ki(r):void 0},l=>{const f=[];l.on("data",a=>f.push(a)),l.on("end",()=>{o({request:i,response:l,data:Buffer.concat(f).toString()})})});i.on("error",s),i.on("timeout",()=>{i.destroy(),s(new x("Request timed out"))}),i.write(D),i.end()}),Yi=async(e,t,n)=>{const{response:u,data:r}=await Vi("api.openai.com","/v1/chat/completions",{Authorization:`Bearer ${e}`},t,n);if(!u.statusCode||u.statusCode<200||u.statusCode>299){let o=`OpenAI API Error: ${u.statusCode} - ${u.statusMessage}`;throw r&&(o+=`
73
73
 
74
74
  ${r}`),u.statusCode===500&&(o+=`
75
75
 
76
- Check the API status: https://status.openai.com`),new x(o)}return JSON.parse(r)},Ki=e=>e.trim().replace(/[\n\r]/g,"").replace(/(\w)\.$/,"$1"),Vi=e=>Array.from(new Set(e)),Yi=(e,t)=>`Write an insightful but concise Git commit message in a complete sentence in present tense for the following diff without prefacing it with anything, the response must be in the language ${e}:
77
- ${t}`,mn="gpt-3.5-turbo",hn=async(e,t,n,u,r)=>{const o=Yi(t,n);if(On(mn).encode(o).length>4e3)throw new x("The diff is too large for the OpenAI API. Try reducing the number of staged changes, or write your own commit message.");try{const s=await zi(e,{model:mn,messages:[{role:"user",content:o}],temperature:.7,top_p:1,frequency_penalty:0,presence_penalty:0,max_tokens:200,stream:!1,n:u},r);return Vi(s.choices.filter(i=>i.message?.content).map(i=>Ki(i.message.content)))}catch(s){const i=s;throw i.code==="ENOTFOUND"?new x(`Error connecting to ${i.hostname} (${i.syscall}). Are you connected to the internet?`):i}};var Ji=async(e,t,n,u)=>(async()=>{Vu(Lu(ju(" aicommits "))),await Yu();const r=dt();n&&await ue("git",["add","--all"]),r.start("Detecting staged files");const o=await Xu(t);if(!o)throw r.stop("Detecting staged files"),new x("No staged changes found. Stage your changes manually, or automatically stage all changes with the `--all` flag.");r.stop(`${fi(o.files)}:
76
+ Check the API status: https://status.openai.com`),new x(o)}return JSON.parse(r)},Ji=e=>e.trim().replace(/[\n\r]/g,"").replace(/(\w)\.$/,"$1"),Xi=e=>Array.from(new Set(e)),Zi=(e,t)=>`Write an insightful but concise Git commit message in a complete sentence in present tense for the following diff without prefacing it with anything, the response must be in the language ${e}:
77
+ ${t}`,Fn=async(e,t,n,u,r,o)=>{const s=Zi(n,u);if(Tn(t).encode(s).length>4e3)throw new x("The diff is too large for the OpenAI API. Try reducing the number of staged changes, or write your own commit message.");try{const D=await Yi(e,{model:t,messages:[{role:"user",content:s}],temperature:.7,top_p:1,frequency_penalty:0,presence_penalty:0,max_tokens:200,stream:!1,n:r},o);return Xi(D.choices.filter(i=>i.message?.content).map(i=>Ji(i.message.content)))}catch(D){const i=D;throw i.code==="ENOTFOUND"?new x(`Error connecting to ${i.hostname} (${i.syscall}). Are you connected to the internet?`):i}};var Qi=async(e,t,n,u)=>(async()=>{Ju(Gu(Nu(" aicommits "))),await Xu();const r=pt();n&&await ue("git",["add","--all"]),r.start("Detecting staged files");const o=await Qu(t);if(!o)throw r.stop("Detecting staged files"),new x("No staged changes found. Stage your changes manually, or automatically stage all changes with the `--all` flag.");r.stop(`${Ci(o.files)}:
78
78
  ${o.files.map(a=>` ${a}`).join(`
79
- `)}`);const{env:s}=process,i=await gt({OPENAI_KEY:s.OPENAI_KEY||s.OPENAI_API_KEY,proxy:s.https_proxy||s.HTTPS_PROXY||s.http_proxy||s.HTTP_PROXY,generate:e?.toString()}),D=dt();D.start("The AI is analyzing your changes");let l;try{l=await hn(i.OPENAI_KEY,i.locale,o.diff,i.generate,i.proxy)}finally{D.stop("Changes analyzed")}if(l.length===0)throw new x("No commit messages were generated. Try again.");let f;if(l.length===1){[f]=l;const a=await ci({message:`Use this commit message?
79
+ `)}`);const{env:s}=process,D=await Et({OPENAI_KEY:s.OPENAI_KEY||s.OPENAI_API_KEY,proxy:s.https_proxy||s.HTTPS_PROXY||s.http_proxy||s.HTTP_PROXY,generate:e?.toString()}),i=pt();i.start("The AI is analyzing your changes");let l;try{l=await Fn(D.OPENAI_KEY,D.model,D.locale,o.diff,D.generate,D.proxy)}finally{i.stop("Changes analyzed")}if(l.length===0)throw new x("No commit messages were generated. Try again.");let f;if(l.length===1){[f]=l;const a=await di({message:`Use this commit message?
80
80
 
81
81
  ${f}
82
- `});if(!a||Wu(a)){V("Commit cancelled");return}}else{const a=await li({message:`Pick a commit message to use: ${ot("(Ctrl+c to exit)")}`,options:l.map(c=>({label:c,value:c}))});if(Wu(a)){V("Commit cancelled");return}f=a}await ue("git",["commit","-m",f,...u]),V(`${Be("\u2714")} Successfully committed!`)})().catch(r=>{V(`${we("\u2716")} ${r.message}`),ve(r),process.exit(1)});const[Fn,Xi]=process.argv.slice(2);var Zi=()=>(async()=>{if(!Fn)throw new x('Commit message file path is missing. This file should be called from the "prepare-commit-msg" git hook');if(Xi)return;const e=await Xu();if(!e)return;Vu(Lu(ju(" aicommits ")));const{env:t}=process,n=await gt({proxy:t.https_proxy||t.HTTPS_PROXY||t.http_proxy||t.HTTP_PROXY}),u=dt();u.start("The AI is analyzing your changes");let r;try{r=await hn(n.OPENAI_KEY,n.locale,e.diff,n.generate,n.proxy)}finally{u.stop("Changes analyzed")}const o=r.length>1;let s=`# \u{1F916} AI generated commit${o?"s":""}
83
- `;o?(s+=`# Select one of the following messages by uncommeting:
84
- `,s+=`
85
- ${r.map(i=>`# ${i}`).join(`
86
- `)}`):(s+=`# Edit the message below and commit:
87
- `,s+=`
82
+ `});if(!a||qu(a)){V("Commit cancelled");return}}else{const a=await pi({message:`Pick a commit message to use: ${st("(Ctrl+c to exit)")}`,options:l.map(c=>({label:c,value:c}))});if(qu(a)){V("Commit cancelled");return}f=a}await ue("git",["commit","-m",f,...u]),V(`${Be("\u2714")} Successfully committed!`)})().catch(r=>{V(`${we("\u2716")} ${r.message}`),ve(r),process.exit(1)});const[It,eD]=process.argv.slice(2);var tD=()=>(async()=>{if(!It)throw new x('Commit message file path is missing. This file should be called from the "prepare-commit-msg" git hook');if(eD)return;const e=await Qu();if(!e)return;Ju(Gu(Nu(" aicommits ")));const{env:t}=process,n=await Et({proxy:t.https_proxy||t.HTTPS_PROXY||t.http_proxy||t.HTTP_PROXY}),u=pt();u.start("The AI is analyzing your changes");let r;try{r=await Fn(n.OPENAI_KEY,n.model,n.locale,e.diff,n.generate,n.proxy)}finally{u.stop("Changes analyzed")}const s=await O.readFile(It,"utf8")!=="",D=r.length>1;let i="";s&&(i=`# \u{1F916} AI generated commit${D?"s":""}
83
+ `),D?(s&&(i+=`# Select one of the following messages by uncommeting:
84
+ `),i+=`
85
+ ${r.map(l=>`# ${l}`).join(`
86
+ `)}`):(s&&(i+=`# Edit the message below and commit:
87
+ `),i+=`
88
88
  ${r[0]}
89
- `),await O.appendFile(Fn,s),V(`${Be("\u2714")} Saved commit message!`)})().catch(e=>{V(`${we("\u2716")} ${e.message}`),ve(e),process.exit(1)}),Qi=su({name:"config",parameters:["<mode>","<key=value...>"]},e=>{(async()=>{const{mode:t,keyValue:n}=e._;if(t==="get"){const u=await gt();for(const r of n)nn(u,r)&&console.log(`${r}=${u[r]}`);return}if(t==="set"){await pi(n.map(u=>u.split("=")));return}throw new x(`Invalid mode: ${t}`)})().catch(t=>{console.error(`${we("\u2716")} ${t.message}`),ve(t),process.exit(1)})});const gn="prepare-commit-msg",_=`.git/hooks/${gn}`,eD=process.argv[1].endsWith(`/${_}`);var tD=su({name:"hook",parameters:["<install/uninstall>"]},e=>{const t=_n(new URL("cli.mjs",import.meta.url));(async()=>{await Yu();const{installUninstall:n}=e._,u=await un(_);if(n==="install"){if(u){if(await O.realpath(_).catch(()=>{})===t){console.warn("The hook is already installed");return}throw new x(`A different ${gn} hook seems to be installed. Please remove it before installing aicommits.`)}await O.mkdir(X.dirname(_),{recursive:!0}),await O.symlink(t,_,"file"),await O.chmod(_,493),console.log(`${Be("\u2714")} Hook installed`);return}if(n==="uninstall"){if(!u){console.warn("Hook is not installed");return}if(await O.realpath(_)!==t){console.warn("Hook is not installed");return}await O.rm(_),console.log(`${Be("\u2714")} Hook uninstalled`);return}throw new x(`Invalid mode: ${n}`)})().catch(n=>{console.error(`${we("\u2716")} ${n.message}`),ve(n),process.exit(1)})});const En=process.argv.slice(2);Qr({name:"aicommits",version:iu,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}},commands:[Qi,tD],help:{description:eo},ignoreArgv:e=>e==="unknown-flag"||e==="argument"},e=>{eD?Zi():Ji(e.flags.generate,e.flags.exclude,e.flags.all,En)},En);
89
+ `),await O.appendFile(It,i),V(`${Be("\u2714")} Saved commit message!`)})().catch(e=>{V(`${we("\u2716")} ${e.message}`),ve(e),process.exit(1)}),uD=Du({name:"config",parameters:["<mode>","<key=value...>"]},e=>{(async()=>{const{mode:t,keyValue:n}=e._;if(t==="get"){const u=await Et();for(const r of n)on(u,r)&&console.log(`${r}=${u[r]}`);return}if(t==="set"){await hi(n.map(u=>u.split("=")));return}throw new x(`Invalid mode: ${t}`)})().catch(t=>{console.error(`${we("\u2716")} ${t.message}`),ve(t),process.exit(1)})});const gn="prepare-commit-msg",T=`.git/hooks/${gn}`,Ie=kn(new URL("cli.mjs",import.meta.url)),nD=process.argv[1].replace(/\\/g,"/").endsWith(`/${T}`),En=process.platform==="win32",yn=`
90
+ #!/usr/bin/env node
91
+ import(${JSON.stringify(Mn(Ie))})
92
+ `.trim();var rD=Du({name:"hook",parameters:["<install/uninstall>"]},e=>{(async()=>{await Xu();const{installUninstall:t}=e._,n=await rn(T);if(t==="install"){if(n){if(await O.realpath(T).catch(()=>{})===Ie){console.warn("The hook is already installed");return}throw new x(`A different ${gn} hook seems to be installed. Please remove it before installing aicommits.`)}await O.mkdir(X.dirname(T),{recursive:!0}),En?await O.writeFile(T,yn):(await O.symlink(Ie,T,"file"),await O.chmod(T,493)),console.log(`${Be("\u2714")} Hook installed`);return}if(t==="uninstall"){if(!n){console.warn("Hook is not installed");return}if(En){if(await O.readFile(T,"utf8")!==yn){console.warn("Hook is not installed");return}}else if(await O.realpath(T)!==Ie){console.warn("Hook is not installed");return}await O.rm(T),console.log(`${Be("\u2714")} Hook uninstalled`);return}throw new x(`Invalid mode: ${t}`)})().catch(t=>{console.error(`${we("\u2716")} ${t.message}`),ve(t),process.exit(1)})});const bn=process.argv.slice(2);uo({name:"aicommits",version:au,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}},commands:[uD,rD],help:{description:no},ignoreArgv:e=>e==="unknown-flag"||e==="argument"},e=>{nD?tD():Qi(e.flags.generate,e.flags.exclude,e.flags.all,bn)},bn);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aicommits",
3
- "version": "1.7.0",
3
+ "version": "1.8.1",
4
4
  "description": "Writes your git commit messages for you with AI",
5
5
  "keywords": [
6
6
  "ai",