@sugarmo/aicommits 1.17.0 → 1.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +10 -0
  2. package/dist/cli.mjs +111 -110
  3. package/package.json +1 -1
package/dist/cli.mjs CHANGED
@@ -1,147 +1,148 @@
1
1
  #!/usr/bin/env node
2
- import rt from"tty";import{Buffer as qr}from"node:buffer";import oe from"node:path";import pu,{ChildProcess as Hr}from"node:child_process";import T,{stdin as Vr,stdout as Kr}from"node:process";import Jr from"child_process";import N from"path";import Dt from"fs";import{fileURLToPath as Cu}from"node:url";import Yr,{constants as mu}from"node:os";import hu from"assert";import gu from"events";import{createWriteStream as Zr,createReadStream as Xr}from"node:fs";import Qr from"buffer";import ot from"stream";import Eu from"util";import{debuglog as eD}from"node:util";import yu from"node:readline";import{WriteStream as tD}from"node:tty";import A from"fs/promises";import Oe from"os";import uD from"https";import nD from"net";import rD from"tls";import DD,{fileURLToPath as bu,pathToFileURL as oD}from"url";const sD="known-flag",iD="unknown-flag",aD="argument",{stringify:Fe}=JSON,cD=/\B([A-Z])/g,lD=e=>e.replace(cD,"-$1").toLowerCase(),{hasOwnProperty:fD}=Object.prototype,pe=(e,t)=>fD.call(e,t),dD=e=>Array.isArray(e),wu=e=>typeof e=="function"?[e,!1]:dD(e)?[e[0],!0]:wu(e.type),FD=(e,t)=>e===Boolean?t!=="false":t,pD=(e,t)=>typeof t=="boolean"?t:e===Number&&t===""?Number.NaN:e(t),CD=/[\s.:=]/,mD=e=>{const t=`Flag name ${Fe(e)}`;if(e.length===0)throw new Error(`${t} cannot be empty`);if(e.length===1)throw new Error(`${t} must be longer than a character`);const u=e.match(CD);if(u)throw new Error(`${t} cannot contain ${Fe(u?.[0])}`)},hD=e=>{const t={},u=(n,D)=>{if(pe(t,n))throw new Error(`Duplicate flags named ${Fe(n)}`);t[n]=D};for(const n in e){if(!pe(e,n))continue;mD(n);const D=e[n],o=[[],...wu(D),D];u(n,o);const r=lD(n);if(n!==r&&u(r,o),"alias"in D&&typeof D.alias=="string"){const{alias:i}=D,s=`Flag alias ${Fe(i)} for flag ${Fe(n)}`;if(i.length===0)throw new Error(`${s} cannot be empty`);if(i.length>1)throw new Error(`${s} must be a single character`);u(i,o)}}return t},gD=(e,t)=>{const u={};for(const n in e){if(!pe(e,n))continue;const[D,,o,r]=t[n];if(D.length===0&&"default"in r){let{default:i}=r;typeof i=="function"&&(i=i()),u[n]=i}else u[n]=o?D:D.pop()}return u},Te="--",ED=/[.:=]/,yD=/^-{1,2}\w/,bD=e=>{if(!yD.test(e))return;const t=!e.startsWith(Te);let u=e.slice(t?1:2),n;const D=u.match(ED);if(D){const{index:o}=D;n=u.slice(o+1),u=u.slice(0,o)}return[u,n,t]},wD=(e,{onFlag:t,onArgument:u})=>{let n;const D=(o,r)=>{if(typeof n!="function")return!0;n(o,r),n=void 0};for(let o=0;o<e.length;o+=1){const r=e[o];if(r===Te){D();const s=e.slice(o+1);u?.(s,[o],!0);break}const i=bD(r);if(i){if(D(),!t)continue;const[s,c,f]=i;if(f)for(let l=0;l<s.length;l+=1){D();const a=l===s.length-1;n=t(s[l],a?c:void 0,[o,l+1,a])}else n=t(s,c,[o])}else D(r,[o])&&u?.([r],[o])}D()},BD=(e,t)=>{for(const[u,n,D]of t.reverse()){if(n){const o=e[u];let r=o.slice(0,n);if(D||(r+=o.slice(n+1)),r!=="-"){e[u]=r;continue}}e.splice(u,1)}},vD=(e,t=process.argv.slice(2),{ignore:u}={})=>{const n=[],D=hD(e),o={},r=[];return r[Te]=[],wD(t,{onFlag(i,s,c){const f=pe(D,i);if(!u?.(f?sD:iD,i,s)){if(f){const[l,a]=D[i],d=FD(a,s),F=(m,p)=>{n.push(c),p&&n.push(p),l.push(pD(a,m||""))};return d===void 0?F:F(d)}pe(o,i)||(o[i]=[]),o[i].push(s===void 0?!0:s),n.push(c)}},onArgument(i,s,c){u?.(aD,t[s[0]])||(r.push(...i),c?(r[Te]=i,t.splice(s[0])):n.push(s))}}),BD(t,n),{flags:gD(e,D),unknownFlags:o,_:r}};var AD=Object.create,Pe=Object.defineProperty,$D=Object.defineProperties,xD=Object.getOwnPropertyDescriptor,SD=Object.getOwnPropertyDescriptors,kD=Object.getOwnPropertyNames,Bu=Object.getOwnPropertySymbols,MD=Object.getPrototypeOf,vu=Object.prototype.hasOwnProperty,ID=Object.prototype.propertyIsEnumerable,Au=(e,t,u)=>t in e?Pe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:u}):e[t]=u,Re=(e,t)=>{for(var u in t||(t={}))vu.call(t,u)&&Au(e,u,t[u]);if(Bu)for(var u of Bu(t))ID.call(t,u)&&Au(e,u,t[u]);return e},st=(e,t)=>$D(e,SD(t)),OD=e=>Pe(e,"__esModule",{value:!0}),TD=(e,t)=>()=>(e&&(t=e(e=0)),t),PD=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),RD=(e,t,u,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let D of kD(t))!vu.call(e,D)&&(u||D!=="default")&&Pe(e,D,{get:()=>t[D],enumerable:!(n=xD(t,D))||n.enumerable});return e},_D=(e,t)=>RD(OD(Pe(e!=null?AD(MD(e)):{},"default",!t&&e&&e.__esModule?{get:()=>e.default,enumerable:!0}:{value:e,enumerable:!0})),e),L=TD(()=>{}),jD=PD((e,t)=>{L(),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}});L(),L(),L();var ND=e=>{var t,u,n;let D=(t=process.stdout.columns)!=null?t:Number.POSITIVE_INFINITY;return typeof e=="function"&&(e=e(D)),e||(e={}),Array.isArray(e)?{columns:e,stdoutColumns:D}:{columns:(u=e.columns)!=null?u:[],stdoutColumns:(n=e.stdoutColumns)!=null?n:D}};L(),L(),L(),L(),L();function LD({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 $u(e){if(typeof e!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof e}\``);return e.replace(LD(),"")}L();function GD(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 WD=_D(jD(),1);function ue(e){if(typeof e!="string"||e.length===0||(e=$u(e),e.length===0))return 0;e=e.replace((0,WD.default)()," ");let t=0;for(let u=0;u<e.length;u++){let n=e.codePointAt(u);n<=31||n>=127&&n<=159||n>=768&&n<=879||(n>65535&&u++,t+=GD(n)?2:1)}return t}var xu=e=>Math.max(...e.split(`
3
- `).map(ue)),zD=e=>{let t=[];for(let u of e){let{length:n}=u,D=n-t.length;for(let o=0;o<D;o+=1)t.push(0);for(let o=0;o<n;o+=1){let r=xu(u[o]);r>t[o]&&(t[o]=r)}}return t};L();var Su=/^\d+%$/,ku={width:"auto",align:"left",contentWidth:0,paddingLeft:0,paddingRight:0,paddingTop:0,paddingBottom:0,horizontalPadding:0,paddingLeftString:"",paddingRightString:""},UD=(e,t)=>{var u;let n=[];for(let D=0;D<e.length;D+=1){let o=(u=t[D])!=null?u:"auto";if(typeof o=="number"||o==="auto"||o==="content-width"||typeof o=="string"&&Su.test(o)){n.push(st(Re({},ku),{width:o,contentWidth:e[D]}));continue}if(o&&typeof o=="object"){let r=st(Re(Re({},ku),o),{contentWidth:e[D]});r.horizontalPadding=r.paddingLeft+r.paddingRight,n.push(r);continue}throw new Error(`Invalid column width: ${JSON.stringify(o)}`)}return n};function qD(e,t){for(let u of e){let{width:n}=u;if(n==="content-width"&&(u.width=u.contentWidth),n==="auto"){let s=Math.min(20,u.contentWidth);u.width=s,u.autoOverflow=u.contentWidth-s}if(typeof n=="string"&&Su.test(n)){let s=Number.parseFloat(n.slice(0,-1))/100;u.width=Math.floor(t*s)-(u.paddingLeft+u.paddingRight)}let{horizontalPadding:D}=u,o=1,r=o+D;if(r>=t){let s=r-t,c=Math.ceil(u.paddingLeft/D*s),f=s-c;u.paddingLeft-=c,u.paddingRight-=f,u.horizontalPadding=u.paddingLeft+u.paddingRight}u.paddingLeftString=u.paddingLeft?" ".repeat(u.paddingLeft):"",u.paddingRightString=u.paddingRight?" ".repeat(u.paddingRight):"";let i=t-u.horizontalPadding;u.width=Math.max(Math.min(u.width,i),o)}}var Mu=()=>Object.assign([],{columns:0});function HD(e,t){let u=[Mu()],[n]=u;for(let D of e){let o=D.width+D.horizontalPadding;n.columns+o>t&&(n=Mu(),u.push(n)),n.push(D),n.columns+=o}for(let D of u){let o=D.reduce((a,d)=>a+d.width+d.horizontalPadding,0),r=t-o;if(r===0)continue;let i=D.filter(a=>"autoOverflow"in a),s=i.filter(a=>a.autoOverflow>0),c=s.reduce((a,d)=>a+d.autoOverflow,0),f=Math.min(c,r);for(let a of s){let d=Math.floor(a.autoOverflow/c*f);a.width+=d,r-=d}let l=Math.floor(r/i.length);for(let a=0;a<i.length;a+=1){let d=i[a];a===i.length-1?d.width+=r:d.width+=l,r-=l}}return u}function VD(e,t,u){let n=UD(u,t);return qD(n,e),HD(n,e)}L(),L(),L();var it=10,Iu=(e=0)=>t=>`\x1B[${t+e}m`,Ou=(e=0)=>t=>`\x1B[${38+e};5;${t}m`,Tu=(e=0)=>(t,u,n)=>`\x1B[${38+e};2;${t};${u};${n}m`;function KD(){let e=new Map,t={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};t.color.gray=t.color.blackBright,t.bgColor.bgGray=t.bgColor.bgBlackBright,t.color.grey=t.color.blackBright,t.bgColor.bgGrey=t.bgColor.bgBlackBright;for(let[u,n]of Object.entries(t)){for(let[D,o]of Object.entries(n))t[D]={open:`\x1B[${o[0]}m`,close:`\x1B[${o[1]}m`},n[D]=t[D],e.set(o[0],o[1]);Object.defineProperty(t,u,{value:n,enumerable:!1})}return Object.defineProperty(t,"codes",{value:e,enumerable:!1}),t.color.close="\x1B[39m",t.bgColor.close="\x1B[49m",t.color.ansi=Iu(),t.color.ansi256=Ou(),t.color.ansi16m=Tu(),t.bgColor.ansi=Iu(it),t.bgColor.ansi256=Ou(it),t.bgColor.ansi16m=Tu(it),Object.defineProperties(t,{rgbToAnsi256:{value:(u,n,D)=>u===n&&n===D?u<8?16:u>248?231:Math.round((u-8)/247*24)+232:16+36*Math.round(u/255*5)+6*Math.round(n/255*5)+Math.round(D/255*5),enumerable:!1},hexToRgb:{value:u=>{let n=/(?<colorString>[a-f\d]{6}|[a-f\d]{3})/i.exec(u.toString(16));if(!n)return[0,0,0];let{colorString:D}=n.groups;D.length===3&&(D=D.split("").map(r=>r+r).join(""));let o=Number.parseInt(D,16);return[o>>16&255,o>>8&255,o&255]},enumerable:!1},hexToAnsi256:{value:u=>t.rgbToAnsi256(...t.hexToRgb(u)),enumerable:!1},ansi256ToAnsi:{value:u=>{if(u<8)return 30+u;if(u<16)return 90+(u-8);let n,D,o;if(u>=232)n=((u-232)*10+8)/255,D=n,o=n;else{u-=16;let s=u%36;n=Math.floor(u/36)/5,D=Math.floor(s/6)/5,o=s%6/5}let r=Math.max(n,D,o)*2;if(r===0)return 30;let i=30+(Math.round(o)<<2|Math.round(D)<<1|Math.round(n));return r===2&&(i+=60),i},enumerable:!1},rgbToAnsi:{value:(u,n,D)=>t.ansi256ToAnsi(t.rgbToAnsi256(u,n,D)),enumerable:!1},hexToAnsi:{value:u=>t.ansi256ToAnsi(t.hexToAnsi256(u)),enumerable:!1}}),t}var JD=KD(),YD=JD,_e=new Set(["\x1B","\x9B"]),ZD=39,at="\x07",Pu="[",XD="]",Ru="m",ct=`${XD}8;;`,_u=e=>`${_e.values().next().value}${Pu}${e}${Ru}`,ju=e=>`${_e.values().next().value}${ct}${e}${at}`,QD=e=>e.split(" ").map(t=>ue(t)),lt=(e,t,u)=>{let n=[...t],D=!1,o=!1,r=ue($u(e[e.length-1]));for(let[i,s]of n.entries()){let c=ue(s);if(r+c<=u?e[e.length-1]+=s:(e.push(s),r=0),_e.has(s)&&(D=!0,o=n.slice(i+1).join("").startsWith(ct)),D){o?s===at&&(D=!1,o=!1):s===Ru&&(D=!1);continue}r+=c,r===u&&i<n.length-1&&(e.push(""),r=0)}!r&&e[e.length-1].length>0&&e.length>1&&(e[e.length-2]+=e.pop())},eo=e=>{let t=e.split(" "),u=t.length;for(;u>0&&!(ue(t[u-1])>0);)u--;return u===t.length?e:t.slice(0,u).join(" ")+t.slice(u).join("")},to=(e,t,u={})=>{if(u.trim!==!1&&e.trim()==="")return"";let n="",D,o,r=QD(e),i=[""];for(let[c,f]of e.split(" ").entries()){u.trim!==!1&&(i[i.length-1]=i[i.length-1].trimStart());let l=ue(i[i.length-1]);if(c!==0&&(l>=t&&(u.wordWrap===!1||u.trim===!1)&&(i.push(""),l=0),(l>0||u.trim===!1)&&(i[i.length-1]+=" ",l++)),u.hard&&r[c]>t){let a=t-l,d=1+Math.floor((r[c]-a-1)/t);Math.floor((r[c]-1)/t)<d&&i.push(""),lt(i,f,t);continue}if(l+r[c]>t&&l>0&&r[c]>0){if(u.wordWrap===!1&&l<t){lt(i,f,t);continue}i.push("")}if(l+r[c]>t&&u.wordWrap===!1){lt(i,f,t);continue}i[i.length-1]+=f}u.trim!==!1&&(i=i.map(c=>eo(c)));let s=[...i.join(`
4
- `)];for(let[c,f]of s.entries()){if(n+=f,_e.has(f)){let{groups:a}=new RegExp(`(?:\\${Pu}(?<code>\\d+)m|\\${ct}(?<uri>.*)${at})`).exec(s.slice(c).join(""))||{groups:{}};if(a.code!==void 0){let d=Number.parseFloat(a.code);D=d===ZD?void 0:d}else a.uri!==void 0&&(o=a.uri.length===0?void 0:a.uri)}let l=YD.codes.get(Number(D));s[c+1]===`
5
- `?(o&&(n+=ju("")),D&&l&&(n+=_u(l))):f===`
6
- `&&(D&&l&&(n+=_u(D)),o&&(n+=ju(o)))}return n};function uo(e,t,u){return String(e).normalize().replace(/\r\n/g,`
2
+ import Dt from"tty";import{Buffer as Hr}from"node:buffer";import oe from"node:path";import Cu,{ChildProcess as Vr}from"node:child_process";import T,{stdin as Kr,stdout as Jr}from"node:process";import Yr from"child_process";import N from"path";import ot from"fs";import{fileURLToPath as mu}from"node:url";import Zr,{constants as hu}from"node:os";import gu from"assert";import Eu from"events";import{createWriteStream as Xr,createReadStream as Qr}from"node:fs";import eD from"buffer";import st from"stream";import yu from"util";import{debuglog as tD}from"node:util";import bu from"node:readline";import{WriteStream as uD}from"node:tty";import A from"fs/promises";import Oe from"os";import nD from"https";import rD from"net";import DD from"tls";import oD,{fileURLToPath as wu,pathToFileURL as sD}from"url";const iD="known-flag",aD="unknown-flag",cD="argument",{stringify:pe}=JSON,lD=/\B([A-Z])/g,fD=e=>e.replace(lD,"-$1").toLowerCase(),{hasOwnProperty:dD}=Object.prototype,Ce=(e,t)=>dD.call(e,t),FD=e=>Array.isArray(e),Bu=e=>typeof e=="function"?[e,!1]:FD(e)?[e[0],!0]:Bu(e.type),pD=(e,t)=>e===Boolean?t!=="false":t,CD=(e,t)=>typeof t=="boolean"?t:e===Number&&t===""?Number.NaN:e(t),mD=/[\s.:=]/,hD=e=>{const t=`Flag name ${pe(e)}`;if(e.length===0)throw new Error(`${t} cannot be empty`);if(e.length===1)throw new Error(`${t} must be longer than a character`);const u=e.match(mD);if(u)throw new Error(`${t} cannot contain ${pe(u?.[0])}`)},gD=e=>{const t={},u=(n,D)=>{if(Ce(t,n))throw new Error(`Duplicate flags named ${pe(n)}`);t[n]=D};for(const n in e){if(!Ce(e,n))continue;hD(n);const D=e[n],o=[[],...Bu(D),D];u(n,o);const r=fD(n);if(n!==r&&u(r,o),"alias"in D&&typeof D.alias=="string"){const{alias:i}=D,s=`Flag alias ${pe(i)} for flag ${pe(n)}`;if(i.length===0)throw new Error(`${s} cannot be empty`);if(i.length>1)throw new Error(`${s} must be a single character`);u(i,o)}}return t},ED=(e,t)=>{const u={};for(const n in e){if(!Ce(e,n))continue;const[D,,o,r]=t[n];if(D.length===0&&"default"in r){let{default:i}=r;typeof i=="function"&&(i=i()),u[n]=i}else u[n]=o?D:D.pop()}return u},Te="--",yD=/[.:=]/,bD=/^-{1,2}\w/,wD=e=>{if(!bD.test(e))return;const t=!e.startsWith(Te);let u=e.slice(t?1:2),n;const D=u.match(yD);if(D){const{index:o}=D;n=u.slice(o+1),u=u.slice(0,o)}return[u,n,t]},BD=(e,{onFlag:t,onArgument:u})=>{let n;const D=(o,r)=>{if(typeof n!="function")return!0;n(o,r),n=void 0};for(let o=0;o<e.length;o+=1){const r=e[o];if(r===Te){D();const s=e.slice(o+1);u?.(s,[o],!0);break}const i=wD(r);if(i){if(D(),!t)continue;const[s,c,f]=i;if(f)for(let l=0;l<s.length;l+=1){D();const a=l===s.length-1;n=t(s[l],a?c:void 0,[o,l+1,a])}else n=t(s,c,[o])}else D(r,[o])&&u?.([r],[o])}D()},vD=(e,t)=>{for(const[u,n,D]of t.reverse()){if(n){const o=e[u];let r=o.slice(0,n);if(D||(r+=o.slice(n+1)),r!=="-"){e[u]=r;continue}}e.splice(u,1)}},AD=(e,t=process.argv.slice(2),{ignore:u}={})=>{const n=[],D=gD(e),o={},r=[];return r[Te]=[],BD(t,{onFlag(i,s,c){const f=Ce(D,i);if(!u?.(f?iD:aD,i,s)){if(f){const[l,a]=D[i],d=pD(a,s),F=(h,p)=>{n.push(c),p&&n.push(p),l.push(CD(a,h||""))};return d===void 0?F:F(d)}Ce(o,i)||(o[i]=[]),o[i].push(s===void 0?!0:s),n.push(c)}},onArgument(i,s,c){u?.(cD,t[s[0]])||(r.push(...i),c?(r[Te]=i,t.splice(s[0])):n.push(s))}}),vD(t,n),{flags:ED(e,D),unknownFlags:o,_:r}};var $D=Object.create,Pe=Object.defineProperty,xD=Object.defineProperties,SD=Object.getOwnPropertyDescriptor,kD=Object.getOwnPropertyDescriptors,MD=Object.getOwnPropertyNames,vu=Object.getOwnPropertySymbols,ID=Object.getPrototypeOf,Au=Object.prototype.hasOwnProperty,OD=Object.prototype.propertyIsEnumerable,$u=(e,t,u)=>t in e?Pe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:u}):e[t]=u,Re=(e,t)=>{for(var u in t||(t={}))Au.call(t,u)&&$u(e,u,t[u]);if(vu)for(var u of vu(t))OD.call(t,u)&&$u(e,u,t[u]);return e},it=(e,t)=>xD(e,kD(t)),TD=e=>Pe(e,"__esModule",{value:!0}),PD=(e,t)=>()=>(e&&(t=e(e=0)),t),RD=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),_D=(e,t,u,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let D of MD(t))!Au.call(e,D)&&(u||D!=="default")&&Pe(e,D,{get:()=>t[D],enumerable:!(n=SD(t,D))||n.enumerable});return e},jD=(e,t)=>_D(TD(Pe(e!=null?$D(ID(e)):{},"default",!t&&e&&e.__esModule?{get:()=>e.default,enumerable:!0}:{value:e,enumerable:!0})),e),L=PD(()=>{}),ND=RD((e,t)=>{L(),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}});L(),L(),L();var LD=e=>{var t,u,n;let D=(t=process.stdout.columns)!=null?t:Number.POSITIVE_INFINITY;return typeof e=="function"&&(e=e(D)),e||(e={}),Array.isArray(e)?{columns:e,stdoutColumns:D}:{columns:(u=e.columns)!=null?u:[],stdoutColumns:(n=e.stdoutColumns)!=null?n:D}};L(),L(),L(),L(),L();function GD({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 xu(e){if(typeof e!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof e}\``);return e.replace(GD(),"")}L();function WD(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 zD=jD(ND(),1);function ue(e){if(typeof e!="string"||e.length===0||(e=xu(e),e.length===0))return 0;e=e.replace((0,zD.default)()," ");let t=0;for(let u=0;u<e.length;u++){let n=e.codePointAt(u);n<=31||n>=127&&n<=159||n>=768&&n<=879||(n>65535&&u++,t+=WD(n)?2:1)}return t}var Su=e=>Math.max(...e.split(`
3
+ `).map(ue)),UD=e=>{let t=[];for(let u of e){let{length:n}=u,D=n-t.length;for(let o=0;o<D;o+=1)t.push(0);for(let o=0;o<n;o+=1){let r=Su(u[o]);r>t[o]&&(t[o]=r)}}return t};L();var ku=/^\d+%$/,Mu={width:"auto",align:"left",contentWidth:0,paddingLeft:0,paddingRight:0,paddingTop:0,paddingBottom:0,horizontalPadding:0,paddingLeftString:"",paddingRightString:""},qD=(e,t)=>{var u;let n=[];for(let D=0;D<e.length;D+=1){let o=(u=t[D])!=null?u:"auto";if(typeof o=="number"||o==="auto"||o==="content-width"||typeof o=="string"&&ku.test(o)){n.push(it(Re({},Mu),{width:o,contentWidth:e[D]}));continue}if(o&&typeof o=="object"){let r=it(Re(Re({},Mu),o),{contentWidth:e[D]});r.horizontalPadding=r.paddingLeft+r.paddingRight,n.push(r);continue}throw new Error(`Invalid column width: ${JSON.stringify(o)}`)}return n};function HD(e,t){for(let u of e){let{width:n}=u;if(n==="content-width"&&(u.width=u.contentWidth),n==="auto"){let s=Math.min(20,u.contentWidth);u.width=s,u.autoOverflow=u.contentWidth-s}if(typeof n=="string"&&ku.test(n)){let s=Number.parseFloat(n.slice(0,-1))/100;u.width=Math.floor(t*s)-(u.paddingLeft+u.paddingRight)}let{horizontalPadding:D}=u,o=1,r=o+D;if(r>=t){let s=r-t,c=Math.ceil(u.paddingLeft/D*s),f=s-c;u.paddingLeft-=c,u.paddingRight-=f,u.horizontalPadding=u.paddingLeft+u.paddingRight}u.paddingLeftString=u.paddingLeft?" ".repeat(u.paddingLeft):"",u.paddingRightString=u.paddingRight?" ".repeat(u.paddingRight):"";let i=t-u.horizontalPadding;u.width=Math.max(Math.min(u.width,i),o)}}var Iu=()=>Object.assign([],{columns:0});function VD(e,t){let u=[Iu()],[n]=u;for(let D of e){let o=D.width+D.horizontalPadding;n.columns+o>t&&(n=Iu(),u.push(n)),n.push(D),n.columns+=o}for(let D of u){let o=D.reduce((a,d)=>a+d.width+d.horizontalPadding,0),r=t-o;if(r===0)continue;let i=D.filter(a=>"autoOverflow"in a),s=i.filter(a=>a.autoOverflow>0),c=s.reduce((a,d)=>a+d.autoOverflow,0),f=Math.min(c,r);for(let a of s){let d=Math.floor(a.autoOverflow/c*f);a.width+=d,r-=d}let l=Math.floor(r/i.length);for(let a=0;a<i.length;a+=1){let d=i[a];a===i.length-1?d.width+=r:d.width+=l,r-=l}}return u}function KD(e,t,u){let n=qD(u,t);return HD(n,e),VD(n,e)}L(),L(),L();var at=10,Ou=(e=0)=>t=>`\x1B[${t+e}m`,Tu=(e=0)=>t=>`\x1B[${38+e};5;${t}m`,Pu=(e=0)=>(t,u,n)=>`\x1B[${38+e};2;${t};${u};${n}m`;function JD(){let e=new Map,t={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};t.color.gray=t.color.blackBright,t.bgColor.bgGray=t.bgColor.bgBlackBright,t.color.grey=t.color.blackBright,t.bgColor.bgGrey=t.bgColor.bgBlackBright;for(let[u,n]of Object.entries(t)){for(let[D,o]of Object.entries(n))t[D]={open:`\x1B[${o[0]}m`,close:`\x1B[${o[1]}m`},n[D]=t[D],e.set(o[0],o[1]);Object.defineProperty(t,u,{value:n,enumerable:!1})}return Object.defineProperty(t,"codes",{value:e,enumerable:!1}),t.color.close="\x1B[39m",t.bgColor.close="\x1B[49m",t.color.ansi=Ou(),t.color.ansi256=Tu(),t.color.ansi16m=Pu(),t.bgColor.ansi=Ou(at),t.bgColor.ansi256=Tu(at),t.bgColor.ansi16m=Pu(at),Object.defineProperties(t,{rgbToAnsi256:{value:(u,n,D)=>u===n&&n===D?u<8?16:u>248?231:Math.round((u-8)/247*24)+232:16+36*Math.round(u/255*5)+6*Math.round(n/255*5)+Math.round(D/255*5),enumerable:!1},hexToRgb:{value:u=>{let n=/(?<colorString>[a-f\d]{6}|[a-f\d]{3})/i.exec(u.toString(16));if(!n)return[0,0,0];let{colorString:D}=n.groups;D.length===3&&(D=D.split("").map(r=>r+r).join(""));let o=Number.parseInt(D,16);return[o>>16&255,o>>8&255,o&255]},enumerable:!1},hexToAnsi256:{value:u=>t.rgbToAnsi256(...t.hexToRgb(u)),enumerable:!1},ansi256ToAnsi:{value:u=>{if(u<8)return 30+u;if(u<16)return 90+(u-8);let n,D,o;if(u>=232)n=((u-232)*10+8)/255,D=n,o=n;else{u-=16;let s=u%36;n=Math.floor(u/36)/5,D=Math.floor(s/6)/5,o=s%6/5}let r=Math.max(n,D,o)*2;if(r===0)return 30;let i=30+(Math.round(o)<<2|Math.round(D)<<1|Math.round(n));return r===2&&(i+=60),i},enumerable:!1},rgbToAnsi:{value:(u,n,D)=>t.ansi256ToAnsi(t.rgbToAnsi256(u,n,D)),enumerable:!1},hexToAnsi:{value:u=>t.ansi256ToAnsi(t.hexToAnsi256(u)),enumerable:!1}}),t}var YD=JD(),ZD=YD,_e=new Set(["\x1B","\x9B"]),XD=39,ct="\x07",Ru="[",QD="]",_u="m",lt=`${QD}8;;`,ju=e=>`${_e.values().next().value}${Ru}${e}${_u}`,Nu=e=>`${_e.values().next().value}${lt}${e}${ct}`,eo=e=>e.split(" ").map(t=>ue(t)),ft=(e,t,u)=>{let n=[...t],D=!1,o=!1,r=ue(xu(e[e.length-1]));for(let[i,s]of n.entries()){let c=ue(s);if(r+c<=u?e[e.length-1]+=s:(e.push(s),r=0),_e.has(s)&&(D=!0,o=n.slice(i+1).join("").startsWith(lt)),D){o?s===ct&&(D=!1,o=!1):s===_u&&(D=!1);continue}r+=c,r===u&&i<n.length-1&&(e.push(""),r=0)}!r&&e[e.length-1].length>0&&e.length>1&&(e[e.length-2]+=e.pop())},to=e=>{let t=e.split(" "),u=t.length;for(;u>0&&!(ue(t[u-1])>0);)u--;return u===t.length?e:t.slice(0,u).join(" ")+t.slice(u).join("")},uo=(e,t,u={})=>{if(u.trim!==!1&&e.trim()==="")return"";let n="",D,o,r=eo(e),i=[""];for(let[c,f]of e.split(" ").entries()){u.trim!==!1&&(i[i.length-1]=i[i.length-1].trimStart());let l=ue(i[i.length-1]);if(c!==0&&(l>=t&&(u.wordWrap===!1||u.trim===!1)&&(i.push(""),l=0),(l>0||u.trim===!1)&&(i[i.length-1]+=" ",l++)),u.hard&&r[c]>t){let a=t-l,d=1+Math.floor((r[c]-a-1)/t);Math.floor((r[c]-1)/t)<d&&i.push(""),ft(i,f,t);continue}if(l+r[c]>t&&l>0&&r[c]>0){if(u.wordWrap===!1&&l<t){ft(i,f,t);continue}i.push("")}if(l+r[c]>t&&u.wordWrap===!1){ft(i,f,t);continue}i[i.length-1]+=f}u.trim!==!1&&(i=i.map(c=>to(c)));let s=[...i.join(`
4
+ `)];for(let[c,f]of s.entries()){if(n+=f,_e.has(f)){let{groups:a}=new RegExp(`(?:\\${Ru}(?<code>\\d+)m|\\${lt}(?<uri>.*)${ct})`).exec(s.slice(c).join(""))||{groups:{}};if(a.code!==void 0){let d=Number.parseFloat(a.code);D=d===XD?void 0:d}else a.uri!==void 0&&(o=a.uri.length===0?void 0:a.uri)}let l=ZD.codes.get(Number(D));s[c+1]===`
5
+ `?(o&&(n+=Nu("")),D&&l&&(n+=ju(l))):f===`
6
+ `&&(D&&l&&(n+=ju(D)),o&&(n+=Nu(o)))}return n};function no(e,t,u){return String(e).normalize().replace(/\r\n/g,`
7
7
  `).split(`
8
- `).map(n=>to(n,t,u)).join(`
9
- `)}var Nu=e=>Array.from({length:e}).fill("");function no(e,t){let u=[],n=0;for(let D of e){let o=0,r=D.map(s=>{var c;let f=(c=t[n])!=null?c:"";n+=1,s.preprocess&&(f=s.preprocess(f)),xu(f)>s.width&&(f=uo(f,s.width,{hard:!0}));let l=f.split(`
10
- `);if(s.postprocess){let{postprocess:a}=s;l=l.map((d,F)=>a.call(s,d,F))}return s.paddingTop&&l.unshift(...Nu(s.paddingTop)),s.paddingBottom&&l.push(...Nu(s.paddingBottom)),l.length>o&&(o=l.length),st(Re({},s),{lines:l})}),i=[];for(let s=0;s<o;s+=1){let c=r.map(f=>{var l;let a=(l=f.lines[s])!=null?l:"",d=Number.isFinite(f.width)?" ".repeat(f.width-ue(a)):"",F=f.paddingLeftString;return f.align==="right"&&(F+=d),F+=a,f.align==="left"&&(F+=d),F+f.paddingRightString}).join("");i.push(c)}u.push(i.join(`
8
+ `).map(n=>uo(n,t,u)).join(`
9
+ `)}var Lu=e=>Array.from({length:e}).fill("");function ro(e,t){let u=[],n=0;for(let D of e){let o=0,r=D.map(s=>{var c;let f=(c=t[n])!=null?c:"";n+=1,s.preprocess&&(f=s.preprocess(f)),Su(f)>s.width&&(f=no(f,s.width,{hard:!0}));let l=f.split(`
10
+ `);if(s.postprocess){let{postprocess:a}=s;l=l.map((d,F)=>a.call(s,d,F))}return s.paddingTop&&l.unshift(...Lu(s.paddingTop)),s.paddingBottom&&l.push(...Lu(s.paddingBottom)),l.length>o&&(o=l.length),it(Re({},s),{lines:l})}),i=[];for(let s=0;s<o;s+=1){let c=r.map(f=>{var l;let a=(l=f.lines[s])!=null?l:"",d=Number.isFinite(f.width)?" ".repeat(f.width-ue(a)):"",F=f.paddingLeftString;return f.align==="right"&&(F+=d),F+=a,f.align==="left"&&(F+=d),F+f.paddingRightString}).join("");i.push(c)}u.push(i.join(`
11
11
  `))}return u.join(`
12
- `)}function ro(e,t){if(!e||e.length===0)return"";let u=zD(e),n=u.length;if(n===0)return"";let{stdoutColumns:D,columns:o}=ND(t);if(o.length>n)throw new Error(`${o.length} columns defined, but only ${n} columns found`);let r=VD(D,o,u);return e.map(i=>no(r,i)).join(`
13
- `)}L();var Do=["<",">","=",">=","<="];function oo(e){if(!Do.includes(e))throw new TypeError(`Invalid breakpoint operator: ${e}`)}function so(e){let t=Object.keys(e).map(u=>{let[n,D]=u.split(" ");oo(n);let o=Number.parseInt(D,10);if(Number.isNaN(o))throw new TypeError(`Invalid breakpoint value: ${D}`);let r=e[u];return{operator:n,breakpoint:o,value:r}}).sort((u,n)=>n.breakpoint-u.breakpoint);return u=>{var n;return(n=t.find(({operator:D,breakpoint:o})=>D==="="&&u===o||D===">"&&u>o||D==="<"&&u<o||D===">="&&u>=o||D==="<="&&u<=o))==null?void 0:n.value}}const io=e=>e.replace(/[\W_]([a-z\d])?/gi,(t,u)=>u?u.toUpperCase():""),ao=e=>e.replace(/\B([A-Z])/g,"-$1").toLowerCase(),co={"> 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 lo(e){let t=!1;return{type:"table",data:{tableData:Object.keys(e).sort((u,n)=>u.localeCompare(n)).map(u=>{const n=e[u],D="alias"in n;return D&&(t=!0),{name:u,flag:n,flagFormatted:`--${ao(u)}`,aliasesEnabled:t,aliasFormatted:D?`-${n.alias}`:void 0}}).map(u=>(u.aliasesEnabled=t,[{type:"flagName",data:u},{type:"flagDescription",data:u}])),tableBreakpoints:co}}}const Lu=e=>!e||(e.version??(e.help?e.help.version:void 0)),Gu=e=>{const t="parent"in e&&e.parent?.name;return(t?`${t} `:"")+e.name};function fo(e){const t=[];e.name&&t.push(Gu(e));const u=Lu(e)??("parent"in e&&Lu(e.parent));if(u&&t.push(`v${u}`),t.length!==0)return{id:"name",type:"text",data:`${t.join(" ")}
14
- `}}function Fo(e){const{help:t}=e;if(!(!t||!t.description))return{id:"description",type:"text",data:`${t.description}
15
- `}}function po(e){const t=e.help||{};if("usage"in t)return t.usage?{id:"usage",type:"section",data:{title:"Usage:",body:Array.isArray(t.usage)?t.usage.join(`
16
- `):t.usage}}:void 0;if(e.name){const u=[],n=[Gu(e)];if(e.flags&&Object.keys(e.flags).length>0&&n.push("[flags...]"),e.parameters&&e.parameters.length>0){const{parameters:D}=e,o=D.indexOf("--"),r=o>-1&&D.slice(o+1).some(i=>i.startsWith("<"));n.push(D.map(i=>i!=="--"?i:r?"--":"[--]").join(" "))}if(n.length>1&&u.push(n.join(" ")),"commands"in e&&e.commands?.length&&u.push(`${e.name} <command>`),u.length>0)return{id:"usage",type:"section",data:{title:"Usage:",body:u.join(`
17
- `)}}}}function Co(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 mo(e){if(!(!e.flags||Object.keys(e.flags).length===0))return{id:"flags",type:"section",data:{title:"Flags:",body:lo(e.flags),indentBody:0}}}function ho(e){const{help:t}=e;if(!t||!t.examples||t.examples.length===0)return;let{examples:u}=t;if(Array.isArray(u)&&(u=u.join(`
18
- `)),u)return{id:"examples",type:"section",data:{title:"Examples:",body:u}}}function go(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 Eo=e=>[fo,Fo,po,Co,mo,ho,go].map(t=>t(e)).filter(Boolean),yo=rt.WriteStream.prototype.hasColors();class bo{text(t){return t}bold(t){return yo?`\x1B[1m${t}\x1B[22m`:t.toLocaleUpperCase()}indentText({text:t,spaces:u}){return t.replace(/^/gm," ".repeat(u))}heading(t){return this.bold(t)}section({title:t,body:u,indentBody:n=2}){return`${(t?`${this.heading(t)}
12
+ `)}function Do(e,t){if(!e||e.length===0)return"";let u=UD(e),n=u.length;if(n===0)return"";let{stdoutColumns:D,columns:o}=LD(t);if(o.length>n)throw new Error(`${o.length} columns defined, but only ${n} columns found`);let r=KD(D,o,u);return e.map(i=>ro(r,i)).join(`
13
+ `)}L();var oo=["<",">","=",">=","<="];function so(e){if(!oo.includes(e))throw new TypeError(`Invalid breakpoint operator: ${e}`)}function io(e){let t=Object.keys(e).map(u=>{let[n,D]=u.split(" ");so(n);let o=Number.parseInt(D,10);if(Number.isNaN(o))throw new TypeError(`Invalid breakpoint value: ${D}`);let r=e[u];return{operator:n,breakpoint:o,value:r}}).sort((u,n)=>n.breakpoint-u.breakpoint);return u=>{var n;return(n=t.find(({operator:D,breakpoint:o})=>D==="="&&u===o||D===">"&&u>o||D==="<"&&u<o||D===">="&&u>=o||D==="<="&&u<=o))==null?void 0:n.value}}const ao=e=>e.replace(/[\W_]([a-z\d])?/gi,(t,u)=>u?u.toUpperCase():""),co=e=>e.replace(/\B([A-Z])/g,"-$1").toLowerCase(),lo={"> 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 fo(e){let t=!1;return{type:"table",data:{tableData:Object.keys(e).sort((u,n)=>u.localeCompare(n)).map(u=>{const n=e[u],D="alias"in n;return D&&(t=!0),{name:u,flag:n,flagFormatted:`--${co(u)}`,aliasesEnabled:t,aliasFormatted:D?`-${n.alias}`:void 0}}).map(u=>(u.aliasesEnabled=t,[{type:"flagName",data:u},{type:"flagDescription",data:u}])),tableBreakpoints:lo}}}const Gu=e=>!e||(e.version??(e.help?e.help.version:void 0)),Wu=e=>{const t="parent"in e&&e.parent?.name;return(t?`${t} `:"")+e.name};function Fo(e){const t=[];e.name&&t.push(Wu(e));const u=Gu(e)??("parent"in e&&Gu(e.parent));if(u&&t.push(`v${u}`),t.length!==0)return{id:"name",type:"text",data:`${t.join(" ")}
14
+ `}}function po(e){const{help:t}=e;if(!(!t||!t.description))return{id:"description",type:"text",data:`${t.description}
15
+ `}}function Co(e){const t=e.help||{};if("usage"in t)return t.usage?{id:"usage",type:"section",data:{title:"Usage:",body:Array.isArray(t.usage)?t.usage.join(`
16
+ `):t.usage}}:void 0;if(e.name){const u=[],n=[Wu(e)];if(e.flags&&Object.keys(e.flags).length>0&&n.push("[flags...]"),e.parameters&&e.parameters.length>0){const{parameters:D}=e,o=D.indexOf("--"),r=o>-1&&D.slice(o+1).some(i=>i.startsWith("<"));n.push(D.map(i=>i!=="--"?i:r?"--":"[--]").join(" "))}if(n.length>1&&u.push(n.join(" ")),"commands"in e&&e.commands?.length&&u.push(`${e.name} <command>`),u.length>0)return{id:"usage",type:"section",data:{title:"Usage:",body:u.join(`
17
+ `)}}}}function mo(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 ho(e){if(!(!e.flags||Object.keys(e.flags).length===0))return{id:"flags",type:"section",data:{title:"Flags:",body:fo(e.flags),indentBody:0}}}function go(e){const{help:t}=e;if(!t||!t.examples||t.examples.length===0)return;let{examples:u}=t;if(Array.isArray(u)&&(u=u.join(`
18
+ `)),u)return{id:"examples",type:"section",data:{title:"Examples:",body:u}}}function Eo(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 yo=e=>[Fo,po,Co,mo,ho,go,Eo].map(t=>t(e)).filter(Boolean),bo=Dt.WriteStream.prototype.hasColors();class wo{text(t){return t}bold(t){return bo?`\x1B[1m${t}\x1B[22m`:t.toLocaleUpperCase()}indentText({text:t,spaces:u}){return t.replace(/^/gm," ".repeat(u))}heading(t){return this.bold(t)}section({title:t,body:u,indentBody:n=2}){return`${(t?`${this.heading(t)}
19
19
  `:"")+(u?this.indentText({text:this.render(u),spaces:n}):"")}
20
- `}table({tableData:t,tableOptions:u,tableBreakpoints:n}){return ro(t.map(D=>D.map(o=>this.render(o))),n?so(n):u)}flagParameter(t){return t===Boolean?"":t===String?"<string>":t===Number?"<number>":Array.isArray(t)?this.flagParameter(t[0]):"<value>"}flagOperator(t){return" "}flagName(t){const{flag:u,flagFormatted:n,aliasesEnabled:D,aliasFormatted:o}=t;let r="";if(o?r+=`${o}, `:D&&(r+=" "),r+=n,"placeholder"in u&&typeof u.placeholder=="string")r+=`${this.flagOperator(t)}${u.placeholder}`;else{const i=this.flagParameter("type"in u?u.type:u);i&&(r+=`${this.flagOperator(t)}${i}`)}return r}flagDefault(t){return JSON.stringify(t)}flagDescription({flag:t}){let u="description"in t?t.description??"":"";if("default"in t){let{default:n}=t;typeof n=="function"&&(n=n()),n&&(u+=` (default: ${this.flagDefault(n)})`)}return u}render(t){if(typeof t=="string")return t;if(Array.isArray(t))return t.map(u=>this.render(u)).join(`
21
- `);if("type"in t&&this[t.type]){const u=this[t.type];if(typeof u=="function")return u.call(this,t.data)}throw new Error(`Invalid node type: ${JSON.stringify(t)}`)}}const ft=e=>e.length>0&&!e.includes(" "),{stringify:V}=JSON,wo=/[|\\{}()[\]^$+*?.]/;function dt(e){const t=[];let u,n;for(const D of e){if(n)throw new Error(`Invalid parameter: Spread parameter ${V(n)} must be last`);const o=D[0],r=D[D.length-1];let i;if(o==="<"&&r===">"&&(i=!0,u))throw new Error(`Invalid parameter: Required parameter ${V(D)} cannot come after optional parameter ${V(u)}`);if(o==="["&&r==="]"&&(i=!1,u=D),i===void 0)throw new Error(`Invalid parameter: ${V(D)}. Must be wrapped in <> (required parameter) or [] (optional parameter)`);let s=D.slice(1,-1);const c=s.slice(-3)==="...";c&&(n=D,s=s.slice(0,-3));const f=s.match(wo);if(f)throw new Error(`Invalid parameter: ${V(D)}. Invalid character found ${V(f[0])}`);t.push({name:s,required:i,spread:c})}return t}function Ft(e,t,u,n){for(let D=0;D<t.length;D+=1){const{name:o,required:r,spread:i}=t[D],s=io(o);if(s in e)throw new Error(`Invalid parameter: ${V(o)} is used more than once.`);const c=i?u.slice(D):u[D];if(i&&(D=t.length),r&&(!c||i&&c.length===0))return console.error(`Error: Missing required parameter ${V(o)}
22
- `),n(),process.exit(1);e[s]=c}}function Bo(e){return e===void 0||e!==!1}function Wu(e,t,u,n){const D={...t.flags},o=t.version;o&&(D.version={type:Boolean,description:"Show version"});const{help:r}=t,i=Bo(r);i&&!("help"in D)&&(D.help={type:Boolean,alias:"h",description:"Show help"});const s=vD(D,n,{ignore:t.ignoreArgv}),c=()=>{console.log(t.version)};if(o&&s.flags.version===!0)return c(),process.exit(0);const f=new bo,l=i&&r?.render?r.render:F=>f.render(F),a=F=>{const m=Eo({...t,...F?{help:F}:{},flags:D});console.log(l(m,f))};if(i&&s.flags.help===!0)return a(),process.exit(0);if(t.parameters){let{parameters:F}=t,m=s._;const p=F.indexOf("--"),C=F.slice(p+1),y=Object.create(null);if(p>-1&&C.length>0){F=F.slice(0,p);const v=s._["--"];m=m.slice(0,-v.length||void 0),Ft(y,dt(F),m,a),Ft(y,dt(C),v,a)}else Ft(y,dt(F),m,a);Object.assign(s._,y)}const d={...s,showVersion:c,showHelp:a};return typeof u=="function"&&u(d),{command:e,...d}}function vo(e,t){const u=new Map;for(const n of t){const D=[n.options.name],{alias:o}=n.options;o&&(Array.isArray(o)?D.push(...o):D.push(o));for(const r of D){if(u.has(r))throw new Error(`Duplicate command name found: ${V(r)}`);u.set(r,n)}}return u.get(e)}function Ao(e,t,u=process.argv.slice(2)){if(!e)throw new Error("Options is required");if("name"in e&&(!e.name||!ft(e.name)))throw new Error(`Invalid script name: ${V(e.name)}`);const n=u[0];if(e.commands&&n&&ft(n)){const D=vo(n,e.commands);if(D)return Wu(D.options.name,{...D.options,parent:e},D.callback,u.slice(1))}return Wu(void 0,e,t,u)}function zu(e,t){if(!e)throw new Error("Command options are required");const{name:u}=e;if(u===void 0)throw new Error("Command name is required");if(!ft(u))throw new Error(`Invalid command name ${JSON.stringify(u)}. Command names must be one word.`);return{options:e,callback:t}}var $o="1.17.0",xo="Writes your git commit messages for you with AI",So="sugarmo/aicommits",_=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function se(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ie={exports:{}},pt,Uu;function ko(){if(Uu)return pt;Uu=1,pt=n,n.sync=D;var e=Dt;function t(o,r){var i=r.pathExt!==void 0?r.pathExt:process.env.PATHEXT;if(!i||(i=i.split(";"),i.indexOf("")!==-1))return!0;for(var s=0;s<i.length;s++){var c=i[s].toLowerCase();if(c&&o.substr(-c.length).toLowerCase()===c)return!0}return!1}function u(o,r,i){return!o.isSymbolicLink()&&!o.isFile()?!1:t(r,i)}function n(o,r,i){e.stat(o,function(s,c){i(s,s?!1:u(c,o,r))})}function D(o,r){return u(e.statSync(o),o,r)}return pt}var Ct,qu;function Mo(){if(qu)return Ct;qu=1,Ct=t,t.sync=u;var e=Dt;function t(o,r,i){e.stat(o,function(s,c){i(s,s?!1:n(c,r))})}function u(o,r){return n(e.statSync(o),r)}function n(o,r){return o.isFile()&&D(o,r)}function D(o,r){var i=o.mode,s=o.uid,c=o.gid,f=r.uid!==void 0?r.uid:process.getuid&&process.getuid(),l=r.gid!==void 0?r.gid:process.getgid&&process.getgid(),a=parseInt("100",8),d=parseInt("010",8),F=parseInt("001",8),m=a|d,p=i&F||i&d&&c===l||i&a&&s===f||i&m&&f===0;return p}return Ct}var je;process.platform==="win32"||_.TESTING_WINDOWS?je=ko():je=Mo();var Io=mt;mt.sync=Oo;function mt(e,t,u){if(typeof t=="function"&&(u=t,t={}),!u){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(n,D){mt(e,t||{},function(o,r){o?D(o):n(r)})})}je(e,t||{},function(n,D){n&&(n.code==="EACCES"||t&&t.ignoreErrors)&&(n=null,D=!1),u(n,D)})}function Oo(e,t){try{return je.sync(e,t||{})}catch(u){if(t&&t.ignoreErrors||u.code==="EACCES")return!1;throw u}}const ae=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",Hu=N,To=ae?";":":",Vu=Io,Ku=e=>Object.assign(new Error(`not found: ${e}`),{code:"ENOENT"}),Ju=(e,t)=>{const u=t.colon||To,n=e.match(/\//)||ae&&e.match(/\\/)?[""]:[...ae?[process.cwd()]:[],...(t.path||process.env.PATH||"").split(u)],D=ae?t.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",o=ae?D.split(u):[""];return ae&&e.indexOf(".")!==-1&&o[0]!==""&&o.unshift(""),{pathEnv:n,pathExt:o,pathExtExe:D}},Yu=(e,t,u)=>{typeof t=="function"&&(u=t,t={}),t||(t={});const{pathEnv:n,pathExt:D,pathExtExe:o}=Ju(e,t),r=[],i=c=>new Promise((f,l)=>{if(c===n.length)return t.all&&r.length?f(r):l(Ku(e));const a=n[c],d=/^".*"$/.test(a)?a.slice(1,-1):a,F=Hu.join(d,e),m=!d&&/^\.[\\\/]/.test(e)?e.slice(0,2)+F:F;f(s(m,c,0))}),s=(c,f,l)=>new Promise((a,d)=>{if(l===D.length)return a(i(f+1));const F=D[l];Vu(c+F,{pathExt:o},(m,p)=>{if(!m&&p)if(t.all)r.push(c+F);else return a(c+F);return a(s(c,f,l+1))})});return u?i(0).then(c=>u(null,c),u):i(0)},Po=(e,t)=>{t=t||{};const{pathEnv:u,pathExt:n,pathExtExe:D}=Ju(e,t),o=[];for(let r=0;r<u.length;r++){const i=u[r],s=/^".*"$/.test(i)?i.slice(1,-1):i,c=Hu.join(s,e),f=!s&&/^\.[\\\/]/.test(e)?e.slice(0,2)+c:c;for(let l=0;l<n.length;l++){const a=f+n[l];try{if(Vu.sync(a,{pathExt:D}))if(t.all)o.push(a);else return a}catch{}}}if(t.all&&o.length)return o;if(t.nothrow)return null;throw Ku(e)};var Ro=Yu;Yu.sync=Po;var ht={exports:{}};const Zu=(e={})=>{const t=e.env||process.env;return(e.platform||process.platform)!=="win32"?"PATH":Object.keys(t).reverse().find(n=>n.toUpperCase()==="PATH")||"Path"};ht.exports=Zu,ht.exports.default=Zu;var _o=ht.exports;const Xu=N,jo=Ro,No=_o;function Qu(e,t){const u=e.options.env||process.env,n=process.cwd(),D=e.options.cwd!=null,o=D&&process.chdir!==void 0&&!process.chdir.disabled;if(o)try{process.chdir(e.options.cwd)}catch{}let r;try{r=jo.sync(e.command,{path:u[No({env:u})],pathExt:t?Xu.delimiter:void 0})}catch{}finally{o&&process.chdir(n)}return r&&(r=Xu.resolve(D?e.options.cwd:"",r)),r}function Lo(e){return Qu(e)||Qu(e,!0)}var Go=Lo,gt={};const Et=/([()\][%!^"`<>&|;, *?])/g;function Wo(e){return e=e.replace(Et,"^$1"),e}function zo(e,t){return e=`${e}`,e=e.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),e=e.replace(/(?=(\\+?)?)\1$/,"$1$1"),e=`"${e}"`,e=e.replace(Et,"^$1"),t&&(e=e.replace(Et,"^$1")),e}gt.command=Wo,gt.argument=zo;var Uo=/^#!(.*)/;const qo=Uo;var Ho=(e="")=>{const t=e.match(qo);if(!t)return null;const[u,n]=t[0].replace(/#! ?/,"").split(" "),D=u.split("/").pop();return D==="env"?n:n?`${D} ${n}`:D};const yt=Dt,Vo=Ho;function Ko(e){const u=Buffer.alloc(150);let n;try{n=yt.openSync(e,"r"),yt.readSync(n,u,0,150,0),yt.closeSync(n)}catch{}return Vo(u.toString())}var Jo=Ko;const Yo=N,en=Go,tn=gt,Zo=Jo,Xo=process.platform==="win32",Qo=/\.(?:com|exe)$/i,es=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function ts(e){e.file=en(e);const t=e.file&&Zo(e.file);return t?(e.args.unshift(e.file),e.command=t,en(e)):e.file}function us(e){if(!Xo)return e;const t=ts(e),u=!Qo.test(t);if(e.options.forceShell||u){const n=es.test(t);e.command=Yo.normalize(e.command),e.command=tn.command(e.command),e.args=e.args.map(o=>tn.argument(o,n));const D=[e.command].concat(e.args).join(" ");e.args=["/d","/s","/c",`"${D}"`],e.command=process.env.comspec||"cmd.exe",e.options.windowsVerbatimArguments=!0}return e}function ns(e,t,u){t&&!Array.isArray(t)&&(u=t,t=null),t=t?t.slice(0):[],u=Object.assign({},u);const n={command:e,args:t,options:u,file:void 0,original:{command:e,args:t}};return u.shell?n:us(n)}var rs=ns;const bt=process.platform==="win32";function wt(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 Ds(e,t){if(!bt)return;const u=e.emit;e.emit=function(n,D){if(n==="exit"){const o=un(D,t);if(o)return u.call(e,"error",o)}return u.apply(e,arguments)}}function un(e,t){return bt&&e===1&&!t.file?wt(t.original,"spawn"):null}function os(e,t){return bt&&e===1&&!t.file?wt(t.original,"spawnSync"):null}var ss={hookChildProcess:Ds,verifyENOENT:un,verifyENOENTSync:os,notFoundError:wt};const nn=Jr,Bt=rs,vt=ss;function rn(e,t,u){const n=Bt(e,t,u),D=nn.spawn(n.command,n.args,n.options);return vt.hookChildProcess(D,n),D}function is(e,t,u){const n=Bt(e,t,u),D=nn.spawnSync(n.command,n.args,n.options);return D.error=D.error||vt.verifyENOENTSync(D.status,n),D}ie.exports=rn,ie.exports.spawn=rn,ie.exports.sync=is,ie.exports._parse=Bt,ie.exports._enoent=vt;var as=ie.exports,cs=se(as);function ls(e){const t=typeof e=="string"?`
20
+ `}table({tableData:t,tableOptions:u,tableBreakpoints:n}){return Do(t.map(D=>D.map(o=>this.render(o))),n?io(n):u)}flagParameter(t){return t===Boolean?"":t===String?"<string>":t===Number?"<number>":Array.isArray(t)?this.flagParameter(t[0]):"<value>"}flagOperator(t){return" "}flagName(t){const{flag:u,flagFormatted:n,aliasesEnabled:D,aliasFormatted:o}=t;let r="";if(o?r+=`${o}, `:D&&(r+=" "),r+=n,"placeholder"in u&&typeof u.placeholder=="string")r+=`${this.flagOperator(t)}${u.placeholder}`;else{const i=this.flagParameter("type"in u?u.type:u);i&&(r+=`${this.flagOperator(t)}${i}`)}return r}flagDefault(t){return JSON.stringify(t)}flagDescription({flag:t}){let u="description"in t?t.description??"":"";if("default"in t){let{default:n}=t;typeof n=="function"&&(n=n()),n&&(u+=` (default: ${this.flagDefault(n)})`)}return u}render(t){if(typeof t=="string")return t;if(Array.isArray(t))return t.map(u=>this.render(u)).join(`
21
+ `);if("type"in t&&this[t.type]){const u=this[t.type];if(typeof u=="function")return u.call(this,t.data)}throw new Error(`Invalid node type: ${JSON.stringify(t)}`)}}const dt=e=>e.length>0&&!e.includes(" "),{stringify:K}=JSON,Bo=/[|\\{}()[\]^$+*?.]/;function Ft(e){const t=[];let u,n;for(const D of e){if(n)throw new Error(`Invalid parameter: Spread parameter ${K(n)} must be last`);const o=D[0],r=D[D.length-1];let i;if(o==="<"&&r===">"&&(i=!0,u))throw new Error(`Invalid parameter: Required parameter ${K(D)} cannot come after optional parameter ${K(u)}`);if(o==="["&&r==="]"&&(i=!1,u=D),i===void 0)throw new Error(`Invalid parameter: ${K(D)}. Must be wrapped in <> (required parameter) or [] (optional parameter)`);let s=D.slice(1,-1);const c=s.slice(-3)==="...";c&&(n=D,s=s.slice(0,-3));const f=s.match(Bo);if(f)throw new Error(`Invalid parameter: ${K(D)}. Invalid character found ${K(f[0])}`);t.push({name:s,required:i,spread:c})}return t}function pt(e,t,u,n){for(let D=0;D<t.length;D+=1){const{name:o,required:r,spread:i}=t[D],s=ao(o);if(s in e)throw new Error(`Invalid parameter: ${K(o)} is used more than once.`);const c=i?u.slice(D):u[D];if(i&&(D=t.length),r&&(!c||i&&c.length===0))return console.error(`Error: Missing required parameter ${K(o)}
22
+ `),n(),process.exit(1);e[s]=c}}function vo(e){return e===void 0||e!==!1}function zu(e,t,u,n){const D={...t.flags},o=t.version;o&&(D.version={type:Boolean,description:"Show version"});const{help:r}=t,i=vo(r);i&&!("help"in D)&&(D.help={type:Boolean,alias:"h",description:"Show help"});const s=AD(D,n,{ignore:t.ignoreArgv}),c=()=>{console.log(t.version)};if(o&&s.flags.version===!0)return c(),process.exit(0);const f=new wo,l=i&&r?.render?r.render:F=>f.render(F),a=F=>{const h=yo({...t,...F?{help:F}:{},flags:D});console.log(l(h,f))};if(i&&s.flags.help===!0)return a(),process.exit(0);if(t.parameters){let{parameters:F}=t,h=s._;const p=F.indexOf("--"),C=F.slice(p+1),b=Object.create(null);if(p>-1&&C.length>0){F=F.slice(0,p);const v=s._["--"];h=h.slice(0,-v.length||void 0),pt(b,Ft(F),h,a),pt(b,Ft(C),v,a)}else pt(b,Ft(F),h,a);Object.assign(s._,b)}const d={...s,showVersion:c,showHelp:a};return typeof u=="function"&&u(d),{command:e,...d}}function Ao(e,t){const u=new Map;for(const n of t){const D=[n.options.name],{alias:o}=n.options;o&&(Array.isArray(o)?D.push(...o):D.push(o));for(const r of D){if(u.has(r))throw new Error(`Duplicate command name found: ${K(r)}`);u.set(r,n)}}return u.get(e)}function $o(e,t,u=process.argv.slice(2)){if(!e)throw new Error("Options is required");if("name"in e&&(!e.name||!dt(e.name)))throw new Error(`Invalid script name: ${K(e.name)}`);const n=u[0];if(e.commands&&n&&dt(n)){const D=Ao(n,e.commands);if(D)return zu(D.options.name,{...D.options,parent:e},D.callback,u.slice(1))}return zu(void 0,e,t,u)}function Uu(e,t){if(!e)throw new Error("Command options are required");const{name:u}=e;if(u===void 0)throw new Error("Command name is required");if(!dt(u))throw new Error(`Invalid command name ${JSON.stringify(u)}. Command names must be one word.`);return{options:e,callback:t}}var xo="1.18.0",So="Writes your git commit messages for you with AI",ko="sugarmo/aicommits",_=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function se(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ie={exports:{}},Ct,qu;function Mo(){if(qu)return Ct;qu=1,Ct=n,n.sync=D;var e=ot;function t(o,r){var i=r.pathExt!==void 0?r.pathExt:process.env.PATHEXT;if(!i||(i=i.split(";"),i.indexOf("")!==-1))return!0;for(var s=0;s<i.length;s++){var c=i[s].toLowerCase();if(c&&o.substr(-c.length).toLowerCase()===c)return!0}return!1}function u(o,r,i){return!o.isSymbolicLink()&&!o.isFile()?!1:t(r,i)}function n(o,r,i){e.stat(o,function(s,c){i(s,s?!1:u(c,o,r))})}function D(o,r){return u(e.statSync(o),o,r)}return Ct}var mt,Hu;function Io(){if(Hu)return mt;Hu=1,mt=t,t.sync=u;var e=ot;function t(o,r,i){e.stat(o,function(s,c){i(s,s?!1:n(c,r))})}function u(o,r){return n(e.statSync(o),r)}function n(o,r){return o.isFile()&&D(o,r)}function D(o,r){var i=o.mode,s=o.uid,c=o.gid,f=r.uid!==void 0?r.uid:process.getuid&&process.getuid(),l=r.gid!==void 0?r.gid:process.getgid&&process.getgid(),a=parseInt("100",8),d=parseInt("010",8),F=parseInt("001",8),h=a|d,p=i&F||i&d&&c===l||i&a&&s===f||i&h&&f===0;return p}return mt}var je;process.platform==="win32"||_.TESTING_WINDOWS?je=Mo():je=Io();var Oo=ht;ht.sync=To;function ht(e,t,u){if(typeof t=="function"&&(u=t,t={}),!u){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(n,D){ht(e,t||{},function(o,r){o?D(o):n(r)})})}je(e,t||{},function(n,D){n&&(n.code==="EACCES"||t&&t.ignoreErrors)&&(n=null,D=!1),u(n,D)})}function To(e,t){try{return je.sync(e,t||{})}catch(u){if(t&&t.ignoreErrors||u.code==="EACCES")return!1;throw u}}const ae=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",Vu=N,Po=ae?";":":",Ku=Oo,Ju=e=>Object.assign(new Error(`not found: ${e}`),{code:"ENOENT"}),Yu=(e,t)=>{const u=t.colon||Po,n=e.match(/\//)||ae&&e.match(/\\/)?[""]:[...ae?[process.cwd()]:[],...(t.path||process.env.PATH||"").split(u)],D=ae?t.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",o=ae?D.split(u):[""];return ae&&e.indexOf(".")!==-1&&o[0]!==""&&o.unshift(""),{pathEnv:n,pathExt:o,pathExtExe:D}},Zu=(e,t,u)=>{typeof t=="function"&&(u=t,t={}),t||(t={});const{pathEnv:n,pathExt:D,pathExtExe:o}=Yu(e,t),r=[],i=c=>new Promise((f,l)=>{if(c===n.length)return t.all&&r.length?f(r):l(Ju(e));const a=n[c],d=/^".*"$/.test(a)?a.slice(1,-1):a,F=Vu.join(d,e),h=!d&&/^\.[\\\/]/.test(e)?e.slice(0,2)+F:F;f(s(h,c,0))}),s=(c,f,l)=>new Promise((a,d)=>{if(l===D.length)return a(i(f+1));const F=D[l];Ku(c+F,{pathExt:o},(h,p)=>{if(!h&&p)if(t.all)r.push(c+F);else return a(c+F);return a(s(c,f,l+1))})});return u?i(0).then(c=>u(null,c),u):i(0)},Ro=(e,t)=>{t=t||{};const{pathEnv:u,pathExt:n,pathExtExe:D}=Yu(e,t),o=[];for(let r=0;r<u.length;r++){const i=u[r],s=/^".*"$/.test(i)?i.slice(1,-1):i,c=Vu.join(s,e),f=!s&&/^\.[\\\/]/.test(e)?e.slice(0,2)+c:c;for(let l=0;l<n.length;l++){const a=f+n[l];try{if(Ku.sync(a,{pathExt:D}))if(t.all)o.push(a);else return a}catch{}}}if(t.all&&o.length)return o;if(t.nothrow)return null;throw Ju(e)};var _o=Zu;Zu.sync=Ro;var gt={exports:{}};const Xu=(e={})=>{const t=e.env||process.env;return(e.platform||process.platform)!=="win32"?"PATH":Object.keys(t).reverse().find(n=>n.toUpperCase()==="PATH")||"Path"};gt.exports=Xu,gt.exports.default=Xu;var jo=gt.exports;const Qu=N,No=_o,Lo=jo;function en(e,t){const u=e.options.env||process.env,n=process.cwd(),D=e.options.cwd!=null,o=D&&process.chdir!==void 0&&!process.chdir.disabled;if(o)try{process.chdir(e.options.cwd)}catch{}let r;try{r=No.sync(e.command,{path:u[Lo({env:u})],pathExt:t?Qu.delimiter:void 0})}catch{}finally{o&&process.chdir(n)}return r&&(r=Qu.resolve(D?e.options.cwd:"",r)),r}function Go(e){return en(e)||en(e,!0)}var Wo=Go,Et={};const yt=/([()\][%!^"`<>&|;, *?])/g;function zo(e){return e=e.replace(yt,"^$1"),e}function Uo(e,t){return e=`${e}`,e=e.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),e=e.replace(/(?=(\\+?)?)\1$/,"$1$1"),e=`"${e}"`,e=e.replace(yt,"^$1"),t&&(e=e.replace(yt,"^$1")),e}Et.command=zo,Et.argument=Uo;var qo=/^#!(.*)/;const Ho=qo;var Vo=(e="")=>{const t=e.match(Ho);if(!t)return null;const[u,n]=t[0].replace(/#! ?/,"").split(" "),D=u.split("/").pop();return D==="env"?n:n?`${D} ${n}`:D};const bt=ot,Ko=Vo;function Jo(e){const u=Buffer.alloc(150);let n;try{n=bt.openSync(e,"r"),bt.readSync(n,u,0,150,0),bt.closeSync(n)}catch{}return Ko(u.toString())}var Yo=Jo;const Zo=N,tn=Wo,un=Et,Xo=Yo,Qo=process.platform==="win32",es=/\.(?:com|exe)$/i,ts=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function us(e){e.file=tn(e);const t=e.file&&Xo(e.file);return t?(e.args.unshift(e.file),e.command=t,tn(e)):e.file}function ns(e){if(!Qo)return e;const t=us(e),u=!es.test(t);if(e.options.forceShell||u){const n=ts.test(t);e.command=Zo.normalize(e.command),e.command=un.command(e.command),e.args=e.args.map(o=>un.argument(o,n));const D=[e.command].concat(e.args).join(" ");e.args=["/d","/s","/c",`"${D}"`],e.command=process.env.comspec||"cmd.exe",e.options.windowsVerbatimArguments=!0}return e}function rs(e,t,u){t&&!Array.isArray(t)&&(u=t,t=null),t=t?t.slice(0):[],u=Object.assign({},u);const n={command:e,args:t,options:u,file:void 0,original:{command:e,args:t}};return u.shell?n:ns(n)}var Ds=rs;const wt=process.platform==="win32";function Bt(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 os(e,t){if(!wt)return;const u=e.emit;e.emit=function(n,D){if(n==="exit"){const o=nn(D,t);if(o)return u.call(e,"error",o)}return u.apply(e,arguments)}}function nn(e,t){return wt&&e===1&&!t.file?Bt(t.original,"spawn"):null}function ss(e,t){return wt&&e===1&&!t.file?Bt(t.original,"spawnSync"):null}var is={hookChildProcess:os,verifyENOENT:nn,verifyENOENTSync:ss,notFoundError:Bt};const rn=Yr,vt=Ds,At=is;function Dn(e,t,u){const n=vt(e,t,u),D=rn.spawn(n.command,n.args,n.options);return At.hookChildProcess(D,n),D}function as(e,t,u){const n=vt(e,t,u),D=rn.spawnSync(n.command,n.args,n.options);return D.error=D.error||At.verifyENOENTSync(D.status,n),D}ie.exports=Dn,ie.exports.spawn=Dn,ie.exports.sync=as,ie.exports._parse=vt,ie.exports._enoent=At;var cs=ie.exports,ls=se(cs);function fs(e){const t=typeof e=="string"?`
23
23
  `:`
24
- `.charCodeAt(),u=typeof e=="string"?"\r":"\r".charCodeAt();return e[e.length-1]===t&&(e=e.slice(0,-1)),e[e.length-1]===u&&(e=e.slice(0,-1)),e}function Dn(e={}){const{env:t=process.env,platform:u=process.platform}=e;return u!=="win32"?"PATH":Object.keys(t).reverse().find(n=>n.toUpperCase()==="PATH")||"Path"}const fs=({cwd:e=T.cwd(),path:t=T.env[Dn()],preferLocal:u=!0,execPath:n=T.execPath,addExecPath:D=!0}={})=>{const o=e instanceof URL?Cu(e):e,r=oe.resolve(o),i=[];return u&&ds(i,r),D&&Fs(i,n,r),[...i,t].join(oe.delimiter)},ds=(e,t)=>{let u;for(;u!==t;)e.push(oe.join(t,"node_modules/.bin")),u=t,t=oe.resolve(t,"..")},Fs=(e,t,u)=>{const n=t instanceof URL?Cu(t):t;e.push(oe.resolve(u,n,".."))},ps=({env:e=T.env,...t}={})=>{e={...e};const u=Dn({env:e});return t.path=e[u],e[u]=fs(t),e},Cs=(e,t,u,n)=>{if(u==="length"||u==="prototype"||u==="arguments"||u==="caller")return;const D=Object.getOwnPropertyDescriptor(e,u),o=Object.getOwnPropertyDescriptor(t,u);!ms(D,o)&&n||Object.defineProperty(e,u,o)},ms=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)},hs=(e,t)=>{const u=Object.getPrototypeOf(t);u!==Object.getPrototypeOf(e)&&Object.setPrototypeOf(e,u)},gs=(e,t)=>`/* Wrapped ${e}*/
25
- ${t}`,Es=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),ys=Object.getOwnPropertyDescriptor(Function.prototype.toString,"name"),bs=(e,t,u)=>{const n=u===""?"":`with ${u.trim()}() `,D=gs.bind(null,n,t.toString());Object.defineProperty(D,"name",ys),Object.defineProperty(e,"toString",{...Es,value:D})};function ws(e,t,{ignoreNonConfigurable:u=!1}={}){const{name:n}=e;for(const D of Reflect.ownKeys(t))Cs(e,t,D,u);return hs(e,t),bs(e,t,n),e}const Ne=new WeakMap,on=(e,t={})=>{if(typeof e!="function")throw new TypeError("Expected a function");let u,n=0;const D=e.displayName||e.name||"<anonymous>",o=function(...r){if(Ne.set(o,++n),n===1)u=e.apply(this,r),e=null;else if(t.throw===!0)throw new Error(`Function \`${D}\` can only be called once`);return u};return ws(o,e),Ne.set(o,n),o};on.callCount=e=>{if(!Ne.has(e))throw new Error(`The given function \`${e.name}\` is not wrapped by the \`onetime\` package`);return Ne.get(e)};const Bs=()=>{const e=an-sn+1;return Array.from({length:e},vs)},vs=(e,t)=>({name:`SIGRT${t+1}`,number:sn+t,action:"terminate",description:"Application-specific signal (realtime)",standard:"posix"}),sn=34,an=64,As=[{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"}],cn=()=>{const e=Bs();return[...As,...e].map($s)},$s=({name:e,number:t,description:u,action:n,forced:D=!1,standard:o})=>{const{signals:{[e]:r}}=mu,i=r!==void 0;return{name:e,number:i?r:t,description:u,supported:i,action:n,forced:D,standard:o}},xs=()=>{const e=cn();return Object.fromEntries(e.map(Ss))},Ss=({name:e,number:t,description:u,supported:n,action:D,forced:o,standard:r})=>[e,{name:e,number:t,description:u,supported:n,action:D,forced:o,standard:r}],ks=xs(),Ms=()=>{const e=cn(),t=an+1,u=Array.from({length:t},(n,D)=>Is(D,e));return Object.assign({},...u)},Is=(e,t)=>{const u=Os(e,t);if(u===void 0)return{};const{name:n,description:D,supported:o,action:r,forced:i,standard:s}=u;return{[e]:{name:n,number:e,description:D,supported:o,action:r,forced:i,standard:s}}},Os=(e,t)=>{const u=t.find(({name:n})=>mu.signals[n]===e);return u!==void 0?u:t.find(n=>n.number===e)};Ms();const Ts=({timedOut:e,timeout:t,errorCode:u,signal:n,signalDescription:D,exitCode:o,isCanceled:r})=>e?`timed out after ${t} milliseconds`:r?"was canceled":u!==void 0?`failed with ${u}`:n!==void 0?`was killed with ${n} (${D})`:o!==void 0?`failed with exit code ${o}`:"failed",ln=({stdout:e,stderr:t,all:u,error:n,signal:D,exitCode:o,command:r,escapedCommand:i,timedOut:s,isCanceled:c,killed:f,parsed:{options:{timeout:l,cwd:a=T.cwd()}}})=>{o=o===null?void 0:o,D=D===null?void 0:D;const d=D===void 0?void 0:ks[D].description,F=n&&n.code,p=`Command ${Ts({timedOut:s,timeout:l,errorCode:F,signal:D,signalDescription:d,exitCode:o,isCanceled:c})}: ${r}`,C=Object.prototype.toString.call(n)==="[object Error]",y=C?`${p}
26
- ${n.message}`:p,v=[y,t,e].filter(Boolean).join(`
27
- `);return C?(n.originalMessage=n.message,n.message=v):n=new Error(v),n.shortMessage=y,n.command=r,n.escapedCommand=i,n.exitCode=o,n.signal=D,n.signalDescription=d,n.stdout=e,n.stderr=t,n.cwd=a,u!==void 0&&(n.all=u),"bufferedData"in n&&delete n.bufferedData,n.failed=!0,n.timedOut=!!s,n.isCanceled=c,n.killed=f&&!s,n},Le=["stdin","stdout","stderr"],Ps=e=>Le.some(t=>e[t]!==void 0),Rs=e=>{if(!e)return;const{stdio:t}=e;if(t===void 0)return Le.map(n=>e[n]);if(Ps(e))throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${Le.map(n=>`\`${n}\``).join(", ")}`);if(typeof t=="string")return t;if(!Array.isArray(t))throw new TypeError(`Expected \`stdio\` to be of type \`string\` or \`Array\`, got \`${typeof t}\``);const u=Math.max(t.length,Le.length);return Array.from({length:u},(n,D)=>t[D])};var ce={exports:{}},Ge={exports:{}};Ge.exports;var fn;function _s(){return fn||(fn=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")}(Ge)),Ge.exports}var S=_.process;const ne=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(!ne(S))ce.exports=function(){return function(){}};else{var js=hu,Ce=_s(),Ns=/^win/i.test(S.platform),We=gu;typeof We!="function"&&(We=We.EventEmitter);var j;S.__signal_exit_emitter__?j=S.__signal_exit_emitter__:(j=S.__signal_exit_emitter__=new We,j.count=0,j.emitted={}),j.infinite||(j.setMaxListeners(1/0),j.infinite=!0),ce.exports=function(e,t){if(!ne(_.process))return function(){};js.equal(typeof e,"function","a callback must be provided for exit handler"),me===!1&&dn();var u="exit";t&&t.alwaysLast&&(u="afterexit");var n=function(){j.removeListener(u,e),j.listeners("exit").length===0&&j.listeners("afterexit").length===0&&At()};return j.on(u,e),n};var At=function(){!me||!ne(_.process)||(me=!1,Ce.forEach(function(t){try{S.removeListener(t,$t[t])}catch{}}),S.emit=xt,S.reallyExit=Fn,j.count-=1)};ce.exports.unload=At;var le=function(t,u,n){j.emitted[t]||(j.emitted[t]=!0,j.emit(t,u,n))},$t={};Ce.forEach(function(e){$t[e]=function(){if(ne(_.process)){var u=S.listeners(e);u.length===j.count&&(At(),le("exit",null,e),le("afterexit",null,e),Ns&&e==="SIGHUP"&&(e="SIGINT"),S.kill(S.pid,e))}}}),ce.exports.signals=function(){return Ce};var me=!1,dn=function(){me||!ne(_.process)||(me=!0,j.count+=1,Ce=Ce.filter(function(t){try{return S.on(t,$t[t]),!0}catch{return!1}}),S.emit=Gs,S.reallyExit=Ls)};ce.exports.load=dn;var Fn=S.reallyExit,Ls=function(t){ne(_.process)&&(S.exitCode=t||0,le("exit",S.exitCode,null),le("afterexit",S.exitCode,null),Fn.call(S,S.exitCode))},xt=S.emit,Gs=function(t,u){if(t==="exit"&&ne(_.process)){u!==void 0&&(S.exitCode=u);var n=xt.apply(this,arguments);return le("exit",S.exitCode,null),le("afterexit",S.exitCode,null),n}else return xt.apply(this,arguments)}}var Ws=ce.exports,zs=se(Ws);const Us=1e3*5,qs=(e,t="SIGTERM",u={})=>{const n=e(t);return Hs(e,t,u,n),n},Hs=(e,t,u,n)=>{if(!Vs(t,u,n))return;const D=Js(u),o=setTimeout(()=>{e("SIGKILL")},D);o.unref&&o.unref()},Vs=(e,{forceKillAfterTimeout:t},u)=>Ks(e)&&t!==!1&&u,Ks=e=>e===Yr.constants.signals.SIGTERM||typeof e=="string"&&e.toUpperCase()==="SIGTERM",Js=({forceKillAfterTimeout:e=!0})=>{if(e===!0)return Us;if(!Number.isFinite(e)||e<0)throw new TypeError(`Expected the \`forceKillAfterTimeout\` option to be a non-negative integer, got \`${e}\` (${typeof e})`);return e},Ys=(e,t)=>{e.kill()&&(t.isCanceled=!0)},Zs=(e,t,u)=>{e.kill(t),u(Object.assign(new Error("Timed out"),{timedOut:!0,signal:t}))},Xs=(e,{timeout:t,killSignal:u="SIGTERM"},n)=>{if(t===0||t===void 0)return n;let D;const o=new Promise((i,s)=>{D=setTimeout(()=>{Zs(e,u,s)},t)}),r=n.finally(()=>{clearTimeout(D)});return Promise.race([o,r])},Qs=({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})`)},ei=async(e,{cleanup:t,detached:u},n)=>{if(!t||u)return n;const D=zs(()=>{e.kill()});return n.finally(()=>{D()})};function pn(e){return e!==null&&typeof e=="object"&&typeof e.pipe=="function"}function Cn(e){return pn(e)&&e.writable!==!1&&typeof e._write=="function"&&typeof e._writableState=="object"}const ti=e=>e instanceof Hr&&typeof e.then=="function",St=(e,t,u)=>{if(typeof u=="string")return e[t].pipe(Zr(u)),e;if(Cn(u))return e[t].pipe(u),e;if(!ti(u))throw new TypeError("The second argument must be a string, a stream or an Execa child process.");if(!Cn(u.stdin))throw new TypeError("The target child process's stdin must be available.");return e[t].pipe(u.stdin),u},ui=e=>{e.stdout!==null&&(e.pipeStdout=St.bind(void 0,e,"stdout")),e.stderr!==null&&(e.pipeStderr=St.bind(void 0,e,"stderr")),e.all!==void 0&&(e.pipeAll=St.bind(void 0,e,"all"))};var he={exports:{}};const{PassThrough:ni}=ot;var ri=e=>{e={...e};const{array:t}=e;let{encoding:u}=e;const n=u==="buffer";let D=!1;t?D=!(u||n):u=u||"utf8",n&&(u=null);const o=new ni({objectMode:D});u&&o.setEncoding(u);let r=0;const i=[];return o.on("data",s=>{i.push(s),D?r=i.length:r+=s.length}),o.getBufferedValue=()=>t?i:n?Buffer.concat(i,r):i.join(""),o.getBufferedLength=()=>r,o};const{constants:Di}=Qr,oi=ot,{promisify:si}=Eu,ii=ri,ai=si(oi.pipeline);class mn extends Error{constructor(){super("maxBuffer exceeded"),this.name="MaxBufferError"}}async function kt(e,t){if(!e)throw new Error("Expected a stream");t={maxBuffer:1/0,...t};const{maxBuffer:u}=t,n=ii(t);return await new Promise((D,o)=>{const r=i=>{i&&n.getBufferedLength()<=Di.MAX_LENGTH&&(i.bufferedData=n.getBufferedValue()),o(i)};(async()=>{try{await ai(e,n),D()}catch(i){r(i)}})(),n.on("data",()=>{n.getBufferedLength()>u&&r(new mn)})}),n.getBufferedValue()}he.exports=kt,he.exports.buffer=(e,t)=>kt(e,{...t,encoding:"buffer"}),he.exports.array=(e,t)=>kt(e,{...t,array:!0}),he.exports.MaxBufferError=mn;var ci=he.exports,hn=se(ci);const{PassThrough:li}=ot;var fi=function(){var e=[],t=new li({objectMode:!0});return t.setMaxListeners(0),t.add=u,t.isEmpty=n,t.on("unpipe",D),Array.prototype.slice.call(arguments).forEach(u),t;function u(o){return Array.isArray(o)?(o.forEach(u),this):(e.push(o),o.once("end",D.bind(null,o)),o.once("error",t.emit.bind(t,"error")),o.pipe(t,{end:!1}),this)}function n(){return e.length==0}function D(o){e=e.filter(function(r){return r!==o}),!e.length&&t.readable&&t.end()}},di=se(fi);const Fi=e=>{if(e!==void 0)throw new TypeError("The `input` and `inputFile` options cannot be both set.")},pi=({input:e,inputFile:t})=>typeof t!="string"?e:(Fi(e),Xr(t)),Ci=(e,t)=>{const u=pi(t);u!==void 0&&(pn(u)?u.pipe(e.stdin):e.stdin.end(u))},mi=(e,{all:t})=>{if(!t||!e.stdout&&!e.stderr)return;const u=di();return e.stdout&&u.add(e.stdout),e.stderr&&u.add(e.stderr),u},Mt=async(e,t)=>{if(!(!e||t===void 0)){e.destroy();try{return await t}catch(u){return u.bufferedData}}},It=(e,{encoding:t,buffer:u,maxBuffer:n})=>{if(!(!e||!u))return t?hn(e,{encoding:t,maxBuffer:n}):hn.buffer(e,{maxBuffer:n})},hi=async({stdout:e,stderr:t,all:u},{encoding:n,buffer:D,maxBuffer:o},r)=>{const i=It(e,{encoding:n,buffer:D,maxBuffer:o}),s=It(t,{encoding:n,buffer:D,maxBuffer:o}),c=It(u,{encoding:n,buffer:D,maxBuffer:o*2});try{return await Promise.all([r,i,s,c])}catch(f){return Promise.all([{error:f,signal:f.signal,timedOut:f.timedOut},Mt(e,i),Mt(t,s),Mt(u,c)])}},gi=(async()=>{})().constructor.prototype,Ei=["then","catch","finally"].map(e=>[e,Reflect.getOwnPropertyDescriptor(gi,e)]),gn=(e,t)=>{for(const[u,n]of Ei){const D=typeof t=="function"?(...o)=>Reflect.apply(n.value,t(),o):n.value.bind(t);Reflect.defineProperty(e,u,{...n,value:D})}},yi=e=>new Promise((t,u)=>{e.on("exit",(n,D)=>{t({exitCode:n,signal:D})}),e.on("error",n=>{u(n)}),e.stdin&&e.stdin.on("error",n=>{u(n)})}),En=(e,t=[])=>Array.isArray(t)?[e,...t]:[e],bi=/^[\w.-]+$/,wi=/"/g,Bi=e=>typeof e!="string"||bi.test(e)?e:`"${e.replace(wi,'\\"')}"`,vi=(e,t)=>En(e,t).join(" "),Ai=(e,t)=>En(e,t).map(u=>Bi(u)).join(" "),$i=eD("execa").enabled,ze=(e,t)=>String(e).padStart(t,"0"),xi=()=>{const e=new Date;return`${ze(e.getHours(),2)}:${ze(e.getMinutes(),2)}:${ze(e.getSeconds(),2)}.${ze(e.getMilliseconds(),3)}`},Si=(e,{verbose:t})=>{t&&T.stderr.write(`[${xi()}] ${e}
28
- `)},ki=1e3*1e3*100,Mi=({env:e,extendEnv:t,preferLocal:u,localDir:n,execPath:D})=>{const o=t?{...T.env,...e}:e;return u?ps({env:o,cwd:n,execPath:D}):o},Ii=(e,t,u={})=>{const n=cs._parse(e,t,u);return e=n.command,t=n.args,u=n.options,u={maxBuffer:ki,buffer:!0,stripFinalNewline:!0,extendEnv:!0,preferLocal:!1,localDir:u.cwd||T.cwd(),execPath:T.execPath,encoding:"utf8",reject:!0,cleanup:!0,all:!1,windowsHide:!0,verbose:$i,...u},u.env=Mi(u),u.stdio=Rs(u),T.platform==="win32"&&oe.basename(e,".exe")==="cmd"&&t.unshift("/q"),{file:e,args:t,options:u,parsed:n}},Ot=(e,t,u)=>typeof t!="string"&&!qr.isBuffer(t)?u===void 0?void 0:"":e.stripFinalNewline?ls(t):t;function q(e,t,u){const n=Ii(e,t,u),D=vi(e,t),o=Ai(e,t);Si(o,n.options),Qs(n.options);let r;try{r=pu.spawn(n.file,n.args,n.options)}catch(d){const F=new pu.ChildProcess,m=Promise.reject(ln({error:d,stdout:"",stderr:"",all:"",command:D,escapedCommand:o,parsed:n,timedOut:!1,isCanceled:!1,killed:!1}));return gn(F,m),F}const i=yi(r),s=Xs(r,n.options,i),c=ei(r,n.options,s),f={isCanceled:!1};r.kill=qs.bind(null,r.kill.bind(r)),r.cancel=Ys.bind(null,r,f);const a=on(async()=>{const[{error:d,exitCode:F,signal:m,timedOut:p},C,y,v]=await hi(r,n.options,c),I=Ot(n.options,C),$=Ot(n.options,y),g=Ot(n.options,v);if(d||F!==0||m!==null){const b=ln({error:d,exitCode:F,signal:m,stdout:I,stderr:$,all:g,command:D,escapedCommand:o,parsed:n,timedOut:p,isCanceled:f.isCanceled||(n.options.signal?n.options.signal.aborted:!1),killed:r.killed});if(!n.options.reject)return b;throw b}return{command:D,escapedCommand:o,exitCode:0,stdout:I,stderr:$,all:g,failed:!1,timedOut:!1,isCanceled:!1,killed:!1}});return Ci(r,n.options),r.all=mi(r,n.options),ui(r),gn(r,a),r}let re=!0;const fe=typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{};let ge=0;if(fe.process&&fe.process.env&&fe.process.stdout){const{FORCE_COLOR:e,NODE_DISABLE_COLORS:t,NO_COLOR:u,TERM:n,COLORTERM:D}=fe.process.env;t||u||e==="0"?re=!1:e==="1"||e==="2"||e==="3"?re=!0:n==="dumb"?re=!1:"CI"in fe.process.env&&["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE","DRONE"].some(o=>o in fe.process.env)?re=!0:re=process.stdout.isTTY,re&&(process.platform==="win32"||D&&(D==="truecolor"||D==="24bit")?ge=3:n&&(n.endsWith("-256color")||n.endsWith("256"))?ge=2:ge=1)}let yn={enabled:re,supportLevel:ge};function De(e,t,u=1){const n=`\x1B[${e}m`,D=`\x1B[${t}m`,o=new RegExp(`\\x1b\\[${t}m`,"g");return r=>yn.enabled&&yn.supportLevel>=u?n+(""+r).replace(o,n)+D:""+r}const Ue=De(2,22),Oi=De(30,39),Tt=De(31,39),qe=De(32,39),Ti=De(35,39),Pi=De(90,39),Ri=De(46,49),Pt="\x1B",M=`${Pt}[`,_i="\x07",Rt={to(e,t){return t?`${M}${t+1};${e+1}H`:`${M}${e+1}G`},move(e,t){let u="";return e<0?u+=`${M}${-e}D`:e>0&&(u+=`${M}${e}C`),t<0?u+=`${M}${-t}A`:t>0&&(u+=`${M}${t}B`),u},up:(e=1)=>`${M}${e}A`,down:(e=1)=>`${M}${e}B`,forward:(e=1)=>`${M}${e}C`,backward:(e=1)=>`${M}${e}D`,nextLine:(e=1)=>`${M}E`.repeat(e),prevLine:(e=1)=>`${M}F`.repeat(e),left:`${M}G`,hide:`${M}?25l`,show:`${M}?25h`,save:`${Pt}7`,restore:`${Pt}8`},ji={up:(e=1)=>`${M}S`.repeat(e),down:(e=1)=>`${M}T`.repeat(e)},Ni={screen:`${M}2J`,up:(e=1)=>`${M}1J`.repeat(e),down:(e=1)=>`${M}J`.repeat(e),line:`${M}2K`,lineEnd:`${M}K`,lineStart:`${M}1K`,lines(e){let t="";for(let u=0;u<e;u++)t+=this.line+(u<e-1?Rt.up():"");return e&&(t+=Rt.left),t}};var K={cursor:Rt,scroll:ji,erase:Ni,beep:_i},_t={exports:{}};let He=process||{},bn=He.argv||[],Ve=He.env||{},Li=!(Ve.NO_COLOR||bn.includes("--no-color"))&&(!!Ve.FORCE_COLOR||bn.includes("--color")||He.platform==="win32"||(He.stdout||{}).isTTY&&Ve.TERM!=="dumb"||!!Ve.CI),Gi=(e,t,u=e)=>n=>{let D=""+n,o=D.indexOf(t,e.length);return~o?e+Wi(D,t,u,o)+t:e+D+t},Wi=(e,t,u,n)=>{let D="",o=0;do D+=e.substring(o,n)+u,o=n+t.length,n=e.indexOf(t,o);while(~n);return D+e.substring(o)},wn=(e=Li)=>{let t=e?Gi:()=>String;return{isColorSupported:e,reset:t("\x1B[0m","\x1B[0m"),bold:t("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"),dim:t("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"),italic:t("\x1B[3m","\x1B[23m"),underline:t("\x1B[4m","\x1B[24m"),inverse:t("\x1B[7m","\x1B[27m"),hidden:t("\x1B[8m","\x1B[28m"),strikethrough:t("\x1B[9m","\x1B[29m"),black:t("\x1B[30m","\x1B[39m"),red:t("\x1B[31m","\x1B[39m"),green:t("\x1B[32m","\x1B[39m"),yellow:t("\x1B[33m","\x1B[39m"),blue:t("\x1B[34m","\x1B[39m"),magenta:t("\x1B[35m","\x1B[39m"),cyan:t("\x1B[36m","\x1B[39m"),white:t("\x1B[37m","\x1B[39m"),gray:t("\x1B[90m","\x1B[39m"),bgBlack:t("\x1B[40m","\x1B[49m"),bgRed:t("\x1B[41m","\x1B[49m"),bgGreen:t("\x1B[42m","\x1B[49m"),bgYellow:t("\x1B[43m","\x1B[49m"),bgBlue:t("\x1B[44m","\x1B[49m"),bgMagenta:t("\x1B[45m","\x1B[49m"),bgCyan:t("\x1B[46m","\x1B[49m"),bgWhite:t("\x1B[47m","\x1B[49m"),blackBright:t("\x1B[90m","\x1B[39m"),redBright:t("\x1B[91m","\x1B[39m"),greenBright:t("\x1B[92m","\x1B[39m"),yellowBright:t("\x1B[93m","\x1B[39m"),blueBright:t("\x1B[94m","\x1B[39m"),magentaBright:t("\x1B[95m","\x1B[39m"),cyanBright:t("\x1B[96m","\x1B[39m"),whiteBright:t("\x1B[97m","\x1B[39m"),bgBlackBright:t("\x1B[100m","\x1B[49m"),bgRedBright:t("\x1B[101m","\x1B[49m"),bgGreenBright:t("\x1B[102m","\x1B[49m"),bgYellowBright:t("\x1B[103m","\x1B[49m"),bgBlueBright:t("\x1B[104m","\x1B[49m"),bgMagentaBright:t("\x1B[105m","\x1B[49m"),bgCyanBright:t("\x1B[106m","\x1B[49m"),bgWhiteBright:t("\x1B[107m","\x1B[49m")}};_t.exports=wn(),_t.exports.createColors=wn;var zi=_t.exports,E=se(zi);function Ui({onlyFirst:e=!1}={}){const t=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");return new RegExp(t,e?void 0:"g")}const qi=Ui();function Bn(e){if(typeof e!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof e}\``);return e.replace(qi,"")}function vn(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var An={exports:{}};(function(e){var t={};e.exports=t,t.eastAsianWidth=function(n){var D=n.charCodeAt(0),o=n.length==2?n.charCodeAt(1):0,r=D;return 55296<=D&&D<=56319&&56320<=o&&o<=57343&&(D&=1023,o&=1023,r=D<<10|o,r+=65536),r==12288||65281<=r&&r<=65376||65504<=r&&r<=65510?"F":r==8361||65377<=r&&r<=65470||65474<=r&&r<=65479||65482<=r&&r<=65487||65490<=r&&r<=65495||65498<=r&&r<=65500||65512<=r&&r<=65518?"H":4352<=r&&r<=4447||4515<=r&&r<=4519||4602<=r&&r<=4607||9001<=r&&r<=9002||11904<=r&&r<=11929||11931<=r&&r<=12019||12032<=r&&r<=12245||12272<=r&&r<=12283||12289<=r&&r<=12350||12353<=r&&r<=12438||12441<=r&&r<=12543||12549<=r&&r<=12589||12593<=r&&r<=12686||12688<=r&&r<=12730||12736<=r&&r<=12771||12784<=r&&r<=12830||12832<=r&&r<=12871||12880<=r&&r<=13054||13056<=r&&r<=19903||19968<=r&&r<=42124||42128<=r&&r<=42182||43360<=r&&r<=43388||44032<=r&&r<=55203||55216<=r&&r<=55238||55243<=r&&r<=55291||63744<=r&&r<=64255||65040<=r&&r<=65049||65072<=r&&r<=65106||65108<=r&&r<=65126||65128<=r&&r<=65131||110592<=r&&r<=110593||127488<=r&&r<=127490||127504<=r&&r<=127546||127552<=r&&r<=127560||127568<=r&&r<=127569||131072<=r&&r<=194367||177984<=r&&r<=196605||196608<=r&&r<=262141?"W":32<=r&&r<=126||162<=r&&r<=163||165<=r&&r<=166||r==172||r==175||10214<=r&&r<=10221||10629<=r&&r<=10630?"Na":r==161||r==164||167<=r&&r<=168||r==170||173<=r&&r<=174||176<=r&&r<=180||182<=r&&r<=186||188<=r&&r<=191||r==198||r==208||215<=r&&r<=216||222<=r&&r<=225||r==230||232<=r&&r<=234||236<=r&&r<=237||r==240||242<=r&&r<=243||247<=r&&r<=250||r==252||r==254||r==257||r==273||r==275||r==283||294<=r&&r<=295||r==299||305<=r&&r<=307||r==312||319<=r&&r<=322||r==324||328<=r&&r<=331||r==333||338<=r&&r<=339||358<=r&&r<=359||r==363||r==462||r==464||r==466||r==468||r==470||r==472||r==474||r==476||r==593||r==609||r==708||r==711||713<=r&&r<=715||r==717||r==720||728<=r&&r<=731||r==733||r==735||768<=r&&r<=879||913<=r&&r<=929||931<=r&&r<=937||945<=r&&r<=961||963<=r&&r<=969||r==1025||1040<=r&&r<=1103||r==1105||r==8208||8211<=r&&r<=8214||8216<=r&&r<=8217||8220<=r&&r<=8221||8224<=r&&r<=8226||8228<=r&&r<=8231||r==8240||8242<=r&&r<=8243||r==8245||r==8251||r==8254||r==8308||r==8319||8321<=r&&r<=8324||r==8364||r==8451||r==8453||r==8457||r==8467||r==8470||8481<=r&&r<=8482||r==8486||r==8491||8531<=r&&r<=8532||8539<=r&&r<=8542||8544<=r&&r<=8555||8560<=r&&r<=8569||r==8585||8592<=r&&r<=8601||8632<=r&&r<=8633||r==8658||r==8660||r==8679||r==8704||8706<=r&&r<=8707||8711<=r&&r<=8712||r==8715||r==8719||r==8721||r==8725||r==8730||8733<=r&&r<=8736||r==8739||r==8741||8743<=r&&r<=8748||r==8750||8756<=r&&r<=8759||8764<=r&&r<=8765||r==8776||r==8780||r==8786||8800<=r&&r<=8801||8804<=r&&r<=8807||8810<=r&&r<=8811||8814<=r&&r<=8815||8834<=r&&r<=8835||8838<=r&&r<=8839||r==8853||r==8857||r==8869||r==8895||r==8978||9312<=r&&r<=9449||9451<=r&&r<=9547||9552<=r&&r<=9587||9600<=r&&r<=9615||9618<=r&&r<=9621||9632<=r&&r<=9633||9635<=r&&r<=9641||9650<=r&&r<=9651||9654<=r&&r<=9655||9660<=r&&r<=9661||9664<=r&&r<=9665||9670<=r&&r<=9672||r==9675||9678<=r&&r<=9681||9698<=r&&r<=9701||r==9711||9733<=r&&r<=9734||r==9737||9742<=r&&r<=9743||9748<=r&&r<=9749||r==9756||r==9758||r==9792||r==9794||9824<=r&&r<=9825||9827<=r&&r<=9829||9831<=r&&r<=9834||9836<=r&&r<=9837||r==9839||9886<=r&&r<=9887||9918<=r&&r<=9919||9924<=r&&r<=9933||9935<=r&&r<=9953||r==9955||9960<=r&&r<=9983||r==10045||r==10071||10102<=r&&r<=10111||11093<=r&&r<=11097||12872<=r&&r<=12879||57344<=r&&r<=63743||65024<=r&&r<=65039||r==65533||127232<=r&&r<=127242||127248<=r&&r<=127277||127280<=r&&r<=127337||127344<=r&&r<=127386||917760<=r&&r<=917999||983040<=r&&r<=1048573||1048576<=r&&r<=1114109?"A":"N"},t.characterLength=function(n){var D=this.eastAsianWidth(n);return D=="F"||D=="W"||D=="A"?2:1};function u(n){return n.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g)||[]}t.length=function(n){for(var D=u(n),o=0,r=0;r<D.length;r++)o=o+this.characterLength(D[r]);return o},t.slice=function(n,D,o){textLen=t.length(n),D=D||0,o=o||1,D<0&&(D=textLen+D),o<0&&(o=textLen+o);for(var r="",i=0,s=u(n),c=0;c<s.length;c++){var f=s[c],l=t.length(f);if(i>=D-(l==2?1:0))if(i+l<=o)r+=f;else break;i+=l}return r}})(An);var Hi=An.exports;const Vi=vn(Hi);var Ki=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};const Ji=vn(Ki);function Ee(e,t={}){if(typeof e!="string"||e.length===0||(t={ambiguousIsNarrow:!0,...t},e=Bn(e),e.length===0))return 0;e=e.replace(Ji()," ");const u=t.ambiguousIsNarrow?1:2;let n=0;for(const D of e){const o=D.codePointAt(0);if(!(o<=31||o>=127&&o<=159||o>=768&&o<=879))switch(Vi.eastAsianWidth(D)){case"F":case"W":n+=2;break;case"A":n+=u;break;default:n+=1}}return n}const jt=10,$n=(e=0)=>t=>`\x1B[${t+e}m`,xn=(e=0)=>t=>`\x1B[${38+e};5;${t}m`,Sn=(e=0)=>(t,u,n)=>`\x1B[${38+e};2;${t};${u};${n}m`,k={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};Object.keys(k.modifier);const Yi=Object.keys(k.color),Zi=Object.keys(k.bgColor);[...Yi,...Zi];function Xi(){const e=new Map;for(const[t,u]of Object.entries(k)){for(const[n,D]of Object.entries(u))k[n]={open:`\x1B[${D[0]}m`,close:`\x1B[${D[1]}m`},u[n]=k[n],e.set(D[0],D[1]);Object.defineProperty(k,t,{value:u,enumerable:!1})}return Object.defineProperty(k,"codes",{value:e,enumerable:!1}),k.color.close="\x1B[39m",k.bgColor.close="\x1B[49m",k.color.ansi=$n(),k.color.ansi256=xn(),k.color.ansi16m=Sn(),k.bgColor.ansi=$n(jt),k.bgColor.ansi256=xn(jt),k.bgColor.ansi16m=Sn(jt),Object.defineProperties(k,{rgbToAnsi256:{value:(t,u,n)=>t===u&&u===n?t<8?16:t>248?231:Math.round((t-8)/247*24)+232:16+36*Math.round(t/255*5)+6*Math.round(u/255*5)+Math.round(n/255*5),enumerable:!1},hexToRgb:{value:t=>{const u=/[a-f\d]{6}|[a-f\d]{3}/i.exec(t.toString(16));if(!u)return[0,0,0];let[n]=u;n.length===3&&(n=[...n].map(o=>o+o).join(""));const D=Number.parseInt(n,16);return[D>>16&255,D>>8&255,D&255]},enumerable:!1},hexToAnsi256:{value:t=>k.rgbToAnsi256(...k.hexToRgb(t)),enumerable:!1},ansi256ToAnsi:{value:t=>{if(t<8)return 30+t;if(t<16)return 90+(t-8);let u,n,D;if(t>=232)u=((t-232)*10+8)/255,n=u,D=u;else{t-=16;const i=t%36;u=Math.floor(t/36)/5,n=Math.floor(i/6)/5,D=i%6/5}const o=Math.max(u,n,D)*2;if(o===0)return 30;let r=30+(Math.round(D)<<2|Math.round(n)<<1|Math.round(u));return o===2&&(r+=60),r},enumerable:!1},rgbToAnsi:{value:(t,u,n)=>k.ansi256ToAnsi(k.rgbToAnsi256(t,u,n)),enumerable:!1},hexToAnsi:{value:t=>k.ansi256ToAnsi(k.hexToAnsi256(t)),enumerable:!1}}),k}const Qi=Xi(),Ke=new Set(["\x1B","\x9B"]),ea=39,Nt="\x07",kn="[",ta="]",Mn="m",Lt=`${ta}8;;`,In=e=>`${Ke.values().next().value}${kn}${e}${Mn}`,On=e=>`${Ke.values().next().value}${Lt}${e}${Nt}`,ua=e=>e.split(" ").map(t=>Ee(t)),Gt=(e,t,u)=>{const n=[...t];let D=!1,o=!1,r=Ee(Bn(e[e.length-1]));for(const[i,s]of n.entries()){const c=Ee(s);if(r+c<=u?e[e.length-1]+=s:(e.push(s),r=0),Ke.has(s)&&(D=!0,o=n.slice(i+1).join("").startsWith(Lt)),D){o?s===Nt&&(D=!1,o=!1):s===Mn&&(D=!1);continue}r+=c,r===u&&i<n.length-1&&(e.push(""),r=0)}!r&&e[e.length-1].length>0&&e.length>1&&(e[e.length-2]+=e.pop())},na=e=>{const t=e.split(" ");let u=t.length;for(;u>0&&!(Ee(t[u-1])>0);)u--;return u===t.length?e:t.slice(0,u).join(" ")+t.slice(u).join("")},ra=(e,t,u={})=>{if(u.trim!==!1&&e.trim()==="")return"";let n="",D,o;const r=ua(e);let i=[""];for(const[c,f]of e.split(" ").entries()){u.trim!==!1&&(i[i.length-1]=i[i.length-1].trimStart());let l=Ee(i[i.length-1]);if(c!==0&&(l>=t&&(u.wordWrap===!1||u.trim===!1)&&(i.push(""),l=0),(l>0||u.trim===!1)&&(i[i.length-1]+=" ",l++)),u.hard&&r[c]>t){const a=t-l,d=1+Math.floor((r[c]-a-1)/t);Math.floor((r[c]-1)/t)<d&&i.push(""),Gt(i,f,t);continue}if(l+r[c]>t&&l>0&&r[c]>0){if(u.wordWrap===!1&&l<t){Gt(i,f,t);continue}i.push("")}if(l+r[c]>t&&u.wordWrap===!1){Gt(i,f,t);continue}i[i.length-1]+=f}u.trim!==!1&&(i=i.map(c=>na(c)));const s=[...i.join(`
29
- `)];for(const[c,f]of s.entries()){if(n+=f,Ke.has(f)){const{groups:a}=new RegExp(`(?:\\${kn}(?<code>\\d+)m|\\${Lt}(?<uri>.*)${Nt})`).exec(s.slice(c).join(""))||{groups:{}};if(a.code!==void 0){const d=Number.parseFloat(a.code);D=d===ea?void 0:d}else a.uri!==void 0&&(o=a.uri.length===0?void 0:a.uri)}const l=Qi.codes.get(Number(D));s[c+1]===`
30
- `?(o&&(n+=On("")),D&&l&&(n+=In(l))):f===`
31
- `&&(D&&l&&(n+=In(D)),o&&(n+=On(o)))}return n};function Tn(e,t,u){return String(e).normalize().replace(/\r\n/g,`
24
+ `.charCodeAt(),u=typeof e=="string"?"\r":"\r".charCodeAt();return e[e.length-1]===t&&(e=e.slice(0,-1)),e[e.length-1]===u&&(e=e.slice(0,-1)),e}function on(e={}){const{env:t=process.env,platform:u=process.platform}=e;return u!=="win32"?"PATH":Object.keys(t).reverse().find(n=>n.toUpperCase()==="PATH")||"Path"}const ds=({cwd:e=T.cwd(),path:t=T.env[on()],preferLocal:u=!0,execPath:n=T.execPath,addExecPath:D=!0}={})=>{const o=e instanceof URL?mu(e):e,r=oe.resolve(o),i=[];return u&&Fs(i,r),D&&ps(i,n,r),[...i,t].join(oe.delimiter)},Fs=(e,t)=>{let u;for(;u!==t;)e.push(oe.join(t,"node_modules/.bin")),u=t,t=oe.resolve(t,"..")},ps=(e,t,u)=>{const n=t instanceof URL?mu(t):t;e.push(oe.resolve(u,n,".."))},Cs=({env:e=T.env,...t}={})=>{e={...e};const u=on({env:e});return t.path=e[u],e[u]=ds(t),e},ms=(e,t,u,n)=>{if(u==="length"||u==="prototype"||u==="arguments"||u==="caller")return;const D=Object.getOwnPropertyDescriptor(e,u),o=Object.getOwnPropertyDescriptor(t,u);!hs(D,o)&&n||Object.defineProperty(e,u,o)},hs=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)},gs=(e,t)=>{const u=Object.getPrototypeOf(t);u!==Object.getPrototypeOf(e)&&Object.setPrototypeOf(e,u)},Es=(e,t)=>`/* Wrapped ${e}*/
25
+ ${t}`,ys=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),bs=Object.getOwnPropertyDescriptor(Function.prototype.toString,"name"),ws=(e,t,u)=>{const n=u===""?"":`with ${u.trim()}() `,D=Es.bind(null,n,t.toString());Object.defineProperty(D,"name",bs),Object.defineProperty(e,"toString",{...ys,value:D})};function Bs(e,t,{ignoreNonConfigurable:u=!1}={}){const{name:n}=e;for(const D of Reflect.ownKeys(t))ms(e,t,D,u);return gs(e,t),ws(e,t,n),e}const Ne=new WeakMap,sn=(e,t={})=>{if(typeof e!="function")throw new TypeError("Expected a function");let u,n=0;const D=e.displayName||e.name||"<anonymous>",o=function(...r){if(Ne.set(o,++n),n===1)u=e.apply(this,r),e=null;else if(t.throw===!0)throw new Error(`Function \`${D}\` can only be called once`);return u};return Bs(o,e),Ne.set(o,n),o};sn.callCount=e=>{if(!Ne.has(e))throw new Error(`The given function \`${e.name}\` is not wrapped by the \`onetime\` package`);return Ne.get(e)};const vs=()=>{const e=cn-an+1;return Array.from({length:e},As)},As=(e,t)=>({name:`SIGRT${t+1}`,number:an+t,action:"terminate",description:"Application-specific signal (realtime)",standard:"posix"}),an=34,cn=64,$s=[{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"}],ln=()=>{const e=vs();return[...$s,...e].map(xs)},xs=({name:e,number:t,description:u,action:n,forced:D=!1,standard:o})=>{const{signals:{[e]:r}}=hu,i=r!==void 0;return{name:e,number:i?r:t,description:u,supported:i,action:n,forced:D,standard:o}},Ss=()=>{const e=ln();return Object.fromEntries(e.map(ks))},ks=({name:e,number:t,description:u,supported:n,action:D,forced:o,standard:r})=>[e,{name:e,number:t,description:u,supported:n,action:D,forced:o,standard:r}],Ms=Ss(),Is=()=>{const e=ln(),t=cn+1,u=Array.from({length:t},(n,D)=>Os(D,e));return Object.assign({},...u)},Os=(e,t)=>{const u=Ts(e,t);if(u===void 0)return{};const{name:n,description:D,supported:o,action:r,forced:i,standard:s}=u;return{[e]:{name:n,number:e,description:D,supported:o,action:r,forced:i,standard:s}}},Ts=(e,t)=>{const u=t.find(({name:n})=>hu.signals[n]===e);return u!==void 0?u:t.find(n=>n.number===e)};Is();const Ps=({timedOut:e,timeout:t,errorCode:u,signal:n,signalDescription:D,exitCode:o,isCanceled:r})=>e?`timed out after ${t} milliseconds`:r?"was canceled":u!==void 0?`failed with ${u}`:n!==void 0?`was killed with ${n} (${D})`:o!==void 0?`failed with exit code ${o}`:"failed",fn=({stdout:e,stderr:t,all:u,error:n,signal:D,exitCode:o,command:r,escapedCommand:i,timedOut:s,isCanceled:c,killed:f,parsed:{options:{timeout:l,cwd:a=T.cwd()}}})=>{o=o===null?void 0:o,D=D===null?void 0:D;const d=D===void 0?void 0:Ms[D].description,F=n&&n.code,p=`Command ${Ps({timedOut:s,timeout:l,errorCode:F,signal:D,signalDescription:d,exitCode:o,isCanceled:c})}: ${r}`,C=Object.prototype.toString.call(n)==="[object Error]",b=C?`${p}
26
+ ${n.message}`:p,v=[b,t,e].filter(Boolean).join(`
27
+ `);return C?(n.originalMessage=n.message,n.message=v):n=new Error(v),n.shortMessage=b,n.command=r,n.escapedCommand=i,n.exitCode=o,n.signal=D,n.signalDescription=d,n.stdout=e,n.stderr=t,n.cwd=a,u!==void 0&&(n.all=u),"bufferedData"in n&&delete n.bufferedData,n.failed=!0,n.timedOut=!!s,n.isCanceled=c,n.killed=f&&!s,n},Le=["stdin","stdout","stderr"],Rs=e=>Le.some(t=>e[t]!==void 0),_s=e=>{if(!e)return;const{stdio:t}=e;if(t===void 0)return Le.map(n=>e[n]);if(Rs(e))throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${Le.map(n=>`\`${n}\``).join(", ")}`);if(typeof t=="string")return t;if(!Array.isArray(t))throw new TypeError(`Expected \`stdio\` to be of type \`string\` or \`Array\`, got \`${typeof t}\``);const u=Math.max(t.length,Le.length);return Array.from({length:u},(n,D)=>t[D])};var ce={exports:{}},Ge={exports:{}};Ge.exports;var dn;function js(){return dn||(dn=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")}(Ge)),Ge.exports}var x=_.process;const ne=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(!ne(x))ce.exports=function(){return function(){}};else{var Ns=gu,me=js(),Ls=/^win/i.test(x.platform),We=Eu;typeof We!="function"&&(We=We.EventEmitter);var j;x.__signal_exit_emitter__?j=x.__signal_exit_emitter__:(j=x.__signal_exit_emitter__=new We,j.count=0,j.emitted={}),j.infinite||(j.setMaxListeners(1/0),j.infinite=!0),ce.exports=function(e,t){if(!ne(_.process))return function(){};Ns.equal(typeof e,"function","a callback must be provided for exit handler"),he===!1&&Fn();var u="exit";t&&t.alwaysLast&&(u="afterexit");var n=function(){j.removeListener(u,e),j.listeners("exit").length===0&&j.listeners("afterexit").length===0&&$t()};return j.on(u,e),n};var $t=function(){!he||!ne(_.process)||(he=!1,me.forEach(function(t){try{x.removeListener(t,xt[t])}catch{}}),x.emit=St,x.reallyExit=pn,j.count-=1)};ce.exports.unload=$t;var le=function(t,u,n){j.emitted[t]||(j.emitted[t]=!0,j.emit(t,u,n))},xt={};me.forEach(function(e){xt[e]=function(){if(ne(_.process)){var u=x.listeners(e);u.length===j.count&&($t(),le("exit",null,e),le("afterexit",null,e),Ls&&e==="SIGHUP"&&(e="SIGINT"),x.kill(x.pid,e))}}}),ce.exports.signals=function(){return me};var he=!1,Fn=function(){he||!ne(_.process)||(he=!0,j.count+=1,me=me.filter(function(t){try{return x.on(t,xt[t]),!0}catch{return!1}}),x.emit=Ws,x.reallyExit=Gs)};ce.exports.load=Fn;var pn=x.reallyExit,Gs=function(t){ne(_.process)&&(x.exitCode=t||0,le("exit",x.exitCode,null),le("afterexit",x.exitCode,null),pn.call(x,x.exitCode))},St=x.emit,Ws=function(t,u){if(t==="exit"&&ne(_.process)){u!==void 0&&(x.exitCode=u);var n=St.apply(this,arguments);return le("exit",x.exitCode,null),le("afterexit",x.exitCode,null),n}else return St.apply(this,arguments)}}var zs=ce.exports,Us=se(zs);const qs=1e3*5,Hs=(e,t="SIGTERM",u={})=>{const n=e(t);return Vs(e,t,u,n),n},Vs=(e,t,u,n)=>{if(!Ks(t,u,n))return;const D=Ys(u),o=setTimeout(()=>{e("SIGKILL")},D);o.unref&&o.unref()},Ks=(e,{forceKillAfterTimeout:t},u)=>Js(e)&&t!==!1&&u,Js=e=>e===Zr.constants.signals.SIGTERM||typeof e=="string"&&e.toUpperCase()==="SIGTERM",Ys=({forceKillAfterTimeout:e=!0})=>{if(e===!0)return qs;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},Zs=(e,t)=>{e.kill()&&(t.isCanceled=!0)},Xs=(e,t,u)=>{e.kill(t),u(Object.assign(new Error("Timed out"),{timedOut:!0,signal:t}))},Qs=(e,{timeout:t,killSignal:u="SIGTERM"},n)=>{if(t===0||t===void 0)return n;let D;const o=new Promise((i,s)=>{D=setTimeout(()=>{Xs(e,u,s)},t)}),r=n.finally(()=>{clearTimeout(D)});return Promise.race([o,r])},ei=({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})`)},ti=async(e,{cleanup:t,detached:u},n)=>{if(!t||u)return n;const D=Us(()=>{e.kill()});return n.finally(()=>{D()})};function Cn(e){return e!==null&&typeof e=="object"&&typeof e.pipe=="function"}function mn(e){return Cn(e)&&e.writable!==!1&&typeof e._write=="function"&&typeof e._writableState=="object"}const ui=e=>e instanceof Vr&&typeof e.then=="function",kt=(e,t,u)=>{if(typeof u=="string")return e[t].pipe(Xr(u)),e;if(mn(u))return e[t].pipe(u),e;if(!ui(u))throw new TypeError("The second argument must be a string, a stream or an Execa child process.");if(!mn(u.stdin))throw new TypeError("The target child process's stdin must be available.");return e[t].pipe(u.stdin),u},ni=e=>{e.stdout!==null&&(e.pipeStdout=kt.bind(void 0,e,"stdout")),e.stderr!==null&&(e.pipeStderr=kt.bind(void 0,e,"stderr")),e.all!==void 0&&(e.pipeAll=kt.bind(void 0,e,"all"))};var ge={exports:{}};const{PassThrough:ri}=st;var Di=e=>{e={...e};const{array:t}=e;let{encoding:u}=e;const n=u==="buffer";let D=!1;t?D=!(u||n):u=u||"utf8",n&&(u=null);const o=new ri({objectMode:D});u&&o.setEncoding(u);let r=0;const i=[];return o.on("data",s=>{i.push(s),D?r=i.length:r+=s.length}),o.getBufferedValue=()=>t?i:n?Buffer.concat(i,r):i.join(""),o.getBufferedLength=()=>r,o};const{constants:oi}=eD,si=st,{promisify:ii}=yu,ai=Di,ci=ii(si.pipeline);class hn extends Error{constructor(){super("maxBuffer exceeded"),this.name="MaxBufferError"}}async function Mt(e,t){if(!e)throw new Error("Expected a stream");t={maxBuffer:1/0,...t};const{maxBuffer:u}=t,n=ai(t);return await new Promise((D,o)=>{const r=i=>{i&&n.getBufferedLength()<=oi.MAX_LENGTH&&(i.bufferedData=n.getBufferedValue()),o(i)};(async()=>{try{await ci(e,n),D()}catch(i){r(i)}})(),n.on("data",()=>{n.getBufferedLength()>u&&r(new hn)})}),n.getBufferedValue()}ge.exports=Mt,ge.exports.buffer=(e,t)=>Mt(e,{...t,encoding:"buffer"}),ge.exports.array=(e,t)=>Mt(e,{...t,array:!0}),ge.exports.MaxBufferError=hn;var li=ge.exports,gn=se(li);const{PassThrough:fi}=st;var di=function(){var e=[],t=new fi({objectMode:!0});return t.setMaxListeners(0),t.add=u,t.isEmpty=n,t.on("unpipe",D),Array.prototype.slice.call(arguments).forEach(u),t;function u(o){return Array.isArray(o)?(o.forEach(u),this):(e.push(o),o.once("end",D.bind(null,o)),o.once("error",t.emit.bind(t,"error")),o.pipe(t,{end:!1}),this)}function n(){return e.length==0}function D(o){e=e.filter(function(r){return r!==o}),!e.length&&t.readable&&t.end()}},Fi=se(di);const pi=e=>{if(e!==void 0)throw new TypeError("The `input` and `inputFile` options cannot be both set.")},Ci=({input:e,inputFile:t})=>typeof t!="string"?e:(pi(e),Qr(t)),mi=(e,t)=>{const u=Ci(t);u!==void 0&&(Cn(u)?u.pipe(e.stdin):e.stdin.end(u))},hi=(e,{all:t})=>{if(!t||!e.stdout&&!e.stderr)return;const u=Fi();return e.stdout&&u.add(e.stdout),e.stderr&&u.add(e.stderr),u},It=async(e,t)=>{if(!(!e||t===void 0)){e.destroy();try{return await t}catch(u){return u.bufferedData}}},Ot=(e,{encoding:t,buffer:u,maxBuffer:n})=>{if(!(!e||!u))return t?gn(e,{encoding:t,maxBuffer:n}):gn.buffer(e,{maxBuffer:n})},gi=async({stdout:e,stderr:t,all:u},{encoding:n,buffer:D,maxBuffer:o},r)=>{const i=Ot(e,{encoding:n,buffer:D,maxBuffer:o}),s=Ot(t,{encoding:n,buffer:D,maxBuffer:o}),c=Ot(u,{encoding:n,buffer:D,maxBuffer:o*2});try{return await Promise.all([r,i,s,c])}catch(f){return Promise.all([{error:f,signal:f.signal,timedOut:f.timedOut},It(e,i),It(t,s),It(u,c)])}},Ei=(async()=>{})().constructor.prototype,yi=["then","catch","finally"].map(e=>[e,Reflect.getOwnPropertyDescriptor(Ei,e)]),En=(e,t)=>{for(const[u,n]of yi){const D=typeof t=="function"?(...o)=>Reflect.apply(n.value,t(),o):n.value.bind(t);Reflect.defineProperty(e,u,{...n,value:D})}},bi=e=>new Promise((t,u)=>{e.on("exit",(n,D)=>{t({exitCode:n,signal:D})}),e.on("error",n=>{u(n)}),e.stdin&&e.stdin.on("error",n=>{u(n)})}),yn=(e,t=[])=>Array.isArray(t)?[e,...t]:[e],wi=/^[\w.-]+$/,Bi=/"/g,vi=e=>typeof e!="string"||wi.test(e)?e:`"${e.replace(Bi,'\\"')}"`,Ai=(e,t)=>yn(e,t).join(" "),$i=(e,t)=>yn(e,t).map(u=>vi(u)).join(" "),xi=tD("execa").enabled,ze=(e,t)=>String(e).padStart(t,"0"),Si=()=>{const e=new Date;return`${ze(e.getHours(),2)}:${ze(e.getMinutes(),2)}:${ze(e.getSeconds(),2)}.${ze(e.getMilliseconds(),3)}`},ki=(e,{verbose:t})=>{t&&T.stderr.write(`[${Si()}] ${e}
28
+ `)},Mi=1e3*1e3*100,Ii=({env:e,extendEnv:t,preferLocal:u,localDir:n,execPath:D})=>{const o=t?{...T.env,...e}:e;return u?Cs({env:o,cwd:n,execPath:D}):o},Oi=(e,t,u={})=>{const n=ls._parse(e,t,u);return e=n.command,t=n.args,u=n.options,u={maxBuffer:Mi,buffer:!0,stripFinalNewline:!0,extendEnv:!0,preferLocal:!1,localDir:u.cwd||T.cwd(),execPath:T.execPath,encoding:"utf8",reject:!0,cleanup:!0,all:!1,windowsHide:!0,verbose:xi,...u},u.env=Ii(u),u.stdio=_s(u),T.platform==="win32"&&oe.basename(e,".exe")==="cmd"&&t.unshift("/q"),{file:e,args:t,options:u,parsed:n}},Tt=(e,t,u)=>typeof t!="string"&&!Hr.isBuffer(t)?u===void 0?void 0:"":e.stripFinalNewline?fs(t):t;function U(e,t,u){const n=Oi(e,t,u),D=Ai(e,t),o=$i(e,t);ki(o,n.options),ei(n.options);let r;try{r=Cu.spawn(n.file,n.args,n.options)}catch(d){const F=new Cu.ChildProcess,h=Promise.reject(fn({error:d,stdout:"",stderr:"",all:"",command:D,escapedCommand:o,parsed:n,timedOut:!1,isCanceled:!1,killed:!1}));return En(F,h),F}const i=bi(r),s=Qs(r,n.options,i),c=ti(r,n.options,s),f={isCanceled:!1};r.kill=Hs.bind(null,r.kill.bind(r)),r.cancel=Zs.bind(null,r,f);const a=sn(async()=>{const[{error:d,exitCode:F,signal:h,timedOut:p},C,b,v]=await gi(r,n.options,c),M=Tt(n.options,C),O=Tt(n.options,b),g=Tt(n.options,v);if(d||F!==0||h!==null){const E=fn({error:d,exitCode:F,signal:h,stdout:M,stderr:O,all:g,command:D,escapedCommand:o,parsed:n,timedOut:p,isCanceled:f.isCanceled||(n.options.signal?n.options.signal.aborted:!1),killed:r.killed});if(!n.options.reject)return E;throw E}return{command:D,escapedCommand:o,exitCode:0,stdout:M,stderr:O,all:g,failed:!1,timedOut:!1,isCanceled:!1,killed:!1}});return mi(r,n.options),r.all=hi(r,n.options),ni(r),En(r,a),r}let re=!0;const fe=typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{};let Ee=0;if(fe.process&&fe.process.env&&fe.process.stdout){const{FORCE_COLOR:e,NODE_DISABLE_COLORS:t,NO_COLOR:u,TERM:n,COLORTERM:D}=fe.process.env;t||u||e==="0"?re=!1:e==="1"||e==="2"||e==="3"?re=!0:n==="dumb"?re=!1:"CI"in fe.process.env&&["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE","DRONE"].some(o=>o in fe.process.env)?re=!0:re=process.stdout.isTTY,re&&(process.platform==="win32"||D&&(D==="truecolor"||D==="24bit")?Ee=3:n&&(n.endsWith("-256color")||n.endsWith("256"))?Ee=2:Ee=1)}let bn={enabled:re,supportLevel:Ee};function De(e,t,u=1){const n=`\x1B[${e}m`,D=`\x1B[${t}m`,o=new RegExp(`\\x1b\\[${t}m`,"g");return r=>bn.enabled&&bn.supportLevel>=u?n+(""+r).replace(o,n)+D:""+r}const Ue=De(2,22),Ti=De(30,39),Pt=De(31,39),ye=De(32,39),Pi=De(35,39),Ri=De(90,39),_i=De(46,49),Rt="\x1B",k=`${Rt}[`,ji="\x07",_t={to(e,t){return t?`${k}${t+1};${e+1}H`:`${k}${e+1}G`},move(e,t){let u="";return e<0?u+=`${k}${-e}D`:e>0&&(u+=`${k}${e}C`),t<0?u+=`${k}${-t}A`:t>0&&(u+=`${k}${t}B`),u},up:(e=1)=>`${k}${e}A`,down:(e=1)=>`${k}${e}B`,forward:(e=1)=>`${k}${e}C`,backward:(e=1)=>`${k}${e}D`,nextLine:(e=1)=>`${k}E`.repeat(e),prevLine:(e=1)=>`${k}F`.repeat(e),left:`${k}G`,hide:`${k}?25l`,show:`${k}?25h`,save:`${Rt}7`,restore:`${Rt}8`},Ni={up:(e=1)=>`${k}S`.repeat(e),down:(e=1)=>`${k}T`.repeat(e)},Li={screen:`${k}2J`,up:(e=1)=>`${k}1J`.repeat(e),down:(e=1)=>`${k}J`.repeat(e),line:`${k}2K`,lineEnd:`${k}K`,lineStart:`${k}1K`,lines(e){let t="";for(let u=0;u<e;u++)t+=this.line+(u<e-1?_t.up():"");return e&&(t+=_t.left),t}};var J={cursor:_t,scroll:Ni,erase:Li,beep:ji},jt={exports:{}};let qe=process||{},wn=qe.argv||[],He=qe.env||{},Gi=!(He.NO_COLOR||wn.includes("--no-color"))&&(!!He.FORCE_COLOR||wn.includes("--color")||qe.platform==="win32"||(qe.stdout||{}).isTTY&&He.TERM!=="dumb"||!!He.CI),Wi=(e,t,u=e)=>n=>{let D=""+n,o=D.indexOf(t,e.length);return~o?e+zi(D,t,u,o)+t:e+D+t},zi=(e,t,u,n)=>{let D="",o=0;do D+=e.substring(o,n)+u,o=n+t.length,n=e.indexOf(t,o);while(~n);return D+e.substring(o)},Bn=(e=Gi)=>{let t=e?Wi:()=>String;return{isColorSupported:e,reset:t("\x1B[0m","\x1B[0m"),bold:t("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"),dim:t("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"),italic:t("\x1B[3m","\x1B[23m"),underline:t("\x1B[4m","\x1B[24m"),inverse:t("\x1B[7m","\x1B[27m"),hidden:t("\x1B[8m","\x1B[28m"),strikethrough:t("\x1B[9m","\x1B[29m"),black:t("\x1B[30m","\x1B[39m"),red:t("\x1B[31m","\x1B[39m"),green:t("\x1B[32m","\x1B[39m"),yellow:t("\x1B[33m","\x1B[39m"),blue:t("\x1B[34m","\x1B[39m"),magenta:t("\x1B[35m","\x1B[39m"),cyan:t("\x1B[36m","\x1B[39m"),white:t("\x1B[37m","\x1B[39m"),gray:t("\x1B[90m","\x1B[39m"),bgBlack:t("\x1B[40m","\x1B[49m"),bgRed:t("\x1B[41m","\x1B[49m"),bgGreen:t("\x1B[42m","\x1B[49m"),bgYellow:t("\x1B[43m","\x1B[49m"),bgBlue:t("\x1B[44m","\x1B[49m"),bgMagenta:t("\x1B[45m","\x1B[49m"),bgCyan:t("\x1B[46m","\x1B[49m"),bgWhite:t("\x1B[47m","\x1B[49m"),blackBright:t("\x1B[90m","\x1B[39m"),redBright:t("\x1B[91m","\x1B[39m"),greenBright:t("\x1B[92m","\x1B[39m"),yellowBright:t("\x1B[93m","\x1B[39m"),blueBright:t("\x1B[94m","\x1B[39m"),magentaBright:t("\x1B[95m","\x1B[39m"),cyanBright:t("\x1B[96m","\x1B[39m"),whiteBright:t("\x1B[97m","\x1B[39m"),bgBlackBright:t("\x1B[100m","\x1B[49m"),bgRedBright:t("\x1B[101m","\x1B[49m"),bgGreenBright:t("\x1B[102m","\x1B[49m"),bgYellowBright:t("\x1B[103m","\x1B[49m"),bgBlueBright:t("\x1B[104m","\x1B[49m"),bgMagentaBright:t("\x1B[105m","\x1B[49m"),bgCyanBright:t("\x1B[106m","\x1B[49m"),bgWhiteBright:t("\x1B[107m","\x1B[49m")}};jt.exports=Bn(),jt.exports.createColors=Bn;var Ui=jt.exports,y=se(Ui);function qi({onlyFirst:e=!1}={}){const t=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");return new RegExp(t,e?void 0:"g")}const Hi=qi();function vn(e){if(typeof e!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof e}\``);return e.replace(Hi,"")}function An(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var $n={exports:{}};(function(e){var t={};e.exports=t,t.eastAsianWidth=function(n){var D=n.charCodeAt(0),o=n.length==2?n.charCodeAt(1):0,r=D;return 55296<=D&&D<=56319&&56320<=o&&o<=57343&&(D&=1023,o&=1023,r=D<<10|o,r+=65536),r==12288||65281<=r&&r<=65376||65504<=r&&r<=65510?"F":r==8361||65377<=r&&r<=65470||65474<=r&&r<=65479||65482<=r&&r<=65487||65490<=r&&r<=65495||65498<=r&&r<=65500||65512<=r&&r<=65518?"H":4352<=r&&r<=4447||4515<=r&&r<=4519||4602<=r&&r<=4607||9001<=r&&r<=9002||11904<=r&&r<=11929||11931<=r&&r<=12019||12032<=r&&r<=12245||12272<=r&&r<=12283||12289<=r&&r<=12350||12353<=r&&r<=12438||12441<=r&&r<=12543||12549<=r&&r<=12589||12593<=r&&r<=12686||12688<=r&&r<=12730||12736<=r&&r<=12771||12784<=r&&r<=12830||12832<=r&&r<=12871||12880<=r&&r<=13054||13056<=r&&r<=19903||19968<=r&&r<=42124||42128<=r&&r<=42182||43360<=r&&r<=43388||44032<=r&&r<=55203||55216<=r&&r<=55238||55243<=r&&r<=55291||63744<=r&&r<=64255||65040<=r&&r<=65049||65072<=r&&r<=65106||65108<=r&&r<=65126||65128<=r&&r<=65131||110592<=r&&r<=110593||127488<=r&&r<=127490||127504<=r&&r<=127546||127552<=r&&r<=127560||127568<=r&&r<=127569||131072<=r&&r<=194367||177984<=r&&r<=196605||196608<=r&&r<=262141?"W":32<=r&&r<=126||162<=r&&r<=163||165<=r&&r<=166||r==172||r==175||10214<=r&&r<=10221||10629<=r&&r<=10630?"Na":r==161||r==164||167<=r&&r<=168||r==170||173<=r&&r<=174||176<=r&&r<=180||182<=r&&r<=186||188<=r&&r<=191||r==198||r==208||215<=r&&r<=216||222<=r&&r<=225||r==230||232<=r&&r<=234||236<=r&&r<=237||r==240||242<=r&&r<=243||247<=r&&r<=250||r==252||r==254||r==257||r==273||r==275||r==283||294<=r&&r<=295||r==299||305<=r&&r<=307||r==312||319<=r&&r<=322||r==324||328<=r&&r<=331||r==333||338<=r&&r<=339||358<=r&&r<=359||r==363||r==462||r==464||r==466||r==468||r==470||r==472||r==474||r==476||r==593||r==609||r==708||r==711||713<=r&&r<=715||r==717||r==720||728<=r&&r<=731||r==733||r==735||768<=r&&r<=879||913<=r&&r<=929||931<=r&&r<=937||945<=r&&r<=961||963<=r&&r<=969||r==1025||1040<=r&&r<=1103||r==1105||r==8208||8211<=r&&r<=8214||8216<=r&&r<=8217||8220<=r&&r<=8221||8224<=r&&r<=8226||8228<=r&&r<=8231||r==8240||8242<=r&&r<=8243||r==8245||r==8251||r==8254||r==8308||r==8319||8321<=r&&r<=8324||r==8364||r==8451||r==8453||r==8457||r==8467||r==8470||8481<=r&&r<=8482||r==8486||r==8491||8531<=r&&r<=8532||8539<=r&&r<=8542||8544<=r&&r<=8555||8560<=r&&r<=8569||r==8585||8592<=r&&r<=8601||8632<=r&&r<=8633||r==8658||r==8660||r==8679||r==8704||8706<=r&&r<=8707||8711<=r&&r<=8712||r==8715||r==8719||r==8721||r==8725||r==8730||8733<=r&&r<=8736||r==8739||r==8741||8743<=r&&r<=8748||r==8750||8756<=r&&r<=8759||8764<=r&&r<=8765||r==8776||r==8780||r==8786||8800<=r&&r<=8801||8804<=r&&r<=8807||8810<=r&&r<=8811||8814<=r&&r<=8815||8834<=r&&r<=8835||8838<=r&&r<=8839||r==8853||r==8857||r==8869||r==8895||r==8978||9312<=r&&r<=9449||9451<=r&&r<=9547||9552<=r&&r<=9587||9600<=r&&r<=9615||9618<=r&&r<=9621||9632<=r&&r<=9633||9635<=r&&r<=9641||9650<=r&&r<=9651||9654<=r&&r<=9655||9660<=r&&r<=9661||9664<=r&&r<=9665||9670<=r&&r<=9672||r==9675||9678<=r&&r<=9681||9698<=r&&r<=9701||r==9711||9733<=r&&r<=9734||r==9737||9742<=r&&r<=9743||9748<=r&&r<=9749||r==9756||r==9758||r==9792||r==9794||9824<=r&&r<=9825||9827<=r&&r<=9829||9831<=r&&r<=9834||9836<=r&&r<=9837||r==9839||9886<=r&&r<=9887||9918<=r&&r<=9919||9924<=r&&r<=9933||9935<=r&&r<=9953||r==9955||9960<=r&&r<=9983||r==10045||r==10071||10102<=r&&r<=10111||11093<=r&&r<=11097||12872<=r&&r<=12879||57344<=r&&r<=63743||65024<=r&&r<=65039||r==65533||127232<=r&&r<=127242||127248<=r&&r<=127277||127280<=r&&r<=127337||127344<=r&&r<=127386||917760<=r&&r<=917999||983040<=r&&r<=1048573||1048576<=r&&r<=1114109?"A":"N"},t.characterLength=function(n){var D=this.eastAsianWidth(n);return D=="F"||D=="W"||D=="A"?2:1};function u(n){return n.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g)||[]}t.length=function(n){for(var D=u(n),o=0,r=0;r<D.length;r++)o=o+this.characterLength(D[r]);return o},t.slice=function(n,D,o){textLen=t.length(n),D=D||0,o=o||1,D<0&&(D=textLen+D),o<0&&(o=textLen+o);for(var r="",i=0,s=u(n),c=0;c<s.length;c++){var f=s[c],l=t.length(f);if(i>=D-(l==2?1:0))if(i+l<=o)r+=f;else break;i+=l}return r}})($n);var Vi=$n.exports;const Ki=An(Vi);var Ji=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};const Yi=An(Ji);function be(e,t={}){if(typeof e!="string"||e.length===0||(t={ambiguousIsNarrow:!0,...t},e=vn(e),e.length===0))return 0;e=e.replace(Yi()," ");const u=t.ambiguousIsNarrow?1:2;let n=0;for(const D of e){const o=D.codePointAt(0);if(!(o<=31||o>=127&&o<=159||o>=768&&o<=879))switch(Ki.eastAsianWidth(D)){case"F":case"W":n+=2;break;case"A":n+=u;break;default:n+=1}}return n}const Nt=10,xn=(e=0)=>t=>`\x1B[${t+e}m`,Sn=(e=0)=>t=>`\x1B[${38+e};5;${t}m`,kn=(e=0)=>(t,u,n)=>`\x1B[${38+e};2;${t};${u};${n}m`,S={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};Object.keys(S.modifier);const Zi=Object.keys(S.color),Xi=Object.keys(S.bgColor);[...Zi,...Xi];function Qi(){const e=new Map;for(const[t,u]of Object.entries(S)){for(const[n,D]of Object.entries(u))S[n]={open:`\x1B[${D[0]}m`,close:`\x1B[${D[1]}m`},u[n]=S[n],e.set(D[0],D[1]);Object.defineProperty(S,t,{value:u,enumerable:!1})}return Object.defineProperty(S,"codes",{value:e,enumerable:!1}),S.color.close="\x1B[39m",S.bgColor.close="\x1B[49m",S.color.ansi=xn(),S.color.ansi256=Sn(),S.color.ansi16m=kn(),S.bgColor.ansi=xn(Nt),S.bgColor.ansi256=Sn(Nt),S.bgColor.ansi16m=kn(Nt),Object.defineProperties(S,{rgbToAnsi256:{value:(t,u,n)=>t===u&&u===n?t<8?16:t>248?231:Math.round((t-8)/247*24)+232:16+36*Math.round(t/255*5)+6*Math.round(u/255*5)+Math.round(n/255*5),enumerable:!1},hexToRgb:{value:t=>{const u=/[a-f\d]{6}|[a-f\d]{3}/i.exec(t.toString(16));if(!u)return[0,0,0];let[n]=u;n.length===3&&(n=[...n].map(o=>o+o).join(""));const D=Number.parseInt(n,16);return[D>>16&255,D>>8&255,D&255]},enumerable:!1},hexToAnsi256:{value:t=>S.rgbToAnsi256(...S.hexToRgb(t)),enumerable:!1},ansi256ToAnsi:{value:t=>{if(t<8)return 30+t;if(t<16)return 90+(t-8);let u,n,D;if(t>=232)u=((t-232)*10+8)/255,n=u,D=u;else{t-=16;const i=t%36;u=Math.floor(t/36)/5,n=Math.floor(i/6)/5,D=i%6/5}const o=Math.max(u,n,D)*2;if(o===0)return 30;let r=30+(Math.round(D)<<2|Math.round(n)<<1|Math.round(u));return o===2&&(r+=60),r},enumerable:!1},rgbToAnsi:{value:(t,u,n)=>S.ansi256ToAnsi(S.rgbToAnsi256(t,u,n)),enumerable:!1},hexToAnsi:{value:t=>S.ansi256ToAnsi(S.hexToAnsi256(t)),enumerable:!1}}),S}const ea=Qi(),Ve=new Set(["\x1B","\x9B"]),ta=39,Lt="\x07",Mn="[",ua="]",In="m",Gt=`${ua}8;;`,On=e=>`${Ve.values().next().value}${Mn}${e}${In}`,Tn=e=>`${Ve.values().next().value}${Gt}${e}${Lt}`,na=e=>e.split(" ").map(t=>be(t)),Wt=(e,t,u)=>{const n=[...t];let D=!1,o=!1,r=be(vn(e[e.length-1]));for(const[i,s]of n.entries()){const c=be(s);if(r+c<=u?e[e.length-1]+=s:(e.push(s),r=0),Ve.has(s)&&(D=!0,o=n.slice(i+1).join("").startsWith(Gt)),D){o?s===Lt&&(D=!1,o=!1):s===In&&(D=!1);continue}r+=c,r===u&&i<n.length-1&&(e.push(""),r=0)}!r&&e[e.length-1].length>0&&e.length>1&&(e[e.length-2]+=e.pop())},ra=e=>{const t=e.split(" ");let u=t.length;for(;u>0&&!(be(t[u-1])>0);)u--;return u===t.length?e:t.slice(0,u).join(" ")+t.slice(u).join("")},Da=(e,t,u={})=>{if(u.trim!==!1&&e.trim()==="")return"";let n="",D,o;const r=na(e);let i=[""];for(const[c,f]of e.split(" ").entries()){u.trim!==!1&&(i[i.length-1]=i[i.length-1].trimStart());let l=be(i[i.length-1]);if(c!==0&&(l>=t&&(u.wordWrap===!1||u.trim===!1)&&(i.push(""),l=0),(l>0||u.trim===!1)&&(i[i.length-1]+=" ",l++)),u.hard&&r[c]>t){const a=t-l,d=1+Math.floor((r[c]-a-1)/t);Math.floor((r[c]-1)/t)<d&&i.push(""),Wt(i,f,t);continue}if(l+r[c]>t&&l>0&&r[c]>0){if(u.wordWrap===!1&&l<t){Wt(i,f,t);continue}i.push("")}if(l+r[c]>t&&u.wordWrap===!1){Wt(i,f,t);continue}i[i.length-1]+=f}u.trim!==!1&&(i=i.map(c=>ra(c)));const s=[...i.join(`
29
+ `)];for(const[c,f]of s.entries()){if(n+=f,Ve.has(f)){const{groups:a}=new RegExp(`(?:\\${Mn}(?<code>\\d+)m|\\${Gt}(?<uri>.*)${Lt})`).exec(s.slice(c).join(""))||{groups:{}};if(a.code!==void 0){const d=Number.parseFloat(a.code);D=d===ta?void 0:d}else a.uri!==void 0&&(o=a.uri.length===0?void 0:a.uri)}const l=ea.codes.get(Number(D));s[c+1]===`
30
+ `?(o&&(n+=Tn("")),D&&l&&(n+=On(l))):f===`
31
+ `&&(D&&l&&(n+=On(D)),o&&(n+=Tn(o)))}return n};function Pn(e,t,u){return String(e).normalize().replace(/\r\n/g,`
32
32
  `).split(`
33
- `).map(n=>ra(n,t,u)).join(`
34
- `)}var Da=Object.defineProperty,oa=(e,t,u)=>t in e?Da(e,t,{enumerable:!0,configurable:!0,writable:!0,value:u}):e[t]=u,z=(e,t,u)=>(oa(e,typeof t!="symbol"?t+"":t,u),u);function sa(e,t){if(e===t)return;const u=e.split(`
33
+ `).map(n=>Da(n,t,u)).join(`
34
+ `)}var oa=Object.defineProperty,sa=(e,t,u)=>t in e?oa(e,t,{enumerable:!0,configurable:!0,writable:!0,value:u}):e[t]=u,W=(e,t,u)=>(sa(e,typeof t!="symbol"?t+"":t,u),u);function ia(e,t){if(e===t)return;const u=e.split(`
35
35
  `),n=t.split(`
36
- `),D=[];for(let o=0;o<Math.max(u.length,n.length);o++)u[o]!==n[o]&&D.push(o);return D}const Pn=Symbol("clack:cancel");function ia(e){return e===Pn}function Je(e,t){e.isTTY&&e.setRawMode(t)}const Rn=new Map([["k","up"],["j","down"],["h","left"],["l","right"]]),aa=new Set(["up","down","left","right","space","enter"]);class _n{constructor({render:t,input:u=Vr,output:n=Kr,...D},o=!0){z(this,"input"),z(this,"output"),z(this,"rl"),z(this,"opts"),z(this,"_track",!1),z(this,"_render"),z(this,"_cursor",0),z(this,"state","initial"),z(this,"value"),z(this,"error",""),z(this,"subscribers",new Map),z(this,"_prevFrame",""),this.opts=D,this.onKeypress=this.onKeypress.bind(this),this.close=this.close.bind(this),this.render=this.render.bind(this),this._render=t.bind(this),this._track=o,this.input=u,this.output=n}prompt(){const t=new tD(0);return t._write=(u,n,D)=>{this._track&&(this.value=this.rl.line.replace(/\t/g,""),this._cursor=this.rl.cursor,this.emit("value",this.value)),D()},this.input.pipe(t),this.rl=yu.createInterface({input:this.input,output:t,tabSize:2,prompt:"",escapeCodeTimeout:50}),yu.emitKeypressEvents(this.input,this.rl),this.rl.prompt(),this.opts.initialValue!==void 0&&this._track&&this.rl.write(this.opts.initialValue),this.input.on("keypress",this.onKeypress),Je(this.input,!0),this.output.on("resize",this.render),this.render(),new Promise((u,n)=>{this.once("submit",()=>{this.output.write(K.cursor.show),this.output.off("resize",this.render),Je(this.input,!1),u(this.value)}),this.once("cancel",()=>{this.output.write(K.cursor.show),this.output.off("resize",this.render),Je(this.input,!1),u(Pn)})})}on(t,u){const n=this.subscribers.get(t)??[];n.push({cb:u}),this.subscribers.set(t,n)}once(t,u){const n=this.subscribers.get(t)??[];n.push({cb:u,once:!0}),this.subscribers.set(t,n)}emit(t,...u){const n=this.subscribers.get(t)??[],D=[];for(const o of n)o.cb(...u),o.once&&D.push(()=>n.splice(n.indexOf(o),1));for(const o of D)o()}unsubscribe(){this.subscribers.clear()}onKeypress(t,u){if(this.state==="error"&&(this.state="active"),u?.name&&!this._track&&Rn.has(u.name)&&this.emit("cursor",Rn.get(u.name)),u?.name&&aa.has(u.name)&&this.emit("cursor",u.name),t&&(t.toLowerCase()==="y"||t.toLowerCase()==="n")&&this.emit("confirm",t.toLowerCase()==="y"),t===" "&&this.opts.placeholder&&(this.value||(this.rl.write(this.opts.placeholder),this.emit("value",this.opts.placeholder))),t&&this.emit("key",t.toLowerCase()),u?.name==="return"){if(this.opts.validate){const n=this.opts.validate(this.value);n&&(this.error=n,this.state="error",this.rl.write(this.value))}this.state!=="error"&&(this.state="submit")}t===""&&(this.state="cancel"),(this.state==="submit"||this.state==="cancel")&&this.emit("finalize"),this.render(),(this.state==="submit"||this.state==="cancel")&&this.close()}close(){this.input.unpipe(),this.input.removeListener("keypress",this.onKeypress),this.output.write(`
37
- `),Je(this.input,!1),this.rl.close(),this.emit(`${this.state}`,this.value),this.unsubscribe()}restoreCursor(){const t=Tn(this._prevFrame,process.stdout.columns,{hard:!0}).split(`
38
- `).length-1;this.output.write(K.cursor.move(-999,t*-1))}render(){const t=Tn(this._render(this)??"",process.stdout.columns,{hard:!0});if(t!==this._prevFrame){if(this.state==="initial")this.output.write(K.cursor.hide);else{const u=sa(this._prevFrame,t);if(this.restoreCursor(),u&&u?.length===1){const n=u[0];this.output.write(K.cursor.move(0,n)),this.output.write(K.erase.lines(1));const D=t.split(`
39
- `);this.output.write(D[n]),this._prevFrame=t,this.output.write(K.cursor.move(0,D.length-n-1));return}else if(u&&u?.length>1){const n=u[0];this.output.write(K.cursor.move(0,n)),this.output.write(K.erase.down());const D=t.split(`
36
+ `),D=[];for(let o=0;o<Math.max(u.length,n.length);o++)u[o]!==n[o]&&D.push(o);return D}const Rn=Symbol("clack:cancel");function aa(e){return e===Rn}function Ke(e,t){e.isTTY&&e.setRawMode(t)}const _n=new Map([["k","up"],["j","down"],["h","left"],["l","right"]]),ca=new Set(["up","down","left","right","space","enter"]);class jn{constructor({render:t,input:u=Kr,output:n=Jr,...D},o=!0){W(this,"input"),W(this,"output"),W(this,"rl"),W(this,"opts"),W(this,"_track",!1),W(this,"_render"),W(this,"_cursor",0),W(this,"state","initial"),W(this,"value"),W(this,"error",""),W(this,"subscribers",new Map),W(this,"_prevFrame",""),this.opts=D,this.onKeypress=this.onKeypress.bind(this),this.close=this.close.bind(this),this.render=this.render.bind(this),this._render=t.bind(this),this._track=o,this.input=u,this.output=n}prompt(){const t=new uD(0);return t._write=(u,n,D)=>{this._track&&(this.value=this.rl.line.replace(/\t/g,""),this._cursor=this.rl.cursor,this.emit("value",this.value)),D()},this.input.pipe(t),this.rl=bu.createInterface({input:this.input,output:t,tabSize:2,prompt:"",escapeCodeTimeout:50}),bu.emitKeypressEvents(this.input,this.rl),this.rl.prompt(),this.opts.initialValue!==void 0&&this._track&&this.rl.write(this.opts.initialValue),this.input.on("keypress",this.onKeypress),Ke(this.input,!0),this.output.on("resize",this.render),this.render(),new Promise((u,n)=>{this.once("submit",()=>{this.output.write(J.cursor.show),this.output.off("resize",this.render),Ke(this.input,!1),u(this.value)}),this.once("cancel",()=>{this.output.write(J.cursor.show),this.output.off("resize",this.render),Ke(this.input,!1),u(Rn)})})}on(t,u){const n=this.subscribers.get(t)??[];n.push({cb:u}),this.subscribers.set(t,n)}once(t,u){const n=this.subscribers.get(t)??[];n.push({cb:u,once:!0}),this.subscribers.set(t,n)}emit(t,...u){const n=this.subscribers.get(t)??[],D=[];for(const o of n)o.cb(...u),o.once&&D.push(()=>n.splice(n.indexOf(o),1));for(const o of D)o()}unsubscribe(){this.subscribers.clear()}onKeypress(t,u){if(this.state==="error"&&(this.state="active"),u?.name&&!this._track&&_n.has(u.name)&&this.emit("cursor",_n.get(u.name)),u?.name&&ca.has(u.name)&&this.emit("cursor",u.name),t&&(t.toLowerCase()==="y"||t.toLowerCase()==="n")&&this.emit("confirm",t.toLowerCase()==="y"),t===" "&&this.opts.placeholder&&(this.value||(this.rl.write(this.opts.placeholder),this.emit("value",this.opts.placeholder))),t&&this.emit("key",t.toLowerCase()),u?.name==="return"){if(this.opts.validate){const n=this.opts.validate(this.value);n&&(this.error=n,this.state="error",this.rl.write(this.value))}this.state!=="error"&&(this.state="submit")}t===""&&(this.state="cancel"),(this.state==="submit"||this.state==="cancel")&&this.emit("finalize"),this.render(),(this.state==="submit"||this.state==="cancel")&&this.close()}close(){this.input.unpipe(),this.input.removeListener("keypress",this.onKeypress),this.output.write(`
37
+ `),Ke(this.input,!1),this.rl.close(),this.emit(`${this.state}`,this.value),this.unsubscribe()}restoreCursor(){const t=Pn(this._prevFrame,process.stdout.columns,{hard:!0}).split(`
38
+ `).length-1;this.output.write(J.cursor.move(-999,t*-1))}render(){const t=Pn(this._render(this)??"",process.stdout.columns,{hard:!0});if(t!==this._prevFrame){if(this.state==="initial")this.output.write(J.cursor.hide);else{const u=ia(this._prevFrame,t);if(this.restoreCursor(),u&&u?.length===1){const n=u[0];this.output.write(J.cursor.move(0,n)),this.output.write(J.erase.lines(1));const D=t.split(`
39
+ `);this.output.write(D[n]),this._prevFrame=t,this.output.write(J.cursor.move(0,D.length-n-1));return}else if(u&&u?.length>1){const n=u[0];this.output.write(J.cursor.move(0,n)),this.output.write(J.erase.down());const D=t.split(`
40
40
  `).slice(n);this.output.write(D.join(`
41
- `)),this._prevFrame=t;return}this.output.write(K.erase.down())}this.output.write(t),this.state==="initial"&&(this.state="active"),this._prevFrame=t}}}var ca=Object.defineProperty,la=(e,t,u)=>t in e?ca(e,t,{enumerable:!0,configurable:!0,writable:!0,value:u}):e[t]=u,jn=(e,t,u)=>(la(e,typeof t!="symbol"?t+"":t,u),u);let fa=class extends _n{constructor(e){super(e,!1),jn(this,"options"),jn(this,"cursor",0),this.options=e.options,this.cursor=this.options.findIndex(({value:t})=>t===e.initialValue),this.cursor===-1&&(this.cursor=0),this.changeValue(),this.on("cursor",t=>{switch(t){case"left":case"up":this.cursor=this.cursor===0?this.options.length-1:this.cursor-1;break;case"down":case"right":this.cursor=this.cursor===this.options.length-1?0:this.cursor+1;break}this.changeValue()})}get _value(){return this.options[this.cursor]}changeValue(){this.value=this._value.value}};var da=Object.defineProperty,Fa=(e,t,u)=>t in e?da(e,t,{enumerable:!0,configurable:!0,writable:!0,value:u}):e[t]=u,pa=(e,t,u)=>(Fa(e,typeof t!="symbol"?t+"":t,u),u);class Ca extends _n{constructor(t){super(t),pa(this,"valueWithCursor",""),this.on("finalize",()=>{this.value||(this.value=t.defaultValue),this.valueWithCursor=this.value}),this.on("value",()=>{if(this.cursor>=this.value.length)this.valueWithCursor=`${this.value}${E.inverse(E.hidden("_"))}`;else{const u=this.value.slice(0,this.cursor),n=this.value.slice(this.cursor);this.valueWithCursor=`${u}${E.inverse(n[0])}${n.slice(1)}`}})}get cursor(){return this._cursor}}globalThis.process.platform.startsWith("win");function ma(){return T.platform!=="win32"?T.env.TERM!=="linux":!!T.env.CI||!!T.env.WT_SESSION||!!T.env.TERMINUS_SUBLIME||T.env.ConEmuTask==="{cmd::Cmder}"||T.env.TERM_PROGRAM==="Terminus-Sublime"||T.env.TERM_PROGRAM==="vscode"||T.env.TERM==="xterm-256color"||T.env.TERM==="alacritty"||T.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}const ha=ma(),Z=(e,t)=>ha?e:t,ga=Z("\u25C6","*"),Ea=Z("\u25A0","x"),ya=Z("\u25B2","x"),ba=Z("\u25C7","o"),wa=Z("\u250C","T"),W=Z("\u2502","|"),Ye=Z("\u2514","\u2014"),Ba=Z("\u25CF",">"),va=Z("\u25CB"," "),Nn=e=>{switch(e){case"initial":case"active":return E.cyan(ga);case"cancel":return E.red(Ea);case"error":return E.yellow(ya);case"submit":return E.green(ba)}},Aa=e=>new Ca({validate:e.validate,placeholder:e.placeholder,defaultValue:e.defaultValue,initialValue:e.initialValue,render(){const t=`${E.gray(W)}
42
- ${Nn(this.state)} ${e.message}
43
- `,u=e.placeholder?E.inverse(e.placeholder[0])+E.dim(e.placeholder.slice(1)):E.inverse(E.hidden("_")),n=this.value?this.valueWithCursor:u;switch(this.state){case"error":return`${t.trim()}
44
- ${E.yellow(W)} ${n}
45
- ${E.yellow(Ye)} ${E.yellow(this.error)}
46
- `;case"submit":return`${t}${E.gray(W)} ${E.dim(this.value||e.placeholder)}`;case"cancel":return`${t}${E.gray(W)} ${E.strikethrough(E.dim(this.value??""))}${this.value?.trim()?`
47
- `+E.gray(W):""}`;default:return`${t}${E.cyan(W)} ${n}
48
- ${E.cyan(Ye)}
49
- `}}}).prompt(),$a=e=>{const t=(u,n)=>{const D=u.label??String(u.value);return n==="active"?`${E.green(Ba)} ${D} ${u.hint?E.dim(`(${u.hint})`):""}`:n==="selected"?`${E.dim(D)}`:n==="cancelled"?`${E.strikethrough(E.dim(D))}`:`${E.dim(va)} ${E.dim(D)}`};return new fa({options:e.options,initialValue:e.initialValue,render(){const u=`${E.gray(W)}
50
- ${Nn(this.state)} ${e.message}
51
- `;switch(this.state){case"submit":return`${u}${E.gray(W)} ${t(this.options[this.cursor],"selected")}`;case"cancel":return`${u}${E.gray(W)} ${t(this.options[this.cursor],"cancelled")}
52
- ${E.gray(W)}`;default:return`${u}${E.cyan(W)} ${this.options.map((n,D)=>t(n,D===this.cursor?"active":"inactive")).join(`
53
- ${E.cyan(W)} `)}
54
- ${E.cyan(Ye)}
55
- `}}}).prompt()},xa=(e="")=>{process.stdout.write(`${E.gray(wa)} ${e}
56
- `)},Wt=(e="")=>{process.stdout.write(`${E.gray(W)}
57
- ${E.gray(Ye)} ${e}
58
-
59
- `)},Ln=e=>$o,Sa=Ln();class h extends Error{}const zt=" ",ka="https://github.com/sugarmo/aicommits/issues/new/choose",Ma=e=>e.trim().replace(/^github:/,"").replace(/^git\+/,"").replace(/\.git$/,""),Gn=e=>{if(typeof e=="string"){const t=Ma(e);if(/^[^/\s]+\/[^/\s]+$/.test(t))return t;const u=t.match(/^git@github\.com:([^/\s]+\/[^/\s]+)$/);if(u?.[1])return u[1];const n=t.match(/^https?:\/\/github\.com\/([^/\s]+\/[^/\s]+)$/);if(n?.[1])return n[1]}if(e&&typeof e=="object"&&"url"in e)return Gn(e.url)},Ia=(()=>{const e=Gn(So);return e?`https://github.com/${e}/issues/new/choose`:ka})(),Ut=e=>{e instanceof Error&&!(e instanceof h)&&(e.stack&&console.error(Ue(e.stack.split(`
41
+ `)),this._prevFrame=t;return}this.output.write(J.erase.down())}this.output.write(t),this.state==="initial"&&(this.state="active"),this._prevFrame=t}}}var la=Object.defineProperty,fa=(e,t,u)=>t in e?la(e,t,{enumerable:!0,configurable:!0,writable:!0,value:u}):e[t]=u,Nn=(e,t,u)=>(fa(e,typeof t!="symbol"?t+"":t,u),u);let da=class extends jn{constructor(e){super(e,!1),Nn(this,"options"),Nn(this,"cursor",0),this.options=e.options,this.cursor=this.options.findIndex(({value:t})=>t===e.initialValue),this.cursor===-1&&(this.cursor=0),this.changeValue(),this.on("cursor",t=>{switch(t){case"left":case"up":this.cursor=this.cursor===0?this.options.length-1:this.cursor-1;break;case"down":case"right":this.cursor=this.cursor===this.options.length-1?0:this.cursor+1;break}this.changeValue()})}get _value(){return this.options[this.cursor]}changeValue(){this.value=this._value.value}};var Fa=Object.defineProperty,pa=(e,t,u)=>t in e?Fa(e,t,{enumerable:!0,configurable:!0,writable:!0,value:u}):e[t]=u,Ca=(e,t,u)=>(pa(e,typeof t!="symbol"?t+"":t,u),u);class ma extends jn{constructor(t){super(t),Ca(this,"valueWithCursor",""),this.on("finalize",()=>{this.value||(this.value=t.defaultValue),this.valueWithCursor=this.value}),this.on("value",()=>{if(this.cursor>=this.value.length)this.valueWithCursor=`${this.value}${y.inverse(y.hidden("_"))}`;else{const u=this.value.slice(0,this.cursor),n=this.value.slice(this.cursor);this.valueWithCursor=`${u}${y.inverse(n[0])}${n.slice(1)}`}})}get cursor(){return this._cursor}}globalThis.process.platform.startsWith("win");function ha(){return T.platform!=="win32"?T.env.TERM!=="linux":!!T.env.CI||!!T.env.WT_SESSION||!!T.env.TERMINUS_SUBLIME||T.env.ConEmuTask==="{cmd::Cmder}"||T.env.TERM_PROGRAM==="Terminus-Sublime"||T.env.TERM_PROGRAM==="vscode"||T.env.TERM==="xterm-256color"||T.env.TERM==="alacritty"||T.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}const ga=ha(),X=(e,t)=>ga?e:t,Ea=X("\u25C6","*"),ya=X("\u25A0","x"),ba=X("\u25B2","x"),wa=X("\u25C7","o"),Ba=X("\u250C","T"),G=X("\u2502","|"),Je=X("\u2514","\u2014"),va=X("\u25CF",">"),Aa=X("\u25CB"," "),Ln=e=>{switch(e){case"initial":case"active":return y.cyan(Ea);case"cancel":return y.red(ya);case"error":return y.yellow(ba);case"submit":return y.green(wa)}},$a=e=>new ma({validate:e.validate,placeholder:e.placeholder,defaultValue:e.defaultValue,initialValue:e.initialValue,render(){const t=`${y.gray(G)}
42
+ ${Ln(this.state)} ${e.message}
43
+ `,u=e.placeholder?y.inverse(e.placeholder[0])+y.dim(e.placeholder.slice(1)):y.inverse(y.hidden("_")),n=this.value?this.valueWithCursor:u;switch(this.state){case"error":return`${t.trim()}
44
+ ${y.yellow(G)} ${n}
45
+ ${y.yellow(Je)} ${y.yellow(this.error)}
46
+ `;case"submit":return`${t}${y.gray(G)} ${y.dim(this.value||e.placeholder)}`;case"cancel":return`${t}${y.gray(G)} ${y.strikethrough(y.dim(this.value??""))}${this.value?.trim()?`
47
+ `+y.gray(G):""}`;default:return`${t}${y.cyan(G)} ${n}
48
+ ${y.cyan(Je)}
49
+ `}}}).prompt(),xa=e=>{const t=(u,n)=>{const D=u.label??String(u.value);return n==="active"?`${y.green(va)} ${D} ${u.hint?y.dim(`(${u.hint})`):""}`:n==="selected"?`${y.dim(D)}`:n==="cancelled"?`${y.strikethrough(y.dim(D))}`:`${y.dim(Aa)} ${y.dim(D)}`};return new da({options:e.options,initialValue:e.initialValue,render(){const u=`${y.gray(G)}
50
+ ${Ln(this.state)} ${e.message}
51
+ `;switch(this.state){case"submit":return`${u}${y.gray(G)} ${t(this.options[this.cursor],"selected")}`;case"cancel":return`${u}${y.gray(G)} ${t(this.options[this.cursor],"cancelled")}
52
+ ${y.gray(G)}`;default:return`${u}${y.cyan(G)} ${this.options.map((n,D)=>t(n,D===this.cursor?"active":"inactive")).join(`
53
+ ${y.cyan(G)} `)}
54
+ ${y.cyan(Je)}
55
+ `}}}).prompt()},Sa=(e="")=>{process.stdout.write(`${y.gray(Ba)} ${e}
56
+ `)},Ye=(e="")=>{process.stdout.write(`${y.gray(G)}
57
+ ${y.gray(Je)} ${e}
58
+
59
+ `)},Gn=e=>xo,ka=Gn();class m extends Error{}const zt=" ",Ma="https://github.com/sugarmo/aicommits/issues/new/choose",Ia=e=>e.trim().replace(/^github:/,"").replace(/^git\+/,"").replace(/\.git$/,""),Wn=e=>{if(typeof e=="string"){const t=Ia(e);if(/^[^/\s]+\/[^/\s]+$/.test(t))return t;const u=t.match(/^git@github\.com:([^/\s]+\/[^/\s]+)$/);if(u?.[1])return u[1];const n=t.match(/^https?:\/\/github\.com\/([^/\s]+\/[^/\s]+)$/);if(n?.[1])return n[1]}if(e&&typeof e=="object"&&"url"in e)return Wn(e.url)},Oa=(()=>{const e=Wn(ko);return e?`https://github.com/${e}/issues/new/choose`:Ma})(),Ut=e=>{e instanceof Error&&!(e instanceof m)&&(e.stack&&console.error(Ue(e.stack.split(`
60
60
  `).slice(1).join(`
61
61
  `))),console.error(`
62
- ${zt}${Ue(`aicommits v${Sa}`)}`),console.error(`
63
- ${zt}Please open a Bug report with the information above:`),console.error(`${zt}${Ia}`))},Wn=async(e,t)=>{const{stdout:u,failed:n}=await q("git",["rev-parse",...e],{reject:!1,cwd:t});if(n)throw new h("The current directory must be a Git repository!");return u.trim()},zn=async()=>Wn(["--show-toplevel"]),Oa=async(e,t)=>{const u=t||process.cwd(),n=await Wn(["--git-path",e],u);return N.isAbsolute(n)?n:N.resolve(u,n)},Un=e=>`:(exclude)${e}`,Ta=["package-lock.json","pnpm-lock.yaml","*.lock"].map(Un),qn=e=>e.split(`
64
- `).filter(Boolean),Hn=e=>[...Ta,...e?e.map(Un):[]],Vn=async(e,t,u)=>{const n=Hn(t),{stdout:D}=await q("git",[...e,"--name-only",...n],{cwd:u});if(!D)return;const{stdout:o}=await q("git",[...e,...n],{cwd:u});return{files:qn(D),diff:o}},Pa=async(e,t)=>{const{stdout:u}=await q("git",["ls-files","--others","--exclude-standard","--",".",...Hn(e)],{cwd:t});return u?qn(u):[]},Ra=async(e,t)=>{if(e.length===0)return"";const u=[];for(const n of e){const{stdout:D}=await q("git",["diff","--no-index","--diff-algorithm=minimal","--","/dev/null",n],{reject:!1,cwd:t});D&&u.push(D)}return u.join(`
62
+ ${zt}${Ue(`aicommits v${ka}`)}`),console.error(`
63
+ ${zt}Please open a Bug report with the information above:`),console.error(`${zt}${Oa}`))},zn=async(e,t)=>{const{stdout:u,failed:n}=await U("git",["rev-parse",...e],{reject:!1,cwd:t});if(n)throw new m("The current directory must be a Git repository!");return u.trim()},Un=async()=>zn(["--show-toplevel"]),Ta=async(e,t)=>{const u=t||process.cwd(),n=await zn(["--git-path",e],u);return N.isAbsolute(n)?n:N.resolve(u,n)},qn=e=>`:(exclude)${e}`,Pa=["package-lock.json","pnpm-lock.yaml","*.lock"].map(qn),Hn=e=>e.split(`
64
+ `).filter(Boolean),Vn=e=>[...Pa,...e?e.map(qn):[]],Kn=async(e,t,u)=>{const n=Vn(t),{stdout:D}=await U("git",[...e,"--name-only",...n],{cwd:u});if(!D)return;const{stdout:o}=await U("git",[...e,...n],{cwd:u});return{files:Hn(D),diff:o}},Ra=async(e,t)=>{const{stdout:u}=await U("git",["ls-files","--others","--exclude-standard","--",".",...Vn(e)],{cwd:t});return u?Hn(u):[]},_a=async(e,t)=>{if(e.length===0)return"";const u=[];for(const n of e){const{stdout:D}=await U("git",["diff","--no-index","--diff-algorithm=minimal","--","/dev/null",n],{reject:!1,cwd:t});D&&u.push(D)}return u.join(`
65
65
 
66
- `)},_a=async e=>{const{stdout:t}=await q("git",["diff","--cached","--name-only"],{cwd:e});return t.trim().length>0},Kn=async(e,t)=>{const n=await Vn(["diff","--cached","--diff-algorithm=minimal"],e,t);if(n)return{...n,source:"staged"}},ja=async(e,t)=>{const n=await Vn(["diff","--diff-algorithm=minimal"],e,t),D=await Pa(e,t);if(!n&&D.length===0)return;const o=await Ra(D,t),r=Array.from(new Set([...n?.files??[],...D])),i=[n?.diff,o].filter(Boolean).join(`
66
+ `)},ja=async e=>{const{stdout:t}=await U("git",["diff","--cached","--name-only"],{cwd:e});return t.trim().length>0},Jn=async(e,t)=>{const n=await Kn(["diff","--cached","--diff-algorithm=minimal"],e,t);if(n)return{...n,source:"staged"}},Na=async(e,t)=>{const n=await Kn(["diff","--diff-algorithm=minimal"],e,t),D=await Ra(e,t);if(!n&&D.length===0)return;const o=await _a(D,t),r=Array.from(new Set([...n?.files??[],...D])),i=[n?.diff,o].filter(Boolean).join(`
67
67
 
68
- `);return{files:r,diff:i,source:"uncommitted"}},Na=async(e,t)=>{const u=await Kn(e,t);if(u)return u;if(!await _a(t))return ja(e,t)},La=(e,t="staged")=>`Detected ${e.length.toLocaleString()} ${t} file${e.length>1?"s":""}`,Jn="message.md",Yn=["# Commit Message Instructions","","## Language","- Write the commit message in English.","","## Format","- Output a plain git commit title, not a conventional commit prefix.","- Return only a single title line with no body.","- Use concise imperative wording.","","## Focus","- Lead with the dominant user-facing, product-facing, or operational outcome.","- Prefer the end result over the implementation mechanism.","- Describe what the change enables, fixes, prevents, or improves.","- Mention a concrete file, module, class, or subsystem only when it helps disambiguate the change.","","## Constraints","- Keep the title around 50 characters when practical.",'- Avoid vague subjects like "update", "improve", "refactor", or "cleanup" unless the diff is genuinely dominated by maintenance work.'].join(`
69
- `),Ze=(e,t,u="")=>{const n=t?.trim()||u.trim();return n?N.isAbsolute(n)?n:N.join(e,n):""},Ga=async e=>{await A.mkdir(N.dirname(e),{recursive:!0})},Wa=async(e,t)=>{let u;try{u=await A.lstat(e)}catch(n){throw n.code==="ENOENT"?new h(`${t} was not created: ${e}`):n}if(!u.isFile())throw new h(`${t} must point to a file: ${e}`)},za=async(e,t)=>{try{if(!(await A.lstat(e)).isFile())throw new h(`Message Markdown file must point to a file: ${e}`);return}catch(u){if(u.code!=="ENOENT")throw u}await Ga(e),await A.writeFile(e,`${t.trimEnd()}
70
- `,"utf8"),await Wa(e,"Message Markdown file")},Zn=async(e,t)=>{const u=Ze(e,t,Jn);await za(u,Yn);const n=await A.readFile(u,"utf8");return{messageFilePath:u,messageInstructionsMarkdown:n}},qt=(e,t)=>Ze(e,t)||void 0,Ua=async({configDirectoryPath:e,messagePathValue:t,postResponseScriptValue:u,suppressErrors:n=!1})=>{if(n)try{return{...await Zn(e,t),postResponseScriptPath:qt(e,u)}}catch{return{messageFilePath:Ze(e,t,Jn),messageInstructionsMarkdown:Yn,postResponseScriptPath:qt(e,u)}}return{...await Zn(e,t),postResponseScriptPath:qt(e,u)}},Ht=e=>`Flag "${e}" has been removed. Move commit message instructions into ~/.aicommits/message.md or point --message-file at another Markdown file.`,qa={cn:"zh-CN","zh-cn":"zh-CN","zh-hans":"zh-CN",zh:"zh-CN","zh-tw":"zh-TW","zh-hant":"zh-TW"},Ha="message.md",Vt=["locale","type","details","details-style","instructions","conventional-format","conventional-types","conventional-scope","title-length-guide","detail-column-guide"],Xn={"title-length-guide":["max-length"]},Va=new Set([...Vt,"max-length"]),U=(e,t,u)=>{if(!t)throw new h(`Invalid config property ${e}: ${u}`)},Kt=e=>typeof e=="string"||typeof e=="number"||typeof e=="boolean"?e:void 0,Qn=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),er=(e,t,u)=>{if(t==null||t==="")return u;if(typeof t=="boolean")return t;if(typeof t=="number"){if(t===1)return!0;if(t===0)return!1}if(typeof t=="string"){const n=t.trim().toLowerCase();if(["true","1","yes","on"].includes(n))return!0;if(["false","0","no","off"].includes(n))return!1}throw new h(`Invalid config property ${e}: Must be a boolean (true/false)`)},Ka=e=>{const t=e.trim().replace(/_/g,"-");return qa[t.toLowerCase()]??t},Ja=e=>e?(U("type",typeof e=="string","Must be a string"),U("type",["","conventional"].includes(e),"Invalid commit type"),e):"",Ya=e=>{if(e==null||e==="")return"paragraph";if(typeof e!="string")throw new h("Invalid config property details-style: Must be a string");const t=e.trim().toLowerCase();return U("details-style",["paragraph","list","markdown"].includes(t),"Must be one of: paragraph, list, markdown"),t},Za=e=>{if(e==null)return"";if(typeof e!="string")throw new h("Invalid config property instructions: Must be a string");return e.trim()},Xa=e=>{if(e==null)return"";if(typeof e!="string")throw new h("Invalid config property conventional-format: Must be a string");return e.trim()},Qa=e=>{if(!e)return"";if(typeof e!="string")throw new h("Invalid config property conventional-types: Must be valid JSON");let t;try{t=JSON.parse(e)}catch{throw new h("Invalid config property conventional-types: Must be valid JSON")}U("conventional-types",typeof t=="object"&&t!==null&&!Array.isArray(t),'Must be a JSON object with "type":"description" pairs');const u=Object.entries(t).map(([n,D])=>[n.trim(),String(D).trim()]).filter(([n,D])=>n.length>0&&D.length>0);return U("conventional-types",u.length>0,"Must contain at least one type"),JSON.stringify(Object.fromEntries(u))},ec=e=>{if(!e)return 50;U("title-length-guide",typeof e=="string"||typeof e=="number","Must be an integer");const t=Number(e);return U("title-length-guide",Number.isInteger(t),"Must be an integer"),U("title-length-guide",t>=20,"Must be greater than 20 characters"),t},tc=e=>{if(!e)return 72;U("detail-column-guide",typeof e=="string"||typeof e=="number","Must be an integer");const t=Number(e);return U("detail-column-guide",Number.isInteger(t),"Must be an integer"),U("detail-column-guide",t>=20,"Must be greater than 20 characters"),t},J={locale(e){if(!e)return"en";if(typeof e!="string")throw new h("Invalid config property locale: Must be a string");const t=Ka(e);return U("locale",/^[a-z]{2,3}(?:-[a-z\d]{2,8})*$/i.test(t),"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"),t},type:Ja,details(e){return er("details",e,!1)},"details-style":Ya,instructions:Za,"conventional-format":Xa,"conventional-types":Qa,"conventional-scope"(e){return er("conventional-scope",e,!1)},"title-length-guide":ec,"detail-column-guide":tc},H=(e,t)=>{const u=Kt(e[t]);if(u!==void 0)return u;const n=Xn[t]||[];for(const D of n){const o=Kt(e[D]);if(o!==void 0)return o}},uc=e=>Vt.some(t=>H(e,t)!==void 0),nc=e=>e.trim().replace(/[^\w.-]+/g,"-").replace(/-+/g,"-").replace(/^-+|-+$/g,"")||"profile",rc=e=>{if(e.type!=="conventional")return["## Commit Type","- Output a plain commit title, not a conventional commit prefix."].join(`
68
+ `);return{files:r,diff:i,source:"uncommitted"}},La=async(e,t)=>{const u=await Jn(e,t);if(u)return u;if(!await ja(t))return Na(e,t)},Ga=(e,t="staged")=>`Detected ${e.length.toLocaleString()} ${t} file${e.length>1?"s":""}`,Yn="message.md",Zn=["# Commit Message Instructions","","## Language","- Write the commit message in English.","","## Format","- Output a plain git commit title, not a conventional commit prefix.","- Return only a single title line with no body.","- Use concise imperative wording.","","## Focus","- Lead with the dominant user-facing, product-facing, or operational outcome.","- Prefer the end result over the implementation mechanism.","- Describe what the change enables, fixes, prevents, or improves.","- Mention a concrete file, module, class, or subsystem only when it helps disambiguate the change.","","## Constraints","- Keep the title around 50 characters when practical.",'- Avoid vague subjects like "update", "improve", "refactor", or "cleanup" unless the diff is genuinely dominated by maintenance work.'].join(`
69
+ `),Ze=(e,t,u="")=>{const n=t?.trim()||u.trim();return n?N.isAbsolute(n)?n:N.join(e,n):""},Wa=async e=>{await A.mkdir(N.dirname(e),{recursive:!0})},za=async(e,t)=>{let u;try{u=await A.lstat(e)}catch(n){throw n.code==="ENOENT"?new m(`${t} was not created: ${e}`):n}if(!u.isFile())throw new m(`${t} must point to a file: ${e}`)},Ua=async(e,t)=>{try{if(!(await A.lstat(e)).isFile())throw new m(`Message Markdown file must point to a file: ${e}`);return}catch(u){if(u.code!=="ENOENT")throw u}await Wa(e),await A.writeFile(e,`${t.trimEnd()}
70
+ `,"utf8"),await za(e,"Message Markdown file")},Xn=async(e,t)=>{const u=Ze(e,t,Yn);await Ua(u,Zn);const n=await A.readFile(u,"utf8");return{messageFilePath:u,messageInstructionsMarkdown:n}},qt=(e,t)=>Ze(e,t)||void 0,qa=async({configDirectoryPath:e,messagePathValue:t,postResponseScriptValue:u,suppressErrors:n=!1})=>{if(n)try{return{...await Xn(e,t),postResponseScriptPath:qt(e,u)}}catch{return{messageFilePath:Ze(e,t,Yn),messageInstructionsMarkdown:Zn,postResponseScriptPath:qt(e,u)}}return{...await Xn(e,t),postResponseScriptPath:qt(e,u)}},Ht=e=>`Flag "${e}" has been removed. Move commit message instructions into ~/.aicommits/message.md or point --message-file at another Markdown file.`,Ha={cn:"zh-CN","zh-cn":"zh-CN","zh-hans":"zh-CN",zh:"zh-CN","zh-tw":"zh-TW","zh-hant":"zh-TW"},Va="message.md",Vt=["locale","type","details","details-style","instructions","conventional-format","conventional-types","conventional-scope","title-length-guide","detail-column-guide"],Qn={"title-length-guide":["max-length"]},Ka=new Set([...Vt,"max-length"]),z=(e,t,u)=>{if(!t)throw new m(`Invalid config property ${e}: ${u}`)},Kt=e=>typeof e=="string"||typeof e=="number"||typeof e=="boolean"?e:void 0,er=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),tr=(e,t,u)=>{if(t==null||t==="")return u;if(typeof t=="boolean")return t;if(typeof t=="number"){if(t===1)return!0;if(t===0)return!1}if(typeof t=="string"){const n=t.trim().toLowerCase();if(["true","1","yes","on"].includes(n))return!0;if(["false","0","no","off"].includes(n))return!1}throw new m(`Invalid config property ${e}: Must be a boolean (true/false)`)},Ja=e=>{const t=e.trim().replace(/_/g,"-");return Ha[t.toLowerCase()]??t},Ya=e=>e?(z("type",typeof e=="string","Must be a string"),z("type",["","conventional"].includes(e),"Invalid commit type"),e):"",Za=e=>{if(e==null||e==="")return"paragraph";if(typeof e!="string")throw new m("Invalid config property details-style: Must be a string");const t=e.trim().toLowerCase();return z("details-style",["paragraph","list","markdown"].includes(t),"Must be one of: paragraph, list, markdown"),t},Xa=e=>{if(e==null)return"";if(typeof e!="string")throw new m("Invalid config property instructions: Must be a string");return e.trim()},Qa=e=>{if(e==null)return"";if(typeof e!="string")throw new m("Invalid config property conventional-format: Must be a string");return e.trim()},ec=e=>{if(!e)return"";if(typeof e!="string")throw new m("Invalid config property conventional-types: Must be valid JSON");let t;try{t=JSON.parse(e)}catch{throw new m("Invalid config property conventional-types: Must be valid JSON")}z("conventional-types",typeof t=="object"&&t!==null&&!Array.isArray(t),'Must be a JSON object with "type":"description" pairs');const u=Object.entries(t).map(([n,D])=>[n.trim(),String(D).trim()]).filter(([n,D])=>n.length>0&&D.length>0);return z("conventional-types",u.length>0,"Must contain at least one type"),JSON.stringify(Object.fromEntries(u))},tc=e=>{if(!e)return 50;z("title-length-guide",typeof e=="string"||typeof e=="number","Must be an integer");const t=Number(e);return z("title-length-guide",Number.isInteger(t),"Must be an integer"),z("title-length-guide",t>=20,"Must be greater than 20 characters"),t},uc=e=>{if(!e)return 72;z("detail-column-guide",typeof e=="string"||typeof e=="number","Must be an integer");const t=Number(e);return z("detail-column-guide",Number.isInteger(t),"Must be an integer"),z("detail-column-guide",t>=20,"Must be greater than 20 characters"),t},Y={locale(e){if(!e)return"en";if(typeof e!="string")throw new m("Invalid config property locale: Must be a string");const t=Ja(e);return z("locale",/^[a-z]{2,3}(?:-[a-z\d]{2,8})*$/i.test(t),"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"),t},type:Ya,details(e){return tr("details",e,!1)},"details-style":Za,instructions:Xa,"conventional-format":Qa,"conventional-types":ec,"conventional-scope"(e){return tr("conventional-scope",e,!1)},"title-length-guide":tc,"detail-column-guide":uc},q=(e,t)=>{const u=Kt(e[t]);if(u!==void 0)return u;const n=Qn[t]||[];for(const D of n){const o=Kt(e[D]);if(o!==void 0)return o}},nc=e=>Vt.some(t=>q(e,t)!==void 0),rc=e=>e.trim().replace(/[^\w.-]+/g,"-").replace(/-+/g,"-").replace(/^-+|-+$/g,"")||"profile",Dc=e=>{if(e.type!=="conventional")return["## Commit Type","- Output a plain commit title, not a conventional commit prefix."].join(`
71
71
  `);const t=["## Commit Type","- Use conventional commit formatting."];return e["conventional-scope"]?t.push("- Prefer `type(scope): subject` and only omit scope when there is no clear dominant module, file, class, or subsystem."):t.push("- Prefer `type: subject` without a scope."),e["conventional-format"]&&t.push(`- Use this title format exactly: \`${e["conventional-format"]}\`.`),e["conventional-types"]&&t.push("- Use these conventional type definitions:","```json",e["conventional-types"],"```"),t.join(`
72
- `)},Dc=e=>{if(!e.details)return["## Body","- Return only the title line with no body."].join(`
72
+ `)},oc=e=>{if(!e.details)return["## Body","- Return only the title line with no body."].join(`
73
73
  `);const t=["## Body","- Include a body only when the title alone is not sufficient."];return e["details-style"]==="list"?t.push("- When a body is needed, use concise bullet points.",`- Wrap bullet lines around column ${e["detail-column-guide"]} when practical.`):e["details-style"]==="markdown"?t.push("- When a body is needed, use concise markdown without fenced code blocks."):t.push("- When a body is needed, write concise prose paragraphs.",`- Wrap body text around column ${e["detail-column-guide"]} when practical.`),t.join(`
74
- `)},oc=e=>["# Commit Message Instructions","","## Language",`- Write the commit message strictly in ${e.locale}.`,"",rc(e),"","## Title","- Use concise imperative wording.","- Focus on the dominant user-facing, product-facing, or operational outcome first.","- Prefer the end result over the implementation mechanism.",`- Keep the title around ${e["title-length-guide"]} characters when practical.`,"",Dc(e),"","## Style","- Describe what the change enables, fixes, prevents, or improves.",'- Avoid vague subjects like "update", "improve", "refactor", or "cleanup" unless the diff is genuinely dominated by maintenance work.',...e.instructions?["","## Additional Instructions",e.instructions]:[]].join(`
75
- `),sc=async e=>{await A.mkdir(N.dirname(e),{recursive:!0})},ic=async(e,t)=>{let u;try{u=await A.lstat(e)}catch(n){throw n.code==="ENOENT"?new h(`${t} was not created: ${e}`):n}if(!u.isFile())throw new h(`${t} must point to a file: ${e}`)},ac=async(e,t)=>{try{if(!(await A.lstat(e)).isFile())throw new h(`Migrated message Markdown file must point to a file: ${e}`);return}catch(u){if(u.code!=="ENOENT")throw u}await sc(e),await A.writeFile(e,`${t.trimEnd()}
76
- `,"utf8"),await ic(e,"Migrated message Markdown file")},cc=e=>({locale:J.locale(H(e,"locale")),type:J.type(H(e,"type")),details:J.details(H(e,"details")),"details-style":J["details-style"](H(e,"details-style")),instructions:J.instructions(H(e,"instructions")),"conventional-format":J["conventional-format"](H(e,"conventional-format")),"conventional-types":J["conventional-types"](H(e,"conventional-types")),"conventional-scope":J["conventional-scope"](H(e,"conventional-scope")),"title-length-guide":J["title-length-guide"](H(e,"title-length-guide")),"detail-column-guide":J["detail-column-guide"](H(e,"detail-column-guide"))}),lc=e=>{for(const t of Vt){delete e[t];const u=Xn[t]||[];for(const n of u)delete e[n]}},tr=async(e,t,u,n)=>{if(!uc(e))return!1;const D=cc(e),o=Kt(e["message-path"]),r=typeof o=="string"&&o.trim()?o.trim():u,i=Ze(t,r,u);return await ac(i,oc(D)),n&&(e["message-path"]=r),lc(e),!0},Jt=async({backupConfig:e,config:t,configDirectoryPath:u,normalizeLegacyConfigKeys:n,writeConfig:D})=>{let o=!1;o=await tr(t,u,Ha,!1)||o;const{profiles:r}=t;if(Qn(r))for(const[i,s]of Object.entries(r)){if(!Qn(s))continue;const c=`message.${nc(i)}.md`;o=await tr(s,u,c,!0)||o}o&&(n(t),await e?.(),await D(t))},fc=e=>{const t=e.trim();if(Va.has(t))return`Config property "${t}" has moved to your message Markdown file. Edit ~/.aicommits/message.md or set message-path instead.`},dc=["responses","chat"],Fc=["none","low","medium","high","xhigh"],{hasOwnProperty:pc}=Object.prototype,ur=(e,t)=>pc.call(e,t),R=(e,t,u)=>{if(!t)throw new h(`Invalid config property ${e}: ${u}`)},ye=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),te=e=>typeof e=="string"||typeof e=="number"||typeof e=="boolean"?e:void 0,Cc=(e,t,u)=>{if(t==null||t==="")return u;if(typeof t=="boolean")return t;if(typeof t=="number"){if(t===1)return!0;if(t===0)return!1}if(typeof t=="string"){const n=t.trim().toLowerCase();if(["true","1","yes","on"].includes(n))return!0;if(["false","0","no","off"].includes(n))return!1}throw new h(`Invalid config property ${e}: Must be a boolean (true/false)`)},mc=e=>{let t;try{t=JSON.parse(e)}catch{throw new h("Invalid config property request-options: Must be valid JSON")}return R("request-options",typeof t=="object"&&t!==null&&!Array.isArray(t),"Must be a JSON object"),JSON.stringify(t)},hc=e=>{if(typeof e=="number")return R("context-window",Number.isInteger(e),"Must be an integer or use K/M suffix"),e;const u=e.trim().match(/^([+-]?\d+)([kKmM])?$/);if(R("context-window",!!u,"Must be an integer or use K/M suffix"),!u?.[1])return Number.NaN;const n=Number(u[1]),D=u[2]?.toLowerCase();let o=1;return D==="k"?o=1024:D==="m"&&(o=1024*1024),n*o},nr=(e,t="")=>{if(e==null)return t;if(typeof e!="string")throw new h("Path values must be strings");return e.trim()||t},gc=/^[A-Za-z_]\w*$/,Ec=e=>{if(typeof e!="string")return;const t=e.trim();if(!t)return;if(t.startsWith("env:")){const n=t.slice(4).trim();return gc.test(n)?n:void 0}return t.match(/^\$\{([A-Za-z_]\w*)\}$/)?.[1]},yc=(e,t)=>{if(e!=="api-key")return t;const u=Ec(t);if(!u)return t;const n=process.env[u];if(n===void 0)throw new h(`Invalid config property api-key: Environment variable ${u} is not set`);return n},be={"api-key"(e){if(!e)throw new h("Please set your API key via `aicommits config set api-key=<your token>`");if(typeof e!="string")throw new h("Invalid config property api-key: Must be a string");const t=e.trim();return R("api-key",t.length>0,"Cannot be empty"),t},"base-url"(e){if(e==null||e==="")throw new h("Please set your API base URL via `aicommits config set base-url=<https://...>`");if(typeof e!="string")throw new h("Invalid config property base-url: Must be a valid URL");const t=e.trim();let u;try{u=new URL(t)}catch{throw new h("Invalid config property base-url: Must be a valid URL")}R("base-url",u.protocol==="https:","Must be an HTTPS URL"),R("base-url",u.hash==="","Must not include URL fragments"),R("base-url",u.search==="","Must not include query parameters");const n=u.pathname.replace(/\/+$/,"");return`${u.origin}${n}`},profile(e){if(e==null)return"";if(typeof e!="string")throw new h("Invalid config property profile: Must be a string");return e.trim()},generate(e){if(!e)return 1;R("generate",typeof e=="string"||typeof e=="number","Must be an integer");const t=Number(e);return R("generate",Number.isInteger(t),"Must be an integer"),R("generate",t>0,"Must be greater than 0"),R("generate",t<=5,"Must be less or equal to 5"),t},proxy(e){if(!(e==null||e==="")){if(typeof e!="string")throw new h("Invalid config property proxy: Must be a valid URL");return R("proxy",/^https?:\/\//.test(e),"Must be a valid URL"),e}},model(e){if(e==null||e==="")return"gpt-3.5-turbo";if(typeof e!="string")throw new h("Invalid config property model: Must be a string");return e},timeout(e){if(!e)return 1e4;R("timeout",typeof e=="string"||typeof e=="number","Must be an integer");const t=Number(e);return R("timeout",Number.isInteger(t),"Must be an integer"),R("timeout",t>=500,"Must be greater than 500ms"),t},"context-window"(e){if(!e)return 0;if(typeof e!="string"&&typeof e!="number")throw new h("Invalid config property context-window: Must be an integer or use K/M suffix");const t=hc(e);return R("context-window",Number.isInteger(t),"Must be an integer"),R("context-window",t===0||t>=1024,"Must be 0 (auto) or greater than or equal to 1024 tokens"),t},"show-reasoning"(e){return Cc("show-reasoning",e,!1)},"reasoning-effort"(e){if(e==null||e==="")return"";if(typeof e!="string")throw new h("Invalid config property reasoning-effort: Must be one of: none, low, medium, high, xhigh");const t=e.trim().toLowerCase();return R("reasoning-effort",Fc.includes(t),"Must be one of: none, low, medium, high, xhigh"),t},"api-mode"(e){if(e==null||e==="")return"responses";if(typeof e!="string")throw new h('Invalid config property api-mode: Must be "responses" or "chat"');const t=e.trim().toLowerCase();return R("api-mode",dc.includes(t),"Must be one of: responses, chat"),t},"request-options"(e){if(e==null||e==="")return"";if(typeof e!="string")throw new h("Invalid config property request-options: Must be valid JSON");return mc(e)},"message-path"(e){try{return nr(e,"message.md")}catch{throw new h("Invalid config property message-path: Must be a string")}},"post-response-script"(e){try{return nr(e,"")}catch{throw new h("Invalid config property post-response-script: Must be a string")}}},bc={},Yt={"api-key":["openai-key","OPENAI_KEY","OPENAI_API_KEY"],"base-url":["openai-base-url","OPENAI_BASE_URL"],model:["OPENAI_MODEL"]},Y=N.join(Oe.homedir(),".aicommits"),rr=N.join(Y,"config.toml"),wc=[N.join(Oe.homedir(),"aicommits.toml"),N.join(Oe.homedir(),".aicommits")],Bc=e=>{let t=!1,u=!1,n=!1;for(let D=0;D<e.length;D+=1){const o=e[D];if(o==="\\"&&u&&!n){n=!0;continue}if(o==='"'&&!t&&!n)u=!u;else if(o==="'"&&!u)t=!t;else if(o==="#"&&!t&&!u)return e.slice(0,D);n=!1}return e},Dr=e=>{const t=e.trim();return t.startsWith('"')&&t.endsWith('"')||t.startsWith("'")&&t.endsWith("'")?t.slice(1,-1):t},vc=e=>{const t=e.trim();if(t==="")return"";if(t.startsWith('"')&&t.endsWith('"'))try{return JSON.parse(t)}catch{return t.slice(1,-1)}return t.startsWith("'")&&t.endsWith("'")?t.slice(1,-1):/^(?:true|false)$/i.test(t)?t.toLowerCase()==="true":/^[+-]?\d+$/.test(t)||/^[+-]?\d+\.\d+$/.test(t)?Number(t):t},Ac=(e,t)=>{let u=e;for(const n of t){const D=u[n];if(!ye(D)){const o=Object.create(null);u[n]=o,u=o;continue}u=D}return u},$c=e=>{const t=Object.create(null);let u=t;for(const n of e.split(/\r?\n/)){const D=Bc(n).trim();if(!D)continue;if(D.startsWith("[")&&D.endsWith("]")){const s=D.slice(1,-1).trim();if(!s){u=t;continue}const c=s.split(".").map(Dr).map(f=>f.trim()).filter(Boolean);if(c.length===0){u=t;continue}u=Ac(t,c);continue}const o=D.indexOf("=");if(o<=0)continue;const r=Dr(D.slice(0,o));if(!r)continue;const i=vc(D.slice(o+1));u[r]=i}return t},or=e=>typeof e=="string"?JSON.stringify(e):String(e),xc=e=>{const t=[],u=[],n=(D,o)=>{const r=[],i=[];for(const[s,c]of Object.entries(o)){const f=te(c);if(f!==void 0){r.push(`${s} = ${or(f)}`);continue}ye(c)&&i.push([s,c])}D.length>0&&r.length>0&&u.push(`[${D.join(".")}]`,...r,"");for(const[s,c]of i)n([...D,s],c)};for(const[D,o]of Object.entries(e)){const r=te(o);if(r!==void 0){t.push(`${D} = ${or(r)}`);continue}ye(o)&&n([D],o)}for(;u[u.length-1]==="";)u.pop();return[...t,...t.length>0&&u.length>0?[""]:[],...u].join(`
77
- `)},we=async e=>{await A.mkdir(Y,{recursive:!0});const t=xc(e);await A.writeFile(rr,`${t}
78
- `,"utf8")},Sc=async(e,t)=>{try{if((await A.lstat(e)).isFile())return;throw new h(`Backup path must point to a file: ${e}`)}catch(u){if(u.code!=="ENOENT")throw u}await A.mkdir(N.dirname(e),{recursive:!0}),await A.writeFile(e,t,"utf8")},Zt=async(e,t)=>{!e||t===void 0||await Sc(`${e}.bak`,t)},sr=async(e,t,u)=>{await Zt(t,u),await A.rm(t),await A.mkdir(Y,{recursive:!0}),await Jt({config:e,configDirectoryPath:Y,normalizeLegacyConfigKeys:Be,writeConfig:we}),await we(e)},ir=async e=>{try{if(!(await A.lstat(e)).isFile())return;const u=await A.readFile(e,"utf8");return{config:$c(u),content:u,path:e}}catch{return}},ar=async()=>{const e=await ir(rr);if(e)return{config:e.config,sourceContent:e.content,sourcePath:e.path};for(const t of wc){const u=await ir(t);if(u)return{config:u.config,sourceContent:u.content,sourcePath:u.path}}return{config:Object.create(null)}},kc=(e,t)=>{const u=Yt[e];if(!(!u||u.length===0))for(const n of u){const D=te(t[n]);if(D!==void 0)return D}},Be=e=>{for(const[t,u]of Object.entries(Yt)){if(te(e[t])===void 0)for(const n of u){const D=te(e[n]);if(D!==void 0){e[t]=D;break}}for(const n of u)delete e[n]}},Mc=(e,t,u)=>{if(!t)return;const{profiles:n}=e;if(!ye(n))return;const D=n[t];if(ye(D))return te(D[u])},cr=e=>{const t=e.trim();return ur(be,t)?t:bc[t]},Xt=async(e,t)=>{const{config:u,sourceContent:n,sourcePath:D}=await ar(),o=D===Y;Be(u),o&&D?await sr(u,D,n):await Jt({backupConfig:async()=>Zt(D,n),config:u,configDirectoryPath:Y,normalizeLegacyConfigKeys:Be,writeConfig:we});const r={},i=e?.profile??te(u.profile);let s="";try{s=be.profile(i)}catch{if(!t)throw new h("Invalid config property profile: Must be a string")}for(const a of Object.keys(be)){const d=be[a],F=yc(a,e?.[a]??(a==="profile"?void 0:Mc(u,s,a))??te(u[a])??kc(a,u));if(t)try{r[a]=d(F)}catch{}else r[a]=d(F)}const c=r["message-path"]||"message.md",f=r["post-response-script"]||"",l=await Ua({configDirectoryPath:Y,messagePathValue:c,postResponseScriptValue:f,suppressErrors:t});return{...r,configDirectoryPath:Y,...l}},Ic=async e=>{const{config:t,sourceContent:u,sourcePath:n}=await ar(),D=n===Y;Be(t),D&&n?await sr(t,n,u):await Jt({backupConfig:async()=>Zt(n,u),config:t,configDirectoryPath:Y,normalizeLegacyConfigKeys:Be,writeConfig:we});for(const[o,r]of e){const i=fc(o);if(i)throw new h(i);const s=cr(o);if(!s)throw new h(`Invalid config property: ${o}`);const c=be[s](r);t[s]=c;const f=Yt[s]||[];for(const l of f)delete t[l]}await we(t)};var Qt={},eu={exports:{}},ve={exports:{}},tu,lr;function Oc(){if(lr)return tu;lr=1;var e=1e3,t=e*60,u=t*60,n=u*24,D=n*7,o=n*365.25;tu=function(f,l){l=l||{};var a=typeof f;if(a==="string"&&f.length>0)return r(f);if(a==="number"&&isFinite(f))return l.long?s(f):i(f);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(f))};function r(f){if(f=String(f),!(f.length>100)){var l=/^(-?(?:\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(l){var a=parseFloat(l[1]),d=(l[2]||"ms").toLowerCase();switch(d){case"years":case"year":case"yrs":case"yr":case"y":return a*o;case"weeks":case"week":case"w":return a*D;case"days":case"day":case"d":return a*n;case"hours":case"hour":case"hrs":case"hr":case"h":return a*u;case"minutes":case"minute":case"mins":case"min":case"m":return a*t;case"seconds":case"second":case"secs":case"sec":case"s":return a*e;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return a;default:return}}}}function i(f){var l=Math.abs(f);return l>=n?Math.round(f/n)+"d":l>=u?Math.round(f/u)+"h":l>=t?Math.round(f/t)+"m":l>=e?Math.round(f/e)+"s":f+"ms"}function s(f){var l=Math.abs(f);return l>=n?c(f,l,n,"day"):l>=u?c(f,l,u,"hour"):l>=t?c(f,l,t,"minute"):l>=e?c(f,l,e,"second"):f+" ms"}function c(f,l,a,d){var F=l>=a*1.5;return Math.round(f/a)+" "+d+(F?"s":"")}return tu}var uu,fr;function dr(){if(fr)return uu;fr=1;function e(t){n.debug=n,n.default=n,n.coerce=c,n.disable=i,n.enable=o,n.enabled=s,n.humanize=Oc(),n.destroy=f,Object.keys(t).forEach(l=>{n[l]=t[l]}),n.names=[],n.skips=[],n.formatters={};function u(l){let a=0;for(let d=0;d<l.length;d++)a=(a<<5)-a+l.charCodeAt(d),a|=0;return n.colors[Math.abs(a)%n.colors.length]}n.selectColor=u;function n(l){let a,d=null,F,m;function p(...C){if(!p.enabled)return;const y=p,v=Number(new Date),I=v-(a||v);y.diff=I,y.prev=a,y.curr=v,a=v,C[0]=n.coerce(C[0]),typeof C[0]!="string"&&C.unshift("%O");let $=0;C[0]=C[0].replace(/%([a-zA-Z%])/g,(b,w)=>{if(b==="%%")return"%";$++;const O=n.formatters[w];if(typeof O=="function"){const B=C[$];b=O.call(y,B),C.splice($,1),$--}return b}),n.formatArgs.call(y,C),(y.log||n.log).apply(y,C)}return p.namespace=l,p.useColors=n.useColors(),p.color=n.selectColor(l),p.extend=D,p.destroy=n.destroy,Object.defineProperty(p,"enabled",{enumerable:!0,configurable:!1,get:()=>d!==null?d:(F!==n.namespaces&&(F=n.namespaces,m=n.enabled(l)),m),set:C=>{d=C}}),typeof n.init=="function"&&n.init(p),p}function D(l,a){const d=n(this.namespace+(typeof a>"u"?":":a)+l);return d.log=this.log,d}function o(l){n.save(l),n.namespaces=l,n.names=[],n.skips=[];const a=(typeof l=="string"?l:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(const d of a)d[0]==="-"?n.skips.push(d.slice(1)):n.names.push(d)}function r(l,a){let d=0,F=0,m=-1,p=0;for(;d<l.length;)if(F<a.length&&(a[F]===l[d]||a[F]==="*"))a[F]==="*"?(m=F,p=d,F++):(d++,F++);else if(m!==-1)F=m+1,p++,d=p;else return!1;for(;F<a.length&&a[F]==="*";)F++;return F===a.length}function i(){const l=[...n.names,...n.skips.map(a=>"-"+a)].join(",");return n.enable(""),l}function s(l){for(const a of n.skips)if(r(l,a))return!1;for(const a of n.names)if(r(l,a))return!0;return!1}function c(l){return l instanceof Error?l.stack||l.message:l}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 uu=e,uu}ve.exports;var Fr;function Tc(){return Fr||(Fr=1,function(e,t){t.formatArgs=n,t.save=D,t.load=o,t.useColors=u,t.storage=r(),t.destroy=(()=>{let s=!1;return()=>{s||(s=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function u(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let s;return 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&&(s=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(s[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function n(s){if(s[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+s[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const c="color: "+this.color;s.splice(1,0,c,"color: inherit");let f=0,l=0;s[0].replace(/%[a-zA-Z%]/g,a=>{a!=="%%"&&(f++,a==="%c"&&(l=f))}),s.splice(l,0,c)}t.log=console.debug||console.log||(()=>{});function D(s){try{s?t.storage.setItem("debug",s):t.storage.removeItem("debug")}catch{}}function o(){let s;try{s=t.storage.getItem("debug")||t.storage.getItem("DEBUG")}catch{}return!s&&typeof process<"u"&&"env"in process&&(s=process.env.DEBUG),s}function r(){try{return localStorage}catch{}}e.exports=dr()(t);const{formatters:i}=e.exports;i.j=function(s){try{return JSON.stringify(s)}catch(c){return"[UnexpectedJSONParseError]: "+c.message}}}(ve,ve.exports)),ve.exports}var Ae={exports:{}},nu,pr;function Pc(){return pr||(pr=1,nu=(e,t=process.argv)=>{const u=e.startsWith("-")?"":e.length===1?"-":"--",n=t.indexOf(u+e),D=t.indexOf("--");return n!==-1&&(D===-1||n<D)}),nu}var ru,Cr;function Rc(){if(Cr)return ru;Cr=1;const e=Oe,t=rt,u=Pc(),{env:n}=process;let D;u("no-color")||u("no-colors")||u("color=false")||u("color=never")?D=0:(u("color")||u("colors")||u("color=true")||u("color=always"))&&(D=1),"FORCE_COLOR"in n&&(n.FORCE_COLOR==="true"?D=1:n.FORCE_COLOR==="false"?D=0:D=n.FORCE_COLOR.length===0?1:Math.min(parseInt(n.FORCE_COLOR,10),3));function o(s){return s===0?!1:{level:s,hasBasic:!0,has256:s>=2,has16m:s>=3}}function r(s,c){if(D===0)return 0;if(u("color=16m")||u("color=full")||u("color=truecolor"))return 3;if(u("color=256"))return 2;if(s&&!c&&D===void 0)return 0;const f=D||0;if(n.TERM==="dumb")return f;if(process.platform==="win32"){const l=e.release().split(".");return Number(l[0])>=10&&Number(l[2])>=10586?Number(l[2])>=14931?3:2:1}if("CI"in n)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some(l=>l 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 l=parseInt((n.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(n.TERM_PROGRAM){case"iTerm.app":return l>=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 i(s){const c=r(s,s&&s.isTTY);return o(c)}return ru={supportsColor:i,stdout:o(r(!0,t.isatty(1))),stderr:o(r(!0,t.isatty(2)))},ru}Ae.exports;var mr;function _c(){return mr||(mr=1,function(e,t){const u=rt,n=Eu;t.init=f,t.log=i,t.formatArgs=o,t.save=s,t.load=c,t.useColors=D,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 a=Rc();a&&(a.stderr||a).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(a=>/^debug_/i.test(a)).reduce((a,d)=>{const F=d.substring(6).toLowerCase().replace(/_([a-z])/g,(p,C)=>C.toUpperCase());let m=process.env[d];return/^(yes|on|true|enabled)$/i.test(m)?m=!0:/^(no|off|false|disabled)$/i.test(m)?m=!1:m==="null"?m=null:m=Number(m),a[F]=m,a},{});function D(){return"colors"in t.inspectOpts?!!t.inspectOpts.colors:u.isatty(process.stderr.fd)}function o(a){const{namespace:d,useColors:F}=this;if(F){const m=this.color,p="\x1B[3"+(m<8?m:"8;5;"+m),C=` ${p};1m${d} \x1B[0m`;a[0]=C+a[0].split(`
74
+ `)},sc=e=>["# Commit Message Instructions","","## Language",`- Write the commit message strictly in ${e.locale}.`,"",Dc(e),"","## Title","- Use concise imperative wording.","- Focus on the dominant user-facing, product-facing, or operational outcome first.","- Prefer the end result over the implementation mechanism.",`- Keep the title around ${e["title-length-guide"]} characters when practical.`,"",oc(e),"","## Style","- Describe what the change enables, fixes, prevents, or improves.",'- Avoid vague subjects like "update", "improve", "refactor", or "cleanup" unless the diff is genuinely dominated by maintenance work.',...e.instructions?["","## Additional Instructions",e.instructions]:[]].join(`
75
+ `),ic=async e=>{await A.mkdir(N.dirname(e),{recursive:!0})},ac=async(e,t)=>{let u;try{u=await A.lstat(e)}catch(n){throw n.code==="ENOENT"?new m(`${t} was not created: ${e}`):n}if(!u.isFile())throw new m(`${t} must point to a file: ${e}`)},cc=async(e,t)=>{try{if(!(await A.lstat(e)).isFile())throw new m(`Migrated message Markdown file must point to a file: ${e}`);return}catch(u){if(u.code!=="ENOENT")throw u}await ic(e),await A.writeFile(e,`${t.trimEnd()}
76
+ `,"utf8"),await ac(e,"Migrated message Markdown file")},lc=e=>({locale:Y.locale(q(e,"locale")),type:Y.type(q(e,"type")),details:Y.details(q(e,"details")),"details-style":Y["details-style"](q(e,"details-style")),instructions:Y.instructions(q(e,"instructions")),"conventional-format":Y["conventional-format"](q(e,"conventional-format")),"conventional-types":Y["conventional-types"](q(e,"conventional-types")),"conventional-scope":Y["conventional-scope"](q(e,"conventional-scope")),"title-length-guide":Y["title-length-guide"](q(e,"title-length-guide")),"detail-column-guide":Y["detail-column-guide"](q(e,"detail-column-guide"))}),fc=e=>{for(const t of Vt){delete e[t];const u=Qn[t]||[];for(const n of u)delete e[n]}},ur=async(e,t,u,n)=>{if(!nc(e))return!1;const D=lc(e),o=Kt(e["message-path"]),r=typeof o=="string"&&o.trim()?o.trim():u,i=Ze(t,r,u);return await cc(i,sc(D)),n&&(e["message-path"]=r),fc(e),!0},Jt=async({backupConfig:e,config:t,configDirectoryPath:u,normalizeLegacyConfigKeys:n,writeConfig:D})=>{let o=!1;o=await ur(t,u,Va,!1)||o;const{profiles:r}=t;if(er(r))for(const[i,s]of Object.entries(r)){if(!er(s))continue;const c=`message.${rc(i)}.md`;o=await ur(s,u,c,!0)||o}o&&(n(t),await e?.(),await D(t))},dc=e=>{const t=e.trim();if(Ka.has(t))return`Config property "${t}" has moved to your message Markdown file. Edit ~/.aicommits/message.md or set message-path instead.`},Fc=["responses","chat"],pc=["none","low","medium","high","xhigh"],{hasOwnProperty:Cc}=Object.prototype,nr=(e,t)=>Cc.call(e,t),R=(e,t,u)=>{if(!t)throw new m(`Invalid config property ${e}: ${u}`)},we=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),te=e=>typeof e=="string"||typeof e=="number"||typeof e=="boolean"?e:void 0,mc=(e,t,u)=>{if(t==null||t==="")return u;if(typeof t=="boolean")return t;if(typeof t=="number"){if(t===1)return!0;if(t===0)return!1}if(typeof t=="string"){const n=t.trim().toLowerCase();if(["true","1","yes","on"].includes(n))return!0;if(["false","0","no","off"].includes(n))return!1}throw new m(`Invalid config property ${e}: Must be a boolean (true/false)`)},hc=e=>{let t;try{t=JSON.parse(e)}catch{throw new m("Invalid config property request-options: Must be valid JSON")}return R("request-options",typeof t=="object"&&t!==null&&!Array.isArray(t),"Must be a JSON object"),JSON.stringify(t)},gc=e=>{if(typeof e=="number")return R("context-window",Number.isInteger(e),"Must be an integer or use K/M suffix"),e;const u=e.trim().match(/^([+-]?\d+)([kKmM])?$/);if(R("context-window",!!u,"Must be an integer or use K/M suffix"),!u?.[1])return Number.NaN;const n=Number(u[1]),D=u[2]?.toLowerCase();let o=1;return D==="k"?o=1024:D==="m"&&(o=1024*1024),n*o},rr=(e,t="")=>{if(e==null)return t;if(typeof e!="string")throw new m("Path values must be strings");return e.trim()||t},Ec=/^[A-Za-z_]\w*$/,yc=e=>{if(typeof e!="string")return;const t=e.trim();if(!t)return;if(t.startsWith("env:")){const n=t.slice(4).trim();return Ec.test(n)?n:void 0}return t.match(/^\$\{([A-Za-z_]\w*)\}$/)?.[1]},bc=(e,t)=>{if(e!=="api-key")return t;const u=yc(t);if(!u)return t;const n=process.env[u];if(n===void 0)throw new m(`Invalid config property api-key: Environment variable ${u} is not set`);return n},Be={"api-key"(e){if(!e)throw new m("Please set your API key via `aicommits config set api-key=<your token>`");if(typeof e!="string")throw new m("Invalid config property api-key: Must be a string");const t=e.trim();return R("api-key",t.length>0,"Cannot be empty"),t},"base-url"(e){if(e==null||e==="")throw new m("Please set your API base URL via `aicommits config set base-url=<https://...>`");if(typeof e!="string")throw new m("Invalid config property base-url: Must be a valid URL");const t=e.trim();let u;try{u=new URL(t)}catch{throw new m("Invalid config property base-url: Must be a valid URL")}R("base-url",u.protocol==="https:","Must be an HTTPS URL"),R("base-url",u.hash==="","Must not include URL fragments"),R("base-url",u.search==="","Must not include query parameters");const n=u.pathname.replace(/\/+$/,"");return`${u.origin}${n}`},profile(e){if(e==null)return"";if(typeof e!="string")throw new m("Invalid config property profile: Must be a string");return e.trim()},generate(e){if(!e)return 1;R("generate",typeof e=="string"||typeof e=="number","Must be an integer");const t=Number(e);return R("generate",Number.isInteger(t),"Must be an integer"),R("generate",t>0,"Must be greater than 0"),R("generate",t<=5,"Must be less or equal to 5"),t},proxy(e){if(!(e==null||e==="")){if(typeof e!="string")throw new m("Invalid config property proxy: Must be a valid URL");return R("proxy",/^https?:\/\//.test(e),"Must be a valid URL"),e}},model(e){if(e==null||e==="")return"gpt-3.5-turbo";if(typeof e!="string")throw new m("Invalid config property model: Must be a string");return e},timeout(e){if(!e)return 1e4;R("timeout",typeof e=="string"||typeof e=="number","Must be an integer");const t=Number(e);return R("timeout",Number.isInteger(t),"Must be an integer"),R("timeout",t>=500,"Must be greater than 500ms"),t},"context-window"(e){if(!e)return 0;if(typeof e!="string"&&typeof e!="number")throw new m("Invalid config property context-window: Must be an integer or use K/M suffix");const t=gc(e);return R("context-window",Number.isInteger(t),"Must be an integer"),R("context-window",t===0||t>=1024,"Must be 0 (auto) or greater than or equal to 1024 tokens"),t},"show-reasoning"(e){return mc("show-reasoning",e,!1)},"reasoning-effort"(e){if(e==null||e==="")return"";if(typeof e!="string")throw new m("Invalid config property reasoning-effort: Must be one of: none, low, medium, high, xhigh");const t=e.trim().toLowerCase();return R("reasoning-effort",pc.includes(t),"Must be one of: none, low, medium, high, xhigh"),t},"api-mode"(e){if(e==null||e==="")return"responses";if(typeof e!="string")throw new m('Invalid config property api-mode: Must be "responses" or "chat"');const t=e.trim().toLowerCase();return R("api-mode",Fc.includes(t),"Must be one of: responses, chat"),t},"request-options"(e){if(e==null||e==="")return"";if(typeof e!="string")throw new m("Invalid config property request-options: Must be valid JSON");return hc(e)},"message-path"(e){try{return rr(e,"message.md")}catch{throw new m("Invalid config property message-path: Must be a string")}},"post-response-script"(e){try{return rr(e,"")}catch{throw new m("Invalid config property post-response-script: Must be a string")}}},wc={},Yt={"api-key":["openai-key","OPENAI_KEY","OPENAI_API_KEY"],"base-url":["openai-base-url","OPENAI_BASE_URL"],model:["OPENAI_MODEL"]},Z=N.join(Oe.homedir(),".aicommits"),Dr=N.join(Z,"config.toml"),Bc=[N.join(Oe.homedir(),"aicommits.toml"),N.join(Oe.homedir(),".aicommits")],vc=e=>{let t=!1,u=!1,n=!1;for(let D=0;D<e.length;D+=1){const o=e[D];if(o==="\\"&&u&&!n){n=!0;continue}if(o==='"'&&!t&&!n)u=!u;else if(o==="'"&&!u)t=!t;else if(o==="#"&&!t&&!u)return e.slice(0,D);n=!1}return e},or=e=>{const t=e.trim();return t.startsWith('"')&&t.endsWith('"')||t.startsWith("'")&&t.endsWith("'")?t.slice(1,-1):t},Ac=e=>{const t=e.trim();if(t==="")return"";if(t.startsWith('"')&&t.endsWith('"'))try{return JSON.parse(t)}catch{return t.slice(1,-1)}return t.startsWith("'")&&t.endsWith("'")?t.slice(1,-1):/^(?:true|false)$/i.test(t)?t.toLowerCase()==="true":/^[+-]?\d+$/.test(t)||/^[+-]?\d+\.\d+$/.test(t)?Number(t):t},$c=(e,t)=>{let u=e;for(const n of t){const D=u[n];if(!we(D)){const o=Object.create(null);u[n]=o,u=o;continue}u=D}return u},xc=e=>{const t=Object.create(null);let u=t;for(const n of e.split(/\r?\n/)){const D=vc(n).trim();if(!D)continue;if(D.startsWith("[")&&D.endsWith("]")){const s=D.slice(1,-1).trim();if(!s){u=t;continue}const c=s.split(".").map(or).map(f=>f.trim()).filter(Boolean);if(c.length===0){u=t;continue}u=$c(t,c);continue}const o=D.indexOf("=");if(o<=0)continue;const r=or(D.slice(0,o));if(!r)continue;const i=Ac(D.slice(o+1));u[r]=i}return t},sr=e=>typeof e=="string"?JSON.stringify(e):String(e),Sc=e=>{const t=[],u=[],n=(D,o)=>{const r=[],i=[];for(const[s,c]of Object.entries(o)){const f=te(c);if(f!==void 0){r.push(`${s} = ${sr(f)}`);continue}we(c)&&i.push([s,c])}D.length>0&&r.length>0&&u.push(`[${D.join(".")}]`,...r,"");for(const[s,c]of i)n([...D,s],c)};for(const[D,o]of Object.entries(e)){const r=te(o);if(r!==void 0){t.push(`${D} = ${sr(r)}`);continue}we(o)&&n([D],o)}for(;u[u.length-1]==="";)u.pop();return[...t,...t.length>0&&u.length>0?[""]:[],...u].join(`
77
+ `)},ve=async e=>{await A.mkdir(Z,{recursive:!0});const t=Sc(e);await A.writeFile(Dr,`${t}
78
+ `,"utf8")},kc=async(e,t)=>{try{if((await A.lstat(e)).isFile())return;throw new m(`Backup path must point to a file: ${e}`)}catch(u){if(u.code!=="ENOENT")throw u}await A.mkdir(N.dirname(e),{recursive:!0}),await A.writeFile(e,t,"utf8")},Zt=async(e,t)=>{!e||t===void 0||await kc(`${e}.bak`,t)},ir=async(e,t,u)=>{await Zt(t,u),await A.rm(t),await A.mkdir(Z,{recursive:!0}),await Jt({config:e,configDirectoryPath:Z,normalizeLegacyConfigKeys:Ae,writeConfig:ve}),await ve(e)},ar=async e=>{try{if(!(await A.lstat(e)).isFile())return;const u=await A.readFile(e,"utf8");return{config:xc(u),content:u,path:e}}catch{return}},cr=async()=>{const e=await ar(Dr);if(e)return{config:e.config,sourceContent:e.content,sourcePath:e.path};for(const t of Bc){const u=await ar(t);if(u)return{config:u.config,sourceContent:u.content,sourcePath:u.path}}return{config:Object.create(null)}},Mc=(e,t)=>{const u=Yt[e];if(!(!u||u.length===0))for(const n of u){const D=te(t[n]);if(D!==void 0)return D}},Ae=e=>{for(const[t,u]of Object.entries(Yt)){if(te(e[t])===void 0)for(const n of u){const D=te(e[n]);if(D!==void 0){e[t]=D;break}}for(const n of u)delete e[n]}},Ic=(e,t,u)=>{if(!t)return;const{profiles:n}=e;if(!we(n))return;const D=n[t];if(we(D))return te(D[u])},lr=e=>{const t=e.trim();return nr(Be,t)?t:wc[t]},Xt=async(e,t)=>{const{config:u,sourceContent:n,sourcePath:D}=await cr(),o=D===Z;Ae(u),o&&D?await ir(u,D,n):await Jt({backupConfig:async()=>Zt(D,n),config:u,configDirectoryPath:Z,normalizeLegacyConfigKeys:Ae,writeConfig:ve});const r={},i=e?.profile??te(u.profile);let s="";try{s=Be.profile(i)}catch{if(!t)throw new m("Invalid config property profile: Must be a string")}for(const a of Object.keys(Be)){const d=Be[a],F=bc(a,e?.[a]??(a==="profile"?void 0:Ic(u,s,a))??te(u[a])??Mc(a,u));if(t)try{r[a]=d(F)}catch{}else r[a]=d(F)}const c=r["message-path"]||"message.md",f=r["post-response-script"]||"",l=await qa({configDirectoryPath:Z,messagePathValue:c,postResponseScriptValue:f,suppressErrors:t});return{...r,configDirectoryPath:Z,...l}},Oc=async e=>{const{config:t,sourceContent:u,sourcePath:n}=await cr(),D=n===Z;Ae(t),D&&n?await ir(t,n,u):await Jt({backupConfig:async()=>Zt(n,u),config:t,configDirectoryPath:Z,normalizeLegacyConfigKeys:Ae,writeConfig:ve});for(const[o,r]of e){const i=dc(o);if(i)throw new m(i);const s=lr(o);if(!s)throw new m(`Invalid config property: ${o}`);const c=Be[s](r);t[s]=c;const f=Yt[s]||[];for(const l of f)delete t[l]}await ve(t)};var Qt={},eu={exports:{}},$e={exports:{}},tu,fr;function Tc(){if(fr)return tu;fr=1;var e=1e3,t=e*60,u=t*60,n=u*24,D=n*7,o=n*365.25;tu=function(f,l){l=l||{};var a=typeof f;if(a==="string"&&f.length>0)return r(f);if(a==="number"&&isFinite(f))return l.long?s(f):i(f);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(f))};function r(f){if(f=String(f),!(f.length>100)){var l=/^(-?(?:\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(l){var a=parseFloat(l[1]),d=(l[2]||"ms").toLowerCase();switch(d){case"years":case"year":case"yrs":case"yr":case"y":return a*o;case"weeks":case"week":case"w":return a*D;case"days":case"day":case"d":return a*n;case"hours":case"hour":case"hrs":case"hr":case"h":return a*u;case"minutes":case"minute":case"mins":case"min":case"m":return a*t;case"seconds":case"second":case"secs":case"sec":case"s":return a*e;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return a;default:return}}}}function i(f){var l=Math.abs(f);return l>=n?Math.round(f/n)+"d":l>=u?Math.round(f/u)+"h":l>=t?Math.round(f/t)+"m":l>=e?Math.round(f/e)+"s":f+"ms"}function s(f){var l=Math.abs(f);return l>=n?c(f,l,n,"day"):l>=u?c(f,l,u,"hour"):l>=t?c(f,l,t,"minute"):l>=e?c(f,l,e,"second"):f+" ms"}function c(f,l,a,d){var F=l>=a*1.5;return Math.round(f/a)+" "+d+(F?"s":"")}return tu}var uu,dr;function Fr(){if(dr)return uu;dr=1;function e(t){n.debug=n,n.default=n,n.coerce=c,n.disable=i,n.enable=o,n.enabled=s,n.humanize=Tc(),n.destroy=f,Object.keys(t).forEach(l=>{n[l]=t[l]}),n.names=[],n.skips=[],n.formatters={};function u(l){let a=0;for(let d=0;d<l.length;d++)a=(a<<5)-a+l.charCodeAt(d),a|=0;return n.colors[Math.abs(a)%n.colors.length]}n.selectColor=u;function n(l){let a,d=null,F,h;function p(...C){if(!p.enabled)return;const b=p,v=Number(new Date),M=v-(a||v);b.diff=M,b.prev=a,b.curr=v,a=v,C[0]=n.coerce(C[0]),typeof C[0]!="string"&&C.unshift("%O");let O=0;C[0]=C[0].replace(/%([a-zA-Z%])/g,(E,w)=>{if(E==="%%")return"%";O++;const I=n.formatters[w];if(typeof I=="function"){const B=C[O];E=I.call(b,B),C.splice(O,1),O--}return E}),n.formatArgs.call(b,C),(b.log||n.log).apply(b,C)}return p.namespace=l,p.useColors=n.useColors(),p.color=n.selectColor(l),p.extend=D,p.destroy=n.destroy,Object.defineProperty(p,"enabled",{enumerable:!0,configurable:!1,get:()=>d!==null?d:(F!==n.namespaces&&(F=n.namespaces,h=n.enabled(l)),h),set:C=>{d=C}}),typeof n.init=="function"&&n.init(p),p}function D(l,a){const d=n(this.namespace+(typeof a>"u"?":":a)+l);return d.log=this.log,d}function o(l){n.save(l),n.namespaces=l,n.names=[],n.skips=[];const a=(typeof l=="string"?l:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(const d of a)d[0]==="-"?n.skips.push(d.slice(1)):n.names.push(d)}function r(l,a){let d=0,F=0,h=-1,p=0;for(;d<l.length;)if(F<a.length&&(a[F]===l[d]||a[F]==="*"))a[F]==="*"?(h=F,p=d,F++):(d++,F++);else if(h!==-1)F=h+1,p++,d=p;else return!1;for(;F<a.length&&a[F]==="*";)F++;return F===a.length}function i(){const l=[...n.names,...n.skips.map(a=>"-"+a)].join(",");return n.enable(""),l}function s(l){for(const a of n.skips)if(r(l,a))return!1;for(const a of n.names)if(r(l,a))return!0;return!1}function c(l){return l instanceof Error?l.stack||l.message:l}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 uu=e,uu}$e.exports;var pr;function Pc(){return pr||(pr=1,function(e,t){t.formatArgs=n,t.save=D,t.load=o,t.useColors=u,t.storage=r(),t.destroy=(()=>{let s=!1;return()=>{s||(s=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function u(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let s;return 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&&(s=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(s[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function n(s){if(s[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+s[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const c="color: "+this.color;s.splice(1,0,c,"color: inherit");let f=0,l=0;s[0].replace(/%[a-zA-Z%]/g,a=>{a!=="%%"&&(f++,a==="%c"&&(l=f))}),s.splice(l,0,c)}t.log=console.debug||console.log||(()=>{});function D(s){try{s?t.storage.setItem("debug",s):t.storage.removeItem("debug")}catch{}}function o(){let s;try{s=t.storage.getItem("debug")||t.storage.getItem("DEBUG")}catch{}return!s&&typeof process<"u"&&"env"in process&&(s=process.env.DEBUG),s}function r(){try{return localStorage}catch{}}e.exports=Fr()(t);const{formatters:i}=e.exports;i.j=function(s){try{return JSON.stringify(s)}catch(c){return"[UnexpectedJSONParseError]: "+c.message}}}($e,$e.exports)),$e.exports}var xe={exports:{}},nu,Cr;function Rc(){return Cr||(Cr=1,nu=(e,t=process.argv)=>{const u=e.startsWith("-")?"":e.length===1?"-":"--",n=t.indexOf(u+e),D=t.indexOf("--");return n!==-1&&(D===-1||n<D)}),nu}var ru,mr;function _c(){if(mr)return ru;mr=1;const e=Oe,t=Dt,u=Rc(),{env:n}=process;let D;u("no-color")||u("no-colors")||u("color=false")||u("color=never")?D=0:(u("color")||u("colors")||u("color=true")||u("color=always"))&&(D=1),"FORCE_COLOR"in n&&(n.FORCE_COLOR==="true"?D=1:n.FORCE_COLOR==="false"?D=0:D=n.FORCE_COLOR.length===0?1:Math.min(parseInt(n.FORCE_COLOR,10),3));function o(s){return s===0?!1:{level:s,hasBasic:!0,has256:s>=2,has16m:s>=3}}function r(s,c){if(D===0)return 0;if(u("color=16m")||u("color=full")||u("color=truecolor"))return 3;if(u("color=256"))return 2;if(s&&!c&&D===void 0)return 0;const f=D||0;if(n.TERM==="dumb")return f;if(process.platform==="win32"){const l=e.release().split(".");return Number(l[0])>=10&&Number(l[2])>=10586?Number(l[2])>=14931?3:2:1}if("CI"in n)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some(l=>l 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 l=parseInt((n.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(n.TERM_PROGRAM){case"iTerm.app":return l>=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 i(s){const c=r(s,s&&s.isTTY);return o(c)}return ru={supportsColor:i,stdout:o(r(!0,t.isatty(1))),stderr:o(r(!0,t.isatty(2)))},ru}xe.exports;var hr;function jc(){return hr||(hr=1,function(e,t){const u=Dt,n=yu;t.init=f,t.log=i,t.formatArgs=o,t.save=s,t.load=c,t.useColors=D,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 a=_c();a&&(a.stderr||a).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(a=>/^debug_/i.test(a)).reduce((a,d)=>{const F=d.substring(6).toLowerCase().replace(/_([a-z])/g,(p,C)=>C.toUpperCase());let h=process.env[d];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),a[F]=h,a},{});function D(){return"colors"in t.inspectOpts?!!t.inspectOpts.colors:u.isatty(process.stderr.fd)}function o(a){const{namespace:d,useColors:F}=this;if(F){const h=this.color,p="\x1B[3"+(h<8?h:"8;5;"+h),C=` ${p};1m${d} \x1B[0m`;a[0]=C+a[0].split(`
79
79
  `).join(`
80
80
  `+C),a.push(p+"m+"+e.exports.humanize(this.diff)+"\x1B[0m")}else a[0]=r()+d+" "+a[0]}function r(){return t.inspectOpts.hideDate?"":new Date().toISOString()+" "}function i(...a){return process.stderr.write(n.formatWithOptions(t.inspectOpts,...a)+`
81
- `)}function s(a){a?process.env.DEBUG=a:delete process.env.DEBUG}function c(){return process.env.DEBUG}function f(a){a.inspectOpts={};const d=Object.keys(t.inspectOpts);for(let F=0;F<d.length;F++)a.inspectOpts[d[F]]=t.inspectOpts[d[F]]}e.exports=dr()(t);const{formatters:l}=e.exports;l.o=function(a){return this.inspectOpts.colors=this.useColors,n.inspect(a,this.inspectOpts).split(`
82
- `).map(d=>d.trim()).join(" ")},l.O=function(a){return this.inspectOpts.colors=this.useColors,n.inspect(a,this.inspectOpts)}}(Ae,Ae.exports)),Ae.exports}typeof process>"u"||process.type==="renderer"||process.browser===!0||process.__nwjs?eu.exports=Tc():eu.exports=_c();var Du=eu.exports,ou={};Object.defineProperty(ou,"__esModule",{value:!0});function jc(e){return function(t,u){return new Promise((n,D)=>{e.call(this,t,u,(o,r)=>{o?D(o):n(r)})})}}ou.default=jc;var hr=_&&_.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};const Nc=gu,Lc=hr(Du),Gc=hr(ou),$e=Lc.default("agent-base");function Wc(e){return!!e&&typeof e.addRequest=="function"}function su(){const{stack:e}=new Error;return typeof e!="string"?!1:e.split(`
83
- `).some(t=>t.indexOf("(https.js:")!==-1||t.indexOf("node:https:")!==-1)}function Xe(e,t){return new Xe.Agent(e,t)}(function(e){class t extends Nc.EventEmitter{constructor(n,D){super();let o=D;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:su()?443:80}set defaultPort(n){this.explicitDefaultPort=n}get protocol(){return typeof this.explicitProtocol=="string"?this.explicitProtocol:su()?"https:":"http:"}set protocol(n){this.explicitProtocol=n}callback(n,D,o){throw new Error('"agent-base" has no default implementation, you must subclass and override `callback()`')}addRequest(n,D){const o=Object.assign({},D);typeof o.secureEndpoint!="boolean"&&(o.secureEndpoint=su()),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 r=!1,i=null;const s=o.timeout||this.timeout,c=d=>{n._hadError||(n.emit("error",d),n._hadError=!0)},f=()=>{i=null,r=!0;const d=new Error(`A "socket" was not created for HTTP request before ${s}ms`);d.code="ETIMEOUT",c(d)},l=d=>{r||(i!==null&&(clearTimeout(i),i=null),c(d))},a=d=>{if(r)return;if(i!=null&&(clearTimeout(i),i=null),Wc(d)){$e("Callback returned another Agent instance %o",d.constructor.name),d.addRequest(n,o);return}if(d){d.once("free",()=>{this.freeSocket(d,o)}),n.onSocket(d);return}const F=new Error(`no Duplex stream was returned to agent-base for \`${n.method} ${n.path}\``);c(F)};if(typeof this.callback!="function"){c(new Error("`callback` is not defined"));return}this.promisifiedCallback||(this.callback.length>=3?($e("Converting legacy callback function to promise"),this.promisifiedCallback=Gc.default(this.callback)):this.promisifiedCallback=this.callback),typeof s=="number"&&s>0&&(i=setTimeout(f,s)),"port"in o&&typeof o.port!="number"&&(o.port=Number(o.port));try{$e("Resolving socket for %o request: %o",o.protocol,`${n.method} ${n.path}`),Promise.resolve(this.promisifiedCallback(n,o)).then(a,l)}catch(d){Promise.reject(d).catch(l)}}freeSocket(n,D){$e("Freeing socket %o %o",n.constructor.name,D),n.destroy()}destroy(){$e("Destroying agent %o",this.constructor.name)}}e.Agent=t,e.prototype=e.Agent.prototype})(Xe||(Xe={}));var zc=Xe,iu={},Uc=_&&_.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(iu,"__esModule",{value:!0});const qc=Uc(Du),xe=qc.default("https-proxy-agent:parse-proxy-response");function Hc(e){return new Promise((t,u)=>{let n=0;const D=[];function o(){const l=e.read();l?f(l):e.once("readable",o)}function r(){e.removeListener("end",s),e.removeListener("error",c),e.removeListener("close",i),e.removeListener("readable",o)}function i(l){xe("onclose had error %o",l)}function s(){xe("onend")}function c(l){r(),xe("onerror %o",l),u(l)}function f(l){D.push(l),n+=l.length;const a=Buffer.concat(D,n);if(a.indexOf(`\r
81
+ `)}function s(a){a?process.env.DEBUG=a:delete process.env.DEBUG}function c(){return process.env.DEBUG}function f(a){a.inspectOpts={};const d=Object.keys(t.inspectOpts);for(let F=0;F<d.length;F++)a.inspectOpts[d[F]]=t.inspectOpts[d[F]]}e.exports=Fr()(t);const{formatters:l}=e.exports;l.o=function(a){return this.inspectOpts.colors=this.useColors,n.inspect(a,this.inspectOpts).split(`
82
+ `).map(d=>d.trim()).join(" ")},l.O=function(a){return this.inspectOpts.colors=this.useColors,n.inspect(a,this.inspectOpts)}}(xe,xe.exports)),xe.exports}typeof process>"u"||process.type==="renderer"||process.browser===!0||process.__nwjs?eu.exports=Pc():eu.exports=jc();var Du=eu.exports,ou={};Object.defineProperty(ou,"__esModule",{value:!0});function Nc(e){return function(t,u){return new Promise((n,D)=>{e.call(this,t,u,(o,r)=>{o?D(o):n(r)})})}}ou.default=Nc;var gr=_&&_.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};const Lc=Eu,Gc=gr(Du),Wc=gr(ou),Se=Gc.default("agent-base");function zc(e){return!!e&&typeof e.addRequest=="function"}function su(){const{stack:e}=new Error;return typeof e!="string"?!1:e.split(`
83
+ `).some(t=>t.indexOf("(https.js:")!==-1||t.indexOf("node:https:")!==-1)}function Xe(e,t){return new Xe.Agent(e,t)}(function(e){class t extends Lc.EventEmitter{constructor(n,D){super();let o=D;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:su()?443:80}set defaultPort(n){this.explicitDefaultPort=n}get protocol(){return typeof this.explicitProtocol=="string"?this.explicitProtocol:su()?"https:":"http:"}set protocol(n){this.explicitProtocol=n}callback(n,D,o){throw new Error('"agent-base" has no default implementation, you must subclass and override `callback()`')}addRequest(n,D){const o=Object.assign({},D);typeof o.secureEndpoint!="boolean"&&(o.secureEndpoint=su()),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 r=!1,i=null;const s=o.timeout||this.timeout,c=d=>{n._hadError||(n.emit("error",d),n._hadError=!0)},f=()=>{i=null,r=!0;const d=new Error(`A "socket" was not created for HTTP request before ${s}ms`);d.code="ETIMEOUT",c(d)},l=d=>{r||(i!==null&&(clearTimeout(i),i=null),c(d))},a=d=>{if(r)return;if(i!=null&&(clearTimeout(i),i=null),zc(d)){Se("Callback returned another Agent instance %o",d.constructor.name),d.addRequest(n,o);return}if(d){d.once("free",()=>{this.freeSocket(d,o)}),n.onSocket(d);return}const F=new Error(`no Duplex stream was returned to agent-base for \`${n.method} ${n.path}\``);c(F)};if(typeof this.callback!="function"){c(new Error("`callback` is not defined"));return}this.promisifiedCallback||(this.callback.length>=3?(Se("Converting legacy callback function to promise"),this.promisifiedCallback=Wc.default(this.callback)):this.promisifiedCallback=this.callback),typeof s=="number"&&s>0&&(i=setTimeout(f,s)),"port"in o&&typeof o.port!="number"&&(o.port=Number(o.port));try{Se("Resolving socket for %o request: %o",o.protocol,`${n.method} ${n.path}`),Promise.resolve(this.promisifiedCallback(n,o)).then(a,l)}catch(d){Promise.reject(d).catch(l)}}freeSocket(n,D){Se("Freeing socket %o %o",n.constructor.name,D),n.destroy()}destroy(){Se("Destroying agent %o",this.constructor.name)}}e.Agent=t,e.prototype=e.Agent.prototype})(Xe||(Xe={}));var Uc=Xe,iu={},qc=_&&_.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(iu,"__esModule",{value:!0});const Hc=qc(Du),ke=Hc.default("https-proxy-agent:parse-proxy-response");function Vc(e){return new Promise((t,u)=>{let n=0;const D=[];function o(){const l=e.read();l?f(l):e.once("readable",o)}function r(){e.removeListener("end",s),e.removeListener("error",c),e.removeListener("close",i),e.removeListener("readable",o)}function i(l){ke("onclose had error %o",l)}function s(){ke("onend")}function c(l){r(),ke("onerror %o",l),u(l)}function f(l){D.push(l),n+=l.length;const a=Buffer.concat(D,n);if(a.indexOf(`\r
84
84
  \r
85
- `)===-1){xe("have not received end of HTTP headers yet..."),o();return}const F=a.toString("ascii",0,a.indexOf(`\r
86
- `)),m=+F.split(" ")[1];xe("got proxy server response: %o",F),t({statusCode:m,buffered:a})}e.on("error",c),e.on("close",i),e.on("end",s),o()})}iu.default=Hc;var Vc=_&&_.__awaiter||function(e,t,u,n){function D(o){return o instanceof u?o:new u(function(r){r(o)})}return new(u||(u=Promise))(function(o,r){function i(f){try{c(n.next(f))}catch(l){r(l)}}function s(f){try{c(n.throw(f))}catch(l){r(l)}}function c(f){f.done?o(f.value):D(f.value).then(i,s)}c((n=n.apply(e,t||[])).next())})},de=_&&_.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Qt,"__esModule",{value:!0});const gr=de(nD),Er=de(rD),Kc=de(DD),Jc=de(hu),Yc=de(Du),Zc=zc,Xc=de(iu),Se=Yc.default("https-proxy-agent:agent");class Qc extends Zc.Agent{constructor(t){let u;if(typeof t=="string"?u=Kc.default.parse(t):u=t,!u)throw new Error("an HTTP(S) proxy server `host` and `port` must be specified!");Se("creating new HttpsProxyAgent instance: %o",u),super(u);const n=Object.assign({},u);this.secureProxy=u.secureProxy||ul(n.protocol),n.host=n.hostname||n.host,typeof n.port=="string"&&(n.port=parseInt(n.port,10)),!n.port&&n.host&&(n.port=this.secureProxy?443:80),this.secureProxy&&!("ALPNProtocols"in n)&&(n.ALPNProtocols=["http 1.1"]),n.host&&n.path&&(delete n.path,delete n.pathname),this.proxy=n}callback(t,u){return Vc(this,void 0,void 0,function*(){const{proxy:n,secureProxy:D}=this;let o;D?(Se("Creating `tls.Socket`: %o",n),o=Er.default.connect(n)):(Se("Creating `net.Socket`: %o",n),o=gr.default.connect(n));const r=Object.assign({},n.headers);let s=`CONNECT ${`${u.host}:${u.port}`} HTTP/1.1\r
87
- `;n.auth&&(r["Proxy-Authorization"]=`Basic ${Buffer.from(n.auth).toString("base64")}`);let{host:c,port:f,secureEndpoint:l}=u;tl(f,l)||(c+=`:${f}`),r.Host=c,r.Connection="close";for(const p of Object.keys(r))s+=`${p}: ${r[p]}\r
88
- `;const a=Xc.default(o);o.write(`${s}\r
89
- `);const{statusCode:d,buffered:F}=yield a;if(d===200){if(t.once("socket",el),u.secureEndpoint){Se("Upgrading socket connection to TLS");const p=u.servername||u.host;return Er.default.connect(Object.assign(Object.assign({},nl(u,"host","hostname","path","port")),{socket:o,servername:p}))}return o}o.destroy();const m=new gr.default.Socket({writable:!1});return m.readable=!0,t.once("socket",p=>{Se("replaying proxy buffer for failed request"),Jc.default(p.listenerCount("data")>0),p.push(F),p.push(null)}),m})}}Qt.default=Qc;function el(e){e.resume()}function tl(e,t){return!!(!t&&e===80||t&&e===443)}function ul(e){return typeof e=="string"?/^https:?$/i.test(e):!1}function nl(e,...t){const u={};let n;for(n in e)t.includes(n)||(u[n]=e[n]);return u}var rl=_&&_.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};const au=rl(Qt);function cu(e){return new au.default(e)}(function(e){e.HttpsProxyAgent=au.default,e.prototype=au.default.prototype})(cu||(cu={}));var Dl=cu,ol=se(Dl);const sl=e=>{if(!e||e.length===0)return"";const t=e.map(D=>D.trim()).filter(Boolean);if(t.length===0)return"";const u=t.slice(0,12),n=t.length-u.length;return["Changed files:",...u.map(D=>`- ${D}`),...n>0?[`- ...and ${n} more file(s)`]:[]].join(`
90
- `)},yr=e=>{const t=(e.rewriteFeedbackHistory??[]).map(n=>n.trim()).filter(Boolean);if(t.length>0)return t;const u=e.rewriteFeedback?.trim();return u?[u]:[]},il=e=>["Generate a git commit message for the provided code diff.","The output will be passed directly into git commit.","Return ONLY the final commit message text.","Do not add explanations, quotes, markdown fences, or surrounding commentary.","You may use the changed file list as supporting context, but the diff is the source of truth.",...e.diffWasCompacted?["The diff may be compacted to fit the model context. Infer the dominant outcome from the available patches without pretending to have seen omitted content."]:[],sl(e.changedFiles),...(e.rewriteConversation??[]).length>0?["This may be a revision request with prior assistant drafts and user feedback included in the conversation input.","Treat the conversation turns as the canonical rewrite history. Preserve prior accepted constraints unless a later user turn changes them.","Revise the latest assistant draft instead of drafting a completely new message from scratch."]:[],...e.rewriteFromMessage?.trim()&&yr(e).length>0?["You already suggested a commit message and now need to revise it.",["Current suggested commit message:",e.rewriteFromMessage.trim()].join(`
91
- `),["User rewrite feedback history:",...yr(e).map((t,u)=>`${u+1}. ${t}`)].join(`
85
+ `)===-1){ke("have not received end of HTTP headers yet..."),o();return}const F=a.toString("ascii",0,a.indexOf(`\r
86
+ `)),h=+F.split(" ")[1];ke("got proxy server response: %o",F),t({statusCode:h,buffered:a})}e.on("error",c),e.on("close",i),e.on("end",s),o()})}iu.default=Vc;var Kc=_&&_.__awaiter||function(e,t,u,n){function D(o){return o instanceof u?o:new u(function(r){r(o)})}return new(u||(u=Promise))(function(o,r){function i(f){try{c(n.next(f))}catch(l){r(l)}}function s(f){try{c(n.throw(f))}catch(l){r(l)}}function c(f){f.done?o(f.value):D(f.value).then(i,s)}c((n=n.apply(e,t||[])).next())})},de=_&&_.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Qt,"__esModule",{value:!0});const Er=de(rD),yr=de(DD),Jc=de(oD),Yc=de(gu),Zc=de(Du),Xc=Uc,Qc=de(iu),Me=Zc.default("https-proxy-agent:agent");class el extends Xc.Agent{constructor(t){let u;if(typeof t=="string"?u=Jc.default.parse(t):u=t,!u)throw new Error("an HTTP(S) proxy server `host` and `port` must be specified!");Me("creating new HttpsProxyAgent instance: %o",u),super(u);const n=Object.assign({},u);this.secureProxy=u.secureProxy||nl(n.protocol),n.host=n.hostname||n.host,typeof n.port=="string"&&(n.port=parseInt(n.port,10)),!n.port&&n.host&&(n.port=this.secureProxy?443:80),this.secureProxy&&!("ALPNProtocols"in n)&&(n.ALPNProtocols=["http 1.1"]),n.host&&n.path&&(delete n.path,delete n.pathname),this.proxy=n}callback(t,u){return Kc(this,void 0,void 0,function*(){const{proxy:n,secureProxy:D}=this;let o;D?(Me("Creating `tls.Socket`: %o",n),o=yr.default.connect(n)):(Me("Creating `net.Socket`: %o",n),o=Er.default.connect(n));const r=Object.assign({},n.headers);let s=`CONNECT ${`${u.host}:${u.port}`} HTTP/1.1\r
87
+ `;n.auth&&(r["Proxy-Authorization"]=`Basic ${Buffer.from(n.auth).toString("base64")}`);let{host:c,port:f,secureEndpoint:l}=u;ul(f,l)||(c+=`:${f}`),r.Host=c,r.Connection="close";for(const p of Object.keys(r))s+=`${p}: ${r[p]}\r
88
+ `;const a=Qc.default(o);o.write(`${s}\r
89
+ `);const{statusCode:d,buffered:F}=yield a;if(d===200){if(t.once("socket",tl),u.secureEndpoint){Me("Upgrading socket connection to TLS");const p=u.servername||u.host;return yr.default.connect(Object.assign(Object.assign({},rl(u,"host","hostname","path","port")),{socket:o,servername:p}))}return o}o.destroy();const h=new Er.default.Socket({writable:!1});return h.readable=!0,t.once("socket",p=>{Me("replaying proxy buffer for failed request"),Yc.default(p.listenerCount("data")>0),p.push(F),p.push(null)}),h})}}Qt.default=el;function tl(e){e.resume()}function ul(e,t){return!!(!t&&e===80||t&&e===443)}function nl(e){return typeof e=="string"?/^https:?$/i.test(e):!1}function rl(e,...t){const u={};let n;for(n in e)t.includes(n)||(u[n]=e[n]);return u}var Dl=_&&_.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};const au=Dl(Qt);function cu(e){return new au.default(e)}(function(e){e.HttpsProxyAgent=au.default,e.prototype=au.default.prototype})(cu||(cu={}));var ol=cu,sl=se(ol);const il=e=>{if(!e||e.length===0)return"";const t=e.map(D=>D.trim()).filter(Boolean);if(t.length===0)return"";const u=t.slice(0,12),n=t.length-u.length;return["Changed files:",...u.map(D=>`- ${D}`),...n>0?[`- ...and ${n} more file(s)`]:[]].join(`
90
+ `)},br=e=>{const t=(e.rewriteFeedbackHistory??[]).map(n=>n.trim()).filter(Boolean);if(t.length>0)return t;const u=e.rewriteFeedback?.trim();return u?[u]:[]},al=e=>["Generate a git commit message for the provided code diff.","The output will be passed directly into git commit.","Return ONLY the final commit message text.","Do not add explanations, quotes, markdown fences, or surrounding commentary.","You may use the changed file list as supporting context, but the diff is the source of truth.",...e.diffWasCompacted?["The diff may be compacted to fit the model context. Infer the dominant outcome from the available patches without pretending to have seen omitted content."]:[],il(e.changedFiles),...(e.rewriteConversation??[]).length>0?["This may be a revision request with prior assistant drafts and user feedback included in the conversation input.","Treat the conversation turns as the canonical rewrite history. Preserve prior accepted constraints unless a later user turn changes them.","Revise the latest assistant draft instead of drafting a completely new message from scratch."]:[],...e.rewriteFromMessage?.trim()&&br(e).length>0?["You already suggested a commit message and now need to revise it.",["Current suggested commit message:",e.rewriteFromMessage.trim()].join(`
91
+ `),["User rewrite feedback history:",...br(e).map((t,u)=>`${u+1}. ${t}`)].join(`
92
92
  `),"For this revision, treat the user rewrite feedback as higher priority than the earlier style or formatting preferences.","Revise the existing commit message instead of drafting a completely new one from scratch. Preserve any parts that still fit the diff unless the feedback requires changing them.","Rewrite the commit message to address the feedback while staying faithful to the diff. If the feedback conflicts with the diff, prefer the diff and revise as closely as possible."]:[],"Markdown instructions:",e.messageInstructionsMarkdown.trim()].filter(Boolean).join(`
93
93
 
94
- `),al="<think>",cl="</think>",Qe=()=>({carry:"",inReasoningBlock:!1}),ll=(e,t)=>{const u=Math.min(e.length,t.length-1);for(let n=u;n>0;n-=1)if(t.startsWith(e.slice(-n)))return n;return 0},lu=(e,t)=>{let u=`${t.carry}${e}`;const n={carry:"",inReasoningBlock:t.inReasoningBlock};let D="",o="";for(;u.length>0;){const r=n.inReasoningBlock?cl:al,i=u.indexOf(r);if(i===-1){const c=ll(u,r),f=u.slice(0,u.length-c);n.inReasoningBlock?o+=f:D+=f,n.carry=u.slice(u.length-c);break}const s=u.slice(0,i);n.inReasoningBlock?o+=s:D+=s,n.inReasoningBlock=!n.inReasoningBlock,u=u.slice(i+r.length)}return{content:D,reasoning:o,state:n}},br=e=>({content:e.inReasoningBlock?"":e.carry,reasoning:e.inReasoningBlock?e.carry:"",state:Qe()}),fl=e=>{let t=Qe(),u="",n="";for(const o of e){const r=lu(o,t);u+=r.content,n+=r.reasoning,t=r.state}const D=br(t);return u+=D.content,n+=D.reasoning,{content:u,reasoning:n}},dl=e=>fl([e]).content,wr=async(e,t,u,n,D,o,r,i)=>new Promise((s,c)=>{const f=JSON.stringify(n),l={port:r??443,hostname:e,path:t,method:"POST",headers:{...u,"Content-Type":"application/json","Content-Length":Buffer.byteLength(f)},timeout:D,agent:o?ol(o):void 0},a=uD.request(l,d=>{const F=[];d.on("data",m=>{F.push(m),i?.(m.toString())}),d.on("end",()=>{s({request:a,response:d,data:Buffer.concat(F).toString()})})});a.on("error",c),a.on("timeout",()=>{a.destroy(),c(new h(`Time out error: request took over ${D}ms. Try increasing the \`timeout\` config, or checking your API provider status.`))}),a.write(f),a.end()}),Br=(e,t)=>{if(!e?.trim())throw new h("Please set your API base URL via `aicommits config set base-url=<https://...>`");const u=e.trim(),n=new URL(u),D=n.pathname.replace(/\/+$/,"");return{hostname:n.hostname,port:n.port?Number(n.port):443,path:`${D}${t}`}},Fl=e=>Br(e,"/chat/completions"),pl=e=>Br(e,"/responses"),Cl=async(e,t,u,n,D,o,r)=>{const i={...t,...r,stream:!0};let s="";const c=new Map,f=g=>{if(!o)return;const b=Array.isArray(g.choices)?g.choices:[];for(const w of b){if(typeof w!="object"||w===null)continue;const{delta:O}=w;if(typeof O!="object"||O===null)continue;const B=O,x=typeof B.reasoning_content=="string"?B.reasoning_content:typeof B.reasoning=="string"?B.reasoning:"";if(x&&o({kind:"reasoning",text:x}),typeof B.content=="string"&&B.content.length>0){const G=typeof w.index=="number"?w.index:0;if(x){o({kind:"content",text:B.content});continue}const X=c.get(G)||Qe(),P=lu(B.content,X);c.set(G,P.state),P.reasoning&&o({kind:"reasoning",text:P.reasoning}),P.content&&o({kind:"content",text:P.content})}}},l=g=>{if(!o)return;s+=g.replace(/\r\n/g,`
95
- `);let b=s.indexOf(`
94
+ `),cl="<think>",ll="</think>",Qe=()=>({carry:"",inReasoningBlock:!1}),fl=(e,t)=>{const u=Math.min(e.length,t.length-1);for(let n=u;n>0;n-=1)if(t.startsWith(e.slice(-n)))return n;return 0},lu=(e,t)=>{let u=`${t.carry}${e}`;const n={carry:"",inReasoningBlock:t.inReasoningBlock};let D="",o="";for(;u.length>0;){const r=n.inReasoningBlock?ll:cl,i=u.indexOf(r);if(i===-1){const c=fl(u,r),f=u.slice(0,u.length-c);n.inReasoningBlock?o+=f:D+=f,n.carry=u.slice(u.length-c);break}const s=u.slice(0,i);n.inReasoningBlock?o+=s:D+=s,n.inReasoningBlock=!n.inReasoningBlock,u=u.slice(i+r.length)}return{content:D,reasoning:o,state:n}},wr=e=>({content:e.inReasoningBlock?"":e.carry,reasoning:e.inReasoningBlock?e.carry:"",state:Qe()}),dl=e=>{let t=Qe(),u="",n="";for(const o of e){const r=lu(o,t);u+=r.content,n+=r.reasoning,t=r.state}const D=wr(t);return u+=D.content,n+=D.reasoning,{content:u,reasoning:n}},Fl=e=>dl([e]).content,Br=async(e,t,u,n,D,o,r,i)=>new Promise((s,c)=>{const f=JSON.stringify(n),l={port:r??443,hostname:e,path:t,method:"POST",headers:{...u,"Content-Type":"application/json","Content-Length":Buffer.byteLength(f)},timeout:D,agent:o?sl(o):void 0},a=nD.request(l,d=>{const F=[];d.on("data",h=>{F.push(h),i?.(h.toString())}),d.on("end",()=>{s({request:a,response:d,data:Buffer.concat(F).toString()})})});a.on("error",c),a.on("timeout",()=>{a.destroy(),c(new m(`Time out error: request took over ${D}ms. Try increasing the \`timeout\` config, or checking your API provider status.`))}),a.write(f),a.end()}),vr=(e,t)=>{if(!e?.trim())throw new m("Please set your API base URL via `aicommits config set base-url=<https://...>`");const u=e.trim(),n=new URL(u),D=n.pathname.replace(/\/+$/,"");return{hostname:n.hostname,port:n.port?Number(n.port):443,path:`${D}${t}`}},pl=e=>vr(e,"/chat/completions"),Cl=e=>vr(e,"/responses"),ml=async(e,t,u,n,D,o,r)=>{const i={...t,...r,stream:!0};let s="";const c=new Map,f=g=>{if(!o)return;const E=Array.isArray(g.choices)?g.choices:[];for(const w of E){if(typeof w!="object"||w===null)continue;const{delta:I}=w;if(typeof I!="object"||I===null)continue;const B=I,$=typeof B.reasoning_content=="string"?B.reasoning_content:typeof B.reasoning=="string"?B.reasoning:"";if($&&o({kind:"reasoning",text:$}),typeof B.content=="string"&&B.content.length>0){const H=typeof w.index=="number"?w.index:0;if($){o({kind:"content",text:B.content});continue}const V=c.get(H)||Qe(),P=lu(B.content,V);c.set(H,P.state),P.reasoning&&o({kind:"reasoning",text:P.reasoning}),P.content&&o({kind:"content",text:P.content})}}},l=g=>{if(!o)return;s+=g.replace(/\r\n/g,`
95
+ `);let E=s.indexOf(`
96
96
 
97
- `);for(;b!==-1;){const w=s.slice(0,b);s=s.slice(b+2);for(const O of w.split(`
98
- `)){const B=O.trim();if(!B.startsWith("data:"))continue;const x=B.slice(5).trim();if(!(!x||x==="[DONE]"))try{const G=JSON.parse(x);f(G)}catch{}}b=s.indexOf(`
97
+ `);for(;E!==-1;){const w=s.slice(0,E);s=s.slice(E+2);for(const I of w.split(`
98
+ `)){const B=I.trim();if(!B.startsWith("data:"))continue;const $=B.slice(5).trim();if(!(!$||$==="[DONE]"))try{const H=JSON.parse($);f(H)}catch{}}E=s.indexOf(`
99
99
 
100
- `)}},a=Fl(D),{response:d,data:F}=await wr(a.hostname,a.path,{Authorization:`Bearer ${e}`},i,u,n,a.port,l);if(!d.statusCode||d.statusCode<200||d.statusCode>299){let g=`API Error: ${d.statusCode} - ${d.statusMessage}`;throw F&&(g+=`
100
+ `)}},a=pl(D),{response:d,data:F}=await Br(a.hostname,a.path,{Authorization:`Bearer ${e}`},i,u,n,a.port,l);if(!d.statusCode||d.statusCode<200||d.statusCode>299){let g=`API Error: ${d.statusCode} - ${d.statusMessage}`;throw F&&(g+=`
101
101
 
102
- ${F}`),new h(g)}const m=F.trim();if(!m)throw new h("API Error: Empty response body");if(m.startsWith("{")){const g=JSON.parse(m),b=Array.isArray(g.choices)?g.choices:[];return{model:typeof g.model=="string"?g.model:"",choices:b.map((w,O)=>{const B=typeof w=="object"&&w!==null?w:{},x=typeof B.message=="object"&&B.message!==null?B.message:{};return{index:typeof B.index=="number"?B.index:O,finish_reason:typeof B.finish_reason=="string"||B.finish_reason===null?B.finish_reason:void 0,message:{role:typeof x.role=="string"?x.role:"assistant",content:typeof x.content=="string"?x.content:"",...typeof x.reasoning_content=="string"?{reasoning_content:x.reasoning_content}:{}}}})}}const p=[];for(const g of m.split(/\r?\n/)){const b=g.trim();if(!b.startsWith("data:"))continue;const w=b.slice(5).trim();if(!(!w||w==="[DONE]"))try{p.push(JSON.parse(w))}catch{}}if(p.length===0)throw new h("API Error: Unable to parse streamed response");const C=p.find(g=>typeof g.error=="object"&&g.error!==null);if(C?.error&&typeof C.error=="object"&&C.error!==null){const g="message"in C.error&&typeof C.error.message=="string"?C.error.message:JSON.stringify(C.error);throw new h(`API Error: ${g}`)}const y=p.find(g=>typeof g.model=="string")||p[0],v=new Map,I=new Map;for(const g of p){const b=Array.isArray(g.choices)?g.choices:[];for(const w of b){if(typeof w!="object"||w===null)continue;const O=w,B=typeof O.index=="number"?O.index:0,x=v.get(B)||{index:B,contentParts:[],reasoningParts:[]},{delta:G}=O;if(typeof G=="object"&&G!==null){const P=G;if(typeof P.role=="string"&&(x.role=P.role),typeof P.content=="string")if(typeof P.reasoning_content=="string"||typeof P.reasoning=="string")x.contentParts.push(P.content);else{const Me=I.get(B)||Qe(),Q=lu(P.content,Me);I.set(B,Q.state),Q.content&&x.contentParts.push(Q.content),Q.reasoning&&x.reasoningParts.push(Q.reasoning)}typeof P.reasoning_content=="string"&&x.reasoningParts.push(P.reasoning_content),typeof P.reasoning=="string"&&x.reasoningParts.push(P.reasoning)}const X=O.finish_reason;(typeof X=="string"||X===null)&&(x.finishReason=X),v.set(B,x)}}for(const[g,b]of I.entries()){const w=v.get(g);if(!w)continue;const O=br(b);O.content&&w.contentParts.push(O.content),O.reasoning&&w.reasoningParts.push(O.reasoning)}const $=Array.from(v.values()).sort((g,b)=>g.index-b.index).map(g=>{const b={role:g.role||"assistant",content:g.contentParts.join("")},w=g.reasoningParts.join("");return w&&(b.reasoning_content=w),{index:g.index,finish_reason:g.finishReason??"stop",message:b}});if($.length===0)throw new h("API Error: Streamed response did not include any choices");return{model:typeof y.model=="string"?y.model:"",choices:$}},ml=(e,t)=>({model:e,messages:t}),vr=e=>{const t=(e.rewriteFeedbackHistory??[]).map(n=>n.trim()).filter(Boolean);if(t.length>0)return t;const u=e.rewriteFeedback?.trim();return u?[u]:[]},fu=e=>{const t=(e.rewriteConversation??[]).flatMap(D=>{if(!D||D.role!=="assistant"&&D.role!=="user")return[];const o=D.content.trim();return o?[{role:D.role,content:o}]:[]});if(t.length>0)return t;const u=e.rewriteFromMessage?.trim(),n=vr(e);return!u||n.length===0?[]:[{role:"assistant",content:u},{role:"user",content:hl(n)}]},hl=e=>["Revise your previous commit message instead of drafting a new one from scratch.","Keep the parts of your previous message that still fit the diff unless the feedback requires changing them.","Apply all of the following rewrite feedback, not just the latest item:",...e.map((t,u)=>`${u+1}. ${t}`),"Return only the revised final commit message text."].join(`
102
+ ${F}`),new m(g)}const h=F.trim();if(!h)throw new m("API Error: Empty response body");if(h.startsWith("{")){const g=JSON.parse(h),E=Array.isArray(g.choices)?g.choices:[];return{model:typeof g.model=="string"?g.model:"",choices:E.map((w,I)=>{const B=typeof w=="object"&&w!==null?w:{},$=typeof B.message=="object"&&B.message!==null?B.message:{};return{index:typeof B.index=="number"?B.index:I,finish_reason:typeof B.finish_reason=="string"||B.finish_reason===null?B.finish_reason:void 0,message:{role:typeof $.role=="string"?$.role:"assistant",content:typeof $.content=="string"?$.content:"",...typeof $.reasoning_content=="string"?{reasoning_content:$.reasoning_content}:{}}}})}}const p=[];for(const g of h.split(/\r?\n/)){const E=g.trim();if(!E.startsWith("data:"))continue;const w=E.slice(5).trim();if(!(!w||w==="[DONE]"))try{p.push(JSON.parse(w))}catch{}}if(p.length===0)throw new m("API Error: Unable to parse streamed response");const C=p.find(g=>typeof g.error=="object"&&g.error!==null);if(C?.error&&typeof C.error=="object"&&C.error!==null){const g="message"in C.error&&typeof C.error.message=="string"?C.error.message:JSON.stringify(C.error);throw new m(`API Error: ${g}`)}const b=p.find(g=>typeof g.model=="string")||p[0],v=new Map,M=new Map;for(const g of p){const E=Array.isArray(g.choices)?g.choices:[];for(const w of E){if(typeof w!="object"||w===null)continue;const I=w,B=typeof I.index=="number"?I.index:0,$=v.get(B)||{index:B,contentParts:[],reasoningParts:[]},{delta:H}=I;if(typeof H=="object"&&H!==null){const P=H;if(typeof P.role=="string"&&($.role=P.role),typeof P.content=="string")if(typeof P.reasoning_content=="string"||typeof P.reasoning=="string")$.contentParts.push(P.content);else{const Fe=M.get(B)||Qe(),Q=lu(P.content,Fe);M.set(B,Q.state),Q.content&&$.contentParts.push(Q.content),Q.reasoning&&$.reasoningParts.push(Q.reasoning)}typeof P.reasoning_content=="string"&&$.reasoningParts.push(P.reasoning_content),typeof P.reasoning=="string"&&$.reasoningParts.push(P.reasoning)}const V=I.finish_reason;(typeof V=="string"||V===null)&&($.finishReason=V),v.set(B,$)}}for(const[g,E]of M.entries()){const w=v.get(g);if(!w)continue;const I=wr(E);I.content&&w.contentParts.push(I.content),I.reasoning&&w.reasoningParts.push(I.reasoning)}const O=Array.from(v.values()).sort((g,E)=>g.index-E.index).map(g=>{const E={role:g.role||"assistant",content:g.contentParts.join("")},w=g.reasoningParts.join("");return w&&(E.reasoning_content=w),{index:g.index,finish_reason:g.finishReason??"stop",message:E}});if(O.length===0)throw new m("API Error: Streamed response did not include any choices");return{model:typeof b.model=="string"?b.model:"",choices:O}},hl=(e,t)=>({model:e,messages:t}),Ar=e=>{const t=(e.rewriteFeedbackHistory??[]).map(n=>n.trim()).filter(Boolean);if(t.length>0)return t;const u=e.rewriteFeedback?.trim();return u?[u]:[]},fu=e=>{const t=(e.rewriteConversation??[]).flatMap(D=>{if(!D||D.role!=="assistant"&&D.role!=="user")return[];const o=D.content.trim();return o?[{role:D.role,content:o}]:[]});if(t.length>0)return t;const u=e.rewriteFromMessage?.trim(),n=Ar(e);return!u||n.length===0?[]:[{role:"assistant",content:u},{role:"user",content:gl(n)}]},gl=e=>["Revise your previous commit message instead of drafting a new one from scratch.","Keep the parts of your previous message that still fit the diff unless the feedback requires changing them.","Apply all of the following rewrite feedback, not just the latest item:",...e.map((t,u)=>`${u+1}. ${t}`),"Return only the revised final commit message text."].join(`
103
103
 
104
- `),gl=(e,t,u)=>{const n=fu(u);return n.length===0?[{role:"system",content:e},{role:"user",content:t}]:[{role:"system",content:e},{role:"user",content:t},...n]},El=(e,t,u)=>({model:e,instructions:t,input:u}),yl=(e,t)=>{const u=fu(t);return u.length===0?e:[{role:"user",content:e},...u]},Ar=e=>Array.isArray(e)?e.flatMap(t=>{if(typeof t!="object"||t===null)return[];const u="text"in t&&typeof t.text=="string"?t.text:"";return u?[u]:[]}).join(""):"",$r=e=>{const t=Array.isArray(e.output)?e.output:[],u=t.filter(D=>D?.type==="message"||D?.role==="assistant").map(D=>Ar(D.content)).join(""),n=t.filter(D=>D?.type==="reasoning").map(D=>Ar(D.summary)).join("");return{model:typeof e.model=="string"?e.model:"",choices:[{index:0,finish_reason:"stop",message:{role:"assistant",content:u,...n?{reasoning_content:n}:{}}}]}},bl=e=>{const t=e.find(D=>D.type==="response.completed");if(t&&typeof t.response=="object"&&t.response!==null)return $r(t.response);const u=e.filter(D=>typeof D.type=="string"&&D.type.includes("output_text")&&D.type.endsWith(".delta")&&typeof D.delta=="string").map(D=>D.delta).join(""),n=e.filter(D=>typeof D.type=="string"&&D.type.includes("reasoning")&&D.type.endsWith(".delta")&&typeof D.delta=="string").map(D=>D.delta).join("");return{model:"",choices:[{index:0,finish_reason:"stop",message:{role:"assistant",content:u,...n?{reasoning_content:n}:{}}}]}},wl=async(e,t,u,n,D,o,r)=>{const i={...t,...r,stream:!0};let s="";const c=C=>{if(!(!o||typeof C.type!="string")){if(C.type.includes("reasoning")&&C.type.endsWith(".delta")&&typeof C.delta=="string"){o({kind:"reasoning",text:C.delta});return}C.type.includes("output_text")&&C.type.endsWith(".delta")&&typeof C.delta=="string"&&o({kind:"content",text:C.delta})}},f=C=>{if(!o)return;s+=C.replace(/\r\n/g,`
105
- `);let y=s.indexOf(`
104
+ `),El=(e,t,u)=>{const n=fu(u);return n.length===0?[{role:"system",content:e},{role:"user",content:t}]:[{role:"system",content:e},{role:"user",content:t},...n]},yl=(e,t,u)=>({model:e,instructions:t,input:u}),bl=(e,t)=>{const u=fu(t);return u.length===0?e:[{role:"user",content:e},...u]},$r=e=>Array.isArray(e)?e.flatMap(t=>{if(typeof t!="object"||t===null)return[];const u="text"in t&&typeof t.text=="string"?t.text:"";return u?[u]:[]}).join(""):"",xr=e=>{const t=Array.isArray(e.output)?e.output:[],u=t.filter(D=>D?.type==="message"||D?.role==="assistant").map(D=>$r(D.content)).join(""),n=t.filter(D=>D?.type==="reasoning").map(D=>$r(D.summary)).join("");return{model:typeof e.model=="string"?e.model:"",choices:[{index:0,finish_reason:"stop",message:{role:"assistant",content:u,...n?{reasoning_content:n}:{}}}]}},wl=e=>{const t=e.find(D=>D.type==="response.completed");if(t&&typeof t.response=="object"&&t.response!==null)return xr(t.response);const u=e.filter(D=>typeof D.type=="string"&&D.type.includes("output_text")&&D.type.endsWith(".delta")&&typeof D.delta=="string").map(D=>D.delta).join(""),n=e.filter(D=>typeof D.type=="string"&&D.type.includes("reasoning")&&D.type.endsWith(".delta")&&typeof D.delta=="string").map(D=>D.delta).join("");return{model:"",choices:[{index:0,finish_reason:"stop",message:{role:"assistant",content:u,...n?{reasoning_content:n}:{}}}]}},Bl=async(e,t,u,n,D,o,r)=>{const i={...t,...r,stream:!0};let s="";const c=C=>{if(!(!o||typeof C.type!="string")){if(C.type.includes("reasoning")&&C.type.endsWith(".delta")&&typeof C.delta=="string"){o({kind:"reasoning",text:C.delta});return}C.type.includes("output_text")&&C.type.endsWith(".delta")&&typeof C.delta=="string"&&o({kind:"content",text:C.delta})}},f=C=>{if(!o)return;s+=C.replace(/\r\n/g,`
105
+ `);let b=s.indexOf(`
106
106
 
107
- `);for(;y!==-1;){const v=s.slice(0,y);s=s.slice(y+2);for(const I of v.split(`
108
- `)){const $=I.trim();if(!$.startsWith("data:"))continue;const g=$.slice(5).trim();if(!(!g||g==="[DONE]"))try{c(JSON.parse(g))}catch{}}y=s.indexOf(`
107
+ `);for(;b!==-1;){const v=s.slice(0,b);s=s.slice(b+2);for(const M of v.split(`
108
+ `)){const O=M.trim();if(!O.startsWith("data:"))continue;const g=O.slice(5).trim();if(!(!g||g==="[DONE]"))try{c(JSON.parse(g))}catch{}}b=s.indexOf(`
109
109
 
110
- `)}},l=pl(D),{response:a,data:d}=await wr(l.hostname,l.path,{Authorization:`Bearer ${e}`},i,u,n,l.port,f);if(!a.statusCode||a.statusCode<200||a.statusCode>299){let C=`API Error: ${a.statusCode} - ${a.statusMessage}`;throw d&&(C+=`
110
+ `)}},l=Cl(D),{response:a,data:d}=await Br(l.hostname,l.path,{Authorization:`Bearer ${e}`},i,u,n,l.port,f);if(!a.statusCode||a.statusCode<200||a.statusCode>299){let C=`API Error: ${a.statusCode} - ${a.statusMessage}`;throw d&&(C+=`
111
111
 
112
- ${d}`),new h(C)}const F=d.trim();if(!F)throw new h("API Error: Empty response body");if(F.startsWith("{"))return $r(JSON.parse(F));const m=[];for(const C of F.split(/\r?\n/)){const y=C.trim();if(!y.startsWith("data:"))continue;const v=y.slice(5).trim();if(!(!v||v==="[DONE]"))try{m.push(JSON.parse(v))}catch{}}if(m.length===0)throw new h("API Error: Unable to parse streamed response");const p=m.find(C=>C.type==="error"||typeof C.error=="object"&&C.error!==null);if(p){if(typeof p.error=="object"&&p.error!==null){const C="message"in p.error&&typeof p.error.message=="string"?p.error.message:JSON.stringify(p.error);throw new h(`API Error: ${C}`)}if(typeof p.message=="string")throw new h(`API Error: ${p.message}`)}return bl(m)},du=e=>e.replace(/\r\n?/g,`
113
- `),Bl=e=>{const t=e.match(/```[\w-]*\n([\s\S]*?)```/);return t?.[1]?t[1].trim():e.replace(/```/g,"").trim()},vl=e=>e.trim().replace(/^title:\s*/i,"").replace(/(\w)\.$/,"$1").replace(/^["'`]|["'`]$/g,""),Al=e=>{const t=du(e).trim();if(!t)return{title:"",body:""};const u=t.split(`
114
- `).map(o=>o.replace(/\s+$/g,""));for(;u[0]?.trim()==="";)u.shift();const n=vl(u.shift()||"");for(;u[0]?.trim()==="";)u.shift();u[0]?.trim().toLowerCase().startsWith("body:")&&(u[0]=u[0].replace(/^body:\s*/i,""));const D=u.join(`
115
- `).trim();return{title:n,body:D}},$l=(e,t)=>t?`${e}
112
+ ${d}`),new m(C)}const F=d.trim();if(!F)throw new m("API Error: Empty response body");if(F.startsWith("{"))return xr(JSON.parse(F));const h=[];for(const C of F.split(/\r?\n/)){const b=C.trim();if(!b.startsWith("data:"))continue;const v=b.slice(5).trim();if(!(!v||v==="[DONE]"))try{h.push(JSON.parse(v))}catch{}}if(h.length===0)throw new m("API Error: Unable to parse streamed response");const p=h.find(C=>C.type==="error"||typeof C.error=="object"&&C.error!==null);if(p){if(typeof p.error=="object"&&p.error!==null){const C="message"in p.error&&typeof p.error.message=="string"?p.error.message:JSON.stringify(p.error);throw new m(`API Error: ${C}`)}if(typeof p.message=="string")throw new m(`API Error: ${p.message}`)}return wl(h)},du=e=>e.replace(/\r\n?/g,`
113
+ `),vl=e=>{const t=e.match(/```[\w-]*\n([\s\S]*?)```/);return t?.[1]?t[1].trim():e.replace(/```/g,"").trim()},Al=e=>e.trim().replace(/^title:\s*/i,"").replace(/(\w)\.$/,"$1").replace(/^["'`]|["'`]$/g,""),$l=e=>{const t=du(e).trim();if(!t)return{title:"",body:""};const u=t.split(`
114
+ `).map(o=>o.replace(/\s+$/g,""));for(;u[0]?.trim()==="";)u.shift();const n=Al(u.shift()||"");for(;u[0]?.trim()==="";)u.shift();u[0]?.trim().toLowerCase().startsWith("body:")&&(u[0]=u[0].replace(/^body:\s*/i,""));const D=u.join(`
115
+ `).trim();return{title:n,body:D}},xl=(e,t)=>t?`${e}
116
116
 
117
- ${t}`:e,xl=(e,t,u,n)=>{const D=Bl(e),{title:o,body:r}=Al(D);if(!o)return"";const i=du(r).split(`
117
+ ${t}`:e,Sl=(e,t,u,n)=>{const D=vl(e),{title:o,body:r}=$l(D);if(!o)return"";const i=du(r).split(`
118
118
  `).map(s=>s.replace(/\s+$/u,"")).join(`
119
- `).trim();return i?$l(o,i):o},Sl=["none","low","medium","high","xhigh"],et=e=>{if(typeof e!="string")return;const t=e.trim().toLowerCase();return Sl.includes(t)?t:void 0},kl=(e,t)=>{if(!e?.trim())return{};let u;try{u=JSON.parse(e)}catch{throw new h("Invalid config property request-options: Must be valid JSON")}if(typeof u!="object"||u===null||Array.isArray(u))throw new h("Invalid config property request-options: Must be a JSON object");const n={...u};if(delete n.model,delete n.messages,delete n.input,delete n.instructions,delete n.stream,t==="responses"){const o=et(n.reasoning_effort);return o&&(typeof n.reasoning!="object"||n.reasoning===null||Array.isArray(n.reasoning))?n.reasoning={effort:o}:o&&typeof n.reasoning=="object"&&n.reasoning!==null&&!Array.isArray(n.reasoning)&&et(n.reasoning.effort)===void 0&&(n.reasoning={...n.reasoning,effort:o}),delete n.reasoning_effort,delete n.max_completion_tokens,n}const D=typeof n.reasoning=="object"&&n.reasoning!==null&&!Array.isArray(n.reasoning)?et(n.reasoning.effort):void 0;return D&&et(n.reasoning_effort)===void 0&&(n.reasoning_effort=D),delete n.reasoning,delete n.max_output_tokens,n},Ml=(e,t,u)=>{const n=kl(e,t);if(!u)return n;if(t==="responses"){const D=typeof n.reasoning=="object"&&n.reasoning!==null&&!Array.isArray(n.reasoning)?n.reasoning:{};return{...n,reasoning:{...D,effort:u}}}return{...n,reasoning_effort:u}},Il=e=>Array.from(new Set(e)),xr=12e4,Ol=1024,Tl=3,Pl=900,Rl=700,_l=450,jl=.85,tt="[Diff compacted to fit model context. Each file is represented with abbreviated hunks when needed.]",Sr="@@ ... patch content truncated ... @@",Nl=(e=0)=>{if(!Number.isInteger(e)||e<=0)return xr;const t=Pl+Rl+_l,u=Math.floor((e-t)*jl),n=Math.max(128,u);return Math.max(Ol,n*Tl)},Ll=e=>{const t=/^diff --git .+$/gm,u=Array.from(e.matchAll(t));if(u.length===0)return[e];const n=[],D=u[0]?.index??0;if(D>0){const o=e.slice(0,D).trim();o&&n.push(o)}for(const[o,r]of u.entries()){const i=r.index??0,s=u[o+1]?.index??e.length,c=e.slice(i,s).trim();c&&n.push(c)}return n},kr=(e,t)=>{if(t<=0)return"";if(e.length<=t)return e;const u=Sr.length+2;if(t<=u)return e.slice(0,t);const n=t-u,D=Math.floor(n*.7),o=Math.min(60,n),r=Math.min(40,Math.max(0,n-o)),i=Math.max(o,Math.min(D,n-r)),s=n-i;if(s<=0)return e.slice(0,t);const c=e.slice(0,i).trimEnd(),f=e.slice(-s).trimStart();return f?`${c}
120
- ${Sr}
121
- ${f}`.slice(0,t):e.slice(0,t)},Gl=(e,t=xr)=>{const u=du(e).trim();if(!u)return u;if(t<=0)return"";const n=tt.length+2;if(u.length<=t)return u;if(t<=n)return u.slice(0,t);const D=t-n,o=Ll(u);if(o.length<=1)return`${kr(u,D)}
119
+ `).trim();return i?xl(o,i):o},kl=["none","low","medium","high","xhigh"],et=e=>{if(typeof e!="string")return;const t=e.trim().toLowerCase();return kl.includes(t)?t:void 0},Ml=(e,t)=>{if(!e?.trim())return{};let u;try{u=JSON.parse(e)}catch{throw new m("Invalid config property request-options: Must be valid JSON")}if(typeof u!="object"||u===null||Array.isArray(u))throw new m("Invalid config property request-options: Must be a JSON object");const n={...u};if(delete n.model,delete n.messages,delete n.input,delete n.instructions,delete n.stream,t==="responses"){const o=et(n.reasoning_effort);return o&&(typeof n.reasoning!="object"||n.reasoning===null||Array.isArray(n.reasoning))?n.reasoning={effort:o}:o&&typeof n.reasoning=="object"&&n.reasoning!==null&&!Array.isArray(n.reasoning)&&et(n.reasoning.effort)===void 0&&(n.reasoning={...n.reasoning,effort:o}),delete n.reasoning_effort,delete n.max_completion_tokens,n}const D=typeof n.reasoning=="object"&&n.reasoning!==null&&!Array.isArray(n.reasoning)?et(n.reasoning.effort):void 0;return D&&et(n.reasoning_effort)===void 0&&(n.reasoning_effort=D),delete n.reasoning,delete n.max_output_tokens,n},Il=(e,t,u)=>{const n=Ml(e,t);if(!u)return n;if(t==="responses"){const D=typeof n.reasoning=="object"&&n.reasoning!==null&&!Array.isArray(n.reasoning)?n.reasoning:{};return{...n,reasoning:{...D,effort:u}}}return{...n,reasoning_effort:u}},Ol=e=>Array.from(new Set(e)),Sr=12e4,Tl=1024,Pl=3,Rl=900,_l=700,jl=450,Nl=.85,tt="[Diff compacted to fit model context. Each file is represented with abbreviated hunks when needed.]",kr="@@ ... patch content truncated ... @@",Ll=(e=0)=>{if(!Number.isInteger(e)||e<=0)return Sr;const t=Rl+_l+jl,u=Math.floor((e-t)*Nl),n=Math.max(128,u);return Math.max(Tl,n*Pl)},Gl=e=>{const t=/^diff --git .+$/gm,u=Array.from(e.matchAll(t));if(u.length===0)return[e];const n=[],D=u[0]?.index??0;if(D>0){const o=e.slice(0,D).trim();o&&n.push(o)}for(const[o,r]of u.entries()){const i=r.index??0,s=u[o+1]?.index??e.length,c=e.slice(i,s).trim();c&&n.push(c)}return n},Mr=(e,t)=>{if(t<=0)return"";if(e.length<=t)return e;const u=kr.length+2;if(t<=u)return e.slice(0,t);const n=t-u,D=Math.floor(n*.7),o=Math.min(60,n),r=Math.min(40,Math.max(0,n-o)),i=Math.max(o,Math.min(D,n-r)),s=n-i;if(s<=0)return e.slice(0,t);const c=e.slice(0,i).trimEnd(),f=e.slice(-s).trimStart();return f?`${c}
120
+ ${kr}
121
+ ${f}`.slice(0,t):e.slice(0,t)},Wl=(e,t=Sr)=>{const u=du(e).trim();if(!u)return u;if(t<=0)return"";const n=tt.length+2;if(u.length<=t)return u;if(t<=n)return u.slice(0,t);const D=t-n,o=Gl(u);if(o.length<=1)return`${Mr(u,D)}
122
122
 
123
123
  ${tt}`;const r=`
124
124
 
125
- `,i=r.length*Math.max(0,o.length-1),s=Math.max(1,D-i),c=Math.max(1,Math.floor(s/o.length));return`${o.map(a=>kr(a,c)).filter(Boolean).join(r)}
125
+ `,i=r.length*Math.max(0,o.length-1),s=Math.max(1,D-i),c=Math.max(1,Math.floor(s/o.length));return`${o.map(a=>Mr(a,c)).filter(Boolean).join(r)}
126
126
 
127
- ${tt}`},Mr=async(e,t,u,n,D,o,r,i)=>{const s=r??{messageInstructionsMarkdown:""},c=s.apiMode??"responses",f=Ml(s.requestOptionsJson,c,s.reasoningEffort),l=Nl(s.contextWindowTokens),a=Gl(u,l),d=a.includes(tt),F=vr(s),m=fu(s);try{const p=Wl({messageInstructionsMarkdown:s.messageInstructionsMarkdown||"",changedFiles:s.changedFiles,diffWasCompacted:d,rewriteFromMessage:s.rewriteFromMessage,rewriteFeedback:s.rewriteFeedback,rewriteFeedbackHistory:F,rewriteConversation:m}),C=Math.max(1,n),v=(await Promise.all(Array.from({length:C},()=>c==="responses"?wl(e,El(t,p,yl(a,{rewriteConversation:m,rewriteFromMessage:s.rewriteFromMessage,rewriteFeedback:s.rewriteFeedback,rewriteFeedbackHistory:F})),D,o,i,I=>s.onStreamEvent?.({phase:"message",...I}),f):Cl(e,ml(t,gl(p,a,{rewriteConversation:m,rewriteFromMessage:s.rewriteFromMessage,rewriteFeedback:s.rewriteFeedback,rewriteFeedbackHistory:F})),D,o,i,I=>s.onStreamEvent?.({phase:"message",...I}),f)))).flatMap(I=>I.choices).flatMap(I=>{const $=I.message?.content;if(typeof $!="string")return[];const g=xl(dl($));return g?[g]:[]});return Il(v)}catch(p){const C=p;throw C.code==="ENOTFOUND"?new h(`Error connecting to ${C.hostname} (${C.syscall}). Are you connected to the internet?`):C}},Wl=e=>il({messageInstructionsMarkdown:e.messageInstructionsMarkdown||"",changedFiles:e.changedFiles,diffWasCompacted:e.diffWasCompacted,rewriteFromMessage:e.rewriteFromMessage,rewriteFeedback:e.rewriteFeedback,rewriteFeedbackHistory:e.rewriteFeedbackHistory,rewriteConversation:e.rewriteConversation}),Ir=()=>{const e=["|","/","-","\\"],t=process.stdout.isTTY?120:1e4;let u=0,n="",D=!1,o;const r=Pi("\u2502"),i=c=>{if(!process.stdout.isTTY){process.stdout.write(`${c}
128
- `);return}process.stdout.write(`\r\x1B[2K${c}`)},s=()=>{const c=e[u];i(`${Ti("\u25C6")} ${c} ${n}`),u=(u+1)%e.length};return{start(c){if(n=c,D){s();return}if(D=!0,process.stdout.isTTY){process.stdout.write(`${r}
129
- `),s(),o=setInterval(s,t);return}i(n)},update(c){n=c,!(!D||!process.stdout.isTTY)&&s()},stop(c){if(D){if(D=!1,o&&(clearInterval(o),o=void 0),process.stdout.isTTY){const f=c.split(/\r?\n/),l=f.shift()??"";process.stdout.write(`\r\x1B[2K${qe("\u25C6")} ${l}
127
+ ${tt}`},Ir=async(e,t,u,n,D,o,r,i)=>{const s=r??{messageInstructionsMarkdown:""},c=s.apiMode??"responses",f=Il(s.requestOptionsJson,c,s.reasoningEffort),l=Ll(s.contextWindowTokens),a=Wl(u,l),d=a.includes(tt),F=Ar(s),h=fu(s);try{const p=zl({messageInstructionsMarkdown:s.messageInstructionsMarkdown||"",changedFiles:s.changedFiles,diffWasCompacted:d,rewriteFromMessage:s.rewriteFromMessage,rewriteFeedback:s.rewriteFeedback,rewriteFeedbackHistory:F,rewriteConversation:h}),C=Math.max(1,n),v=(await Promise.all(Array.from({length:C},()=>c==="responses"?Bl(e,yl(t,p,bl(a,{rewriteConversation:h,rewriteFromMessage:s.rewriteFromMessage,rewriteFeedback:s.rewriteFeedback,rewriteFeedbackHistory:F})),D,o,i,M=>s.onStreamEvent?.({phase:"message",...M}),f):ml(e,hl(t,El(p,a,{rewriteConversation:h,rewriteFromMessage:s.rewriteFromMessage,rewriteFeedback:s.rewriteFeedback,rewriteFeedbackHistory:F})),D,o,i,M=>s.onStreamEvent?.({phase:"message",...M}),f)))).flatMap(M=>M.choices).flatMap(M=>{const O=M.message?.content;if(typeof O!="string")return[];const g=Sl(Fl(O));return g?[g]:[]});return Ol(v)}catch(p){const C=p;throw C.code==="ENOTFOUND"?new m(`Error connecting to ${C.hostname} (${C.syscall}). Are you connected to the internet?`):C}},zl=e=>al({messageInstructionsMarkdown:e.messageInstructionsMarkdown||"",changedFiles:e.changedFiles,diffWasCompacted:e.diffWasCompacted,rewriteFromMessage:e.rewriteFromMessage,rewriteFeedback:e.rewriteFeedback,rewriteFeedbackHistory:e.rewriteFeedbackHistory,rewriteConversation:e.rewriteConversation}),Or=()=>{const e=["|","/","-","\\"],t=process.stdout.isTTY?120:1e4;let u=0,n="",D=!1,o;const r=Ri("\u2502"),i=c=>{if(!process.stdout.isTTY){process.stdout.write(`${c}
128
+ `);return}process.stdout.write(`\r\x1B[2K${c}`)},s=()=>{const c=e[u];i(`${Pi("\u25C6")} ${c} ${n}`),u=(u+1)%e.length};return{start(c){if(n=c,D){s();return}if(D=!0,process.stdout.isTTY){process.stdout.write(`${r}
129
+ `),s(),o=setInterval(s,t);return}i(n)},update(c){n=c,!(!D||!process.stdout.isTTY)&&s()},stop(c){if(D){if(D=!1,o&&(clearInterval(o),o=void 0),process.stdout.isTTY){const f=c.split(/\r?\n/),l=f.shift()??"";process.stdout.write(`\r\x1B[2K${ye("\u25C6")} ${l}
130
130
  `);for(const a of f)process.stdout.write(`${r} ${a}
131
131
  `);return}process.stdout.write(`${c}
132
- `)}}}},zl=e=>e.replace(/\s+$/u,""),Or=async(e,t,u)=>{if(!t)return e;const n=await q(t,[],{cwd:u.cwd,input:e,reject:!1,env:{AICOMMITS_CWD:u.cwd,AICOMMITS_CONFIG_DIR:u.configDirectoryPath,AICOMMITS_MESSAGE_FILE:u.messageFilePath,AICOMMITS_CANDIDATE_INDEX:String(u.candidateIndex),AICOMMITS_CANDIDATE_COUNT:String(u.candidateCount),AICOMMITS_COMMIT_SOURCE:u.commitSource}});if(n.exitCode!==0){const o=n.stderr.trim();throw new h(o?`Post-response script failed: ${o}`:`Post-response script failed with exit code ${n.exitCode}.`)}const D=zl(n.stdout);if(!D)throw new h("Post-response script produced an empty commit message.");return D},Tr="\0use-commit-message",Ul="\0rewrite-commit-message",ut="\0cancel",Pr="\0back",ql=async(e,t)=>{const u=await e.text({message:"Tell the AI how to rewrite this commit message:",placeholder:"Example: keep it shorter, mention the scope, and use feat instead of refactor",validate(n){if(n.trim().length===0)return"Rewrite feedback is required."}});return e.isCancel(u)?{status:"cancelled"}:{status:"rewrite",message:t,feedback:u.trim()}},Rr=async(e,t,u)=>{const n=await e.select({message:`Review this commit message:
132
+ `)}}}},Ul=e=>e.replace(/\s+$/u,""),Tr=async(e,t,u)=>{if(!t)return e;const n=await U(t,[],{cwd:u.cwd,input:e,reject:!1,env:{AICOMMITS_CWD:u.cwd,AICOMMITS_CONFIG_DIR:u.configDirectoryPath,AICOMMITS_MESSAGE_FILE:u.messageFilePath,AICOMMITS_CANDIDATE_INDEX:String(u.candidateIndex),AICOMMITS_CANDIDATE_COUNT:String(u.candidateCount),AICOMMITS_COMMIT_SOURCE:u.commitSource}});if(n.exitCode!==0){const o=n.stderr.trim();throw new m(o?`Post-response script failed: ${o}`:`Post-response script failed with exit code ${n.exitCode}.`)}const D=Ul(n.stdout);if(!D)throw new m("Post-response script produced an empty commit message.");return D},Pr="\0use-commit-message",ql="\0rewrite-commit-message",ut="\0cancel",Rr="\0back",Hl=async(e,t)=>{const u=await e.text({message:"Tell the AI how to rewrite this commit message:",placeholder:"Example: keep it shorter, mention the scope, and use feat instead of refactor",validate(n){if(n.trim().length===0)return"Rewrite feedback is required."}});return e.isCancel(u)?{status:"cancelled"}:{status:"rewrite",message:t,feedback:u.trim()}},_r=async(e,t,u)=>{const n=await e.select({message:`Review this commit message:
133
133
 
134
134
  ${t}
135
- `,options:[{label:"Use this commit message",value:Tr},{label:"Ask AI to rewrite it",hint:"Give feedback and regenerate",value:Ul},...u?[{label:"Back to suggestions",value:Pr}]:[],{label:"Cancel",value:ut}]});return e.isCancel(n)||n===ut?{status:"cancelled"}:n===Pr?{status:"back"}:n===Tr?{status:"submitted",message:t}:ql(e,t)},Hl=async(e,t)=>{if(e.length===1){const[n]=e,D=await Rr(t,n,!1);return D.status==="back"?{status:"cancelled"}:D}let u=!0;for(;u;){const n=await t.select({message:"Pick a commit message to review:",options:[...e.map(o=>({label:o,value:o})),{label:"Cancel",value:ut}]});if(t.isCancel(n)||n===ut)return{status:"cancelled"};const D=await Rr(t,n,!0);if(D.status!=="back")return u=!1,D}return{status:"cancelled"}},Vl=e=>Hl(e,{select:$a,text:Aa,isCancel:ia}),Kl=e=>{const t=Math.max(0,Math.floor(e/1e3)),u=Math.floor(t/3600),n=Math.floor(t%3600/60),D=t%60;return u>0?`${u}h ${n}m ${D}s`:n>0?`${n}m ${D}s`:`${D}s`},Jl=(e,t)=>{const u=Date.now(),n=1e3,D=()=>e.update(`The AI (${t}) is thinking for ${Kl(Date.now()-u)}`);D();const o=setInterval(D,n);return()=>clearInterval(o)};var Yl=async(e,t,u,n,D,o,r,i,s,c,f)=>(async()=>{xa(Ri(Oi(" aicommits "))),await zn();const l=Ir();u&&await q("git",["add","--update"]),l.start("Detecting git changes");const a=await Na(t);if(!a)throw l.stop("Detecting git changes"),new h("No staged changes found. Stage your changes manually, or automatically stage all changes with the `--all` flag.");l.stop(`${La(a.files,a.source)}:
136
- ${a.files.map($=>` ${$}`).join(`
137
- `)}`);const d=await Xt({generate:e?.toString(),"show-reasoning":n===!0?"true":void 0,"reasoning-effort":D,"api-mode":o,"message-path":r,"post-response-script":i,"base-url":s}),F={messageInstructionsMarkdown:d.messageInstructionsMarkdown,reasoningEffort:d["reasoning-effort"],requestOptionsJson:d["request-options"],apiMode:d["api-mode"],contextWindowTokens:d["context-window"],changedFiles:a.files},m=d["show-reasoning"]===!0,p=async({completions:$=d.generate,rewriteFromMessage:g,rewriteFeedback:b,rewriteFeedbackHistory:w,rewriteConversation:O,statusMessage:B=`The AI (${d.model}) is analyzing your changes`,finishedMessage:x="Changes analyzed"}={})=>{const G=Ir();G.start(B);let X,P=!1,ke=!0,Me=!1,Q;const Wr={message:"Message Generation"},zr=ee=>{if(!(ee.kind!=="reasoning"||!ee.text)){if(!m){P||(X=Jl(G,d.model),P=!0);return}ke&&(G.stop(`The AI (${d.model}) is thinking`),ke=!1),Me||(process.stdout.write(`${Ue(`
138
- The AI (${d.model}) is thinking`)}
139
- `),Me=!0),ee.phase!==Q&&(Q=ee.phase,process.stdout.write(`${Ue(`[${Wr[ee.phase]}]
140
- `)}`)),process.stdout.write(ee.text)}};let Ie;try{Ie=await Mr(d["api-key"],d.model,a.diff,$,d.timeout,d.proxy,{...F,rewriteFromMessage:g,rewriteFeedback:b,rewriteFeedbackHistory:w,rewriteConversation:O,onStreamEvent:zr},d["base-url"])}finally{X?.(),ke?G.stop(x):m&&process.stdout.write(`
141
- `)}if(Ie.length===0)throw new h("No commit messages were generated. Try again.");return Promise.all(Ie.map((ee,Ur)=>Or(ee,d.postResponseScriptPath,{candidateCount:Ie.length,candidateIndex:Ur,commitSource:"cli",configDirectoryPath:d.configDirectoryPath,cwd:process.cwd(),messageFilePath:d.messageFilePath})))};let C=await p(),y=[],v=[],I="";if(c)[I]=C;else try{let $=!0;for(;$;){const g=await Vl(C);if(g.status==="cancelled"){Wt("Commit cancelled");return}if(g.status==="submitted"){I=g.message,$=!1;break}y=[...y,g.feedback],v=[...v,{role:"assistant",content:g.message},{role:"user",content:g.feedback}],C=await p({completions:1,rewriteFromMessage:g.message,rewriteFeedback:g.feedback,rewriteFeedbackHistory:y,rewriteConversation:v,statusMessage:`The AI (${d.model}) is revising your commit message`,finishedMessage:"Commit message revised"})}}catch($){const g=$ instanceof Error?$.message:"";throw g.includes("TTY initialization failed")||g.includes("uv_tty_init returned EINVAL")||g.includes("ERR_TTY_INIT_FAILED")?new h("Interactive terminal initialization failed in this environment. Re-run with `--confirm` or `--yes` to skip prompts."):$}a.source==="uncommitted"&&await q("git",["add","--all","--",...a.files]),await q("git",["commit","-m",I,...f]),Wt(`${qe("\u2714")} Successfully committed!`)})().catch(l=>{Wt(`${Tt("\u2716")} ${l.message}`),Ut(l),process.exit(1)});const Zl="prepare-commit-msg-hook",Xl=()=>{const e=process.argv.slice(2);return e[0]===Zl?e.slice(1):e},Ql=async()=>{const{stdout:e}=await q("git",["rev-parse","--git-path","COMMIT_EDITMSG"],{reject:!1}),t=e.trim();return t===""?void 0:t},ef=async e=>A.readFile(e,"utf8").catch(t=>{if(t.code==="ENOENT")return"";throw t});var tf=()=>(async()=>{const[e,t]=Xl(),u=e?.trim()||await Ql();if(!u)return;const n=await ef(u);if(t==="message"&&n.trim()!=="")return;const o=await Kn();if(!o)return;const r=await Xt({}),i={messageInstructionsMarkdown:r.messageInstructionsMarkdown,reasoningEffort:r["reasoning-effort"],requestOptionsJson:r["request-options"],apiMode:r["api-mode"],contextWindowTokens:r["context-window"],changedFiles:o.files},s=await Mr(r["api-key"],r.model,o.diff,r.generate,r.timeout,r.proxy,i,r["base-url"]);if(s.length===0)return;const c=s[0]?.trim();if(!c)return;let f=c;try{f=await Or(c,r.postResponseScriptPath,{candidateCount:1,candidateIndex:0,commitSource:"hook",configDirectoryPath:r.configDirectoryPath,cwd:process.cwd(),messageFilePath:r.messageFilePath})}catch{}const l=`${f}
142
- `;await A.writeFile(u,l),process.stdout.write(l)})().catch(()=>{});const uf=e=>{const t=e.indexOf("=");if(t<=0)throw new h(`Invalid config assignment: "${e}". Use <key>=<value>.`);return[e.slice(0,t),e.slice(t+1)]};var nf=zu({name:"config",parameters:["<mode>","<key=value...>"]},e=>{(async()=>{const{mode:t,keyValue:u}=e._;if(t==="get"){const n=await Xt({},!0);for(const D of u){const o=cr(D);o&&ur(n,o)&&console.log(`${o}=${n[o]}`)}return}if(t==="set"){await Ic(u.map(uf));return}throw new h(`Invalid mode: ${t}`)})().catch(t=>{console.error(`${Tt("\u2716")} ${t.message}`),Ut(t),process.exit(1)})});const rf=e=>A.lstat(e).then(()=>!0,()=>!1),Fu="prepare-commit-msg",Df="prepare-commit-msg-hook",of=`/hooks/${Fu}`,_r=new URL(import.meta.url.endsWith(".ts")?"../cli.ts":"../cli.mjs",import.meta.url),jr=bu(_r),sf=import.meta.url.endsWith(".ts")?new URL("../../node_modules/tsx/dist/cli.mjs",import.meta.url):_r,af=bu(sf),Nr=`
135
+ `,options:[{label:"Use this commit message",value:Pr},{label:"Ask AI to rewrite it",hint:"Give feedback and regenerate",value:ql},...u?[{label:"Back to suggestions",value:Rr}]:[],{label:"Cancel",value:ut}]});return e.isCancel(n)||n===ut?{status:"cancelled"}:n===Rr?{status:"back"}:n===Pr?{status:"submitted",message:t}:Hl(e,t)},Vl=async(e,t)=>{if(e.length===1){const[n]=e,D=await _r(t,n,!1);return D.status==="back"?{status:"cancelled"}:D}let u=!0;for(;u;){const n=await t.select({message:"Pick a commit message to review:",options:[...e.map(o=>({label:o,value:o})),{label:"Cancel",value:ut}]});if(t.isCancel(n)||n===ut)return{status:"cancelled"};const D=await _r(t,n,!0);if(D.status!=="back")return u=!1,D}return{status:"cancelled"}},Kl=e=>Vl(e,{select:xa,text:$a,isCancel:aa}),Jl=e=>{const t=Math.max(0,Math.floor(e/1e3)),u=Math.floor(t/3600),n=Math.floor(t%3600/60),D=t%60;return u>0?`${u}h ${n}m ${D}s`:n>0?`${n}m ${D}s`:`${D}s`},Yl=(e,t)=>{const u=Date.now(),n=1e3,D=()=>e.update(`The AI (${t}) is thinking for ${Jl(Date.now()-u)}`);D();const o=setInterval(D,n);return()=>clearInterval(o)};var Zl=async(e,t,u,n,D,o,r,i,s,c,f,l)=>(async()=>{Sa(_i(Ti(" aicommits "))),await Un();const a=Or();u&&await U("git",["add","--update"]),a.start("Detecting git changes");const d=await La(t);if(!d)throw a.stop("Detecting git changes"),new m("No staged changes found. Stage your changes manually, or automatically stage all changes with the `--all` flag.");a.stop(`${Ga(d.files,d.source)}:
136
+ ${d.files.map(g=>` ${g}`).join(`
137
+ `)}`);const F=await Xt({generate:e?.toString(),"show-reasoning":n===!0?"true":void 0,"reasoning-effort":D,"api-mode":o,"message-path":r,"post-response-script":i,"base-url":s}),h={messageInstructionsMarkdown:F.messageInstructionsMarkdown,reasoningEffort:F["reasoning-effort"],requestOptionsJson:F["request-options"],apiMode:F["api-mode"],contextWindowTokens:F["context-window"],changedFiles:d.files},p=F["show-reasoning"]===!0,C=async({completions:g=F.generate,rewriteFromMessage:E,rewriteFeedback:w,rewriteFeedbackHistory:I,rewriteConversation:B,statusMessage:$=`The AI (${F.model}) is analyzing your changes`,finishedMessage:H="Changes analyzed"}={})=>{const V=Or();V.start($);let P,rt=!1,Fe=!0,Q=!1,pu;const zr={message:"Message Generation"},Ur=ee=>{if(!(ee.kind!=="reasoning"||!ee.text)){if(!p){rt||(P=Yl(V,F.model),rt=!0);return}Fe&&(V.stop(`The AI (${F.model}) is thinking`),Fe=!1),Q||(process.stdout.write(`${Ue(`
138
+ The AI (${F.model}) is thinking`)}
139
+ `),Q=!0),ee.phase!==pu&&(pu=ee.phase,process.stdout.write(`${Ue(`[${zr[ee.phase]}]
140
+ `)}`)),process.stdout.write(ee.text)}};let Ie;try{Ie=await Ir(F["api-key"],F.model,d.diff,g,F.timeout,F.proxy,{...h,rewriteFromMessage:E,rewriteFeedback:w,rewriteFeedbackHistory:I,rewriteConversation:B,onStreamEvent:Ur},F["base-url"])}finally{P?.(),Fe?V.stop(H):p&&process.stdout.write(`
141
+ `)}if(Ie.length===0)throw new m("No commit messages were generated. Try again.");return Promise.all(Ie.map((ee,qr)=>Tr(ee,F.postResponseScriptPath,{candidateCount:Ie.length,candidateIndex:qr,commitSource:"cli",configDirectoryPath:F.configDirectoryPath,cwd:process.cwd(),messageFilePath:F.messageFilePath})))};let b=await C(),v=[],M=[],O="";if(c)[O]=b;else try{let g=!0;for(;g;){const E=await Kl(b);if(E.status==="cancelled"){Ye("Commit cancelled");return}if(E.status==="submitted"){O=E.message,g=!1;break}v=[...v,E.feedback],M=[...M,{role:"assistant",content:E.message},{role:"user",content:E.feedback}],b=await C({completions:1,rewriteFromMessage:E.message,rewriteFeedback:E.feedback,rewriteFeedbackHistory:v,rewriteConversation:M,statusMessage:`The AI (${F.model}) is revising your commit message`,finishedMessage:"Commit message revised"})}}catch(g){const E=g instanceof Error?g.message:"";throw E.includes("TTY initialization failed")||E.includes("uv_tty_init returned EINVAL")||E.includes("ERR_TTY_INIT_FAILED")?new m("Interactive terminal initialization failed in this environment. Re-run with `--confirm` or `--yes` to skip prompts."):g}if(f){process.stdout.write(`${O}
142
+ `),Ye(`${ye("\u2714")} Commit message printed`);return}d.source==="uncommitted"&&await U("git",["add","--all","--",...d.files]),await U("git",["commit","-m",O,...l]),Ye(`${ye("\u2714")} Successfully committed!`)})().catch(a=>{Ye(`${Pt("\u2716")} ${a.message}`),Ut(a),process.exit(1)});const Xl="prepare-commit-msg-hook",Ql=()=>{const e=process.argv.slice(2);return e[0]===Xl?e.slice(1):e},ef=async()=>{const{stdout:e}=await U("git",["rev-parse","--git-path","COMMIT_EDITMSG"],{reject:!1}),t=e.trim();return t===""?void 0:t},tf=async e=>A.readFile(e,"utf8").catch(t=>{if(t.code==="ENOENT")return"";throw t});var uf=()=>(async()=>{const[e,t]=Ql(),u=e?.trim()||await ef();if(!u)return;const n=await tf(u);if(t==="message"&&n.trim()!=="")return;const o=await Jn();if(!o)return;const r=await Xt({}),i={messageInstructionsMarkdown:r.messageInstructionsMarkdown,reasoningEffort:r["reasoning-effort"],requestOptionsJson:r["request-options"],apiMode:r["api-mode"],contextWindowTokens:r["context-window"],changedFiles:o.files},s=await Ir(r["api-key"],r.model,o.diff,r.generate,r.timeout,r.proxy,i,r["base-url"]);if(s.length===0)return;const c=s[0]?.trim();if(!c)return;let f=c;try{f=await Tr(c,r.postResponseScriptPath,{candidateCount:1,candidateIndex:0,commitSource:"hook",configDirectoryPath:r.configDirectoryPath,cwd:process.cwd(),messageFilePath:r.messageFilePath})}catch{}const l=`${f}
143
+ `;await A.writeFile(u,l),process.stdout.write(l)})().catch(()=>{});const nf=e=>{const t=e.indexOf("=");if(t<=0)throw new m(`Invalid config assignment: "${e}". Use <key>=<value>.`);return[e.slice(0,t),e.slice(t+1)]};var rf=Uu({name:"config",parameters:["<mode>","<key=value...>"]},e=>{(async()=>{const{mode:t,keyValue:u}=e._;if(t==="get"){const n=await Xt({},!0);for(const D of u){const o=lr(D);o&&nr(n,o)&&console.log(`${o}=${n[o]}`)}return}if(t==="set"){await Oc(u.map(nf));return}throw new m(`Invalid mode: ${t}`)})().catch(t=>{console.error(`${Pt("\u2716")} ${t.message}`),Ut(t),process.exit(1)})});const Df=e=>A.lstat(e).then(()=>!0,()=>!1),Fu="prepare-commit-msg",of="prepare-commit-msg-hook",sf=`/hooks/${Fu}`,jr=new URL(import.meta.url.endsWith(".ts")?"../cli.ts":"../cli.mjs",import.meta.url),Nr=wu(jr),af=import.meta.url.endsWith(".ts")?new URL("../../node_modules/tsx/dist/cli.mjs",import.meta.url):jr,cf=wu(af),Lr=`
143
144
  #!/usr/bin/env node
144
- process.argv.splice(2, 0, ${JSON.stringify(Df)});
145
- ${import.meta.url.endsWith(".ts")?`process.argv.splice(2, 0, ${JSON.stringify(jr)});`:""}
146
- import(${JSON.stringify(oD(af))})
147
- `.trim(),cf=(process.argv[1]||"").replace(/\\/g,"/").endsWith(of),Lr=async e=>await A.readFile(e,"utf8").catch(()=>{})===Nr,Gr=async e=>await A.realpath(e).catch(()=>{})===jr;var lf=zu({name:"hook",parameters:["<install/uninstall>"]},e=>{(async()=>{const t=await zn(),{installUninstall:u}=e._,n=await Oa("hooks",t),D=N.join(n,Fu),o=await rf(D);if(u==="install"){if(o){if(await Lr(D)){console.warn("The hook is already installed");return}if(await Gr(D))await A.rm(D);else throw new h(`A different ${Fu} hook seems to be installed. Please remove it before installing aicommits.`)}await A.mkdir(N.dirname(D),{recursive:!0}),await A.writeFile(D,Nr),await A.chmod(D,493),console.log(`${qe("\u2714")} Hook installed`);return}if(u==="uninstall"){if(!o){console.warn("Hook is not installed");return}if(!(await Lr(D)||await Gr(D))){console.warn("Hook is not installed");return}await A.rm(D),console.log(`${qe("\u2714")} Hook uninstalled`);return}throw new h(`Invalid mode: ${u}`)})().catch(t=>{console.error(`${Tt("\u2716")} ${t.message}`),Ut(t),process.exit(1)})});const ff=Ln(),nt=process.argv.slice(2),df=nt[0]==="prepare-commit-msg-hook",Ff=[{flag:"--type",matches:["--type","-t"]},{flag:"--details",matches:["--details"]},{flag:"--details-style",matches:["--details-style"]},{flag:"--instructions",matches:["--instructions"]},{flag:"--conventional-format",matches:["--conventional-format"]},{flag:"--conventional-types",matches:["--conventional-types"]},{flag:"--conventional-scope",matches:["--conventional-scope"]}];Ao({name:"aicommits",flags:{generate:{type:Number,description:"Number of messages to generate (Warning: generating multiple costs more) (default: 1)",alias:"g"},exclude:{type:[String],description:"Files to exclude from AI analysis",alias:"x"},all:{type:Boolean,description:"Automatically stage changes in tracked files for the commit",alias:"a",default:!1},type:{type:String,description:"Git commit message format (default: plain). Supports conventional",alias:"t"},details:{type:Boolean,description:"Generate commit message details/body in addition to the title"},showReasoning:{type:Boolean,description:"Stream and print model reasoning while generating messages"},reasoningEffort:{type:String,description:"Reasoning effort to request: none, low, medium, high, or xhigh"},apiMode:{type:String,description:"API mode to use: responses (default) or chat"},messageFile:{type:String,description:"Markdown file used to guide commit message generation"},postResponseScript:{type:String,description:"Executable script that can rewrite the AI response via stdin/stdout"},baseUrl:{type:String,description:"API base URL for Responses API (default) or Chat Completions (for example https://api.openai.com/v1)"},confirm:{type:Boolean,description:"Skip interactive confirmation/selection prompts and use the first generated message",alias:"y",default:!1},yes:{type:Boolean,description:"Alias for --confirm",default:!1},version:{type:Boolean,description:"Show version number",alias:"v"}},commands:[nf,lf],help:{description:xo},ignoreArgv:e=>e==="unknown-flag"||e==="argument"},e=>{if(e.flags.type!==void 0)throw new h(Ht("--type"));if(e.flags.details!==void 0)throw new h(Ht("--details"));for(const{flag:t,matches:u}of Ff)if(nt.some(n=>u.some(D=>n===D||n.startsWith(`${D}=`))))throw new h(Ht(t));e.flags.version&&(console.log(ff),process.exit(0)),cf||df?tf():Yl(e.flags.generate,e.flags.exclude,e.flags.all,e.flags.showReasoning,e.flags.reasoningEffort,e.flags.apiMode,e.flags.messageFile,e.flags.postResponseScript,e.flags.baseUrl,e.flags.confirm||e.flags.yes,nt)},nt);
145
+ process.argv.splice(2, 0, ${JSON.stringify(of)});
146
+ ${import.meta.url.endsWith(".ts")?`process.argv.splice(2, 0, ${JSON.stringify(Nr)});`:""}
147
+ import(${JSON.stringify(sD(cf))})
148
+ `.trim(),lf=(process.argv[1]||"").replace(/\\/g,"/").endsWith(sf),Gr=async e=>await A.readFile(e,"utf8").catch(()=>{})===Lr,Wr=async e=>await A.realpath(e).catch(()=>{})===Nr;var ff=Uu({name:"hook",parameters:["<install/uninstall>"]},e=>{(async()=>{const t=await Un(),{installUninstall:u}=e._,n=await Ta("hooks",t),D=N.join(n,Fu),o=await Df(D);if(u==="install"){if(o){if(await Gr(D)){console.warn("The hook is already installed");return}if(await Wr(D))await A.rm(D);else throw new m(`A different ${Fu} hook seems to be installed. Please remove it before installing aicommits.`)}await A.mkdir(N.dirname(D),{recursive:!0}),await A.writeFile(D,Lr),await A.chmod(D,493),console.log(`${ye("\u2714")} Hook installed`);return}if(u==="uninstall"){if(!o){console.warn("Hook is not installed");return}if(!(await Gr(D)||await Wr(D))){console.warn("Hook is not installed");return}await A.rm(D),console.log(`${ye("\u2714")} Hook uninstalled`);return}throw new m(`Invalid mode: ${u}`)})().catch(t=>{console.error(`${Pt("\u2716")} ${t.message}`),Ut(t),process.exit(1)})});const df=Gn(),nt=process.argv.slice(2),Ff=nt[0]==="prepare-commit-msg-hook",pf=[{flag:"--type",matches:["--type","-t"]},{flag:"--details",matches:["--details"]},{flag:"--details-style",matches:["--details-style"]},{flag:"--instructions",matches:["--instructions"]},{flag:"--conventional-format",matches:["--conventional-format"]},{flag:"--conventional-types",matches:["--conventional-types"]},{flag:"--conventional-scope",matches:["--conventional-scope"]}];$o({name:"aicommits",flags:{generate:{type:Number,description:"Number of messages to generate (Warning: generating multiple costs more) (default: 1)",alias:"g"},exclude:{type:[String],description:"Files to exclude from AI analysis",alias:"x"},all:{type:Boolean,description:"Automatically stage changes in tracked files for the commit",alias:"a",default:!1},type:{type:String,description:"Git commit message format (default: plain). Supports conventional",alias:"t"},details:{type:Boolean,description:"Generate commit message details/body in addition to the title"},showReasoning:{type:Boolean,description:"Stream and print model reasoning while generating messages"},reasoningEffort:{type:String,description:"Reasoning effort to request: none, low, medium, high, or xhigh"},apiMode:{type:String,description:"API mode to use: responses (default) or chat"},messageFile:{type:String,description:"Markdown file used to guide commit message generation"},postResponseScript:{type:String,description:"Executable script that can rewrite the AI response via stdin/stdout"},baseUrl:{type:String,description:"API base URL for Responses API (default) or Chat Completions (for example https://api.openai.com/v1)"},confirm:{type:Boolean,description:"Skip interactive confirmation/selection prompts and use the first generated message",alias:"y",default:!1},yes:{type:Boolean,description:"Alias for --confirm",default:!1},print:{type:Boolean,description:"Print the generated commit message and exit without committing",default:!1},noCommit:{type:Boolean,description:"Alias for --print",default:!1},version:{type:Boolean,description:"Show version number",alias:"v"}},commands:[rf,ff],help:{description:So},ignoreArgv:e=>e==="unknown-flag"||e==="argument"},e=>{if(e.flags.type!==void 0)throw new m(Ht("--type"));if(e.flags.details!==void 0)throw new m(Ht("--details"));for(const{flag:t,matches:u}of pf)if(nt.some(n=>u.some(D=>n===D||n.startsWith(`${D}=`))))throw new m(Ht(t));if(e.flags.version&&(console.log(df),process.exit(0)),lf||Ff)uf();else{const t=e.flags.print||e.flags.noCommit;Zl(e.flags.generate,e.flags.exclude,e.flags.all,e.flags.showReasoning,e.flags.reasoningEffort,e.flags.apiMode,e.flags.messageFile,e.flags.postResponseScript,e.flags.baseUrl,e.flags.confirm||e.flags.yes||t,t,nt)}},nt);