aicommit2 1.9.4 → 1.9.5

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 +52 -5
  2. package/dist/cli.mjs +51 -51
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -21,7 +21,7 @@
21
21
 
22
22
  ## Introduction
23
23
 
24
- AICommit2 streamlines interactions with various AI, enabling users to request multiple AI simultaneously and select the most suitable commit message without waiting for all AI responses. The core functionalities and architecture of this project are inspired by [AICommits](https://github.com/Nutlope/aicommits).
24
+ _aicommit2_ streamlines interactions with various AI, enabling users to request multiple AI simultaneously and select the most suitable commit message without waiting for all AI responses. The core functionalities and architecture of this project are inspired by [AICommits](https://github.com/Nutlope/aicommits).
25
25
 
26
26
  ## Supported Providers
27
27
 
@@ -128,6 +128,8 @@ git add <files...>
128
128
  aicommit2
129
129
  ```
130
130
 
131
+ > 👉 **Tip:** Ollama can run LLMs **in parallel** from v0.1.33. Please see [this section](#loading-multiple-ollama-models).
132
+
131
133
  ## How it works
132
134
 
133
135
  This CLI tool runs `git diff` to grab all your latest code changes, sends them to configured AI, then returns the AI generated commit message.
@@ -199,8 +201,8 @@ aicommit2 --confirm # or -y
199
201
 
200
202
  ##### `--clipboard` or `-c`
201
203
  - Copy the selected message to the clipboard (default: **false**)
202
- - This is a useful option when you don't want to commit through AICommit2.
203
- - If you give this option, AICommit2 will not commit.
204
+ - This is a useful option when you don't want to commit through _aicommit2_.
205
+ - If you give this option, _aicommit2_ will not commit.
204
206
 
205
207
  ```sh
206
208
  aicommit2 --clipboard # or -c
@@ -215,7 +217,7 @@ aicommit2 --prompt <s> # or -p <s>
215
217
 
216
218
  ### Git hook
217
219
 
218
- You can also integrate _AICommit2_ with Git via the [`prepare-commit-msg`](https://git-scm.com/docs/githooks#_prepare_commit_msg) hook. This lets you use Git like you normally would, and edit the commit message before committing.
220
+ You can also integrate _aicommit2_ with Git via the [`prepare-commit-msg`](https://git-scm.com/docs/githooks#_prepare_commit_msg) hook. This lets you use Git like you normally would, and edit the commit message before committing.
219
221
 
220
222
  #### Install
221
223
 
@@ -244,7 +246,7 @@ git commit # Only generates a message when it's not passed in
244
246
 
245
247
  > If you ever want to write your own message instead of generating one, you can simply pass one in: `git commit -m "My message"`
246
248
 
247
- 2. AICommit2 will generate the commit message for you and pass it back to Git. Git will open it with the [configured editor](https://docs.github.com/en/get-started/getting-started-with-git/associating-text-editors-with-git) for you to review/edit it.
249
+ 2. _aicommit2_ will generate the commit message for you and pass it back to Git. Git will open it with the [configured editor](https://docs.github.com/en/get-started/getting-started-with-git/associating-text-editors-with-git) for you to review/edit it.
248
250
 
249
251
  3. Save and close the editor to commit!
250
252
 
@@ -451,6 +453,11 @@ aicommit2 log removeAll
451
453
 
452
454
  The Ollama Model. Please see [a list of models available](https://ollama.com/library)
453
455
 
456
+ ```sh
457
+ aicommit2 config set OLLAMA_MODEL=llama3
458
+ aicommit2 config set OLLAMA_MODEL="llama3,codellama" # for multiple models
459
+ ```
460
+
454
461
  ##### OLLAMA_HOST
455
462
 
456
463
  Default: `http://localhost:11434`
@@ -629,6 +636,46 @@ If it's not the [latest version](https://github.com/tak-bro/aicommit2/releases/l
629
636
  npm update -g aicommit2
630
637
  ```
631
638
 
639
+ ## Loading Multiple Ollama Models
640
+
641
+ <img src="https://github.com/tak-bro/aicommit2/blob/main/img/ollama_parallel.gif?raw=true" alt="OLLAMA_PARALLEL" />
642
+
643
+ You can load and make simultaneous requests to multiple models using Ollama's experimental feature, the `OLLAMA_MAX_LOADED_MODELS` option.
644
+ - `OLLAMA_MAX_LOADED_MODELS`: Load multiple models simultaneously
645
+
646
+ #### Setup Guide
647
+
648
+ Follow these steps to set up and utilize multiple models simultaneously:
649
+
650
+ ##### 1. Running Ollama Server
651
+
652
+ First, launch the Ollama server with the `OLLAMA_MAX_LOADED_MODELS` environment variable set. This variable specifies the maximum number of models to be loaded simultaneously.
653
+ For example, to load up to 3 models, use the following command:
654
+
655
+ ```shell
656
+ OLLAMA_MAX_LOADED_MODELS=3 ollama serve
657
+ ```
658
+ > Refer to [configuration](https://github.com/ollama/ollama/blob/main/docs/faq.md#how-do-i-configure-ollama-server) for detailed instructions.
659
+
660
+ ##### 2. Configuring _aicommit2_
661
+
662
+ Next, set up _aicommit2_ to specify multiple models. You can assign a list of models, separated by **commas(`,`)**, to the OLLAMA_MODEL environment variable. Here's how you do it:
663
+
664
+ ```shell
665
+ aicommit2 config set OLLAMA_MODEL="mistral,dolphin-llama3"
666
+ ```
667
+
668
+ With this command, _aicommit2_ is instructed to utilize both the "mistral" and "dolphin-llama3" models when making requests to the Ollama server.
669
+
670
+ ##### 3. Run _aicommit2_
671
+
672
+ ```shell
673
+ aicommit2
674
+ ```
675
+
676
+ > Note that this feature is available starting from Ollama version [**0.1.33**](https://github.com/ollama/ollama/releases/tag/v0.1.33) and _aicommit2_ version [**1.9.5**](https://www.npmjs.com/package/aicommit2/v/1.9.5).
677
+
678
+
632
679
  ## How to get Cookie(**Unofficial API**)
633
680
 
634
681
  * Login to the site you want
package/dist/cli.mjs CHANGED
@@ -1,46 +1,46 @@
1
1
  #!/usr/bin/env node
2
- import Re from"tty";import{createRequire as vn}from"module";import{Buffer as $n}from"node:buffer";import ee from"node:path";import Rt from"node:child_process";import K from"node:process";import Bn from"child_process";import q from"path";import V from"fs";import xn from"node:url";import On,{constants as kt}from"node:os";import jt from"assert";import Gt from"events";import Sn from"buffer";import ke from"stream";import Ht from"util";import je from"inquirer";import Ge from"ora";import g from"chalk";import{of as j,from as P,filter as Ut,map as I,tap as Kt,concatMap as T,catchError as L,scan as qt,switchMap as In,mergeMap as Mn,BehaviorSubject as zt,ReplaySubject as Pn,lastValueFrom as _n,toArray as Nn}from"rxjs";import Tn from"@anthropic-ai/sdk";import{fromPromise as G}from"rxjs/internal/observable/innerFrom";import He from"os";import{xxh64 as Ln}from"@pacote/xxhash";import Rn from"http";import kn from"https";import"@dqbd/tiktoken";import jn from"net";import Gn from"tls";import Hn,{fileURLToPath as Un,pathToFileURL as Kn}from"url";import{FormData as qn,Blob as zn}from"formdata-node";import x from"fs/promises";import Yn from"axios";import{CohereClient as Wn,CohereTimeoutError as Vn}from"cohere-ai";import{GoogleGenerativeAI as Xn}from"@google/generative-ai";import{Ollama as Jn}from"ollama";import we from"readline";import Zn from"figlet";import Qn from"inquirer-reactive-list-prompt";import{rm as eo}from"node:fs/promises";const to="known-flag",ro="unknown-flag",no="argument",{stringify:De}=JSON,oo=/\B([A-Z])/g,so=e=>e.replace(oo,"-$1").toLowerCase(),{hasOwnProperty:uo}=Object.prototype,le=(e,t)=>uo.call(e,t),io=e=>Array.isArray(e),Yt=e=>typeof e=="function"?[e,!1]:io(e)?[e[0],!0]:Yt(e.type),ao=(e,t)=>e===Boolean?t!=="false":t,co=(e,t)=>typeof t=="boolean"?t:e===Number&&t===""?Number.NaN:e(t),Do=/[\s.:=]/,lo=e=>{const t=`Flag name ${De(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 r=e.match(Do);if(r)throw new Error(`${t} cannot contain ${De(r?.[0])}`)},fo=e=>{const t={},r=(n,s)=>{if(le(t,n))throw new Error(`Duplicate flags named ${De(n)}`);t[n]=s};for(const n in e){if(!le(e,n))continue;lo(n);const s=e[n],o=[[],...Yt(s),s];r(n,o);const u=so(n);if(n!==u&&r(u,o),"alias"in s&&typeof s.alias=="string"){const{alias:a}=s,i=`Flag alias ${De(a)} for flag ${De(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`);r(a,o)}}return t},po=(e,t)=>{const r={};for(const n in e){if(!le(e,n))continue;const[s,,o,u]=t[n];if(s.length===0&&"default"in u){let{default:a}=u;typeof a=="function"&&(a=a()),r[n]=a}else r[n]=o?s:s.pop()}return r},Ae="--",mo=/[.:=]/,ho=/^-{1,2}\w/,go=e=>{if(!ho.test(e))return;const t=!e.startsWith(Ae);let r=e.slice(t?1:2),n;const s=r.match(mo);if(s){const{index:o}=s;n=r.slice(o+1),r=r.slice(0,o)}return[r,n,t]},Co=(e,{onFlag:t,onArgument:r})=>{let n;const s=(o,u)=>{if(typeof n!="function")return!0;n(o,u),n=void 0};for(let o=0;o<e.length;o+=1){const u=e[o];if(u===Ae){s();const i=e.slice(o+1);r?.(i,[o],!0);break}const a=go(u);if(a){if(s(),!t)continue;const[i,l,f]=a;if(f)for(let c=0;c<i.length;c+=1){s();const D=c===i.length-1;n=t(i[c],D?l:void 0,[o,c+1,D])}else n=t(i,l,[o])}else s(u,[o])&&r?.([u],[o])}s()},Eo=(e,t)=>{for(const[r,n,s]of t.reverse()){if(n){const o=e[r];let u=o.slice(0,n);if(s||(u+=o.slice(n+1)),u!=="-"){e[r]=u;continue}}e.splice(r,1)}},Fo=(e,t=process.argv.slice(2),{ignore:r}={})=>{const n=[],s=fo(e),o={},u=[];return u[Ae]=[],Co(t,{onFlag(a,i,l){const f=le(s,a);if(!r?.(f?to:ro,a,i)){if(f){const[c,D]=s[a],p=ao(D,i),d=(h,m)=>{n.push(l),m&&n.push(m),c.push(co(D,h||""))};return p===void 0?d:d(p)}le(o,a)||(o[a]=[]),o[a].push(i===void 0?!0:i),n.push(l)}},onArgument(a,i,l){r?.(no,t[i[0]])||(u.push(...a),l?(u[Ae]=a,t.splice(i[0])):n.push(i))}}),Eo(t,n),{flags:po(e,s),unknownFlags:o,_:u}};var yo=Object.create,ve=Object.defineProperty,bo=Object.defineProperties,wo=Object.getOwnPropertyDescriptor,Ao=Object.getOwnPropertyDescriptors,vo=Object.getOwnPropertyNames,Wt=Object.getOwnPropertySymbols,$o=Object.getPrototypeOf,Vt=Object.prototype.hasOwnProperty,Bo=Object.prototype.propertyIsEnumerable,Xt=(e,t,r)=>t in e?ve(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,$e=(e,t)=>{for(var r in t||(t={}))Vt.call(t,r)&&Xt(e,r,t[r]);if(Wt)for(var r of Wt(t))Bo.call(t,r)&&Xt(e,r,t[r]);return e},Ue=(e,t)=>bo(e,Ao(t)),xo=e=>ve(e,"__esModule",{value:!0}),Oo=(e,t)=>()=>(e&&(t=e(e=0)),t),So=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Io=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of vo(t))!Vt.call(e,s)&&(r||s!=="default")&&ve(e,s,{get:()=>t[s],enumerable:!(n=wo(t,s))||n.enumerable});return e},Mo=(e,t)=>Io(xo(ve(e!=null?yo($o(e)):{},"default",!t&&e&&e.__esModule?{get:()=>e.default,enumerable:!0}:{value:e,enumerable:!0})),e),B=Oo(()=>{}),Po=So((e,t)=>{B(),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}});B(),B(),B();var _o=e=>{var t,r,n;let s=(t=process.stdout.columns)!=null?t:Number.POSITIVE_INFINITY;return typeof e=="function"&&(e=e(s)),e||(e={}),Array.isArray(e)?{columns:e,stdoutColumns:s}:{columns:(r=e.columns)!=null?r:[],stdoutColumns:(n=e.stdoutColumns)!=null?n:s}};B(),B(),B(),B(),B();function No({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 Jt(e){if(typeof e!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof e}\``);return e.replace(No(),"")}B();function To(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 Lo=Mo(Po(),1);function X(e){if(typeof e!="string"||e.length===0||(e=Jt(e),e.length===0))return 0;e=e.replace((0,Lo.default)()," ");let t=0;for(let r=0;r<e.length;r++){let n=e.codePointAt(r);n<=31||n>=127&&n<=159||n>=768&&n<=879||(n>65535&&r++,t+=To(n)?2:1)}return t}var Zt=e=>Math.max(...e.split(`
3
- `).map(X)),Ro=e=>{let t=[];for(let r of e){let{length:n}=r,s=n-t.length;for(let o=0;o<s;o+=1)t.push(0);for(let o=0;o<n;o+=1){let u=Zt(r[o]);u>t[o]&&(t[o]=u)}}return t};B();var Qt=/^\d+%$/,er={width:"auto",align:"left",contentWidth:0,paddingLeft:0,paddingRight:0,paddingTop:0,paddingBottom:0,horizontalPadding:0,paddingLeftString:"",paddingRightString:""},ko=(e,t)=>{var r;let n=[];for(let s=0;s<e.length;s+=1){let o=(r=t[s])!=null?r:"auto";if(typeof o=="number"||o==="auto"||o==="content-width"||typeof o=="string"&&Qt.test(o)){n.push(Ue($e({},er),{width:o,contentWidth:e[s]}));continue}if(o&&typeof o=="object"){let u=Ue($e($e({},er),o),{contentWidth:e[s]});u.horizontalPadding=u.paddingLeft+u.paddingRight,n.push(u);continue}throw new Error(`Invalid column width: ${JSON.stringify(o)}`)}return n};function jo(e,t){for(let r of e){let{width:n}=r;if(n==="content-width"&&(r.width=r.contentWidth),n==="auto"){let i=Math.min(20,r.contentWidth);r.width=i,r.autoOverflow=r.contentWidth-i}if(typeof n=="string"&&Qt.test(n)){let i=Number.parseFloat(n.slice(0,-1))/100;r.width=Math.floor(t*i)-(r.paddingLeft+r.paddingRight)}let{horizontalPadding:s}=r,o=1,u=o+s;if(u>=t){let i=u-t,l=Math.ceil(r.paddingLeft/s*i),f=i-l;r.paddingLeft-=l,r.paddingRight-=f,r.horizontalPadding=r.paddingLeft+r.paddingRight}r.paddingLeftString=r.paddingLeft?" ".repeat(r.paddingLeft):"",r.paddingRightString=r.paddingRight?" ".repeat(r.paddingRight):"";let a=t-r.horizontalPadding;r.width=Math.max(Math.min(r.width,a),o)}}var tr=()=>Object.assign([],{columns:0});function Go(e,t){let r=[tr()],[n]=r;for(let s of e){let o=s.width+s.horizontalPadding;n.columns+o>t&&(n=tr(),r.push(n)),n.push(s),n.columns+=o}for(let s of r){let o=s.reduce((D,p)=>D+p.width+p.horizontalPadding,0),u=t-o;if(u===0)continue;let a=s.filter(D=>"autoOverflow"in D),i=a.filter(D=>D.autoOverflow>0),l=i.reduce((D,p)=>D+p.autoOverflow,0),f=Math.min(l,u);for(let D of i){let p=Math.floor(D.autoOverflow/l*f);D.width+=p,u-=p}let c=Math.floor(u/a.length);for(let D=0;D<a.length;D+=1){let p=a[D];D===a.length-1?p.width+=u:p.width+=c,u-=c}}return r}function Ho(e,t,r){let n=ko(r,t);return jo(n,e),Go(n,e)}B(),B(),B();var Ke=10,rr=(e=0)=>t=>`\x1B[${t+e}m`,nr=(e=0)=>t=>`\x1B[${38+e};5;${t}m`,or=(e=0)=>(t,r,n)=>`\x1B[${38+e};2;${t};${r};${n}m`;function Uo(){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[r,n]of Object.entries(t)){for(let[s,o]of Object.entries(n))t[s]={open:`\x1B[${o[0]}m`,close:`\x1B[${o[1]}m`},n[s]=t[s],e.set(o[0],o[1]);Object.defineProperty(t,r,{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=rr(),t.color.ansi256=nr(),t.color.ansi16m=or(),t.bgColor.ansi=rr(Ke),t.bgColor.ansi256=nr(Ke),t.bgColor.ansi16m=or(Ke),Object.defineProperties(t,{rgbToAnsi256:{value:(r,n,s)=>r===n&&n===s?r<8?16:r>248?231:Math.round((r-8)/247*24)+232:16+36*Math.round(r/255*5)+6*Math.round(n/255*5)+Math.round(s/255*5),enumerable:!1},hexToRgb:{value:r=>{let n=/(?<colorString>[a-f\d]{6}|[a-f\d]{3})/i.exec(r.toString(16));if(!n)return[0,0,0];let{colorString:s}=n.groups;s.length===3&&(s=s.split("").map(u=>u+u).join(""));let o=Number.parseInt(s,16);return[o>>16&255,o>>8&255,o&255]},enumerable:!1},hexToAnsi256:{value:r=>t.rgbToAnsi256(...t.hexToRgb(r)),enumerable:!1},ansi256ToAnsi:{value:r=>{if(r<8)return 30+r;if(r<16)return 90+(r-8);let n,s,o;if(r>=232)n=((r-232)*10+8)/255,s=n,o=n;else{r-=16;let i=r%36;n=Math.floor(r/36)/5,s=Math.floor(i/6)/5,o=i%6/5}let u=Math.max(n,s,o)*2;if(u===0)return 30;let a=30+(Math.round(o)<<2|Math.round(s)<<1|Math.round(n));return u===2&&(a+=60),a},enumerable:!1},rgbToAnsi:{value:(r,n,s)=>t.ansi256ToAnsi(t.rgbToAnsi256(r,n,s)),enumerable:!1},hexToAnsi:{value:r=>t.ansi256ToAnsi(t.hexToAnsi256(r)),enumerable:!1}}),t}var Ko=Uo(),qo=Ko,Be=new Set(["\x1B","\x9B"]),zo=39,qe="\x07",sr="[",Yo="]",ur="m",ze=`${Yo}8;;`,ir=e=>`${Be.values().next().value}${sr}${e}${ur}`,ar=e=>`${Be.values().next().value}${ze}${e}${qe}`,Wo=e=>e.split(" ").map(t=>X(t)),Ye=(e,t,r)=>{let n=[...t],s=!1,o=!1,u=X(Jt(e[e.length-1]));for(let[a,i]of n.entries()){let l=X(i);if(u+l<=r?e[e.length-1]+=i:(e.push(i),u=0),Be.has(i)&&(s=!0,o=n.slice(a+1).join("").startsWith(ze)),s){o?i===qe&&(s=!1,o=!1):i===ur&&(s=!1);continue}u+=l,u===r&&a<n.length-1&&(e.push(""),u=0)}!u&&e[e.length-1].length>0&&e.length>1&&(e[e.length-2]+=e.pop())},Vo=e=>{let t=e.split(" "),r=t.length;for(;r>0&&!(X(t[r-1])>0);)r--;return r===t.length?e:t.slice(0,r).join(" ")+t.slice(r).join("")},Xo=(e,t,r={})=>{if(r.trim!==!1&&e.trim()==="")return"";let n="",s,o,u=Wo(e),a=[""];for(let[l,f]of e.split(" ").entries()){r.trim!==!1&&(a[a.length-1]=a[a.length-1].trimStart());let c=X(a[a.length-1]);if(l!==0&&(c>=t&&(r.wordWrap===!1||r.trim===!1)&&(a.push(""),c=0),(c>0||r.trim===!1)&&(a[a.length-1]+=" ",c++)),r.hard&&u[l]>t){let D=t-c,p=1+Math.floor((u[l]-D-1)/t);Math.floor((u[l]-1)/t)<p&&a.push(""),Ye(a,f,t);continue}if(c+u[l]>t&&c>0&&u[l]>0){if(r.wordWrap===!1&&c<t){Ye(a,f,t);continue}a.push("")}if(c+u[l]>t&&r.wordWrap===!1){Ye(a,f,t);continue}a[a.length-1]+=f}r.trim!==!1&&(a=a.map(l=>Vo(l)));let i=[...a.join(`
4
- `)];for(let[l,f]of i.entries()){if(n+=f,Be.has(f)){let{groups:D}=new RegExp(`(?:\\${sr}(?<code>\\d+)m|\\${ze}(?<uri>.*)${qe})`).exec(i.slice(l).join(""))||{groups:{}};if(D.code!==void 0){let p=Number.parseFloat(D.code);s=p===zo?void 0:p}else D.uri!==void 0&&(o=D.uri.length===0?void 0:D.uri)}let c=qo.codes.get(Number(s));i[l+1]===`
5
- `?(o&&(n+=ar("")),s&&c&&(n+=ir(c))):f===`
6
- `&&(s&&c&&(n+=ir(s)),o&&(n+=ar(o)))}return n};function Jo(e,t,r){return String(e).normalize().replace(/\r\n/g,`
2
+ import Re from"tty";import{createRequire as Bn}from"module";import{Buffer as xn}from"node:buffer";import ee from"node:path";import Rt from"node:child_process";import K from"node:process";import On from"child_process";import q from"path";import X from"fs";import Mn from"node:url";import Sn,{constants as kt}from"node:os";import jt from"assert";import Gt from"events";import In from"buffer";import ke from"stream";import Ht from"util";import je from"inquirer";import Ge from"ora";import g from"chalk";import{of as G,from as S,filter as Ut,map as I,tap as Kt,concatMap as T,catchError as R,scan as qt,switchMap as Pn,mergeMap as zt,BehaviorSubject as Yt,ReplaySubject as _n,lastValueFrom as Ln,toArray as Nn}from"rxjs";import Tn from"@anthropic-ai/sdk";import{fromPromise as H}from"rxjs/internal/observable/innerFrom";import He from"os";import{xxh64 as Rn}from"@pacote/xxhash";import kn from"http";import jn from"https";import"@dqbd/tiktoken";import Gn from"net";import Hn from"tls";import Un,{fileURLToPath as Kn,pathToFileURL as qn}from"url";import{FormData as zn,Blob as Yn}from"formdata-node";import x from"fs/promises";import Wn from"axios";import{CohereClient as Vn,CohereTimeoutError as Xn}from"cohere-ai";import{GoogleGenerativeAI as Jn}from"@google/generative-ai";import{Ollama as Zn}from"ollama";import Ae from"readline";import Qn from"figlet";import eo from"inquirer-reactive-list-prompt";import{rm as to}from"node:fs/promises";const ro="known-flag",no="unknown-flag",oo="argument",{stringify:le}=JSON,so=/\B([A-Z])/g,uo=e=>e.replace(so,"-$1").toLowerCase(),{hasOwnProperty:io}=Object.prototype,fe=(e,t)=>io.call(e,t),ao=e=>Array.isArray(e),Wt=e=>typeof e=="function"?[e,!1]:ao(e)?[e[0],!0]:Wt(e.type),co=(e,t)=>e===Boolean?t!=="false":t,Do=(e,t)=>typeof t=="boolean"?t:e===Number&&t===""?Number.NaN:e(t),lo=/[\s.:=]/,fo=e=>{const t=`Flag name ${le(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 r=e.match(lo);if(r)throw new Error(`${t} cannot contain ${le(r?.[0])}`)},po=e=>{const t={},r=(n,s)=>{if(fe(t,n))throw new Error(`Duplicate flags named ${le(n)}`);t[n]=s};for(const n in e){if(!fe(e,n))continue;fo(n);const s=e[n],o=[[],...Wt(s),s];r(n,o);const u=uo(n);if(n!==u&&r(u,o),"alias"in s&&typeof s.alias=="string"){const{alias:a}=s,i=`Flag alias ${le(a)} for flag ${le(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`);r(a,o)}}return t},mo=(e,t)=>{const r={};for(const n in e){if(!fe(e,n))continue;const[s,,o,u]=t[n];if(s.length===0&&"default"in u){let{default:a}=u;typeof a=="function"&&(a=a()),r[n]=a}else r[n]=o?s:s.pop()}return r},ve="--",ho=/[.:=]/,go=/^-{1,2}\w/,Co=e=>{if(!go.test(e))return;const t=!e.startsWith(ve);let r=e.slice(t?1:2),n;const s=r.match(ho);if(s){const{index:o}=s;n=r.slice(o+1),r=r.slice(0,o)}return[r,n,t]},Eo=(e,{onFlag:t,onArgument:r})=>{let n;const s=(o,u)=>{if(typeof n!="function")return!0;n(o,u),n=void 0};for(let o=0;o<e.length;o+=1){const u=e[o];if(u===ve){s();const i=e.slice(o+1);r?.(i,[o],!0);break}const a=Co(u);if(a){if(s(),!t)continue;const[i,l,f]=a;if(f)for(let c=0;c<i.length;c+=1){s();const D=c===i.length-1;n=t(i[c],D?l:void 0,[o,c+1,D])}else n=t(i,l,[o])}else s(u,[o])&&r?.([u],[o])}s()},Fo=(e,t)=>{for(const[r,n,s]of t.reverse()){if(n){const o=e[r];let u=o.slice(0,n);if(s||(u+=o.slice(n+1)),u!=="-"){e[r]=u;continue}}e.splice(r,1)}},yo=(e,t=process.argv.slice(2),{ignore:r}={})=>{const n=[],s=po(e),o={},u=[];return u[ve]=[],Eo(t,{onFlag(a,i,l){const f=fe(s,a);if(!r?.(f?ro:no,a,i)){if(f){const[c,D]=s[a],p=co(D,i),d=(h,m)=>{n.push(l),m&&n.push(m),c.push(Do(D,h||""))};return p===void 0?d:d(p)}fe(o,a)||(o[a]=[]),o[a].push(i===void 0?!0:i),n.push(l)}},onArgument(a,i,l){r?.(oo,t[i[0]])||(u.push(...a),l?(u[ve]=a,t.splice(i[0])):n.push(i))}}),Fo(t,n),{flags:mo(e,s),unknownFlags:o,_:u}};var bo=Object.create,$e=Object.defineProperty,wo=Object.defineProperties,Ao=Object.getOwnPropertyDescriptor,vo=Object.getOwnPropertyDescriptors,$o=Object.getOwnPropertyNames,Vt=Object.getOwnPropertySymbols,Bo=Object.getPrototypeOf,Xt=Object.prototype.hasOwnProperty,xo=Object.prototype.propertyIsEnumerable,Jt=(e,t,r)=>t in e?$e(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Be=(e,t)=>{for(var r in t||(t={}))Xt.call(t,r)&&Jt(e,r,t[r]);if(Vt)for(var r of Vt(t))xo.call(t,r)&&Jt(e,r,t[r]);return e},Ue=(e,t)=>wo(e,vo(t)),Oo=e=>$e(e,"__esModule",{value:!0}),Mo=(e,t)=>()=>(e&&(t=e(e=0)),t),So=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Io=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of $o(t))!Xt.call(e,s)&&(r||s!=="default")&&$e(e,s,{get:()=>t[s],enumerable:!(n=Ao(t,s))||n.enumerable});return e},Po=(e,t)=>Io(Oo($e(e!=null?bo(Bo(e)):{},"default",!t&&e&&e.__esModule?{get:()=>e.default,enumerable:!0}:{value:e,enumerable:!0})),e),B=Mo(()=>{}),_o=So((e,t)=>{B(),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}});B(),B(),B();var Lo=e=>{var t,r,n;let s=(t=process.stdout.columns)!=null?t:Number.POSITIVE_INFINITY;return typeof e=="function"&&(e=e(s)),e||(e={}),Array.isArray(e)?{columns:e,stdoutColumns:s}:{columns:(r=e.columns)!=null?r:[],stdoutColumns:(n=e.stdoutColumns)!=null?n:s}};B(),B(),B(),B(),B();function No({onlyFirst:e=!1}={}){let t=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))"].join("|");return new RegExp(t,e?void 0:"g")}function Zt(e){if(typeof e!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof e}\``);return e.replace(No(),"")}B();function To(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 Ro=Po(_o(),1);function J(e){if(typeof e!="string"||e.length===0||(e=Zt(e),e.length===0))return 0;e=e.replace((0,Ro.default)()," ");let t=0;for(let r=0;r<e.length;r++){let n=e.codePointAt(r);n<=31||n>=127&&n<=159||n>=768&&n<=879||(n>65535&&r++,t+=To(n)?2:1)}return t}var Qt=e=>Math.max(...e.split(`
3
+ `).map(J)),ko=e=>{let t=[];for(let r of e){let{length:n}=r,s=n-t.length;for(let o=0;o<s;o+=1)t.push(0);for(let o=0;o<n;o+=1){let u=Qt(r[o]);u>t[o]&&(t[o]=u)}}return t};B();var er=/^\d+%$/,tr={width:"auto",align:"left",contentWidth:0,paddingLeft:0,paddingRight:0,paddingTop:0,paddingBottom:0,horizontalPadding:0,paddingLeftString:"",paddingRightString:""},jo=(e,t)=>{var r;let n=[];for(let s=0;s<e.length;s+=1){let o=(r=t[s])!=null?r:"auto";if(typeof o=="number"||o==="auto"||o==="content-width"||typeof o=="string"&&er.test(o)){n.push(Ue(Be({},tr),{width:o,contentWidth:e[s]}));continue}if(o&&typeof o=="object"){let u=Ue(Be(Be({},tr),o),{contentWidth:e[s]});u.horizontalPadding=u.paddingLeft+u.paddingRight,n.push(u);continue}throw new Error(`Invalid column width: ${JSON.stringify(o)}`)}return n};function Go(e,t){for(let r of e){let{width:n}=r;if(n==="content-width"&&(r.width=r.contentWidth),n==="auto"){let i=Math.min(20,r.contentWidth);r.width=i,r.autoOverflow=r.contentWidth-i}if(typeof n=="string"&&er.test(n)){let i=Number.parseFloat(n.slice(0,-1))/100;r.width=Math.floor(t*i)-(r.paddingLeft+r.paddingRight)}let{horizontalPadding:s}=r,o=1,u=o+s;if(u>=t){let i=u-t,l=Math.ceil(r.paddingLeft/s*i),f=i-l;r.paddingLeft-=l,r.paddingRight-=f,r.horizontalPadding=r.paddingLeft+r.paddingRight}r.paddingLeftString=r.paddingLeft?" ".repeat(r.paddingLeft):"",r.paddingRightString=r.paddingRight?" ".repeat(r.paddingRight):"";let a=t-r.horizontalPadding;r.width=Math.max(Math.min(r.width,a),o)}}var rr=()=>Object.assign([],{columns:0});function Ho(e,t){let r=[rr()],[n]=r;for(let s of e){let o=s.width+s.horizontalPadding;n.columns+o>t&&(n=rr(),r.push(n)),n.push(s),n.columns+=o}for(let s of r){let o=s.reduce((D,p)=>D+p.width+p.horizontalPadding,0),u=t-o;if(u===0)continue;let a=s.filter(D=>"autoOverflow"in D),i=a.filter(D=>D.autoOverflow>0),l=i.reduce((D,p)=>D+p.autoOverflow,0),f=Math.min(l,u);for(let D of i){let p=Math.floor(D.autoOverflow/l*f);D.width+=p,u-=p}let c=Math.floor(u/a.length);for(let D=0;D<a.length;D+=1){let p=a[D];D===a.length-1?p.width+=u:p.width+=c,u-=c}}return r}function Uo(e,t,r){let n=jo(r,t);return Go(n,e),Ho(n,e)}B(),B(),B();var Ke=10,nr=(e=0)=>t=>`\x1B[${t+e}m`,or=(e=0)=>t=>`\x1B[${38+e};5;${t}m`,sr=(e=0)=>(t,r,n)=>`\x1B[${38+e};2;${t};${r};${n}m`;function Ko(){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[r,n]of Object.entries(t)){for(let[s,o]of Object.entries(n))t[s]={open:`\x1B[${o[0]}m`,close:`\x1B[${o[1]}m`},n[s]=t[s],e.set(o[0],o[1]);Object.defineProperty(t,r,{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=nr(),t.color.ansi256=or(),t.color.ansi16m=sr(),t.bgColor.ansi=nr(Ke),t.bgColor.ansi256=or(Ke),t.bgColor.ansi16m=sr(Ke),Object.defineProperties(t,{rgbToAnsi256:{value:(r,n,s)=>r===n&&n===s?r<8?16:r>248?231:Math.round((r-8)/247*24)+232:16+36*Math.round(r/255*5)+6*Math.round(n/255*5)+Math.round(s/255*5),enumerable:!1},hexToRgb:{value:r=>{let n=/(?<colorString>[a-f\d]{6}|[a-f\d]{3})/i.exec(r.toString(16));if(!n)return[0,0,0];let{colorString:s}=n.groups;s.length===3&&(s=s.split("").map(u=>u+u).join(""));let o=Number.parseInt(s,16);return[o>>16&255,o>>8&255,o&255]},enumerable:!1},hexToAnsi256:{value:r=>t.rgbToAnsi256(...t.hexToRgb(r)),enumerable:!1},ansi256ToAnsi:{value:r=>{if(r<8)return 30+r;if(r<16)return 90+(r-8);let n,s,o;if(r>=232)n=((r-232)*10+8)/255,s=n,o=n;else{r-=16;let i=r%36;n=Math.floor(r/36)/5,s=Math.floor(i/6)/5,o=i%6/5}let u=Math.max(n,s,o)*2;if(u===0)return 30;let a=30+(Math.round(o)<<2|Math.round(s)<<1|Math.round(n));return u===2&&(a+=60),a},enumerable:!1},rgbToAnsi:{value:(r,n,s)=>t.ansi256ToAnsi(t.rgbToAnsi256(r,n,s)),enumerable:!1},hexToAnsi:{value:r=>t.ansi256ToAnsi(t.hexToAnsi256(r)),enumerable:!1}}),t}var qo=Ko(),zo=qo,xe=new Set(["\x1B","\x9B"]),Yo=39,qe="\x07",ur="[",Wo="]",ir="m",ze=`${Wo}8;;`,ar=e=>`${xe.values().next().value}${ur}${e}${ir}`,cr=e=>`${xe.values().next().value}${ze}${e}${qe}`,Vo=e=>e.split(" ").map(t=>J(t)),Ye=(e,t,r)=>{let n=[...t],s=!1,o=!1,u=J(Zt(e[e.length-1]));for(let[a,i]of n.entries()){let l=J(i);if(u+l<=r?e[e.length-1]+=i:(e.push(i),u=0),xe.has(i)&&(s=!0,o=n.slice(a+1).join("").startsWith(ze)),s){o?i===qe&&(s=!1,o=!1):i===ir&&(s=!1);continue}u+=l,u===r&&a<n.length-1&&(e.push(""),u=0)}!u&&e[e.length-1].length>0&&e.length>1&&(e[e.length-2]+=e.pop())},Xo=e=>{let t=e.split(" "),r=t.length;for(;r>0&&!(J(t[r-1])>0);)r--;return r===t.length?e:t.slice(0,r).join(" ")+t.slice(r).join("")},Jo=(e,t,r={})=>{if(r.trim!==!1&&e.trim()==="")return"";let n="",s,o,u=Vo(e),a=[""];for(let[l,f]of e.split(" ").entries()){r.trim!==!1&&(a[a.length-1]=a[a.length-1].trimStart());let c=J(a[a.length-1]);if(l!==0&&(c>=t&&(r.wordWrap===!1||r.trim===!1)&&(a.push(""),c=0),(c>0||r.trim===!1)&&(a[a.length-1]+=" ",c++)),r.hard&&u[l]>t){let D=t-c,p=1+Math.floor((u[l]-D-1)/t);Math.floor((u[l]-1)/t)<p&&a.push(""),Ye(a,f,t);continue}if(c+u[l]>t&&c>0&&u[l]>0){if(r.wordWrap===!1&&c<t){Ye(a,f,t);continue}a.push("")}if(c+u[l]>t&&r.wordWrap===!1){Ye(a,f,t);continue}a[a.length-1]+=f}r.trim!==!1&&(a=a.map(l=>Xo(l)));let i=[...a.join(`
4
+ `)];for(let[l,f]of i.entries()){if(n+=f,xe.has(f)){let{groups:D}=new RegExp(`(?:\\${ur}(?<code>\\d+)m|\\${ze}(?<uri>.*)${qe})`).exec(i.slice(l).join(""))||{groups:{}};if(D.code!==void 0){let p=Number.parseFloat(D.code);s=p===Yo?void 0:p}else D.uri!==void 0&&(o=D.uri.length===0?void 0:D.uri)}let c=zo.codes.get(Number(s));i[l+1]===`
5
+ `?(o&&(n+=cr("")),s&&c&&(n+=ar(c))):f===`
6
+ `&&(s&&c&&(n+=ar(s)),o&&(n+=cr(o)))}return n};function Zo(e,t,r){return String(e).normalize().replace(/\r\n/g,`
7
7
  `).split(`
8
- `).map(n=>Xo(n,t,r)).join(`
9
- `)}var cr=e=>Array.from({length:e}).fill("");function Zo(e,t){let r=[],n=0;for(let s of e){let o=0,u=s.map(i=>{var l;let f=(l=t[n])!=null?l:"";n+=1,i.preprocess&&(f=i.preprocess(f)),Zt(f)>i.width&&(f=Jo(f,i.width,{hard:!0}));let c=f.split(`
10
- `);if(i.postprocess){let{postprocess:D}=i;c=c.map((p,d)=>D.call(i,p,d))}return i.paddingTop&&c.unshift(...cr(i.paddingTop)),i.paddingBottom&&c.push(...cr(i.paddingBottom)),c.length>o&&(o=c.length),Ue($e({},i),{lines:c})}),a=[];for(let i=0;i<o;i+=1){let l=u.map(f=>{var c;let D=(c=f.lines[i])!=null?c:"",p=Number.isFinite(f.width)?" ".repeat(f.width-X(D)):"",d=f.paddingLeftString;return f.align==="right"&&(d+=p),d+=D,f.align==="left"&&(d+=p),d+f.paddingRightString}).join("");a.push(l)}r.push(a.join(`
8
+ `).map(n=>Jo(n,t,r)).join(`
9
+ `)}var Dr=e=>Array.from({length:e}).fill("");function Qo(e,t){let r=[],n=0;for(let s of e){let o=0,u=s.map(i=>{var l;let f=(l=t[n])!=null?l:"";n+=1,i.preprocess&&(f=i.preprocess(f)),Qt(f)>i.width&&(f=Zo(f,i.width,{hard:!0}));let c=f.split(`
10
+ `);if(i.postprocess){let{postprocess:D}=i;c=c.map((p,d)=>D.call(i,p,d))}return i.paddingTop&&c.unshift(...Dr(i.paddingTop)),i.paddingBottom&&c.push(...Dr(i.paddingBottom)),c.length>o&&(o=c.length),Ue(Be({},i),{lines:c})}),a=[];for(let i=0;i<o;i+=1){let l=u.map(f=>{var c;let D=(c=f.lines[i])!=null?c:"",p=Number.isFinite(f.width)?" ".repeat(f.width-J(D)):"",d=f.paddingLeftString;return f.align==="right"&&(d+=p),d+=D,f.align==="left"&&(d+=p),d+f.paddingRightString}).join("");a.push(l)}r.push(a.join(`
11
11
  `))}return r.join(`
12
- `)}function Qo(e,t){if(!e||e.length===0)return"";let r=Ro(e),n=r.length;if(n===0)return"";let{stdoutColumns:s,columns:o}=_o(t);if(o.length>n)throw new Error(`${o.length} columns defined, but only ${n} columns found`);let u=Ho(s,o,r);return e.map(a=>Zo(u,a)).join(`
13
- `)}B();var es=["<",">","=",">=","<="];function ts(e){if(!es.includes(e))throw new TypeError(`Invalid breakpoint operator: ${e}`)}function rs(e){let t=Object.keys(e).map(r=>{let[n,s]=r.split(" ");ts(n);let o=Number.parseInt(s,10);if(Number.isNaN(o))throw new TypeError(`Invalid breakpoint value: ${s}`);let u=e[r];return{operator:n,breakpoint:o,value:u}}).sort((r,n)=>n.breakpoint-r.breakpoint);return r=>{var n;return(n=t.find(({operator:s,breakpoint:o})=>s==="="&&r===o||s===">"&&r>o||s==="<"&&r<o||s===">="&&r>=o||s==="<="&&r<=o))==null?void 0:n.value}}const ns=e=>e.replace(/[\W_]([a-z\d])?/gi,(t,r)=>r?r.toUpperCase():""),os=e=>e.replace(/\B([A-Z])/g,"-$1").toLowerCase(),ss={"> 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 us(e){let t=!1;return{type:"table",data:{tableData:Object.keys(e).sort((r,n)=>r.localeCompare(n)).map(r=>{const n=e[r],s="alias"in n;return s&&(t=!0),{name:r,flag:n,flagFormatted:`--${os(r)}`,aliasesEnabled:t,aliasFormatted:s?`-${n.alias}`:void 0}}).map(r=>(r.aliasesEnabled=t,[{type:"flagName",data:r},{type:"flagDescription",data:r}])),tableBreakpoints:ss}}}const Dr=e=>!e||(e.version??(e.help?e.help.version:void 0)),lr=e=>{const t="parent"in e&&e.parent?.name;return(t?`${t} `:"")+e.name};function is(e){const t=[];e.name&&t.push(lr(e));const r=Dr(e)??("parent"in e&&Dr(e.parent));if(r&&t.push(`v${r}`),t.length!==0)return{id:"name",type:"text",data:`${t.join(" ")}
14
- `}}function as(e){const{help:t}=e;if(!(!t||!t.description))return{id:"description",type:"text",data:`${t.description}
15
- `}}function cs(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 r=[],n=[lr(e)];if(e.flags&&Object.keys(e.flags).length>0&&n.push("[flags...]"),e.parameters&&e.parameters.length>0){const{parameters:s}=e,o=s.indexOf("--"),u=o>-1&&s.slice(o+1).some(a=>a.startsWith("<"));n.push(s.map(a=>a!=="--"?a:u?"--":"[--]").join(" "))}if(n.length>1&&r.push(n.join(" ")),"commands"in e&&e.commands?.length&&r.push(`${e.name} <command>`),r.length>0)return{id:"usage",type:"section",data:{title:"Usage:",body:r.join(`
17
- `)}}}}function Ds(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 ls(e){if(!(!e.flags||Object.keys(e.flags).length===0))return{id:"flags",type:"section",data:{title:"Flags:",body:us(e.flags),indentBody:0}}}function fs(e){const{help:t}=e;if(!t||!t.examples||t.examples.length===0)return;let{examples:r}=t;if(Array.isArray(r)&&(r=r.join(`
18
- `)),r)return{id:"examples",type:"section",data:{title:"Examples:",body:r}}}function ps(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 ds=e=>[is,as,cs,Ds,ls,fs,ps].map(t=>t(e)).filter(Boolean),ms=Re.WriteStream.prototype.hasColors();class hs{text(t){return t}bold(t){return ms?`\x1B[1m${t}\x1B[22m`:t.toLocaleUpperCase()}indentText({text:t,spaces:r}){return t.replace(/^/gm," ".repeat(r))}heading(t){return this.bold(t)}section({title:t,body:r,indentBody:n=2}){return`${(t?`${this.heading(t)}
12
+ `)}function es(e,t){if(!e||e.length===0)return"";let r=ko(e),n=r.length;if(n===0)return"";let{stdoutColumns:s,columns:o}=Lo(t);if(o.length>n)throw new Error(`${o.length} columns defined, but only ${n} columns found`);let u=Uo(s,o,r);return e.map(a=>Qo(u,a)).join(`
13
+ `)}B();var ts=["<",">","=",">=","<="];function rs(e){if(!ts.includes(e))throw new TypeError(`Invalid breakpoint operator: ${e}`)}function ns(e){let t=Object.keys(e).map(r=>{let[n,s]=r.split(" ");rs(n);let o=Number.parseInt(s,10);if(Number.isNaN(o))throw new TypeError(`Invalid breakpoint value: ${s}`);let u=e[r];return{operator:n,breakpoint:o,value:u}}).sort((r,n)=>n.breakpoint-r.breakpoint);return r=>{var n;return(n=t.find(({operator:s,breakpoint:o})=>s==="="&&r===o||s===">"&&r>o||s==="<"&&r<o||s===">="&&r>=o||s==="<="&&r<=o))==null?void 0:n.value}}const os=e=>e.replace(/[\W_]([a-z\d])?/gi,(t,r)=>r?r.toUpperCase():""),ss=e=>e.replace(/\B([A-Z])/g,"-$1").toLowerCase(),us={"> 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 is(e){let t=!1;return{type:"table",data:{tableData:Object.keys(e).sort((r,n)=>r.localeCompare(n)).map(r=>{const n=e[r],s="alias"in n;return s&&(t=!0),{name:r,flag:n,flagFormatted:`--${ss(r)}`,aliasesEnabled:t,aliasFormatted:s?`-${n.alias}`:void 0}}).map(r=>(r.aliasesEnabled=t,[{type:"flagName",data:r},{type:"flagDescription",data:r}])),tableBreakpoints:us}}}const lr=e=>!e||(e.version??(e.help?e.help.version:void 0)),fr=e=>{const t="parent"in e&&e.parent?.name;return(t?`${t} `:"")+e.name};function as(e){const t=[];e.name&&t.push(fr(e));const r=lr(e)??("parent"in e&&lr(e.parent));if(r&&t.push(`v${r}`),t.length!==0)return{id:"name",type:"text",data:`${t.join(" ")}
14
+ `}}function cs(e){const{help:t}=e;if(!(!t||!t.description))return{id:"description",type:"text",data:`${t.description}
15
+ `}}function Ds(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 r=[],n=[fr(e)];if(e.flags&&Object.keys(e.flags).length>0&&n.push("[flags...]"),e.parameters&&e.parameters.length>0){const{parameters:s}=e,o=s.indexOf("--"),u=o>-1&&s.slice(o+1).some(a=>a.startsWith("<"));n.push(s.map(a=>a!=="--"?a:u?"--":"[--]").join(" "))}if(n.length>1&&r.push(n.join(" ")),"commands"in e&&e.commands?.length&&r.push(`${e.name} <command>`),r.length>0)return{id:"usage",type:"section",data:{title:"Usage:",body:r.join(`
17
+ `)}}}}function ls(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 fs(e){if(!(!e.flags||Object.keys(e.flags).length===0))return{id:"flags",type:"section",data:{title:"Flags:",body:is(e.flags),indentBody:0}}}function ps(e){const{help:t}=e;if(!t||!t.examples||t.examples.length===0)return;let{examples:r}=t;if(Array.isArray(r)&&(r=r.join(`
18
+ `)),r)return{id:"examples",type:"section",data:{title:"Examples:",body:r}}}function ds(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 ms=e=>[as,cs,Ds,ls,fs,ps,ds].map(t=>t(e)).filter(Boolean),hs=Re.WriteStream.prototype.hasColors();class gs{text(t){return t}bold(t){return hs?`\x1B[1m${t}\x1B[22m`:t.toLocaleUpperCase()}indentText({text:t,spaces:r}){return t.replace(/^/gm," ".repeat(r))}heading(t){return this.bold(t)}section({title:t,body:r,indentBody:n=2}){return`${(t?`${this.heading(t)}
19
19
  `:"")+(r?this.indentText({text:this.render(r),spaces:n}):"")}
20
- `}table({tableData:t,tableOptions:r,tableBreakpoints:n}){return Qo(t.map(s=>s.map(o=>this.render(o))),n?rs(n):r)}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:r,flagFormatted:n,aliasesEnabled:s,aliasFormatted:o}=t;let u="";if(o?u+=`${o}, `:s&&(u+=" "),u+=n,"placeholder"in r&&typeof r.placeholder=="string")u+=`${this.flagOperator(t)}${r.placeholder}`;else{const a=this.flagParameter("type"in r?r.type:r);a&&(u+=`${this.flagOperator(t)}${a}`)}return u}flagDefault(t){return JSON.stringify(t)}flagDescription({flag:t}){let r="description"in t?t.description??"":"";if("default"in t){let{default:n}=t;typeof n=="function"&&(n=n()),n&&(r+=` (default: ${this.flagDefault(n)})`)}return r}render(t){if(typeof t=="string")return t;if(Array.isArray(t))return t.map(r=>this.render(r)).join(`
21
- `);if("type"in t&&this[t.type]){const r=this[t.type];if(typeof r=="function")return r.call(this,t.data)}throw new Error(`Invalid node type: ${JSON.stringify(t)}`)}}const We=/^[\w.-]+$/,{stringify:R}=JSON,gs=/[|\\{}()[\]^$+*?.]/;function Ve(e){const t=[];let r,n;for(const s of e){if(n)throw new Error(`Invalid parameter: Spread parameter ${R(n)} must be last`);const o=s[0],u=s[s.length-1];let a;if(o==="<"&&u===">"&&(a=!0,r))throw new Error(`Invalid parameter: Required parameter ${R(s)} cannot come after optional parameter ${R(r)}`);if(o==="["&&u==="]"&&(a=!1,r=s),a===void 0)throw new Error(`Invalid parameter: ${R(s)}. Must be wrapped in <> (required parameter) or [] (optional parameter)`);let i=s.slice(1,-1);const l=i.slice(-3)==="...";l&&(n=s,i=i.slice(0,-3));const f=i.match(gs);if(f)throw new Error(`Invalid parameter: ${R(s)}. Invalid character found ${R(f[0])}`);t.push({name:i,required:a,spread:l})}return t}function Xe(e,t,r,n){for(let s=0;s<t.length;s+=1){const{name:o,required:u,spread:a}=t[s],i=ns(o);if(i in e)throw new Error(`Invalid parameter: ${R(o)} is used more than once.`);const l=a?r.slice(s):r[s];if(a&&(s=t.length),u&&(!l||a&&l.length===0))return console.error(`Error: Missing required parameter ${R(o)}
22
- `),n(),process.exit(1);e[i]=l}}function Cs(e){return e===void 0||e!==!1}function fr(e,t,r,n){const s={...t.flags},o=t.version;o&&(s.version={type:Boolean,description:"Show version"});const{help:u}=t,a=Cs(u);a&&!("help"in s)&&(s.help={type:Boolean,alias:"h",description:"Show help"});const i=Fo(s,n,{ignore:t.ignoreArgv}),l=()=>{console.log(t.version)};if(o&&i.flags.version===!0)return l(),process.exit(0);const f=new hs,c=a&&u?.render?u.render:d=>f.render(d),D=d=>{const h=ds({...t,...d?{help:d}:{},flags:s});console.log(c(h,f))};if(a&&i.flags.help===!0)return D(),process.exit(0);if(t.parameters){let{parameters:d}=t,h=i._;const m=d.indexOf("--"),C=d.slice(m+1),w=Object.create(null);if(m>-1&&C.length>0){d=d.slice(0,m);const F=i._["--"];h=h.slice(0,-F.length||void 0),Xe(w,Ve(d),h,D),Xe(w,Ve(C),F,D)}else Xe(w,Ve(d),h,D);Object.assign(i._,w)}const p={...i,showVersion:l,showHelp:D};return typeof r=="function"&&r(p),{command:e,...p}}function Es(e,t){const r=new Map;for(const n of t){const s=[n.options.name],{alias:o}=n.options;o&&(Array.isArray(o)?s.push(...o):s.push(o));for(const u of s){if(r.has(u))throw new Error(`Duplicate command name found: ${R(u)}`);r.set(u,n)}}return r.get(e)}function Fs(e,t,r=process.argv.slice(2)){if(!e)throw new Error("Options is required");if("name"in e&&(!e.name||!We.test(e.name)))throw new Error(`Invalid script name: ${R(e.name)}`);const n=r[0];if(e.commands&&We.test(n)){const s=Es(n,e.commands);if(s)return fr(s.options.name,{...s.options,parent:e},s.callback,r.slice(1))}return fr(void 0,e,t,r)}function Je(e,t){if(!e)throw new Error("Command options are required");const{name:r}=e;if(e.name===void 0)throw new Error("Command name is required");if(!We.test(r))throw new Error(`Invalid command name ${JSON.stringify(r)}. Command names must be one word.`);return{options:e,callback:t}}var ys=vn(import.meta.url),v=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function te(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var re={exports:{}},Ze,pr;function bs(){if(pr)return Ze;pr=1,Ze=n,n.sync=s;var e=V;function t(o,u){var a=u.pathExt!==void 0?u.pathExt:process.env.PATHEXT;if(!a||(a=a.split(";"),a.indexOf("")!==-1))return!0;for(var i=0;i<a.length;i++){var l=a[i].toLowerCase();if(l&&o.substr(-l.length).toLowerCase()===l)return!0}return!1}function r(o,u,a){return!o.isSymbolicLink()&&!o.isFile()?!1:t(u,a)}function n(o,u,a){e.stat(o,function(i,l){a(i,i?!1:r(l,o,u))})}function s(o,u){return r(e.statSync(o),o,u)}return Ze}var Qe,dr;function ws(){if(dr)return Qe;dr=1,Qe=t,t.sync=r;var e=V;function t(o,u,a){e.stat(o,function(i,l){a(i,i?!1:n(l,u))})}function r(o,u){return n(e.statSync(o),u)}function n(o,u){return o.isFile()&&s(o,u)}function s(o,u){var a=o.mode,i=o.uid,l=o.gid,f=u.uid!==void 0?u.uid:process.getuid&&process.getuid(),c=u.gid!==void 0?u.gid:process.getgid&&process.getgid(),D=parseInt("100",8),p=parseInt("010",8),d=parseInt("001",8),h=D|p,m=a&d||a&p&&l===c||a&D&&i===f||a&h&&f===0;return m}return Qe}var xe;process.platform==="win32"||v.TESTING_WINDOWS?xe=bs():xe=ws();var As=et;et.sync=vs;function et(e,t,r){if(typeof t=="function"&&(r=t,t={}),!r){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(n,s){et(e,t||{},function(o,u){o?s(o):n(u)})})}xe(e,t||{},function(n,s){n&&(n.code==="EACCES"||t&&t.ignoreErrors)&&(n=null,s=!1),r(n,s)})}function vs(e,t){try{return xe.sync(e,t||{})}catch(r){if(t&&t.ignoreErrors||r.code==="EACCES")return!1;throw r}}const ne=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",mr=q,$s=ne?";":":",hr=As,gr=e=>Object.assign(new Error(`not found: ${e}`),{code:"ENOENT"}),Cr=(e,t)=>{const r=t.colon||$s,n=e.match(/\//)||ne&&e.match(/\\/)?[""]:[...ne?[process.cwd()]:[],...(t.path||process.env.PATH||"").split(r)],s=ne?t.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",o=ne?s.split(r):[""];return ne&&e.indexOf(".")!==-1&&o[0]!==""&&o.unshift(""),{pathEnv:n,pathExt:o,pathExtExe:s}},Er=(e,t,r)=>{typeof t=="function"&&(r=t,t={}),t||(t={});const{pathEnv:n,pathExt:s,pathExtExe:o}=Cr(e,t),u=[],a=l=>new Promise((f,c)=>{if(l===n.length)return t.all&&u.length?f(u):c(gr(e));const D=n[l],p=/^".*"$/.test(D)?D.slice(1,-1):D,d=mr.join(p,e),h=!p&&/^\.[\\\/]/.test(e)?e.slice(0,2)+d:d;f(i(h,l,0))}),i=(l,f,c)=>new Promise((D,p)=>{if(c===s.length)return D(a(f+1));const d=s[c];hr(l+d,{pathExt:o},(h,m)=>{if(!h&&m)if(t.all)u.push(l+d);else return D(l+d);return D(i(l,f,c+1))})});return r?a(0).then(l=>r(null,l),r):a(0)},Bs=(e,t)=>{t=t||{};const{pathEnv:r,pathExt:n,pathExtExe:s}=Cr(e,t),o=[];for(let u=0;u<r.length;u++){const a=r[u],i=/^".*"$/.test(a)?a.slice(1,-1):a,l=mr.join(i,e),f=!i&&/^\.[\\\/]/.test(e)?e.slice(0,2)+l:l;for(let c=0;c<n.length;c++){const D=f+n[c];try{if(hr.sync(D,{pathExt:s}))if(t.all)o.push(D);else return D}catch{}}}if(t.all&&o.length)return o;if(t.nothrow)return null;throw gr(e)};var xs=Er;Er.sync=Bs;var tt={exports:{}};const Fr=(e={})=>{const t=e.env||process.env;return(e.platform||process.platform)!=="win32"?"PATH":Object.keys(t).reverse().find(n=>n.toUpperCase()==="PATH")||"Path"};tt.exports=Fr,tt.exports.default=Fr;var Os=tt.exports;const yr=q,Ss=xs,Is=Os;function br(e,t){const r=e.options.env||process.env,n=process.cwd(),s=e.options.cwd!=null,o=s&&process.chdir!==void 0&&!process.chdir.disabled;if(o)try{process.chdir(e.options.cwd)}catch{}let u;try{u=Ss.sync(e.command,{path:r[Is({env:r})],pathExt:t?yr.delimiter:void 0})}catch{}finally{o&&process.chdir(n)}return u&&(u=yr.resolve(s?e.options.cwd:"",u)),u}function Ms(e){return br(e)||br(e,!0)}var Ps=Ms,rt={};const nt=/([()\][%!^"`<>&|;, *?])/g;function _s(e){return e=e.replace(nt,"^$1"),e}function Ns(e,t){return e=`${e}`,e=e.replace(/(\\*)"/g,'$1$1\\"'),e=e.replace(/(\\*)$/,"$1$1"),e=`"${e}"`,e=e.replace(nt,"^$1"),t&&(e=e.replace(nt,"^$1")),e}rt.command=_s,rt.argument=Ns;var Ts=/^#!(.*)/;const Ls=Ts;var Rs=(e="")=>{const t=e.match(Ls);if(!t)return null;const[r,n]=t[0].replace(/#! ?/,"").split(" "),s=r.split("/").pop();return s==="env"?n:n?`${s} ${n}`:s};const ot=V,ks=Rs;function js(e){const r=Buffer.alloc(150);let n;try{n=ot.openSync(e,"r"),ot.readSync(n,r,0,150,0),ot.closeSync(n)}catch{}return ks(r.toString())}var Gs=js;const Hs=q,wr=Ps,Ar=rt,Us=Gs,Ks=process.platform==="win32",qs=/\.(?:com|exe)$/i,zs=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function Ys(e){e.file=wr(e);const t=e.file&&Us(e.file);return t?(e.args.unshift(e.file),e.command=t,wr(e)):e.file}function Ws(e){if(!Ks)return e;const t=Ys(e),r=!qs.test(t);if(e.options.forceShell||r){const n=zs.test(t);e.command=Hs.normalize(e.command),e.command=Ar.command(e.command),e.args=e.args.map(o=>Ar.argument(o,n));const s=[e.command].concat(e.args).join(" ");e.args=["/d","/s","/c",`"${s}"`],e.command=process.env.comspec||"cmd.exe",e.options.windowsVerbatimArguments=!0}return e}function Vs(e,t,r){t&&!Array.isArray(t)&&(r=t,t=null),t=t?t.slice(0):[],r=Object.assign({},r);const n={command:e,args:t,options:r,file:void 0,original:{command:e,args:t}};return r.shell?n:Ws(n)}var Xs=Vs;const st=process.platform==="win32";function ut(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 Js(e,t){if(!st)return;const r=e.emit;e.emit=function(n,s){if(n==="exit"){const o=vr(s,t);if(o)return r.call(e,"error",o)}return r.apply(e,arguments)}}function vr(e,t){return st&&e===1&&!t.file?ut(t.original,"spawn"):null}function Zs(e,t){return st&&e===1&&!t.file?ut(t.original,"spawnSync"):null}var Qs={hookChildProcess:Js,verifyENOENT:vr,verifyENOENTSync:Zs,notFoundError:ut};const $r=Bn,it=Xs,at=Qs;function Br(e,t,r){const n=it(e,t,r),s=$r.spawn(n.command,n.args,n.options);return at.hookChildProcess(s,n),s}function eu(e,t,r){const n=it(e,t,r),s=$r.spawnSync(n.command,n.args,n.options);return s.error=s.error||at.verifyENOENTSync(s.status,n),s}re.exports=Br,re.exports.spawn=Br,re.exports.sync=eu,re.exports._parse=it,re.exports._enoent=at;var tu=re.exports,ru=te(tu);function nu(e){const t=typeof e=="string"?`
20
+ `}table({tableData:t,tableOptions:r,tableBreakpoints:n}){return es(t.map(s=>s.map(o=>this.render(o))),n?ns(n):r)}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:r,flagFormatted:n,aliasesEnabled:s,aliasFormatted:o}=t;let u="";if(o?u+=`${o}, `:s&&(u+=" "),u+=n,"placeholder"in r&&typeof r.placeholder=="string")u+=`${this.flagOperator(t)}${r.placeholder}`;else{const a=this.flagParameter("type"in r?r.type:r);a&&(u+=`${this.flagOperator(t)}${a}`)}return u}flagDefault(t){return JSON.stringify(t)}flagDescription({flag:t}){let r="description"in t?t.description??"":"";if("default"in t){let{default:n}=t;typeof n=="function"&&(n=n()),n&&(r+=` (default: ${this.flagDefault(n)})`)}return r}render(t){if(typeof t=="string")return t;if(Array.isArray(t))return t.map(r=>this.render(r)).join(`
21
+ `);if("type"in t&&this[t.type]){const r=this[t.type];if(typeof r=="function")return r.call(this,t.data)}throw new Error(`Invalid node type: ${JSON.stringify(t)}`)}}const We=/^[\w.-]+$/,{stringify:k}=JSON,Cs=/[|\\{}()[\]^$+*?.]/;function Ve(e){const t=[];let r,n;for(const s of e){if(n)throw new Error(`Invalid parameter: Spread parameter ${k(n)} must be last`);const o=s[0],u=s[s.length-1];let a;if(o==="<"&&u===">"&&(a=!0,r))throw new Error(`Invalid parameter: Required parameter ${k(s)} cannot come after optional parameter ${k(r)}`);if(o==="["&&u==="]"&&(a=!1,r=s),a===void 0)throw new Error(`Invalid parameter: ${k(s)}. Must be wrapped in <> (required parameter) or [] (optional parameter)`);let i=s.slice(1,-1);const l=i.slice(-3)==="...";l&&(n=s,i=i.slice(0,-3));const f=i.match(Cs);if(f)throw new Error(`Invalid parameter: ${k(s)}. Invalid character found ${k(f[0])}`);t.push({name:i,required:a,spread:l})}return t}function Xe(e,t,r,n){for(let s=0;s<t.length;s+=1){const{name:o,required:u,spread:a}=t[s],i=os(o);if(i in e)throw new Error(`Invalid parameter: ${k(o)} is used more than once.`);const l=a?r.slice(s):r[s];if(a&&(s=t.length),u&&(!l||a&&l.length===0))return console.error(`Error: Missing required parameter ${k(o)}
22
+ `),n(),process.exit(1);e[i]=l}}function Es(e){return e===void 0||e!==!1}function pr(e,t,r,n){const s={...t.flags},o=t.version;o&&(s.version={type:Boolean,description:"Show version"});const{help:u}=t,a=Es(u);a&&!("help"in s)&&(s.help={type:Boolean,alias:"h",description:"Show help"});const i=yo(s,n,{ignore:t.ignoreArgv}),l=()=>{console.log(t.version)};if(o&&i.flags.version===!0)return l(),process.exit(0);const f=new gs,c=a&&u?.render?u.render:d=>f.render(d),D=d=>{const h=ms({...t,...d?{help:d}:{},flags:s});console.log(c(h,f))};if(a&&i.flags.help===!0)return D(),process.exit(0);if(t.parameters){let{parameters:d}=t,h=i._;const m=d.indexOf("--"),C=d.slice(m+1),w=Object.create(null);if(m>-1&&C.length>0){d=d.slice(0,m);const F=i._["--"];h=h.slice(0,-F.length||void 0),Xe(w,Ve(d),h,D),Xe(w,Ve(C),F,D)}else Xe(w,Ve(d),h,D);Object.assign(i._,w)}const p={...i,showVersion:l,showHelp:D};return typeof r=="function"&&r(p),{command:e,...p}}function Fs(e,t){const r=new Map;for(const n of t){const s=[n.options.name],{alias:o}=n.options;o&&(Array.isArray(o)?s.push(...o):s.push(o));for(const u of s){if(r.has(u))throw new Error(`Duplicate command name found: ${k(u)}`);r.set(u,n)}}return r.get(e)}function ys(e,t,r=process.argv.slice(2)){if(!e)throw new Error("Options is required");if("name"in e&&(!e.name||!We.test(e.name)))throw new Error(`Invalid script name: ${k(e.name)}`);const n=r[0];if(e.commands&&We.test(n)){const s=Fs(n,e.commands);if(s)return pr(s.options.name,{...s.options,parent:e},s.callback,r.slice(1))}return pr(void 0,e,t,r)}function Je(e,t){if(!e)throw new Error("Command options are required");const{name:r}=e;if(e.name===void 0)throw new Error("Command name is required");if(!We.test(r))throw new Error(`Invalid command name ${JSON.stringify(r)}. Command names must be one word.`);return{options:e,callback:t}}var bs=Bn(import.meta.url),v=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function te(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var re={exports:{}},Ze,dr;function ws(){if(dr)return Ze;dr=1,Ze=n,n.sync=s;var e=X;function t(o,u){var a=u.pathExt!==void 0?u.pathExt:process.env.PATHEXT;if(!a||(a=a.split(";"),a.indexOf("")!==-1))return!0;for(var i=0;i<a.length;i++){var l=a[i].toLowerCase();if(l&&o.substr(-l.length).toLowerCase()===l)return!0}return!1}function r(o,u,a){return!o.isSymbolicLink()&&!o.isFile()?!1:t(u,a)}function n(o,u,a){e.stat(o,function(i,l){a(i,i?!1:r(l,o,u))})}function s(o,u){return r(e.statSync(o),o,u)}return Ze}var Qe,mr;function As(){if(mr)return Qe;mr=1,Qe=t,t.sync=r;var e=X;function t(o,u,a){e.stat(o,function(i,l){a(i,i?!1:n(l,u))})}function r(o,u){return n(e.statSync(o),u)}function n(o,u){return o.isFile()&&s(o,u)}function s(o,u){var a=o.mode,i=o.uid,l=o.gid,f=u.uid!==void 0?u.uid:process.getuid&&process.getuid(),c=u.gid!==void 0?u.gid:process.getgid&&process.getgid(),D=parseInt("100",8),p=parseInt("010",8),d=parseInt("001",8),h=D|p,m=a&d||a&p&&l===c||a&D&&i===f||a&h&&f===0;return m}return Qe}var Oe;process.platform==="win32"||v.TESTING_WINDOWS?Oe=ws():Oe=As();var vs=et;et.sync=$s;function et(e,t,r){if(typeof t=="function"&&(r=t,t={}),!r){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(n,s){et(e,t||{},function(o,u){o?s(o):n(u)})})}Oe(e,t||{},function(n,s){n&&(n.code==="EACCES"||t&&t.ignoreErrors)&&(n=null,s=!1),r(n,s)})}function $s(e,t){try{return Oe.sync(e,t||{})}catch(r){if(t&&t.ignoreErrors||r.code==="EACCES")return!1;throw r}}const ne=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",hr=q,Bs=ne?";":":",gr=vs,Cr=e=>Object.assign(new Error(`not found: ${e}`),{code:"ENOENT"}),Er=(e,t)=>{const r=t.colon||Bs,n=e.match(/\//)||ne&&e.match(/\\/)?[""]:[...ne?[process.cwd()]:[],...(t.path||process.env.PATH||"").split(r)],s=ne?t.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",o=ne?s.split(r):[""];return ne&&e.indexOf(".")!==-1&&o[0]!==""&&o.unshift(""),{pathEnv:n,pathExt:o,pathExtExe:s}},Fr=(e,t,r)=>{typeof t=="function"&&(r=t,t={}),t||(t={});const{pathEnv:n,pathExt:s,pathExtExe:o}=Er(e,t),u=[],a=l=>new Promise((f,c)=>{if(l===n.length)return t.all&&u.length?f(u):c(Cr(e));const D=n[l],p=/^".*"$/.test(D)?D.slice(1,-1):D,d=hr.join(p,e),h=!p&&/^\.[\\\/]/.test(e)?e.slice(0,2)+d:d;f(i(h,l,0))}),i=(l,f,c)=>new Promise((D,p)=>{if(c===s.length)return D(a(f+1));const d=s[c];gr(l+d,{pathExt:o},(h,m)=>{if(!h&&m)if(t.all)u.push(l+d);else return D(l+d);return D(i(l,f,c+1))})});return r?a(0).then(l=>r(null,l),r):a(0)},xs=(e,t)=>{t=t||{};const{pathEnv:r,pathExt:n,pathExtExe:s}=Er(e,t),o=[];for(let u=0;u<r.length;u++){const a=r[u],i=/^".*"$/.test(a)?a.slice(1,-1):a,l=hr.join(i,e),f=!i&&/^\.[\\\/]/.test(e)?e.slice(0,2)+l:l;for(let c=0;c<n.length;c++){const D=f+n[c];try{if(gr.sync(D,{pathExt:s}))if(t.all)o.push(D);else return D}catch{}}}if(t.all&&o.length)return o;if(t.nothrow)return null;throw Cr(e)};var Os=Fr;Fr.sync=xs;var tt={exports:{}};const yr=(e={})=>{const t=e.env||process.env;return(e.platform||process.platform)!=="win32"?"PATH":Object.keys(t).reverse().find(n=>n.toUpperCase()==="PATH")||"Path"};tt.exports=yr,tt.exports.default=yr;var Ms=tt.exports;const br=q,Ss=Os,Is=Ms;function wr(e,t){const r=e.options.env||process.env,n=process.cwd(),s=e.options.cwd!=null,o=s&&process.chdir!==void 0&&!process.chdir.disabled;if(o)try{process.chdir(e.options.cwd)}catch{}let u;try{u=Ss.sync(e.command,{path:r[Is({env:r})],pathExt:t?br.delimiter:void 0})}catch{}finally{o&&process.chdir(n)}return u&&(u=br.resolve(s?e.options.cwd:"",u)),u}function Ps(e){return wr(e)||wr(e,!0)}var _s=Ps,rt={};const nt=/([()\][%!^"`<>&|;, *?])/g;function Ls(e){return e=e.replace(nt,"^$1"),e}function Ns(e,t){return e=`${e}`,e=e.replace(/(\\*)"/g,'$1$1\\"'),e=e.replace(/(\\*)$/,"$1$1"),e=`"${e}"`,e=e.replace(nt,"^$1"),t&&(e=e.replace(nt,"^$1")),e}rt.command=Ls,rt.argument=Ns;var Ts=/^#!(.*)/;const Rs=Ts;var ks=(e="")=>{const t=e.match(Rs);if(!t)return null;const[r,n]=t[0].replace(/#! ?/,"").split(" "),s=r.split("/").pop();return s==="env"?n:n?`${s} ${n}`:s};const ot=X,js=ks;function Gs(e){const r=Buffer.alloc(150);let n;try{n=ot.openSync(e,"r"),ot.readSync(n,r,0,150,0),ot.closeSync(n)}catch{}return js(r.toString())}var Hs=Gs;const Us=q,Ar=_s,vr=rt,Ks=Hs,qs=process.platform==="win32",zs=/\.(?:com|exe)$/i,Ys=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function Ws(e){e.file=Ar(e);const t=e.file&&Ks(e.file);return t?(e.args.unshift(e.file),e.command=t,Ar(e)):e.file}function Vs(e){if(!qs)return e;const t=Ws(e),r=!zs.test(t);if(e.options.forceShell||r){const n=Ys.test(t);e.command=Us.normalize(e.command),e.command=vr.command(e.command),e.args=e.args.map(o=>vr.argument(o,n));const s=[e.command].concat(e.args).join(" ");e.args=["/d","/s","/c",`"${s}"`],e.command=process.env.comspec||"cmd.exe",e.options.windowsVerbatimArguments=!0}return e}function Xs(e,t,r){t&&!Array.isArray(t)&&(r=t,t=null),t=t?t.slice(0):[],r=Object.assign({},r);const n={command:e,args:t,options:r,file:void 0,original:{command:e,args:t}};return r.shell?n:Vs(n)}var Js=Xs;const st=process.platform==="win32";function ut(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 Zs(e,t){if(!st)return;const r=e.emit;e.emit=function(n,s){if(n==="exit"){const o=$r(s,t);if(o)return r.call(e,"error",o)}return r.apply(e,arguments)}}function $r(e,t){return st&&e===1&&!t.file?ut(t.original,"spawn"):null}function Qs(e,t){return st&&e===1&&!t.file?ut(t.original,"spawnSync"):null}var eu={hookChildProcess:Zs,verifyENOENT:$r,verifyENOENTSync:Qs,notFoundError:ut};const Br=On,it=Js,at=eu;function xr(e,t,r){const n=it(e,t,r),s=Br.spawn(n.command,n.args,n.options);return at.hookChildProcess(s,n),s}function tu(e,t,r){const n=it(e,t,r),s=Br.spawnSync(n.command,n.args,n.options);return s.error=s.error||at.verifyENOENTSync(s.status,n),s}re.exports=xr,re.exports.spawn=xr,re.exports.sync=tu,re.exports._parse=it,re.exports._enoent=at;var ru=re.exports,nu=te(ru);function ou(e){const t=typeof e=="string"?`
23
23
  `:`
24
- `.charCodeAt(),r=typeof e=="string"?"\r":"\r".charCodeAt();return e[e.length-1]===t&&(e=e.slice(0,-1)),e[e.length-1]===r&&(e=e.slice(0,-1)),e}function xr(e={}){const{env:t=process.env,platform:r=process.platform}=e;return r!=="win32"?"PATH":Object.keys(t).reverse().find(n=>n.toUpperCase()==="PATH")||"Path"}function ou(e={}){const{cwd:t=K.cwd(),path:r=K.env[xr()],execPath:n=K.execPath}=e;let s;const o=t instanceof URL?xn.fileURLToPath(t):t;let u=ee.resolve(o);const a=[];for(;s!==u;)a.push(ee.join(u,"node_modules/.bin")),s=u,u=ee.resolve(u,"..");return a.push(ee.resolve(o,n,"..")),[...a,r].join(ee.delimiter)}function su({env:e=K.env,...t}={}){e={...e};const r=xr({env:e});return t.path=e[r],e[r]=ou(t),e}const uu=(e,t,r,n)=>{if(r==="length"||r==="prototype"||r==="arguments"||r==="caller")return;const s=Object.getOwnPropertyDescriptor(e,r),o=Object.getOwnPropertyDescriptor(t,r);!iu(s,o)&&n||Object.defineProperty(e,r,o)},iu=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)},au=(e,t)=>{const r=Object.getPrototypeOf(t);r!==Object.getPrototypeOf(e)&&Object.setPrototypeOf(e,r)},cu=(e,t)=>`/* Wrapped ${e}*/
25
- ${t}`,Du=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),lu=Object.getOwnPropertyDescriptor(Function.prototype.toString,"name"),fu=(e,t,r)=>{const n=r===""?"":`with ${r.trim()}() `,s=cu.bind(null,n,t.toString());Object.defineProperty(s,"name",lu),Object.defineProperty(e,"toString",{...Du,value:s})};function pu(e,t,{ignoreNonConfigurable:r=!1}={}){const{name:n}=e;for(const s of Reflect.ownKeys(t))uu(e,t,s,r);return au(e,t),fu(e,t,n),e}const Oe=new WeakMap,Or=(e,t={})=>{if(typeof e!="function")throw new TypeError("Expected a function");let r,n=0;const s=e.displayName||e.name||"<anonymous>",o=function(...u){if(Oe.set(o,++n),n===1)r=e.apply(this,u),e=null;else if(t.throw===!0)throw new Error(`Function \`${s}\` can only be called once`);return r};return pu(o,e),Oe.set(o,n),o};Or.callCount=e=>{if(!Oe.has(e))throw new Error(`The given function \`${e.name}\` is not wrapped by the \`onetime\` package`);return Oe.get(e)};const du=()=>{const e=Ir-Sr+1;return Array.from({length:e},mu)},mu=(e,t)=>({name:`SIGRT${t+1}`,number:Sr+t,action:"terminate",description:"Application-specific signal (realtime)",standard:"posix"}),Sr=34,Ir=64,hu=[{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"}],Mr=()=>{const e=du();return[...hu,...e].map(gu)},gu=({name:e,number:t,description:r,action:n,forced:s=!1,standard:o})=>{const{signals:{[e]:u}}=kt,a=u!==void 0;return{name:e,number:a?u:t,description:r,supported:a,action:n,forced:s,standard:o}},Cu=()=>{const e=Mr();return Object.fromEntries(e.map(Eu))},Eu=({name:e,number:t,description:r,supported:n,action:s,forced:o,standard:u})=>[e,{name:e,number:t,description:r,supported:n,action:s,forced:o,standard:u}],Fu=Cu(),yu=()=>{const e=Mr(),t=Ir+1,r=Array.from({length:t},(n,s)=>bu(s,e));return Object.assign({},...r)},bu=(e,t)=>{const r=wu(e,t);if(r===void 0)return{};const{name:n,description:s,supported:o,action:u,forced:a,standard:i}=r;return{[e]:{name:n,number:e,description:s,supported:o,action:u,forced:a,standard:i}}},wu=(e,t)=>{const r=t.find(({name:n})=>kt.signals[n]===e);return r!==void 0?r:t.find(n=>n.number===e)};yu();const Au=({timedOut:e,timeout:t,errorCode:r,signal:n,signalDescription:s,exitCode:o,isCanceled:u})=>e?`timed out after ${t} milliseconds`:u?"was canceled":r!==void 0?`failed with ${r}`:n!==void 0?`was killed with ${n} (${s})`:o!==void 0?`failed with exit code ${o}`:"failed",Pr=({stdout:e,stderr:t,all:r,error:n,signal:s,exitCode:o,command:u,escapedCommand:a,timedOut:i,isCanceled:l,killed:f,parsed:{options:{timeout:c}}})=>{o=o===null?void 0:o,s=s===null?void 0:s;const D=s===void 0?void 0:Fu[s].description,p=n&&n.code,h=`Command ${Au({timedOut:i,timeout:c,errorCode:p,signal:s,signalDescription:D,exitCode:o,isCanceled:l})}: ${u}`,m=Object.prototype.toString.call(n)==="[object Error]",C=m?`${h}
24
+ `.charCodeAt(),r=typeof e=="string"?"\r":"\r".charCodeAt();return e[e.length-1]===t&&(e=e.slice(0,-1)),e[e.length-1]===r&&(e=e.slice(0,-1)),e}function Or(e={}){const{env:t=process.env,platform:r=process.platform}=e;return r!=="win32"?"PATH":Object.keys(t).reverse().find(n=>n.toUpperCase()==="PATH")||"Path"}function su(e={}){const{cwd:t=K.cwd(),path:r=K.env[Or()],execPath:n=K.execPath}=e;let s;const o=t instanceof URL?Mn.fileURLToPath(t):t;let u=ee.resolve(o);const a=[];for(;s!==u;)a.push(ee.join(u,"node_modules/.bin")),s=u,u=ee.resolve(u,"..");return a.push(ee.resolve(o,n,"..")),[...a,r].join(ee.delimiter)}function uu({env:e=K.env,...t}={}){e={...e};const r=Or({env:e});return t.path=e[r],e[r]=su(t),e}const iu=(e,t,r,n)=>{if(r==="length"||r==="prototype"||r==="arguments"||r==="caller")return;const s=Object.getOwnPropertyDescriptor(e,r),o=Object.getOwnPropertyDescriptor(t,r);!au(s,o)&&n||Object.defineProperty(e,r,o)},au=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)},cu=(e,t)=>{const r=Object.getPrototypeOf(t);r!==Object.getPrototypeOf(e)&&Object.setPrototypeOf(e,r)},Du=(e,t)=>`/* Wrapped ${e}*/
25
+ ${t}`,lu=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),fu=Object.getOwnPropertyDescriptor(Function.prototype.toString,"name"),pu=(e,t,r)=>{const n=r===""?"":`with ${r.trim()}() `,s=Du.bind(null,n,t.toString());Object.defineProperty(s,"name",fu),Object.defineProperty(e,"toString",{...lu,value:s})};function du(e,t,{ignoreNonConfigurable:r=!1}={}){const{name:n}=e;for(const s of Reflect.ownKeys(t))iu(e,t,s,r);return cu(e,t),pu(e,t,n),e}const Me=new WeakMap,Mr=(e,t={})=>{if(typeof e!="function")throw new TypeError("Expected a function");let r,n=0;const s=e.displayName||e.name||"<anonymous>",o=function(...u){if(Me.set(o,++n),n===1)r=e.apply(this,u),e=null;else if(t.throw===!0)throw new Error(`Function \`${s}\` can only be called once`);return r};return du(o,e),Me.set(o,n),o};Mr.callCount=e=>{if(!Me.has(e))throw new Error(`The given function \`${e.name}\` is not wrapped by the \`onetime\` package`);return Me.get(e)};const mu=()=>{const e=Ir-Sr+1;return Array.from({length:e},hu)},hu=(e,t)=>({name:`SIGRT${t+1}`,number:Sr+t,action:"terminate",description:"Application-specific signal (realtime)",standard:"posix"}),Sr=34,Ir=64,gu=[{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"}],Pr=()=>{const e=mu();return[...gu,...e].map(Cu)},Cu=({name:e,number:t,description:r,action:n,forced:s=!1,standard:o})=>{const{signals:{[e]:u}}=kt,a=u!==void 0;return{name:e,number:a?u:t,description:r,supported:a,action:n,forced:s,standard:o}},Eu=()=>{const e=Pr();return Object.fromEntries(e.map(Fu))},Fu=({name:e,number:t,description:r,supported:n,action:s,forced:o,standard:u})=>[e,{name:e,number:t,description:r,supported:n,action:s,forced:o,standard:u}],yu=Eu(),bu=()=>{const e=Pr(),t=Ir+1,r=Array.from({length:t},(n,s)=>wu(s,e));return Object.assign({},...r)},wu=(e,t)=>{const r=Au(e,t);if(r===void 0)return{};const{name:n,description:s,supported:o,action:u,forced:a,standard:i}=r;return{[e]:{name:n,number:e,description:s,supported:o,action:u,forced:a,standard:i}}},Au=(e,t)=>{const r=t.find(({name:n})=>kt.signals[n]===e);return r!==void 0?r:t.find(n=>n.number===e)};bu();const vu=({timedOut:e,timeout:t,errorCode:r,signal:n,signalDescription:s,exitCode:o,isCanceled:u})=>e?`timed out after ${t} milliseconds`:u?"was canceled":r!==void 0?`failed with ${r}`:n!==void 0?`was killed with ${n} (${s})`:o!==void 0?`failed with exit code ${o}`:"failed",_r=({stdout:e,stderr:t,all:r,error:n,signal:s,exitCode:o,command:u,escapedCommand:a,timedOut:i,isCanceled:l,killed:f,parsed:{options:{timeout:c}}})=>{o=o===null?void 0:o,s=s===null?void 0:s;const D=s===void 0?void 0:yu[s].description,p=n&&n.code,h=`Command ${vu({timedOut:i,timeout:c,errorCode:p,signal:s,signalDescription:D,exitCode:o,isCanceled:l})}: ${u}`,m=Object.prototype.toString.call(n)==="[object Error]",C=m?`${h}
26
26
  ${n.message}`:h,w=[C,t,e].filter(Boolean).join(`
27
- `);return m?(n.originalMessage=n.message,n.message=w):n=new Error(w),n.shortMessage=C,n.command=u,n.escapedCommand=a,n.exitCode=o,n.signal=s,n.signalDescription=D,n.stdout=e,n.stderr=t,r!==void 0&&(n.all=r),"bufferedData"in n&&delete n.bufferedData,n.failed=!0,n.timedOut=!!i,n.isCanceled=l,n.killed=f&&!i,n},Se=["stdin","stdout","stderr"],vu=e=>Se.some(t=>e[t]!==void 0),$u=e=>{if(!e)return;const{stdio:t}=e;if(t===void 0)return Se.map(n=>e[n]);if(vu(e))throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${Se.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 r=Math.max(t.length,Se.length);return Array.from({length:r},(n,s)=>t[s])};var oe={exports:{}},Ie={exports:{}};Ie.exports;var _r;function Bu(){return _r||(_r=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")}(Ie)),Ie.exports}var y=v.process;const J=function(e){return e&&typeof e=="object"&&typeof e.removeListener=="function"&&typeof e.emit=="function"&&typeof e.reallyExit=="function"&&typeof e.listeners=="function"&&typeof e.kill=="function"&&typeof e.pid=="number"&&typeof e.on=="function"};if(!J(y))oe.exports=function(){return function(){}};else{var xu=jt,fe=Bu(),Ou=/^win/i.test(y.platform),Me=Gt;typeof Me!="function"&&(Me=Me.EventEmitter);var $;y.__signal_exit_emitter__?$=y.__signal_exit_emitter__:($=y.__signal_exit_emitter__=new Me,$.count=0,$.emitted={}),$.infinite||($.setMaxListeners(1/0),$.infinite=!0),oe.exports=function(e,t){if(!J(v.process))return function(){};xu.equal(typeof e,"function","a callback must be provided for exit handler"),pe===!1&&Nr();var r="exit";t&&t.alwaysLast&&(r="afterexit");var n=function(){$.removeListener(r,e),$.listeners("exit").length===0&&$.listeners("afterexit").length===0&&ct()};return $.on(r,e),n};var ct=function(){!pe||!J(v.process)||(pe=!1,fe.forEach(function(t){try{y.removeListener(t,Dt[t])}catch{}}),y.emit=lt,y.reallyExit=Tr,$.count-=1)};oe.exports.unload=ct;var se=function(t,r,n){$.emitted[t]||($.emitted[t]=!0,$.emit(t,r,n))},Dt={};fe.forEach(function(e){Dt[e]=function(){if(J(v.process)){var r=y.listeners(e);r.length===$.count&&(ct(),se("exit",null,e),se("afterexit",null,e),Ou&&e==="SIGHUP"&&(e="SIGINT"),y.kill(y.pid,e))}}}),oe.exports.signals=function(){return fe};var pe=!1,Nr=function(){pe||!J(v.process)||(pe=!0,$.count+=1,fe=fe.filter(function(t){try{return y.on(t,Dt[t]),!0}catch{return!1}}),y.emit=Iu,y.reallyExit=Su)};oe.exports.load=Nr;var Tr=y.reallyExit,Su=function(t){J(v.process)&&(y.exitCode=t||0,se("exit",y.exitCode,null),se("afterexit",y.exitCode,null),Tr.call(y,y.exitCode))},lt=y.emit,Iu=function(t,r){if(t==="exit"&&J(v.process)){r!==void 0&&(y.exitCode=r);var n=lt.apply(this,arguments);return se("exit",y.exitCode,null),se("afterexit",y.exitCode,null),n}else return lt.apply(this,arguments)}}var Mu=oe.exports,Pu=te(Mu);const _u=1e3*5,Nu=(e,t="SIGTERM",r={})=>{const n=e(t);return Tu(e,t,r,n),n},Tu=(e,t,r,n)=>{if(!Lu(t,r,n))return;const s=ku(r),o=setTimeout(()=>{e("SIGKILL")},s);o.unref&&o.unref()},Lu=(e,{forceKillAfterTimeout:t},r)=>Ru(e)&&t!==!1&&r,Ru=e=>e===On.constants.signals.SIGTERM||typeof e=="string"&&e.toUpperCase()==="SIGTERM",ku=({forceKillAfterTimeout:e=!0})=>{if(e===!0)return _u;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},ju=(e,t)=>{e.kill()&&(t.isCanceled=!0)},Gu=(e,t,r)=>{e.kill(t),r(Object.assign(new Error("Timed out"),{timedOut:!0,signal:t}))},Hu=(e,{timeout:t,killSignal:r="SIGTERM"},n)=>{if(t===0||t===void 0)return n;let s;const o=new Promise((a,i)=>{s=setTimeout(()=>{Gu(e,r,i)},t)}),u=n.finally(()=>{clearTimeout(s)});return Promise.race([o,u])},Uu=({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})`)},Ku=async(e,{cleanup:t,detached:r},n)=>{if(!t||r)return n;const s=Pu(()=>{e.kill()});return n.finally(()=>{s()})};function qu(e){return e!==null&&typeof e=="object"&&typeof e.pipe=="function"}var de={exports:{}};const{PassThrough:zu}=ke;var Yu=e=>{e={...e};const{array:t}=e;let{encoding:r}=e;const n=r==="buffer";let s=!1;t?s=!(r||n):r=r||"utf8",n&&(r=null);const o=new zu({objectMode:s});r&&o.setEncoding(r);let u=0;const a=[];return o.on("data",i=>{a.push(i),s?u=a.length:u+=i.length}),o.getBufferedValue=()=>t?a:n?Buffer.concat(a,u):a.join(""),o.getBufferedLength=()=>u,o};const{constants:Wu}=Sn,Vu=ke,{promisify:Xu}=Ht,Ju=Yu,Zu=Xu(Vu.pipeline);class Lr extends Error{constructor(){super("maxBuffer exceeded"),this.name="MaxBufferError"}}async function ft(e,t){if(!e)throw new Error("Expected a stream");t={maxBuffer:1/0,...t};const{maxBuffer:r}=t,n=Ju(t);return await new Promise((s,o)=>{const u=a=>{a&&n.getBufferedLength()<=Wu.MAX_LENGTH&&(a.bufferedData=n.getBufferedValue()),o(a)};(async()=>{try{await Zu(e,n),s()}catch(a){u(a)}})(),n.on("data",()=>{n.getBufferedLength()>r&&u(new Lr)})}),n.getBufferedValue()}de.exports=ft,de.exports.buffer=(e,t)=>ft(e,{...t,encoding:"buffer"}),de.exports.array=(e,t)=>ft(e,{...t,array:!0}),de.exports.MaxBufferError=Lr;var Qu=de.exports,Rr=te(Qu);const{PassThrough:ei}=ke;var ti=function(){var e=[],t=new ei({objectMode:!0});return t.setMaxListeners(0),t.add=r,t.isEmpty=n,t.on("unpipe",s),Array.prototype.slice.call(arguments).forEach(r),t;function r(o){return Array.isArray(o)?(o.forEach(r),this):(e.push(o),o.once("end",s.bind(null,o)),o.once("error",t.emit.bind(t,"error")),o.pipe(t,{end:!1}),this)}function n(){return e.length==0}function s(o){e=e.filter(function(u){return u!==o}),!e.length&&t.readable&&t.end()}},ri=te(ti);const ni=(e,t)=>{t!==void 0&&(qu(t)?t.pipe(e.stdin):e.stdin.end(t))},oi=(e,{all:t})=>{if(!t||!e.stdout&&!e.stderr)return;const r=ri();return e.stdout&&r.add(e.stdout),e.stderr&&r.add(e.stderr),r},pt=async(e,t)=>{if(!(!e||t===void 0)){e.destroy();try{return await t}catch(r){return r.bufferedData}}},dt=(e,{encoding:t,buffer:r,maxBuffer:n})=>{if(!(!e||!r))return t?Rr(e,{encoding:t,maxBuffer:n}):Rr.buffer(e,{maxBuffer:n})},si=async({stdout:e,stderr:t,all:r},{encoding:n,buffer:s,maxBuffer:o},u)=>{const a=dt(e,{encoding:n,buffer:s,maxBuffer:o}),i=dt(t,{encoding:n,buffer:s,maxBuffer:o}),l=dt(r,{encoding:n,buffer:s,maxBuffer:o*2});try{return await Promise.all([u,a,i,l])}catch(f){return Promise.all([{error:f,signal:f.signal,timedOut:f.timedOut},pt(e,a),pt(t,i),pt(r,l)])}},ui=(async()=>{})().constructor.prototype,ii=["then","catch","finally"].map(e=>[e,Reflect.getOwnPropertyDescriptor(ui,e)]),kr=(e,t)=>{for(const[r,n]of ii){const s=typeof t=="function"?(...o)=>Reflect.apply(n.value,t(),o):n.value.bind(t);Reflect.defineProperty(e,r,{...n,value:s})}return e},ai=e=>new Promise((t,r)=>{e.on("exit",(n,s)=>{t({exitCode:n,signal:s})}),e.on("error",n=>{r(n)}),e.stdin&&e.stdin.on("error",n=>{r(n)})}),jr=(e,t=[])=>Array.isArray(t)?[e,...t]:[e],ci=/^[\w.-]+$/,Di=/"/g,li=e=>typeof e!="string"||ci.test(e)?e:`"${e.replace(Di,'\\"')}"`,fi=(e,t)=>jr(e,t).join(" "),pi=(e,t)=>jr(e,t).map(r=>li(r)).join(" "),di=1e3*1e3*100,mi=({env:e,extendEnv:t,preferLocal:r,localDir:n,execPath:s})=>{const o=t?{...K.env,...e}:e;return r?su({env:o,cwd:n,execPath:s}):o},hi=(e,t,r={})=>{const n=ru._parse(e,t,r);return e=n.command,t=n.args,r=n.options,r={maxBuffer:di,buffer:!0,stripFinalNewline:!0,extendEnv:!0,preferLocal:!1,localDir:r.cwd||K.cwd(),execPath:K.execPath,encoding:"utf8",reject:!0,cleanup:!0,all:!1,windowsHide:!0,...r},r.env=mi(r),r.stdio=$u(r),K.platform==="win32"&&ee.basename(e,".exe")==="cmd"&&t.unshift("/q"),{file:e,args:t,options:r,parsed:n}},mt=(e,t,r)=>typeof t!="string"&&!$n.isBuffer(t)?r===void 0?void 0:"":e.stripFinalNewline?nu(t):t;function ue(e,t,r){const n=hi(e,t,r),s=fi(e,t),o=pi(e,t);Uu(n.options);let u;try{u=Rt.spawn(n.file,n.args,n.options)}catch(p){const d=new Rt.ChildProcess,h=Promise.reject(Pr({error:p,stdout:"",stderr:"",all:"",command:s,escapedCommand:o,parsed:n,timedOut:!1,isCanceled:!1,killed:!1}));return kr(d,h)}const a=ai(u),i=Hu(u,n.options,a),l=Ku(u,n.options,i),f={isCanceled:!1};u.kill=Nu.bind(null,u.kill.bind(u)),u.cancel=ju.bind(null,u,f);const D=Or(async()=>{const[{error:p,exitCode:d,signal:h,timedOut:m},C,w,F]=await si(u,n.options,l),M=mt(n.options,C),N=mt(n.options,w),W=mt(n.options,F);if(p||d!==0||h!==null){const A=Pr({error:p,exitCode:d,signal:h,stdout:M,stderr:N,all:W,command:s,escapedCommand:o,parsed:n,timedOut:m,isCanceled:f.isCanceled||(n.options.signal?n.options.signal.aborted:!1),killed:u.killed});if(!n.options.reject)return A;throw A}return{command:s,escapedCommand:o,exitCode:0,stdout:M,stderr:N,all:W,failed:!1,timedOut:!1,isCanceled:!1,killed:!1}});return ni(u,n.options.input),u.all=oi(u,n.options),kr(u,D)}class z{static create(t,r){return new t(r)}}const gi=80,Ci={"":"<commit message>",conventional:"<type>(<optional scope>): <description>",gitmoji:":<emoji>: <description>"},Ei={"":"",conventional:"Example commit message => feat: add new disabled boolean variable to button",gitmoji:"Example commit message => :sparkles: Add a generic preset using configuration"},Fi=(e="conventional")=>e===""?"":`The commit message must be in format:
28
- ${Ci[e]}
29
- ${Ei[e]}`,yi={"":"",gitmoji:`Choose a emoji from the emoji-to-description JSON below that best describes the git diff:
27
+ `);return m?(n.originalMessage=n.message,n.message=w):n=new Error(w),n.shortMessage=C,n.command=u,n.escapedCommand=a,n.exitCode=o,n.signal=s,n.signalDescription=D,n.stdout=e,n.stderr=t,r!==void 0&&(n.all=r),"bufferedData"in n&&delete n.bufferedData,n.failed=!0,n.timedOut=!!i,n.isCanceled=l,n.killed=f&&!i,n},Se=["stdin","stdout","stderr"],$u=e=>Se.some(t=>e[t]!==void 0),Bu=e=>{if(!e)return;const{stdio:t}=e;if(t===void 0)return Se.map(n=>e[n]);if($u(e))throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${Se.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 r=Math.max(t.length,Se.length);return Array.from({length:r},(n,s)=>t[s])};var oe={exports:{}},Ie={exports:{}};Ie.exports;var Lr;function xu(){return Lr||(Lr=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")}(Ie)),Ie.exports}var y=v.process;const Z=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(!Z(y))oe.exports=function(){return function(){}};else{var Ou=jt,pe=xu(),Mu=/^win/i.test(y.platform),Pe=Gt;typeof Pe!="function"&&(Pe=Pe.EventEmitter);var $;y.__signal_exit_emitter__?$=y.__signal_exit_emitter__:($=y.__signal_exit_emitter__=new Pe,$.count=0,$.emitted={}),$.infinite||($.setMaxListeners(1/0),$.infinite=!0),oe.exports=function(e,t){if(!Z(v.process))return function(){};Ou.equal(typeof e,"function","a callback must be provided for exit handler"),de===!1&&Nr();var r="exit";t&&t.alwaysLast&&(r="afterexit");var n=function(){$.removeListener(r,e),$.listeners("exit").length===0&&$.listeners("afterexit").length===0&&ct()};return $.on(r,e),n};var ct=function(){!de||!Z(v.process)||(de=!1,pe.forEach(function(t){try{y.removeListener(t,Dt[t])}catch{}}),y.emit=lt,y.reallyExit=Tr,$.count-=1)};oe.exports.unload=ct;var se=function(t,r,n){$.emitted[t]||($.emitted[t]=!0,$.emit(t,r,n))},Dt={};pe.forEach(function(e){Dt[e]=function(){if(Z(v.process)){var r=y.listeners(e);r.length===$.count&&(ct(),se("exit",null,e),se("afterexit",null,e),Mu&&e==="SIGHUP"&&(e="SIGINT"),y.kill(y.pid,e))}}}),oe.exports.signals=function(){return pe};var de=!1,Nr=function(){de||!Z(v.process)||(de=!0,$.count+=1,pe=pe.filter(function(t){try{return y.on(t,Dt[t]),!0}catch{return!1}}),y.emit=Iu,y.reallyExit=Su)};oe.exports.load=Nr;var Tr=y.reallyExit,Su=function(t){Z(v.process)&&(y.exitCode=t||0,se("exit",y.exitCode,null),se("afterexit",y.exitCode,null),Tr.call(y,y.exitCode))},lt=y.emit,Iu=function(t,r){if(t==="exit"&&Z(v.process)){r!==void 0&&(y.exitCode=r);var n=lt.apply(this,arguments);return se("exit",y.exitCode,null),se("afterexit",y.exitCode,null),n}else return lt.apply(this,arguments)}}var Pu=oe.exports,_u=te(Pu);const Lu=1e3*5,Nu=(e,t="SIGTERM",r={})=>{const n=e(t);return Tu(e,t,r,n),n},Tu=(e,t,r,n)=>{if(!Ru(t,r,n))return;const s=ju(r),o=setTimeout(()=>{e("SIGKILL")},s);o.unref&&o.unref()},Ru=(e,{forceKillAfterTimeout:t},r)=>ku(e)&&t!==!1&&r,ku=e=>e===Sn.constants.signals.SIGTERM||typeof e=="string"&&e.toUpperCase()==="SIGTERM",ju=({forceKillAfterTimeout:e=!0})=>{if(e===!0)return Lu;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},Gu=(e,t)=>{e.kill()&&(t.isCanceled=!0)},Hu=(e,t,r)=>{e.kill(t),r(Object.assign(new Error("Timed out"),{timedOut:!0,signal:t}))},Uu=(e,{timeout:t,killSignal:r="SIGTERM"},n)=>{if(t===0||t===void 0)return n;let s;const o=new Promise((a,i)=>{s=setTimeout(()=>{Hu(e,r,i)},t)}),u=n.finally(()=>{clearTimeout(s)});return Promise.race([o,u])},Ku=({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})`)},qu=async(e,{cleanup:t,detached:r},n)=>{if(!t||r)return n;const s=_u(()=>{e.kill()});return n.finally(()=>{s()})};function zu(e){return e!==null&&typeof e=="object"&&typeof e.pipe=="function"}var me={exports:{}};const{PassThrough:Yu}=ke;var Wu=e=>{e={...e};const{array:t}=e;let{encoding:r}=e;const n=r==="buffer";let s=!1;t?s=!(r||n):r=r||"utf8",n&&(r=null);const o=new Yu({objectMode:s});r&&o.setEncoding(r);let u=0;const a=[];return o.on("data",i=>{a.push(i),s?u=a.length:u+=i.length}),o.getBufferedValue=()=>t?a:n?Buffer.concat(a,u):a.join(""),o.getBufferedLength=()=>u,o};const{constants:Vu}=In,Xu=ke,{promisify:Ju}=Ht,Zu=Wu,Qu=Ju(Xu.pipeline);class Rr extends Error{constructor(){super("maxBuffer exceeded"),this.name="MaxBufferError"}}async function ft(e,t){if(!e)throw new Error("Expected a stream");t={maxBuffer:1/0,...t};const{maxBuffer:r}=t,n=Zu(t);return await new Promise((s,o)=>{const u=a=>{a&&n.getBufferedLength()<=Vu.MAX_LENGTH&&(a.bufferedData=n.getBufferedValue()),o(a)};(async()=>{try{await Qu(e,n),s()}catch(a){u(a)}})(),n.on("data",()=>{n.getBufferedLength()>r&&u(new Rr)})}),n.getBufferedValue()}me.exports=ft,me.exports.buffer=(e,t)=>ft(e,{...t,encoding:"buffer"}),me.exports.array=(e,t)=>ft(e,{...t,array:!0}),me.exports.MaxBufferError=Rr;var ei=me.exports,kr=te(ei);const{PassThrough:ti}=ke;var ri=function(){var e=[],t=new ti({objectMode:!0});return t.setMaxListeners(0),t.add=r,t.isEmpty=n,t.on("unpipe",s),Array.prototype.slice.call(arguments).forEach(r),t;function r(o){return Array.isArray(o)?(o.forEach(r),this):(e.push(o),o.once("end",s.bind(null,o)),o.once("error",t.emit.bind(t,"error")),o.pipe(t,{end:!1}),this)}function n(){return e.length==0}function s(o){e=e.filter(function(u){return u!==o}),!e.length&&t.readable&&t.end()}},ni=te(ri);const oi=(e,t)=>{t!==void 0&&(zu(t)?t.pipe(e.stdin):e.stdin.end(t))},si=(e,{all:t})=>{if(!t||!e.stdout&&!e.stderr)return;const r=ni();return e.stdout&&r.add(e.stdout),e.stderr&&r.add(e.stderr),r},pt=async(e,t)=>{if(!(!e||t===void 0)){e.destroy();try{return await t}catch(r){return r.bufferedData}}},dt=(e,{encoding:t,buffer:r,maxBuffer:n})=>{if(!(!e||!r))return t?kr(e,{encoding:t,maxBuffer:n}):kr.buffer(e,{maxBuffer:n})},ui=async({stdout:e,stderr:t,all:r},{encoding:n,buffer:s,maxBuffer:o},u)=>{const a=dt(e,{encoding:n,buffer:s,maxBuffer:o}),i=dt(t,{encoding:n,buffer:s,maxBuffer:o}),l=dt(r,{encoding:n,buffer:s,maxBuffer:o*2});try{return await Promise.all([u,a,i,l])}catch(f){return Promise.all([{error:f,signal:f.signal,timedOut:f.timedOut},pt(e,a),pt(t,i),pt(r,l)])}},ii=(async()=>{})().constructor.prototype,ai=["then","catch","finally"].map(e=>[e,Reflect.getOwnPropertyDescriptor(ii,e)]),jr=(e,t)=>{for(const[r,n]of ai){const s=typeof t=="function"?(...o)=>Reflect.apply(n.value,t(),o):n.value.bind(t);Reflect.defineProperty(e,r,{...n,value:s})}return e},ci=e=>new Promise((t,r)=>{e.on("exit",(n,s)=>{t({exitCode:n,signal:s})}),e.on("error",n=>{r(n)}),e.stdin&&e.stdin.on("error",n=>{r(n)})}),Gr=(e,t=[])=>Array.isArray(t)?[e,...t]:[e],Di=/^[\w.-]+$/,li=/"/g,fi=e=>typeof e!="string"||Di.test(e)?e:`"${e.replace(li,'\\"')}"`,pi=(e,t)=>Gr(e,t).join(" "),di=(e,t)=>Gr(e,t).map(r=>fi(r)).join(" "),mi=1e3*1e3*100,hi=({env:e,extendEnv:t,preferLocal:r,localDir:n,execPath:s})=>{const o=t?{...K.env,...e}:e;return r?uu({env:o,cwd:n,execPath:s}):o},gi=(e,t,r={})=>{const n=nu._parse(e,t,r);return e=n.command,t=n.args,r=n.options,r={maxBuffer:mi,buffer:!0,stripFinalNewline:!0,extendEnv:!0,preferLocal:!1,localDir:r.cwd||K.cwd(),execPath:K.execPath,encoding:"utf8",reject:!0,cleanup:!0,all:!1,windowsHide:!0,...r},r.env=hi(r),r.stdio=Bu(r),K.platform==="win32"&&ee.basename(e,".exe")==="cmd"&&t.unshift("/q"),{file:e,args:t,options:r,parsed:n}},mt=(e,t,r)=>typeof t!="string"&&!xn.isBuffer(t)?r===void 0?void 0:"":e.stripFinalNewline?ou(t):t;function ue(e,t,r){const n=gi(e,t,r),s=pi(e,t),o=di(e,t);Ku(n.options);let u;try{u=Rt.spawn(n.file,n.args,n.options)}catch(p){const d=new Rt.ChildProcess,h=Promise.reject(_r({error:p,stdout:"",stderr:"",all:"",command:s,escapedCommand:o,parsed:n,timedOut:!1,isCanceled:!1,killed:!1}));return jr(d,h)}const a=ci(u),i=Uu(u,n.options,a),l=qu(u,n.options,i),f={isCanceled:!1};u.kill=Nu.bind(null,u.kill.bind(u)),u.cancel=Gu.bind(null,u,f);const D=Mr(async()=>{const[{error:p,exitCode:d,signal:h,timedOut:m},C,w,F]=await ui(u,n.options,l),P=mt(n.options,C),N=mt(n.options,w),V=mt(n.options,F);if(p||d!==0||h!==null){const A=_r({error:p,exitCode:d,signal:h,stdout:P,stderr:N,all:V,command:s,escapedCommand:o,parsed:n,timedOut:m,isCanceled:f.isCanceled||(n.options.signal?n.options.signal.aborted:!1),killed:u.killed});if(!n.options.reject)return A;throw A}return{command:s,escapedCommand:o,exitCode:0,stdout:P,stderr:N,all:V,failed:!1,timedOut:!1,isCanceled:!1,killed:!1}});return oi(u,n.options.input),u.all=si(u,n.options),jr(u,D)}class z{static create(t,r){return new t(r)}}const Ci=80,Ei={"":"<commit message>",conventional:"<type>(<optional scope>): <description>",gitmoji:":<emoji>: <description>"},Fi={"":"",conventional:"Example commit message => feat: add new disabled boolean variable to button",gitmoji:"Example commit message => :sparkles: Add a generic preset using configuration"},yi=(e="conventional")=>e===""?"":`The commit message must be in format:
28
+ ${Ei[e]}
29
+ ${Fi[e]}`,bi={"":"",gitmoji:`Choose a emoji from the emoji-to-description JSON below that best describes the git diff:
30
30
  ${JSON.stringify({":tada:":"Initial commit",":sparkles:":"Introduce new features",":bug:":"Fix a bug",":memo:":"Writing docs",":fire:":"Remove code or files",":art:":"Improve structure/format of the code commit",":zap:":"Improve performance",":lock:":"Fix security issues",":ambulance:":"Critical hotfix",":rocket:":"Deploy stuff",":lipstick:":"Add or update UI and style files",":construction:":"Work in progress",":green_heart:":"Fix CI build issues"},null,2)}`,conventional:`Choose a type from the type-to-description JSON below that best describes the git diff.
31
- ${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 CI configuration files, 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)}`},Z=(e,t,r,n="")=>["You are the expert programmer, trained to write commit messages. You are going to provide a professional git commit message.","Generate a concise git commit message written in present tense with the given specifications below:",`Message language: ${e}`,`Commit message must be a maximum of ${Math.min(Math.max(t,0),gi)} characters.`,`${n}`,"Exclude anything unnecessary such as explanation or translation. Your entire response will be passed directly into git commit.",yi[r],Fi(r)].filter(Boolean).join(`
32
- `),ie=e=>`THE RESULT MUST BE ${e} COMMIT MESSAGES AND MUST BE IN NUMBERED LIST FORMAT.`,Gr=e=>/(build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test)(\(.*\))?: .*$/.test(e),Hr=e=>/:\w*:/.test(e),H={OPEN_AI:"OPENAI_KEY",GEMINI:"GEMINI_KEY",ANTHROPIC:"ANTHROPIC_KEY",HUGGING:"HUGGING_COOKIE",CLOVA_X:"CLOVAX_COOKIE",MISTRAL:"MISTRAL_KEY",OLLAMA:"OLLAMA_MODEL",COHERE:"COHERE_KEY"},Ur=Object.values(H).map(e=>e);class Y{constructor(t){this.handleError$=r=>{let n="An error occurred";return r.message&&(n=r.message),j({name:`${this.errorPrefix} ${n}`,value:n,isError:!0,disabled:!0})},this.serviceName="AI",this.errorPrefix="ERROR",this.colors={primary:""}}buildPrompt(t,r,n,s,o,u){return`${Z(t,s,o,u)}
31
+ ${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 CI configuration files, 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)}`},Q=(e,t,r,n="")=>["You are the expert programmer, trained to write commit messages. You are going to provide a professional git commit message.","Generate a concise git commit message written in present tense with the given specifications below:",`Message language: ${e}`,`Commit message must be a maximum of ${Math.min(Math.max(t,0),Ci)} characters.`,`${n}`,"Exclude anything unnecessary such as explanation or translation. Your entire response will be passed directly into git commit.",bi[r],yi(r)].filter(Boolean).join(`
32
+ `),ie=e=>`THE RESULT MUST BE ${e} COMMIT MESSAGES AND MUST BE IN NUMBERED LIST FORMAT.`,Hr=e=>/(build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test)(\(.*\))?: .*$/.test(e),Ur=e=>/:\w*:/.test(e),_={OPEN_AI:"OPENAI_KEY",GEMINI:"GEMINI_KEY",ANTHROPIC:"ANTHROPIC_KEY",HUGGING:"HUGGING_COOKIE",CLOVA_X:"CLOVAX_COOKIE",MISTRAL:"MISTRAL_KEY",OLLAMA:"OLLAMA_MODEL",COHERE:"COHERE_KEY"},Kr=Object.values(_).map(e=>e);class Y{constructor(t){this.handleError$=r=>{let n="An error occurred";return r.message&&(n=r.message),G({name:`${this.errorPrefix} ${n}`,value:n,isError:!0,disabled:!0})},this.serviceName="AI",this.errorPrefix="ERROR",this.colors={primary:""}}buildPrompt(t,r,n,s,o,u){return`${Q(t,s,o,u)}
33
33
  ${ie(n)}
34
34
  Here are diff:
35
35
  ${r}`}sanitizeMessage(t,r,n){const s=t.split(`
36
- `).map(o=>o.trim().replace(/^\d+\.\s/,"")).map(o=>o.replace(/[`'"*]/g,"")).filter(o=>{switch(r){case"conventional":return Gr(o);case"gitmoji":return Hr(o);default:return!0}}).map(o=>{if(r==="conventional"){const u=/: (\w)/;return o.replace(u,(a,i)=>`: ${i.toLowerCase()}`)}return o}).filter(o=>!!o);return s.length>n?s.slice(0,n):s}}var Kr="1.9.4",bi="A Reactive CLI that generates git commit messages with various AI";class b extends Error{}const ht=" ",me=e=>{e instanceof Error&&(e instanceof b||(e.stack&&console.error(g.dim(e.stack.split(`
36
+ `).map(o=>o.trim().replace(/^\d+\.\s/,"")).map(o=>o.replace(/[`'"*]/g,"")).filter(o=>{switch(r){case"conventional":return Hr(o);case"gitmoji":return Ur(o);default:return!0}}).map(o=>{if(r==="conventional"){const u=/: (\w)/;return o.replace(u,(a,i)=>`: ${i.toLowerCase()}`)}return o}).filter(o=>!!o);return s.length>n?s.slice(0,n):s}}var qr="1.9.5",wi="A Reactive CLI that generates git commit messages with various AI";class b extends Error{}const ht=" ",he=e=>{e instanceof Error&&(e instanceof b||(e.stack&&console.error(g.dim(e.stack.split(`
37
37
  `).slice(1).join(`
38
38
  `))),console.error(`
39
- ${ht}${g.dim(`aicommit2 v${Kr}`)}`),console.error(`
40
- ${ht}Please open a Bug report with the information above:`),console.error(`${ht}https://github.com/tak-bro/aicommit2/issues/new/choose`)))},wi=(e,t)=>{const r=Math.ceil(e),n=Math.floor(t);return Math.floor(Math.random()*(n-r+1))+r};async function*qr(e){const t=await e;for await(const r of t)yield r}const he=(e,t)=>e.disabled&&!t.disabled?1:!e.disabled&&t.disabled?-1:0,O="done",zr="undone",Ai=(e,t,r=!1)=>{const n=e.indexOf(t);if(n!==-1){const s=r?t.length:0;return e.slice(0,n+s).trim()}return e},Yr=q.join(He.homedir(),".aicommit2_log"),vi=new Date,_=(e,t,r,n)=>{const s=`[${e} Response]`,o=$i(vi,t),u=`${Yr}/${o}`;if(V.existsSync(u)){const i=V.readFileSync(u,"utf-8");Wr(u,`${s}
39
+ ${ht}${g.dim(`aicommit2 v${qr}`)}`),console.error(`
40
+ ${ht}Please open a Bug report with the information above:`),console.error(`${ht}https://github.com/tak-bro/aicommit2/issues/new/choose`)))},zr=e=>e&&`${e[0].toUpperCase()}${e.slice(1)}`,Ai=(e,t)=>{const r=Math.ceil(e),n=Math.floor(t);return Math.floor(Math.random()*(n-r+1))+r};async function*Yr(e){const t=await e;for await(const r of t)yield r}const ge=(e,t)=>e.disabled&&!t.disabled?1:!e.disabled&&t.disabled?-1:0,O="done",Wr="undone",vi=(e,t,r=!1)=>{const n=e.indexOf(t);if(n!==-1){const s=r?t.length:0;return e.slice(0,n+s).trim()}return e},Vr=q.join(He.homedir(),".aicommit2_log"),$i=new Date,L=(e,t,r,n)=>{const s=`[${e} Response]`,o=Bi($i,t),u=`${Vr}/${o}`;if(X.existsSync(u)){const i=X.readFileSync(u,"utf-8");Xr(u,`${s}
41
41
  ${n}
42
42
 
43
- ${i}`);return}const a=Ai(r,"Here are diff");Wr(u,`${s}
43
+ ${i}`);return}const a=vi(r,"Here are diff");Xr(u,`${s}
44
44
  ${n}
45
45
 
46
46
 
@@ -49,31 +49,31 @@ ${a}
49
49
 
50
50
 
51
51
  [Git Diff]
52
- ${t}`)},$i=(e,t)=>{const{year:r,month:n,day:s,hours:o,minutes:u,seconds:a}=Bi(e),l=Ln(0).update(t).digest("hex");return`aic2_${r}-${n}-${s}_${o}:${u}:${a}_${l}.log`},Wr=(e,t="")=>{V.mkdirSync(q.dirname(e),{recursive:!0}),V.writeFileSync(e,t,"utf-8")},Bi=e=>{const t=e.getFullYear().toString(),r=(e.getMonth()+1).toString().padStart(2,"0"),n=e.getDate().toString().padStart(2,"0"),s=e.getHours().toString().padStart(2,"0"),o=e.getMinutes().toString().padStart(2,"0"),u=e.getSeconds().toString().padStart(2,"0");return{year:t,month:r,day:n,hours:s,minutes:o,seconds:u}};var gt={},Ct={exports:{}},ge={exports:{}},Et,Vr;function xi(){if(Vr)return Et;Vr=1;var e=1e3,t=e*60,r=t*60,n=r*24,s=n*7,o=n*365.25;Et=function(f,c){c=c||{};var D=typeof f;if(D==="string"&&f.length>0)return u(f);if(D==="number"&&isFinite(f))return c.long?i(f):a(f);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(f))};function u(f){if(f=String(f),!(f.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(f);if(c){var D=parseFloat(c[1]),p=(c[2]||"ms").toLowerCase();switch(p){case"years":case"year":case"yrs":case"yr":case"y":return D*o;case"weeks":case"week":case"w":return D*s;case"days":case"day":case"d":return D*n;case"hours":case"hour":case"hrs":case"hr":case"h":return D*r;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(f){var c=Math.abs(f);return c>=n?Math.round(f/n)+"d":c>=r?Math.round(f/r)+"h":c>=t?Math.round(f/t)+"m":c>=e?Math.round(f/e)+"s":f+"ms"}function i(f){var c=Math.abs(f);return c>=n?l(f,c,n,"day"):c>=r?l(f,c,r,"hour"):c>=t?l(f,c,t,"minute"):c>=e?l(f,c,e,"second"):f+" ms"}function l(f,c,D,p){var d=c>=D*1.5;return Math.round(f/D)+" "+p+(d?"s":"")}return Et}var Ft,Xr;function Jr(){if(Xr)return Ft;Xr=1;function e(t){n.debug=n,n.default=n,n.coerce=l,n.disable=u,n.enable=o,n.enabled=a,n.humanize=xi(),n.destroy=f,Object.keys(t).forEach(c=>{n[c]=t[c]}),n.names=[],n.skips=[],n.formatters={};function r(c){let D=0;for(let p=0;p<c.length;p++)D=(D<<5)-D+c.charCodeAt(p),D|=0;return n.colors[Math.abs(D)%n.colors.length]}n.selectColor=r;function n(c){let D,p=null,d,h;function m(...C){if(!m.enabled)return;const w=m,F=Number(new Date),M=F-(D||F);w.diff=M,w.prev=D,w.curr=F,D=F,C[0]=n.coerce(C[0]),typeof C[0]!="string"&&C.unshift("%O");let N=0;C[0]=C[0].replace(/%([a-zA-Z%])/g,(A,Le)=>{if(A==="%%")return"%";N++;const Lt=n.formatters[Le];if(typeof Lt=="function"){const An=C[N];A=Lt.call(w,An),C.splice(N,1),N--}return A}),n.formatArgs.call(w,C),(w.log||n.log).apply(w,C)}return m.namespace=c,m.useColors=n.useColors(),m.color=n.selectColor(c),m.extend=s,m.destroy=n.destroy,Object.defineProperty(m,"enabled",{enumerable:!0,configurable:!1,get:()=>p!==null?p:(d!==n.namespaces&&(d=n.namespaces,h=n.enabled(c)),h),set:C=>{p=C}}),typeof n.init=="function"&&n.init(m),m}function s(c,D){const p=n(this.namespace+(typeof D>"u"?":":D)+c);return p.log=this.log,p}function o(c){n.save(c),n.namespaces=c,n.names=[],n.skips=[];let D;const p=(typeof c=="string"?c:"").split(/[\s,]+/),d=p.length;for(D=0;D<d;D++)p[D]&&(c=p[D].replace(/\*/g,".*?"),c[0]==="-"?n.skips.push(new RegExp("^"+c.slice(1)+"$")):n.names.push(new RegExp("^"+c+"$")))}function u(){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,p;for(D=0,p=n.skips.length;D<p;D++)if(n.skips[D].test(c))return!1;for(D=0,p=n.names.length;D<p;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 l(c){return c instanceof Error?c.stack||c.message:c}function f(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return n.enable(n.load()),n}return Ft=e,Ft}ge.exports;var Zr;function Oi(){return Zr||(Zr=1,function(e,t){t.formatArgs=n,t.save=s,t.load=o,t.useColors=r,t.storage=u(),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 r(){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 l="color: "+this.color;i.splice(1,0,l,"color: inherit");let f=0,c=0;i[0].replace(/%[a-zA-Z%]/g,D=>{D!=="%%"&&(f++,D==="%c"&&(c=f))}),i.splice(c,0,l)}t.log=console.debug||console.log||(()=>{});function s(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 u(){try{return localStorage}catch{}}e.exports=Jr()(t);const{formatters:a}=e.exports;a.j=function(i){try{return JSON.stringify(i)}catch(l){return"[UnexpectedJSONParseError]: "+l.message}}}(ge,ge.exports)),ge.exports}var Ce={exports:{}},yt,Qr;function Si(){return Qr||(Qr=1,yt=(e,t=process.argv)=>{const r=e.startsWith("-")?"":e.length===1?"-":"--",n=t.indexOf(r+e),s=t.indexOf("--");return n!==-1&&(s===-1||n<s)}),yt}var bt,en;function Ii(){if(en)return bt;en=1;const e=He,t=Re,r=Si(),{env:n}=process;let s;r("no-color")||r("no-colors")||r("color=false")||r("color=never")?s=0:(r("color")||r("colors")||r("color=true")||r("color=always"))&&(s=1),"FORCE_COLOR"in n&&(n.FORCE_COLOR==="true"?s=1:n.FORCE_COLOR==="false"?s=0:s=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 u(i,l){if(s===0)return 0;if(r("color=16m")||r("color=full")||r("color=truecolor"))return 3;if(r("color=256"))return 2;if(i&&!l&&s===void 0)return 0;const f=s||0;if(n.TERM==="dumb")return f;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:f;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:f}function a(i){const l=u(i,i&&i.isTTY);return o(l)}return bt={supportsColor:a,stdout:o(u(!0,t.isatty(1))),stderr:o(u(!0,t.isatty(2)))},bt}Ce.exports;var tn;function Mi(){return tn||(tn=1,function(e,t){const r=Re,n=Ht;t.init=f,t.log=a,t.formatArgs=o,t.save=i,t.load=l,t.useColors=s,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=Ii();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,p)=>{const d=p.substring(6).toLowerCase().replace(/_([a-z])/g,(m,C)=>C.toUpperCase());let h=process.env[p];return/^(yes|on|true|enabled)$/i.test(h)?h=!0:/^(no|off|false|disabled)$/i.test(h)?h=!1:h==="null"?h=null:h=Number(h),D[d]=h,D},{});function s(){return"colors"in t.inspectOpts?!!t.inspectOpts.colors:r.isatty(process.stderr.fd)}function o(D){const{namespace:p,useColors:d}=this;if(d){const h=this.color,m="\x1B[3"+(h<8?h:"8;5;"+h),C=` ${m};1m${p} \x1B[0m`;D[0]=C+D[0].split(`
52
+ ${t}`)},Bi=(e,t)=>{const{year:r,month:n,day:s,hours:o,minutes:u,seconds:a}=xi(e),l=Rn(0).update(t).digest("hex");return`aic2_${r}-${n}-${s}_${o}:${u}:${a}_${l}.log`},Xr=(e,t="")=>{X.mkdirSync(q.dirname(e),{recursive:!0}),X.writeFileSync(e,t,"utf-8")},xi=e=>{const t=e.getFullYear().toString(),r=(e.getMonth()+1).toString().padStart(2,"0"),n=e.getDate().toString().padStart(2,"0"),s=e.getHours().toString().padStart(2,"0"),o=e.getMinutes().toString().padStart(2,"0"),u=e.getSeconds().toString().padStart(2,"0");return{year:t,month:r,day:n,hours:s,minutes:o,seconds:u}};var gt={},Ct={exports:{}},Ce={exports:{}},Et,Jr;function Oi(){if(Jr)return Et;Jr=1;var e=1e3,t=e*60,r=t*60,n=r*24,s=n*7,o=n*365.25;Et=function(f,c){c=c||{};var D=typeof f;if(D==="string"&&f.length>0)return u(f);if(D==="number"&&isFinite(f))return c.long?i(f):a(f);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(f))};function u(f){if(f=String(f),!(f.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(f);if(c){var D=parseFloat(c[1]),p=(c[2]||"ms").toLowerCase();switch(p){case"years":case"year":case"yrs":case"yr":case"y":return D*o;case"weeks":case"week":case"w":return D*s;case"days":case"day":case"d":return D*n;case"hours":case"hour":case"hrs":case"hr":case"h":return D*r;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(f){var c=Math.abs(f);return c>=n?Math.round(f/n)+"d":c>=r?Math.round(f/r)+"h":c>=t?Math.round(f/t)+"m":c>=e?Math.round(f/e)+"s":f+"ms"}function i(f){var c=Math.abs(f);return c>=n?l(f,c,n,"day"):c>=r?l(f,c,r,"hour"):c>=t?l(f,c,t,"minute"):c>=e?l(f,c,e,"second"):f+" ms"}function l(f,c,D,p){var d=c>=D*1.5;return Math.round(f/D)+" "+p+(d?"s":"")}return Et}var Ft,Zr;function Qr(){if(Zr)return Ft;Zr=1;function e(t){n.debug=n,n.default=n,n.coerce=l,n.disable=u,n.enable=o,n.enabled=a,n.humanize=Oi(),n.destroy=f,Object.keys(t).forEach(c=>{n[c]=t[c]}),n.names=[],n.skips=[],n.formatters={};function r(c){let D=0;for(let p=0;p<c.length;p++)D=(D<<5)-D+c.charCodeAt(p),D|=0;return n.colors[Math.abs(D)%n.colors.length]}n.selectColor=r;function n(c){let D,p=null,d,h;function m(...C){if(!m.enabled)return;const w=m,F=Number(new Date),P=F-(D||F);w.diff=P,w.prev=D,w.curr=F,D=F,C[0]=n.coerce(C[0]),typeof C[0]!="string"&&C.unshift("%O");let N=0;C[0]=C[0].replace(/%([a-zA-Z%])/g,(A,De)=>{if(A==="%%")return"%";N++;const Tt=n.formatters[De];if(typeof Tt=="function"){const $n=C[N];A=Tt.call(w,$n),C.splice(N,1),N--}return A}),n.formatArgs.call(w,C),(w.log||n.log).apply(w,C)}return m.namespace=c,m.useColors=n.useColors(),m.color=n.selectColor(c),m.extend=s,m.destroy=n.destroy,Object.defineProperty(m,"enabled",{enumerable:!0,configurable:!1,get:()=>p!==null?p:(d!==n.namespaces&&(d=n.namespaces,h=n.enabled(c)),h),set:C=>{p=C}}),typeof n.init=="function"&&n.init(m),m}function s(c,D){const p=n(this.namespace+(typeof D>"u"?":":D)+c);return p.log=this.log,p}function o(c){n.save(c),n.namespaces=c,n.names=[],n.skips=[];let D;const p=(typeof c=="string"?c:"").split(/[\s,]+/),d=p.length;for(D=0;D<d;D++)p[D]&&(c=p[D].replace(/\*/g,".*?"),c[0]==="-"?n.skips.push(new RegExp("^"+c.slice(1)+"$")):n.names.push(new RegExp("^"+c+"$")))}function u(){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,p;for(D=0,p=n.skips.length;D<p;D++)if(n.skips[D].test(c))return!1;for(D=0,p=n.names.length;D<p;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 l(c){return c instanceof Error?c.stack||c.message:c}function f(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return n.enable(n.load()),n}return Ft=e,Ft}Ce.exports;var en;function Mi(){return en||(en=1,function(e,t){t.formatArgs=n,t.save=s,t.load=o,t.useColors=r,t.storage=u(),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 r(){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 l="color: "+this.color;i.splice(1,0,l,"color: inherit");let f=0,c=0;i[0].replace(/%[a-zA-Z%]/g,D=>{D!=="%%"&&(f++,D==="%c"&&(c=f))}),i.splice(c,0,l)}t.log=console.debug||console.log||(()=>{});function s(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 u(){try{return localStorage}catch{}}e.exports=Qr()(t);const{formatters:a}=e.exports;a.j=function(i){try{return JSON.stringify(i)}catch(l){return"[UnexpectedJSONParseError]: "+l.message}}}(Ce,Ce.exports)),Ce.exports}var Ee={exports:{}},yt,tn;function Si(){return tn||(tn=1,yt=(e,t=process.argv)=>{const r=e.startsWith("-")?"":e.length===1?"-":"--",n=t.indexOf(r+e),s=t.indexOf("--");return n!==-1&&(s===-1||n<s)}),yt}var bt,rn;function Ii(){if(rn)return bt;rn=1;const e=He,t=Re,r=Si(),{env:n}=process;let s;r("no-color")||r("no-colors")||r("color=false")||r("color=never")?s=0:(r("color")||r("colors")||r("color=true")||r("color=always"))&&(s=1),"FORCE_COLOR"in n&&(n.FORCE_COLOR==="true"?s=1:n.FORCE_COLOR==="false"?s=0:s=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 u(i,l){if(s===0)return 0;if(r("color=16m")||r("color=full")||r("color=truecolor"))return 3;if(r("color=256"))return 2;if(i&&!l&&s===void 0)return 0;const f=s||0;if(n.TERM==="dumb")return f;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:f;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:f}function a(i){const l=u(i,i&&i.isTTY);return o(l)}return bt={supportsColor:a,stdout:o(u(!0,t.isatty(1))),stderr:o(u(!0,t.isatty(2)))},bt}Ee.exports;var nn;function Pi(){return nn||(nn=1,function(e,t){const r=Re,n=Ht;t.init=f,t.log=a,t.formatArgs=o,t.save=i,t.load=l,t.useColors=s,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=Ii();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,p)=>{const d=p.substring(6).toLowerCase().replace(/_([a-z])/g,(m,C)=>C.toUpperCase());let h=process.env[p];return/^(yes|on|true|enabled)$/i.test(h)?h=!0:/^(no|off|false|disabled)$/i.test(h)?h=!1:h==="null"?h=null:h=Number(h),D[d]=h,D},{});function s(){return"colors"in t.inspectOpts?!!t.inspectOpts.colors:r.isatty(process.stderr.fd)}function o(D){const{namespace:p,useColors:d}=this;if(d){const h=this.color,m="\x1B[3"+(h<8?h:"8;5;"+h),C=` ${m};1m${p} \x1B[0m`;D[0]=C+D[0].split(`
53
53
  `).join(`
54
54
  `+C),D.push(m+"m+"+e.exports.humanize(this.diff)+"\x1B[0m")}else D[0]=u()+p+" "+D[0]}function u(){return t.inspectOpts.hideDate?"":new Date().toISOString()+" "}function a(...D){return process.stderr.write(n.format(...D)+`
55
- `)}function i(D){D?process.env.DEBUG=D:delete process.env.DEBUG}function l(){return process.env.DEBUG}function f(D){D.inspectOpts={};const p=Object.keys(t.inspectOpts);for(let d=0;d<p.length;d++)D.inspectOpts[p[d]]=t.inspectOpts[p[d]]}e.exports=Jr()(t);const{formatters:c}=e.exports;c.o=function(D){return this.inspectOpts.colors=this.useColors,n.inspect(D,this.inspectOpts).split(`
56
- `).map(p=>p.trim()).join(" ")},c.O=function(D){return this.inspectOpts.colors=this.useColors,n.inspect(D,this.inspectOpts)}}(Ce,Ce.exports)),Ce.exports}typeof process>"u"||process.type==="renderer"||process.browser===!0||process.__nwjs?Ct.exports=Oi():Ct.exports=Mi();var wt=Ct.exports,At={};Object.defineProperty(At,"__esModule",{value:!0});function Pi(e){return function(t,r){return new Promise((n,s)=>{e.call(this,t,r,(o,u)=>{o?s(o):n(u)})})}}At.default=Pi;var rn=v&&v.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};const _i=Gt,Ni=rn(wt),Ti=rn(At),Ee=Ni.default("agent-base");function Li(e){return!!e&&typeof e.addRequest=="function"}function vt(){const{stack:e}=new Error;return typeof e!="string"?!1:e.split(`
57
- `).some(t=>t.indexOf("(https.js:")!==-1||t.indexOf("node:https:")!==-1)}function Pe(e,t){return new Pe.Agent(e,t)}(function(e){class t extends _i.EventEmitter{constructor(n,s){super();let o=s;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:vt()?443:80}set defaultPort(n){this.explicitDefaultPort=n}get protocol(){return typeof this.explicitProtocol=="string"?this.explicitProtocol:vt()?"https:":"http:"}set protocol(n){this.explicitProtocol=n}callback(n,s,o){throw new Error('"agent-base" has no default implementation, you must subclass and override `callback()`')}addRequest(n,s){const o=Object.assign({},s);typeof o.secureEndpoint!="boolean"&&(o.secureEndpoint=vt()),o.host==null&&(o.host="localhost"),o.port==null&&(o.port=o.secureEndpoint?443:80),o.protocol==null&&(o.protocol=o.secureEndpoint?"https:":"http:"),o.host&&o.path&&delete o.path,delete o.agent,delete o.hostname,delete o._defaultAgent,delete o.defaultPort,delete o.createConnection,n._last=!0,n.shouldKeepAlive=!1;let u=!1,a=null;const i=o.timeout||this.timeout,l=p=>{n._hadError||(n.emit("error",p),n._hadError=!0)},f=()=>{a=null,u=!0;const p=new Error(`A "socket" was not created for HTTP request before ${i}ms`);p.code="ETIMEOUT",l(p)},c=p=>{u||(a!==null&&(clearTimeout(a),a=null),l(p))},D=p=>{if(u)return;if(a!=null&&(clearTimeout(a),a=null),Li(p)){Ee("Callback returned another Agent instance %o",p.constructor.name),p.addRequest(n,o);return}if(p){p.once("free",()=>{this.freeSocket(p,o)}),n.onSocket(p);return}const d=new Error(`no Duplex stream was returned to agent-base for \`${n.method} ${n.path}\``);l(d)};if(typeof this.callback!="function"){l(new Error("`callback` is not defined"));return}this.promisifiedCallback||(this.callback.length>=3?(Ee("Converting legacy callback function to promise"),this.promisifiedCallback=Ti.default(this.callback)):this.promisifiedCallback=this.callback),typeof i=="number"&&i>0&&(a=setTimeout(f,i)),"port"in o&&typeof o.port!="number"&&(o.port=Number(o.port));try{Ee("Resolving socket for %o request: %o",o.protocol,`${n.method} ${n.path}`),Promise.resolve(this.promisifiedCallback(n,o)).then(D,c)}catch(p){Promise.reject(p).catch(c)}}freeSocket(n,s){Ee("Freeing socket %o %o",n.constructor.name,s),n.destroy()}destroy(){Ee("Destroying agent %o",this.constructor.name)}}e.Agent=t,e.prototype=e.Agent.prototype})(Pe||(Pe={}));var Ri=Pe,$t={},ki=v&&v.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty($t,"__esModule",{value:!0});const ji=ki(wt),Fe=ji.default("https-proxy-agent:parse-proxy-response");function Gi(e){return new Promise((t,r)=>{let n=0;const s=[];function o(){const c=e.read();c?f(c):e.once("readable",o)}function u(){e.removeListener("end",i),e.removeListener("error",l),e.removeListener("close",a),e.removeListener("readable",o)}function a(c){Fe("onclose had error %o",c)}function i(){Fe("onend")}function l(c){u(),Fe("onerror %o",c),r(c)}function f(c){s.push(c),n+=c.length;const D=Buffer.concat(s,n);if(D.indexOf(`\r
55
+ `)}function i(D){D?process.env.DEBUG=D:delete process.env.DEBUG}function l(){return process.env.DEBUG}function f(D){D.inspectOpts={};const p=Object.keys(t.inspectOpts);for(let d=0;d<p.length;d++)D.inspectOpts[p[d]]=t.inspectOpts[p[d]]}e.exports=Qr()(t);const{formatters:c}=e.exports;c.o=function(D){return this.inspectOpts.colors=this.useColors,n.inspect(D,this.inspectOpts).split(`
56
+ `).map(p=>p.trim()).join(" ")},c.O=function(D){return this.inspectOpts.colors=this.useColors,n.inspect(D,this.inspectOpts)}}(Ee,Ee.exports)),Ee.exports}typeof process>"u"||process.type==="renderer"||process.browser===!0||process.__nwjs?Ct.exports=Mi():Ct.exports=Pi();var wt=Ct.exports,At={};Object.defineProperty(At,"__esModule",{value:!0});function _i(e){return function(t,r){return new Promise((n,s)=>{e.call(this,t,r,(o,u)=>{o?s(o):n(u)})})}}At.default=_i;var on=v&&v.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};const Li=Gt,Ni=on(wt),Ti=on(At),Fe=Ni.default("agent-base");function Ri(e){return!!e&&typeof e.addRequest=="function"}function vt(){const{stack:e}=new Error;return typeof e!="string"?!1:e.split(`
57
+ `).some(t=>t.indexOf("(https.js:")!==-1||t.indexOf("node:https:")!==-1)}function _e(e,t){return new _e.Agent(e,t)}(function(e){class t extends Li.EventEmitter{constructor(n,s){super();let o=s;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:vt()?443:80}set defaultPort(n){this.explicitDefaultPort=n}get protocol(){return typeof this.explicitProtocol=="string"?this.explicitProtocol:vt()?"https:":"http:"}set protocol(n){this.explicitProtocol=n}callback(n,s,o){throw new Error('"agent-base" has no default implementation, you must subclass and override `callback()`')}addRequest(n,s){const o=Object.assign({},s);typeof o.secureEndpoint!="boolean"&&(o.secureEndpoint=vt()),o.host==null&&(o.host="localhost"),o.port==null&&(o.port=o.secureEndpoint?443:80),o.protocol==null&&(o.protocol=o.secureEndpoint?"https:":"http:"),o.host&&o.path&&delete o.path,delete o.agent,delete o.hostname,delete o._defaultAgent,delete o.defaultPort,delete o.createConnection,n._last=!0,n.shouldKeepAlive=!1;let u=!1,a=null;const i=o.timeout||this.timeout,l=p=>{n._hadError||(n.emit("error",p),n._hadError=!0)},f=()=>{a=null,u=!0;const p=new Error(`A "socket" was not created for HTTP request before ${i}ms`);p.code="ETIMEOUT",l(p)},c=p=>{u||(a!==null&&(clearTimeout(a),a=null),l(p))},D=p=>{if(u)return;if(a!=null&&(clearTimeout(a),a=null),Ri(p)){Fe("Callback returned another Agent instance %o",p.constructor.name),p.addRequest(n,o);return}if(p){p.once("free",()=>{this.freeSocket(p,o)}),n.onSocket(p);return}const d=new Error(`no Duplex stream was returned to agent-base for \`${n.method} ${n.path}\``);l(d)};if(typeof this.callback!="function"){l(new Error("`callback` is not defined"));return}this.promisifiedCallback||(this.callback.length>=3?(Fe("Converting legacy callback function to promise"),this.promisifiedCallback=Ti.default(this.callback)):this.promisifiedCallback=this.callback),typeof i=="number"&&i>0&&(a=setTimeout(f,i)),"port"in o&&typeof o.port!="number"&&(o.port=Number(o.port));try{Fe("Resolving socket for %o request: %o",o.protocol,`${n.method} ${n.path}`),Promise.resolve(this.promisifiedCallback(n,o)).then(D,c)}catch(p){Promise.reject(p).catch(c)}}freeSocket(n,s){Fe("Freeing socket %o %o",n.constructor.name,s),n.destroy()}destroy(){Fe("Destroying agent %o",this.constructor.name)}}e.Agent=t,e.prototype=e.Agent.prototype})(_e||(_e={}));var ki=_e,$t={},ji=v&&v.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty($t,"__esModule",{value:!0});const Gi=ji(wt),ye=Gi.default("https-proxy-agent:parse-proxy-response");function Hi(e){return new Promise((t,r)=>{let n=0;const s=[];function o(){const c=e.read();c?f(c):e.once("readable",o)}function u(){e.removeListener("end",i),e.removeListener("error",l),e.removeListener("close",a),e.removeListener("readable",o)}function a(c){ye("onclose had error %o",c)}function i(){ye("onend")}function l(c){u(),ye("onerror %o",c),r(c)}function f(c){s.push(c),n+=c.length;const D=Buffer.concat(s,n);if(D.indexOf(`\r
58
58
  \r
59
- `)===-1){Fe("have not received end of HTTP headers yet..."),o();return}const d=D.toString("ascii",0,D.indexOf(`\r
60
- `)),h=+d.split(" ")[1];Fe("got proxy server response: %o",d),t({statusCode:h,buffered:D})}e.on("error",l),e.on("close",a),e.on("end",i),o()})}$t.default=Gi;var Hi=v&&v.__awaiter||function(e,t,r,n){function s(o){return o instanceof r?o:new r(function(u){u(o)})}return new(r||(r=Promise))(function(o,u){function a(f){try{l(n.next(f))}catch(c){u(c)}}function i(f){try{l(n.throw(f))}catch(c){u(c)}}function l(f){f.done?o(f.value):s(f.value).then(a,i)}l((n=n.apply(e,t||[])).next())})},ae=v&&v.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(gt,"__esModule",{value:!0});const nn=ae(jn),on=ae(Gn),Ui=ae(Hn),Ki=ae(jt),qi=ae(wt),zi=Ri,Yi=ae($t),ye=qi.default("https-proxy-agent:agent");class Wi extends zi.Agent{constructor(t){let r;if(typeof t=="string"?r=Ui.default.parse(t):r=t,!r)throw new Error("an HTTP(S) proxy server `host` and `port` must be specified!");ye("creating new HttpsProxyAgent instance: %o",r),super(r);const n=Object.assign({},r);this.secureProxy=r.secureProxy||Ji(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,r){return Hi(this,void 0,void 0,function*(){const{proxy:n,secureProxy:s}=this;let o;s?(ye("Creating `tls.Socket`: %o",n),o=on.default.connect(n)):(ye("Creating `net.Socket`: %o",n),o=nn.default.connect(n));const u=Object.assign({},n.headers);let i=`CONNECT ${`${r.host}:${r.port}`} HTTP/1.1\r
61
- `;n.auth&&(u["Proxy-Authorization"]=`Basic ${Buffer.from(n.auth).toString("base64")}`);let{host:l,port:f,secureEndpoint:c}=r;Xi(f,c)||(l+=`:${f}`),u.Host=l,u.Connection="close";for(const m of Object.keys(u))i+=`${m}: ${u[m]}\r
62
- `;const D=Yi.default(o);o.write(`${i}\r
63
- `);const{statusCode:p,buffered:d}=yield D;if(p===200){if(t.once("socket",Vi),r.secureEndpoint){ye("Upgrading socket connection to TLS");const m=r.servername||r.host;return on.default.connect(Object.assign(Object.assign({},Zi(r,"host","hostname","path","port")),{socket:o,servername:m}))}return o}o.destroy();const h=new nn.default.Socket({writable:!1});return h.readable=!0,t.once("socket",m=>{ye("replaying proxy buffer for failed request"),Ki.default(m.listenerCount("data")>0),m.push(d),m.push(null)}),h})}}gt.default=Wi;function Vi(e){e.resume()}function Xi(e,t){return!!(!t&&e===80||t&&e===443)}function Ji(e){return typeof e=="string"?/^https:?$/i.test(e):!1}function Zi(e,...t){const r={};let n;for(n in e)t.includes(n)||(r[n]=e[n]);return r}var Qi=v&&v.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};const Bt=Qi(gt);function xt(e){return new Bt.default(e)}(function(e){e.HttpsProxyAgent=Bt.default,e.prototype=Bt.default.prototype})(xt||(xt={}));var ea=xt,ta=te(ea);const ra=async(e,t,r,n,s,o,u)=>new Promise((a,i)=>{const l=JSON.stringify(n),c=(e.protocol.includes("https")?kn:Rn).request({port:u||void 0,hostname:e.hostname,path:t,method:"POST",headers:{"Content-Type":"application/json","Content-Length":Buffer.byteLength(l),...r},timeout:s,agent:o?ta(o):void 0},D=>{const p=[];D.on("data",d=>p.push(d)),D.on("end",()=>{a({request:c,response:D,data:Buffer.concat(p).toString()})})});c.on("error",i),c.on("timeout",()=>{c.destroy(),i(new b(`Time out error: request took over ${s}ms. Try increasing the \`timeout\` config`))}),c.write(l),c.end()}),na=async(e,t,r,n,s,o)=>{const u=new URL(e),{response:a,data:i}=await ra(u,t,{Authorization:`Bearer ${r}`},n,s,o);if(!a.statusCode||a.statusCode<200||a.statusCode>299){let l=`OpenAI API Error: ${a.statusCode} - ${a.statusMessage}`;throw i&&(l+=`
59
+ `)===-1){ye("have not received end of HTTP headers yet..."),o();return}const d=D.toString("ascii",0,D.indexOf(`\r
60
+ `)),h=+d.split(" ")[1];ye("got proxy server response: %o",d),t({statusCode:h,buffered:D})}e.on("error",l),e.on("close",a),e.on("end",i),o()})}$t.default=Hi;var Ui=v&&v.__awaiter||function(e,t,r,n){function s(o){return o instanceof r?o:new r(function(u){u(o)})}return new(r||(r=Promise))(function(o,u){function a(f){try{l(n.next(f))}catch(c){u(c)}}function i(f){try{l(n.throw(f))}catch(c){u(c)}}function l(f){f.done?o(f.value):s(f.value).then(a,i)}l((n=n.apply(e,t||[])).next())})},ae=v&&v.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(gt,"__esModule",{value:!0});const sn=ae(Gn),un=ae(Hn),Ki=ae(Un),qi=ae(jt),zi=ae(wt),Yi=ki,Wi=ae($t),be=zi.default("https-proxy-agent:agent");class Vi extends Yi.Agent{constructor(t){let r;if(typeof t=="string"?r=Ki.default.parse(t):r=t,!r)throw new Error("an HTTP(S) proxy server `host` and `port` must be specified!");be("creating new HttpsProxyAgent instance: %o",r),super(r);const n=Object.assign({},r);this.secureProxy=r.secureProxy||Zi(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,r){return Ui(this,void 0,void 0,function*(){const{proxy:n,secureProxy:s}=this;let o;s?(be("Creating `tls.Socket`: %o",n),o=un.default.connect(n)):(be("Creating `net.Socket`: %o",n),o=sn.default.connect(n));const u=Object.assign({},n.headers);let i=`CONNECT ${`${r.host}:${r.port}`} HTTP/1.1\r
61
+ `;n.auth&&(u["Proxy-Authorization"]=`Basic ${Buffer.from(n.auth).toString("base64")}`);let{host:l,port:f,secureEndpoint:c}=r;Ji(f,c)||(l+=`:${f}`),u.Host=l,u.Connection="close";for(const m of Object.keys(u))i+=`${m}: ${u[m]}\r
62
+ `;const D=Wi.default(o);o.write(`${i}\r
63
+ `);const{statusCode:p,buffered:d}=yield D;if(p===200){if(t.once("socket",Xi),r.secureEndpoint){be("Upgrading socket connection to TLS");const m=r.servername||r.host;return un.default.connect(Object.assign(Object.assign({},Qi(r,"host","hostname","path","port")),{socket:o,servername:m}))}return o}o.destroy();const h=new sn.default.Socket({writable:!1});return h.readable=!0,t.once("socket",m=>{be("replaying proxy buffer for failed request"),qi.default(m.listenerCount("data")>0),m.push(d),m.push(null)}),h})}}gt.default=Vi;function Xi(e){e.resume()}function Ji(e,t){return!!(!t&&e===80||t&&e===443)}function Zi(e){return typeof e=="string"?/^https:?$/i.test(e):!1}function Qi(e,...t){const r={};let n;for(n in e)t.includes(n)||(r[n]=e[n]);return r}var ea=v&&v.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};const Bt=ea(gt);function xt(e){return new Bt.default(e)}(function(e){e.HttpsProxyAgent=Bt.default,e.prototype=Bt.default.prototype})(xt||(xt={}));var ta=xt,ra=te(ta);const na=async(e,t,r,n,s,o,u)=>new Promise((a,i)=>{const l=JSON.stringify(n),c=(e.protocol.includes("https")?jn:kn).request({port:u||void 0,hostname:e.hostname,path:t,method:"POST",headers:{"Content-Type":"application/json","Content-Length":Buffer.byteLength(l),...r},timeout:s,agent:o?ra(o):void 0},D=>{const p=[];D.on("data",d=>p.push(d)),D.on("end",()=>{a({request:c,response:D,data:Buffer.concat(p).toString()})})});c.on("error",i),c.on("timeout",()=>{c.destroy(),i(new b(`Time out error: request took over ${s}ms. Try increasing the \`timeout\` config`))}),c.write(l),c.end()}),oa=async(e,t,r,n,s,o)=>{const u=new URL(e),{response:a,data:i}=await na(u,t,{Authorization:`Bearer ${r}`},n,s,o);if(!a.statusCode||a.statusCode<200||a.statusCode>299){let l=`OpenAI API Error: ${a.statusCode} - ${a.statusMessage}`;throw i&&(l+=`
64
64
 
65
65
  ${i}`),a.statusCode===500&&(l+=`
66
66
 
67
- Check the API status: https://status.openai.com`),new b(l)}return JSON.parse(i)},sn=e=>e.trim().replace(/[\n\r]/g,"").replace(/(\w)\.$/,"$1"),k=e=>Array.from(new Set(e)),oa=async(e,t,r,n,s,o,u,a,i,l,f,c,D,p,d)=>{try{const h=Z(s,a,i,D),m=await na(e,t,r,{model:n,messages:[{role:"system",content:h},{role:"user",content:o}],temperature:c,top_p:1,frequency_penalty:0,presence_penalty:0,max_tokens:f,stream:!1,n:u},l,d),C=k(m.choices.filter(F=>F.message?.content).map(F=>sn(F.message.content)).map(F=>{if(i==="conventional"){const M=/: (\w)/;return F.replace(M,(N,W)=>`: ${W.toLowerCase()}`)}return F}).filter(F=>{switch(i){case"gitmoji":return Hr(F);case"conventional":return Gr(F);case"":default:return!0}})),w=m.choices.filter(F=>F.message?.content).map(F=>sn(F.message.content)).join();return p&&_("OPEN AI",o,h,w),C}catch(h){const m=h;throw m.code==="ENOTFOUND"?new b(`Error connecting to ${m.hostname} (${m.syscall})`):m}};class sa extends Y{constructor(t){super(t),this.params=t,this.handleError$=r=>{const n=r.error?.error?.message?.replace(/(\r\n|\n|\r)/gm,"")||"An error occurred";return j({name:`${this.errorPrefix} ${n}`,value:n,isError:!0,disabled:!0})},this.generateStreamChoice$=()=>{const r=this.params.stagedDiff.diff,{locale:n,generate:s,type:o,prompt:u}=this.params.config,a=this.params.config["max-length"],l=`${Z(n,a,o,u)}
68
- ${ie(s)}`,f={max_tokens:this.params.config["max-tokens"],temperature:this.params.config.temperature,system:l,messages:[{role:"user",content:r}],model:this.params.config.ANTHROPIC_MODEL,stream:!0},c=this.anthropic.messages.create(f);let D="";return P(qr(c)).pipe(Ut(p=>["content_block_delta","message_stop"].includes(p.type)),I(p=>p),Kt(p=>{p.type==="content_block_delta"&&(D+=p.delta.text)}),I(p=>{const d=p.type==="message_stop";return{id:this.params.keyName,name:`${this.serviceName} ${D}`,value:`${D}`,isError:!1,description:d?O:zr,disabled:!d}}))},this.colors={primary:"#AE5630",secondary:"#fff"},this.serviceName=g.bgHex(this.colors.primary).hex(this.colors.secondary).bold("[Anthropic]"),this.errorPrefix=g.red.bold("[Anthropic]"),this.anthropic=new Tn({apiKey:this.params.config.ANTHROPIC_KEY})}generateCommitMessage$(){return G(this.generateMessage()).pipe(T(t=>P(t)),I(t=>({name:`${this.serviceName} ${t}`,value:t,isError:!1})),L(this.handleError$))}async generateMessage(){try{const t=this.params.stagedDiff.diff,{locale:r,generate:n,type:s,prompt:o,logging:u}=this.params.config,a=this.params.config["max-length"],l=`${Z(r,a,s,o)}
69
- ${ie(n)}`,f={max_tokens:this.params.config["max-tokens"],temperature:this.params.config.temperature,system:l,messages:[{role:"user",content:t}],model:this.params.config.ANTHROPIC_MODEL},D=(await this.anthropic.messages.create(f)).content.map(({text:p})=>p).join("");return u&&_("Anthropic",t,l,D),k(this.sanitizeMessage(D,this.params.config.type,n))}catch(t){const r=t;throw r.code==="ENOTFOUND"?new b(`Error connecting to ${r.hostname} (${r.syscall})`):r}}generateStreamCommitMessage$(){return this.generateStreamChoice$().pipe(qt((t,r)=>{if(r.description===O){const o=k(this.sanitizeMessage(r.value,this.params.config.type,this.params.config.generate)),u=this.params.stagedDiff.diff,{locale:a,generate:i,type:l,prompt:f,logging:c}=this.params.config,D=this.params.config["max-length"],d=`${Z(a,D,l,f)}
70
- ${ie(i)}`;return c&&_("Anthropic",u,d,r.value),!o||o.length===0?[{id:`${this.params.keyName}_${O}_0`,name:`${this.serviceName} Failed to extract messages from response`,value:"Failed to extract messages from response",isError:!0,description:O,disabled:!0}]:o.map((m,C)=>({id:`${this.params.keyName}_${O}_${C}`,name:`${this.serviceName} ${m}`,value:`${m}`,isError:!1,description:O,disabled:!1}))}return t.find(o=>o.id===r.id)?[...t.map(o=>r.id===o.id?r:o)]:[{...r}]},[]),T(t=>t),L(this.handleError$))}}const{hasOwnProperty:Ot}=Object.prototype,_e=typeof process<"u"&&process.platform==="win32"?`\r
67
+ Check the API status: https://status.openai.com`),new b(l)}return JSON.parse(i)},an=e=>e.trim().replace(/[\n\r]/g,"").replace(/(\w)\.$/,"$1"),j=e=>Array.from(new Set(e)),sa=async(e,t,r,n,s,o,u,a,i,l,f,c,D,p,d)=>{try{const h=Q(s,a,i,D),m=await oa(e,t,r,{model:n,messages:[{role:"system",content:h},{role:"user",content:o}],temperature:c,top_p:1,frequency_penalty:0,presence_penalty:0,max_tokens:f,stream:!1,n:u},l,d),C=j(m.choices.filter(F=>F.message?.content).map(F=>an(F.message.content)).map(F=>{if(i==="conventional"){const P=/: (\w)/;return F.replace(P,(N,V)=>`: ${V.toLowerCase()}`)}return F}).filter(F=>{switch(i){case"gitmoji":return Ur(F);case"conventional":return Hr(F);case"":default:return!0}})),w=m.choices.filter(F=>F.message?.content).map(F=>an(F.message.content)).join();return p&&L("OPEN AI",o,h,w),C}catch(h){const m=h;throw m.code==="ENOTFOUND"?new b(`Error connecting to ${m.hostname} (${m.syscall})`):m}};class ua extends Y{constructor(t){super(t),this.params=t,this.handleError$=r=>{const n=r.error?.error?.message?.replace(/(\r\n|\n|\r)/gm,"")||"An error occurred";return G({name:`${this.errorPrefix} ${n}`,value:n,isError:!0,disabled:!0})},this.generateStreamChoice$=()=>{const r=this.params.stagedDiff.diff,{locale:n,generate:s,type:o,prompt:u}=this.params.config,a=this.params.config["max-length"],l=`${Q(n,a,o,u)}
68
+ ${ie(s)}`,f={max_tokens:this.params.config["max-tokens"],temperature:this.params.config.temperature,system:l,messages:[{role:"user",content:r}],model:this.params.config.ANTHROPIC_MODEL,stream:!0},c=this.anthropic.messages.create(f);let D="";return S(Yr(c)).pipe(Ut(p=>["content_block_delta","message_stop"].includes(p.type)),I(p=>p),Kt(p=>{p.type==="content_block_delta"&&(D+=p.delta.text)}),I(p=>{const d=p.type==="message_stop";return{id:this.params.keyName,name:`${this.serviceName} ${D}`,value:`${D}`,isError:!1,description:d?O:Wr,disabled:!d}}))},this.colors={primary:"#AE5630",secondary:"#fff"},this.serviceName=g.bgHex(this.colors.primary).hex(this.colors.secondary).bold("[Anthropic]"),this.errorPrefix=g.red.bold("[Anthropic]"),this.anthropic=new Tn({apiKey:this.params.config.ANTHROPIC_KEY})}generateCommitMessage$(){return H(this.generateMessage()).pipe(T(t=>S(t)),I(t=>({name:`${this.serviceName} ${t}`,value:t,isError:!1})),R(this.handleError$))}async generateMessage(){try{const t=this.params.stagedDiff.diff,{locale:r,generate:n,type:s,prompt:o,logging:u}=this.params.config,a=this.params.config["max-length"],l=`${Q(r,a,s,o)}
69
+ ${ie(n)}`,f={max_tokens:this.params.config["max-tokens"],temperature:this.params.config.temperature,system:l,messages:[{role:"user",content:t}],model:this.params.config.ANTHROPIC_MODEL},D=(await this.anthropic.messages.create(f)).content.map(({text:p})=>p).join("");return u&&L("Anthropic",t,l,D),j(this.sanitizeMessage(D,this.params.config.type,n))}catch(t){const r=t;throw r.code==="ENOTFOUND"?new b(`Error connecting to ${r.hostname} (${r.syscall})`):r}}generateStreamCommitMessage$(){return this.generateStreamChoice$().pipe(qt((t,r)=>{if(r.description===O){const o=j(this.sanitizeMessage(r.value,this.params.config.type,this.params.config.generate)),u=this.params.stagedDiff.diff,{locale:a,generate:i,type:l,prompt:f,logging:c}=this.params.config,D=this.params.config["max-length"],d=`${Q(a,D,l,f)}
70
+ ${ie(i)}`;return c&&L("Anthropic",u,d,r.value),!o||o.length===0?[{id:`${this.params.keyName}_${O}_0`,name:`${this.serviceName} Failed to extract messages from response`,value:"Failed to extract messages from response",isError:!0,description:O,disabled:!0}]:o.map((m,C)=>({id:`${this.params.keyName}_${O}_${C}`,name:`${this.serviceName} ${m}`,value:`${m}`,isError:!1,description:O,disabled:!1}))}return t.find(o=>o.id===r.id)?[...t.map(o=>r.id===o.id?r:o)]:[{...r}]},[]),T(t=>t),R(this.handleError$))}}const{hasOwnProperty:Ot}=Object.prototype,Le=typeof process<"u"&&process.platform==="win32"?`\r
71
71
  `:`
72
- `,St=(e,t)=>{const r=[];let n="";typeof t=="string"?t={section:t,whitespace:!1}:(t=t||Object.create(null),t.whitespace=t.whitespace===!0);const s=t.whitespace?" = ":"=";for(const o of Object.keys(e)){const u=e[o];if(u&&Array.isArray(u))for(const a of u)n+=ce(o+"[]")+s+ce(a)+_e;else u&&typeof u=="object"?r.push(o):n+=ce(o)+s+ce(u)+_e}t.section&&n.length&&(n="["+ce(t.section)+"]"+_e+n);for(const o of r){const u=un(o).join("\\."),a=(t.section?t.section+".":"")+u,{whitespace:i}=t,l=St(e[o],{section:a,whitespace:i});n.length&&l.length&&(n+=_e),n+=l}return n},un=e=>e.replace(/\1/g,"LITERAL\\1LITERAL").replace(/\\\./g,"").split(/\./).map(t=>t.replace(/\1/g,"\\.").replace(/\2LITERAL\\1LITERAL\2/g,"")),an=e=>{const t=Object.create(null);let r=t,n=null;const s=/^\[([^\]]*)\]$|^([^=]+)(=(.*))?$/i,o=e.split(/[\r\n]+/g);for(const a of o){if(!a||a.match(/^\s*[;#]/))continue;const i=a.match(s);if(!i)continue;if(i[1]!==void 0){if(n=Ne(i[1]),n==="__proto__"){r=Object.create(null);continue}r=t[n]=t[n]||Object.create(null);continue}const l=Ne(i[2]),f=l.length>2&&l.slice(-2)==="[]",c=f?l.slice(0,-2):l;if(c==="__proto__")continue;const D=i[3]?Ne(i[4]):!0,p=D==="true"||D==="false"||D==="null"?JSON.parse(D):D;f&&(Ot.call(r,c)?Array.isArray(r[c])||(r[c]=[r[c]]):r[c]=[]),Array.isArray(r[c])?r[c].push(p):r[c]=p}const u=[];for(const a of Object.keys(t)){if(!Ot.call(t,a)||typeof t[a]!="object"||Array.isArray(t[a]))continue;const i=un(a);r=t;const l=i.pop(),f=l.replace(/\\\./g,".");for(const c of i)c!=="__proto__"&&((!Ot.call(r,c)||typeof r[c]!="object")&&(r[c]=Object.create(null)),r=r[c]);r===t&&f===l||(r[f]=t[a],u.push(a))}for(const a of u)delete t[a];return t},cn=e=>e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'"),ce=e=>typeof e!="string"||e.match(/[=\r\n]/)||e.match(/^\[/)||e.length>1&&cn(e)||e!==e.trim()?JSON.stringify(e):e.split(";").join("\\;").split("#").join("\\#"),Ne=(e,t)=>{if(e=(e||"").trim(),cn(e)){e.charAt(0)==="'"&&(e=e.slice(1,-1));try{e=JSON.parse(e)}catch{}}else{let r=!1,n="";for(let s=0,o=e.length;s<o;s++){const u=e.charAt(s);if(r)"\\;#".indexOf(u)!==-1?n+=u:n+="\\"+u,r=!1;else{if(";#".indexOf(u)!==-1)break;u==="\\"?r=!0:n+=u}}return r&&(n+="\\"),n.trim()}return e};var ua={parse:an,decode:an,stringify:St,encode:St,safe:ce,unsafe:Ne},Dn=te(ua);const ln=e=>x.lstat(e).then(()=>!0,()=>!1),ia=["","conventional","gitmoji"],It="http://localhost:11434",{hasOwnProperty:aa}=Object.prototype,Q=(e,t)=>aa.call(e,t),E=(e,t,r)=>{if(!t)throw new b(`Invalid config property ${e}: ${r}`)},fn={confirm(e){return e?typeof e=="boolean"?e:(E("confirm",/^(?:true|false)$/.test(e),"Must be a boolean"),e==="true"):!1},prompt(e){return e||""},locale(e){return e?(E("locale",e,"Cannot be empty"),E("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;E("generate",/^\d+$/.test(e),"Must be an integer");const t=Number(e);return E("generate",t>0,"Must be greater than 0"),E("generate",t<=5,"Must be less or equal to 5"),t},type(e){return e?(E("type",ia.includes(e),"Invalid commit type"),e):"conventional"},proxy(e){if(!(!e||e.length===0))return E("proxy",/^https?:\/\//.test(e),"Must be a valid URL"),e},timeout(e){if(!e)return 1e4;E("timeout",/^\d+$/.test(e),"Must be an integer");const t=Number(e);return E("timeout",t>=500,"Must be greater than 500ms"),t},temperature(e){if(!e)return .7;E("temperature",/^(2|\d)(\.\d{1,2})?$/.test(e),"Must be decimal between 0 and 2");const t=Number(e);return E("temperature",t>0,"Must be greater than 0"),E("temperature",t<=2,"Must be less than or equal to 2"),t},"max-length"(e){if(!e)return 50;E("max-length",/^\d+$/.test(e),"Must be an integer");const t=Number(e);return E("max-length",t>=20,"Must be greater than 20 characters"),t},"max-tokens"(e){return e?(E("max-tokens",/^\d+$/.test(e),"Must be an integer"),Number(e)):200},logging(e){return e?typeof e=="boolean"?e:(E("logging",/^(?:true|false)$/.test(e),"Must be a boolean(true or false)"),e==="true"):!1}},pn={OPENAI_KEY(e){return e||""},OPENAI_MODEL(e){return!e||e.length===0?"gpt-3.5-turbo":e},OPENAI_URL(e){return e?(E("OPENAI_URL",/^https?:\/\//.test(e),"Must be a valid URL"),e):"https://api.openai.com"},OPENAI_PATH(e){return e||"/v1/chat/completions"},HUGGING_COOKIE(e){return e||""},HUGGING_MODEL(e){return!e||e.length===0?"mistralai/Mixtral-8x7B-Instruct-v0.1":(E("HUGGING_MODEL",["CohereForAI/c4ai-command-r-plus","meta-llama/Meta-Llama-3-70B-Instruct","HuggingFaceH4/zephyr-orpo-141b-A35b-v0.1","mistralai/Mixtral-8x7B-Instruct-v0.1","NousResearch/Nous-Hermes-2-Mixtral-8x7B-DPO","google/gemma-1.1-7b-it","mistralai/Mistral-7B-Instruct-v0.2","microsoft/Phi-3-mini-4k-instruct"].includes(e),"Invalid model type of HuggingFace chat"),e)},CLOVAX_COOKIE(e){return e||""},GEMINI_KEY(e){return e||""},GEMINI_MODEL(e){return!e||e.length===0?"gemini-1.5-flash-latest":(E("GEMINI_MODEL",["gemini-1.5-flash-latest","gemini-pro"].includes(e),"Invalid model type of Gemini"),e)},ANTHROPIC_MODEL(e){return!e||e.length===0?"claude-3-haiku-20240307":(E("ANTHROPIC_MODEL",["claude-2.1","claude-2.0","claude-instant-1.2","claude-3-haiku-20240307","claude-3-sonnet-20240229","claude-3-opus-20240229"].includes(e),"Invalid model type of Anthropic"),e)},ANTHROPIC_KEY(e){return e||""},MISTRAL_KEY(e){return e||""},MISTRAL_MODEL(e){return!e||e.length===0?"mistral-tiny":(E("MISTRAL_MODEL",["open-mistral-7b","mistral-tiny-2312","mistral-tiny","open-mixtral-8x7b","mistral-small-2312","mistral-small","mistral-small-2402","mistral-small-latest","mistral-medium-latest","mistral-medium-2312","mistral-medium","mistral-large-latest","mistral-large-2402","mistral-embed"].includes(e),"Invalid model type of Mistral AI"),e)},OLLAMA_MODEL(e){return e||""},OLLAMA_HOST(e){return e?(E("OLLAMA_HOST",/^https?:\/\//.test(e),"Must be a valid URL"),e):It},OLLAMA_TIMEOUT(e){if(!e)return 1e5;E("OLLAMA_TIMEOUT",/^\d+$/.test(e),"Must be an integer");const t=Number(e);return E("OLLAMA_TIMEOUT",t>=500,"Must be greater than 500ms"),t},OLLAMA_STREAM(e){return e?typeof e=="boolean"?e:(E("OLLAMA_STREAM",/^(?:true|false)$/.test(e),"Must be a boolean(true or false)"),e==="true"):!1},COHERE_KEY(e){return e||""},COHERE_MODEL(e){return!e||e.length===0?"command":(E("COHERE_MODEL",["command","command-nightly","command-light","command-light-nightly"].includes(e),"Invalid model type of Cohere"),e)}},Mt=q.join(He.homedir(),".aicommit2"),dn=async()=>{if(!await ln(Mt))return Object.create(null);const t=await x.readFile(Mt,"utf8");return Dn.parse(t)},Pt=async(e,t)=>{const r=await dn(),n={},s={...fn,...pn};for(const o of Object.keys(s)){const u=s[o],a=e?.[o]??r[o];if(t)try{n[o]=u(a)}catch{}else n[o]=u(a)}return n},ca=async e=>{const t=await dn(),r={...fn,...pn};for(const[n,s]of e){if(!Q(r,n))throw new b(`Invalid config property: ${n}`);const o=r[n](s);t[n]=o}await x.writeFile(Mt,Dn.stringify(t),"utf8")};class S{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=Yn.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 Da extends Y{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 G(this.generateMessage()).pipe(T(t=>P(t)),I((t,r)=>({name:`${this.serviceName} ${t}`,value:t,isError:!1})),L(this.handleError$))}async generateMessage(){try{const{locale:t,generate:r,type:n,prompt:s,logging:o}=this.params.config,u=this.params.config["max-length"],a=this.params.stagedDiff.diff,i=this.buildPrompt(t,a,r,u,n,s);await this.getAllConversationIds();const l=await this.sendMessage(i),{conversationId:f,allText:c}=this.parseSendMessageResult(l);return await this.deleteConversation(f),o&&_("CLOVA X",a,i,c),k(this.sanitizeMessage(c,this.params.config.type,r))}catch(t){const r=t;throw r.code==="ENOTFOUND"?new b(`Error connecting to ${r.hostname} (${r.syscall})`):r}}async getAllConversationIds(){const r=(await new S({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(!r||!r.content)throw new Error("No content on conversations ClovaX");return r.content.length===0?[]:r.content.map(s=>s.conversationId||"").filter(s=>!!s)}async sendMessage(t){const r={text:t,action:"new"},n=new qn;return n.set("form",new zn([JSON.stringify(r)],{type:"application/json"})),(await new S({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 r=/data:{(.*)}/g,n=t.match(r);if(!n)throw new Error("Failed to extract object from generated text");const s=n.map(i=>i.trim().replace(/data:/g,""));if(!s||s.length===0)throw new Error("Cannot extract message");let o="",u="",a="";if(s.map(i=>{try{return JSON.parse(i)}catch{return null}}).filter(i=>!!i).forEach(i=>{if(Q(i,"conversationId")){o=i.conversationId;return}if(Q(i,"text")){u+=i.text;return}if(Q(i,"error")){a=`${i.error}: ${i.type||i.message||""}`;return}}),a)throw new Error(a);if(!o)throw new Error("No conversationId!");if(!u)throw new Error("No allText!");return{conversationId:o,allText:u}}async deleteConversation(t){return(await new S({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(),([r,n])=>({[r]:{ContentLength:typeof n=="string"?n.length:n.size}}))}}class la extends Y{constructor(t){super(t),this.params=t,this.handleError$=r=>{const n=/"message":\s*"([^"]*)"/,s=r.message.match(n);let o=r?.body?.message;s&&s[1]&&(o=s[1]);const u=`${r.statusCode} ${o}`;return j({name:`${this.errorPrefix} ${u}`,value:o,isError:!0,disabled:!0})},this.colors={primary:"#D18EE2",secondary:"#fff"},this.serviceName=g.bgHex(this.colors.primary).hex(this.colors.secondary).bold("[Cohere]"),this.errorPrefix=g.red.bold("[Cohere]"),this.cohere=new Wn({token:this.params.config.COHERE_KEY})}generateCommitMessage$(){return G(this.generateMessage()).pipe(T(t=>P(t)),I(t=>({name:`${this.serviceName} ${t}`,value:t,isError:!1})),L(this.handleError$))}async generateMessage(){try{const t=this.params.stagedDiff.diff,{locale:r,generate:n,type:s,prompt:o,logging:u}=this.params.config,a=this.params.config["max-length"],i=this.buildPrompt(r,t,n,a,s,o),l=this.params.config["max-tokens"],c=(await this.cohere.generate({prompt:i,maxTokens:l,temperature:this.params.config.temperature,model:this.params.config.COHERE_MODEL})).generations.map(D=>D.text).join("");return u&&_("Cohere",t,i,c),k(this.sanitizeMessage(c,this.params.config.type,n))}catch(t){const r=t;throw r instanceof Vn?new b("Request timed out error!"):r}}}class fa extends Y{constructor(t){super(t),this.params=t,this.handleError$=r=>{const n=r.message||r.toString(),s=/(\[.*?\]\s*[^[]*)/g,o=[...n.matchAll(s)],u=[];o.forEach(i=>u.push(i[1]));const a=u[1]||"An error occurred";return j({name:`${this.errorPrefix} ${a}`,value:a,isError:!0,disabled:!0})},this.colors={primary:"#0077FF",secondary:"#fff"},this.serviceName=g.bgHex(this.colors.primary).hex(this.colors.secondary).bold("[Gemini]"),this.errorPrefix=g.red.bold("[Gemini]"),this.genAI=new Xn(this.params.config.GEMINI_KEY)}generateCommitMessage$(){return G(this.generateMessage()).pipe(T(t=>P(t)),I(t=>({name:`${this.serviceName} ${t}`,value:t,isError:!1})),L(this.handleError$))}async generateMessage(){try{const t=this.params.stagedDiff.diff,{locale:r,generate:n,type:s,prompt:o,logging:u}=this.params.config,a=this.params.config["max-length"],i=this.buildPrompt(r,t,n,a,s,o),l=this.params.config["max-tokens"],p=(await(await this.genAI.getGenerativeModel({model:this.params.config.GEMINI_MODEL,generationConfig:{maxOutputTokens:l,temperature:this.params.config.temperature}}).generateContent(i)).response).text();return u&&_("Gemini",t,i,p),k(this.sanitizeMessage(p,this.params.config.type,n))}catch(t){const r=t;throw r.code==="ENOTFOUND"?new b(`Error connecting to ${r.hostname} (${r.syscall})`):r}}}class pa extends Y{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 G(this.generateMessage()).pipe(T(t=>P(t)),I((t,r)=>({name:`${this.serviceName} ${t}`,value:t,isError:!1})),L(this.handleError$))}async generateMessage(){try{const t=this.getFullPrompt();await this.prepareNewConversation();const{conversationId:r}=await this.getNewConversationId();await this.prepareConversationEvent(r);const{lastMessageId:n}=await this.getConversationInfo(r),s=await this.sendMessage(r,t,n);await this.deleteConversation(r);const{generate:o}=this.params.config;return k(this.sanitizeHuggingMessage(s,this.params.config.type,o))}catch(t){const r=t;throw r.code==="ENOTFOUND"?new b(`Error connecting to ${r.hostname} (${r.syscall})`):r}}sanitizeHuggingMessage(t,r,n){const s=/{[^{}]*}/g,o=t.match(s);if(!o)throw new Error("Failed to extract object from generated text");let u=null;o.forEach((i,l)=>{try{const f=JSON.parse(i);Q(f,"type")&&f.type==="finalAnswer"&&(u=f)}catch{}});const a=this.getFullPrompt();if(!u||!Q(u,"text"))throw this.params.config.logging&&_("HuggingFace",this.params.stagedDiff.diff,a,t),new Error("Cannot parse finalAnswer");return this.params.config.logging&&_("HuggingFace",this.params.stagedDiff.diff,a,u.text),this.sanitizeMessage(u.text,r,n)}async prepareNewConversation(){return(await new S({method:"POST",baseURL:`${this.host}/api/event`}).setHeaders({"content-type":"application/json",Cookie:this.cookie}).setBody({d:"huggingface.co",n:"pageview",r:"https://huggingface.co/chat/",u:"https://huggingface.co/chat/"}).execute()).data}async prepareConversationEvent(t){return(await new S({method:"POST",baseURL:`${this.host}/api/event`}).setHeaders({"content-type":"application/json",Cookie:this.cookie}).setBody({d:"huggingface.co",n:"pageview",r:"https://huggingface.co/chat/",u:`https://huggingface.co/chat/conversation/${t}`}).execute()).data}async getNewConversationId(){const t=await new S({method:"POST",baseURL:`${this.host}/chat/conversation`,timeout:this.params.config.timeout}).setHeaders({"content-type":"application/json",Cookie:this.cookie,Accept:"*/*",Connection:"keep-alive",Host:"huggingface.co",Origin:"https://huggingface.co"}).setBody({model:this.params.config.HUGGING_MODEL,preprompt:""}).execute();if(!t.data||!t.data.conversationId)throw new Error("No conversationId on Hugging service");return t.data}async getConversationInfo(t){const n=(await new S({method:"GET",baseURL:`${this.host}/chat/conversation/${t}/__data.json`,timeout:this.params.config.timeout}).setParams({"x-sveltekit-invalidated":"11"}).setHeaders({"Content-Type":"application/json",Cookie:this.cookie,Accept:"*/*",Connection:"keep-alive",Referer:"https://huggingface.co/chat/"}).execute()).data;if(!n||!n.nodes||n.nodes.length===0)throw new Error("No Nodes on conversation info");if(!n.nodes[1]||!n.nodes[1].data||n.nodes[1].data.length===0||!n.nodes[1].data[3])throw new Error("No data on node");const u=n.nodes[1]?.data[3];return{conversationInfo:n,lastMessageId:u}}async deleteConversation(t){return await new S({method:"DELETE",baseURL:`${this.host}/chat/conversation/${t}`,timeout:this.params.config.timeout}).setHeaders({Cookie:this.cookie}).execute(),(await new S({method:"GET",baseURL:`${this.host}/chat/__data.json`,timeout:this.params.config.timeout}).setParams({"x-sveltekit-trailing-slash":"1","x-sveltekit-invalidated":"10"}).setHeaders({"Content-Type":"application/json",Cookie:this.cookie,Accept:"*/*",Connection:"keep-alive",Referer:"https://huggingface.co/chat/"}).execute()).data}async sendMessage(t,r,n){return(await new S({method:"POST",baseURL:`${this.host}/chat/conversation/${t}`,timeout:this.params.config.timeout}).setHeaders({"content-type":"application/json",Cookie:this.cookie,authority:"huggingface.co",accept:"*/*",origin:"https://huggingface.co"}).setBody({files:[],id:n,inputs:r,is_continue:!1,is_retry:!1,use_cache:!1}).execute()).data}getFullPrompt(){const{locale:t,generate:r,type:n,prompt:s}=this.params.config,o=this.params.config["max-length"],u=this.params.stagedDiff.diff;return this.buildPrompt(t,u,r,o,n,s)}}class da extends Y{constructor(t){super(t),this.params=t,this.host="https://api.mistral.ai",this.apiKey="",this.handleError$=r=>{const n=r.message?.replace(/(\r\n|\n|\r)/gm,"")||"An error occurred";return j({name:`${this.errorPrefix} ${n}`,value:n,isError:!0,disabled:!0})},this.colors={primary:"#FC4A0A",secondary:"#fff"},this.serviceName=g.bgHex(this.colors.primary).hex(this.colors.secondary).bold("[MistralAI]"),this.errorPrefix=g.red.bold("[MistralAI]"),this.apiKey=this.params.config.MISTRAL_KEY}generateCommitMessage$(){return G(this.generateMessage()).pipe(T(t=>P(t)),I(t=>({name:`${this.serviceName} ${t}`,value:t,isError:!1})),L(this.handleError$))}async generateMessage(){try{const t=this.params.stagedDiff.diff,{locale:r,generate:n,type:s,prompt:o,logging:u}=this.params.config,a=this.params.config["max-length"],i=this.buildPrompt(r,t,n,a,s,o);await this.checkAvailableModels();const l=await this.createChatCompletions(i);return u&&_("MistralAI",t,i,l),k(this.sanitizeMessage(l,this.params.config.type,n))}catch(t){const r=t;throw r.code==="ENOTFOUND"?new b(`Error connecting to ${r.hostname} (${r.syscall})`):r}}async checkAvailableModels(){if((await this.getAvailableModels()).includes(this.params.config.MISTRAL_MODEL))return!0;throw new Error("Invalid model type of Mistral AI")}async getAvailableModels(){return(await new S({method:"GET",baseURL:`${this.host}/v1/models`,timeout:this.params.config.timeout}).setHeaders({Authorization:`Bearer ${this.apiKey}`,"content-type":"application/json"}).execute()).data.data.filter(r=>r.object==="model").map(r=>r.id)}async createChatCompletions(t){const n=(await new S({method:"POST",baseURL:`${this.host}/v1/chat/completions`,timeout:this.params.config.timeout}).setHeaders({Authorization:`Bearer ${this.apiKey}`,"content-type":"application/json"}).setBody({model:this.params.config.MISTRAL_MODEL,messages:[{role:"user",content:t}],temperature:this.params.config.temperature,top_p:1,max_tokens:this.params.config["max-tokens"],stream:!1,safe_prompt:!1,random_seed:wi(10,1e3)}).execute()).data;if(!n.choices||n.choices.length===0||!n.choices[0].message?.content)throw new Error("No Content on response. Please open a Bug report");return n.choices[0].message.content}}class ma extends Y{constructor(t){super(t),this.params=t,this.host=It,this.model="",this.handleError$=r=>{if(r.response&&r.response.data?.error)return j({name:`${this.errorPrefix} ${r.response.data?.error}`,value:r.response.data?.error,isError:!0,disabled:!0});const n=r.message?.replace(/(\r\n|\n|\r)/gm,"")||"An error occurred";return j({name:`${this.errorPrefix} ${n}`,value:n,isError:!0,disabled:!0})},this.generateStreamChoice$=()=>{const n=`${Z(this.params.config.locale,this.params.config["max-length"],this.params.config.type,this.params.config.prompt)}
73
- ${ie(this.params.config.generate)}`,s=this.ollama.chat({model:this.model,messages:[{role:"system",content:n},{role:"user",content:`${this.params.stagedDiff.diff}`}],stream:!0,options:{temperature:this.params.config.temperature}});let o="";return P(qr(s)).pipe(Kt(u=>o+=u.message.content),I(u=>({id:this.params.keyName,name:`${this.serviceName} ${o}`,value:`${o}`,isError:!1,description:u.done?O:zr,disabled:!u.done})))},this.colors={primary:"#FFF",secondary:"#000"},this.serviceName=g.bgHex(this.colors.primary).hex(this.colors.secondary).bold("[Ollama]"),this.errorPrefix=g.red.bold("[Ollama]"),this.model=this.params.config.OLLAMA_MODEL,this.host=this.params.config.OLLAMA_HOST||It,this.ollama=new Jn({host:this.host})}generateCommitMessage$(){return this.params.config.OLLAMA_STREAM?this.generateStreamCommitMessage$():G(this.generateMessage()).pipe(T(t=>P(t)),I(t=>({name:`${this.serviceName} ${t}`,value:t,isError:!1})),L(this.handleError$))}generateStreamCommitMessage$(){return G(this.checkIsAvailableOllama()).pipe(In(()=>this.generateStreamChoice$()),qt((t,r)=>{if(r.description===O){const{type:o,generate:u,logging:a}=this.params.config;if(a){const f=this.createSystemPrompt();_("Ollama",this.params.stagedDiff.diff,f,r.value)}const i=k(this.sanitizeMessage(r.value,o,u));return!i||i.length===0?[{id:`${this.params.keyName}_${O}_0`,name:`${this.serviceName} Failed to extract messages from response`,value:"Failed to extract messages from response",isError:!0,description:O,disabled:!0}]:i.map((f,c)=>({id:`${this.params.keyName}_${O}_${c}`,name:`${this.serviceName} ${f}`,value:`${f}`,isError:!1,description:O,disabled:!1}))}return t.find(o=>o.id===r.id)?[...t.map(o=>r.id===o.id?r:o)]:[{...r}]},[]),T(t=>t),L(this.handleError$))}async generateMessage(){try{await this.checkIsAvailableOllama();const t=await this.createChatCompletions(),{type:r,generate:n,logging:s}=this.params.config,o=this.createSystemPrompt();return s&&_("Ollama",this.params.stagedDiff.diff,o,t),k(this.sanitizeMessage(t,r,n))}catch(t){const r=t;throw r.code==="ENOTFOUND"?new b(`Error connecting to ${r.hostname} (${r.syscall})`):r}}async checkIsAvailableOllama(){try{return(await new S({method:"GET",baseURL:`${this.host}`,timeout:this.params.config.OLLAMA_TIMEOUT}).execute()).data}catch(t){throw t.code==="ECONNREFUSED"?new b(`Error connecting to ${this.host}. Please run Ollama or check host`):t}}async createChatCompletions(){const t=this.createSystemPrompt();return(await this.ollama.chat({model:this.model,messages:[{role:"system",content:t},{role:"user",content:`${this.params.stagedDiff.diff}`}],stream:!1,options:{temperature:this.params.config.temperature}})).message.content}createSystemPrompt(){return`${Z(this.params.config.locale,this.params.config["max-length"],this.params.config.type,this.params.config.prompt)}
74
- ${ie(this.params.config.generate)}`}}class ha extends Y{constructor(t){super(t),this.params=t,this.handleError$=r=>{let n="An error occurred";if(r.message){n=r.message.split(`
75
- `)[0];const s=this.extractJSONFromError(r.message);n+=`: ${s.error.message}`}return j({name:`${this.errorPrefix} ${n}`,value:n,isError:!0,disabled:!0})},this.colors={primary:"#74AA9C",secondary:"#FFF"},this.serviceName=g.bgHex(this.colors.primary).hex(this.colors.secondary).bold("[ChatGPT]"),this.errorPrefix=g.red.bold("[ChatGPT]")}generateCommitMessage$(){return G(oa(this.params.config.OPENAI_URL,this.params.config.OPENAI_PATH,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.prompt,this.params.config.logging,this.params.config.proxy)).pipe(T(t=>P(t)),I(t=>({name:`${this.serviceName} ${t}`,value:t,isError:!1})),L(this.handleError$))}extractJSONFromError(t){const r=/[{[]{1}([,:{}[\]0-9.\-+Eaeflnr-u \n\r\t]|".*?")+[}\]]{1}/gis,n=t.match(r);return n?Object.assign({},...n.map(s=>JSON.parse(s))):{error:{message:"Unknown error"}}}}class mn{constructor(t,r){this.config=t,this.stagedDiff=r}createAIRequests$(t){return P(t).pipe(Mn(r=>{const n={config:this.config,stagedDiff:this.stagedDiff,keyName:r};switch(r){case H.OPEN_AI:return z.create(ha,n).generateCommitMessage$();case H.GEMINI:return z.create(fa,n).generateCommitMessage$();case H.ANTHROPIC:return z.create(sa,n).generateCommitMessage$();case H.HUGGING:return z.create(pa,n).generateCommitMessage$();case H.CLOVA_X:return z.create(Da,n).generateCommitMessage$();case H.MISTRAL:return z.create(da,n).generateCommitMessage$();case H.OLLAMA:return z.create(ma,n).generateCommitMessage$();case H.COHERE:return z.create(la,n).generateCommitMessage$();default:const s=g.red.bold(`[${r}]`);return j({name:s+" Invalid AI type",value:"Invalid AI type",isError:!0,disabled:!0})}}))}}const hn=async()=>{const{stdout:e,failed:t}=await ue("git",["rev-parse","--show-toplevel"],{reject:!1});if(t)throw new b("The current directory must be a Git repository!");return e},_t=e=>`:(exclude)${e}`,gn=["package-lock.json","pnpm-lock.yaml","*.lock"].map(_t),Cn=async e=>{const t=["diff","--cached","--diff-algorithm=minimal"],{stdout:r}=await ue("git",[...t,"--name-only",...gn,...e?e.map(_t):[]]);if(!r)return null;const{stdout:n}=await ue("git",[...t,...gn,...e?e.map(_t):[]]);return{files:r.split(`
76
- `),diff:n}},ga=e=>`Detected ${e.length.toLocaleString()} staged file${e.length>1?"s":""}`;class be{constructor(){this.title="aicommit2"}printTitle(){console.log(Zn.textSync(this.title,{font:"Small"}))}displaySpinner(t){return Ge(t).start()}stopSpinner(t){t.stop(),t.clear()}printStagedFiles(t){console.log(g.bold.green("\u2714 ")+g.bold(`${ga(t.files)}:`)),console.log(`${t.files.map(r=>` ${r}`).join(`
72
+ `,Mt=(e,t)=>{const r=[];let n="";typeof t=="string"?t={section:t,whitespace:!1}:(t=t||Object.create(null),t.whitespace=t.whitespace===!0);const s=t.whitespace?" = ":"=";for(const o of Object.keys(e)){const u=e[o];if(u&&Array.isArray(u))for(const a of u)n+=ce(o+"[]")+s+ce(a)+Le;else u&&typeof u=="object"?r.push(o):n+=ce(o)+s+ce(u)+Le}t.section&&n.length&&(n="["+ce(t.section)+"]"+Le+n);for(const o of r){const u=cn(o).join("\\."),a=(t.section?t.section+".":"")+u,{whitespace:i}=t,l=Mt(e[o],{section:a,whitespace:i});n.length&&l.length&&(n+=Le),n+=l}return n},cn=e=>e.replace(/\1/g,"LITERAL\\1LITERAL").replace(/\\\./g,"").split(/\./).map(t=>t.replace(/\1/g,"\\.").replace(/\2LITERAL\\1LITERAL\2/g,"")),Dn=e=>{const t=Object.create(null);let r=t,n=null;const s=/^\[([^\]]*)\]$|^([^=]+)(=(.*))?$/i,o=e.split(/[\r\n]+/g);for(const a of o){if(!a||a.match(/^\s*[;#]/))continue;const i=a.match(s);if(!i)continue;if(i[1]!==void 0){if(n=Ne(i[1]),n==="__proto__"){r=Object.create(null);continue}r=t[n]=t[n]||Object.create(null);continue}const l=Ne(i[2]),f=l.length>2&&l.slice(-2)==="[]",c=f?l.slice(0,-2):l;if(c==="__proto__")continue;const D=i[3]?Ne(i[4]):!0,p=D==="true"||D==="false"||D==="null"?JSON.parse(D):D;f&&(Ot.call(r,c)?Array.isArray(r[c])||(r[c]=[r[c]]):r[c]=[]),Array.isArray(r[c])?r[c].push(p):r[c]=p}const u=[];for(const a of Object.keys(t)){if(!Ot.call(t,a)||typeof t[a]!="object"||Array.isArray(t[a]))continue;const i=cn(a);r=t;const l=i.pop(),f=l.replace(/\\\./g,".");for(const c of i)c!=="__proto__"&&((!Ot.call(r,c)||typeof r[c]!="object")&&(r[c]=Object.create(null)),r=r[c]);r===t&&f===l||(r[f]=t[a],u.push(a))}for(const a of u)delete t[a];return t},ln=e=>e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'"),ce=e=>typeof e!="string"||e.match(/[=\r\n]/)||e.match(/^\[/)||e.length>1&&ln(e)||e!==e.trim()?JSON.stringify(e):e.split(";").join("\\;").split("#").join("\\#"),Ne=(e,t)=>{if(e=(e||"").trim(),ln(e)){e.charAt(0)==="'"&&(e=e.slice(1,-1));try{e=JSON.parse(e)}catch{}}else{let r=!1,n="";for(let s=0,o=e.length;s<o;s++){const u=e.charAt(s);if(r)"\\;#".indexOf(u)!==-1?n+=u:n+="\\"+u,r=!1;else{if(";#".indexOf(u)!==-1)break;u==="\\"?r=!0:n+=u}}return r&&(n+="\\"),n.trim()}return e};var ia={parse:Dn,decode:Dn,stringify:Mt,encode:Mt,safe:ce,unsafe:Ne},fn=te(ia);const pn=e=>x.lstat(e).then(()=>!0,()=>!1),aa=["","conventional","gitmoji"],St="http://localhost:11434",{hasOwnProperty:ca}=Object.prototype,W=(e,t)=>ca.call(e,t),E=(e,t,r)=>{if(!t)throw new b(`Invalid config property ${e}: ${r}`)},dn={confirm(e){return e?typeof e=="boolean"?e:(E("confirm",/^(?:true|false)$/.test(e),"Must be a boolean"),e==="true"):!1},prompt(e){return e||""},locale(e){return e?(E("locale",e,"Cannot be empty"),E("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;E("generate",/^\d+$/.test(e),"Must be an integer");const t=Number(e);return E("generate",t>0,"Must be greater than 0"),E("generate",t<=5,"Must be less or equal to 5"),t},type(e){return e?(E("type",aa.includes(e),"Invalid commit type"),e):"conventional"},proxy(e){if(!(!e||e.length===0))return E("proxy",/^https?:\/\//.test(e),"Must be a valid URL"),e},timeout(e){if(!e)return 1e4;E("timeout",/^\d+$/.test(e),"Must be an integer");const t=Number(e);return E("timeout",t>=500,"Must be greater than 500ms"),t},temperature(e){if(!e)return .7;E("temperature",/^(2|\d)(\.\d{1,2})?$/.test(e),"Must be decimal between 0 and 2");const t=Number(e);return E("temperature",t>0,"Must be greater than 0"),E("temperature",t<=2,"Must be less than or equal to 2"),t},"max-length"(e){if(!e)return 50;E("max-length",/^\d+$/.test(e),"Must be an integer");const t=Number(e);return E("max-length",t>=20,"Must be greater than 20 characters"),t},"max-tokens"(e){return e?(E("max-tokens",/^\d+$/.test(e),"Must be an integer"),Number(e)):200},logging(e){return e?typeof e=="boolean"?e:(E("logging",/^(?:true|false)$/.test(e),"Must be a boolean(true or false)"),e==="true"):!1}},mn={OPENAI_KEY(e){return e||""},OPENAI_MODEL(e){return!e||e.length===0?"gpt-3.5-turbo":e},OPENAI_URL(e){return e?(E("OPENAI_URL",/^https?:\/\//.test(e),"Must be a valid URL"),e):"https://api.openai.com"},OPENAI_PATH(e){return e||"/v1/chat/completions"},HUGGING_COOKIE(e){return e||""},HUGGING_MODEL(e){return!e||e.length===0?"mistralai/Mixtral-8x7B-Instruct-v0.1":(E("HUGGING_MODEL",["CohereForAI/c4ai-command-r-plus","meta-llama/Meta-Llama-3-70B-Instruct","HuggingFaceH4/zephyr-orpo-141b-A35b-v0.1","mistralai/Mixtral-8x7B-Instruct-v0.1","NousResearch/Nous-Hermes-2-Mixtral-8x7B-DPO","google/gemma-1.1-7b-it","mistralai/Mistral-7B-Instruct-v0.2","microsoft/Phi-3-mini-4k-instruct"].includes(e),"Invalid model type of HuggingFace chat"),e)},CLOVAX_COOKIE(e){return e||""},GEMINI_KEY(e){return e||""},GEMINI_MODEL(e){return!e||e.length===0?"gemini-1.5-flash-latest":(E("GEMINI_MODEL",["gemini-1.5-flash-latest","gemini-pro"].includes(e),"Invalid model type of Gemini"),e)},ANTHROPIC_MODEL(e){return!e||e.length===0?"claude-3-haiku-20240307":(E("ANTHROPIC_MODEL",["claude-2.1","claude-2.0","claude-instant-1.2","claude-3-haiku-20240307","claude-3-sonnet-20240229","claude-3-opus-20240229"].includes(e),"Invalid model type of Anthropic"),e)},ANTHROPIC_KEY(e){return e||""},MISTRAL_KEY(e){return e||""},MISTRAL_MODEL(e){return!e||e.length===0?"mistral-tiny":(E("MISTRAL_MODEL",["open-mistral-7b","mistral-tiny-2312","mistral-tiny","open-mixtral-8x7b","mistral-small-2312","mistral-small","mistral-small-2402","mistral-small-latest","mistral-medium-latest","mistral-medium-2312","mistral-medium","mistral-large-latest","mistral-large-2402","mistral-embed"].includes(e),"Invalid model type of Mistral AI"),e)},OLLAMA_MODEL(e){return e?(typeof e=="string"?e?.split(","):e).map(r=>r.trim()).filter(r=>!!r&&r.length>0):[]},OLLAMA_HOST(e){return e?(E("OLLAMA_HOST",/^https?:\/\//.test(e),"Must be a valid URL"),e):St},OLLAMA_TIMEOUT(e){if(!e)return 1e5;E("OLLAMA_TIMEOUT",/^\d+$/.test(e),"Must be an integer");const t=Number(e);return E("OLLAMA_TIMEOUT",t>=500,"Must be greater than 500ms"),t},OLLAMA_STREAM(e){return e?typeof e=="boolean"?e:(E("OLLAMA_STREAM",/^(?:true|false)$/.test(e),"Must be a boolean(true or false)"),e==="true"):!1},COHERE_KEY(e){return e||""},COHERE_MODEL(e){return!e||e.length===0?"command":(E("COHERE_MODEL",["command","command-nightly","command-light","command-light-nightly"].includes(e),"Invalid model type of Cohere"),e)}},It=q.join(He.homedir(),".aicommit2"),hn=async()=>{if(!await pn(It))return Object.create(null);const t=await x.readFile(It,"utf8");let r=fn.parse(t);return W(r,"OLLAMA_MODEL")&&(r={...r,OLLAMA_MODEL:typeof r.OLLAMA_MODEL=="string"?[r.OLLAMA_MODEL]:r.OLLAMA_MODEL}),r},Pt=async(e,t)=>{const r=await hn(),n={},s={...dn,...mn};for(const o of Object.keys(s)){const u=s[o],a=e?.[o]??r[o];if(t)try{n[o]=u(a)}catch{}else n[o]=u(a)}return n},Da=async e=>{const t=await hn(),r={...dn,...mn};for(const[n,s]of e){if(!W(r,n))throw new b(`Invalid config property: ${n}`);const o=r[n](s);t[n]=o}await x.writeFile(It,fn.stringify(t),"utf8")};class M{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=Wn.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 la extends Y{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 H(this.generateMessage()).pipe(T(t=>S(t)),I((t,r)=>({name:`${this.serviceName} ${t}`,value:t,isError:!1})),R(this.handleError$))}async generateMessage(){try{const{locale:t,generate:r,type:n,prompt:s,logging:o}=this.params.config,u=this.params.config["max-length"],a=this.params.stagedDiff.diff,i=this.buildPrompt(t,a,r,u,n,s);await this.getAllConversationIds();const l=await this.sendMessage(i),{conversationId:f,allText:c}=this.parseSendMessageResult(l);return await this.deleteConversation(f),o&&L("CLOVA X",a,i,c),j(this.sanitizeMessage(c,this.params.config.type,r))}catch(t){const r=t;throw r.code==="ENOTFOUND"?new b(`Error connecting to ${r.hostname} (${r.syscall})`):r}}async getAllConversationIds(){const r=(await new M({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(!r||!r.content)throw new Error("No content on conversations ClovaX");return r.content.length===0?[]:r.content.map(s=>s.conversationId||"").filter(s=>!!s)}async sendMessage(t){const r={text:t,action:"new"},n=new zn;return n.set("form",new Yn([JSON.stringify(r)],{type:"application/json"})),(await new M({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 r=/data:{(.*)}/g,n=t.match(r);if(!n)throw new Error("Failed to extract object from generated text");const s=n.map(i=>i.trim().replace(/data:/g,""));if(!s||s.length===0)throw new Error("Cannot extract message");let o="",u="",a="";if(s.map(i=>{try{return JSON.parse(i)}catch{return null}}).filter(i=>!!i).forEach(i=>{if(W(i,"conversationId")){o=i.conversationId;return}if(W(i,"text")){u+=i.text;return}if(W(i,"error")){a=`${i.error}: ${i.type||i.message||""}`;return}}),a)throw new Error(a);if(!o)throw new Error("No conversationId!");if(!u)throw new Error("No allText!");return{conversationId:o,allText:u}}async deleteConversation(t){return(await new M({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(),([r,n])=>({[r]:{ContentLength:typeof n=="string"?n.length:n.size}}))}}class fa extends Y{constructor(t){super(t),this.params=t,this.handleError$=r=>{const n=/"message":\s*"([^"]*)"/,s=r.message.match(n);let o=r?.body?.message;s&&s[1]&&(o=s[1]);const u=`${r.statusCode} ${o}`;return G({name:`${this.errorPrefix} ${u}`,value:o,isError:!0,disabled:!0})},this.colors={primary:"#D18EE2",secondary:"#fff"},this.serviceName=g.bgHex(this.colors.primary).hex(this.colors.secondary).bold("[Cohere]"),this.errorPrefix=g.red.bold("[Cohere]"),this.cohere=new Vn({token:this.params.config.COHERE_KEY})}generateCommitMessage$(){return H(this.generateMessage()).pipe(T(t=>S(t)),I(t=>({name:`${this.serviceName} ${t}`,value:t,isError:!1})),R(this.handleError$))}async generateMessage(){try{const t=this.params.stagedDiff.diff,{locale:r,generate:n,type:s,prompt:o,logging:u}=this.params.config,a=this.params.config["max-length"],i=this.buildPrompt(r,t,n,a,s,o),l=this.params.config["max-tokens"],c=(await this.cohere.generate({prompt:i,maxTokens:l,temperature:this.params.config.temperature,model:this.params.config.COHERE_MODEL})).generations.map(D=>D.text).join("");return u&&L("Cohere",t,i,c),j(this.sanitizeMessage(c,this.params.config.type,n))}catch(t){const r=t;throw r instanceof Xn?new b("Request timed out error!"):r}}}class pa extends Y{constructor(t){super(t),this.params=t,this.handleError$=r=>{const n=r.message||r.toString(),s=/(\[.*?\]\s*[^[]*)/g,o=[...n.matchAll(s)],u=[];o.forEach(i=>u.push(i[1]));const a=u[1]||"An error occurred";return G({name:`${this.errorPrefix} ${a}`,value:a,isError:!0,disabled:!0})},this.colors={primary:"#0077FF",secondary:"#fff"},this.serviceName=g.bgHex(this.colors.primary).hex(this.colors.secondary).bold("[Gemini]"),this.errorPrefix=g.red.bold("[Gemini]"),this.genAI=new Jn(this.params.config.GEMINI_KEY)}generateCommitMessage$(){return H(this.generateMessage()).pipe(T(t=>S(t)),I(t=>({name:`${this.serviceName} ${t}`,value:t,isError:!1})),R(this.handleError$))}async generateMessage(){try{const t=this.params.stagedDiff.diff,{locale:r,generate:n,type:s,prompt:o,logging:u}=this.params.config,a=this.params.config["max-length"],i=this.buildPrompt(r,t,n,a,s,o),l=this.params.config["max-tokens"],p=(await(await this.genAI.getGenerativeModel({model:this.params.config.GEMINI_MODEL,generationConfig:{maxOutputTokens:l,temperature:this.params.config.temperature}}).generateContent(i)).response).text();return u&&L("Gemini",t,i,p),j(this.sanitizeMessage(p,this.params.config.type,n))}catch(t){const r=t;throw r.code==="ENOTFOUND"?new b(`Error connecting to ${r.hostname} (${r.syscall})`):r}}}class da extends Y{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 H(this.generateMessage()).pipe(T(t=>S(t)),I((t,r)=>({name:`${this.serviceName} ${t}`,value:t,isError:!1})),R(this.handleError$))}async generateMessage(){try{const t=this.getFullPrompt();await this.prepareNewConversation();const{conversationId:r}=await this.getNewConversationId();await this.prepareConversationEvent(r);const{lastMessageId:n}=await this.getConversationInfo(r),s=await this.sendMessage(r,t,n);await this.deleteConversation(r);const{generate:o}=this.params.config;return j(this.sanitizeHuggingMessage(s,this.params.config.type,o))}catch(t){const r=t;throw r.code==="ENOTFOUND"?new b(`Error connecting to ${r.hostname} (${r.syscall})`):r}}sanitizeHuggingMessage(t,r,n){const s=/{[^{}]*}/g,o=t.match(s);if(!o)throw new Error("Failed to extract object from generated text");let u=null;o.forEach((i,l)=>{try{const f=JSON.parse(i);W(f,"type")&&f.type==="finalAnswer"&&(u=f)}catch{}});const a=this.getFullPrompt();if(!u||!W(u,"text"))throw this.params.config.logging&&L("HuggingFace",this.params.stagedDiff.diff,a,t),new Error("Cannot parse finalAnswer");return this.params.config.logging&&L("HuggingFace",this.params.stagedDiff.diff,a,u.text),this.sanitizeMessage(u.text,r,n)}async prepareNewConversation(){return(await new M({method:"POST",baseURL:`${this.host}/api/event`}).setHeaders({"content-type":"application/json",Cookie:this.cookie}).setBody({d:"huggingface.co",n:"pageview",r:"https://huggingface.co/chat/",u:"https://huggingface.co/chat/"}).execute()).data}async prepareConversationEvent(t){return(await new M({method:"POST",baseURL:`${this.host}/api/event`}).setHeaders({"content-type":"application/json",Cookie:this.cookie}).setBody({d:"huggingface.co",n:"pageview",r:"https://huggingface.co/chat/",u:`https://huggingface.co/chat/conversation/${t}`}).execute()).data}async getNewConversationId(){const t=await new M({method:"POST",baseURL:`${this.host}/chat/conversation`,timeout:this.params.config.timeout}).setHeaders({"content-type":"application/json",Cookie:this.cookie,Accept:"*/*",Connection:"keep-alive",Host:"huggingface.co",Origin:"https://huggingface.co"}).setBody({model:this.params.config.HUGGING_MODEL,preprompt:""}).execute();if(!t.data||!t.data.conversationId)throw new Error("No conversationId on Hugging service");return t.data}async getConversationInfo(t){const n=(await new M({method:"GET",baseURL:`${this.host}/chat/conversation/${t}/__data.json`,timeout:this.params.config.timeout}).setParams({"x-sveltekit-invalidated":"11"}).setHeaders({"Content-Type":"application/json",Cookie:this.cookie,Accept:"*/*",Connection:"keep-alive",Referer:"https://huggingface.co/chat/"}).execute()).data;if(!n||!n.nodes||n.nodes.length===0)throw new Error("No Nodes on conversation info");if(!n.nodes[1]||!n.nodes[1].data||n.nodes[1].data.length===0||!n.nodes[1].data[3])throw new Error("No data on node");const u=n.nodes[1]?.data[3];return{conversationInfo:n,lastMessageId:u}}async deleteConversation(t){return await new M({method:"DELETE",baseURL:`${this.host}/chat/conversation/${t}`,timeout:this.params.config.timeout}).setHeaders({Cookie:this.cookie}).execute(),(await new M({method:"GET",baseURL:`${this.host}/chat/__data.json`,timeout:this.params.config.timeout}).setParams({"x-sveltekit-trailing-slash":"1","x-sveltekit-invalidated":"10"}).setHeaders({"Content-Type":"application/json",Cookie:this.cookie,Accept:"*/*",Connection:"keep-alive",Referer:"https://huggingface.co/chat/"}).execute()).data}async sendMessage(t,r,n){return(await new M({method:"POST",baseURL:`${this.host}/chat/conversation/${t}`,timeout:this.params.config.timeout}).setHeaders({"content-type":"application/json",Cookie:this.cookie,authority:"huggingface.co",accept:"*/*",origin:"https://huggingface.co"}).setBody({files:[],id:n,inputs:r,is_continue:!1,is_retry:!1,use_cache:!1}).execute()).data}getFullPrompt(){const{locale:t,generate:r,type:n,prompt:s}=this.params.config,o=this.params.config["max-length"],u=this.params.stagedDiff.diff;return this.buildPrompt(t,u,r,o,n,s)}}class ma extends Y{constructor(t){super(t),this.params=t,this.host="https://api.mistral.ai",this.apiKey="",this.handleError$=r=>{const n=r.message?.replace(/(\r\n|\n|\r)/gm,"")||"An error occurred";return G({name:`${this.errorPrefix} ${n}`,value:n,isError:!0,disabled:!0})},this.colors={primary:"#FC4A0A",secondary:"#fff"},this.serviceName=g.bgHex(this.colors.primary).hex(this.colors.secondary).bold("[MistralAI]"),this.errorPrefix=g.red.bold("[MistralAI]"),this.apiKey=this.params.config.MISTRAL_KEY}generateCommitMessage$(){return H(this.generateMessage()).pipe(T(t=>S(t)),I(t=>({name:`${this.serviceName} ${t}`,value:t,isError:!1})),R(this.handleError$))}async generateMessage(){try{const t=this.params.stagedDiff.diff,{locale:r,generate:n,type:s,prompt:o,logging:u}=this.params.config,a=this.params.config["max-length"],i=this.buildPrompt(r,t,n,a,s,o);await this.checkAvailableModels();const l=await this.createChatCompletions(i);return u&&L("MistralAI",t,i,l),j(this.sanitizeMessage(l,this.params.config.type,n))}catch(t){const r=t;throw r.code==="ENOTFOUND"?new b(`Error connecting to ${r.hostname} (${r.syscall})`):r}}async checkAvailableModels(){if((await this.getAvailableModels()).includes(this.params.config.MISTRAL_MODEL))return!0;throw new Error("Invalid model type of Mistral AI")}async getAvailableModels(){return(await new M({method:"GET",baseURL:`${this.host}/v1/models`,timeout:this.params.config.timeout}).setHeaders({Authorization:`Bearer ${this.apiKey}`,"content-type":"application/json"}).execute()).data.data.filter(r=>r.object==="model").map(r=>r.id)}async createChatCompletions(t){const n=(await new M({method:"POST",baseURL:`${this.host}/v1/chat/completions`,timeout:this.params.config.timeout}).setHeaders({Authorization:`Bearer ${this.apiKey}`,"content-type":"application/json"}).setBody({model:this.params.config.MISTRAL_MODEL,messages:[{role:"user",content:t}],temperature:this.params.config.temperature,top_p:1,max_tokens:this.params.config["max-tokens"],stream:!1,safe_prompt:!1,random_seed:Ai(10,1e3)}).execute()).data;if(!n.choices||n.choices.length===0||!n.choices[0].message?.content)throw new Error("No Content on response. Please open a Bug report");return n.choices[0].message.content}}class ha extends Y{constructor(t){super(t),this.params=t,this.host=St,this.model="",this.handleError$=r=>{if(r.response&&r.response.data?.error)return G({name:`${this.errorPrefix} ${r.response.data?.error}`,value:r.response.data?.error,isError:!0,disabled:!0});const n=r.message?.replace(/(\r\n|\n|\r)/gm,"")||"An error occurred";return G({name:`${this.errorPrefix} ${n}`,value:n,isError:!0,disabled:!0})},this.generateStreamChoice$=()=>{const n=`${Q(this.params.config.locale,this.params.config["max-length"],this.params.config.type,this.params.config.prompt)}
73
+ ${ie(this.params.config.generate)}`,s=this.ollama.chat({model:this.model,messages:[{role:"system",content:n},{role:"user",content:`${this.params.stagedDiff.diff}`}],stream:!0,options:{temperature:this.params.config.temperature}});let o="";return S(Yr(s)).pipe(Kt(u=>o+=u.message.content),I(u=>({id:`Ollama_${this.model}`,name:`${this.serviceName} ${o}`,value:`${o}`,isError:!1,description:u.done?O:Wr,disabled:!u.done})))},this.colors={primary:"#FFF",secondary:"#000"},this.model=this.params.keyName,this.serviceName=g.bgHex(this.colors.primary).hex(this.colors.secondary).bold(`[${zr(this.model)}]`),this.errorPrefix=g.red.bold(`[${zr(this.model)}]`),this.host=this.params.config.OLLAMA_HOST||St,this.ollama=new Zn({host:this.host})}generateCommitMessage$(){return this.params.config.OLLAMA_STREAM?this.generateStreamCommitMessage$():H(this.generateMessage()).pipe(T(t=>S(t)),I(t=>({name:`${this.serviceName} ${t}`,value:t,isError:!1})),R(this.handleError$))}generateStreamCommitMessage$(){return H(this.checkIsAvailableOllama()).pipe(Pn(()=>this.generateStreamChoice$()),qt((t,r)=>{if(r.description===O){const{type:o,generate:u,logging:a}=this.params.config;if(a){const f=this.createSystemPrompt();L("Ollama",this.params.stagedDiff.diff,f,r.value)}const i=j(this.sanitizeMessage(r.value,o,u));return!i||i.length===0?[{id:`Ollama_${this.model}_${O}_0`,name:`${this.serviceName} Failed to extract messages from response`,value:"Failed to extract messages from response",isError:!0,description:O,disabled:!0}]:i.map((f,c)=>({id:`Ollama_${this.model}_${O}_${c}`,name:`${this.serviceName} ${f}`,value:`${f}`,isError:!1,description:O,disabled:!1}))}return t.find(o=>o.id===r.id)?[...t.map(o=>r.id===o.id?r:o)]:[{...r}]},[]),T(t=>t),R(this.handleError$))}async generateMessage(){try{await this.checkIsAvailableOllama();const t=await this.createChatCompletions(),{type:r,generate:n,logging:s}=this.params.config,o=this.createSystemPrompt();return s&&L(`Ollama_${this.model}`,this.params.stagedDiff.diff,o,t),j(this.sanitizeMessage(t,r,n))}catch(t){const r=t;throw r.code==="ENOTFOUND"?new b(`Error connecting to ${r.hostname} (${r.syscall})`):r}}async checkIsAvailableOllama(){try{return(await new M({method:"GET",baseURL:`${this.host}`,timeout:this.params.config.OLLAMA_TIMEOUT}).execute()).data}catch(t){throw t.code==="ECONNREFUSED"?new b(`Error connecting to ${this.host}. Please run Ollama or check host`):t}}async createChatCompletions(){const t=this.createSystemPrompt();return(await this.ollama.chat({model:this.model,messages:[{role:"system",content:t},{role:"user",content:`${this.params.stagedDiff.diff}`}],stream:!1,options:{temperature:this.params.config.temperature}})).message.content}createSystemPrompt(){return`${Q(this.params.config.locale,this.params.config["max-length"],this.params.config.type,this.params.config.prompt)}
74
+ ${ie(this.params.config.generate)}`}}class ga extends Y{constructor(t){super(t),this.params=t,this.handleError$=r=>{let n="An error occurred";if(r.message){n=r.message.split(`
75
+ `)[0];const s=this.extractJSONFromError(r.message);n+=`: ${s.error.message}`}return G({name:`${this.errorPrefix} ${n}`,value:n,isError:!0,disabled:!0})},this.colors={primary:"#74AA9C",secondary:"#FFF"},this.serviceName=g.bgHex(this.colors.primary).hex(this.colors.secondary).bold("[ChatGPT]"),this.errorPrefix=g.red.bold("[ChatGPT]")}generateCommitMessage$(){return H(sa(this.params.config.OPENAI_URL,this.params.config.OPENAI_PATH,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.prompt,this.params.config.logging,this.params.config.proxy)).pipe(T(t=>S(t)),I(t=>({name:`${this.serviceName} ${t}`,value:t,isError:!1})),R(this.handleError$))}extractJSONFromError(t){const r=/[{[]{1}([,:{}[\]0-9.\-+Eaeflnr-u \n\r\t]|".*?")+[}\]]{1}/gis,n=t.match(r);return n?Object.assign({},...n.map(s=>JSON.parse(s))):{error:{message:"Unknown error"}}}}class gn{constructor(t,r){this.config=t,this.stagedDiff=r}createAIRequests$(t){return S(t).pipe(zt(r=>{const n={config:this.config,stagedDiff:this.stagedDiff,keyName:r};switch(r){case _.OPEN_AI:return z.create(ga,n).generateCommitMessage$();case _.GEMINI:return z.create(pa,n).generateCommitMessage$();case _.ANTHROPIC:return z.create(ua,n).generateCommitMessage$();case _.HUGGING:return z.create(da,n).generateCommitMessage$();case _.CLOVA_X:return z.create(la,n).generateCommitMessage$();case _.MISTRAL:return z.create(ma,n).generateCommitMessage$();case _.OLLAMA:return S(this.config.OLLAMA_MODEL).pipe(zt(o=>{const u={...n,keyName:o};return z.create(ha,u).generateCommitMessage$()}));case _.COHERE:return z.create(fa,n).generateCommitMessage$();default:const s=g.red.bold(`[${r}]`);return G({name:s+" Invalid AI type",value:"Invalid AI type",isError:!0,disabled:!0})}}))}}const Cn=async()=>{const{stdout:e,failed:t}=await ue("git",["rev-parse","--show-toplevel"],{reject:!1});if(t)throw new b("The current directory must be a Git repository!");return e},_t=e=>`:(exclude)${e}`,En=["package-lock.json","pnpm-lock.yaml","*.lock","*.gif","*.png"].map(_t),Fn=async e=>{const t=["diff","--cached","--diff-algorithm=minimal"],{stdout:r}=await ue("git",[...t,"--name-only",...En,...e?e.map(_t):[]]);if(!r)return null;const{stdout:n}=await ue("git",[...t,...En,...e?e.map(_t):[]]);return{files:r.split(`
76
+ `),diff:n}},Ca=e=>`Detected ${e.length.toLocaleString()} staged file${e.length>1?"s":""}`;class we{constructor(){this.title="aicommit2"}printTitle(){console.log(Qn.textSync(this.title,{font:"Small"}))}displaySpinner(t){return Ge(t).start()}stopSpinner(t){t.stop(),t.clear()}printStagedFiles(t){console.log(g.bold.green("\u2714 ")+g.bold(`${Ca(t.files)}:`)),console.log(`${t.files.map(r=>` ${r}`).join(`
77
77
  `)}
78
78
  `)}printAnalyzed(){console.log(`
79
79
  ${g.bold.green("\u2714")} ${g.bold("Changes analyzed")}`)}printCommitted(){console.log(`
@@ -81,14 +81,14 @@ ${g.bold.green("\u2714")} ${g.bold("Successfully committed!")}`)}printCopied(){c
81
81
  ${g.bold.green("\u2714")} ${g.bold("Successfully copied! Press 'Ctrl + V' to paste")}`)}printSavedCommitMessage(){console.log(`
82
82
  ${g.bold.green("\u2714")} ${g.bold("Saved commit message")}`)}printCancelledCommit(){console.log(`
83
83
  ${g.bold.yellow("\u26A0")} ${g.yellow("Commit cancelled")}`)}printErrorMessage(t){console.log(`
84
- ${g.bold.red("\u2716")} ${g.red(`${t}`)}`)}moveCursorUp(){const t=we.createInterface({input:process.stdin,output:process.stdout});we.moveCursor(process.stdout,0,-1),t.close()}moveCursorDown(){const t=we.createInterface({input:process.stdin,output:process.stdout});we.moveCursor(process.stdout,0,1),t.close()}}const Ca={isLoading:!1,startOption:{text:"AI is analyzing your changes"}},Nt="No commit messages were generated";class Ea{constructor(){this.choices$=new zt([]),this.loader$=new zt(Ca),this.destroyed$=new Pn(1)}initPrompt(){return je.registerPrompt("reactiveListPrompt",Qn),je.prompt({type:"reactiveListPrompt",name:"aicommit2Prompt",message:"Pick a commit message to use: ",emptyMessage:`\u26A0 ${Nt}`,choices$:this.choices$,loader$:this.loader$,loop:!1})}startLoader(){this.loader$.next({isLoading:!0})}refreshChoices(t){const{value:r,isError:n}=t;if(!t||!r)return;if(!t.id){this.choices$.next([...this.currentChoices,t].sort(he));return}this.checkStreamChoice(t)}checkErrorOnChoices(){if(this.choices$.getValue().map(r=>r).every(r=>r?.isError||r?.disabled)){this.alertNoGeneratedMessage(),this.logEmptyCommitMessage(),process.exit(1);return}this.stopLoaderOnSuccess()}completeSubject(){this.choices$.complete(),this.loader$.complete(),this.destroyed$.next(!0),this.destroyed$.complete()}alertNoGeneratedMessage(){this.loader$.next({isLoading:!1,message:Nt,stopOption:{doneFrame:"\u26A0",color:"yellow"}})}stopLoaderOnSuccess(){this.loader$.next({isLoading:!1,message:"Changes analyzed"})}logEmptyCommitMessage(){console.log(`${g.bold.yellow("\u26A0")} ${g.yellow(`${Nt}`)}`)}checkStreamChoice(t){if(t.description===O){const s=this.currentChoices.find(o=>{const u=o.id||"",a=/\d/.test(u);return t.id?.includes(u)&&!a});if(s){this.choices$.next([...this.currentChoices.filter(o=>o.id!==s.id),t].sort(he));return}this.choices$.next([...this.currentChoices,t].sort(he));return}if(this.currentChoices.find(s=>s?.id===t.id)){this.choices$.next(this.currentChoices.map(s=>s?.id===t.id?t:s).sort(he));return}this.choices$.next([...this.currentChoices,t].sort(he))}get currentChoices(){return this.choices$.getValue().map(t=>t)}}const U=new be;var Fa=async(e,t,r,n,s,o,u,a,i)=>(async()=>{U.printTitle(),await hn(),n&&await ue("git",["add","--update"]);const l=U.displaySpinner("Detecting staged files"),f=await Cn(r);if(l.stop(),!f)throw new b("No staged changes found. Stage your changes manually, or automatically stage all changes with the `--all` flag.");U.printStagedFiles(f);const{env:c}=process,D=await Pt({OPENAI_KEY:c.OPENAI_KEY||c.OPENAI_API_KEY,OPENAI_MODEL:c.OPENAI_MODEL||c["openai-model"]||c.openai_model,OPENAI_URL:c.OPENAI_URL||c["openai-url"]||c.OPENAI_URL,GEMINI_KEY:c.GEMINI_KEY||c.GEMINI_API_KEY,GEMINI_MODEL:c.GEMINI_MODEL||c["gemini-model"]||c.gemini_model,ANTHROPIC_KEY:c.ANTHROPIC_KEY||c.ANTHROPIC_API_KEY,ANTHROPIC_MODEL:c.ANTHROPIC_MODEL||c["anthropic-model"]||c.anthropic_model,HUGGING_COOKIE:c.HUGGING_COOKIE||c.HUGGING_API_KEY||c.HF_TOKEN,HUGGING_MODEL:c.HUGGING_MODEL||c["hugging-model"],CLOVAX_COOKIE:c.CLOVAX_COOKIE||c.CLOVA_X_COOKIE,proxy:c.https_proxy||c.HTTPS_PROXY||c.http_proxy||c.HTTP_PROXY,temperature:c.temperature,generate:t?.toString()||c.generate,type:s?.toString()||c.type,locale:e?.toString()||c.locale,prompt:a?.toString()||c.prompt}),p=Object.entries(D).filter(([A])=>Ur.includes(A)).filter(([A,Le])=>!!Le).map(([A])=>A);if(p.length===0)throw new b("Please set at least one API key via `aicommit2 config set OPENAI_KEY=<your token>`");const h=new mn(D,f),m=new Ea,C=m.initPrompt();m.startLoader();const w=h.createAIRequests$(p).subscribe(A=>m.refreshChoices(A),()=>{},()=>m.checkErrorOnChoices()),F=await C;w.unsubscribe(),m.completeSubject(),U.moveCursorUp();const M=F.aicommit2Prompt?.value;if(!M)throw new b("An error occurred! No selected message");if(u&&(ys("copy-paste").copy(M),U.printCopied(),process.exit()),o){const A=Ge("Committing with the generated message").start();await ue("git",["commit","-m",M,...i]),A.stop(),A.clear(),U.printCommitted(),process.exit()}const N=await je.prompt([{type:"confirm",name:"confirmationPrompt",message:"Use selected message?",default:!0}]),{confirmationPrompt:W}=N;if(W){const A=Ge("Committing with the generated message").start();await ue("git",["commit","-m",M,...i]),A.stop(),A.clear(),U.printCommitted(),process.exit()}U.printCancelledCommit(),process.exit()})().catch(l=>{U.printErrorMessage(l.message),me(l),process.exit(1)}),ya=Je({name:"config",parameters:["<mode>","<key=value...>"]},e=>{(async()=>{const{mode:t,keyValue:r}=e._;if(t==="get"){const n=await Pt({},!0);for(const s of r)Q(n,s)&&console.log(`${s}=${n[s]}`);return}if(t==="set"){await ca(r.map(n=>n.split("=")));return}throw new b(`Invalid mode: ${t}`)})().catch(t=>{new be().printErrorMessage(t.message),me(t),process.exit(1)})});const En="prepare-commit-msg",Fn=`.git/hooks/${En}`,Te=Un(new URL("cli.mjs",import.meta.url)),ba=process.argv[1].replace(/\\/g,"/").endsWith(`/${Fn}`),yn=process.platform==="win32",bn=`
84
+ ${g.bold.red("\u2716")} ${g.red(`${t}`)}`)}moveCursorUp(){const t=Ae.createInterface({input:process.stdin,output:process.stdout});Ae.moveCursor(process.stdout,0,-1),t.close()}moveCursorDown(){const t=Ae.createInterface({input:process.stdin,output:process.stdout});Ae.moveCursor(process.stdout,0,1),t.close()}}const Ea={isLoading:!1,startOption:{text:"AI is analyzing your changes"}},Lt="No commit messages were generated";class Fa{constructor(){this.choices$=new Yt([]),this.loader$=new Yt(Ea),this.destroyed$=new _n(1)}initPrompt(){return je.registerPrompt("reactiveListPrompt",eo),je.prompt({type:"reactiveListPrompt",name:"aicommit2Prompt",message:"Pick a commit message to use: ",emptyMessage:`\u26A0 ${Lt}`,choices$:this.choices$,loader$:this.loader$,loop:!1})}startLoader(){this.loader$.next({isLoading:!0})}refreshChoices(t){const{value:r,isError:n}=t;if(!t||!r)return;if(!t.id){this.choices$.next([...this.currentChoices,t].sort(ge));return}this.checkStreamChoice(t)}checkErrorOnChoices(){if(this.choices$.getValue().map(r=>r).every(r=>r?.isError||r?.disabled)){this.alertNoGeneratedMessage(),this.logEmptyCommitMessage(),process.exit(1);return}this.stopLoaderOnSuccess()}completeSubject(){this.choices$.complete(),this.loader$.complete(),this.destroyed$.next(!0),this.destroyed$.complete()}alertNoGeneratedMessage(){this.loader$.next({isLoading:!1,message:Lt,stopOption:{doneFrame:"\u26A0",color:"yellow"}})}stopLoaderOnSuccess(){this.loader$.next({isLoading:!1,message:"Changes analyzed"})}logEmptyCommitMessage(){console.log(`${g.bold.yellow("\u26A0")} ${g.yellow(`${Lt}`)}`)}checkStreamChoice(t){if(t.description===O){const s=this.currentChoices.find(o=>{const u=o.id||"",a=/\d/.test(u);return t.id?.includes(u)&&!a});if(s){this.choices$.next([...this.currentChoices.filter(o=>o.id!==s.id),t].sort(ge));return}this.choices$.next([...this.currentChoices,t].sort(ge));return}if(this.currentChoices.find(s=>s?.id===t.id)){this.choices$.next(this.currentChoices.map(s=>s?.id===t.id?t:s).sort(ge));return}this.choices$.next([...this.currentChoices,t].sort(ge))}get currentChoices(){return this.choices$.getValue().map(t=>t)}}const U=new we;var ya=async(e,t,r,n,s,o,u,a,i)=>(async()=>{U.printTitle(),await Cn(),n&&await ue("git",["add","--update"]);const l=U.displaySpinner("Detecting staged files"),f=await Fn(r);if(l.stop(),!f)throw new b("No staged changes found. Stage your changes manually, or automatically stage all changes with the `--all` flag.");U.printStagedFiles(f);const{env:c}=process,D=await Pt({OPENAI_KEY:c.OPENAI_KEY||c.OPENAI_API_KEY,OPENAI_MODEL:c.OPENAI_MODEL||c["openai-model"]||c.openai_model,OPENAI_URL:c.OPENAI_URL||c["openai-url"]||c.OPENAI_URL,GEMINI_KEY:c.GEMINI_KEY||c.GEMINI_API_KEY,GEMINI_MODEL:c.GEMINI_MODEL||c["gemini-model"]||c.gemini_model,ANTHROPIC_KEY:c.ANTHROPIC_KEY||c.ANTHROPIC_API_KEY,ANTHROPIC_MODEL:c.ANTHROPIC_MODEL||c["anthropic-model"]||c.anthropic_model,HUGGING_COOKIE:c.HUGGING_COOKIE||c.HUGGING_API_KEY||c.HF_TOKEN,HUGGING_MODEL:c.HUGGING_MODEL||c["hugging-model"],CLOVAX_COOKIE:c.CLOVAX_COOKIE||c.CLOVA_X_COOKIE,proxy:c.https_proxy||c.HTTPS_PROXY||c.http_proxy||c.HTTP_PROXY,temperature:c.temperature,generate:t?.toString()||c.generate,type:s?.toString()||c.type,locale:e?.toString()||c.locale,prompt:a?.toString()||c.prompt}),p=Object.entries(D).filter(([A])=>Kr.includes(A)).filter(([A,De])=>A===_.OLLAMA?!!De&&De.length>0:!!De).map(([A])=>A);if(p.length===0)throw new b("Please set at least one API key via `aicommit2 config set OPENAI_KEY=<your token>`");const h=new gn(D,f),m=new Fa,C=m.initPrompt();m.startLoader();const w=h.createAIRequests$(p).subscribe(A=>m.refreshChoices(A),()=>{},()=>m.checkErrorOnChoices()),F=await C;w.unsubscribe(),m.completeSubject(),U.moveCursorUp();const P=F.aicommit2Prompt?.value;if(!P)throw new b("An error occurred! No selected message");if(u&&(bs("copy-paste").copy(P),U.printCopied(),process.exit()),o){const A=Ge("Committing with the generated message").start();await ue("git",["commit","-m",P,...i]),A.stop(),A.clear(),U.printCommitted(),process.exit()}const N=await je.prompt([{type:"confirm",name:"confirmationPrompt",message:"Use selected message?",default:!0}]),{confirmationPrompt:V}=N;if(V){const A=Ge("Committing with the generated message").start();await ue("git",["commit","-m",P,...i]),A.stop(),A.clear(),U.printCommitted(),process.exit()}U.printCancelledCommit(),process.exit()})().catch(l=>{U.printErrorMessage(l.message),he(l),process.exit(1)}),ba=Je({name:"config",parameters:["<mode>","<key=value...>"]},e=>{(async()=>{const{mode:t,keyValue:r}=e._;if(t==="get"){const n=await Pt({},!0);for(const s of r)W(n,s)&&console.log(`${s}=${n[s]}`);return}if(t==="set"){await Da(r.map(n=>n.split("=")));return}throw new b(`Invalid mode: ${t}`)})().catch(t=>{new we().printErrorMessage(t.message),he(t),process.exit(1)})});const yn="prepare-commit-msg",bn=`.git/hooks/${yn}`,Te=Kn(new URL("cli.mjs",import.meta.url)),wa=process.argv[1].replace(/\\/g,"/").endsWith(`/${bn}`),wn=process.platform==="win32",An=`
85
85
  #!/usr/bin/env node
86
- import(${JSON.stringify(Kn(Te))})
87
- `.trim();var wa=Je({name:"hook",parameters:["<install/uninstall>"]},e=>{(async()=>{const t=await hn(),{installUninstall:r}=e._,n=q.join(t,Fn),s=await ln(n);if(r==="install"){if(s){if(await x.realpath(n).catch(()=>{})===Te){console.warn("The hook is already installed");return}throw new b(`A different ${En} hook seems to be installed. Please remove it before installing aicommit2.`)}await x.mkdir(q.dirname(n),{recursive:!0}),yn?await x.writeFile(n,bn):(await x.symlink(Te,n,"file"),await x.chmod(n,493)),console.log(`${g.green("\u2714")} Hook installed`);return}if(r==="uninstall"){if(!s){console.warn("Hook is not installed");return}if(yn){if(await x.readFile(n,"utf8")!==bn){console.warn("Hook is not installed");return}}else if(await x.realpath(n)!==Te){console.warn("Hook is not installed");return}await x.rm(n),console.log(`${g.green("\u2714")} Hook uninstalled`);return}throw new b(`Invalid mode: ${r}`)})().catch(t=>{console.error(`${g.red("\u2716")} ${t.message}`),me(t),process.exit(1)})}),Aa=Je({name:"log",parameters:["<removeAll>"]},e=>{(async()=>{const{removeAll:t}=e._;if(t==="removeAll"){await eo(Yr,{recursive:!0,force:!0}),console.log(`${g.green("\u2714")} All Log files are removed!`);return}throw new b(`Invalid mode: ${t}`)})().catch(t=>{new be().printErrorMessage(t.message),me(t),process.exit(1)})});const[Tt,va]=process.argv.slice(2);var $a=()=>(async()=>{if(!Tt)throw new b('Commit message file path is missing. This file should be called from the "prepare-commit-msg" git hook');if(va)return;const e=await Cn();if(!e)return;const t=new be;t.printTitle();const{env:r}=process,n=await Pt({proxy:r.https_proxy||r.HTTPS_PROXY||r.http_proxy||r.HTTP_PROXY}),s=Object.entries(n).filter(([p])=>Ur.includes(p)).filter(([p,d])=>!!d).map(([p])=>p);if(s.length===0)throw new b("Please set at least one API key via `aicommit2 config set OPENAI_KEY=<your token>`");const u=new mn(n,e),a=t.displaySpinner("The AI is analyzing your changes");let i;try{i=await _n(u.createAIRequests$(s).pipe(Ut(p=>!p.isError),I(p=>p.value),Nn()))}finally{a.stop(),a.clear(),t.printAnalyzed()}const f=await x.readFile(Tt,"utf8")!=="",c=i.length>1;let D="";f&&(D=`# \u{1F916} AI generated commit${c?"s":""}
86
+ import(${JSON.stringify(qn(Te))})
87
+ `.trim();var Aa=Je({name:"hook",parameters:["<install/uninstall>"]},e=>{(async()=>{const t=await Cn(),{installUninstall:r}=e._,n=q.join(t,bn),s=await pn(n);if(r==="install"){if(s){if(await x.realpath(n).catch(()=>{})===Te){console.warn("The hook is already installed");return}throw new b(`A different ${yn} hook seems to be installed. Please remove it before installing aicommit2.`)}await x.mkdir(q.dirname(n),{recursive:!0}),wn?await x.writeFile(n,An):(await x.symlink(Te,n,"file"),await x.chmod(n,493)),console.log(`${g.green("\u2714")} Hook installed`);return}if(r==="uninstall"){if(!s){console.warn("Hook is not installed");return}if(wn){if(await x.readFile(n,"utf8")!==An){console.warn("Hook is not installed");return}}else if(await x.realpath(n)!==Te){console.warn("Hook is not installed");return}await x.rm(n),console.log(`${g.green("\u2714")} Hook uninstalled`);return}throw new b(`Invalid mode: ${r}`)})().catch(t=>{console.error(`${g.red("\u2716")} ${t.message}`),he(t),process.exit(1)})}),va=Je({name:"log",parameters:["<removeAll>"]},e=>{(async()=>{const{removeAll:t}=e._;if(t==="removeAll"){await to(Vr,{recursive:!0,force:!0}),console.log(`${g.green("\u2714")} All Log files are removed!`);return}throw new b(`Invalid mode: ${t}`)})().catch(t=>{new we().printErrorMessage(t.message),he(t),process.exit(1)})});const[Nt,$a]=process.argv.slice(2);var Ba=()=>(async()=>{if(!Nt)throw new b('Commit message file path is missing. This file should be called from the "prepare-commit-msg" git hook');if($a)return;const e=await Fn();if(!e)return;const t=new we;t.printTitle();const{env:r}=process,n=await Pt({proxy:r.https_proxy||r.HTTPS_PROXY||r.http_proxy||r.HTTP_PROXY}),s=Object.entries(n).filter(([p])=>Kr.includes(p)).filter(([p,d])=>p===_.OLLAMA?!!d&&d.length>0:!!d).map(([p])=>p);if(s.length===0)throw new b("Please set at least one API key via `aicommit2 config set OPENAI_KEY=<your token>`");const u=new gn(n,e),a=t.displaySpinner("The AI is analyzing your changes");let i;try{i=await Ln(u.createAIRequests$(s).pipe(Ut(p=>!p.isError),I(p=>p.value),Nn()))}finally{a.stop(),a.clear(),t.printAnalyzed()}const f=await x.readFile(Nt,"utf8")!=="",c=i.length>1;let D="";f&&(D=`# \u{1F916} AI generated commit${c?"s":""}
88
88
  `),c?(f&&(D+=`# Select one of the following messages by uncommenting:
89
89
  `),D+=`
90
90
  ${i.map(p=>`# ${p}`).join(`
91
91
  `)}`):(f&&(D+=`# Edit the message below and commit:
92
92
  `),D+=`
93
93
  ${i[0]}
94
- `),await x.appendFile(Tt,D),t.printSavedCommitMessage()})().catch(e=>{new be().printErrorMessage(e.message),me(e),process.exit(1)});const wn=process.argv.slice(2);Fs({name:"aicommit2",version:Kr,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},prompt:{type:String,description:"Additional prompt to let users fine-tune provided prompt",alias:"p"}},commands:[ya,wa,Aa],help:{description:bi},ignoreArgv:e=>e==="unknown-flag"||e==="argument"},e=>{if(ba){$a();return}Fa(e.flags.locale,e.flags.generate,e.flags.exclude,e.flags.all,e.flags.type,e.flags.confirm,e.flags.clipboard,e.flags.prompt,wn)},wn);
94
+ `),await x.appendFile(Nt,D),t.printSavedCommitMessage()})().catch(e=>{new we().printErrorMessage(e.message),he(e),process.exit(1)});const vn=process.argv.slice(2);ys({name:"aicommit2",version:qr,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},prompt:{type:String,description:"Additional prompt to let users fine-tune provided prompt",alias:"p"}},commands:[ba,Aa,va],help:{description:wi},ignoreArgv:e=>e==="unknown-flag"||e==="argument"},e=>{if(wa){Ba();return}ya(e.flags.locale,e.flags.generate,e.flags.exclude,e.flags.all,e.flags.type,e.flags.confirm,e.flags.clipboard,e.flags.prompt,vn)},vn);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aicommit2",
3
- "version": "1.9.4",
3
+ "version": "1.9.5",
4
4
  "description": "A Reactive CLI that generates git commit messages with various AI",
5
5
  "keywords": [
6
6
  "cli",