aicommit2 1.0.0 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +5 -9
  2. package/dist/cli.mjs +49 -49
  3. package/package.json +5 -3
package/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  <img src="https://github.com/tak-bro/aicommit2/assets/7614353/fae40f3e-329d-4acf-bd91-f7297cb88209" alt="AICommit2"/>
4
4
  <h1 align="center">AICommit2</h1>
5
5
  </div>
6
- <p>A Reactive CLI that generates git commit messages with diverse AI</p>
6
+ <p>Reactive CLI that generates git commit messages with diverse AI</p>
7
7
  <a aria-label="npm" href="https://www.npmjs.com/package/aicommit2">
8
8
  <img src="https://img.shields.io/npm/v/aicommit2" alt="Current version">
9
9
  </a>
@@ -18,7 +18,7 @@
18
18
 
19
19
  The core functionalities and architecture of this project are inspired by [AI Commits](https://github.com/Nutlope/aicommits).
20
20
 
21
- ## Supported AI
21
+ ## Supported Providers
22
22
 
23
23
  - [OpenAI](https://openai.com/)
24
24
  - [Huggingface **(Unofficial)**](https://huggingface.co/chat/)
@@ -26,7 +26,7 @@ The core functionalities and architecture of this project are inspired by [AI Co
26
26
 
27
27
  ## Setup
28
28
 
29
- > The minimum supported version of Node.js is the latest v14. Check your Node.js version with `node --version`.
29
+ > The minimum supported version of Node.js is the latest v16.20.0. Check your Node.js version with `node --version`.
30
30
 
31
31
  1. Install _aicommit2_:
32
32
 
@@ -254,7 +254,7 @@ aicommit2 config set OPENAI_MODEL=gpt-4
254
254
 
255
255
  #### HUGGING_COOKIE
256
256
 
257
- The [Huggingface Chat](https://huggingface.co/chat/) Cookie. Please check [how to get cookie](https://github.com/tak-bro/aicommit2/blob/main/README.md#how-to-get-cookie)
257
+ The [Huggingface Chat](https://huggingface.co/chat/) Cookie. Please check [how to get cookie](https://github.com/tak-bro/aicommit2?tab=readme-ov-file#how-to-get-cookieunofficial-api)
258
258
 
259
259
  #### HUGGING_MODEL
260
260
 
@@ -270,7 +270,7 @@ Supported:
270
270
 
271
271
  #### CLOVAX_COOKIE
272
272
 
273
- The [Clova X](https://clova-x.naver.com/) Cookie. Please check [how to get cookie](https://github.com/tak-bro/aicommit2/blob/main/README.md#how-to-get-cookie)
273
+ The [Clova X](https://clova-x.naver.com/) Cookie. Please check [how to get cookie](https://github.com/tak-bro/aicommit2?tab=readme-ov-file#how-to-get-cookieunofficial-api)
274
274
 
275
275
  #### locale
276
276
 
@@ -370,10 +370,6 @@ Users are responsible for understanding and abiding by the terms of use, rate li
370
370
 
371
371
  It is recommended that users thoroughly review the API documentation and adhere to best practices to ensure a positive and compliant experience.
372
372
 
373
- ## Project Base and Inspiration
374
-
375
- The core functionalities and architecture of this project are inspired by [AI Commits](https://https://github.com/Nutlope/aicommit). In addition to AI Commits, inspiration has been drawn from various open-source communities, expanding upon existing ideas and introducing new features.
376
-
377
373
  ## Maintainers
378
374
 
379
375
  - [@tak-bro](https://env-tak.github.io/)
package/dist/cli.mjs CHANGED
@@ -1,75 +1,75 @@
1
1
  #!/usr/bin/env node
2
- import Ae from"tty";import{createRequire as Du}from"module";import{Buffer as cu}from"node:buffer";import L from"node:path";import Ot from"node:child_process";import _ from"node:process";import lu from"child_process";import j from"path";import ve from"fs";import fu from"node:url";import du,{constants as St}from"node:os";import It from"assert";import Pt from"events";import pu from"buffer";import $e from"stream";import _t from"util";import xe from"inquirer";import Oe from"ora";import g from"chalk";import{of as Se,concatMap as Ie,from as oe,map as se,catchError as Pe,mergeMap as mu,BehaviorSubject as Tt,ReplaySubject as hu,lastValueFrom as Cu,filter as gu,toArray as Fu}from"rxjs";import{fromPromise as _e}from"rxjs/internal/observable/innerFrom";import x from"fs/promises";import Mt from"os";import Eu from"https";import"@dqbd/tiktoken";import yu from"net";import wu from"tls";import bu,{fileURLToPath as Bu,pathToFileURL as Au}from"url";import vu from"axios";import{v4 as Rt}from"uuid";import ie from"readline";import $u from"figlet";import xu from"inquirer-reactive-list-prompt";const Ou="known-flag",Su="unknown-flag",Iu="argument",{stringify:Y}=JSON,Pu=/\B([A-Z])/g,_u=e=>e.replace(Pu,"-$1").toLowerCase(),{hasOwnProperty:Tu}=Object.prototype,X=(e,t)=>Tu.call(e,t),Mu=e=>Array.isArray(e),Nt=e=>typeof e=="function"?[e,!1]:Mu(e)?[e[0],!0]:Nt(e.type),Ru=(e,t)=>e===Boolean?t!=="false":t,Nu=(e,t)=>typeof t=="boolean"?t:e===Number&&t===""?Number.NaN:e(t),ku=/[\s.:=]/,Lu=e=>{const t=`Flag name ${Y(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 u=e.match(ku);if(u)throw new Error(`${t} cannot contain ${Y(u?.[0])}`)},ju=e=>{const t={},u=(n,r)=>{if(X(t,n))throw new Error(`Duplicate flags named ${Y(n)}`);t[n]=r};for(const n in e){if(!X(e,n))continue;Lu(n);const r=e[n],o=[[],...Nt(r),r];u(n,o);const s=_u(n);if(n!==s&&u(s,o),"alias"in r&&typeof r.alias=="string"){const{alias:a}=r,i=`Flag alias ${Y(a)} for flag ${Y(n)}`;if(a.length===0)throw new Error(`${i} cannot be empty`);if(a.length>1)throw new Error(`${i} must be a single character`);u(a,o)}}return t},Gu=(e,t)=>{const u={};for(const n in e){if(!X(e,n))continue;const[r,,o,s]=t[n];if(r.length===0&&"default"in s){let{default:a}=s;typeof a=="function"&&(a=a()),u[n]=a}else u[n]=o?r:r.pop()}return u},ae="--",Uu=/[.:=]/,Hu=/^-{1,2}\w/,qu=e=>{if(!Hu.test(e))return;const t=!e.startsWith(ae);let u=e.slice(t?1:2),n;const r=u.match(Uu);if(r){const{index:o}=r;n=u.slice(o+1),u=u.slice(0,o)}return[u,n,t]},Ku=(e,{onFlag:t,onArgument:u})=>{let n;const r=(o,s)=>{if(typeof n!="function")return!0;n(o,s),n=void 0};for(let o=0;o<e.length;o+=1){const s=e[o];if(s===ae){r();const i=e.slice(o+1);u?.(i,[o],!0);break}const a=qu(s);if(a){if(r(),!t)continue;const[i,f,l]=a;if(l)for(let c=0;c<i.length;c+=1){r();const D=c===i.length-1;n=t(i[c],D?f:void 0,[o,c+1,D])}else n=t(i,f,[o])}else r(s,[o])&&u?.([s],[o])}r()},zu=(e,t)=>{for(const[u,n,r]of t.reverse()){if(n){const o=e[u];let s=o.slice(0,n);if(r||(s+=o.slice(n+1)),s!=="-"){e[u]=s;continue}}e.splice(u,1)}},Wu=(e,t=process.argv.slice(2),{ignore:u}={})=>{const n=[],r=ju(e),o={},s=[];return s[ae]=[],Ku(t,{onFlag(a,i,f){const l=X(r,a);if(!u?.(l?Ou:Su,a,i)){if(l){const[c,D]=r[a],d=Ru(D,i),p=(m,h)=>{n.push(f),h&&n.push(h),c.push(Nu(D,m||""))};return d===void 0?p:p(d)}X(o,a)||(o[a]=[]),o[a].push(i===void 0?!0:i),n.push(f)}},onArgument(a,i,f){u?.(Iu,t[i[0]])||(s.push(...a),f?(s[ae]=a,t.splice(i[0])):n.push(i))}}),zu(t,n),{flags:Gu(e,r),unknownFlags:o,_:s}};var Vu=Object.create,De=Object.defineProperty,Yu=Object.defineProperties,Xu=Object.getOwnPropertyDescriptor,Ju=Object.getOwnPropertyDescriptors,Zu=Object.getOwnPropertyNames,kt=Object.getOwnPropertySymbols,Qu=Object.getPrototypeOf,Lt=Object.prototype.hasOwnProperty,er=Object.prototype.propertyIsEnumerable,jt=(e,t,u)=>t in e?De(e,t,{enumerable:!0,configurable:!0,writable:!0,value:u}):e[t]=u,ce=(e,t)=>{for(var u in t||(t={}))Lt.call(t,u)&&jt(e,u,t[u]);if(kt)for(var u of kt(t))er.call(t,u)&&jt(e,u,t[u]);return e},Te=(e,t)=>Yu(e,Ju(t)),tr=e=>De(e,"__esModule",{value:!0}),nr=(e,t)=>()=>(e&&(t=e(e=0)),t),ur=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),rr=(e,t,u,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of Zu(t))!Lt.call(e,r)&&(u||r!=="default")&&De(e,r,{get:()=>t[r],enumerable:!(n=Xu(t,r))||n.enumerable});return e},or=(e,t)=>rr(tr(De(e!=null?Vu(Qu(e)):{},"default",!t&&e&&e.__esModule?{get:()=>e.default,enumerable:!0}:{value:e,enumerable:!0})),e),v=nr(()=>{}),sr=ur((e,t)=>{v(),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}});v(),v(),v();var ir=e=>{var t,u,n;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:(u=e.columns)!=null?u:[],stdoutColumns:(n=e.stdoutColumns)!=null?n:r}};v(),v(),v(),v(),v();function ar({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 Gt(e){if(typeof e!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof e}\``);return e.replace(ar(),"")}v();function Dr(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 cr=or(sr(),1);function T(e){if(typeof e!="string"||e.length===0||(e=Gt(e),e.length===0))return 0;e=e.replace((0,cr.default)()," ");let t=0;for(let u=0;u<e.length;u++){let n=e.codePointAt(u);n<=31||n>=127&&n<=159||n>=768&&n<=879||(n>65535&&u++,t+=Dr(n)?2:1)}return t}var Ut=e=>Math.max(...e.split(`
3
- `).map(T)),lr=e=>{let t=[];for(let u of e){let{length:n}=u,r=n-t.length;for(let o=0;o<r;o+=1)t.push(0);for(let o=0;o<n;o+=1){let s=Ut(u[o]);s>t[o]&&(t[o]=s)}}return t};v();var Ht=/^\d+%$/,qt={width:"auto",align:"left",contentWidth:0,paddingLeft:0,paddingRight:0,paddingTop:0,paddingBottom:0,horizontalPadding:0,paddingLeftString:"",paddingRightString:""},fr=(e,t)=>{var u;let n=[];for(let r=0;r<e.length;r+=1){let o=(u=t[r])!=null?u:"auto";if(typeof o=="number"||o==="auto"||o==="content-width"||typeof o=="string"&&Ht.test(o)){n.push(Te(ce({},qt),{width:o,contentWidth:e[r]}));continue}if(o&&typeof o=="object"){let s=Te(ce(ce({},qt),o),{contentWidth:e[r]});s.horizontalPadding=s.paddingLeft+s.paddingRight,n.push(s);continue}throw new Error(`Invalid column width: ${JSON.stringify(o)}`)}return n};function dr(e,t){for(let u of e){let{width:n}=u;if(n==="content-width"&&(u.width=u.contentWidth),n==="auto"){let i=Math.min(20,u.contentWidth);u.width=i,u.autoOverflow=u.contentWidth-i}if(typeof n=="string"&&Ht.test(n)){let i=Number.parseFloat(n.slice(0,-1))/100;u.width=Math.floor(t*i)-(u.paddingLeft+u.paddingRight)}let{horizontalPadding:r}=u,o=1,s=o+r;if(s>=t){let i=s-t,f=Math.ceil(u.paddingLeft/r*i),l=i-f;u.paddingLeft-=f,u.paddingRight-=l,u.horizontalPadding=u.paddingLeft+u.paddingRight}u.paddingLeftString=u.paddingLeft?" ".repeat(u.paddingLeft):"",u.paddingRightString=u.paddingRight?" ".repeat(u.paddingRight):"";let a=t-u.horizontalPadding;u.width=Math.max(Math.min(u.width,a),o)}}var Kt=()=>Object.assign([],{columns:0});function pr(e,t){let u=[Kt()],[n]=u;for(let r of e){let o=r.width+r.horizontalPadding;n.columns+o>t&&(n=Kt(),u.push(n)),n.push(r),n.columns+=o}for(let r of u){let o=r.reduce((D,d)=>D+d.width+d.horizontalPadding,0),s=t-o;if(s===0)continue;let a=r.filter(D=>"autoOverflow"in D),i=a.filter(D=>D.autoOverflow>0),f=i.reduce((D,d)=>D+d.autoOverflow,0),l=Math.min(f,s);for(let D of i){let d=Math.floor(D.autoOverflow/f*l);D.width+=d,s-=d}let c=Math.floor(s/a.length);for(let D=0;D<a.length;D+=1){let d=a[D];D===a.length-1?d.width+=s:d.width+=c,s-=c}}return u}function mr(e,t,u){let n=fr(u,t);return dr(n,e),pr(n,e)}v(),v(),v();var Me=10,zt=(e=0)=>t=>`\x1B[${t+e}m`,Wt=(e=0)=>t=>`\x1B[${38+e};5;${t}m`,Vt=(e=0)=>(t,u,n)=>`\x1B[${38+e};2;${t};${u};${n}m`;function hr(){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[u,n]of Object.entries(t)){for(let[r,o]of Object.entries(n))t[r]={open:`\x1B[${o[0]}m`,close:`\x1B[${o[1]}m`},n[r]=t[r],e.set(o[0],o[1]);Object.defineProperty(t,u,{value:n,enumerable:!1})}return Object.defineProperty(t,"codes",{value:e,enumerable:!1}),t.color.close="\x1B[39m",t.bgColor.close="\x1B[49m",t.color.ansi=zt(),t.color.ansi256=Wt(),t.color.ansi16m=Vt(),t.bgColor.ansi=zt(Me),t.bgColor.ansi256=Wt(Me),t.bgColor.ansi16m=Vt(Me),Object.defineProperties(t,{rgbToAnsi256:{value:(u,n,r)=>u===n&&n===r?u<8?16:u>248?231:Math.round((u-8)/247*24)+232:16+36*Math.round(u/255*5)+6*Math.round(n/255*5)+Math.round(r/255*5),enumerable:!1},hexToRgb:{value:u=>{let n=/(?<colorString>[a-f\d]{6}|[a-f\d]{3})/i.exec(u.toString(16));if(!n)return[0,0,0];let{colorString:r}=n.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:u=>t.rgbToAnsi256(...t.hexToRgb(u)),enumerable:!1},ansi256ToAnsi:{value:u=>{if(u<8)return 30+u;if(u<16)return 90+(u-8);let n,r,o;if(u>=232)n=((u-232)*10+8)/255,r=n,o=n;else{u-=16;let i=u%36;n=Math.floor(u/36)/5,r=Math.floor(i/6)/5,o=i%6/5}let s=Math.max(n,r,o)*2;if(s===0)return 30;let a=30+(Math.round(o)<<2|Math.round(r)<<1|Math.round(n));return s===2&&(a+=60),a},enumerable:!1},rgbToAnsi:{value:(u,n,r)=>t.ansi256ToAnsi(t.rgbToAnsi256(u,n,r)),enumerable:!1},hexToAnsi:{value:u=>t.ansi256ToAnsi(t.hexToAnsi256(u)),enumerable:!1}}),t}var Cr=hr(),gr=Cr,le=new Set(["\x1B","\x9B"]),Fr=39,Re="\x07",Yt="[",Er="]",Xt="m",Ne=`${Er}8;;`,Jt=e=>`${le.values().next().value}${Yt}${e}${Xt}`,Zt=e=>`${le.values().next().value}${Ne}${e}${Re}`,yr=e=>e.split(" ").map(t=>T(t)),ke=(e,t,u)=>{let n=[...t],r=!1,o=!1,s=T(Gt(e[e.length-1]));for(let[a,i]of n.entries()){let f=T(i);if(s+f<=u?e[e.length-1]+=i:(e.push(i),s=0),le.has(i)&&(r=!0,o=n.slice(a+1).join("").startsWith(Ne)),r){o?i===Re&&(r=!1,o=!1):i===Xt&&(r=!1);continue}s+=f,s===u&&a<n.length-1&&(e.push(""),s=0)}!s&&e[e.length-1].length>0&&e.length>1&&(e[e.length-2]+=e.pop())},wr=e=>{let t=e.split(" "),u=t.length;for(;u>0&&!(T(t[u-1])>0);)u--;return u===t.length?e:t.slice(0,u).join(" ")+t.slice(u).join("")},br=(e,t,u={})=>{if(u.trim!==!1&&e.trim()==="")return"";let n="",r,o,s=yr(e),a=[""];for(let[f,l]of e.split(" ").entries()){u.trim!==!1&&(a[a.length-1]=a[a.length-1].trimStart());let c=T(a[a.length-1]);if(f!==0&&(c>=t&&(u.wordWrap===!1||u.trim===!1)&&(a.push(""),c=0),(c>0||u.trim===!1)&&(a[a.length-1]+=" ",c++)),u.hard&&s[f]>t){let D=t-c,d=1+Math.floor((s[f]-D-1)/t);Math.floor((s[f]-1)/t)<d&&a.push(""),ke(a,l,t);continue}if(c+s[f]>t&&c>0&&s[f]>0){if(u.wordWrap===!1&&c<t){ke(a,l,t);continue}a.push("")}if(c+s[f]>t&&u.wordWrap===!1){ke(a,l,t);continue}a[a.length-1]+=l}u.trim!==!1&&(a=a.map(f=>wr(f)));let i=[...a.join(`
4
- `)];for(let[f,l]of i.entries()){if(n+=l,le.has(l)){let{groups:D}=new RegExp(`(?:\\${Yt}(?<code>\\d+)m|\\${Ne}(?<uri>.*)${Re})`).exec(i.slice(f).join(""))||{groups:{}};if(D.code!==void 0){let d=Number.parseFloat(D.code);r=d===Fr?void 0:d}else D.uri!==void 0&&(o=D.uri.length===0?void 0:D.uri)}let c=gr.codes.get(Number(r));i[f+1]===`
5
- `?(o&&(n+=Zt("")),r&&c&&(n+=Jt(c))):l===`
6
- `&&(r&&c&&(n+=Jt(r)),o&&(n+=Zt(o)))}return n};function Br(e,t,u){return String(e).normalize().replace(/\r\n/g,`
2
+ import Ae from"tty";import{createRequire as Du}from"module";import{Buffer as cu}from"node:buffer";import L from"node:path";import Ot from"node:child_process";import _ from"node:process";import lu from"child_process";import j from"path";import ve from"fs";import fu from"node:url";import du,{constants as St}from"node:os";import It from"assert";import Pt from"events";import pu from"buffer";import $e from"stream";import _t from"util";import xe from"inquirer";import Oe from"ora";import g from"chalk";import{of as Se,concatMap as Ie,from as oe,map as se,catchError as Pe,mergeMap as mu,BehaviorSubject as Tt,ReplaySubject as hu,lastValueFrom as Cu,filter as gu,toArray as Fu}from"rxjs";import"web-streams-polyfill";import{FormData as Eu,Blob as yu}from"formdata-node";import{fromPromise as _e}from"rxjs/internal/observable/innerFrom";import x from"fs/promises";import Mt from"os";import wu from"https";import"@dqbd/tiktoken";import bu from"net";import Bu from"tls";import Au,{fileURLToPath as vu,pathToFileURL as $u}from"url";import xu from"axios";import{v4 as Rt}from"uuid";import ie from"readline";import Ou from"figlet";import Su from"inquirer-reactive-list-prompt";const Iu="known-flag",Pu="unknown-flag",_u="argument",{stringify:Y}=JSON,Tu=/\B([A-Z])/g,Mu=e=>e.replace(Tu,"-$1").toLowerCase(),{hasOwnProperty:Ru}=Object.prototype,X=(e,t)=>Ru.call(e,t),Nu=e=>Array.isArray(e),Nt=e=>typeof e=="function"?[e,!1]:Nu(e)?[e[0],!0]:Nt(e.type),ku=(e,t)=>e===Boolean?t!=="false":t,Lu=(e,t)=>typeof t=="boolean"?t:e===Number&&t===""?Number.NaN:e(t),ju=/[\s.:=]/,Gu=e=>{const t=`Flag name ${Y(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(ju);if(n)throw new Error(`${t} cannot contain ${Y(n?.[0])}`)},Uu=e=>{const t={},n=(u,r)=>{if(X(t,u))throw new Error(`Duplicate flags named ${Y(u)}`);t[u]=r};for(const u in e){if(!X(e,u))continue;Gu(u);const r=e[u],o=[[],...Nt(r),r];n(u,o);const s=Mu(u);if(u!==s&&n(s,o),"alias"in r&&typeof r.alias=="string"){const{alias:a}=r,i=`Flag alias ${Y(a)} for flag ${Y(u)}`;if(a.length===0)throw new Error(`${i} cannot be empty`);if(a.length>1)throw new Error(`${i} must be a single character`);n(a,o)}}return t},Hu=(e,t)=>{const n={};for(const u in e){if(!X(e,u))continue;const[r,,o,s]=t[u];if(r.length===0&&"default"in s){let{default:a}=s;typeof a=="function"&&(a=a()),n[u]=a}else n[u]=o?r:r.pop()}return n},ae="--",qu=/[.:=]/,Ku=/^-{1,2}\w/,zu=e=>{if(!Ku.test(e))return;const t=!e.startsWith(ae);let n=e.slice(t?1:2),u;const r=n.match(qu);if(r){const{index:o}=r;u=n.slice(o+1),n=n.slice(0,o)}return[n,u,t]},Wu=(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===ae){r();const i=e.slice(o+1);n?.(i,[o],!0);break}const a=zu(s);if(a){if(r(),!t)continue;const[i,f,l]=a;if(l)for(let c=0;c<i.length;c+=1){r();const D=c===i.length-1;u=t(i[c],D?f:void 0,[o,c+1,D])}else u=t(i,f,[o])}else r(s,[o])&&n?.([s],[o])}r()},Vu=(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)}},Yu=(e,t=process.argv.slice(2),{ignore:n}={})=>{const u=[],r=Uu(e),o={},s=[];return s[ae]=[],Wu(t,{onFlag(a,i,f){const l=X(r,a);if(!n?.(l?Iu:Pu,a,i)){if(l){const[c,D]=r[a],d=ku(D,i),p=(m,h)=>{u.push(f),h&&u.push(h),c.push(Lu(D,m||""))};return d===void 0?p:p(d)}X(o,a)||(o[a]=[]),o[a].push(i===void 0?!0:i),u.push(f)}},onArgument(a,i,f){n?.(_u,t[i[0]])||(s.push(...a),f?(s[ae]=a,t.splice(i[0])):u.push(i))}}),Vu(t,u),{flags:Hu(e,r),unknownFlags:o,_:s}};var Xu=Object.create,De=Object.defineProperty,Ju=Object.defineProperties,Zu=Object.getOwnPropertyDescriptor,Qu=Object.getOwnPropertyDescriptors,er=Object.getOwnPropertyNames,kt=Object.getOwnPropertySymbols,tr=Object.getPrototypeOf,Lt=Object.prototype.hasOwnProperty,nr=Object.prototype.propertyIsEnumerable,jt=(e,t,n)=>t in e?De(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ce=(e,t)=>{for(var n in t||(t={}))Lt.call(t,n)&&jt(e,n,t[n]);if(kt)for(var n of kt(t))nr.call(t,n)&&jt(e,n,t[n]);return e},Te=(e,t)=>Ju(e,Qu(t)),ur=e=>De(e,"__esModule",{value:!0}),rr=(e,t)=>()=>(e&&(t=e(e=0)),t),or=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),sr=(e,t,n,u)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of er(t))!Lt.call(e,r)&&(n||r!=="default")&&De(e,r,{get:()=>t[r],enumerable:!(u=Zu(t,r))||u.enumerable});return e},ir=(e,t)=>sr(ur(De(e!=null?Xu(tr(e)):{},"default",!t&&e&&e.__esModule?{get:()=>e.default,enumerable:!0}:{value:e,enumerable:!0})),e),v=rr(()=>{}),ar=or((e,t)=>{v(),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}});v(),v(),v();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}};v(),v(),v(),v(),v();function cr({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 Gt(e){if(typeof e!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof e}\``);return e.replace(cr(),"")}v();function lr(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 fr=ir(ar(),1);function T(e){if(typeof e!="string"||e.length===0||(e=Gt(e),e.length===0))return 0;e=e.replace((0,fr.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+=lr(u)?2:1)}return t}var Ut=e=>Math.max(...e.split(`
3
+ `).map(T)),dr=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=Ut(n[o]);s>t[o]&&(t[o]=s)}}return t};v();var Ht=/^\d+%$/,qt={width:"auto",align:"left",contentWidth:0,paddingLeft:0,paddingRight:0,paddingTop:0,paddingBottom:0,horizontalPadding:0,paddingLeftString:"",paddingRightString:""},pr=(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"&&Ht.test(o)){u.push(Te(ce({},qt),{width:o,contentWidth:e[r]}));continue}if(o&&typeof o=="object"){let s=Te(ce(ce({},qt),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 mr(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"&&Ht.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,f=Math.ceil(n.paddingLeft/r*i),l=i-f;n.paddingLeft-=f,n.paddingRight-=l,n.horizontalPadding=n.paddingLeft+n.paddingRight}n.paddingLeftString=n.paddingLeft?" ".repeat(n.paddingLeft):"",n.paddingRightString=n.paddingRight?" ".repeat(n.paddingRight):"";let a=t-n.horizontalPadding;n.width=Math.max(Math.min(n.width,a),o)}}var Kt=()=>Object.assign([],{columns:0});function hr(e,t){let n=[Kt()],[u]=n;for(let r of e){let o=r.width+r.horizontalPadding;u.columns+o>t&&(u=Kt(),n.push(u)),u.push(r),u.columns+=o}for(let r of n){let o=r.reduce((D,d)=>D+d.width+d.horizontalPadding,0),s=t-o;if(s===0)continue;let a=r.filter(D=>"autoOverflow"in D),i=a.filter(D=>D.autoOverflow>0),f=i.reduce((D,d)=>D+d.autoOverflow,0),l=Math.min(f,s);for(let D of i){let d=Math.floor(D.autoOverflow/f*l);D.width+=d,s-=d}let c=Math.floor(s/a.length);for(let D=0;D<a.length;D+=1){let d=a[D];D===a.length-1?d.width+=s:d.width+=c,s-=c}}return n}function Cr(e,t,n){let u=pr(n,t);return mr(u,e),hr(u,e)}v(),v(),v();var Me=10,zt=(e=0)=>t=>`\x1B[${t+e}m`,Wt=(e=0)=>t=>`\x1B[${38+e};5;${t}m`,Vt=(e=0)=>(t,n,u)=>`\x1B[${38+e};2;${t};${n};${u}m`;function gr(){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=zt(),t.color.ansi256=Wt(),t.color.ansi16m=Vt(),t.bgColor.ansi=zt(Me),t.bgColor.ansi256=Wt(Me),t.bgColor.ansi16m=Vt(Me),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 a=30+(Math.round(o)<<2|Math.round(r)<<1|Math.round(u));return s===2&&(a+=60),a},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 Fr=gr(),Er=Fr,le=new Set(["\x1B","\x9B"]),yr=39,Re="\x07",Yt="[",wr="]",Xt="m",Ne=`${wr}8;;`,Jt=e=>`${le.values().next().value}${Yt}${e}${Xt}`,Zt=e=>`${le.values().next().value}${Ne}${e}${Re}`,br=e=>e.split(" ").map(t=>T(t)),ke=(e,t,n)=>{let u=[...t],r=!1,o=!1,s=T(Gt(e[e.length-1]));for(let[a,i]of u.entries()){let f=T(i);if(s+f<=n?e[e.length-1]+=i:(e.push(i),s=0),le.has(i)&&(r=!0,o=u.slice(a+1).join("").startsWith(Ne)),r){o?i===Re&&(r=!1,o=!1):i===Xt&&(r=!1);continue}s+=f,s===n&&a<u.length-1&&(e.push(""),s=0)}!s&&e[e.length-1].length>0&&e.length>1&&(e[e.length-2]+=e.pop())},Br=e=>{let t=e.split(" "),n=t.length;for(;n>0&&!(T(t[n-1])>0);)n--;return n===t.length?e:t.slice(0,n).join(" ")+t.slice(n).join("")},Ar=(e,t,n={})=>{if(n.trim!==!1&&e.trim()==="")return"";let u="",r,o,s=br(e),a=[""];for(let[f,l]of e.split(" ").entries()){n.trim!==!1&&(a[a.length-1]=a[a.length-1].trimStart());let c=T(a[a.length-1]);if(f!==0&&(c>=t&&(n.wordWrap===!1||n.trim===!1)&&(a.push(""),c=0),(c>0||n.trim===!1)&&(a[a.length-1]+=" ",c++)),n.hard&&s[f]>t){let D=t-c,d=1+Math.floor((s[f]-D-1)/t);Math.floor((s[f]-1)/t)<d&&a.push(""),ke(a,l,t);continue}if(c+s[f]>t&&c>0&&s[f]>0){if(n.wordWrap===!1&&c<t){ke(a,l,t);continue}a.push("")}if(c+s[f]>t&&n.wordWrap===!1){ke(a,l,t);continue}a[a.length-1]+=l}n.trim!==!1&&(a=a.map(f=>Br(f)));let i=[...a.join(`
4
+ `)];for(let[f,l]of i.entries()){if(u+=l,le.has(l)){let{groups:D}=new RegExp(`(?:\\${Yt}(?<code>\\d+)m|\\${Ne}(?<uri>.*)${Re})`).exec(i.slice(f).join(""))||{groups:{}};if(D.code!==void 0){let d=Number.parseFloat(D.code);r=d===yr?void 0:d}else D.uri!==void 0&&(o=D.uri.length===0?void 0:D.uri)}let c=Er.codes.get(Number(r));i[f+1]===`
5
+ `?(o&&(u+=Zt("")),r&&c&&(u+=Jt(c))):l===`
6
+ `&&(r&&c&&(u+=Jt(r)),o&&(u+=Zt(o)))}return u};function vr(e,t,n){return String(e).normalize().replace(/\r\n/g,`
7
7
  `).split(`
8
- `).map(n=>br(n,t,u)).join(`
9
- `)}var Qt=e=>Array.from({length:e}).fill("");function Ar(e,t){let u=[],n=0;for(let r of e){let o=0,s=r.map(i=>{var f;let l=(f=t[n])!=null?f:"";n+=1,i.preprocess&&(l=i.preprocess(l)),Ut(l)>i.width&&(l=Br(l,i.width,{hard:!0}));let c=l.split(`
10
- `);if(i.postprocess){let{postprocess:D}=i;c=c.map((d,p)=>D.call(i,d,p))}return i.paddingTop&&c.unshift(...Qt(i.paddingTop)),i.paddingBottom&&c.push(...Qt(i.paddingBottom)),c.length>o&&(o=c.length),Te(ce({},i),{lines:c})}),a=[];for(let i=0;i<o;i+=1){let f=s.map(l=>{var c;let D=(c=l.lines[i])!=null?c:"",d=Number.isFinite(l.width)?" ".repeat(l.width-T(D)):"",p=l.paddingLeftString;return l.align==="right"&&(p+=d),p+=D,l.align==="left"&&(p+=d),p+l.paddingRightString}).join("");a.push(f)}u.push(a.join(`
11
- `))}return u.join(`
12
- `)}function vr(e,t){if(!e||e.length===0)return"";let u=lr(e),n=u.length;if(n===0)return"";let{stdoutColumns:r,columns:o}=ir(t);if(o.length>n)throw new Error(`${o.length} columns defined, but only ${n} columns found`);let s=mr(r,o,u);return e.map(a=>Ar(s,a)).join(`
13
- `)}v();var $r=["<",">","=",">=","<="];function xr(e){if(!$r.includes(e))throw new TypeError(`Invalid breakpoint operator: ${e}`)}function Or(e){let t=Object.keys(e).map(u=>{let[n,r]=u.split(" ");xr(n);let o=Number.parseInt(r,10);if(Number.isNaN(o))throw new TypeError(`Invalid breakpoint value: ${r}`);let s=e[u];return{operator:n,breakpoint:o,value:s}}).sort((u,n)=>n.breakpoint-u.breakpoint);return u=>{var n;return(n=t.find(({operator:r,breakpoint:o})=>r==="="&&u===o||r===">"&&u>o||r==="<"&&u<o||r===">="&&u>=o||r==="<="&&u<=o))==null?void 0:n.value}}const Sr=e=>e.replace(/[\W_]([a-z\d])?/gi,(t,u)=>u?u.toUpperCase():""),Ir=e=>e.replace(/\B([A-Z])/g,"-$1").toLowerCase(),Pr={"> 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 _r(e){let t=!1;return{type:"table",data:{tableData:Object.keys(e).sort((u,n)=>u.localeCompare(n)).map(u=>{const n=e[u],r="alias"in n;return r&&(t=!0),{name:u,flag:n,flagFormatted:`--${Ir(u)}`,aliasesEnabled:t,aliasFormatted:r?`-${n.alias}`:void 0}}).map(u=>(u.aliasesEnabled=t,[{type:"flagName",data:u},{type:"flagDescription",data:u}])),tableBreakpoints:Pr}}}const en=e=>!e||(e.version??(e.help?e.help.version:void 0)),tn=e=>{const t="parent"in e&&e.parent?.name;return(t?`${t} `:"")+e.name};function Tr(e){const t=[];e.name&&t.push(tn(e));const u=en(e)??("parent"in e&&en(e.parent));if(u&&t.push(`v${u}`),t.length!==0)return{id:"name",type:"text",data:`${t.join(" ")}
14
- `}}function Mr(e){const{help:t}=e;if(!(!t||!t.description))return{id:"description",type:"text",data:`${t.description}
15
- `}}function Rr(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 u=[],n=[tn(e)];if(e.flags&&Object.keys(e.flags).length>0&&n.push("[flags...]"),e.parameters&&e.parameters.length>0){const{parameters:r}=e,o=r.indexOf("--"),s=o>-1&&r.slice(o+1).some(a=>a.startsWith("<"));n.push(r.map(a=>a!=="--"?a:s?"--":"[--]").join(" "))}if(n.length>1&&u.push(n.join(" ")),"commands"in e&&e.commands?.length&&u.push(`${e.name} <command>`),u.length>0)return{id:"usage",type:"section",data:{title:"Usage:",body:u.join(`
17
- `)}}}}function Nr(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:_r(e.flags),indentBody:0}}}function Lr(e){const{help:t}=e;if(!t||!t.examples||t.examples.length===0)return;let{examples:u}=t;if(Array.isArray(u)&&(u=u.join(`
18
- `)),u)return{id:"examples",type:"section",data:{title:"Examples:",body:u}}}function jr(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 Gr=e=>[Tr,Mr,Rr,Nr,kr,Lr,jr].map(t=>t(e)).filter(Boolean),Ur=Ae.WriteStream.prototype.hasColors();class Hr{text(t){return t}bold(t){return Ur?`\x1B[1m${t}\x1B[22m`:t.toLocaleUpperCase()}indentText({text:t,spaces:u}){return t.replace(/^/gm," ".repeat(u))}heading(t){return this.bold(t)}section({title:t,body:u,indentBody:n=2}){return`${(t?`${this.heading(t)}
19
- `:"")+(u?this.indentText({text:this.render(u),spaces:n}):"")}
20
- `}table({tableData:t,tableOptions:u,tableBreakpoints:n}){return vr(t.map(r=>r.map(o=>this.render(o))),n?Or(n):u)}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:u,flagFormatted:n,aliasesEnabled:r,aliasFormatted:o}=t;let s="";if(o?s+=`${o}, `:r&&(s+=" "),s+=n,"placeholder"in u&&typeof u.placeholder=="string")s+=`${this.flagOperator(t)}${u.placeholder}`;else{const a=this.flagParameter("type"in u?u.type:u);a&&(s+=`${this.flagOperator(t)}${a}`)}return s}flagDefault(t){return JSON.stringify(t)}flagDescription({flag:t}){let u="description"in t?t.description??"":"";if("default"in t){let{default:n}=t;typeof n=="function"&&(n=n()),n&&(u+=` (default: ${this.flagDefault(n)})`)}return u}render(t){if(typeof t=="string")return t;if(Array.isArray(t))return t.map(u=>this.render(u)).join(`
21
- `);if("type"in t&&this[t.type]){const u=this[t.type];if(typeof u=="function")return u.call(this,t.data)}throw new Error(`Invalid node type: ${JSON.stringify(t)}`)}}const Le=/^[\w.-]+$/,{stringify:O}=JSON,qr=/[|\\{}()[\]^$+*?.]/;function je(e){const t=[];let u,n;for(const r of e){if(n)throw new Error(`Invalid parameter: Spread parameter ${O(n)} must be last`);const o=r[0],s=r[r.length-1];let a;if(o==="<"&&s===">"&&(a=!0,u))throw new Error(`Invalid parameter: Required parameter ${O(r)} cannot come after optional parameter ${O(u)}`);if(o==="["&&s==="]"&&(a=!1,u=r),a===void 0)throw new Error(`Invalid parameter: ${O(r)}. Must be wrapped in <> (required parameter) or [] (optional parameter)`);let i=r.slice(1,-1);const f=i.slice(-3)==="...";f&&(n=r,i=i.slice(0,-3));const l=i.match(qr);if(l)throw new Error(`Invalid parameter: ${O(r)}. Invalid character found ${O(l[0])}`);t.push({name:i,required:a,spread:f})}return t}function Ge(e,t,u,n){for(let r=0;r<t.length;r+=1){const{name:o,required:s,spread:a}=t[r],i=Sr(o);if(i in e)throw new Error(`Invalid parameter: ${O(o)} is used more than once.`);const f=a?u.slice(r):u[r];if(a&&(r=t.length),s&&(!f||a&&f.length===0))return console.error(`Error: Missing required parameter ${O(o)}
22
- `),n(),process.exit(1);e[i]=f}}function Kr(e){return e===void 0||e!==!1}function nn(e,t,u,n){const r={...t.flags},o=t.version;o&&(r.version={type:Boolean,description:"Show version"});const{help:s}=t,a=Kr(s);a&&!("help"in r)&&(r.help={type:Boolean,alias:"h",description:"Show help"});const i=Wu(r,n,{ignore:t.ignoreArgv}),f=()=>{console.log(t.version)};if(o&&i.flags.version===!0)return f(),process.exit(0);const l=new Hr,c=a&&s?.render?s.render:p=>l.render(p),D=p=>{const m=Gr({...t,...p?{help:p}:{},flags:r});console.log(c(m,l))};if(a&&i.flags.help===!0)return D(),process.exit(0);if(t.parameters){let{parameters:p}=t,m=i._;const h=p.indexOf("--"),C=p.slice(h+1),E=Object.create(null);if(h>-1&&C.length>0){p=p.slice(0,h);const $=i._["--"];m=m.slice(0,-$.length||void 0),Ge(E,je(p),m,D),Ge(E,je(C),$,D)}else Ge(E,je(p),m,D);Object.assign(i._,E)}const d={...i,showVersion:f,showHelp:D};return typeof u=="function"&&u(d),{command:e,...d}}function zr(e,t){const u=new Map;for(const n of t){const r=[n.options.name],{alias:o}=n.options;o&&(Array.isArray(o)?r.push(...o):r.push(o));for(const s of r){if(u.has(s))throw new Error(`Duplicate command name found: ${O(s)}`);u.set(s,n)}}return u.get(e)}function Wr(e,t,u=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: ${O(e.name)}`);const n=u[0];if(e.commands&&Le.test(n)){const r=zr(n,e.commands);if(r)return nn(r.options.name,{...r.options,parent:e},r.callback,u.slice(1))}return nn(void 0,e,t,u)}function un(e,t){if(!e)throw new Error("Command options are required");const{name:u}=e;if(e.name===void 0)throw new Error("Command name is required");if(!Le.test(u))throw new Error(`Invalid command name ${JSON.stringify(u)}. Command names must be one word.`);return{options:e,callback:t}}var Vr=Du(import.meta.url),y=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function G(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var U={exports:{}},Ue,rn;function Yr(){if(rn)return Ue;rn=1,Ue=n,n.sync=r;var e=ve;function t(o,s){var a=s.pathExt!==void 0?s.pathExt:process.env.PATHEXT;if(!a||(a=a.split(";"),a.indexOf("")!==-1))return!0;for(var i=0;i<a.length;i++){var f=a[i].toLowerCase();if(f&&o.substr(-f.length).toLowerCase()===f)return!0}return!1}function u(o,s,a){return!o.isSymbolicLink()&&!o.isFile()?!1:t(s,a)}function n(o,s,a){e.stat(o,function(i,f){a(i,i?!1:u(f,o,s))})}function r(o,s){return u(e.statSync(o),o,s)}return Ue}var He,on;function Xr(){if(on)return He;on=1,He=t,t.sync=u;var e=ve;function t(o,s,a){e.stat(o,function(i,f){a(i,i?!1:n(f,s))})}function u(o,s){return n(e.statSync(o),s)}function n(o,s){return o.isFile()&&r(o,s)}function r(o,s){var a=o.mode,i=o.uid,f=o.gid,l=s.uid!==void 0?s.uid:process.getuid&&process.getuid(),c=s.gid!==void 0?s.gid:process.getgid&&process.getgid(),D=parseInt("100",8),d=parseInt("010",8),p=parseInt("001",8),m=D|d,h=a&p||a&d&&f===c||a&D&&i===l||a&m&&l===0;return h}return He}var fe;process.platform==="win32"||y.TESTING_WINDOWS?fe=Yr():fe=Xr();var Jr=qe;qe.sync=Zr;function qe(e,t,u){if(typeof t=="function"&&(u=t,t={}),!u){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(n,r){qe(e,t||{},function(o,s){o?r(o):n(s)})})}fe(e,t||{},function(n,r){n&&(n.code==="EACCES"||t&&t.ignoreErrors)&&(n=null,r=!1),u(n,r)})}function Zr(e,t){try{return fe.sync(e,t||{})}catch(u){if(t&&t.ignoreErrors||u.code==="EACCES")return!1;throw u}}const H=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",sn=j,Qr=H?";":":",an=Jr,Dn=e=>Object.assign(new Error(`not found: ${e}`),{code:"ENOENT"}),cn=(e,t)=>{const u=t.colon||Qr,n=e.match(/\//)||H&&e.match(/\\/)?[""]:[...H?[process.cwd()]:[],...(t.path||process.env.PATH||"").split(u)],r=H?t.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",o=H?r.split(u):[""];return H&&e.indexOf(".")!==-1&&o[0]!==""&&o.unshift(""),{pathEnv:n,pathExt:o,pathExtExe:r}},ln=(e,t,u)=>{typeof t=="function"&&(u=t,t={}),t||(t={});const{pathEnv:n,pathExt:r,pathExtExe:o}=cn(e,t),s=[],a=f=>new Promise((l,c)=>{if(f===n.length)return t.all&&s.length?l(s):c(Dn(e));const D=n[f],d=/^".*"$/.test(D)?D.slice(1,-1):D,p=sn.join(d,e),m=!d&&/^\.[\\\/]/.test(e)?e.slice(0,2)+p:p;l(i(m,f,0))}),i=(f,l,c)=>new Promise((D,d)=>{if(c===r.length)return D(a(l+1));const p=r[c];an(f+p,{pathExt:o},(m,h)=>{if(!m&&h)if(t.all)s.push(f+p);else return D(f+p);return D(i(f,l,c+1))})});return u?a(0).then(f=>u(null,f),u):a(0)},eo=(e,t)=>{t=t||{};const{pathEnv:u,pathExt:n,pathExtExe:r}=cn(e,t),o=[];for(let s=0;s<u.length;s++){const a=u[s],i=/^".*"$/.test(a)?a.slice(1,-1):a,f=sn.join(i,e),l=!i&&/^\.[\\\/]/.test(e)?e.slice(0,2)+f:f;for(let c=0;c<n.length;c++){const D=l+n[c];try{if(an.sync(D,{pathExt:r}))if(t.all)o.push(D);else return D}catch{}}}if(t.all&&o.length)return o;if(t.nothrow)return null;throw Dn(e)};var to=ln;ln.sync=eo;var Ke={exports:{}};const fn=(e={})=>{const t=e.env||process.env;return(e.platform||process.platform)!=="win32"?"PATH":Object.keys(t).reverse().find(n=>n.toUpperCase()==="PATH")||"Path"};Ke.exports=fn,Ke.exports.default=fn;var no=Ke.exports;const dn=j,uo=to,ro=no;function pn(e,t){const u=e.options.env||process.env,n=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=uo.sync(e.command,{path:u[ro({env:u})],pathExt:t?dn.delimiter:void 0})}catch{}finally{o&&process.chdir(n)}return s&&(s=dn.resolve(r?e.options.cwd:"",s)),s}function oo(e){return pn(e)||pn(e,!0)}var so=oo,ze={};const We=/([()\][%!^"`<>&|;, *?])/g;function io(e){return e=e.replace(We,"^$1"),e}function ao(e,t){return e=`${e}`,e=e.replace(/(\\*)"/g,'$1$1\\"'),e=e.replace(/(\\*)$/,"$1$1"),e=`"${e}"`,e=e.replace(We,"^$1"),t&&(e=e.replace(We,"^$1")),e}ze.command=io,ze.argument=ao;var Do=/^#!(.*)/;const co=Do;var lo=(e="")=>{const t=e.match(co);if(!t)return null;const[u,n]=t[0].replace(/#! ?/,"").split(" "),r=u.split("/").pop();return r==="env"?n:n?`${r} ${n}`:r};const Ve=ve,fo=lo;function po(e){const u=Buffer.alloc(150);let n;try{n=Ve.openSync(e,"r"),Ve.readSync(n,u,0,150,0),Ve.closeSync(n)}catch{}return fo(u.toString())}var mo=po;const ho=j,mn=so,hn=ze,Co=mo,go=process.platform==="win32",Fo=/\.(?:com|exe)$/i,Eo=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function yo(e){e.file=mn(e);const t=e.file&&Co(e.file);return t?(e.args.unshift(e.file),e.command=t,mn(e)):e.file}function wo(e){if(!go)return e;const t=yo(e),u=!Fo.test(t);if(e.options.forceShell||u){const n=Eo.test(t);e.command=ho.normalize(e.command),e.command=hn.command(e.command),e.args=e.args.map(o=>hn.argument(o,n));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 bo(e,t,u){t&&!Array.isArray(t)&&(u=t,t=null),t=t?t.slice(0):[],u=Object.assign({},u);const n={command:e,args:t,options:u,file:void 0,original:{command:e,args:t}};return u.shell?n:wo(n)}var Bo=bo;const Ye=process.platform==="win32";function Xe(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 Ao(e,t){if(!Ye)return;const u=e.emit;e.emit=function(n,r){if(n==="exit"){const o=Cn(r,t);if(o)return u.call(e,"error",o)}return u.apply(e,arguments)}}function Cn(e,t){return Ye&&e===1&&!t.file?Xe(t.original,"spawn"):null}function vo(e,t){return Ye&&e===1&&!t.file?Xe(t.original,"spawnSync"):null}var $o={hookChildProcess:Ao,verifyENOENT:Cn,verifyENOENTSync:vo,notFoundError:Xe};const gn=lu,Je=Bo,Ze=$o;function Fn(e,t,u){const n=Je(e,t,u),r=gn.spawn(n.command,n.args,n.options);return Ze.hookChildProcess(r,n),r}function xo(e,t,u){const n=Je(e,t,u),r=gn.spawnSync(n.command,n.args,n.options);return r.error=r.error||Ze.verifyENOENTSync(r.status,n),r}U.exports=Fn,U.exports.spawn=Fn,U.exports.sync=xo,U.exports._parse=Je,U.exports._enoent=Ze;var Oo=U.exports,So=G(Oo);function Io(e){const t=typeof e=="string"?`
8
+ `).map(u=>Ar(u,t,n)).join(`
9
+ `)}var Qt=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 f;let l=(f=t[u])!=null?f:"";u+=1,i.preprocess&&(l=i.preprocess(l)),Ut(l)>i.width&&(l=vr(l,i.width,{hard:!0}));let c=l.split(`
10
+ `);if(i.postprocess){let{postprocess:D}=i;c=c.map((d,p)=>D.call(i,d,p))}return i.paddingTop&&c.unshift(...Qt(i.paddingTop)),i.paddingBottom&&c.push(...Qt(i.paddingBottom)),c.length>o&&(o=c.length),Te(ce({},i),{lines:c})}),a=[];for(let i=0;i<o;i+=1){let f=s.map(l=>{var c;let D=(c=l.lines[i])!=null?c:"",d=Number.isFinite(l.width)?" ".repeat(l.width-T(D)):"",p=l.paddingLeftString;return l.align==="right"&&(p+=d),p+=D,l.align==="left"&&(p+=d),p+l.paddingRightString}).join("");a.push(f)}n.push(a.join(`
11
+ `))}return n.join(`
12
+ `)}function xr(e,t){if(!e||e.length===0)return"";let n=dr(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=Cr(r,o,n);return e.map(a=>$r(s,a)).join(`
13
+ `)}v();var Or=["<",">","=",">=","<="];function Sr(e){if(!Or.includes(e))throw new TypeError(`Invalid breakpoint operator: ${e}`)}function Ir(e){let t=Object.keys(e).map(n=>{let[u,r]=n.split(" ");Sr(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 Pr=e=>e.replace(/[\W_]([a-z\d])?/gi,(t,n)=>n?n.toUpperCase():""),_r=e=>e.replace(/\B([A-Z])/g,"-$1").toLowerCase(),Tr={"> 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 Mr(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:`--${_r(n)}`,aliasesEnabled:t,aliasFormatted:r?`-${u.alias}`:void 0}}).map(n=>(n.aliasesEnabled=t,[{type:"flagName",data:n},{type:"flagDescription",data:n}])),tableBreakpoints:Tr}}}const en=e=>!e||(e.version??(e.help?e.help.version:void 0)),tn=e=>{const t="parent"in e&&e.parent?.name;return(t?`${t} `:"")+e.name};function Rr(e){const t=[];e.name&&t.push(tn(e));const n=en(e)??("parent"in e&&en(e.parent));if(n&&t.push(`v${n}`),t.length!==0)return{id:"name",type:"text",data:`${t.join(" ")}
14
+ `}}function Nr(e){const{help:t}=e;if(!(!t||!t.description))return{id:"description",type:"text",data:`${t.description}
15
+ `}}function kr(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=[tn(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(a=>a.startsWith("<"));u.push(r.map(a=>a!=="--"?a: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 Lr(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 jr(e){if(!(!e.flags||Object.keys(e.flags).length===0))return{id:"flags",type:"section",data:{title:"Flags:",body:Mr(e.flags),indentBody:0}}}function Gr(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 Ur(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 Hr=e=>[Rr,Nr,kr,Lr,jr,Gr,Ur].map(t=>t(e)).filter(Boolean),qr=Ae.WriteStream.prototype.hasColors();class Kr{text(t){return t}bold(t){return qr?`\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
+ `:"")+(n?this.indentText({text:this.render(n),spaces:u}):"")}
20
+ `}table({tableData:t,tableOptions:n,tableBreakpoints:u}){return xr(t.map(r=>r.map(o=>this.render(o))),u?Ir(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 a=this.flagParameter("type"in n?n.type:n);a&&(s+=`${this.flagOperator(t)}${a}`)}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:O}=JSON,zr=/[|\\{}()[\]^$+*?.]/;function je(e){const t=[];let n,u;for(const r of e){if(u)throw new Error(`Invalid parameter: Spread parameter ${O(u)} must be last`);const o=r[0],s=r[r.length-1];let a;if(o==="<"&&s===">"&&(a=!0,n))throw new Error(`Invalid parameter: Required parameter ${O(r)} cannot come after optional parameter ${O(n)}`);if(o==="["&&s==="]"&&(a=!1,n=r),a===void 0)throw new Error(`Invalid parameter: ${O(r)}. Must be wrapped in <> (required parameter) or [] (optional parameter)`);let i=r.slice(1,-1);const f=i.slice(-3)==="...";f&&(u=r,i=i.slice(0,-3));const l=i.match(zr);if(l)throw new Error(`Invalid parameter: ${O(r)}. Invalid character found ${O(l[0])}`);t.push({name:i,required:a,spread:f})}return t}function Ge(e,t,n,u){for(let r=0;r<t.length;r+=1){const{name:o,required:s,spread:a}=t[r],i=Pr(o);if(i in e)throw new Error(`Invalid parameter: ${O(o)} is used more than once.`);const f=a?n.slice(r):n[r];if(a&&(r=t.length),s&&(!f||a&&f.length===0))return console.error(`Error: Missing required parameter ${O(o)}
22
+ `),u(),process.exit(1);e[i]=f}}function Wr(e){return e===void 0||e!==!1}function nn(e,t,n,u){const r={...t.flags},o=t.version;o&&(r.version={type:Boolean,description:"Show version"});const{help:s}=t,a=Wr(s);a&&!("help"in r)&&(r.help={type:Boolean,alias:"h",description:"Show help"});const i=Yu(r,u,{ignore:t.ignoreArgv}),f=()=>{console.log(t.version)};if(o&&i.flags.version===!0)return f(),process.exit(0);const l=new Kr,c=a&&s?.render?s.render:p=>l.render(p),D=p=>{const m=Hr({...t,...p?{help:p}:{},flags:r});console.log(c(m,l))};if(a&&i.flags.help===!0)return D(),process.exit(0);if(t.parameters){let{parameters:p}=t,m=i._;const h=p.indexOf("--"),C=p.slice(h+1),E=Object.create(null);if(h>-1&&C.length>0){p=p.slice(0,h);const $=i._["--"];m=m.slice(0,-$.length||void 0),Ge(E,je(p),m,D),Ge(E,je(C),$,D)}else Ge(E,je(p),m,D);Object.assign(i._,E)}const d={...i,showVersion:f,showHelp:D};return typeof n=="function"&&n(d),{command:e,...d}}function Vr(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: ${O(s)}`);n.set(s,u)}}return n.get(e)}function Yr(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: ${O(e.name)}`);const u=n[0];if(e.commands&&Le.test(u)){const r=Vr(u,e.commands);if(r)return nn(r.options.name,{...r.options,parent:e},r.callback,n.slice(1))}return nn(void 0,e,t,n)}function un(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 Xr=Du(import.meta.url),y=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function G(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var U={exports:{}},Ue,rn;function Jr(){if(rn)return Ue;rn=1,Ue=u,u.sync=r;var e=ve;function t(o,s){var a=s.pathExt!==void 0?s.pathExt:process.env.PATHEXT;if(!a||(a=a.split(";"),a.indexOf("")!==-1))return!0;for(var i=0;i<a.length;i++){var f=a[i].toLowerCase();if(f&&o.substr(-f.length).toLowerCase()===f)return!0}return!1}function n(o,s,a){return!o.isSymbolicLink()&&!o.isFile()?!1:t(s,a)}function u(o,s,a){e.stat(o,function(i,f){a(i,i?!1:n(f,o,s))})}function r(o,s){return n(e.statSync(o),o,s)}return Ue}var He,on;function Zr(){if(on)return He;on=1,He=t,t.sync=n;var e=ve;function t(o,s,a){e.stat(o,function(i,f){a(i,i?!1:u(f,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 a=o.mode,i=o.uid,f=o.gid,l=s.uid!==void 0?s.uid:process.getuid&&process.getuid(),c=s.gid!==void 0?s.gid:process.getgid&&process.getgid(),D=parseInt("100",8),d=parseInt("010",8),p=parseInt("001",8),m=D|d,h=a&p||a&d&&f===c||a&D&&i===l||a&m&&l===0;return h}return He}var fe;process.platform==="win32"||y.TESTING_WINDOWS?fe=Jr():fe=Zr();var Qr=qe;qe.sync=eo;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)})})}fe(e,t||{},function(u,r){u&&(u.code==="EACCES"||t&&t.ignoreErrors)&&(u=null,r=!1),n(u,r)})}function eo(e,t){try{return fe.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",sn=j,to=H?";":":",an=Qr,Dn=e=>Object.assign(new Error(`not found: ${e}`),{code:"ENOENT"}),cn=(e,t)=>{const n=t.colon||to,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}},ln=(e,t,n)=>{typeof t=="function"&&(n=t,t={}),t||(t={});const{pathEnv:u,pathExt:r,pathExtExe:o}=cn(e,t),s=[],a=f=>new Promise((l,c)=>{if(f===u.length)return t.all&&s.length?l(s):c(Dn(e));const D=u[f],d=/^".*"$/.test(D)?D.slice(1,-1):D,p=sn.join(d,e),m=!d&&/^\.[\\\/]/.test(e)?e.slice(0,2)+p:p;l(i(m,f,0))}),i=(f,l,c)=>new Promise((D,d)=>{if(c===r.length)return D(a(l+1));const p=r[c];an(f+p,{pathExt:o},(m,h)=>{if(!m&&h)if(t.all)s.push(f+p);else return D(f+p);return D(i(f,l,c+1))})});return n?a(0).then(f=>n(null,f),n):a(0)},no=(e,t)=>{t=t||{};const{pathEnv:n,pathExt:u,pathExtExe:r}=cn(e,t),o=[];for(let s=0;s<n.length;s++){const a=n[s],i=/^".*"$/.test(a)?a.slice(1,-1):a,f=sn.join(i,e),l=!i&&/^\.[\\\/]/.test(e)?e.slice(0,2)+f:f;for(let c=0;c<u.length;c++){const D=l+u[c];try{if(an.sync(D,{pathExt:r}))if(t.all)o.push(D);else return D}catch{}}}if(t.all&&o.length)return o;if(t.nothrow)return null;throw Dn(e)};var uo=ln;ln.sync=no;var Ke={exports:{}};const fn=(e={})=>{const t=e.env||process.env;return(e.platform||process.platform)!=="win32"?"PATH":Object.keys(t).reverse().find(u=>u.toUpperCase()==="PATH")||"Path"};Ke.exports=fn,Ke.exports.default=fn;var ro=Ke.exports;const dn=j,oo=uo,so=ro;function pn(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=oo.sync(e.command,{path:n[so({env:n})],pathExt:t?dn.delimiter:void 0})}catch{}finally{o&&process.chdir(u)}return s&&(s=dn.resolve(r?e.options.cwd:"",s)),s}function io(e){return pn(e)||pn(e,!0)}var ao=io,ze={};const We=/([()\][%!^"`<>&|;, *?])/g;function Do(e){return e=e.replace(We,"^$1"),e}function co(e,t){return e=`${e}`,e=e.replace(/(\\*)"/g,'$1$1\\"'),e=e.replace(/(\\*)$/,"$1$1"),e=`"${e}"`,e=e.replace(We,"^$1"),t&&(e=e.replace(We,"^$1")),e}ze.command=Do,ze.argument=co;var lo=/^#!(.*)/;const fo=lo;var po=(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 Ve=ve,mo=po;function ho(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 mo(n.toString())}var Co=ho;const go=j,mn=ao,hn=ze,Fo=Co,Eo=process.platform==="win32",yo=/\.(?:com|exe)$/i,wo=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function bo(e){e.file=mn(e);const t=e.file&&Fo(e.file);return t?(e.args.unshift(e.file),e.command=t,mn(e)):e.file}function Bo(e){if(!Eo)return e;const t=bo(e),n=!yo.test(t);if(e.options.forceShell||n){const u=wo.test(t);e.command=go.normalize(e.command),e.command=hn.command(e.command),e.args=e.args.map(o=>hn.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 Ao(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:Bo(u)}var vo=Ao;const Ye=process.platform==="win32";function Xe(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 $o(e,t){if(!Ye)return;const n=e.emit;e.emit=function(u,r){if(u==="exit"){const o=Cn(r,t);if(o)return n.call(e,"error",o)}return n.apply(e,arguments)}}function Cn(e,t){return Ye&&e===1&&!t.file?Xe(t.original,"spawn"):null}function xo(e,t){return Ye&&e===1&&!t.file?Xe(t.original,"spawnSync"):null}var Oo={hookChildProcess:$o,verifyENOENT:Cn,verifyENOENTSync:xo,notFoundError:Xe};const gn=lu,Je=vo,Ze=Oo;function Fn(e,t,n){const u=Je(e,t,n),r=gn.spawn(u.command,u.args,u.options);return Ze.hookChildProcess(r,u),r}function So(e,t,n){const u=Je(e,t,n),r=gn.spawnSync(u.command,u.args,u.options);return r.error=r.error||Ze.verifyENOENTSync(r.status,u),r}U.exports=Fn,U.exports.spawn=Fn,U.exports.sync=So,U.exports._parse=Je,U.exports._enoent=Ze;var Io=U.exports,Po=G(Io);function _o(e){const t=typeof e=="string"?`
23
23
  `:`
24
- `.charCodeAt(),u=typeof e=="string"?"\r":"\r".charCodeAt();return e[e.length-1]===t&&(e=e.slice(0,-1)),e[e.length-1]===u&&(e=e.slice(0,-1)),e}function En(e={}){const{env:t=process.env,platform:u=process.platform}=e;return u!=="win32"?"PATH":Object.keys(t).reverse().find(n=>n.toUpperCase()==="PATH")||"Path"}function Po(e={}){const{cwd:t=_.cwd(),path:u=_.env[En()],execPath:n=_.execPath}=e;let r;const o=t instanceof URL?fu.fileURLToPath(t):t;let s=L.resolve(o);const a=[];for(;r!==s;)a.push(L.join(s,"node_modules/.bin")),r=s,s=L.resolve(s,"..");return a.push(L.resolve(o,n,"..")),[...a,u].join(L.delimiter)}function _o({env:e=_.env,...t}={}){e={...e};const u=En({env:e});return t.path=e[u],e[u]=Po(t),e}const To=(e,t,u,n)=>{if(u==="length"||u==="prototype"||u==="arguments"||u==="caller")return;const r=Object.getOwnPropertyDescriptor(e,u),o=Object.getOwnPropertyDescriptor(t,u);!Mo(r,o)&&n||Object.defineProperty(e,u,o)},Mo=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)},Ro=(e,t)=>{const u=Object.getPrototypeOf(t);u!==Object.getPrototypeOf(e)&&Object.setPrototypeOf(e,u)},No=(e,t)=>`/* Wrapped ${e}*/
25
- ${t}`,ko=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),Lo=Object.getOwnPropertyDescriptor(Function.prototype.toString,"name"),jo=(e,t,u)=>{const n=u===""?"":`with ${u.trim()}() `,r=No.bind(null,n,t.toString());Object.defineProperty(r,"name",Lo),Object.defineProperty(e,"toString",{...ko,value:r})};function Go(e,t,{ignoreNonConfigurable:u=!1}={}){const{name:n}=e;for(const r of Reflect.ownKeys(t))To(e,t,r,u);return Ro(e,t),jo(e,t,n),e}const de=new WeakMap,yn=(e,t={})=>{if(typeof e!="function")throw new TypeError("Expected a function");let u,n=0;const r=e.displayName||e.name||"<anonymous>",o=function(...s){if(de.set(o,++n),n===1)u=e.apply(this,s),e=null;else if(t.throw===!0)throw new Error(`Function \`${r}\` can only be called once`);return u};return Go(o,e),de.set(o,n),o};yn.callCount=e=>{if(!de.has(e))throw new Error(`The given function \`${e.name}\` is not wrapped by the \`onetime\` package`);return de.get(e)};const Uo=()=>{const e=bn-wn+1;return Array.from({length:e},Ho)},Ho=(e,t)=>({name:`SIGRT${t+1}`,number:wn+t,action:"terminate",description:"Application-specific signal (realtime)",standard:"posix"}),wn=34,bn=64,qo=[{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"}],Bn=()=>{const e=Uo();return[...qo,...e].map(Ko)},Ko=({name:e,number:t,description:u,action:n,forced:r=!1,standard:o})=>{const{signals:{[e]:s}}=St,a=s!==void 0;return{name:e,number:a?s:t,description:u,supported:a,action:n,forced:r,standard:o}},zo=()=>{const e=Bn();return Object.fromEntries(e.map(Wo))},Wo=({name:e,number:t,description:u,supported:n,action:r,forced:o,standard:s})=>[e,{name:e,number:t,description:u,supported:n,action:r,forced:o,standard:s}],Vo=zo(),Yo=()=>{const e=Bn(),t=bn+1,u=Array.from({length:t},(n,r)=>Xo(r,e));return Object.assign({},...u)},Xo=(e,t)=>{const u=Jo(e,t);if(u===void 0)return{};const{name:n,description:r,supported:o,action:s,forced:a,standard:i}=u;return{[e]:{name:n,number:e,description:r,supported:o,action:s,forced:a,standard:i}}},Jo=(e,t)=>{const u=t.find(({name:n})=>St.signals[n]===e);return u!==void 0?u:t.find(n=>n.number===e)};Yo();const Zo=({timedOut:e,timeout:t,errorCode:u,signal:n,signalDescription:r,exitCode:o,isCanceled:s})=>e?`timed out after ${t} milliseconds`:s?"was canceled":u!==void 0?`failed with ${u}`:n!==void 0?`was killed with ${n} (${r})`:o!==void 0?`failed with exit code ${o}`:"failed",An=({stdout:e,stderr:t,all:u,error:n,signal:r,exitCode:o,command:s,escapedCommand:a,timedOut:i,isCanceled:f,killed:l,parsed:{options:{timeout:c}}})=>{o=o===null?void 0:o,r=r===null?void 0:r;const D=r===void 0?void 0:Vo[r].description,d=n&&n.code,m=`Command ${Zo({timedOut:i,timeout:c,errorCode:d,signal:r,signalDescription:D,exitCode:o,isCanceled:f})}: ${s}`,h=Object.prototype.toString.call(n)==="[object Error]",C=h?`${m}
26
- ${n.message}`:m,E=[C,t,e].filter(Boolean).join(`
27
- `);return h?(n.originalMessage=n.message,n.message=E):n=new Error(E),n.shortMessage=C,n.command=s,n.escapedCommand=a,n.exitCode=o,n.signal=r,n.signalDescription=D,n.stdout=e,n.stderr=t,u!==void 0&&(n.all=u),"bufferedData"in n&&delete n.bufferedData,n.failed=!0,n.timedOut=!!i,n.isCanceled=f,n.killed=l&&!i,n},pe=["stdin","stdout","stderr"],Qo=e=>pe.some(t=>e[t]!==void 0),es=e=>{if(!e)return;const{stdio:t}=e;if(t===void 0)return pe.map(n=>e[n]);if(Qo(e))throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${pe.map(n=>`\`${n}\``).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 u=Math.max(t.length,pe.length);return Array.from({length:u},(n,r)=>t[r])};var q={exports:{}},me={exports:{}};me.exports;var vn;function ts(){return vn||(vn=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")}(me)),me.exports}var F=y.process;const M=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(!M(F))q.exports=function(){return function(){}};else{var ns=It,J=ts(),us=/^win/i.test(F.platform),he=Pt;typeof he!="function"&&(he=he.EventEmitter);var B;F.__signal_exit_emitter__?B=F.__signal_exit_emitter__:(B=F.__signal_exit_emitter__=new he,B.count=0,B.emitted={}),B.infinite||(B.setMaxListeners(1/0),B.infinite=!0),q.exports=function(e,t){if(!M(y.process))return function(){};ns.equal(typeof e,"function","a callback must be provided for exit handler"),Z===!1&&$n();var u="exit";t&&t.alwaysLast&&(u="afterexit");var n=function(){B.removeListener(u,e),B.listeners("exit").length===0&&B.listeners("afterexit").length===0&&Qe()};return B.on(u,e),n};var Qe=function(){!Z||!M(y.process)||(Z=!1,J.forEach(function(t){try{F.removeListener(t,et[t])}catch{}}),F.emit=tt,F.reallyExit=xn,B.count-=1)};q.exports.unload=Qe;var K=function(t,u,n){B.emitted[t]||(B.emitted[t]=!0,B.emit(t,u,n))},et={};J.forEach(function(e){et[e]=function(){if(M(y.process)){var u=F.listeners(e);u.length===B.count&&(Qe(),K("exit",null,e),K("afterexit",null,e),us&&e==="SIGHUP"&&(e="SIGINT"),F.kill(F.pid,e))}}}),q.exports.signals=function(){return J};var Z=!1,$n=function(){Z||!M(y.process)||(Z=!0,B.count+=1,J=J.filter(function(t){try{return F.on(t,et[t]),!0}catch{return!1}}),F.emit=os,F.reallyExit=rs)};q.exports.load=$n;var xn=F.reallyExit,rs=function(t){M(y.process)&&(F.exitCode=t||0,K("exit",F.exitCode,null),K("afterexit",F.exitCode,null),xn.call(F,F.exitCode))},tt=F.emit,os=function(t,u){if(t==="exit"&&M(y.process)){u!==void 0&&(F.exitCode=u);var n=tt.apply(this,arguments);return K("exit",F.exitCode,null),K("afterexit",F.exitCode,null),n}else return tt.apply(this,arguments)}}var ss=q.exports,is=G(ss);const as=1e3*5,Ds=(e,t="SIGTERM",u={})=>{const n=e(t);return cs(e,t,u,n),n},cs=(e,t,u,n)=>{if(!ls(t,u,n))return;const r=ds(u),o=setTimeout(()=>{e("SIGKILL")},r);o.unref&&o.unref()},ls=(e,{forceKillAfterTimeout:t},u)=>fs(e)&&t!==!1&&u,fs=e=>e===du.constants.signals.SIGTERM||typeof e=="string"&&e.toUpperCase()==="SIGTERM",ds=({forceKillAfterTimeout:e=!0})=>{if(e===!0)return as;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},ps=(e,t)=>{e.kill()&&(t.isCanceled=!0)},ms=(e,t,u)=>{e.kill(t),u(Object.assign(new Error("Timed out"),{timedOut:!0,signal:t}))},hs=(e,{timeout:t,killSignal:u="SIGTERM"},n)=>{if(t===0||t===void 0)return n;let r;const o=new Promise((a,i)=>{r=setTimeout(()=>{ms(e,u,i)},t)}),s=n.finally(()=>{clearTimeout(r)});return Promise.race([o,s])},Cs=({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})`)},gs=async(e,{cleanup:t,detached:u},n)=>{if(!t||u)return n;const r=is(()=>{e.kill()});return n.finally(()=>{r()})};function Fs(e){return e!==null&&typeof e=="object"&&typeof e.pipe=="function"}var Q={exports:{}};const{PassThrough:Es}=$e;var ys=e=>{e={...e};const{array:t}=e;let{encoding:u}=e;const n=u==="buffer";let r=!1;t?r=!(u||n):u=u||"utf8",n&&(u=null);const o=new Es({objectMode:r});u&&o.setEncoding(u);let s=0;const a=[];return o.on("data",i=>{a.push(i),r?s=a.length:s+=i.length}),o.getBufferedValue=()=>t?a:n?Buffer.concat(a,s):a.join(""),o.getBufferedLength=()=>s,o};const{constants:ws}=pu,bs=$e,{promisify:Bs}=_t,As=ys,vs=Bs(bs.pipeline);class On extends Error{constructor(){super("maxBuffer exceeded"),this.name="MaxBufferError"}}async function nt(e,t){if(!e)throw new Error("Expected a stream");t={maxBuffer:1/0,...t};const{maxBuffer:u}=t,n=As(t);return await new Promise((r,o)=>{const s=a=>{a&&n.getBufferedLength()<=ws.MAX_LENGTH&&(a.bufferedData=n.getBufferedValue()),o(a)};(async()=>{try{await vs(e,n),r()}catch(a){s(a)}})(),n.on("data",()=>{n.getBufferedLength()>u&&s(new On)})}),n.getBufferedValue()}Q.exports=nt,Q.exports.buffer=(e,t)=>nt(e,{...t,encoding:"buffer"}),Q.exports.array=(e,t)=>nt(e,{...t,array:!0}),Q.exports.MaxBufferError=On;var $s=Q.exports,Sn=G($s);const{PassThrough:xs}=$e;var Os=function(){var e=[],t=new xs({objectMode:!0});return t.setMaxListeners(0),t.add=u,t.isEmpty=n,t.on("unpipe",r),Array.prototype.slice.call(arguments).forEach(u),t;function u(o){return Array.isArray(o)?(o.forEach(u),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 n(){return e.length==0}function r(o){e=e.filter(function(s){return s!==o}),!e.length&&t.readable&&t.end()}},Ss=G(Os);const Is=(e,t)=>{t!==void 0&&(Fs(t)?t.pipe(e.stdin):e.stdin.end(t))},Ps=(e,{all:t})=>{if(!t||!e.stdout&&!e.stderr)return;const u=Ss();return e.stdout&&u.add(e.stdout),e.stderr&&u.add(e.stderr),u},ut=async(e,t)=>{if(!(!e||t===void 0)){e.destroy();try{return await t}catch(u){return u.bufferedData}}},rt=(e,{encoding:t,buffer:u,maxBuffer:n})=>{if(!(!e||!u))return t?Sn(e,{encoding:t,maxBuffer:n}):Sn.buffer(e,{maxBuffer:n})},_s=async({stdout:e,stderr:t,all:u},{encoding:n,buffer:r,maxBuffer:o},s)=>{const a=rt(e,{encoding:n,buffer:r,maxBuffer:o}),i=rt(t,{encoding:n,buffer:r,maxBuffer:o}),f=rt(u,{encoding:n,buffer:r,maxBuffer:o*2});try{return await Promise.all([s,a,i,f])}catch(l){return Promise.all([{error:l,signal:l.signal,timedOut:l.timedOut},ut(e,a),ut(t,i),ut(u,f)])}},Ts=(async()=>{})().constructor.prototype,Ms=["then","catch","finally"].map(e=>[e,Reflect.getOwnPropertyDescriptor(Ts,e)]),In=(e,t)=>{for(const[u,n]of Ms){const r=typeof t=="function"?(...o)=>Reflect.apply(n.value,t(),o):n.value.bind(t);Reflect.defineProperty(e,u,{...n,value:r})}return e},Rs=e=>new Promise((t,u)=>{e.on("exit",(n,r)=>{t({exitCode:n,signal:r})}),e.on("error",n=>{u(n)}),e.stdin&&e.stdin.on("error",n=>{u(n)})}),Pn=(e,t=[])=>Array.isArray(t)?[e,...t]:[e],Ns=/^[\w.-]+$/,ks=/"/g,Ls=e=>typeof e!="string"||Ns.test(e)?e:`"${e.replace(ks,'\\"')}"`,js=(e,t)=>Pn(e,t).join(" "),Gs=(e,t)=>Pn(e,t).map(u=>Ls(u)).join(" "),Us=1e3*1e3*100,Hs=({env:e,extendEnv:t,preferLocal:u,localDir:n,execPath:r})=>{const o=t?{..._.env,...e}:e;return u?_o({env:o,cwd:n,execPath:r}):o},qs=(e,t,u={})=>{const n=So._parse(e,t,u);return e=n.command,t=n.args,u=n.options,u={maxBuffer:Us,buffer:!0,stripFinalNewline:!0,extendEnv:!0,preferLocal:!1,localDir:u.cwd||_.cwd(),execPath:_.execPath,encoding:"utf8",reject:!0,cleanup:!0,all:!1,windowsHide:!0,...u},u.env=Hs(u),u.stdio=es(u),_.platform==="win32"&&L.basename(e,".exe")==="cmd"&&t.unshift("/q"),{file:e,args:t,options:u,parsed:n}},ot=(e,t,u)=>typeof t!="string"&&!cu.isBuffer(t)?u===void 0?void 0:"":e.stripFinalNewline?Io(t):t;function z(e,t,u){const n=qs(e,t,u),r=js(e,t),o=Gs(e,t);Cs(n.options);let s;try{s=Ot.spawn(n.file,n.args,n.options)}catch(d){const p=new Ot.ChildProcess,m=Promise.reject(An({error:d,stdout:"",stderr:"",all:"",command:r,escapedCommand:o,parsed:n,timedOut:!1,isCanceled:!1,killed:!1}));return In(p,m)}const a=Rs(s),i=hs(s,n.options,a),f=gs(s,n.options,i),l={isCanceled:!1};s.kill=Ds.bind(null,s.kill.bind(s)),s.cancel=ps.bind(null,s,l);const D=yn(async()=>{const[{error:d,exitCode:p,signal:m,timedOut:h},C,E,$]=await _s(s,n.options,f),k=ot(n.options,C),S=ot(n.options,E),b=ot(n.options,$);if(d||p!==0||m!==null){const P=An({error:d,exitCode:p,signal:m,stdout:k,stderr:S,all:b,command:r,escapedCommand:o,parsed:n,timedOut:h,isCanceled:l.isCanceled||(n.options.signal?n.options.signal.aborted:!1),killed:s.killed});if(!n.options.reject)return P;throw P}return{command:r,escapedCommand:o,exitCode:0,stdout:k,stderr:S,all:b,failed:!1,timedOut:!1,isCanceled:!1,killed:!1}});return Is(s,n.options.input),s.all=Ps(s,n.options),In(s,D)}class st{static create(t,u){return new t(u)}}const Ks={"":"<commit message>",conventional:"<type>(<optional scope>): <description>",gitmoji:":<emoji>: <description>"},zs=e=>`The output response must be in ${e} commit type:
28
- ${Ks[e]}`,Ws={"":"",gitmoji:"",conventional:`Choose a type from the type-to-description JSON below that best describes the git diff:
29
- ${JSON.stringify({docs:"Documentation only changes",style:"Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)",refactor:"A code change that neither fixes a bug nor adds a feature",perf:"A code change that improves performance",test:"Adding missing tests or correcting existing tests",build:"Changes that affect the build system or external dependencies",ci:"Changes to our CI configuration files and scripts",chore:"Other changes that don't modify src or test files",revert:"Reverts a previous commit",feat:"A new feature",fix:"A bug fix"},null,2)}`},_n=(e,t,u)=>["Generate a concise git commit message written in present tense for the following code diff with the given specifications below:",`Message language: ${e}`,`Commit message must be a maximum of ${t} characters.`,"Exclude anything unnecessary such as translation. Your entire response will be passed directly into git commit.",Ws[u],zs(u)].filter(Boolean).join(`
30
- `),Vs=e=>/^(build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test){1}(\([\s\w\.\-\p{Extended_Pictographic}]+\))?(!)?: ([\s\w \p{Extended_Pictographic}])+([\s\S]*)/.test(e),Ys=e=>/^\:\w+\: (.*)$/.test(e),Ce={OPEN_AI:"OPENAI_KEY",HUGGING:"HUGGING_COOKIE",CLOVA_X:"CLOVAX_COOKIE"},Tn=Object.values(Ce).map(e=>e);class it{constructor(t){this.handleError$=u=>{let n="An error occurred";return u.message&&(n=u.message),Se({name:`${this.errorPrefix} ${n}`,value:n,isError:!0})},this.serviceName="AI",this.errorPrefix="ERROR",this.colors={primary:""}}buildPrompt(t,u,n,r,o){return`${_n(t,r,o)}
31
- Please just generate ${n} messages in numbered list format. Here are git diff:
32
- ${u}`}extractCommitMessageFromRawText(t,u){switch(t){case"conventional":const n=new RegExp(/(build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test){1}(\([\s\w\.\-\p{Extended_Pictographic}]+\))?(!)?: ([\s\w \p{Extended_Pictographic}])+([\s\S]*)/),r=u.match(n);return r?r[0].replace(/: (\w)/,(a,i)=>`: ${i.toLowerCase()}`):"";case"gitmoji":const o=new RegExp(/\:\w+\: (.*)$/),s=u.match(o);return s?s[0]:"";default:return u}}}const{hasOwnProperty:at}=Object.prototype,ge=typeof process<"u"&&process.platform==="win32"?`\r
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 En(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 To(e={}){const{cwd:t=_.cwd(),path:n=_.env[En()],execPath:u=_.execPath}=e;let r;const o=t instanceof URL?fu.fileURLToPath(t):t;let s=L.resolve(o);const a=[];for(;r!==s;)a.push(L.join(s,"node_modules/.bin")),r=s,s=L.resolve(s,"..");return a.push(L.resolve(o,u,"..")),[...a,n].join(L.delimiter)}function Mo({env:e=_.env,...t}={}){e={...e};const n=En({env:e});return t.path=e[n],e[n]=To(t),e}const Ro=(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)},ko=(e,t)=>{const n=Object.getPrototypeOf(t);n!==Object.getPrototypeOf(e)&&Object.setPrototypeOf(e,n)},Lo=(e,t)=>`/* Wrapped ${e}*/
25
+ ${t}`,jo=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),Go=Object.getOwnPropertyDescriptor(Function.prototype.toString,"name"),Uo=(e,t,n)=>{const u=n===""?"":`with ${n.trim()}() `,r=Lo.bind(null,u,t.toString());Object.defineProperty(r,"name",Go),Object.defineProperty(e,"toString",{...jo,value:r})};function Ho(e,t,{ignoreNonConfigurable:n=!1}={}){const{name:u}=e;for(const r of Reflect.ownKeys(t))Ro(e,t,r,n);return ko(e,t),Uo(e,t,u),e}const de=new WeakMap,yn=(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(de.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 Ho(o,e),de.set(o,u),o};yn.callCount=e=>{if(!de.has(e))throw new Error(`The given function \`${e.name}\` is not wrapped by the \`onetime\` package`);return de.get(e)};const qo=()=>{const e=bn-wn+1;return Array.from({length:e},Ko)},Ko=(e,t)=>({name:`SIGRT${t+1}`,number:wn+t,action:"terminate",description:"Application-specific signal (realtime)",standard:"posix"}),wn=34,bn=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"}],Bn=()=>{const e=qo();return[...zo,...e].map(Wo)},Wo=({name:e,number:t,description:n,action:u,forced:r=!1,standard:o})=>{const{signals:{[e]:s}}=St,a=s!==void 0;return{name:e,number:a?s:t,description:n,supported:a,action:u,forced:r,standard:o}},Vo=()=>{const e=Bn();return Object.fromEntries(e.map(Yo))},Yo=({name:e,number:t,description:n,supported:u,action:r,forced:o,standard:s})=>[e,{name:e,number:t,description:n,supported:u,action:r,forced:o,standard:s}],Xo=Vo(),Jo=()=>{const e=Bn(),t=bn+1,n=Array.from({length:t},(u,r)=>Zo(r,e));return Object.assign({},...n)},Zo=(e,t)=>{const n=Qo(e,t);if(n===void 0)return{};const{name:u,description:r,supported:o,action:s,forced:a,standard:i}=n;return{[e]:{name:u,number:e,description:r,supported:o,action:s,forced:a,standard:i}}},Qo=(e,t)=>{const n=t.find(({name:u})=>St.signals[u]===e);return n!==void 0?n:t.find(u=>u.number===e)};Jo();const es=({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",An=({stdout:e,stderr:t,all:n,error:u,signal:r,exitCode:o,command:s,escapedCommand:a,timedOut:i,isCanceled:f,killed:l,parsed:{options:{timeout:c}}})=>{o=o===null?void 0:o,r=r===null?void 0:r;const D=r===void 0?void 0:Xo[r].description,d=u&&u.code,m=`Command ${es({timedOut:i,timeout:c,errorCode:d,signal:r,signalDescription:D,exitCode:o,isCanceled:f})}: ${s}`,h=Object.prototype.toString.call(u)==="[object Error]",C=h?`${m}
26
+ ${u.message}`:m,E=[C,t,e].filter(Boolean).join(`
27
+ `);return h?(u.originalMessage=u.message,u.message=E):u=new Error(E),u.shortMessage=C,u.command=s,u.escapedCommand=a,u.exitCode=o,u.signal=r,u.signalDescription=D,u.stdout=e,u.stderr=t,n!==void 0&&(u.all=n),"bufferedData"in u&&delete u.bufferedData,u.failed=!0,u.timedOut=!!i,u.isCanceled=f,u.killed=l&&!i,u},pe=["stdin","stdout","stderr"],ts=e=>pe.some(t=>e[t]!==void 0),ns=e=>{if(!e)return;const{stdio:t}=e;if(t===void 0)return pe.map(u=>e[u]);if(ts(e))throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${pe.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,pe.length);return Array.from({length:n},(u,r)=>t[r])};var q={exports:{}},me={exports:{}};me.exports;var vn;function us(){return vn||(vn=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")}(me)),me.exports}var F=y.process;const M=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(!M(F))q.exports=function(){return function(){}};else{var rs=It,J=us(),os=/^win/i.test(F.platform),he=Pt;typeof he!="function"&&(he=he.EventEmitter);var B;F.__signal_exit_emitter__?B=F.__signal_exit_emitter__:(B=F.__signal_exit_emitter__=new he,B.count=0,B.emitted={}),B.infinite||(B.setMaxListeners(1/0),B.infinite=!0),q.exports=function(e,t){if(!M(y.process))return function(){};rs.equal(typeof e,"function","a callback must be provided for exit handler"),Z===!1&&$n();var n="exit";t&&t.alwaysLast&&(n="afterexit");var u=function(){B.removeListener(n,e),B.listeners("exit").length===0&&B.listeners("afterexit").length===0&&Qe()};return B.on(n,e),u};var Qe=function(){!Z||!M(y.process)||(Z=!1,J.forEach(function(t){try{F.removeListener(t,et[t])}catch{}}),F.emit=tt,F.reallyExit=xn,B.count-=1)};q.exports.unload=Qe;var K=function(t,n,u){B.emitted[t]||(B.emitted[t]=!0,B.emit(t,n,u))},et={};J.forEach(function(e){et[e]=function(){if(M(y.process)){var n=F.listeners(e);n.length===B.count&&(Qe(),K("exit",null,e),K("afterexit",null,e),os&&e==="SIGHUP"&&(e="SIGINT"),F.kill(F.pid,e))}}}),q.exports.signals=function(){return J};var Z=!1,$n=function(){Z||!M(y.process)||(Z=!0,B.count+=1,J=J.filter(function(t){try{return F.on(t,et[t]),!0}catch{return!1}}),F.emit=is,F.reallyExit=ss)};q.exports.load=$n;var xn=F.reallyExit,ss=function(t){M(y.process)&&(F.exitCode=t||0,K("exit",F.exitCode,null),K("afterexit",F.exitCode,null),xn.call(F,F.exitCode))},tt=F.emit,is=function(t,n){if(t==="exit"&&M(y.process)){n!==void 0&&(F.exitCode=n);var u=tt.apply(this,arguments);return K("exit",F.exitCode,null),K("afterexit",F.exitCode,null),u}else return tt.apply(this,arguments)}}var as=q.exports,Ds=G(as);const cs=1e3*5,ls=(e,t="SIGTERM",n={})=>{const u=e(t);return fs(e,t,n,u),u},fs=(e,t,n,u)=>{if(!ds(t,n,u))return;const r=ms(n),o=setTimeout(()=>{e("SIGKILL")},r);o.unref&&o.unref()},ds=(e,{forceKillAfterTimeout:t},n)=>ps(e)&&t!==!1&&n,ps=e=>e===du.constants.signals.SIGTERM||typeof e=="string"&&e.toUpperCase()==="SIGTERM",ms=({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},hs=(e,t)=>{e.kill()&&(t.isCanceled=!0)},Cs=(e,t,n)=>{e.kill(t),n(Object.assign(new Error("Timed out"),{timedOut:!0,signal:t}))},gs=(e,{timeout:t,killSignal:n="SIGTERM"},u)=>{if(t===0||t===void 0)return u;let r;const o=new Promise((a,i)=>{r=setTimeout(()=>{Cs(e,n,i)},t)}),s=u.finally(()=>{clearTimeout(r)});return Promise.race([o,s])},Fs=({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})`)},Es=async(e,{cleanup:t,detached:n},u)=>{if(!t||n)return u;const r=Ds(()=>{e.kill()});return u.finally(()=>{r()})};function ys(e){return e!==null&&typeof e=="object"&&typeof e.pipe=="function"}var Q={exports:{}};const{PassThrough:ws}=$e;var bs=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 ws({objectMode:r});n&&o.setEncoding(n);let s=0;const a=[];return o.on("data",i=>{a.push(i),r?s=a.length:s+=i.length}),o.getBufferedValue=()=>t?a:u?Buffer.concat(a,s):a.join(""),o.getBufferedLength=()=>s,o};const{constants:Bs}=pu,As=$e,{promisify:vs}=_t,$s=bs,xs=vs(As.pipeline);class On extends Error{constructor(){super("maxBuffer exceeded"),this.name="MaxBufferError"}}async function nt(e,t){if(!e)throw new Error("Expected a stream");t={maxBuffer:1/0,...t};const{maxBuffer:n}=t,u=$s(t);return await new Promise((r,o)=>{const s=a=>{a&&u.getBufferedLength()<=Bs.MAX_LENGTH&&(a.bufferedData=u.getBufferedValue()),o(a)};(async()=>{try{await xs(e,u),r()}catch(a){s(a)}})(),u.on("data",()=>{u.getBufferedLength()>n&&s(new On)})}),u.getBufferedValue()}Q.exports=nt,Q.exports.buffer=(e,t)=>nt(e,{...t,encoding:"buffer"}),Q.exports.array=(e,t)=>nt(e,{...t,array:!0}),Q.exports.MaxBufferError=On;var Os=Q.exports,Sn=G(Os);const{PassThrough:Ss}=$e;var Is=function(){var e=[],t=new Ss({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()}},Ps=G(Is);const _s=(e,t)=>{t!==void 0&&(ys(t)?t.pipe(e.stdin):e.stdin.end(t))},Ts=(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}}},rt=(e,{encoding:t,buffer:n,maxBuffer:u})=>{if(!(!e||!n))return t?Sn(e,{encoding:t,maxBuffer:u}):Sn.buffer(e,{maxBuffer:u})},Ms=async({stdout:e,stderr:t,all:n},{encoding:u,buffer:r,maxBuffer:o},s)=>{const a=rt(e,{encoding:u,buffer:r,maxBuffer:o}),i=rt(t,{encoding:u,buffer:r,maxBuffer:o}),f=rt(n,{encoding:u,buffer:r,maxBuffer:o*2});try{return await Promise.all([s,a,i,f])}catch(l){return Promise.all([{error:l,signal:l.signal,timedOut:l.timedOut},ut(e,a),ut(t,i),ut(n,f)])}},Rs=(async()=>{})().constructor.prototype,Ns=["then","catch","finally"].map(e=>[e,Reflect.getOwnPropertyDescriptor(Rs,e)]),In=(e,t)=>{for(const[n,u]of Ns){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},ks=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)})}),Pn=(e,t=[])=>Array.isArray(t)?[e,...t]:[e],Ls=/^[\w.-]+$/,js=/"/g,Gs=e=>typeof e!="string"||Ls.test(e)?e:`"${e.replace(js,'\\"')}"`,Us=(e,t)=>Pn(e,t).join(" "),Hs=(e,t)=>Pn(e,t).map(n=>Gs(n)).join(" "),qs=1e3*1e3*100,Ks=({env:e,extendEnv:t,preferLocal:n,localDir:u,execPath:r})=>{const o=t?{..._.env,...e}:e;return n?Mo({env:o,cwd:u,execPath:r}):o},zs=(e,t,n={})=>{const u=Po._parse(e,t,n);return e=u.command,t=u.args,n=u.options,n={maxBuffer:qs,buffer:!0,stripFinalNewline:!0,extendEnv:!0,preferLocal:!1,localDir:n.cwd||_.cwd(),execPath:_.execPath,encoding:"utf8",reject:!0,cleanup:!0,all:!1,windowsHide:!0,...n},n.env=Ks(n),n.stdio=ns(n),_.platform==="win32"&&L.basename(e,".exe")==="cmd"&&t.unshift("/q"),{file:e,args:t,options:n,parsed:u}},ot=(e,t,n)=>typeof t!="string"&&!cu.isBuffer(t)?n===void 0?void 0:"":e.stripFinalNewline?_o(t):t;function z(e,t,n){const u=zs(e,t,n),r=Us(e,t),o=Hs(e,t);Fs(u.options);let s;try{s=Ot.spawn(u.file,u.args,u.options)}catch(d){const p=new Ot.ChildProcess,m=Promise.reject(An({error:d,stdout:"",stderr:"",all:"",command:r,escapedCommand:o,parsed:u,timedOut:!1,isCanceled:!1,killed:!1}));return In(p,m)}const a=ks(s),i=gs(s,u.options,a),f=Es(s,u.options,i),l={isCanceled:!1};s.kill=ls.bind(null,s.kill.bind(s)),s.cancel=hs.bind(null,s,l);const D=yn(async()=>{const[{error:d,exitCode:p,signal:m,timedOut:h},C,E,$]=await Ms(s,u.options,f),k=ot(u.options,C),S=ot(u.options,E),b=ot(u.options,$);if(d||p!==0||m!==null){const P=An({error:d,exitCode:p,signal:m,stdout:k,stderr:S,all:b,command:r,escapedCommand:o,parsed:u,timedOut:h,isCanceled:l.isCanceled||(u.options.signal?u.options.signal.aborted:!1),killed:s.killed});if(!u.options.reject)return P;throw P}return{command:r,escapedCommand:o,exitCode:0,stdout:k,stderr:S,all:b,failed:!1,timedOut:!1,isCanceled:!1,killed:!1}});return _s(s,u.options.input),s.all=Ts(s,u.options),In(s,D)}class st{static create(t,n){return new t(n)}}const Ws={"":"<commit message>",conventional:"<type>(<optional scope>): <description>",gitmoji:":<emoji>: <description>"},Vs=e=>`The output response must be in ${e} commit type:
28
+ ${Ws[e]}`,Ys={"":"",gitmoji:"",conventional:`Choose a type from the type-to-description JSON below that best describes the git diff:
29
+ ${JSON.stringify({docs:"Documentation only changes",style:"Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)",refactor:"A code change that neither fixes a bug nor adds a feature",perf:"A code change that improves performance",test:"Adding missing tests or correcting existing tests",build:"Changes that affect the build system or external dependencies",ci:"Changes to our CI configuration files and scripts",chore:"Other changes that don't modify src or test files",revert:"Reverts a previous commit",feat:"A new feature",fix:"A bug fix"},null,2)}`},_n=(e,t,n)=>["Generate a concise git commit message written in present tense for the following code diff with the given specifications below:",`Message language: ${e}`,`Commit message must be a maximum of ${t} characters.`,"Exclude anything unnecessary such as translation. Your entire response will be passed directly into git commit.",Ys[n],Vs(n)].filter(Boolean).join(`
30
+ `),Xs=e=>/^(build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test){1}(\([\s\w\.\-\p{Extended_Pictographic}]+\))?(!)?: ([\s\w \p{Extended_Pictographic}])+([\s\S]*)/.test(e),Js=e=>/^\:\w+\: (.*)$/.test(e),Ce={OPEN_AI:"OPENAI_KEY",HUGGING:"HUGGING_COOKIE",CLOVA_X:"CLOVAX_COOKIE"},Tn=Object.values(Ce).map(e=>e);class it{constructor(t){this.handleError$=n=>{let u="An error occurred";return n.message&&(u=n.message),Se({name:`${this.errorPrefix} ${u}`,value:u,isError:!0})},this.serviceName="AI",this.errorPrefix="ERROR",this.colors={primary:""}}buildPrompt(t,n,u,r,o){return`${_n(t,r,o)}
31
+ Please just generate ${u} messages in numbered list format. Here are git diff:
32
+ ${n}`}extractCommitMessageFromRawText(t,n){switch(t){case"conventional":const u=new RegExp(/(build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test)(\(.*\))?: .*$/),r=n.match(u);return r?r[0].replace(/: (\w)/,(a,i)=>`: ${i.toLowerCase()}`):"";case"gitmoji":const o=new RegExp(/\:\w+\: (.*)$/),s=n.match(o);return s?s[0]:"";default:return n}}}const{hasOwnProperty:at}=Object.prototype,ge=typeof process<"u"&&process.platform==="win32"?`\r
33
33
  `:`
34
- `,Dt=(e,t)=>{const u=[];let n="";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 a of s)n+=W(o+"[]")+r+W(a)+ge;else s&&typeof s=="object"?u.push(o):n+=W(o)+r+W(s)+ge}t.section&&n.length&&(n="["+W(t.section)+"]"+ge+n);for(const o of u){const s=Mn(o).join("\\."),a=(t.section?t.section+".":"")+s,{whitespace:i}=t,f=Dt(e[o],{section:a,whitespace:i});n.length&&f.length&&(n+=ge),n+=f}return n},Mn=e=>e.replace(/\1/g,"LITERAL\\1LITERAL").replace(/\\\./g,"").split(/\./).map(t=>t.replace(/\1/g,"\\.").replace(/\2LITERAL\\1LITERAL\2/g,"")),Rn=e=>{const t=Object.create(null);let u=t,n=null;const r=/^\[([^\]]*)\]$|^([^=]+)(=(.*))?$/i,o=e.split(/[\r\n]+/g);for(const a of o){if(!a||a.match(/^\s*[;#]/))continue;const i=a.match(r);if(!i)continue;if(i[1]!==void 0){if(n=Fe(i[1]),n==="__proto__"){u=Object.create(null);continue}u=t[n]=t[n]||Object.create(null);continue}const f=Fe(i[2]),l=f.length>2&&f.slice(-2)==="[]",c=l?f.slice(0,-2):f;if(c==="__proto__")continue;const D=i[3]?Fe(i[4]):!0,d=D==="true"||D==="false"||D==="null"?JSON.parse(D):D;l&&(at.call(u,c)?Array.isArray(u[c])||(u[c]=[u[c]]):u[c]=[]),Array.isArray(u[c])?u[c].push(d):u[c]=d}const s=[];for(const a of Object.keys(t)){if(!at.call(t,a)||typeof t[a]!="object"||Array.isArray(t[a]))continue;const i=Mn(a);u=t;const f=i.pop(),l=f.replace(/\\\./g,".");for(const c of i)c!=="__proto__"&&((!at.call(u,c)||typeof u[c]!="object")&&(u[c]=Object.create(null)),u=u[c]);u===t&&l===f||(u[l]=t[a],s.push(a))}for(const a of s)delete t[a];return t},Nn=e=>e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'"),W=e=>typeof e!="string"||e.match(/[=\r\n]/)||e.match(/^\[/)||e.length>1&&Nn(e)||e!==e.trim()?JSON.stringify(e):e.split(";").join("\\;").split("#").join("\\#"),Fe=(e,t)=>{if(e=(e||"").trim(),Nn(e)){e.charAt(0)==="'"&&(e=e.slice(1,-1));try{e=JSON.parse(e)}catch{}}else{let u=!1,n="";for(let r=0,o=e.length;r<o;r++){const s=e.charAt(r);if(u)"\\;#".indexOf(s)!==-1?n+=s:n+="\\"+s,u=!1;else{if(";#".indexOf(s)!==-1)break;s==="\\"?u=!0:n+=s}}return u&&(n+="\\"),n.trim()}return e};var Xs={parse:Rn,decode:Rn,stringify:Dt,encode:Dt,safe:W,unsafe:Fe},kn=G(Xs),Ln="1.0.0",Js="A Reactive CLI that generates git commit messages with diverse AI";class A extends Error{}const ct=" ",Ee=e=>{e instanceof Error&&(e instanceof A||(e.stack&&console.error(g.dim(e.stack.split(`
34
+ `,Dt=(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 a of s)u+=W(o+"[]")+r+W(a)+ge;else s&&typeof s=="object"?n.push(o):u+=W(o)+r+W(s)+ge}t.section&&u.length&&(u="["+W(t.section)+"]"+ge+u);for(const o of n){const s=Mn(o).join("\\."),a=(t.section?t.section+".":"")+s,{whitespace:i}=t,f=Dt(e[o],{section:a,whitespace:i});u.length&&f.length&&(u+=ge),u+=f}return u},Mn=e=>e.replace(/\1/g,"LITERAL\\1LITERAL").replace(/\\\./g,"").split(/\./).map(t=>t.replace(/\1/g,"\\.").replace(/\2LITERAL\\1LITERAL\2/g,"")),Rn=e=>{const t=Object.create(null);let n=t,u=null;const r=/^\[([^\]]*)\]$|^([^=]+)(=(.*))?$/i,o=e.split(/[\r\n]+/g);for(const a of o){if(!a||a.match(/^\s*[;#]/))continue;const i=a.match(r);if(!i)continue;if(i[1]!==void 0){if(u=Fe(i[1]),u==="__proto__"){n=Object.create(null);continue}n=t[u]=t[u]||Object.create(null);continue}const f=Fe(i[2]),l=f.length>2&&f.slice(-2)==="[]",c=l?f.slice(0,-2):f;if(c==="__proto__")continue;const D=i[3]?Fe(i[4]):!0,d=D==="true"||D==="false"||D==="null"?JSON.parse(D):D;l&&(at.call(n,c)?Array.isArray(n[c])||(n[c]=[n[c]]):n[c]=[]),Array.isArray(n[c])?n[c].push(d):n[c]=d}const s=[];for(const a of Object.keys(t)){if(!at.call(t,a)||typeof t[a]!="object"||Array.isArray(t[a]))continue;const i=Mn(a);n=t;const f=i.pop(),l=f.replace(/\\\./g,".");for(const c of i)c!=="__proto__"&&((!at.call(n,c)||typeof n[c]!="object")&&(n[c]=Object.create(null)),n=n[c]);n===t&&l===f||(n[l]=t[a],s.push(a))}for(const a of s)delete t[a];return t},Nn=e=>e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'"),W=e=>typeof e!="string"||e.match(/[=\r\n]/)||e.match(/^\[/)||e.length>1&&Nn(e)||e!==e.trim()?JSON.stringify(e):e.split(";").join("\\;").split("#").join("\\#"),Fe=(e,t)=>{if(e=(e||"").trim(),Nn(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 Zs={parse:Rn,decode:Rn,stringify:Dt,encode:Dt,safe:W,unsafe:Fe},kn=G(Zs),Ln="1.1.0",Qs="Reactive CLI that generates git commit messages with diverse AI";class A extends Error{}const ct=" ",Ee=e=>{e instanceof Error&&(e instanceof A||(e.stack&&console.error(g.dim(e.stack.split(`
35
35
  `).slice(1).join(`
36
36
  `))),console.error(`
37
37
  ${ct}${g.dim(`aicommit2 v${Ln}`)}`),console.error(`
38
- ${ct}Please open a Bug report with the information above:`),console.error(`${ct}https://github.com/tak-bro/aicommit2/issues/new/choose`)))},jn=e=>x.lstat(e).then(()=>!0,()=>!1),Zs=["","conventional","gitmoji"],{hasOwnProperty:Qs}=Object.prototype,R=(e,t)=>Qs.call(e,t),w=(e,t,u)=>{if(!t)throw new A(`Invalid config property ${e}: ${u}`)},ye={OPENAI_KEY(e){return e?(w("OPENAI_KEY",e.startsWith("sk-"),'Must start with "sk-"'),e):""},OPENAI_MODEL(e){return!e||e.length===0?"gpt-3.5-turbo":e},HUGGING_COOKIE(e){return e||""},HUGGING_MODEL(e){return!e||e.length===0?"mistralai/Mixtral-8x7B-Instruct-v0.1":(w("HUGGING_MODEL",["mistralai/Mixtral-8x7B-Instruct-v0.1","meta-llama/Llama-2-70b-chat-hf","NousResearch/Nous-Hermes-2-Mixtral-8x7B-DPO","codellama/CodeLlama-70b-Instruct-hf","mistralai/Mistral-7B-Instruct-v0.2","openchat/openchat-3.5-0106"].includes(e),"Invalid model type of hugging"),e)},CLOVAX_COOKIE(e){return e||""},GOOGLE_KEY(e){return e||""},CLAUDE_MODEL(e){return!e||e.length===0?"claude-2.1":e},CLAUDE_KEY(e){return e||""},confirm(e){return e?typeof e=="boolean"?e:(w("confirm",/^(?:true|false)$/.test(e),"Must be a boolean"),e==="true"):!1},locale(e){return e?(w("locale",e,"Cannot be empty"),w("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;w("generate",/^\d+$/.test(e),"Must be an integer");const t=Number(e);return w("generate",t>0,"Must be greater than 0"),w("generate",t<=5,"Must be less or equal to 5"),t},type(e){return e?(w("type",Zs.includes(e),"Invalid commit type"),e):"conventional"},proxy(e){if(!(!e||e.length===0))return w("proxy",/^https?:\/\//.test(e),"Must be a valid URL"),e},timeout(e){if(!e)return 1e4;w("timeout",/^\d+$/.test(e),"Must be an integer");const t=Number(e);return w("timeout",t>=500,"Must be greater than 500ms"),t},temperature(e){if(!e)return .7;w("temperature",/^(2|\d)(\.\d{1,2})?$/.test(e),"Must be decimal between 0 and 2");const t=Number(e);return w("temperature",t>0,"Must be greater than 0"),w("temperature",t<=2,"Must be less than or equal to 2"),t},"max-length"(e){if(!e)return 50;w("max-length",/^\d+$/.test(e),"Must be an integer");const t=Number(e);return w("max-length",t>=20,"Must be greater than 20 characters"),t},"max-tokens"(e){return e?(w("max-tokens",/^\d+$/.test(e),"Must be an integer"),Number(e)):200}},lt=j.join(Mt.homedir(),".aicommit2"),Gn=async()=>{if(!await jn(lt))return Object.create(null);const t=await x.readFile(lt,"utf8");return kn.parse(t)},ft=async(e,t)=>{const u=await Gn(),n={};for(const r of Object.keys(ye)){const o=ye[r],s=e?.[r]??u[r];if(t)try{n[r]=o(s)}catch{}else n[r]=o(s)}return n},ei=async e=>{const t=await Gn();for(const[u,n]of e){if(!R(ye,u))throw new A(`Invalid config property: ${u}`);const r=ye[u](n);t[u]=r}await x.writeFile(lt,kn.stringify(t),"utf8")};var dt={},pt={exports:{}},ee={exports:{}},mt,Un;function ti(){if(Un)return mt;Un=1;var e=1e3,t=e*60,u=t*60,n=u*24,r=n*7,o=n*365.25;mt=function(l,c){c=c||{};var D=typeof l;if(D==="string"&&l.length>0)return s(l);if(D==="number"&&isFinite(l))return c.long?i(l):a(l);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(l))};function s(l){if(l=String(l),!(l.length>100)){var c=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(l);if(c){var D=parseFloat(c[1]),d=(c[2]||"ms").toLowerCase();switch(d){case"years":case"year":case"yrs":case"yr":case"y":return D*o;case"weeks":case"week":case"w":return D*r;case"days":case"day":case"d":return D*n;case"hours":case"hour":case"hrs":case"hr":case"h":return D*u;case"minutes":case"minute":case"mins":case"min":case"m":return D*t;case"seconds":case"second":case"secs":case"sec":case"s":return D*e;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return D;default:return}}}}function a(l){var c=Math.abs(l);return c>=n?Math.round(l/n)+"d":c>=u?Math.round(l/u)+"h":c>=t?Math.round(l/t)+"m":c>=e?Math.round(l/e)+"s":l+"ms"}function i(l){var c=Math.abs(l);return c>=n?f(l,c,n,"day"):c>=u?f(l,c,u,"hour"):c>=t?f(l,c,t,"minute"):c>=e?f(l,c,e,"second"):l+" ms"}function f(l,c,D,d){var p=c>=D*1.5;return Math.round(l/D)+" "+d+(p?"s":"")}return mt}var ht,Hn;function qn(){if(Hn)return ht;Hn=1;function e(t){n.debug=n,n.default=n,n.coerce=f,n.disable=s,n.enable=o,n.enabled=a,n.humanize=ti(),n.destroy=l,Object.keys(t).forEach(c=>{n[c]=t[c]}),n.names=[],n.skips=[],n.formatters={};function u(c){let D=0;for(let d=0;d<c.length;d++)D=(D<<5)-D+c.charCodeAt(d),D|=0;return n.colors[Math.abs(D)%n.colors.length]}n.selectColor=u;function n(c){let D,d=null,p,m;function h(...C){if(!h.enabled)return;const E=h,$=Number(new Date),k=$-(D||$);E.diff=k,E.prev=D,E.curr=$,D=$,C[0]=n.coerce(C[0]),typeof C[0]!="string"&&C.unshift("%O");let S=0;C[0]=C[0].replace(/%([a-zA-Z%])/g,(P,iu)=>{if(P==="%%")return"%";S++;const xt=n.formatters[iu];if(typeof xt=="function"){const au=C[S];P=xt.call(E,au),C.splice(S,1),S--}return P}),n.formatArgs.call(E,C),(E.log||n.log).apply(E,C)}return h.namespace=c,h.useColors=n.useColors(),h.color=n.selectColor(c),h.extend=r,h.destroy=n.destroy,Object.defineProperty(h,"enabled",{enumerable:!0,configurable:!1,get:()=>d!==null?d:(p!==n.namespaces&&(p=n.namespaces,m=n.enabled(c)),m),set:C=>{d=C}}),typeof n.init=="function"&&n.init(h),h}function r(c,D){const d=n(this.namespace+(typeof D>"u"?":":D)+c);return d.log=this.log,d}function o(c){n.save(c),n.namespaces=c,n.names=[],n.skips=[];let D;const d=(typeof c=="string"?c:"").split(/[\s,]+/),p=d.length;for(D=0;D<p;D++)d[D]&&(c=d[D].replace(/\*/g,".*?"),c[0]==="-"?n.skips.push(new RegExp("^"+c.slice(1)+"$")):n.names.push(new RegExp("^"+c+"$")))}function s(){const c=[...n.names.map(i),...n.skips.map(i).map(D=>"-"+D)].join(",");return n.enable(""),c}function a(c){if(c[c.length-1]==="*")return!0;let D,d;for(D=0,d=n.skips.length;D<d;D++)if(n.skips[D].test(c))return!1;for(D=0,d=n.names.length;D<d;D++)if(n.names[D].test(c))return!0;return!1}function i(c){return c.toString().substring(2,c.toString().length-2).replace(/\.\*\?$/,"*")}function f(c){return c instanceof Error?c.stack||c.message:c}function l(){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 n.enable(n.load()),n}return ht=e,ht}ee.exports;var Kn;function ni(){return Kn||(Kn=1,function(e,t){t.formatArgs=n,t.save=r,t.load=o,t.useColors=u,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 u(){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 n(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 f="color: "+this.color;i.splice(1,0,f,"color: inherit");let l=0,c=0;i[0].replace(/%[a-zA-Z%]/g,D=>{D!=="%%"&&(l++,D==="%c"&&(c=l))}),i.splice(c,0,f)}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=qn()(t);const{formatters:a}=e.exports;a.j=function(i){try{return JSON.stringify(i)}catch(f){return"[UnexpectedJSONParseError]: "+f.message}}}(ee,ee.exports)),ee.exports}var te={exports:{}},Ct,zn;function ui(){return zn||(zn=1,Ct=(e,t=process.argv)=>{const u=e.startsWith("-")?"":e.length===1?"-":"--",n=t.indexOf(u+e),r=t.indexOf("--");return n!==-1&&(r===-1||n<r)}),Ct}var gt,Wn;function ri(){if(Wn)return gt;Wn=1;const e=Mt,t=Ae,u=ui(),{env:n}=process;let r;u("no-color")||u("no-colors")||u("color=false")||u("color=never")?r=0:(u("color")||u("colors")||u("color=true")||u("color=always"))&&(r=1),"FORCE_COLOR"in n&&(n.FORCE_COLOR==="true"?r=1:n.FORCE_COLOR==="false"?r=0:r=n.FORCE_COLOR.length===0?1:Math.min(parseInt(n.FORCE_COLOR,10),3));function o(i){return i===0?!1:{level:i,hasBasic:!0,has256:i>=2,has16m:i>=3}}function s(i,f){if(r===0)return 0;if(u("color=16m")||u("color=full")||u("color=truecolor"))return 3;if(u("color=256"))return 2;if(i&&!f&&r===void 0)return 0;const l=r||0;if(n.TERM==="dumb")return l;if(process.platform==="win32"){const c=e.release().split(".");return Number(c[0])>=10&&Number(c[2])>=10586?Number(c[2])>=14931?3:2:1}if("CI"in n)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some(c=>c in n)||n.CI_NAME==="codeship"?1:l;if("TEAMCITY_VERSION"in n)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(n.TEAMCITY_VERSION)?1:0;if(n.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in n){const c=parseInt((n.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(n.TERM_PROGRAM){case"iTerm.app":return c>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(n.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(n.TERM)||"COLORTERM"in n?1:l}function a(i){const f=s(i,i&&i.isTTY);return o(f)}return gt={supportsColor:a,stdout:o(s(!0,t.isatty(1))),stderr:o(s(!0,t.isatty(2)))},gt}te.exports;var Vn;function oi(){return Vn||(Vn=1,function(e,t){const u=Ae,n=_t;t.init=l,t.log=a,t.formatArgs=o,t.save=i,t.load=f,t.useColors=r,t.destroy=n.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 D=ri();D&&(D.stderr||D).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(D=>/^debug_/i.test(D)).reduce((D,d)=>{const p=d.substring(6).toLowerCase().replace(/_([a-z])/g,(h,C)=>C.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),D[p]=m,D},{});function r(){return"colors"in t.inspectOpts?!!t.inspectOpts.colors:u.isatty(process.stderr.fd)}function o(D){const{namespace:d,useColors:p}=this;if(p){const m=this.color,h="\x1B[3"+(m<8?m:"8;5;"+m),C=` ${h};1m${d} \x1B[0m`;D[0]=C+D[0].split(`
38
+ ${ct}Please open a Bug report with the information above:`),console.error(`${ct}https://github.com/tak-bro/aicommit2/issues/new/choose`)))},jn=e=>x.lstat(e).then(()=>!0,()=>!1),ei=["","conventional","gitmoji"],{hasOwnProperty:ti}=Object.prototype,R=(e,t)=>ti.call(e,t),w=(e,t,n)=>{if(!t)throw new A(`Invalid config property ${e}: ${n}`)},ye={OPENAI_KEY(e){return e?(w("OPENAI_KEY",e.startsWith("sk-"),'Must start with "sk-"'),e):""},OPENAI_MODEL(e){return!e||e.length===0?"gpt-3.5-turbo":e},HUGGING_COOKIE(e){return e||""},HUGGING_MODEL(e){return!e||e.length===0?"mistralai/Mixtral-8x7B-Instruct-v0.1":(w("HUGGING_MODEL",["mistralai/Mixtral-8x7B-Instruct-v0.1","meta-llama/Llama-2-70b-chat-hf","NousResearch/Nous-Hermes-2-Mixtral-8x7B-DPO","codellama/CodeLlama-70b-Instruct-hf","mistralai/Mistral-7B-Instruct-v0.2","openchat/openchat-3.5-0106"].includes(e),"Invalid model type of hugging"),e)},CLOVAX_COOKIE(e){return e||""},GOOGLE_KEY(e){return e||""},CLAUDE_MODEL(e){return!e||e.length===0?"claude-2.1":e},CLAUDE_KEY(e){return e||""},confirm(e){return e?typeof e=="boolean"?e:(w("confirm",/^(?:true|false)$/.test(e),"Must be a boolean"),e==="true"):!1},locale(e){return e?(w("locale",e,"Cannot be empty"),w("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;w("generate",/^\d+$/.test(e),"Must be an integer");const t=Number(e);return w("generate",t>0,"Must be greater than 0"),w("generate",t<=5,"Must be less or equal to 5"),t},type(e){return e?(w("type",ei.includes(e),"Invalid commit type"),e):"conventional"},proxy(e){if(!(!e||e.length===0))return w("proxy",/^https?:\/\//.test(e),"Must be a valid URL"),e},timeout(e){if(!e)return 1e4;w("timeout",/^\d+$/.test(e),"Must be an integer");const t=Number(e);return w("timeout",t>=500,"Must be greater than 500ms"),t},temperature(e){if(!e)return .7;w("temperature",/^(2|\d)(\.\d{1,2})?$/.test(e),"Must be decimal between 0 and 2");const t=Number(e);return w("temperature",t>0,"Must be greater than 0"),w("temperature",t<=2,"Must be less than or equal to 2"),t},"max-length"(e){if(!e)return 50;w("max-length",/^\d+$/.test(e),"Must be an integer");const t=Number(e);return w("max-length",t>=20,"Must be greater than 20 characters"),t},"max-tokens"(e){return e?(w("max-tokens",/^\d+$/.test(e),"Must be an integer"),Number(e)):200}},lt=j.join(Mt.homedir(),".aicommit2"),Gn=async()=>{if(!await jn(lt))return Object.create(null);const t=await x.readFile(lt,"utf8");return kn.parse(t)},ft=async(e,t)=>{const n=await Gn(),u={};for(const r of Object.keys(ye)){const o=ye[r],s=e?.[r]??n[r];if(t)try{u[r]=o(s)}catch{}else u[r]=o(s)}return u},ni=async e=>{const t=await Gn();for(const[n,u]of e){if(!R(ye,n))throw new A(`Invalid config property: ${n}`);const r=ye[n](u);t[n]=r}await x.writeFile(lt,kn.stringify(t),"utf8")};var dt={},pt={exports:{}},ee={exports:{}},mt,Un;function ui(){if(Un)return mt;Un=1;var e=1e3,t=e*60,n=t*60,u=n*24,r=u*7,o=u*365.25;mt=function(l,c){c=c||{};var D=typeof l;if(D==="string"&&l.length>0)return s(l);if(D==="number"&&isFinite(l))return c.long?i(l):a(l);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(l))};function s(l){if(l=String(l),!(l.length>100)){var c=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(l);if(c){var D=parseFloat(c[1]),d=(c[2]||"ms").toLowerCase();switch(d){case"years":case"year":case"yrs":case"yr":case"y":return D*o;case"weeks":case"week":case"w":return D*r;case"days":case"day":case"d":return D*u;case"hours":case"hour":case"hrs":case"hr":case"h":return D*n;case"minutes":case"minute":case"mins":case"min":case"m":return D*t;case"seconds":case"second":case"secs":case"sec":case"s":return D*e;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return D;default:return}}}}function a(l){var c=Math.abs(l);return c>=u?Math.round(l/u)+"d":c>=n?Math.round(l/n)+"h":c>=t?Math.round(l/t)+"m":c>=e?Math.round(l/e)+"s":l+"ms"}function i(l){var c=Math.abs(l);return c>=u?f(l,c,u,"day"):c>=n?f(l,c,n,"hour"):c>=t?f(l,c,t,"minute"):c>=e?f(l,c,e,"second"):l+" ms"}function f(l,c,D,d){var p=c>=D*1.5;return Math.round(l/D)+" "+d+(p?"s":"")}return mt}var ht,Hn;function qn(){if(Hn)return ht;Hn=1;function e(t){u.debug=u,u.default=u,u.coerce=f,u.disable=s,u.enable=o,u.enabled=a,u.humanize=ui(),u.destroy=l,Object.keys(t).forEach(c=>{u[c]=t[c]}),u.names=[],u.skips=[],u.formatters={};function n(c){let D=0;for(let d=0;d<c.length;d++)D=(D<<5)-D+c.charCodeAt(d),D|=0;return u.colors[Math.abs(D)%u.colors.length]}u.selectColor=n;function u(c){let D,d=null,p,m;function h(...C){if(!h.enabled)return;const E=h,$=Number(new Date),k=$-(D||$);E.diff=k,E.prev=D,E.curr=$,D=$,C[0]=u.coerce(C[0]),typeof C[0]!="string"&&C.unshift("%O");let S=0;C[0]=C[0].replace(/%([a-zA-Z%])/g,(P,iu)=>{if(P==="%%")return"%";S++;const xt=u.formatters[iu];if(typeof xt=="function"){const au=C[S];P=xt.call(E,au),C.splice(S,1),S--}return P}),u.formatArgs.call(E,C),(E.log||u.log).apply(E,C)}return h.namespace=c,h.useColors=u.useColors(),h.color=u.selectColor(c),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(c)),m),set:C=>{d=C}}),typeof u.init=="function"&&u.init(h),h}function r(c,D){const d=u(this.namespace+(typeof D>"u"?":":D)+c);return d.log=this.log,d}function o(c){u.save(c),u.namespaces=c,u.names=[],u.skips=[];let D;const d=(typeof c=="string"?c:"").split(/[\s,]+/),p=d.length;for(D=0;D<p;D++)d[D]&&(c=d[D].replace(/\*/g,".*?"),c[0]==="-"?u.skips.push(new RegExp("^"+c.slice(1)+"$")):u.names.push(new RegExp("^"+c+"$")))}function s(){const c=[...u.names.map(i),...u.skips.map(i).map(D=>"-"+D)].join(",");return u.enable(""),c}function a(c){if(c[c.length-1]==="*")return!0;let D,d;for(D=0,d=u.skips.length;D<d;D++)if(u.skips[D].test(c))return!1;for(D=0,d=u.names.length;D<d;D++)if(u.names[D].test(c))return!0;return!1}function i(c){return c.toString().substring(2,c.toString().length-2).replace(/\.\*\?$/,"*")}function f(c){return c instanceof Error?c.stack||c.message:c}function l(){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 ht=e,ht}ee.exports;var Kn;function ri(){return Kn||(Kn=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 f="color: "+this.color;i.splice(1,0,f,"color: inherit");let l=0,c=0;i[0].replace(/%[a-zA-Z%]/g,D=>{D!=="%%"&&(l++,D==="%c"&&(c=l))}),i.splice(c,0,f)}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=qn()(t);const{formatters:a}=e.exports;a.j=function(i){try{return JSON.stringify(i)}catch(f){return"[UnexpectedJSONParseError]: "+f.message}}}(ee,ee.exports)),ee.exports}var te={exports:{}},Ct,zn;function oi(){return zn||(zn=1,Ct=(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)}),Ct}var gt,Wn;function si(){if(Wn)return gt;Wn=1;const e=Mt,t=Ae,n=oi(),{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,f){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&&!f&&r===void 0)return 0;const l=r||0;if(u.TERM==="dumb")return l;if(process.platform==="win32"){const c=e.release().split(".");return Number(c[0])>=10&&Number(c[2])>=10586?Number(c[2])>=14931?3:2:1}if("CI"in u)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some(c=>c in u)||u.CI_NAME==="codeship"?1:l;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 c=parseInt((u.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(u.TERM_PROGRAM){case"iTerm.app":return c>=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:l}function a(i){const f=s(i,i&&i.isTTY);return o(f)}return gt={supportsColor:a,stdout:o(s(!0,t.isatty(1))),stderr:o(s(!0,t.isatty(2)))},gt}te.exports;var Vn;function ii(){return Vn||(Vn=1,function(e,t){const n=Ae,u=_t;t.init=l,t.log=a,t.formatArgs=o,t.save=i,t.load=f,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 D=si();D&&(D.stderr||D).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(D=>/^debug_/i.test(D)).reduce((D,d)=>{const p=d.substring(6).toLowerCase().replace(/_([a-z])/g,(h,C)=>C.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),D[p]=m,D},{});function r(){return"colors"in t.inspectOpts?!!t.inspectOpts.colors:n.isatty(process.stderr.fd)}function o(D){const{namespace:d,useColors:p}=this;if(p){const m=this.color,h="\x1B[3"+(m<8?m:"8;5;"+m),C=` ${h};1m${d} \x1B[0m`;D[0]=C+D[0].split(`
39
39
  `).join(`
40
- `+C),D.push(h+"m+"+e.exports.humanize(this.diff)+"\x1B[0m")}else D[0]=s()+d+" "+D[0]}function s(){return t.inspectOpts.hideDate?"":new Date().toISOString()+" "}function a(...D){return process.stderr.write(n.format(...D)+`
41
- `)}function i(D){D?process.env.DEBUG=D:delete process.env.DEBUG}function f(){return process.env.DEBUG}function l(D){D.inspectOpts={};const d=Object.keys(t.inspectOpts);for(let p=0;p<d.length;p++)D.inspectOpts[d[p]]=t.inspectOpts[d[p]]}e.exports=qn()(t);const{formatters:c}=e.exports;c.o=function(D){return this.inspectOpts.colors=this.useColors,n.inspect(D,this.inspectOpts).split(`
42
- `).map(d=>d.trim()).join(" ")},c.O=function(D){return this.inspectOpts.colors=this.useColors,n.inspect(D,this.inspectOpts)}}(te,te.exports)),te.exports}typeof process>"u"||process.type==="renderer"||process.browser===!0||process.__nwjs?pt.exports=ni():pt.exports=oi();var Ft=pt.exports,Et={};Object.defineProperty(Et,"__esModule",{value:!0});function si(e){return function(t,u){return new Promise((n,r)=>{e.call(this,t,u,(o,s)=>{o?r(o):n(s)})})}}Et.default=si;var Yn=y&&y.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};const ii=Pt,ai=Yn(Ft),Di=Yn(Et),ne=ai.default("agent-base");function ci(e){return!!e&&typeof e.addRequest=="function"}function yt(){const{stack:e}=new Error;return typeof e!="string"?!1:e.split(`
43
- `).some(t=>t.indexOf("(https.js:")!==-1||t.indexOf("node:https:")!==-1)}function we(e,t){return new we.Agent(e,t)}(function(e){class t extends ii.EventEmitter{constructor(n,r){super();let o=r;typeof n=="function"?this.callback=n:n&&(o=n),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:yt()?443:80}set defaultPort(n){this.explicitDefaultPort=n}get protocol(){return typeof this.explicitProtocol=="string"?this.explicitProtocol:yt()?"https:":"http:"}set protocol(n){this.explicitProtocol=n}callback(n,r,o){throw new Error('"agent-base" has no default implementation, you must subclass and override `callback()`')}addRequest(n,r){const o=Object.assign({},r);typeof o.secureEndpoint!="boolean"&&(o.secureEndpoint=yt()),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,n._last=!0,n.shouldKeepAlive=!1;let s=!1,a=null;const i=o.timeout||this.timeout,f=d=>{n._hadError||(n.emit("error",d),n._hadError=!0)},l=()=>{a=null,s=!0;const d=new Error(`A "socket" was not created for HTTP request before ${i}ms`);d.code="ETIMEOUT",f(d)},c=d=>{s||(a!==null&&(clearTimeout(a),a=null),f(d))},D=d=>{if(s)return;if(a!=null&&(clearTimeout(a),a=null),ci(d)){ne("Callback returned another Agent instance %o",d.constructor.name),d.addRequest(n,o);return}if(d){d.once("free",()=>{this.freeSocket(d,o)}),n.onSocket(d);return}const p=new Error(`no Duplex stream was returned to agent-base for \`${n.method} ${n.path}\``);f(p)};if(typeof this.callback!="function"){f(new Error("`callback` is not defined"));return}this.promisifiedCallback||(this.callback.length>=3?(ne("Converting legacy callback function to promise"),this.promisifiedCallback=Di.default(this.callback)):this.promisifiedCallback=this.callback),typeof i=="number"&&i>0&&(a=setTimeout(l,i)),"port"in o&&typeof o.port!="number"&&(o.port=Number(o.port));try{ne("Resolving socket for %o request: %o",o.protocol,`${n.method} ${n.path}`),Promise.resolve(this.promisifiedCallback(n,o)).then(D,c)}catch(d){Promise.reject(d).catch(c)}}freeSocket(n,r){ne("Freeing socket %o %o",n.constructor.name,r),n.destroy()}destroy(){ne("Destroying agent %o",this.constructor.name)}}e.Agent=t,e.prototype=e.Agent.prototype})(we||(we={}));var li=we,wt={},fi=y&&y.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(wt,"__esModule",{value:!0});const di=fi(Ft),ue=di.default("https-proxy-agent:parse-proxy-response");function pi(e){return new Promise((t,u)=>{let n=0;const r=[];function o(){const c=e.read();c?l(c):e.once("readable",o)}function s(){e.removeListener("end",i),e.removeListener("error",f),e.removeListener("close",a),e.removeListener("readable",o)}function a(c){ue("onclose had error %o",c)}function i(){ue("onend")}function f(c){s(),ue("onerror %o",c),u(c)}function l(c){r.push(c),n+=c.length;const D=Buffer.concat(r,n);if(D.indexOf(`\r
40
+ `+C),D.push(h+"m+"+e.exports.humanize(this.diff)+"\x1B[0m")}else D[0]=s()+d+" "+D[0]}function s(){return t.inspectOpts.hideDate?"":new Date().toISOString()+" "}function a(...D){return process.stderr.write(u.format(...D)+`
41
+ `)}function i(D){D?process.env.DEBUG=D:delete process.env.DEBUG}function f(){return process.env.DEBUG}function l(D){D.inspectOpts={};const d=Object.keys(t.inspectOpts);for(let p=0;p<d.length;p++)D.inspectOpts[d[p]]=t.inspectOpts[d[p]]}e.exports=qn()(t);const{formatters:c}=e.exports;c.o=function(D){return this.inspectOpts.colors=this.useColors,u.inspect(D,this.inspectOpts).split(`
42
+ `).map(d=>d.trim()).join(" ")},c.O=function(D){return this.inspectOpts.colors=this.useColors,u.inspect(D,this.inspectOpts)}}(te,te.exports)),te.exports}typeof process>"u"||process.type==="renderer"||process.browser===!0||process.__nwjs?pt.exports=ri():pt.exports=ii();var Ft=pt.exports,Et={};Object.defineProperty(Et,"__esModule",{value:!0});function ai(e){return function(t,n){return new Promise((u,r)=>{e.call(this,t,n,(o,s)=>{o?r(o):u(s)})})}}Et.default=ai;var Yn=y&&y.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};const Di=Pt,ci=Yn(Ft),li=Yn(Et),ne=ci.default("agent-base");function fi(e){return!!e&&typeof e.addRequest=="function"}function yt(){const{stack:e}=new Error;return typeof e!="string"?!1:e.split(`
43
+ `).some(t=>t.indexOf("(https.js:")!==-1||t.indexOf("node:https:")!==-1)}function we(e,t){return new we.Agent(e,t)}(function(e){class t extends Di.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:yt()?443:80}set defaultPort(u){this.explicitDefaultPort=u}get protocol(){return typeof this.explicitProtocol=="string"?this.explicitProtocol:yt()?"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=yt()),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,a=null;const i=o.timeout||this.timeout,f=d=>{u._hadError||(u.emit("error",d),u._hadError=!0)},l=()=>{a=null,s=!0;const d=new Error(`A "socket" was not created for HTTP request before ${i}ms`);d.code="ETIMEOUT",f(d)},c=d=>{s||(a!==null&&(clearTimeout(a),a=null),f(d))},D=d=>{if(s)return;if(a!=null&&(clearTimeout(a),a=null),fi(d)){ne("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}\``);f(p)};if(typeof this.callback!="function"){f(new Error("`callback` is not defined"));return}this.promisifiedCallback||(this.callback.length>=3?(ne("Converting legacy callback function to promise"),this.promisifiedCallback=li.default(this.callback)):this.promisifiedCallback=this.callback),typeof i=="number"&&i>0&&(a=setTimeout(l,i)),"port"in o&&typeof o.port!="number"&&(o.port=Number(o.port));try{ne("Resolving socket for %o request: %o",o.protocol,`${u.method} ${u.path}`),Promise.resolve(this.promisifiedCallback(u,o)).then(D,c)}catch(d){Promise.reject(d).catch(c)}}freeSocket(u,r){ne("Freeing socket %o %o",u.constructor.name,r),u.destroy()}destroy(){ne("Destroying agent %o",this.constructor.name)}}e.Agent=t,e.prototype=e.Agent.prototype})(we||(we={}));var di=we,wt={},pi=y&&y.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(wt,"__esModule",{value:!0});const mi=pi(Ft),ue=mi.default("https-proxy-agent:parse-proxy-response");function hi(e){return new Promise((t,n)=>{let u=0;const r=[];function o(){const c=e.read();c?l(c):e.once("readable",o)}function s(){e.removeListener("end",i),e.removeListener("error",f),e.removeListener("close",a),e.removeListener("readable",o)}function a(c){ue("onclose had error %o",c)}function i(){ue("onend")}function f(c){s(),ue("onerror %o",c),n(c)}function l(c){r.push(c),u+=c.length;const D=Buffer.concat(r,u);if(D.indexOf(`\r
44
44
  \r
45
45
  `)===-1){ue("have not received end of HTTP headers yet..."),o();return}const p=D.toString("ascii",0,D.indexOf(`\r
46
- `)),m=+p.split(" ")[1];ue("got proxy server response: %o",p),t({statusCode:m,buffered:D})}e.on("error",f),e.on("close",a),e.on("end",i),o()})}wt.default=pi;var mi=y&&y.__awaiter||function(e,t,u,n){function r(o){return o instanceof u?o:new u(function(s){s(o)})}return new(u||(u=Promise))(function(o,s){function a(l){try{f(n.next(l))}catch(c){s(c)}}function i(l){try{f(n.throw(l))}catch(c){s(c)}}function f(l){l.done?o(l.value):r(l.value).then(a,i)}f((n=n.apply(e,t||[])).next())})},V=y&&y.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(dt,"__esModule",{value:!0});const Xn=V(yu),Jn=V(wu),hi=V(bu),Ci=V(It),gi=V(Ft),Fi=li,Ei=V(wt),re=gi.default("https-proxy-agent:agent");class yi extends Fi.Agent{constructor(t){let u;if(typeof t=="string"?u=hi.default.parse(t):u=t,!u)throw new Error("an HTTP(S) proxy server `host` and `port` must be specified!");re("creating new HttpsProxyAgent instance: %o",u),super(u);const n=Object.assign({},u);this.secureProxy=u.secureProxy||Bi(n.protocol),n.host=n.hostname||n.host,typeof n.port=="string"&&(n.port=parseInt(n.port,10)),!n.port&&n.host&&(n.port=this.secureProxy?443:80),this.secureProxy&&!("ALPNProtocols"in n)&&(n.ALPNProtocols=["http 1.1"]),n.host&&n.path&&(delete n.path,delete n.pathname),this.proxy=n}callback(t,u){return mi(this,void 0,void 0,function*(){const{proxy:n,secureProxy:r}=this;let o;r?(re("Creating `tls.Socket`: %o",n),o=Jn.default.connect(n)):(re("Creating `net.Socket`: %o",n),o=Xn.default.connect(n));const s=Object.assign({},n.headers);let i=`CONNECT ${`${u.host}:${u.port}`} HTTP/1.1\r
47
- `;n.auth&&(s["Proxy-Authorization"]=`Basic ${Buffer.from(n.auth).toString("base64")}`);let{host:f,port:l,secureEndpoint:c}=u;bi(l,c)||(f+=`:${l}`),s.Host=f,s.Connection="close";for(const h of Object.keys(s))i+=`${h}: ${s[h]}\r
48
- `;const D=Ei.default(o);o.write(`${i}\r
49
- `);const{statusCode:d,buffered:p}=yield D;if(d===200){if(t.once("socket",wi),u.secureEndpoint){re("Upgrading socket connection to TLS");const h=u.servername||u.host;return Jn.default.connect(Object.assign(Object.assign({},Ai(u,"host","hostname","path","port")),{socket:o,servername:h}))}return o}o.destroy();const m=new Xn.default.Socket({writable:!1});return m.readable=!0,t.once("socket",h=>{re("replaying proxy buffer for failed request"),Ci.default(h.listenerCount("data")>0),h.push(p),h.push(null)}),m})}}dt.default=yi;function wi(e){e.resume()}function bi(e,t){return!!(!t&&e===80||t&&e===443)}function Bi(e){return typeof e=="string"?/^https:?$/i.test(e):!1}function Ai(e,...t){const u={};let n;for(n in e)t.includes(n)||(u[n]=e[n]);return u}var vi=y&&y.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};const bt=vi(dt);function Bt(e){return new bt.default(e)}(function(e){e.HttpsProxyAgent=bt.default,e.prototype=bt.default.prototype})(Bt||(Bt={}));var $i=Bt,xi=G($i);const Oi=async(e,t,u,n,r,o,s)=>new Promise((a,i)=>{const f=JSON.stringify(n),l=Eu.request({port:s||void 0,hostname:e,path:t,method:"POST",headers:{"Content-Type":"application/json","Content-Length":Buffer.byteLength(f),...u},timeout:r,agent:o?xi(o):void 0},c=>{const D=[];c.on("data",d=>D.push(d)),c.on("end",()=>{a({request:l,response:c,data:Buffer.concat(D).toString()})})});l.on("error",i),l.on("timeout",()=>{l.destroy(),i(new A(`Time out error: request took over ${r}ms. Try increasing the \`timeout\` config`))}),l.write(f),l.end()}),Si=async(e,t,u,n)=>{const{response:r,data:o}=await Oi("api.openai.com","/v1/chat/completions",{Authorization:`Bearer ${e}`},t,u,n);if(!r.statusCode||r.statusCode<200||r.statusCode>299){let s=`OpenAI API Error: ${r.statusCode} - ${r.statusMessage}`;throw o&&(s+=`
46
+ `)),m=+p.split(" ")[1];ue("got proxy server response: %o",p),t({statusCode:m,buffered:D})}e.on("error",f),e.on("close",a),e.on("end",i),o()})}wt.default=hi;var Ci=y&&y.__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 a(l){try{f(u.next(l))}catch(c){s(c)}}function i(l){try{f(u.throw(l))}catch(c){s(c)}}function f(l){l.done?o(l.value):r(l.value).then(a,i)}f((u=u.apply(e,t||[])).next())})},V=y&&y.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(dt,"__esModule",{value:!0});const Xn=V(bu),Jn=V(Bu),gi=V(Au),Fi=V(It),Ei=V(Ft),yi=di,wi=V(wt),re=Ei.default("https-proxy-agent:agent");class bi extends yi.Agent{constructor(t){let n;if(typeof t=="string"?n=gi.default.parse(t):n=t,!n)throw new Error("an HTTP(S) proxy server `host` and `port` must be specified!");re("creating new HttpsProxyAgent instance: %o",n),super(n);const u=Object.assign({},n);this.secureProxy=n.secureProxy||vi(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 Ci(this,void 0,void 0,function*(){const{proxy:u,secureProxy:r}=this;let o;r?(re("Creating `tls.Socket`: %o",u),o=Jn.default.connect(u)):(re("Creating `net.Socket`: %o",u),o=Xn.default.connect(u));const s=Object.assign({},u.headers);let i=`CONNECT ${`${n.host}:${n.port}`} HTTP/1.1\r
47
+ `;u.auth&&(s["Proxy-Authorization"]=`Basic ${Buffer.from(u.auth).toString("base64")}`);let{host:f,port:l,secureEndpoint:c}=n;Ai(l,c)||(f+=`:${l}`),s.Host=f,s.Connection="close";for(const h of Object.keys(s))i+=`${h}: ${s[h]}\r
48
+ `;const D=wi.default(o);o.write(`${i}\r
49
+ `);const{statusCode:d,buffered:p}=yield D;if(d===200){if(t.once("socket",Bi),n.secureEndpoint){re("Upgrading socket connection to TLS");const h=n.servername||n.host;return Jn.default.connect(Object.assign(Object.assign({},$i(n,"host","hostname","path","port")),{socket:o,servername:h}))}return o}o.destroy();const m=new Xn.default.Socket({writable:!1});return m.readable=!0,t.once("socket",h=>{re("replaying proxy buffer for failed request"),Fi.default(h.listenerCount("data")>0),h.push(p),h.push(null)}),m})}}dt.default=bi;function Bi(e){e.resume()}function Ai(e,t){return!!(!t&&e===80||t&&e===443)}function vi(e){return typeof e=="string"?/^https:?$/i.test(e):!1}function $i(e,...t){const n={};let u;for(u in e)t.includes(u)||(n[u]=e[u]);return n}var xi=y&&y.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};const bt=xi(dt);function Bt(e){return new bt.default(e)}(function(e){e.HttpsProxyAgent=bt.default,e.prototype=bt.default.prototype})(Bt||(Bt={}));var Oi=Bt,Si=G(Oi);const Ii=async(e,t,n,u,r,o,s)=>new Promise((a,i)=>{const f=JSON.stringify(u),l=wu.request({port:s||void 0,hostname:e,path:t,method:"POST",headers:{"Content-Type":"application/json","Content-Length":Buffer.byteLength(f),...n},timeout:r,agent:o?Si(o):void 0},c=>{const D=[];c.on("data",d=>D.push(d)),c.on("end",()=>{a({request:l,response:c,data:Buffer.concat(D).toString()})})});l.on("error",i),l.on("timeout",()=>{l.destroy(),i(new A(`Time out error: request took over ${r}ms. Try increasing the \`timeout\` config`))}),l.write(f),l.end()}),Pi=async(e,t,n,u)=>{const{response:r,data:o}=await Ii("api.openai.com","/v1/chat/completions",{Authorization:`Bearer ${e}`},t,n,u);if(!r.statusCode||r.statusCode<200||r.statusCode>299){let s=`OpenAI API Error: ${r.statusCode} - ${r.statusMessage}`;throw o&&(s+=`
50
50
 
51
51
  ${o}`),r.statusCode===500&&(s+=`
52
52
 
53
- Check the API status: https://status.openai.com`),new A(s)}return JSON.parse(o)},Ii=e=>e.trim().replace(/[\n\r]/g,"").replace(/(\w)\.$/,"$1"),At=e=>Array.from(new Set(e)),Pi=async(e,t,u,n,r,o,s,a,i,f,l)=>{try{const c=await Si(e,{model:t,messages:[{role:"system",content:_n(u,o,s)},{role:"user",content:n}],temperature:f,top_p:1,frequency_penalty:0,presence_penalty:0,max_tokens:i,stream:!1,n:r},a,l);return At(c.choices.filter(D=>D.message?.content).map(D=>Ii(D.message.content)).map(D=>{if(s==="conventional"){const d=/: (\w)/;return D.replace(d,(p,m)=>`: ${m.toLowerCase()}`)}return D}).filter(D=>{switch(s){case"gitmoji":return Ys(D);case"conventional":return Vs(D);case"":default:return!0}}))}catch(c){const D=c;throw D.code==="ENOTFOUND"?new A(`Error connecting to ${D.hostname} (${D.syscall})`):D}};class N{constructor(t={}){if(!t.method)throw new Error("method should be defined!");if(!t.baseURL)throw new Error("baseURL should be defined!");this.config={...t},this.axiosInstance=vu.create(this.config)}setHeaders(t){return this.config.headers=t,this}setParams(t){return this.config.params=t,this}setBody(t){return this.config.data=t,this}setMethod(t){return this.config.method=t,this}async execute(){try{return await this.axiosInstance.request(this.config)}catch(t){throw t}}}class _i extends it{constructor(t){super(t),this.params=t,this.host="https://clova-x.naver.com",this.cookie="",this.colors={primary:"#00db9b",secondary:"#fff"},this.serviceName=g.bgHex(this.colors.primary).hex(this.colors.secondary).bold("[CLOVA X]"),this.errorPrefix=g.red.bold("[CLOVA X]"),this.cookie=this.params.config.CLOVAX_COOKIE}generateCommitMessage$(){return _e(this.generateMessage()).pipe(Ie(t=>oe(t)),se(t=>({name:`${this.serviceName} ${t}`,value:t,isError:!1})),Pe(this.handleError$))}async generateMessage(){try{const{locale:t,generate:u,type:n}=this.params.config,r=this.params.config["max-length"],o=this.params.stagedDiff.diff,s=this.buildPrompt(t,o,u,r,n);await this.getAllConversationIds();const a=await this.sendMessage(s),{conversationId:i,allText:f}=this.parseSendMessageResult(a);return await this.deleteConversation(i),At(this.sanitizeMessage(f))}catch(t){const u=t;throw u.code==="ENOTFOUND"?new A(`Error connecting to ${u.hostname} (${u.syscall})`):u}}async getAllConversationIds(){const u=(await new N({method:"GET",baseURL:`${this.host}/api/v1/conversations`,timeout:this.params.config.timeout}).setHeaders({Cookie:this.cookie}).setParams({page:0,size:50,sort:"turnUpdatedTime,DESC"}).execute()).data;if(!u||!u.content)throw new Error("No content on conversations ClovaX");return u.content.length===0?[]:u.content.map(r=>r.conversationId||"").filter(r=>!!r)}async sendMessage(t){const u={text:t,action:"new"},n=new FormData;return n.append("form",new Blob([JSON.stringify(u)],{type:"application/json"})),(await new N({method:"POST",baseURL:`${this.host}/api/v1/generate`,timeout:this.params.config.timeout}).setHeaders({"Content-Type":"multipart/form-data","Content-Length":this.getContentLength(n),Cookie:this.cookie}).setBody(n).execute()).data}parseSendMessageResult(t){const u=/data:{(.*)}/g,n=t.match(u);if(!n)throw new Error("Failed to extract object from generated text");const r=n.map(i=>i.trim().replace(/data:/g,""));if(!r||r.length===0)throw new Error("Cannot extract message");let o="",s="",a="";if(r.map(i=>{try{return JSON.parse(i)}catch{return null}}).filter(i=>!!i).forEach(i=>{if(R(i,"conversationId")){o=i.conversationId;return}if(R(i,"text")){s+=i.text;return}if(R(i,"error")){a=`${i.error}: ${i.type||i.message||""}`;return}}),a)throw new Error(a);if(!o)throw new Error("No conversationId!");if(!s)throw new Error("No allText!");return{conversationId:o,allText:s}}sanitizeMessage(t){return t.split(`
54
- `).map(u=>u.trim().replace(/^\d+\.\s/,"")).map(u=>this.extractCommitMessageFromRawText(this.params.config.type,u)).filter(u=>!!u)}async deleteConversation(t){return(await new N({method:"DELETE",baseURL:`${this.host}/api/v1/conversation/${t}`,timeout:this.params.config.timeout}).setHeaders({Cookie:this.cookie}).execute()).data}getContentLength(t){return Array.from(t.entries(),([u,n])=>({[u]:{ContentLength:typeof n=="string"?n.length:n.size}}))}}class Ti extends it{constructor(t){super(t),this.params=t,this.host="https://huggingface.co",this.cookie="",this.colors={primary:"#FED21F",secondary:"#000"},this.serviceName=g.bgHex(this.colors.primary).hex(this.colors.secondary).bold("[HuggingFace]"),this.errorPrefix=g.red.bold("[HuggingFace]"),this.cookie=this.params.config.HUGGING_COOKIE}generateCommitMessage$(){return _e(this.generateMessage()).pipe(Ie(t=>oe(t)),se(t=>({name:`${this.serviceName} ${t}`,value:t,isError:!1})),Pe(this.handleError$))}async generateMessage(){try{const{locale:t,generate:u,type:n}=this.params.config,r=this.params.config["max-length"],o=this.params.stagedDiff.diff,s=this.buildPrompt(t,o,u,r,n),{conversationId:a}=await this.getNewConversationId();await this.prepareConversation(a);const i=await this.sendMessage(a,s);return await this.deleteConversation(a),At(this.sanitizeMessage(i))}catch(t){const u=t;throw u.code==="ENOTFOUND"?new A(`Error connecting to ${u.hostname} (${u.syscall})`):u}}sanitizeMessage(t){const u=/{[^{}]*}/g,n=t.match(u);if(!n)throw new Error("Failed to extract object from generated text");let r=null;if(n.forEach((o,s)=>{try{const a=JSON.parse(o);R(a,"type")&&a.type==="finalAnswer"&&(r=a)}catch{}}),!r||!R(r,"text"))throw new Error("Cannot parse finalAnswer");return r.text.split(`
55
- `).map(o=>o.trim().replace(/^\d+\.\s/,"")).map(o=>this.extractCommitMessageFromRawText(this.params.config.type,o)).filter(o=>!!o)}async prepareConversation(t,u="11"){return(await new N({method:"GET",baseURL:`${this.host}/chat/conversation/${t}/__data.json`,timeout:this.params.config.timeout}).setHeaders({"Content-Type":"application/json",Cookie:this.cookie}).setParams({"x-sveltekit-invalidated":`${u}`}).execute()).data}async getNewConversationId(){const t=await new N({method:"POST",baseURL:`${this.host}/chat/conversation`,timeout:this.params.config.timeout}).setHeaders({"content-type":"application/json",Cookie:this.cookie}).setBody({model:this.params.config.HUGGING_MODEL}).execute();if(!t.data||!t.data.conversationId)throw new Error("No conversationId on Hugging service");return t.data}async deleteConversation(t){return(await new N({method:"DELETE",baseURL:`${this.host}/chat/conversation/${t}`,timeout:this.params.config.timeout}).setHeaders({Cookie:this.cookie}).execute()).data}async sendMessage(t,u){return(await new N({method:"POST",baseURL:`${this.host}/chat/conversation/${t}`,timeout:this.params.config.timeout}).setHeaders({"content-type":"application/json",Cookie:this.cookie}).setBody({inputs:u,parameters:{temperature:this.params.config.temperature,truncate:1e3,max_new_tokens:this.params.config["max-tokens"],stop:["</s>"],top_p:.95,repetition_penalty:1.2,top_k:50,return_full_text:!1},stream:!0,options:{id:Rt(),response_id:Rt(),is_retry:!1,use_cache:!1,web_search_id:""}}).execute()).data}}class Mi extends it{constructor(t){super(t),this.params=t,this.handleError$=u=>{const n=g.red.bold("[ChatGPT]");let r="An error occurred";if(u.message){r=u.message.split(`
56
- `)[0];const o=this.extractJSONFromError(u.message);r+=`: ${o.error.message}`}return Se({name:`${n} ${r}`,value:r,isError:!0})},this.colors={primary:"#74AA9C",secondary:"#FFF"},this.serviceName=g.bgHex(this.colors.primary).hex(this.colors.secondary).bold("[ChatGPT]")}generateCommitMessage$(){return _e(Pi(this.params.config.OPENAI_KEY,this.params.config.OPENAI_MODEL,this.params.config.locale,this.params.stagedDiff.diff,this.params.config.generate,this.params.config["max-length"],this.params.config.type,this.params.config.timeout,this.params.config["max-tokens"],this.params.config.temperature,this.params.config.proxy)).pipe(Ie(t=>oe(t)),se(t=>({name:`${this.serviceName} ${t}`,value:t,isError:!1})),Pe(this.handleError$))}extractJSONFromError(t){const u=/[{[]{1}([,:{}[\]0-9.\-+Eaeflnr-u \n\r\t]|".*?")+[}\]]{1}/gis,n=t.match(u);return n?Object.assign({},...n.map(r=>JSON.parse(r))):{error:{message:"Unknown error"}}}}class Zn{constructor(t,u){this.config=t,this.stagedDiff=u}createAIRequests$(t){return oe(t).pipe(mu(u=>{const n={config:this.config,stagedDiff:this.stagedDiff};switch(u){case Ce.OPEN_AI:return st.create(Mi,n).generateCommitMessage$();case Ce.HUGGING:return st.create(Ti,n).generateCommitMessage$();case Ce.CLOVA_X:return st.create(_i,n).generateCommitMessage$();default:const r=g.red.bold(`[${u}]`);return Se({name:r+" Invalid AI type",value:"Invalid AI type",isError:!0})}}))}}const Qn=async()=>{const{stdout:e,failed:t}=await z("git",["rev-parse","--show-toplevel"],{reject:!1});if(t)throw new A("The current directory must be a Git repository!");return e},vt=e=>`:(exclude)${e}`,eu=["package-lock.json","pnpm-lock.yaml","*.lock"].map(vt),tu=async e=>{const t=["diff","--cached","--diff-algorithm=minimal"],{stdout:u}=await z("git",[...t,"--name-only",...eu,...e?e.map(vt):[]]);if(!u)return null;const{stdout:n}=await z("git",[...t,...eu,...e?e.map(vt):[]]);return{files:u.split(`
57
- `),diff:n}},Ri=e=>`Detected ${e.length.toLocaleString()} staged file${e.length>1?"s":""}`;class be{constructor(){this.title="aicommit2"}printTitle(){console.log($u.textSync(this.title,{font:"Small"}))}displaySpinner(t){return Oe(t).start()}stopSpinner(t){t.stop(),t.clear()}printStagedFiles(t){console.log(g.bold.green("\u2714 ")+g.bold(`${Ri(t.files)}:`)),console.log(`${t.files.map(u=>` ${u}`).join(`
53
+ Check the API status: https://status.openai.com`),new A(s)}return JSON.parse(o)},_i=e=>e.trim().replace(/[\n\r]/g,"").replace(/(\w)\.$/,"$1"),At=e=>Array.from(new Set(e)),Ti=async(e,t,n,u,r,o,s,a,i,f,l)=>{try{const c=await Pi(e,{model:t,messages:[{role:"system",content:_n(n,o,s)},{role:"user",content:u}],temperature:f,top_p:1,frequency_penalty:0,presence_penalty:0,max_tokens:i,stream:!1,n:r},a,l);return At(c.choices.filter(D=>D.message?.content).map(D=>_i(D.message.content)).map(D=>{if(s==="conventional"){const d=/: (\w)/;return D.replace(d,(p,m)=>`: ${m.toLowerCase()}`)}return D}).filter(D=>{switch(s){case"gitmoji":return Js(D);case"conventional":return Xs(D);case"":default:return!0}}))}catch(c){const D=c;throw D.code==="ENOTFOUND"?new A(`Error connecting to ${D.hostname} (${D.syscall})`):D}};class N{constructor(t={}){if(!t.method)throw new Error("method should be defined!");if(!t.baseURL)throw new Error("baseURL should be defined!");this.config={...t},this.axiosInstance=xu.create(this.config)}setHeaders(t){return this.config.headers=t,this}setParams(t){return this.config.params=t,this}setBody(t){return this.config.data=t,this}setMethod(t){return this.config.method=t,this}async execute(){try{return await this.axiosInstance.request(this.config)}catch(t){throw t}}}class Mi extends it{constructor(t){super(t),this.params=t,this.host="https://clova-x.naver.com",this.cookie="",this.colors={primary:"#00db9b",secondary:"#fff"},this.serviceName=g.bgHex(this.colors.primary).hex(this.colors.secondary).bold("[CLOVA X]"),this.errorPrefix=g.red.bold("[CLOVA X]"),this.cookie=this.params.config.CLOVAX_COOKIE}generateCommitMessage$(){return _e(this.generateMessage()).pipe(Ie(t=>oe(t)),se(t=>({name:`${this.serviceName} ${t}`,value:t,isError:!1})),Pe(this.handleError$))}async generateMessage(){try{const{locale:t,generate:n,type:u}=this.params.config,r=this.params.config["max-length"],o=this.params.stagedDiff.diff,s=this.buildPrompt(t,o,n,r,u);await this.getAllConversationIds();const a=await this.sendMessage(s),{conversationId:i,allText:f}=this.parseSendMessageResult(a);return await this.deleteConversation(i),At(this.sanitizeMessage(f))}catch(t){const n=t;throw n.code==="ENOTFOUND"?new A(`Error connecting to ${n.hostname} (${n.syscall})`):n}}async getAllConversationIds(){const n=(await new N({method:"GET",baseURL:`${this.host}/api/v1/conversations`,timeout:this.params.config.timeout}).setHeaders({Cookie:this.cookie}).setParams({page:0,size:50,sort:"turnUpdatedTime,DESC"}).execute()).data;if(!n||!n.content)throw new Error("No content on conversations ClovaX");return n.content.length===0?[]:n.content.map(r=>r.conversationId||"").filter(r=>!!r)}async sendMessage(t){const n={text:t,action:"new"},u=new Eu;return u.set("form",new yu([JSON.stringify(n)],{type:"application/json"})),(await new N({method:"POST",baseURL:`${this.host}/api/v1/generate`,timeout:this.params.config.timeout}).setHeaders({"Content-Type":"multipart/form-data","Content-Length":this.getContentLength(u),Cookie:this.cookie}).setBody(u).execute()).data}parseSendMessageResult(t){const n=/data:{(.*)}/g,u=t.match(n);if(!u)throw new Error("Failed to extract object from generated text");const r=u.map(i=>i.trim().replace(/data:/g,""));if(!r||r.length===0)throw new Error("Cannot extract message");let o="",s="",a="";if(r.map(i=>{try{return JSON.parse(i)}catch{return null}}).filter(i=>!!i).forEach(i=>{if(R(i,"conversationId")){o=i.conversationId;return}if(R(i,"text")){s+=i.text;return}if(R(i,"error")){a=`${i.error}: ${i.type||i.message||""}`;return}}),a)throw new Error(a);if(!o)throw new Error("No conversationId!");if(!s)throw new Error("No allText!");return{conversationId:o,allText:s}}sanitizeMessage(t){return t.split(`
54
+ `).map(n=>n.trim().replace(/^\d+\.\s/,"")).map(n=>n.replace(/`/g,"")).map(n=>this.extractCommitMessageFromRawText(this.params.config.type,n)).filter(n=>!!n)}async deleteConversation(t){return(await new N({method:"DELETE",baseURL:`${this.host}/api/v1/conversation/${t}`,timeout:this.params.config.timeout}).setHeaders({Cookie:this.cookie}).execute()).data}getContentLength(t){return Array.from(t.entries(),([n,u])=>({[n]:{ContentLength:typeof u=="string"?u.length:u.size}}))}}class Ri extends it{constructor(t){super(t),this.params=t,this.host="https://huggingface.co",this.cookie="",this.colors={primary:"#FED21F",secondary:"#000"},this.serviceName=g.bgHex(this.colors.primary).hex(this.colors.secondary).bold("[HuggingFace]"),this.errorPrefix=g.red.bold("[HuggingFace]"),this.cookie=this.params.config.HUGGING_COOKIE}generateCommitMessage$(){return _e(this.generateMessage()).pipe(Ie(t=>oe(t)),se(t=>({name:`${this.serviceName} ${t}`,value:t,isError:!1})),Pe(this.handleError$))}async generateMessage(){try{const{locale:t,generate:n,type:u}=this.params.config,r=this.params.config["max-length"],o=this.params.stagedDiff.diff,s=this.buildPrompt(t,o,n,r,u),{conversationId:a}=await this.getNewConversationId();await this.prepareConversation(a);const i=await this.sendMessage(a,s);return await this.deleteConversation(a),At(this.sanitizeMessage(i))}catch(t){const n=t;throw n.code==="ENOTFOUND"?new A(`Error connecting to ${n.hostname} (${n.syscall})`):n}}sanitizeMessage(t){const n=/{[^{}]*}/g,u=t.match(n);if(!u)throw new Error("Failed to extract object from generated text");let r=null;if(u.forEach((o,s)=>{try{const a=JSON.parse(o);R(a,"type")&&a.type==="finalAnswer"&&(r=a)}catch{}}),!r||!R(r,"text"))throw new Error("Cannot parse finalAnswer");return r.text.split(`
55
+ `).map(o=>o.trim().replace(/^\d+\.\s/,"")).map(o=>o.replace(/`/g,"")).map(o=>this.extractCommitMessageFromRawText(this.params.config.type,o)).filter(o=>!!o)}async prepareConversation(t,n="11"){return(await new N({method:"GET",baseURL:`${this.host}/chat/conversation/${t}/__data.json`,timeout:this.params.config.timeout}).setHeaders({"Content-Type":"application/json",Cookie:this.cookie}).setParams({"x-sveltekit-invalidated":`${n}`}).execute()).data}async getNewConversationId(){const t=await new N({method:"POST",baseURL:`${this.host}/chat/conversation`,timeout:this.params.config.timeout}).setHeaders({"content-type":"application/json",Cookie:this.cookie}).setBody({model:this.params.config.HUGGING_MODEL}).execute();if(!t.data||!t.data.conversationId)throw new Error("No conversationId on Hugging service");return t.data}async deleteConversation(t){return(await new N({method:"DELETE",baseURL:`${this.host}/chat/conversation/${t}`,timeout:this.params.config.timeout}).setHeaders({Cookie:this.cookie}).execute()).data}async sendMessage(t,n){return(await new N({method:"POST",baseURL:`${this.host}/chat/conversation/${t}`,timeout:this.params.config.timeout}).setHeaders({"content-type":"application/json",Cookie:this.cookie}).setBody({inputs:n,parameters:{temperature:this.params.config.temperature,truncate:1e3,max_new_tokens:this.params.config["max-tokens"],stop:["</s>"],top_p:.95,repetition_penalty:1.2,top_k:50,return_full_text:!1},stream:!0,options:{id:Rt(),response_id:Rt(),is_retry:!1,use_cache:!1,web_search_id:""}}).execute()).data}}class Ni extends it{constructor(t){super(t),this.params=t,this.handleError$=n=>{const u=g.red.bold("[ChatGPT]");let r="An error occurred";if(n.message){r=n.message.split(`
56
+ `)[0];const o=this.extractJSONFromError(n.message);r+=`: ${o.error.message}`}return Se({name:`${u} ${r}`,value:r,isError:!0})},this.colors={primary:"#74AA9C",secondary:"#FFF"},this.serviceName=g.bgHex(this.colors.primary).hex(this.colors.secondary).bold("[ChatGPT]")}generateCommitMessage$(){return _e(Ti(this.params.config.OPENAI_KEY,this.params.config.OPENAI_MODEL,this.params.config.locale,this.params.stagedDiff.diff,this.params.config.generate,this.params.config["max-length"],this.params.config.type,this.params.config.timeout,this.params.config["max-tokens"],this.params.config.temperature,this.params.config.proxy)).pipe(Ie(t=>oe(t)),se(t=>({name:`${this.serviceName} ${t}`,value:t,isError:!1})),Pe(this.handleError$))}extractJSONFromError(t){const n=/[{[]{1}([,:{}[\]0-9.\-+Eaeflnr-u \n\r\t]|".*?")+[}\]]{1}/gis,u=t.match(n);return u?Object.assign({},...u.map(r=>JSON.parse(r))):{error:{message:"Unknown error"}}}}class Zn{constructor(t,n){this.config=t,this.stagedDiff=n}createAIRequests$(t){return oe(t).pipe(mu(n=>{const u={config:this.config,stagedDiff:this.stagedDiff};switch(n){case Ce.OPEN_AI:return st.create(Ni,u).generateCommitMessage$();case Ce.HUGGING:return st.create(Ri,u).generateCommitMessage$();case Ce.CLOVA_X:return st.create(Mi,u).generateCommitMessage$();default:const r=g.red.bold(`[${n}]`);return Se({name:r+" Invalid AI type",value:"Invalid AI type",isError:!0})}}))}}const Qn=async()=>{const{stdout:e,failed:t}=await z("git",["rev-parse","--show-toplevel"],{reject:!1});if(t)throw new A("The current directory must be a Git repository!");return e},vt=e=>`:(exclude)${e}`,eu=["package-lock.json","pnpm-lock.yaml","*.lock"].map(vt),tu=async e=>{const t=["diff","--cached","--diff-algorithm=minimal"],{stdout:n}=await z("git",[...t,"--name-only",...eu,...e?e.map(vt):[]]);if(!n)return null;const{stdout:u}=await z("git",[...t,...eu,...e?e.map(vt):[]]);return{files:n.split(`
57
+ `),diff:u}},ki=e=>`Detected ${e.length.toLocaleString()} staged file${e.length>1?"s":""}`;class be{constructor(){this.title="aicommit2"}printTitle(){console.log(Ou.textSync(this.title,{font:"Small"}))}displaySpinner(t){return Oe(t).start()}stopSpinner(t){t.stop(),t.clear()}printStagedFiles(t){console.log(g.bold.green("\u2714 ")+g.bold(`${ki(t.files)}:`)),console.log(`${t.files.map(n=>` ${n}`).join(`
58
58
  `)}
59
59
  `)}printAnalyzed(){console.log(`
60
60
  ${g.bold.green("\u2714")} ${g.bold("Changes analyzed")}`)}printCommitted(){console.log(`
61
61
  ${g.bold.green("\u2714")} ${g.bold("Successfully committed!")}`)}printCopied(){console.log(`
62
- ${g.bold.green("\u2714")} ${g.bold("Message successfully copied! Press 'Ctrl + V' to paste")}`)}printSavedCommitMessage(){console.log(`
62
+ ${g.bold.green("\u2714")} ${g.bold("Successfully copied! Press 'Ctrl + V' to paste")}`)}printSavedCommitMessage(){console.log(`
63
63
  ${g.bold.green("\u2714")} ${g.bold("Saved commit message")}`)}printCancelledCommit(){console.log(`
64
64
  ${g.bold.yellow("\u26A0")} ${g.yellow("Commit cancelled")}`)}printErrorMessage(t){console.log(`
65
- ${g.bold.red("\u2716")} ${g.red(`${t}`)}`)}moveCursorUp(){const t=ie.createInterface({input:process.stdin,output:process.stdout});ie.moveCursor(process.stdout,0,-1),t.close()}moveCursorDown(){const t=ie.createInterface({input:process.stdin,output:process.stdout});ie.moveCursor(process.stdout,0,1),t.close()}}const Ni={isLoading:!1,startOption:{text:"AI is analyzing your changes"}};class ki{constructor(){this.choices$=new Tt([]),this.loader$=new Tt(Ni),this.destroyed$=new hu(1)}initPrompt(){return xe.registerPrompt("reactiveListPrompt",xu),xe.prompt({type:"reactiveListPrompt",name:"aicommit2Prompt",message:"Pick a commit message to use: ",emptyMessage:"\u26A0 No commit messages were generated",choices$:this.choices$,loader$:this.loader$})}startLoader(){this.loader$.next({isLoading:!0})}refreshChoices(t){const{name:u,value:n,isError:r}=t;if(!t||!n)return;const o=this.choices$.getValue();this.choices$.next([...o,{name:u,value:n,disabled:r,isError:r}])}checkErrorOnChoices(){if(this.choices$.getValue().map(u=>u).every(u=>u?.isError||u?.disabled)){this.alertNoGeneratedMessage();return}this.stopLoaderOnSuccess()}completeSubject(){this.choices$.complete(),this.loader$.complete(),this.destroyed$.next(!0),this.destroyed$.complete()}alertNoGeneratedMessage(){this.loader$.next({isLoading:!1,message:"No commit messages were generated",stopOption:{doneFrame:"\u26A0",color:"yellow"}})}stopLoaderOnSuccess(){this.loader$.next({isLoading:!1,message:"Changes analyzed"})}}const I=new be;var Li=async(e,t,u,n,r,o,s,a)=>(async()=>{I.printTitle(),await Qn(),n&&await z("git",["add","--update"]);const i=I.displaySpinner("Detecting staged files"),f=await tu(u);if(i.stop(),!f)throw new A("No staged changes found. Stage your changes manually, or automatically stage all changes with the `--all` flag.");I.printStagedFiles(f);const{env:l}=process,c=await ft({OPENAI_KEY:l.OPENAI_KEY||l.OPENAI_API_KEY,OPENAI_MODEL:l.OPENAI_MODEL||l["openai-model"]||l.openai_model,HUGGING_COOKIE:l.HUGGING_COOKIE||l.HUGGING_API_KEY||l.HF_TOKEN,HUGGING_MODEL:l.HUGGING_MODEL||l["hugging-model"],CLOVAX_COOKIE:l.CLOVAX_COOKIE||l.CLOVA_X_COOKIE,proxy:l.https_proxy||l.HTTPS_PROXY||l.http_proxy||l.HTTP_PROXY,temperature:l.temperature,generate:t?.toString()||l.generate,type:r?.toString()||l.type,locale:e?.toString()||l.locale}),D=Object.entries(c).filter(([b])=>Tn.includes(b)).filter(([b,P])=>!!P).map(([b])=>b);if(D.length===0)throw new A("Please set at least one API key via `aicommit2 config set OPENAI_KEY=<your token>`");const p=new Zn(c,f),m=new ki,h=m.initPrompt();m.startLoader();const C=p.createAIRequests$(D).subscribe(b=>m.refreshChoices(b),()=>{},()=>m.checkErrorOnChoices()),E=await h;C.unsubscribe(),m.completeSubject(),I.moveCursorUp();const $=E.aicommit2Prompt?.value;if(!$)throw new A("An error occurred! No selected message");if(s&&(Vr("copy-paste").copy($),I.printCopied(),process.exit()),o){const b=Oe("Committing with the generated message").start();await z("git",["commit","-m",$,...a]),b.stop(),b.clear(),I.printCommitted(),process.exit()}const k=await xe.prompt([{type:"confirm",name:"confirmationPrompt",message:"Use selected message?",default:!0}]),{confirmationPrompt:S}=k;if(S){const b=Oe("Committing with the generated message").start();await z("git",["commit","-m",$,...a]),b.stop(),b.clear(),I.printCommitted(),process.exit()}I.printCancelledCommit(),process.exit()})().catch(i=>{I.printErrorMessage(i.message),Ee(i),process.exit(1)}),ji=un({name:"config",parameters:["<mode>","<key=value...>"]},e=>{(async()=>{const{mode:t,keyValue:u}=e._;if(t==="get"){const n=await ft({},!0);for(const r of u)R(n,r)&&console.log(`${r}=${n[r]}`);return}if(t==="set"){await ei(u.map(n=>n.split("=")));return}throw new A(`Invalid mode: ${t}`)})().catch(t=>{new be().printErrorMessage(t.message),Ee(t),process.exit(1)})});const nu="prepare-commit-msg",uu=`.git/hooks/${nu}`,Be=Bu(new URL("cli.mjs",import.meta.url)),Gi=process.argv[1].replace(/\\/g,"/").endsWith(`/${uu}`),ru=process.platform==="win32",ou=`
65
+ ${g.bold.red("\u2716")} ${g.red(`${t}`)}`)}moveCursorUp(){const t=ie.createInterface({input:process.stdin,output:process.stdout});ie.moveCursor(process.stdout,0,-1),t.close()}moveCursorDown(){const t=ie.createInterface({input:process.stdin,output:process.stdout});ie.moveCursor(process.stdout,0,1),t.close()}}const Li={isLoading:!1,startOption:{text:"AI is analyzing your changes"}};class ji{constructor(){this.choices$=new Tt([]),this.loader$=new Tt(Li),this.destroyed$=new hu(1)}initPrompt(){return xe.registerPrompt("reactiveListPrompt",Su),xe.prompt({type:"reactiveListPrompt",name:"aicommit2Prompt",message:"Pick a commit message to use: ",emptyMessage:"\u26A0 No commit messages were generated",choices$:this.choices$,loader$:this.loader$})}startLoader(){this.loader$.next({isLoading:!0})}refreshChoices(t){const{name:n,value:u,isError:r}=t;if(!t||!u)return;const o=this.choices$.getValue();this.choices$.next([...o,{name:n,value:u,disabled:r,isError:r}])}checkErrorOnChoices(){if(this.choices$.getValue().map(n=>n).every(n=>n?.isError||n?.disabled)){this.alertNoGeneratedMessage();return}this.stopLoaderOnSuccess()}completeSubject(){this.choices$.complete(),this.loader$.complete(),this.destroyed$.next(!0),this.destroyed$.complete()}alertNoGeneratedMessage(){this.loader$.next({isLoading:!1,message:"No commit messages were generated",stopOption:{doneFrame:"\u26A0",color:"yellow"}})}stopLoaderOnSuccess(){this.loader$.next({isLoading:!1,message:"Changes analyzed"})}}const I=new be;var Gi=async(e,t,n,u,r,o,s,a)=>(async()=>{I.printTitle(),await Qn(),u&&await z("git",["add","--update"]);const i=I.displaySpinner("Detecting staged files"),f=await tu(n);if(i.stop(),!f)throw new A("No staged changes found. Stage your changes manually, or automatically stage all changes with the `--all` flag.");I.printStagedFiles(f);const{env:l}=process,c=await ft({OPENAI_KEY:l.OPENAI_KEY||l.OPENAI_API_KEY,OPENAI_MODEL:l.OPENAI_MODEL||l["openai-model"]||l.openai_model,HUGGING_COOKIE:l.HUGGING_COOKIE||l.HUGGING_API_KEY||l.HF_TOKEN,HUGGING_MODEL:l.HUGGING_MODEL||l["hugging-model"],CLOVAX_COOKIE:l.CLOVAX_COOKIE||l.CLOVA_X_COOKIE,proxy:l.https_proxy||l.HTTPS_PROXY||l.http_proxy||l.HTTP_PROXY,temperature:l.temperature,generate:t?.toString()||l.generate,type:r?.toString()||l.type,locale:e?.toString()||l.locale}),D=Object.entries(c).filter(([b])=>Tn.includes(b)).filter(([b,P])=>!!P).map(([b])=>b);if(D.length===0)throw new A("Please set at least one API key via `aicommit2 config set OPENAI_KEY=<your token>`");const p=new Zn(c,f),m=new ji,h=m.initPrompt();m.startLoader();const C=p.createAIRequests$(D).subscribe(b=>m.refreshChoices(b),()=>{},()=>m.checkErrorOnChoices()),E=await h;C.unsubscribe(),m.completeSubject(),I.moveCursorUp();const $=E.aicommit2Prompt?.value;if(!$)throw new A("An error occurred! No selected message");if(s&&(Xr("copy-paste").copy($),I.printCopied(),process.exit()),o){const b=Oe("Committing with the generated message").start();await z("git",["commit","-m",$,...a]),b.stop(),b.clear(),I.printCommitted(),process.exit()}const k=await xe.prompt([{type:"confirm",name:"confirmationPrompt",message:"Use selected message?",default:!0}]),{confirmationPrompt:S}=k;if(S){const b=Oe("Committing with the generated message").start();await z("git",["commit","-m",$,...a]),b.stop(),b.clear(),I.printCommitted(),process.exit()}I.printCancelledCommit(),process.exit()})().catch(i=>{I.printErrorMessage(i.message),Ee(i),process.exit(1)}),Ui=un({name:"config",parameters:["<mode>","<key=value...>"]},e=>{(async()=>{const{mode:t,keyValue:n}=e._;if(t==="get"){const u=await ft({},!0);for(const r of n)R(u,r)&&console.log(`${r}=${u[r]}`);return}if(t==="set"){await ni(n.map(u=>u.split("=")));return}throw new A(`Invalid mode: ${t}`)})().catch(t=>{new be().printErrorMessage(t.message),Ee(t),process.exit(1)})});const nu="prepare-commit-msg",uu=`.git/hooks/${nu}`,Be=vu(new URL("cli.mjs",import.meta.url)),Hi=process.argv[1].replace(/\\/g,"/").endsWith(`/${uu}`),ru=process.platform==="win32",ou=`
66
66
  #!/usr/bin/env node
67
- import(${JSON.stringify(Au(Be))})
68
- `.trim();var Ui=un({name:"hook",parameters:["<install/uninstall>"]},e=>{(async()=>{const t=await Qn(),{installUninstall:u}=e._,n=j.join(t,uu),r=await jn(n);if(u==="install"){if(r){if(await x.realpath(n).catch(()=>{})===Be){console.warn("The hook is already installed");return}throw new A(`A different ${nu} hook seems to be installed. Please remove it before installing aicommit2.`)}await x.mkdir(j.dirname(n),{recursive:!0}),ru?await x.writeFile(n,ou):(await x.symlink(Be,n,"file"),await x.chmod(n,493)),console.log(`${g.green("\u2714")} Hook installed`);return}if(u==="uninstall"){if(!r){console.warn("Hook is not installed");return}if(ru){if(await x.readFile(n,"utf8")!==ou){console.warn("Hook is not installed");return}}else if(await x.realpath(n)!==Be){console.warn("Hook is not installed");return}await x.rm(n),console.log(`${g.green("\u2714")} Hook uninstalled`);return}throw new A(`Invalid mode: ${u}`)})().catch(t=>{console.error(`${g.red("\u2716")} ${t.message}`),Ee(t),process.exit(1)})});const[$t,Hi]=process.argv.slice(2);var qi=()=>(async()=>{if(!$t)throw new A('Commit message file path is missing. This file should be called from the "prepare-commit-msg" git hook');if(Hi)return;const e=await tu();if(!e)return;const t=new be;t.printTitle();const{env:u}=process,n=await ft({proxy:u.https_proxy||u.HTTPS_PROXY||u.http_proxy||u.HTTP_PROXY}),r=Object.entries(n).filter(([d])=>Tn.includes(d)).filter(([d,p])=>!!p).map(([d])=>d);if(r.length===0)throw new A("Please set at least one API key via `aicommit2 config set OPENAI_KEY=<your token>`");const s=new Zn(n,e),a=t.displaySpinner("The AI is analyzing your changes");let i;try{i=await Cu(s.createAIRequests$(r).pipe(gu(d=>!d.isError),se(d=>d.value),Fu()))}finally{a.stop(),a.clear(),t.printAnalyzed()}const l=await x.readFile($t,"utf8")!=="",c=i.length>1;let D="";l&&(D=`# \u{1F916} AI generated commit${c?"s":""}
67
+ import(${JSON.stringify($u(Be))})
68
+ `.trim();var qi=un({name:"hook",parameters:["<install/uninstall>"]},e=>{(async()=>{const t=await Qn(),{installUninstall:n}=e._,u=j.join(t,uu),r=await jn(u);if(n==="install"){if(r){if(await x.realpath(u).catch(()=>{})===Be){console.warn("The hook is already installed");return}throw new A(`A different ${nu} hook seems to be installed. Please remove it before installing aicommit2.`)}await x.mkdir(j.dirname(u),{recursive:!0}),ru?await x.writeFile(u,ou):(await x.symlink(Be,u,"file"),await x.chmod(u,493)),console.log(`${g.green("\u2714")} Hook installed`);return}if(n==="uninstall"){if(!r){console.warn("Hook is not installed");return}if(ru){if(await x.readFile(u,"utf8")!==ou){console.warn("Hook is not installed");return}}else if(await x.realpath(u)!==Be){console.warn("Hook is not installed");return}await x.rm(u),console.log(`${g.green("\u2714")} Hook uninstalled`);return}throw new A(`Invalid mode: ${n}`)})().catch(t=>{console.error(`${g.red("\u2716")} ${t.message}`),Ee(t),process.exit(1)})});const[$t,Ki]=process.argv.slice(2);var zi=()=>(async()=>{if(!$t)throw new A('Commit message file path is missing. This file should be called from the "prepare-commit-msg" git hook');if(Ki)return;const e=await tu();if(!e)return;const t=new be;t.printTitle();const{env:n}=process,u=await ft({proxy:n.https_proxy||n.HTTPS_PROXY||n.http_proxy||n.HTTP_PROXY}),r=Object.entries(u).filter(([d])=>Tn.includes(d)).filter(([d,p])=>!!p).map(([d])=>d);if(r.length===0)throw new A("Please set at least one API key via `aicommit2 config set OPENAI_KEY=<your token>`");const s=new Zn(u,e),a=t.displaySpinner("The AI is analyzing your changes");let i;try{i=await Cu(s.createAIRequests$(r).pipe(gu(d=>!d.isError),se(d=>d.value),Fu()))}finally{a.stop(),a.clear(),t.printAnalyzed()}const l=await x.readFile($t,"utf8")!=="",c=i.length>1;let D="";l&&(D=`# \u{1F916} AI generated commit${c?"s":""}
69
69
  `),c?(l&&(D+=`# Select one of the following messages by uncommenting:
70
70
  `),D+=`
71
71
  ${i.map(d=>`# ${d}`).join(`
72
72
  `)}`):(l&&(D+=`# Edit the message below and commit:
73
73
  `),D+=`
74
74
  ${i[0]}
75
- `),await x.appendFile($t,D),t.printSavedCommitMessage()})().catch(e=>{new be().printErrorMessage(e.message),Ee(e),process.exit(1)});const su=process.argv.slice(2);Wr({name:"aicommit2",version:Ln,flags:{locale:{type:String,description:"Locale to use for the generated commit messages (default: en)",alias:"l"},generate:{type:Number,description:"Number of messages to generate (Warning: generating multiple costs more) (default: 1)",alias:"g"},exclude:{type:[String],description:"Files to exclude from AI analysis",alias:"x"},all:{type:Boolean,description:"Automatically stage changes in tracked files for the commit",alias:"a",default:!1},type:{type:String,description:"Type of commit message to generate",alias:"t",default:"conventional"},confirm:{type:Boolean,description:"Skip confirmation when committing after message generation (default: false)",alias:"y",default:!1},clipboard:{type:Boolean,description:"Copy the selected message to the clipboard",alias:"c",default:!1}},commands:[ji,Ui],help:{description:Js},ignoreArgv:e=>e==="unknown-flag"||e==="argument"},e=>{if(Gi){qi();return}Li(e.flags.locale,e.flags.generate,e.flags.exclude,e.flags.all,e.flags.type,e.flags.confirm,e.flags.clipboard,su)},su);
75
+ `),await x.appendFile($t,D),t.printSavedCommitMessage()})().catch(e=>{new be().printErrorMessage(e.message),Ee(e),process.exit(1)});const su=process.argv.slice(2);Yr({name:"aicommit2",version:Ln,flags:{locale:{type:String,description:"Locale to use for the generated commit messages (default: en)",alias:"l"},generate:{type:Number,description:"Number of messages to generate (Warning: generating multiple costs more) (default: 1)",alias:"g"},exclude:{type:[String],description:"Files to exclude from AI analysis",alias:"x"},all:{type:Boolean,description:"Automatically stage changes in tracked files for the commit",alias:"a",default:!1},type:{type:String,description:"Type of commit message to generate",alias:"t",default:"conventional"},confirm:{type:Boolean,description:"Skip confirmation when committing after message generation (default: false)",alias:"y",default:!1},clipboard:{type:Boolean,description:"Copy the selected message to the clipboard",alias:"c",default:!1}},commands:[Ui,qi],help:{description:Qs},ignoreArgv:e=>e==="unknown-flag"||e==="argument"},e=>{if(Hi){zi();return}Gi(e.flags.locale,e.flags.generate,e.flags.exclude,e.flags.all,e.flags.type,e.flags.confirm,e.flags.clipboard,su)},su);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "aicommit2",
3
- "version": "1.0.0",
4
- "description": "A Reactive CLI that generates git commit messages with diverse AI",
3
+ "version": "1.1.0",
4
+ "description": "Reactive CLI that generates git commit messages with diverse AI",
5
5
  "keywords": [
6
6
  "ai",
7
7
  "git",
@@ -33,11 +33,13 @@
33
33
  "chalk": "^5.3.0",
34
34
  "copy-paste": "^1.5.3",
35
35
  "figlet": "^1.7.0",
36
+ "formdata-node": "^6.0.3",
36
37
  "inquirer": "^9.0.3",
37
38
  "inquirer-reactive-list-prompt": "^1.0.5",
38
39
  "ora": "^8.0.1",
39
40
  "readline": "^1.3.0",
40
41
  "rxjs": "^7.8.1",
41
- "uuid": "^9.0.1"
42
+ "uuid": "^9.0.1",
43
+ "web-streams-polyfill": "^3.3.2"
42
44
  }
43
45
  }