@sugarmo/aicommits 1.18.0 → 1.19.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 +20 -0
  2. package/dist/cli.mjs +112 -111
  3. package/package.json +1 -1
package/dist/cli.mjs CHANGED
@@ -1,148 +1,149 @@
1
1
  #!/usr/bin/env node
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,`
2
+ import ot from"tty";import{Buffer as Yr}from"node:buffer";import oe from"node:path";import gu,{ChildProcess as Zr}from"node:child_process";import O,{stdin as Xr,stdout as Qr}from"node:process";import eD from"child_process";import N from"path";import st from"fs";import{fileURLToPath as Eu}from"node:url";import tD,{constants as yu}from"node:os";import bu from"assert";import wu from"events";import{createWriteStream as uD,createReadStream as nD}from"node:fs";import rD from"buffer";import it from"stream";import Bu from"util";import{debuglog as DD}from"node:util";import vu from"node:readline";import{WriteStream as oD}from"node:tty";import $ from"fs/promises";import Te from"os";import sD from"https";import iD from"net";import aD from"tls";import cD,{fileURLToPath as Au,pathToFileURL as lD}from"url";const fD="known-flag",dD="unknown-flag",FD="argument",{stringify:pe}=JSON,pD=/\B([A-Z])/g,CD=e=>e.replace(pD,"-$1").toLowerCase(),{hasOwnProperty:mD}=Object.prototype,Ce=(e,t)=>mD.call(e,t),hD=e=>Array.isArray(e),$u=e=>typeof e=="function"?[e,!1]:hD(e)?[e[0],!0]:$u(e.type),gD=(e,t)=>e===Boolean?t!=="false":t,ED=(e,t)=>typeof t=="boolean"?t:e===Number&&t===""?Number.NaN:e(t),yD=/[\s.:=]/,bD=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(yD);if(u)throw new Error(`${t} cannot contain ${pe(u?.[0])}`)},wD=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;bD(n);const D=e[n],o=[[],...$u(D),D];u(n,o);const r=CD(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},BD=(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},Pe="--",vD=/[.:=]/,AD=/^-{1,2}\w/,$D=e=>{if(!AD.test(e))return;const t=!e.startsWith(Pe);let u=e.slice(t?1:2),n;const D=u.match(vD);if(D){const{index:o}=D;n=u.slice(o+1),u=u.slice(0,o)}return[u,n,t]},xD=(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===Pe){D();const s=e.slice(o+1);u?.(s,[o],!0);break}const i=$D(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()},SD=(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)}},kD=(e,t=process.argv.slice(2),{ignore:u}={})=>{const n=[],D=wD(e),o={},r=[];return r[Pe]=[],xD(t,{onFlag(i,s,c){const f=Ce(D,i);if(!u?.(f?fD:dD,i,s)){if(f){const[l,a]=D[i],d=gD(a,s),F=(C,p)=>{n.push(c),p&&n.push(p),l.push(ED(a,C||""))};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?.(FD,t[s[0]])||(r.push(...i),c?(r[Pe]=i,t.splice(s[0])):n.push(s))}}),SD(t,n),{flags:BD(e,D),unknownFlags:o,_:r}};var MD=Object.create,Re=Object.defineProperty,ID=Object.defineProperties,OD=Object.getOwnPropertyDescriptor,TD=Object.getOwnPropertyDescriptors,PD=Object.getOwnPropertyNames,xu=Object.getOwnPropertySymbols,RD=Object.getPrototypeOf,Su=Object.prototype.hasOwnProperty,_D=Object.prototype.propertyIsEnumerable,ku=(e,t,u)=>t in e?Re(e,t,{enumerable:!0,configurable:!0,writable:!0,value:u}):e[t]=u,_e=(e,t)=>{for(var u in t||(t={}))Su.call(t,u)&&ku(e,u,t[u]);if(xu)for(var u of xu(t))_D.call(t,u)&&ku(e,u,t[u]);return e},at=(e,t)=>ID(e,TD(t)),jD=e=>Re(e,"__esModule",{value:!0}),ND=(e,t)=>()=>(e&&(t=e(e=0)),t),LD=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),GD=(e,t,u,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let D of PD(t))!Su.call(e,D)&&(u||D!=="default")&&Re(e,D,{get:()=>t[D],enumerable:!(n=OD(t,D))||n.enumerable});return e},zD=(e,t)=>GD(jD(Re(e!=null?MD(RD(e)):{},"default",!t&&e&&e.__esModule?{get:()=>e.default,enumerable:!0}:{value:e,enumerable:!0})),e),L=ND(()=>{}),WD=LD((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 UD=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 qD({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 Mu(e){if(typeof e!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof e}\``);return e.replace(qD(),"")}L();function HD(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 VD=zD(WD(),1);function ue(e){if(typeof e!="string"||e.length===0||(e=Mu(e),e.length===0))return 0;e=e.replace((0,VD.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+=HD(n)?2:1)}return t}var Iu=e=>Math.max(...e.split(`
3
+ `).map(ue)),KD=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=Iu(u[o]);r>t[o]&&(t[o]=r)}}return t};L();var Ou=/^\d+%$/,Tu={width:"auto",align:"left",contentWidth:0,paddingLeft:0,paddingRight:0,paddingTop:0,paddingBottom:0,horizontalPadding:0,paddingLeftString:"",paddingRightString:""},JD=(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"&&Ou.test(o)){n.push(at(_e({},Tu),{width:o,contentWidth:e[D]}));continue}if(o&&typeof o=="object"){let r=at(_e(_e({},Tu),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 YD(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"&&Ou.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 Pu=()=>Object.assign([],{columns:0});function ZD(e,t){let u=[Pu()],[n]=u;for(let D of e){let o=D.width+D.horizontalPadding;n.columns+o>t&&(n=Pu(),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 XD(e,t,u){let n=JD(u,t);return YD(n,e),ZD(n,e)}L(),L(),L();var ct=10,Ru=(e=0)=>t=>`\x1B[${t+e}m`,_u=(e=0)=>t=>`\x1B[${38+e};5;${t}m`,ju=(e=0)=>(t,u,n)=>`\x1B[${38+e};2;${t};${u};${n}m`;function QD(){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=Ru(),t.color.ansi256=_u(),t.color.ansi16m=ju(),t.bgColor.ansi=Ru(ct),t.bgColor.ansi256=_u(ct),t.bgColor.ansi16m=ju(ct),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 eo=QD(),to=eo,je=new Set(["\x1B","\x9B"]),uo=39,lt="\x07",Nu="[",no="]",Lu="m",ft=`${no}8;;`,Gu=e=>`${je.values().next().value}${Nu}${e}${Lu}`,zu=e=>`${je.values().next().value}${ft}${e}${lt}`,ro=e=>e.split(" ").map(t=>ue(t)),dt=(e,t,u)=>{let n=[...t],D=!1,o=!1,r=ue(Mu(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),je.has(s)&&(D=!0,o=n.slice(i+1).join("").startsWith(ft)),D){o?s===lt&&(D=!1,o=!1):s===Lu&&(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())},Do=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("")},oo=(e,t,u={})=>{if(u.trim!==!1&&e.trim()==="")return"";let n="",D,o,r=ro(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(""),dt(i,f,t);continue}if(l+r[c]>t&&l>0&&r[c]>0){if(u.wordWrap===!1&&l<t){dt(i,f,t);continue}i.push("")}if(l+r[c]>t&&u.wordWrap===!1){dt(i,f,t);continue}i[i.length-1]+=f}u.trim!==!1&&(i=i.map(c=>Do(c)));let s=[...i.join(`
4
+ `)];for(let[c,f]of s.entries()){if(n+=f,je.has(f)){let{groups:a}=new RegExp(`(?:\\${Nu}(?<code>\\d+)m|\\${ft}(?<uri>.*)${lt})`).exec(s.slice(c).join(""))||{groups:{}};if(a.code!==void 0){let d=Number.parseFloat(a.code);D=d===uo?void 0:d}else a.uri!==void 0&&(o=a.uri.length===0?void 0:a.uri)}let l=to.codes.get(Number(D));s[c+1]===`
5
+ `?(o&&(n+=zu("")),D&&l&&(n+=Gu(l))):f===`
6
+ `&&(D&&l&&(n+=Gu(D)),o&&(n+=zu(o)))}return n};function so(e,t,u){return String(e).normalize().replace(/\r\n/g,`
7
7
  `).split(`
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(`
8
+ `).map(n=>oo(n,t,u)).join(`
9
+ `)}var Wu=e=>Array.from({length:e}).fill("");function io(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)),Iu(f)>s.width&&(f=so(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(...Wu(s.paddingTop)),s.paddingBottom&&l.push(...Wu(s.paddingBottom)),l.length>o&&(o=l.length),at(_e({},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 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)}
12
+ `)}function ao(e,t){if(!e||e.length===0)return"";let u=KD(e),n=u.length;if(n===0)return"";let{stdoutColumns:D,columns:o}=UD(t);if(o.length>n)throw new Error(`${o.length} columns defined, but only ${n} columns found`);let r=XD(D,o,u);return e.map(i=>io(r,i)).join(`
13
+ `)}L();var co=["<",">","=",">=","<="];function lo(e){if(!co.includes(e))throw new TypeError(`Invalid breakpoint operator: ${e}`)}function fo(e){let t=Object.keys(e).map(u=>{let[n,D]=u.split(" ");lo(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 Fo=e=>e.replace(/[\W_]([a-z\d])?/gi,(t,u)=>u?u.toUpperCase():""),po=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 mo(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:`--${po(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 Uu=e=>!e||(e.version??(e.help?e.help.version:void 0)),qu=e=>{const t="parent"in e&&e.parent?.name;return(t?`${t} `:"")+e.name};function ho(e){const t=[];e.name&&t.push(qu(e));const u=Uu(e)??("parent"in e&&Uu(e.parent));if(u&&t.push(`v${u}`),t.length!==0)return{id:"name",type:"text",data:`${t.join(" ")}
14
+ `}}function go(e){const{help:t}=e;if(!(!t||!t.description))return{id:"description",type:"text",data:`${t.description}
15
+ `}}function Eo(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=[qu(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 yo(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 bo(e){if(!(!e.flags||Object.keys(e.flags).length===0))return{id:"flags",type:"section",data:{title:"Flags:",body:mo(e.flags),indentBody:0}}}function wo(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 Bo(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 vo=e=>[ho,go,Eo,yo,bo,wo,Bo].map(t=>t(e)).filter(Boolean),Ao=ot.WriteStream.prototype.hasColors();class $o{text(t){return t}bold(t){return Ao?`\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 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"?`
20
+ `}table({tableData:t,tableOptions:u,tableBreakpoints:n}){return ao(t.map(D=>D.map(o=>this.render(o))),n?fo(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,xo=/[|\\{}()[\]^$+*?.]/;function pt(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(xo);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 Ct(e,t,u,n){for(let D=0;D<t.length;D+=1){const{name:o,required:r,spread:i}=t[D],s=Fo(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 So(e){return e===void 0||e!==!1}function Hu(e,t,u,n){const D={...t.flags},o=t.version;o&&(D.version={type:Boolean,description:"Show version"});const{help:r}=t,i=So(r);i&&!("help"in D)&&(D.help={type:Boolean,alias:"h",description:"Show help"});const s=kD(D,n,{ignore:t.ignoreArgv}),c=()=>{console.log(t.version)};if(o&&s.flags.version===!0)return c(),process.exit(0);const f=new $o,l=i&&r?.render?r.render:F=>f.render(F),a=F=>{const C=vo({...t,...F?{help:F}:{},flags:D});console.log(l(C,f))};if(i&&s.flags.help===!0)return a(),process.exit(0);if(t.parameters){let{parameters:F}=t,C=s._;const p=F.indexOf("--"),h=F.slice(p+1),w=Object.create(null);if(p>-1&&h.length>0){F=F.slice(0,p);const A=s._["--"];C=C.slice(0,-A.length||void 0),Ct(w,pt(F),C,a),Ct(w,pt(h),A,a)}else Ct(w,pt(F),C,a);Object.assign(s._,w)}const d={...s,showVersion:c,showHelp:a};return typeof u=="function"&&u(d),{command:e,...d}}function ko(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 Mo(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=ko(n,e.commands);if(D)return Hu(D.options.name,{...D.options,parent:e},D.callback,u.slice(1))}return Hu(void 0,e,t,u)}function Vu(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 Io="1.19.0",Oo="Writes your git commit messages for you with AI",To="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:{}},mt,Ku;function Po(){if(Ku)return mt;Ku=1,mt=n,n.sync=D;var e=st;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 mt}var ht,Ju;function Ro(){if(Ju)return ht;Ju=1,ht=t,t.sync=u;var e=st;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),C=a|d,p=i&F||i&d&&c===l||i&a&&s===f||i&C&&f===0;return p}return ht}var Ne;process.platform==="win32"||_.TESTING_WINDOWS?Ne=Po():Ne=Ro();var _o=gt;gt.sync=jo;function gt(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){gt(e,t||{},function(o,r){o?D(o):n(r)})})}Ne(e,t||{},function(n,D){n&&(n.code==="EACCES"||t&&t.ignoreErrors)&&(n=null,D=!1),u(n,D)})}function jo(e,t){try{return Ne.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",Yu=N,No=ae?";":":",Zu=_o,Xu=e=>Object.assign(new Error(`not found: ${e}`),{code:"ENOENT"}),Qu=(e,t)=>{const u=t.colon||No,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}},en=(e,t,u)=>{typeof t=="function"&&(u=t,t={}),t||(t={});const{pathEnv:n,pathExt:D,pathExtExe:o}=Qu(e,t),r=[],i=c=>new Promise((f,l)=>{if(c===n.length)return t.all&&r.length?f(r):l(Xu(e));const a=n[c],d=/^".*"$/.test(a)?a.slice(1,-1):a,F=Yu.join(d,e),C=!d&&/^\.[\\\/]/.test(e)?e.slice(0,2)+F:F;f(s(C,c,0))}),s=(c,f,l)=>new Promise((a,d)=>{if(l===D.length)return a(i(f+1));const F=D[l];Zu(c+F,{pathExt:o},(C,p)=>{if(!C&&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)},Lo=(e,t)=>{t=t||{};const{pathEnv:u,pathExt:n,pathExtExe:D}=Qu(e,t),o=[];for(let r=0;r<u.length;r++){const i=u[r],s=/^".*"$/.test(i)?i.slice(1,-1):i,c=Yu.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(Zu.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 Xu(e)};var Go=en;en.sync=Lo;var Et={exports:{}};const tn=(e={})=>{const t=e.env||process.env;return(e.platform||process.platform)!=="win32"?"PATH":Object.keys(t).reverse().find(n=>n.toUpperCase()==="PATH")||"Path"};Et.exports=tn,Et.exports.default=tn;var zo=Et.exports;const un=N,Wo=Go,Uo=zo;function nn(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=Wo.sync(e.command,{path:u[Uo({env:u})],pathExt:t?un.delimiter:void 0})}catch{}finally{o&&process.chdir(n)}return r&&(r=un.resolve(D?e.options.cwd:"",r)),r}function qo(e){return nn(e)||nn(e,!0)}var Ho=qo,yt={};const bt=/([()\][%!^"`<>&|;, *?])/g;function Vo(e){return e=e.replace(bt,"^$1"),e}function Ko(e,t){return e=`${e}`,e=e.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),e=e.replace(/(?=(\\+?)?)\1$/,"$1$1"),e=`"${e}"`,e=e.replace(bt,"^$1"),t&&(e=e.replace(bt,"^$1")),e}yt.command=Vo,yt.argument=Ko;var Jo=/^#!(.*)/;const Yo=Jo;var Zo=(e="")=>{const t=e.match(Yo);if(!t)return null;const[u,n]=t[0].replace(/#! ?/,"").split(" "),D=u.split("/").pop();return D==="env"?n:n?`${D} ${n}`:D};const wt=st,Xo=Zo;function Qo(e){const u=Buffer.alloc(150);let n;try{n=wt.openSync(e,"r"),wt.readSync(n,u,0,150,0),wt.closeSync(n)}catch{}return Xo(u.toString())}var es=Qo;const ts=N,rn=Ho,Dn=yt,us=es,ns=process.platform==="win32",rs=/\.(?:com|exe)$/i,Ds=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function os(e){e.file=rn(e);const t=e.file&&us(e.file);return t?(e.args.unshift(e.file),e.command=t,rn(e)):e.file}function ss(e){if(!ns)return e;const t=os(e),u=!rs.test(t);if(e.options.forceShell||u){const n=Ds.test(t);e.command=ts.normalize(e.command),e.command=Dn.command(e.command),e.args=e.args.map(o=>Dn.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 is(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:ss(n)}var as=is;const Bt=process.platform==="win32";function vt(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 cs(e,t){if(!Bt)return;const u=e.emit;e.emit=function(n,D){if(n==="exit"){const o=on(D,t);if(o)return u.call(e,"error",o)}return u.apply(e,arguments)}}function on(e,t){return Bt&&e===1&&!t.file?vt(t.original,"spawn"):null}function ls(e,t){return Bt&&e===1&&!t.file?vt(t.original,"spawnSync"):null}var fs={hookChildProcess:cs,verifyENOENT:on,verifyENOENTSync:ls,notFoundError:vt};const sn=eD,At=as,$t=fs;function an(e,t,u){const n=At(e,t,u),D=sn.spawn(n.command,n.args,n.options);return $t.hookChildProcess(D,n),D}function ds(e,t,u){const n=At(e,t,u),D=sn.spawnSync(n.command,n.args,n.options);return D.error=D.error||$t.verifyENOENTSync(D.status,n),D}ie.exports=an,ie.exports.spawn=an,ie.exports.sync=ds,ie.exports._parse=At,ie.exports._enoent=$t;var Fs=ie.exports,ps=se(Fs);function Cs(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 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,`
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 cn(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 ms=({cwd:e=O.cwd(),path:t=O.env[cn()],preferLocal:u=!0,execPath:n=O.execPath,addExecPath:D=!0}={})=>{const o=e instanceof URL?Eu(e):e,r=oe.resolve(o),i=[];return u&&hs(i,r),D&&gs(i,n,r),[...i,t].join(oe.delimiter)},hs=(e,t)=>{let u;for(;u!==t;)e.push(oe.join(t,"node_modules/.bin")),u=t,t=oe.resolve(t,"..")},gs=(e,t,u)=>{const n=t instanceof URL?Eu(t):t;e.push(oe.resolve(u,n,".."))},Es=({env:e=O.env,...t}={})=>{e={...e};const u=cn({env:e});return t.path=e[u],e[u]=ms(t),e},ys=(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);!bs(D,o)&&n||Object.defineProperty(e,u,o)},bs=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)},ws=(e,t)=>{const u=Object.getPrototypeOf(t);u!==Object.getPrototypeOf(e)&&Object.setPrototypeOf(e,u)},Bs=(e,t)=>`/* Wrapped ${e}*/
25
+ ${t}`,vs=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),As=Object.getOwnPropertyDescriptor(Function.prototype.toString,"name"),$s=(e,t,u)=>{const n=u===""?"":`with ${u.trim()}() `,D=Bs.bind(null,n,t.toString());Object.defineProperty(D,"name",As),Object.defineProperty(e,"toString",{...vs,value:D})};function xs(e,t,{ignoreNonConfigurable:u=!1}={}){const{name:n}=e;for(const D of Reflect.ownKeys(t))ys(e,t,D,u);return ws(e,t),$s(e,t,n),e}const Le=new WeakMap,ln=(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(Le.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 xs(o,e),Le.set(o,n),o};ln.callCount=e=>{if(!Le.has(e))throw new Error(`The given function \`${e.name}\` is not wrapped by the \`onetime\` package`);return Le.get(e)};const Ss=()=>{const e=dn-fn+1;return Array.from({length:e},ks)},ks=(e,t)=>({name:`SIGRT${t+1}`,number:fn+t,action:"terminate",description:"Application-specific signal (realtime)",standard:"posix"}),fn=34,dn=64,Ms=[{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"}],Fn=()=>{const e=Ss();return[...Ms,...e].map(Is)},Is=({name:e,number:t,description:u,action:n,forced:D=!1,standard:o})=>{const{signals:{[e]:r}}=yu,i=r!==void 0;return{name:e,number:i?r:t,description:u,supported:i,action:n,forced:D,standard:o}},Os=()=>{const e=Fn();return Object.fromEntries(e.map(Ts))},Ts=({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}],Ps=Os(),Rs=()=>{const e=Fn(),t=dn+1,u=Array.from({length:t},(n,D)=>_s(D,e));return Object.assign({},...u)},_s=(e,t)=>{const u=js(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}}},js=(e,t)=>{const u=t.find(({name:n})=>yu.signals[n]===e);return u!==void 0?u:t.find(n=>n.number===e)};Rs();const Ns=({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",pn=({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=O.cwd()}}})=>{o=o===null?void 0:o,D=D===null?void 0:D;const d=D===void 0?void 0:Ps[D].description,F=n&&n.code,p=`Command ${Ns({timedOut:s,timeout:l,errorCode:F,signal:D,signalDescription:d,exitCode:o,isCanceled:c})}: ${r}`,h=Object.prototype.toString.call(n)==="[object Error]",w=h?`${p}
26
+ ${n.message}`:p,A=[w,t,e].filter(Boolean).join(`
27
+ `);return h?(n.originalMessage=n.message,n.message=A):n=new Error(A),n.shortMessage=w,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},Ge=["stdin","stdout","stderr"],Ls=e=>Ge.some(t=>e[t]!==void 0),Gs=e=>{if(!e)return;const{stdio:t}=e;if(t===void 0)return Ge.map(n=>e[n]);if(Ls(e))throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${Ge.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,Ge.length);return Array.from({length:u},(n,D)=>t[D])};var ce={exports:{}},ze={exports:{}};ze.exports;var Cn;function zs(){return Cn||(Cn=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")}(ze)),ze.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 Ws=bu,me=zs(),Us=/^win/i.test(S.platform),We=wu;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(){};Ws.equal(typeof e,"function","a callback must be provided for exit handler"),he===!1&&mn();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&&xt()};return j.on(u,e),n};var xt=function(){!he||!ne(_.process)||(he=!1,me.forEach(function(t){try{S.removeListener(t,St[t])}catch{}}),S.emit=kt,S.reallyExit=hn,j.count-=1)};ce.exports.unload=xt;var le=function(t,u,n){j.emitted[t]||(j.emitted[t]=!0,j.emit(t,u,n))},St={};me.forEach(function(e){St[e]=function(){if(ne(_.process)){var u=S.listeners(e);u.length===j.count&&(xt(),le("exit",null,e),le("afterexit",null,e),Us&&e==="SIGHUP"&&(e="SIGINT"),S.kill(S.pid,e))}}}),ce.exports.signals=function(){return me};var he=!1,mn=function(){he||!ne(_.process)||(he=!0,j.count+=1,me=me.filter(function(t){try{return S.on(t,St[t]),!0}catch{return!1}}),S.emit=Hs,S.reallyExit=qs)};ce.exports.load=mn;var hn=S.reallyExit,qs=function(t){ne(_.process)&&(S.exitCode=t||0,le("exit",S.exitCode,null),le("afterexit",S.exitCode,null),hn.call(S,S.exitCode))},kt=S.emit,Hs=function(t,u){if(t==="exit"&&ne(_.process)){u!==void 0&&(S.exitCode=u);var n=kt.apply(this,arguments);return le("exit",S.exitCode,null),le("afterexit",S.exitCode,null),n}else return kt.apply(this,arguments)}}var Vs=ce.exports,Ks=se(Vs);const Js=1e3*5,Ys=(e,t="SIGTERM",u={})=>{const n=e(t);return Zs(e,t,u,n),n},Zs=(e,t,u,n)=>{if(!Xs(t,u,n))return;const D=ei(u),o=setTimeout(()=>{e("SIGKILL")},D);o.unref&&o.unref()},Xs=(e,{forceKillAfterTimeout:t},u)=>Qs(e)&&t!==!1&&u,Qs=e=>e===tD.constants.signals.SIGTERM||typeof e=="string"&&e.toUpperCase()==="SIGTERM",ei=({forceKillAfterTimeout:e=!0})=>{if(e===!0)return Js;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},ti=(e,t)=>{e.kill()&&(t.isCanceled=!0)},ui=(e,t,u)=>{e.kill(t),u(Object.assign(new Error("Timed out"),{timedOut:!0,signal:t}))},ni=(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(()=>{ui(e,u,s)},t)}),r=n.finally(()=>{clearTimeout(D)});return Promise.race([o,r])},ri=({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})`)},Di=async(e,{cleanup:t,detached:u},n)=>{if(!t||u)return n;const D=Ks(()=>{e.kill()});return n.finally(()=>{D()})};function gn(e){return e!==null&&typeof e=="object"&&typeof e.pipe=="function"}function En(e){return gn(e)&&e.writable!==!1&&typeof e._write=="function"&&typeof e._writableState=="object"}const oi=e=>e instanceof Zr&&typeof e.then=="function",Mt=(e,t,u)=>{if(typeof u=="string")return e[t].pipe(uD(u)),e;if(En(u))return e[t].pipe(u),e;if(!oi(u))throw new TypeError("The second argument must be a string, a stream or an Execa child process.");if(!En(u.stdin))throw new TypeError("The target child process's stdin must be available.");return e[t].pipe(u.stdin),u},si=e=>{e.stdout!==null&&(e.pipeStdout=Mt.bind(void 0,e,"stdout")),e.stderr!==null&&(e.pipeStderr=Mt.bind(void 0,e,"stderr")),e.all!==void 0&&(e.pipeAll=Mt.bind(void 0,e,"all"))};var ge={exports:{}};const{PassThrough:ii}=it;var ai=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 ii({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:ci}=rD,li=it,{promisify:fi}=Bu,di=ai,Fi=fi(li.pipeline);class yn extends Error{constructor(){super("maxBuffer exceeded"),this.name="MaxBufferError"}}async function It(e,t){if(!e)throw new Error("Expected a stream");t={maxBuffer:1/0,...t};const{maxBuffer:u}=t,n=di(t);return await new Promise((D,o)=>{const r=i=>{i&&n.getBufferedLength()<=ci.MAX_LENGTH&&(i.bufferedData=n.getBufferedValue()),o(i)};(async()=>{try{await Fi(e,n),D()}catch(i){r(i)}})(),n.on("data",()=>{n.getBufferedLength()>u&&r(new yn)})}),n.getBufferedValue()}ge.exports=It,ge.exports.buffer=(e,t)=>It(e,{...t,encoding:"buffer"}),ge.exports.array=(e,t)=>It(e,{...t,array:!0}),ge.exports.MaxBufferError=yn;var pi=ge.exports,bn=se(pi);const{PassThrough:Ci}=it;var mi=function(){var e=[],t=new Ci({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()}},hi=se(mi);const gi=e=>{if(e!==void 0)throw new TypeError("The `input` and `inputFile` options cannot be both set.")},Ei=({input:e,inputFile:t})=>typeof t!="string"?e:(gi(e),nD(t)),yi=(e,t)=>{const u=Ei(t);u!==void 0&&(gn(u)?u.pipe(e.stdin):e.stdin.end(u))},bi=(e,{all:t})=>{if(!t||!e.stdout&&!e.stderr)return;const u=hi();return e.stdout&&u.add(e.stdout),e.stderr&&u.add(e.stderr),u},Ot=async(e,t)=>{if(!(!e||t===void 0)){e.destroy();try{return await t}catch(u){return u.bufferedData}}},Tt=(e,{encoding:t,buffer:u,maxBuffer:n})=>{if(!(!e||!u))return t?bn(e,{encoding:t,maxBuffer:n}):bn.buffer(e,{maxBuffer:n})},wi=async({stdout:e,stderr:t,all:u},{encoding:n,buffer:D,maxBuffer:o},r)=>{const i=Tt(e,{encoding:n,buffer:D,maxBuffer:o}),s=Tt(t,{encoding:n,buffer:D,maxBuffer:o}),c=Tt(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},Ot(e,i),Ot(t,s),Ot(u,c)])}},Bi=(async()=>{})().constructor.prototype,vi=["then","catch","finally"].map(e=>[e,Reflect.getOwnPropertyDescriptor(Bi,e)]),wn=(e,t)=>{for(const[u,n]of vi){const D=typeof t=="function"?(...o)=>Reflect.apply(n.value,t(),o):n.value.bind(t);Reflect.defineProperty(e,u,{...n,value:D})}},Ai=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)})}),Bn=(e,t=[])=>Array.isArray(t)?[e,...t]:[e],$i=/^[\w.-]+$/,xi=/"/g,Si=e=>typeof e!="string"||$i.test(e)?e:`"${e.replace(xi,'\\"')}"`,ki=(e,t)=>Bn(e,t).join(" "),Mi=(e,t)=>Bn(e,t).map(u=>Si(u)).join(" "),Ii=DD("execa").enabled,Ue=(e,t)=>String(e).padStart(t,"0"),Oi=()=>{const e=new Date;return`${Ue(e.getHours(),2)}:${Ue(e.getMinutes(),2)}:${Ue(e.getSeconds(),2)}.${Ue(e.getMilliseconds(),3)}`},Ti=(e,{verbose:t})=>{t&&O.stderr.write(`[${Oi()}] ${e}
28
+ `)},Pi=1e3*1e3*100,Ri=({env:e,extendEnv:t,preferLocal:u,localDir:n,execPath:D})=>{const o=t?{...O.env,...e}:e;return u?Es({env:o,cwd:n,execPath:D}):o},_i=(e,t,u={})=>{const n=ps._parse(e,t,u);return e=n.command,t=n.args,u=n.options,u={maxBuffer:Pi,buffer:!0,stripFinalNewline:!0,extendEnv:!0,preferLocal:!1,localDir:u.cwd||O.cwd(),execPath:O.execPath,encoding:"utf8",reject:!0,cleanup:!0,all:!1,windowsHide:!0,verbose:Ii,...u},u.env=Ri(u),u.stdio=Gs(u),O.platform==="win32"&&oe.basename(e,".exe")==="cmd"&&t.unshift("/q"),{file:e,args:t,options:u,parsed:n}},Pt=(e,t,u)=>typeof t!="string"&&!Yr.isBuffer(t)?u===void 0?void 0:"":e.stripFinalNewline?Cs(t):t;function U(e,t,u){const n=_i(e,t,u),D=ki(e,t),o=Mi(e,t);Ti(o,n.options),ri(n.options);let r;try{r=gu.spawn(n.file,n.args,n.options)}catch(d){const F=new gu.ChildProcess,C=Promise.reject(pn({error:d,stdout:"",stderr:"",all:"",command:D,escapedCommand:o,parsed:n,timedOut:!1,isCanceled:!1,killed:!1}));return wn(F,C),F}const i=Ai(r),s=ni(r,n.options,i),c=Di(r,n.options,s),f={isCanceled:!1};r.kill=Ys.bind(null,r.kill.bind(r)),r.cancel=ti.bind(null,r,f);const a=ln(async()=>{const[{error:d,exitCode:F,signal:C,timedOut:p},h,w,A]=await wi(r,n.options,c),I=Pt(n.options,h),T=Pt(n.options,w),g=Pt(n.options,A);if(d||F!==0||C!==null){const B=pn({error:d,exitCode:F,signal:C,stdout:I,stderr:T,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:T,all:g,failed:!1,timedOut:!1,isCanceled:!1,killed:!1}});return yi(r,n.options),r.all=bi(r,n.options),si(r),wn(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 vn={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=>vn.enabled&&vn.supportLevel>=u?n+(""+r).replace(o,n)+D:""+r}const qe=De(2,22),ji=De(30,39),Rt=De(31,39),ye=De(32,39),Ni=De(35,39),Li=De(90,39),Gi=De(46,49),_t="\x1B",M=`${_t}[`,zi="\x07",jt={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:`${_t}7`,restore:`${_t}8`},Wi={up:(e=1)=>`${M}S`.repeat(e),down:(e=1)=>`${M}T`.repeat(e)},Ui={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?jt.up():"");return e&&(t+=jt.left),t}};var K={cursor:jt,scroll:Wi,erase:Ui,beep:zi},Nt={exports:{}};let He=process||{},An=He.argv||[],Ve=He.env||{},qi=!(Ve.NO_COLOR||An.includes("--no-color"))&&(!!Ve.FORCE_COLOR||An.includes("--color")||He.platform==="win32"||(He.stdout||{}).isTTY&&Ve.TERM!=="dumb"||!!Ve.CI),Hi=(e,t,u=e)=>n=>{let D=""+n,o=D.indexOf(t,e.length);return~o?e+Vi(D,t,u,o)+t:e+D+t},Vi=(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)},$n=(e=qi)=>{let t=e?Hi:()=>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")}};Nt.exports=$n(),Nt.exports.createColors=$n;var Ki=Nt.exports,E=se(Ki);function Ji({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 Yi=Ji();function xn(e){if(typeof e!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof e}\``);return e.replace(Yi,"")}function Sn(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var kn={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}})(kn);var Zi=kn.exports;const Xi=Sn(Zi);var Qi=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 ea=Sn(Qi);function be(e,t={}){if(typeof e!="string"||e.length===0||(t={ambiguousIsNarrow:!0,...t},e=xn(e),e.length===0))return 0;e=e.replace(ea()," ");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(Xi.eastAsianWidth(D)){case"F":case"W":n+=2;break;case"A":n+=u;break;default:n+=1}}return n}const Lt=10,Mn=(e=0)=>t=>`\x1B[${t+e}m`,In=(e=0)=>t=>`\x1B[${38+e};5;${t}m`,On=(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 ta=Object.keys(k.color),ua=Object.keys(k.bgColor);[...ta,...ua];function na(){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=Mn(),k.color.ansi256=In(),k.color.ansi16m=On(),k.bgColor.ansi=Mn(Lt),k.bgColor.ansi256=In(Lt),k.bgColor.ansi16m=On(Lt),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 ra=na(),Ke=new Set(["\x1B","\x9B"]),Da=39,Gt="\x07",Tn="[",oa="]",Pn="m",zt=`${oa}8;;`,Rn=e=>`${Ke.values().next().value}${Tn}${e}${Pn}`,_n=e=>`${Ke.values().next().value}${zt}${e}${Gt}`,sa=e=>e.split(" ").map(t=>be(t)),Wt=(e,t,u)=>{const n=[...t];let D=!1,o=!1,r=be(xn(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),Ke.has(s)&&(D=!0,o=n.slice(i+1).join("").startsWith(zt)),D){o?s===Gt&&(D=!1,o=!1):s===Pn&&(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())},ia=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("")},aa=(e,t,u={})=>{if(u.trim!==!1&&e.trim()==="")return"";let n="",D,o;const r=sa(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=>ia(c)));const s=[...i.join(`
29
+ `)];for(const[c,f]of s.entries()){if(n+=f,Ke.has(f)){const{groups:a}=new RegExp(`(?:\\${Tn}(?<code>\\d+)m|\\${zt}(?<uri>.*)${Gt})`).exec(s.slice(c).join(""))||{groups:{}};if(a.code!==void 0){const d=Number.parseFloat(a.code);D=d===Da?void 0:d}else a.uri!==void 0&&(o=a.uri.length===0?void 0:a.uri)}const l=ra.codes.get(Number(D));s[c+1]===`
30
+ `?(o&&(n+=_n("")),D&&l&&(n+=Rn(l))):f===`
31
+ `&&(D&&l&&(n+=Rn(D)),o&&(n+=_n(o)))}return n};function jn(e,t,u){return String(e).normalize().replace(/\r\n/g,`
32
32
  `).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(`
33
+ `).map(n=>aa(n,t,u)).join(`
34
+ `)}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,z=(e,t,u)=>(la(e,typeof t!="symbol"?t+"":t,u),u);function fa(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 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(`
36
+ `),D=[];for(let o=0;o<Math.max(u.length,n.length);o++)u[o]!==n[o]&&D.push(o);return D}const Nn=Symbol("clack:cancel");function da(e){return e===Nn}function Je(e,t){e.isTTY&&e.setRawMode(t)}const Ln=new Map([["k","up"],["j","down"],["h","left"],["l","right"]]),Fa=new Set(["up","down","left","right","space","enter"]);class Gn{constructor({render:t,input:u=Xr,output:n=Qr,...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 oD(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=vu.createInterface({input:this.input,output:t,tabSize:2,prompt:"",escapeCodeTimeout:50}),vu.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(Nn)})})}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&&Ln.has(u.name)&&this.emit("cursor",Ln.get(u.name)),u?.name&&Fa.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=jn(this._prevFrame,process.stdout.columns,{hard:!0}).split(`
38
+ `).length-1;this.output.write(K.cursor.move(-999,t*-1))}render(){const t=jn(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=fa(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(`
40
40
  `).slice(n);this.output.write(D.join(`
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(`
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 pa=Object.defineProperty,Ca=(e,t,u)=>t in e?pa(e,t,{enumerable:!0,configurable:!0,writable:!0,value:u}):e[t]=u,zn=(e,t,u)=>(Ca(e,typeof t!="symbol"?t+"":t,u),u);let ma=class extends Gn{constructor(e){super(e,!1),zn(this,"options"),zn(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 ha=Object.defineProperty,ga=(e,t,u)=>t in e?ha(e,t,{enumerable:!0,configurable:!0,writable:!0,value:u}):e[t]=u,Ea=(e,t,u)=>(ga(e,typeof t!="symbol"?t+"":t,u),u);class ya extends Gn{constructor(t){super(t),Ea(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 ba(){return O.platform!=="win32"?O.env.TERM!=="linux":!!O.env.CI||!!O.env.WT_SESSION||!!O.env.TERMINUS_SUBLIME||O.env.ConEmuTask==="{cmd::Cmder}"||O.env.TERM_PROGRAM==="Terminus-Sublime"||O.env.TERM_PROGRAM==="vscode"||O.env.TERM==="xterm-256color"||O.env.TERM==="alacritty"||O.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}const wa=ba(),Z=(e,t)=>wa?e:t,Ba=Z("\u25C6","*"),va=Z("\u25A0","x"),Aa=Z("\u25B2","x"),$a=Z("\u25C7","o"),xa=Z("\u250C","T"),G=Z("\u2502","|"),Ye=Z("\u2514","\u2014"),Sa=Z("\u25CF",">"),ka=Z("\u25CB"," "),Wn=e=>{switch(e){case"initial":case"active":return E.cyan(Ba);case"cancel":return E.red(va);case"error":return E.yellow(Aa);case"submit":return E.green($a)}},Ma=e=>new ya({validate:e.validate,placeholder:e.placeholder,defaultValue:e.defaultValue,initialValue:e.initialValue,render(){const t=`${E.gray(G)}
42
+ ${Wn(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(G)} ${n}
45
+ ${E.yellow(Ye)} ${E.yellow(this.error)}
46
+ `;case"submit":return`${t}${E.gray(G)} ${E.dim(this.value||e.placeholder)}`;case"cancel":return`${t}${E.gray(G)} ${E.strikethrough(E.dim(this.value??""))}${this.value?.trim()?`
47
+ `+E.gray(G):""}`;default:return`${t}${E.cyan(G)} ${n}
48
+ ${E.cyan(Ye)}
49
+ `}}}).prompt(),Ia=e=>{const t=(u,n)=>{const D=u.label??String(u.value);return n==="active"?`${E.green(Sa)} ${D} ${u.hint?E.dim(`(${u.hint})`):""}`:n==="selected"?`${E.dim(D)}`:n==="cancelled"?`${E.strikethrough(E.dim(D))}`:`${E.dim(ka)} ${E.dim(D)}`};return new ma({options:e.options,initialValue:e.initialValue,render(){const u=`${E.gray(G)}
50
+ ${Wn(this.state)} ${e.message}
51
+ `;switch(this.state){case"submit":return`${u}${E.gray(G)} ${t(this.options[this.cursor],"selected")}`;case"cancel":return`${u}${E.gray(G)} ${t(this.options[this.cursor],"cancelled")}
52
+ ${E.gray(G)}`;default:return`${u}${E.cyan(G)} ${this.options.map((n,D)=>t(n,D===this.cursor?"active":"inactive")).join(`
53
+ ${E.cyan(G)} `)}
54
+ ${E.cyan(Ye)}
55
+ `}}}).prompt()},Oa=(e="")=>{process.stdout.write(`${E.gray(xa)} ${e}
56
+ `)},Ze=(e="")=>{process.stdout.write(`${E.gray(G)}
57
+ ${E.gray(Ye)} ${e}
58
+
59
+ `)},Un=e=>Io,Ta=Un();class m extends Error{}const Ut=" ",Pa="https://github.com/sugarmo/aicommits/issues/new/choose",Ra=e=>e.trim().replace(/^github:/,"").replace(/^git\+/,"").replace(/\.git$/,""),qn=e=>{if(typeof e=="string"){const t=Ra(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 qn(e.url)},_a=(()=>{const e=qn(To);return e?`https://github.com/${e}/issues/new/choose`:Pa})(),qt=e=>{e instanceof Error&&!(e instanceof m)&&(e.stack&&console.error(qe(e.stack.split(`
60
60
  `).slice(1).join(`
61
61
  `))),console.error(`
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(`
62
+ ${Ut}${qe(`aicommits v${Ta}`)}`),console.error(`
63
+ ${Ut}Please open a Bug report with the information above:`),console.error(`${Ut}${_a}`))},Hn=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()},Vn=async()=>Hn(["--show-toplevel"]),ja=async(e,t)=>{const u=t||process.cwd(),n=await Hn(["--git-path",e],u);return N.isAbsolute(n)?n:N.resolve(u,n)},Kn=e=>`:(exclude)${e}`,Na=["package-lock.json","pnpm-lock.yaml","*.lock"].map(Kn),Jn=e=>e.split(`
64
+ `).filter(Boolean),Yn=e=>[...Na,...e?e.map(Kn):[]],Zn=async(e,t,u,n={})=>{const D=Yn(t),{stdout:o}=await U("git",[...e,"--name-only",...D],{cwd:u});if(!o)return;const r=n.includeSubmoduleCommits?[...e,"--submodule=log"]:e,{stdout:i}=await U("git",[...r,...D],{cwd:u});return{files:Jn(o),diff:i}},La=async(e,t)=>{const{stdout:u}=await U("git",["ls-files","--others","--exclude-standard","--",".",...Yn(e)],{cwd:t});return u?Jn(u):[]},Ga=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
- `)},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(`
66
+ `)},za=async e=>{const{stdout:t}=await U("git",["diff","--cached","--name-only"],{cwd:e});return t.trim().length>0},Ht=async(e,t,u)=>{const D=await Zn(["diff","--cached","--diff-algorithm=minimal"],e,t,u);if(D)return{...D,source:"staged"}},Wa=async(e,t,u)=>{const D=await Zn(["diff","--diff-algorithm=minimal"],e,t,u),o=await La(e,t);if(!D&&o.length===0)return;const r=await Ga(o,t),i=Array.from(new Set([...D?.files??[],...o])),s=[D?.diff,r].filter(Boolean).join(`
67
67
 
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(`
68
+ `);return{files:i,diff:s,source:"uncommitted"}},Xn=async(e,t,u)=>{const n=await Ht(e,t,u);if(n)return n;if(!await za(t))return Wa(e,t,u)},Ua=(e,t="staged")=>`Detected ${e.length.toLocaleString()} ${t} file${e.length>1?"s":""}`,Qn="message.md",er=["# 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
+ `),Xe=(e,t,u="")=>{const n=t?.trim()||u.trim();return n?N.isAbsolute(n)?n:N.join(e,n):""},qa=async e=>{await $.mkdir(N.dirname(e),{recursive:!0})},Ha=async(e,t)=>{let u;try{u=await $.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}`)},Va=async(e,t)=>{try{if(!(await $.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 qa(e),await $.writeFile(e,`${t.trimEnd()}
70
+ `,"utf8"),await Ha(e,"Message Markdown file")},tr=async(e,t)=>{const u=Xe(e,t,Qn);await Va(u,er);const n=await $.readFile(u,"utf8");return{messageFilePath:u,messageInstructionsMarkdown:n}},Vt=(e,t)=>Xe(e,t)||void 0,Ka=async({configDirectoryPath:e,messagePathValue:t,postResponseScriptValue:u,suppressErrors:n=!1})=>{if(n)try{return{...await tr(e,t),postResponseScriptPath:Vt(e,u)}}catch{return{messageFilePath:Xe(e,t,Qn),messageInstructionsMarkdown:er,postResponseScriptPath:Vt(e,u)}}return{...await tr(e,t),postResponseScriptPath:Vt(e,u)}},Kt=e=>`Flag "${e}" has been removed. Move commit message instructions into ~/.aicommits/message.md or point --message-file at another Markdown file.`,Ja={cn:"zh-CN","zh-cn":"zh-CN","zh-hans":"zh-CN",zh:"zh-CN","zh-tw":"zh-TW","zh-hant":"zh-TW"},Ya="message.md",Jt=["locale","type","details","details-style","instructions","conventional-format","conventional-types","conventional-scope","title-length-guide","detail-column-guide"],ur={"title-length-guide":["max-length"]},Za=new Set([...Jt,"max-length"]),W=(e,t,u)=>{if(!t)throw new m(`Invalid config property ${e}: ${u}`)},Yt=e=>typeof e=="string"||typeof e=="number"||typeof e=="boolean"?e:void 0,nr=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),rr=(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)`)},Xa=e=>{const t=e.trim().replace(/_/g,"-");return Ja[t.toLowerCase()]??t},Qa=e=>e?(W("type",typeof e=="string","Must be a string"),W("type",["","conventional"].includes(e),"Invalid commit type"),e):"",ec=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 W("details-style",["paragraph","list","markdown"].includes(t),"Must be one of: paragraph, list, markdown"),t},tc=e=>{if(e==null)return"";if(typeof e!="string")throw new m("Invalid config property instructions: Must be a string");return e.trim()},uc=e=>{if(e==null)return"";if(typeof e!="string")throw new m("Invalid config property conventional-format: Must be a string");return e.trim()},nc=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")}W("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 W("conventional-types",u.length>0,"Must contain at least one type"),JSON.stringify(Object.fromEntries(u))},rc=e=>{if(!e)return 50;W("title-length-guide",typeof e=="string"||typeof e=="number","Must be an integer");const t=Number(e);return W("title-length-guide",Number.isInteger(t),"Must be an integer"),W("title-length-guide",t>=20,"Must be greater than 20 characters"),t},Dc=e=>{if(!e)return 72;W("detail-column-guide",typeof e=="string"||typeof e=="number","Must be an integer");const t=Number(e);return W("detail-column-guide",Number.isInteger(t),"Must be an integer"),W("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 m("Invalid config property locale: Must be a string");const t=Xa(e);return W("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:Qa,details(e){return rr("details",e,!1)},"details-style":ec,instructions:tc,"conventional-format":uc,"conventional-types":nc,"conventional-scope"(e){return rr("conventional-scope",e,!1)},"title-length-guide":rc,"detail-column-guide":Dc},q=(e,t)=>{const u=Yt(e[t]);if(u!==void 0)return u;const n=ur[t]||[];for(const D of n){const o=Yt(e[D]);if(o!==void 0)return o}},oc=e=>Jt.some(t=>q(e,t)!==void 0),sc=e=>e.trim().replace(/[^\w.-]+/g,"-").replace(/-+/g,"-").replace(/^-+|-+$/g,"")||"profile",ic=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
- `)},oc=e=>{if(!e.details)return["## Body","- Return only the title line with no body."].join(`
72
+ `)},ac=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
- `)},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(`
74
+ `)},cc=e=>["# Commit Message Instructions","","## Language",`- Write the commit message strictly in ${e.locale}.`,"",ic(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.`,"",ac(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
+ `),lc=async e=>{await $.mkdir(N.dirname(e),{recursive:!0})},fc=async(e,t)=>{let u;try{u=await $.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}`)},dc=async(e,t)=>{try{if(!(await $.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 lc(e),await $.writeFile(e,`${t.trimEnd()}
76
+ `,"utf8"),await fc(e,"Migrated message Markdown file")},Fc=e=>({locale:J.locale(q(e,"locale")),type:J.type(q(e,"type")),details:J.details(q(e,"details")),"details-style":J["details-style"](q(e,"details-style")),instructions:J.instructions(q(e,"instructions")),"conventional-format":J["conventional-format"](q(e,"conventional-format")),"conventional-types":J["conventional-types"](q(e,"conventional-types")),"conventional-scope":J["conventional-scope"](q(e,"conventional-scope")),"title-length-guide":J["title-length-guide"](q(e,"title-length-guide")),"detail-column-guide":J["detail-column-guide"](q(e,"detail-column-guide"))}),pc=e=>{for(const t of Jt){delete e[t];const u=ur[t]||[];for(const n of u)delete e[n]}},Dr=async(e,t,u,n)=>{if(!oc(e))return!1;const D=Fc(e),o=Yt(e["message-path"]),r=typeof o=="string"&&o.trim()?o.trim():u,i=Xe(t,r,u);return await dc(i,cc(D)),n&&(e["message-path"]=r),pc(e),!0},Zt=async({backupConfig:e,config:t,configDirectoryPath:u,normalizeLegacyConfigKeys:n,writeConfig:D})=>{let o=!1;o=await Dr(t,u,Ya,!1)||o;const{profiles:r}=t;if(nr(r))for(const[i,s]of Object.entries(r)){if(!nr(s))continue;const c=`message.${sc(i)}.md`;o=await Dr(s,u,c,!0)||o}o&&(n(t),await e?.(),await D(t))},Cc=e=>{const t=e.trim();if(Za.has(t))return`Config property "${t}" has moved to your message Markdown file. Edit ~/.aicommits/message.md or set message-path instead.`},mc=["responses","chat"],hc=["none","low","medium","high","xhigh"],{hasOwnProperty:gc}=Object.prototype,or=(e,t)=>gc.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),ee=e=>typeof e=="string"||typeof e=="number"||typeof e=="boolean"?e:void 0,sr=(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)`)},Ec=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)},yc=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},ir=(e,t="")=>{if(e==null)return t;if(typeof e!="string")throw new m("Path values must be strings");return e.trim()||t},bc=/^[A-Za-z_]\w*$/,wc=e=>{if(typeof e!="string")return;const t=e.trim();if(!t)return;if(t.startsWith("env:")){const n=t.slice(4).trim();return bc.test(n)?n:void 0}return t.match(/^\$\{([A-Za-z_]\w*)\}$/)?.[1]},Bc=(e,t)=>{if(e!=="api-key")return t;const u=wc(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=yc(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 sr("show-reasoning",e,!1)},"include-submodule-commits"(e){return sr("include-submodule-commits",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",hc.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",mc.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 Ec(e)},"message-path"(e){try{return ir(e,"message.md")}catch{throw new m("Invalid config property message-path: Must be a string")}},"post-response-script"(e){try{return ir(e,"")}catch{throw new m("Invalid config property post-response-script: Must be a string")}}},vc={},Xt={"api-key":["openai-key","OPENAI_KEY","OPENAI_API_KEY"],"base-url":["openai-base-url","OPENAI_BASE_URL"],model:["OPENAI_MODEL"]},Y=N.join(Te.homedir(),".aicommits"),ar=N.join(Y,"config.toml"),Ac=[N.join(Te.homedir(),"aicommits.toml"),N.join(Te.homedir(),".aicommits")],$c=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},cr=e=>{const t=e.trim();return t.startsWith('"')&&t.endsWith('"')||t.startsWith("'")&&t.endsWith("'")?t.slice(1,-1):t},xc=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},Sc=(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},kc=e=>{const t=Object.create(null);let u=t;for(const n of e.split(/\r?\n/)){const D=$c(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(cr).map(f=>f.trim()).filter(Boolean);if(c.length===0){u=t;continue}u=Sc(t,c);continue}const o=D.indexOf("=");if(o<=0)continue;const r=cr(D.slice(0,o));if(!r)continue;const i=xc(D.slice(o+1));u[r]=i}return t},lr=e=>typeof e=="string"?JSON.stringify(e):String(e),Mc=e=>{const t=[],u=[],n=(D,o)=>{const r=[],i=[];for(const[s,c]of Object.entries(o)){const f=ee(c);if(f!==void 0){r.push(`${s} = ${lr(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=ee(o);if(r!==void 0){t.push(`${D} = ${lr(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 $.mkdir(Y,{recursive:!0});const t=Mc(e);await $.writeFile(ar,`${t}
78
+ `,"utf8")},Ic=async(e,t)=>{try{if((await $.lstat(e)).isFile())return;throw new m(`Backup path must point to a file: ${e}`)}catch(u){if(u.code!=="ENOENT")throw u}await $.mkdir(N.dirname(e),{recursive:!0}),await $.writeFile(e,t,"utf8")},Qt=async(e,t)=>{!e||t===void 0||await Ic(`${e}.bak`,t)},fr=async(e,t,u)=>{await Qt(t,u),await $.rm(t),await $.mkdir(Y,{recursive:!0}),await Zt({config:e,configDirectoryPath:Y,normalizeLegacyConfigKeys:Ae,writeConfig:ve}),await ve(e)},dr=async e=>{try{if(!(await $.lstat(e)).isFile())return;const u=await $.readFile(e,"utf8");return{config:kc(u),content:u,path:e}}catch{return}},Fr=async()=>{const e=await dr(ar);if(e)return{config:e.config,sourceContent:e.content,sourcePath:e.path};for(const t of Ac){const u=await dr(t);if(u)return{config:u.config,sourceContent:u.content,sourcePath:u.path}}return{config:Object.create(null)}},Oc=(e,t)=>{const u=Xt[e];if(!(!u||u.length===0))for(const n of u){const D=ee(t[n]);if(D!==void 0)return D}},Ae=e=>{for(const[t,u]of Object.entries(Xt)){if(ee(e[t])===void 0)for(const n of u){const D=ee(e[n]);if(D!==void 0){e[t]=D;break}}for(const n of u)delete e[n]}},Tc=(e,t,u)=>{if(!t)return;const{profiles:n}=e;if(!we(n))return;const D=n[t];if(we(D))return ee(D[u])},pr=e=>{const t=e.trim();return or(Be,t)?t:vc[t]},eu=async(e,t)=>{const{config:u,sourceContent:n,sourcePath:D}=await Fr(),o=D===Y;Ae(u),o&&D?await fr(u,D,n):await Zt({backupConfig:async()=>Qt(D,n),config:u,configDirectoryPath:Y,normalizeLegacyConfigKeys:Ae,writeConfig:ve});const r={},i=e?.profile??ee(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:Tc(u,s,a))??ee(u[a])??Oc(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 Ka({configDirectoryPath:Y,messagePathValue:c,postResponseScriptValue:f,suppressErrors:t});return{...r,configDirectoryPath:Y,...l}},Pc=async e=>{const{config:t,sourceContent:u,sourcePath:n}=await Fr(),D=n===Y;Ae(t),D&&n?await fr(t,n,u):await Zt({backupConfig:async()=>Qt(n,u),config:t,configDirectoryPath:Y,normalizeLegacyConfigKeys:Ae,writeConfig:ve});for(const[o,r]of e){const i=Cc(o);if(i)throw new m(i);const s=pr(o);if(!s)throw new m(`Invalid config property: ${o}`);const c=Be[s](r);t[s]=c;const f=Xt[s]||[];for(const l of f)delete t[l]}await ve(t)};var tu={},uu={exports:{}},$e={exports:{}},nu,Cr;function Rc(){if(Cr)return nu;Cr=1;var e=1e3,t=e*60,u=t*60,n=u*24,D=n*7,o=n*365.25;nu=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 nu}var ru,mr;function hr(){if(mr)return ru;mr=1;function e(t){n.debug=n,n.default=n,n.coerce=c,n.disable=i,n.enable=o,n.enabled=s,n.humanize=Rc(),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,C;function p(...h){if(!p.enabled)return;const w=p,A=Number(new Date),I=A-(a||A);w.diff=I,w.prev=a,w.curr=A,a=A,h[0]=n.coerce(h[0]),typeof h[0]!="string"&&h.unshift("%O");let T=0;h[0]=h[0].replace(/%([a-zA-Z%])/g,(B,y)=>{if(B==="%%")return"%";T++;const b=n.formatters[y];if(typeof b=="function"){const v=h[T];B=b.call(w,v),h.splice(T,1),T--}return B}),n.formatArgs.call(w,h),(w.log||n.log).apply(w,h)}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,C=n.enabled(l)),C),set:h=>{d=h}}),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,C=-1,p=0;for(;d<l.length;)if(F<a.length&&(a[F]===l[d]||a[F]==="*"))a[F]==="*"?(C=F,p=d,F++):(d++,F++);else if(C!==-1)F=C+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 ru=e,ru}$e.exports;var gr;function _c(){return gr||(gr=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=hr()(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:{}},Du,Er;function jc(){return Er||(Er=1,Du=(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)}),Du}var ou,yr;function Nc(){if(yr)return ou;yr=1;const e=Te,t=ot,u=jc(),{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 ou={supportsColor:i,stdout:o(r(!0,t.isatty(1))),stderr:o(r(!0,t.isatty(2)))},ou}xe.exports;var br;function Lc(){return br||(br=1,function(e,t){const u=ot,n=Bu;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=Nc();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,h)=>h.toUpperCase());let C=process.env[d];return/^(yes|on|true|enabled)$/i.test(C)?C=!0:/^(no|off|false|disabled)$/i.test(C)?C=!1:C==="null"?C=null:C=Number(C),a[F]=C,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 C=this.color,p="\x1B[3"+(C<8?C:"8;5;"+C),h=` ${p};1m${d} \x1B[0m`;a[0]=h+a[0].split(`
79
79
  `).join(`
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=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
80
+ `+h),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=hr()(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?uu.exports=_c():uu.exports=Lc();var su=uu.exports,iu={};Object.defineProperty(iu,"__esModule",{value:!0});function Gc(e){return function(t,u){return new Promise((n,D)=>{e.call(this,t,u,(o,r)=>{o?D(o):n(r)})})}}iu.default=Gc;var wr=_&&_.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};const zc=wu,Wc=wr(su),Uc=wr(iu),Se=Wc.default("agent-base");function qc(e){return!!e&&typeof e.addRequest=="function"}function au(){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 Qe(e,t){return new Qe.Agent(e,t)}(function(e){class t extends zc.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:au()?443:80}set defaultPort(n){this.explicitDefaultPort=n}get protocol(){return typeof this.explicitProtocol=="string"?this.explicitProtocol:au()?"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=au()),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),qc(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=Uc.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})(Qe||(Qe={}));var Hc=Qe,cu={},Vc=_&&_.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(cu,"__esModule",{value:!0});const Kc=Vc(su),ke=Kc.default("https-proxy-agent:parse-proxy-response");function Jc(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
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(`
86
+ `)),C=+F.split(" ")[1];ke("got proxy server response: %o",F),t({statusCode:C,buffered:a})}e.on("error",c),e.on("close",i),e.on("end",s),o()})}cu.default=Jc;var Yc=_&&_.__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(tu,"__esModule",{value:!0});const Br=de(iD),vr=de(aD),Zc=de(cD),Xc=de(bu),Qc=de(su),el=Hc,tl=de(cu),Me=Qc.default("https-proxy-agent:agent");class ul extends el.Agent{constructor(t){let u;if(typeof t=="string"?u=Zc.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||Dl(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 Yc(this,void 0,void 0,function*(){const{proxy:n,secureProxy:D}=this;let o;D?(Me("Creating `tls.Socket`: %o",n),o=vr.default.connect(n)):(Me("Creating `net.Socket`: %o",n),o=Br.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;rl(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=tl.default(o);o.write(`${s}\r
89
+ `);const{statusCode:d,buffered:F}=yield a;if(d===200){if(t.once("socket",nl),u.secureEndpoint){Me("Upgrading socket connection to TLS");const p=u.servername||u.host;return vr.default.connect(Object.assign(Object.assign({},ol(u,"host","hostname","path","port")),{socket:o,servername:p}))}return o}o.destroy();const C=new Br.default.Socket({writable:!1});return C.readable=!0,t.once("socket",p=>{Me("replaying proxy buffer for failed request"),Xc.default(p.listenerCount("data")>0),p.push(F),p.push(null)}),C})}}tu.default=ul;function nl(e){e.resume()}function rl(e,t){return!!(!t&&e===80||t&&e===443)}function Dl(e){return typeof e=="string"?/^https:?$/i.test(e):!1}function ol(e,...t){const u={};let n;for(n in e)t.includes(n)||(u[n]=e[n]);return u}var sl=_&&_.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};const lu=sl(tu);function fu(e){return new lu.default(e)}(function(e){e.HttpsProxyAgent=lu.default,e.prototype=lu.default.prototype})(fu||(fu={}));var il=fu,al=se(il);const cl=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
+ `)},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]:[]},ll=e=>{const t=e?.trim();return t?["User-provided commit intent:",t,"Use this intent as extra context for the purpose of the change. If it conflicts with the diff, prefer the diff."].join(`
91
+ `):""},fl=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."]:[],cl(e.changedFiles),ll(e.steer),...(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()&&Ar(e).length>0?["You already suggested a commit message and now need to revise it.",["Current suggested commit message:",e.rewriteFromMessage.trim()].join(`
92
+ `),["User rewrite feedback history:",...Ar(e).map((t,u)=>`${u+1}. ${t}`)].join(`
92
93
  `),"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
94
 
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(`
95
+ `),dl="<think>",Fl="</think>",et=()=>({carry:"",inReasoningBlock:!1}),pl=(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},du=(e,t)=>{let u=`${t.carry}${e}`;const n={carry:"",inReasoningBlock:t.inReasoningBlock};let D="",o="";for(;u.length>0;){const r=n.inReasoningBlock?Fl:dl,i=u.indexOf(r);if(i===-1){const c=pl(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}},$r=e=>({content:e.inReasoningBlock?"":e.carry,reasoning:e.inReasoningBlock?e.carry:"",state:et()}),Cl=e=>{let t=et(),u="",n="";for(const o of e){const r=du(o,t);u+=r.content,n+=r.reasoning,t=r.state}const D=$r(t);return u+=D.content,n+=D.reasoning,{content:u,reasoning:n}},ml=e=>Cl([e]).content,xr=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?al(o):void 0},a=sD.request(l,d=>{const F=[];d.on("data",C=>{F.push(C),i?.(C.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()}),Sr=(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}`}},hl=e=>Sr(e,"/chat/completions"),gl=e=>Sr(e,"/responses"),El=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 y of B){if(typeof y!="object"||y===null)continue;const{delta:b}=y;if(typeof b!="object"||b===null)continue;const v=b,x=typeof v.reasoning_content=="string"?v.reasoning_content:typeof v.reasoning=="string"?v.reasoning:"";if(x&&o({kind:"reasoning",text:x}),typeof v.content=="string"&&v.content.length>0){const H=typeof y.index=="number"?y.index:0;if(x){o({kind:"content",text:v.content});continue}const te=c.get(H)||et(),P=du(v.content,te);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,`
96
+ `);let B=s.indexOf(`
96
97
 
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(`
98
+ `);for(;B!==-1;){const y=s.slice(0,B);s=s.slice(B+2);for(const b of y.split(`
99
+ `)){const v=b.trim();if(!v.startsWith("data:"))continue;const x=v.slice(5).trim();if(!(!x||x==="[DONE]"))try{const H=JSON.parse(x);f(H)}catch{}}B=s.indexOf(`
99
100
 
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
+ `)}},a=hl(D),{response:d,data:F}=await xr(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
102
 
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
+ ${F}`),new m(g)}const C=F.trim();if(!C)throw new m("API Error: Empty response body");if(C.startsWith("{")){const g=JSON.parse(C),B=Array.isArray(g.choices)?g.choices:[];return{model:typeof g.model=="string"?g.model:"",choices:B.map((y,b)=>{const v=typeof y=="object"&&y!==null?y:{},x=typeof v.message=="object"&&v.message!==null?v.message:{};return{index:typeof v.index=="number"?v.index:b,finish_reason:typeof v.finish_reason=="string"||v.finish_reason===null?v.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 C.split(/\r?\n/)){const B=g.trim();if(!B.startsWith("data:"))continue;const y=B.slice(5).trim();if(!(!y||y==="[DONE]"))try{p.push(JSON.parse(y))}catch{}}if(p.length===0)throw new m("API Error: Unable to parse streamed response");const h=p.find(g=>typeof g.error=="object"&&g.error!==null);if(h?.error&&typeof h.error=="object"&&h.error!==null){const g="message"in h.error&&typeof h.error.message=="string"?h.error.message:JSON.stringify(h.error);throw new m(`API Error: ${g}`)}const w=p.find(g=>typeof g.model=="string")||p[0],A=new Map,I=new Map;for(const g of p){const B=Array.isArray(g.choices)?g.choices:[];for(const y of B){if(typeof y!="object"||y===null)continue;const b=y,v=typeof b.index=="number"?b.index:0,x=A.get(v)||{index:v,contentParts:[],reasoningParts:[]},{delta:H}=b;if(typeof H=="object"&&H!==null){const P=H;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 Ie=I.get(v)||et(),X=du(P.content,Ie);I.set(v,X.state),X.content&&x.contentParts.push(X.content),X.reasoning&&x.reasoningParts.push(X.reasoning)}typeof P.reasoning_content=="string"&&x.reasoningParts.push(P.reasoning_content),typeof P.reasoning=="string"&&x.reasoningParts.push(P.reasoning)}const te=b.finish_reason;(typeof te=="string"||te===null)&&(x.finishReason=te),A.set(v,x)}}for(const[g,B]of I.entries()){const y=A.get(g);if(!y)continue;const b=$r(B);b.content&&y.contentParts.push(b.content),b.reasoning&&y.reasoningParts.push(b.reasoning)}const T=Array.from(A.values()).sort((g,B)=>g.index-B.index).map(g=>{const B={role:g.role||"assistant",content:g.contentParts.join("")},y=g.reasoningParts.join("");return y&&(B.reasoning_content=y),{index:g.index,finish_reason:g.finishReason??"stop",message:B}});if(T.length===0)throw new m("API Error: Streamed response did not include any choices");return{model:typeof w.model=="string"?w.model:"",choices:T}},yl=(e,t)=>({model:e,messages:t}),kr=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=kr(e);return!u||n.length===0?[]:[{role:"assistant",content:u},{role:"user",content:bl(n)}]},bl=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
104
 
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(`
105
+ `),wl=(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]},Bl=(e,t,u)=>({model:e,instructions:t,input:u}),vl=(e,t)=>{const u=Fu(t);return u.length===0?e:[{role:"user",content:e},...u]},Mr=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(""):"",Ir=e=>{const t=Array.isArray(e.output)?e.output:[],u=t.filter(D=>D?.type==="message"||D?.role==="assistant").map(D=>Mr(D.content)).join(""),n=t.filter(D=>D?.type==="reasoning").map(D=>Mr(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}:{}}}]}},Al=e=>{const t=e.find(D=>D.type==="response.completed");if(t&&typeof t.response=="object"&&t.response!==null)return Ir(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}:{}}}]}},$l=async(e,t,u,n,D,o,r)=>{const i={...t,...r,stream:!0};let s="";const c=h=>{if(!(!o||typeof h.type!="string")){if(h.type.includes("reasoning")&&h.type.endsWith(".delta")&&typeof h.delta=="string"){o({kind:"reasoning",text:h.delta});return}h.type.includes("output_text")&&h.type.endsWith(".delta")&&typeof h.delta=="string"&&o({kind:"content",text:h.delta})}},f=h=>{if(!o)return;s+=h.replace(/\r\n/g,`
106
+ `);let w=s.indexOf(`
106
107
 
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(`
108
+ `);for(;w!==-1;){const A=s.slice(0,w);s=s.slice(w+2);for(const I of A.split(`
109
+ `)){const T=I.trim();if(!T.startsWith("data:"))continue;const g=T.slice(5).trim();if(!(!g||g==="[DONE]"))try{c(JSON.parse(g))}catch{}}w=s.indexOf(`
109
110
 
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
+ `)}},l=gl(D),{response:a,data:d}=await xr(l.hostname,l.path,{Authorization:`Bearer ${e}`},i,u,n,l.port,f);if(!a.statusCode||a.statusCode<200||a.statusCode>299){let h=`API Error: ${a.statusCode} - ${a.statusMessage}`;throw d&&(h+=`
111
112
 
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}
113
+ ${d}`),new m(h)}const F=d.trim();if(!F)throw new m("API Error: Empty response body");if(F.startsWith("{"))return Ir(JSON.parse(F));const C=[];for(const h of F.split(/\r?\n/)){const w=h.trim();if(!w.startsWith("data:"))continue;const A=w.slice(5).trim();if(!(!A||A==="[DONE]"))try{C.push(JSON.parse(A))}catch{}}if(C.length===0)throw new m("API Error: Unable to parse streamed response");const p=C.find(h=>h.type==="error"||typeof h.error=="object"&&h.error!==null);if(p){if(typeof p.error=="object"&&p.error!==null){const h="message"in p.error&&typeof p.error.message=="string"?p.error.message:JSON.stringify(p.error);throw new m(`API Error: ${h}`)}if(typeof p.message=="string")throw new m(`API Error: ${p.message}`)}return Al(C)},pu=e=>e.replace(/\r\n?/g,`
114
+ `),xl=e=>{const t=e.match(/```[\w-]*\n([\s\S]*?)```/);return t?.[1]?t[1].trim():e.replace(/```/g,"").trim()},Sl=e=>e.trim().replace(/^title:\s*/i,"").replace(/(\w)\.$/,"$1").replace(/^["'`]|["'`]$/g,""),kl=e=>{const t=pu(e).trim();if(!t)return{title:"",body:""};const u=t.split(`
115
+ `).map(o=>o.replace(/\s+$/g,""));for(;u[0]?.trim()==="";)u.shift();const n=Sl(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(`
116
+ `).trim();return{title:n,body:D}},Ml=(e,t)=>t?`${e}
116
117
 
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
+ ${t}`:e,Il=(e,t,u,n)=>{const D=xl(e),{title:o,body:r}=kl(D);if(!o)return"";const i=pu(r).split(`
118
119
  `).map(s=>s.replace(/\s+$/u,"")).join(`
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)}
120
+ `).trim();return i?Ml(o,i):o},Ol=["none","low","medium","high","xhigh"],tt=e=>{if(typeof e!="string")return;const t=e.trim().toLowerCase();return Ol.includes(t)?t:void 0},Tl=(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=tt(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)&&tt(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)?tt(n.reasoning.effort):void 0;return D&&tt(n.reasoning_effort)===void 0&&(n.reasoning_effort=D),delete n.reasoning,delete n.max_output_tokens,n},Pl=(e,t,u)=>{const n=Tl(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}},Rl=e=>Array.from(new Set(e)),Or=12e4,_l=1024,jl=3,Nl=900,Ll=700,Gl=450,zl=.85,ut="[Diff compacted to fit model context. Each file is represented with abbreviated hunks when needed.]",Tr="@@ ... patch content truncated ... @@",Wl=(e=0)=>{if(!Number.isInteger(e)||e<=0)return Or;const t=Nl+Ll+Gl,u=Math.floor((e-t)*zl),n=Math.max(128,u);return Math.max(_l,n*jl)},Ul=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},Pr=(e,t)=>{if(t<=0)return"";if(e.length<=t)return e;const u=Tr.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}
121
+ ${Tr}
122
+ ${f}`.slice(0,t):e.slice(0,t)},ql=(e,t=Or)=>{const u=pu(e).trim();if(!u)return u;if(t<=0)return"";const n=ut.length+2;if(u.length<=t)return u;if(t<=n)return u.slice(0,t);const D=t-n,o=Ul(u);if(o.length<=1)return`${Pr(u,D)}
122
123
 
123
- ${tt}`;const r=`
124
+ ${ut}`;const r=`
124
125
 
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
+ `,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=>Pr(a,c)).filter(Boolean).join(r)}
126
127
 
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}
128
+ ${ut}`},Rr=async(e,t,u,n,D,o,r,i)=>{const s=r??{messageInstructionsMarkdown:""},c=s.apiMode??"responses",f=Pl(s.requestOptionsJson,c,s.reasoningEffort),l=Wl(s.contextWindowTokens),a=ql(u,l),d=a.includes(ut),F=kr(s),C=Fu(s);try{const p=Hl({messageInstructionsMarkdown:s.messageInstructionsMarkdown||"",steer:s.steer,changedFiles:s.changedFiles,diffWasCompacted:d,rewriteFromMessage:s.rewriteFromMessage,rewriteFeedback:s.rewriteFeedback,rewriteFeedbackHistory:F,rewriteConversation:C}),h=Math.max(1,n),A=(await Promise.all(Array.from({length:h},()=>c==="responses"?$l(e,Bl(t,p,vl(a,{rewriteConversation:C,rewriteFromMessage:s.rewriteFromMessage,rewriteFeedback:s.rewriteFeedback,rewriteFeedbackHistory:F})),D,o,i,I=>s.onStreamEvent?.({phase:"message",...I}),f):El(e,yl(t,wl(p,a,{rewriteConversation:C,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 T=I.message?.content;if(typeof T!="string")return[];const g=Il(ml(T));return g?[g]:[]});return Rl(A)}catch(p){const h=p;throw h.code==="ENOTFOUND"?new m(`Error connecting to ${h.hostname} (${h.syscall}). Are you connected to the internet?`):h}},Hl=e=>fl({messageInstructionsMarkdown:e.messageInstructionsMarkdown||"",steer:e.steer,changedFiles:e.changedFiles,diffWasCompacted:e.diffWasCompacted,rewriteFromMessage:e.rewriteFromMessage,rewriteFeedback:e.rewriteFeedback,rewriteFeedbackHistory:e.rewriteFeedbackHistory,rewriteConversation:e.rewriteConversation}),_r=()=>{const e=["|","/","-","\\"],t=process.stdout.isTTY?120:1e4;let u=0,n="",D=!1,o;const r=Li("\u2502"),i=c=>{if(!process.stdout.isTTY){process.stdout.write(`${c}
129
+ `);return}process.stdout.write(`\r\x1B[2K${c}`)},s=()=>{const c=e[u];i(`${Ni("\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
130
  `),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
131
  `);for(const a of f)process.stdout.write(`${r} ${a}
131
132
  `);return}process.stdout.write(`${c}
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
+ `)}}}},Vl=e=>e.replace(/\s+$/u,""),jr=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=Vl(n.stdout);if(!D)throw new m("Post-response script produced an empty commit message.");return D},Nr="\0use-commit-message",Kl="\0rewrite-commit-message",nt="\0cancel",Lr="\0back",Jl=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()}},Gr=async(e,t,u)=>{const n=await e.select({message:`Review this commit message:
133
134
 
134
135
  ${t}
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=`
136
+ `,options:[{label:"Use this commit message",value:Nr},{label:"Ask AI to rewrite it",hint:"Give feedback and regenerate",value:Kl},...u?[{label:"Back to suggestions",value:Lr}]:[],{label:"Cancel",value:nt}]});return e.isCancel(n)||n===nt?{status:"cancelled"}:n===Lr?{status:"back"}:n===Nr?{status:"submitted",message:t}:Jl(e,t)},Yl=async(e,t)=>{if(e.length===1){const[n]=e,D=await Gr(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:nt}]});if(t.isCancel(n)||n===nt)return{status:"cancelled"};const D=await Gr(t,n,!0);if(D.status!=="back")return u=!1,D}return{status:"cancelled"}},Zl=e=>Yl(e,{select:Ia,text:Ma,isCancel:da}),Xl=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`},Ql=(e,t)=>{const u=Date.now(),n=1e3,D=()=>e.update(`The AI (${t}) is thinking for ${Xl(Date.now()-u)}`);D();const o=setInterval(D,n);return()=>clearInterval(o)};var ef=async(e,t,u,n,D,o,r,i,s,c,f,l,a)=>(async()=>{Oa(Gi(ji(" aicommits "))),await Vn();const d=_r();u&&await U("git",["add","--update"]),d.start("Detecting git changes");const F=await Xn(t);if(!F)throw d.stop("Detecting git changes"),new m("No staged changes found. Stage your changes manually, or automatically stage all changes with the `--all` flag.");d.stop(`${Ua(F.files,F.source)}:
137
+ ${F.files.map(y=>` ${y}`).join(`
138
+ `)}`);let C=F;const p=await eu({generate:e?.toString(),"show-reasoning":n===!0?"true":void 0,"reasoning-effort":D,"api-mode":o,"message-path":r,"post-response-script":s,"base-url":c});p["include-submodule-commits"]&&(C=await Xn(t,void 0,{includeSubmoduleCommits:!0})??C);const h={messageInstructionsMarkdown:p.messageInstructionsMarkdown,steer:i,reasoningEffort:p["reasoning-effort"],requestOptionsJson:p["request-options"],apiMode:p["api-mode"],contextWindowTokens:p["context-window"],changedFiles:C.files},w=p["show-reasoning"]===!0,A=async({completions:y=p.generate,rewriteFromMessage:b,rewriteFeedback:v,rewriteFeedbackHistory:x,rewriteConversation:H,statusMessage:te=`The AI (${p.model}) is analyzing your changes`,finishedMessage:P="Changes analyzed"}={})=>{const Fe=_r();Fe.start(te);let Ie,X=!1,Dt=!0,mu=!1,hu;const Vr={message:"Message Generation"},Kr=Q=>{if(!(Q.kind!=="reasoning"||!Q.text)){if(!w){X||(Ie=Ql(Fe,p.model),X=!0);return}Dt&&(Fe.stop(`The AI (${p.model}) is thinking`),Dt=!1),mu||(process.stdout.write(`${qe(`
139
+ The AI (${p.model}) is thinking`)}
140
+ `),mu=!0),Q.phase!==hu&&(hu=Q.phase,process.stdout.write(`${qe(`[${Vr[Q.phase]}]
141
+ `)}`)),process.stdout.write(Q.text)}};let Oe;try{Oe=await Rr(p["api-key"],p.model,C.diff,y,p.timeout,p.proxy,{...h,rewriteFromMessage:b,rewriteFeedback:v,rewriteFeedbackHistory:x,rewriteConversation:H,onStreamEvent:Kr},p["base-url"])}finally{Ie?.(),Dt?Fe.stop(P):w&&process.stdout.write(`
142
+ `)}if(Oe.length===0)throw new m("No commit messages were generated. Try again.");return Promise.all(Oe.map((Q,Jr)=>jr(Q,p.postResponseScriptPath,{candidateCount:Oe.length,candidateIndex:Jr,commitSource:"cli",configDirectoryPath:p.configDirectoryPath,cwd:process.cwd(),messageFilePath:p.messageFilePath})))};let I=await A(),T=[],g=[],B="";if(f)[B]=I;else try{let y=!0;for(;y;){const b=await Zl(I);if(b.status==="cancelled"){Ze("Commit cancelled");return}if(b.status==="submitted"){B=b.message,y=!1;break}T=[...T,b.feedback],g=[...g,{role:"assistant",content:b.message},{role:"user",content:b.feedback}],I=await A({completions:1,rewriteFromMessage:b.message,rewriteFeedback:b.feedback,rewriteFeedbackHistory:T,rewriteConversation:g,statusMessage:`The AI (${p.model}) is revising your commit message`,finishedMessage:"Commit message revised"})}}catch(y){const b=y instanceof Error?y.message:"";throw b.includes("TTY initialization failed")||b.includes("uv_tty_init returned EINVAL")||b.includes("ERR_TTY_INIT_FAILED")?new m("Interactive terminal initialization failed in this environment. Re-run with `--confirm` or `--yes` to skip prompts."):y}if(l){process.stdout.write(`${B}
143
+ `),Ze(`${ye("\u2714")} Commit message printed`);return}C.source==="uncommitted"&&await U("git",["add","--all","--",...C.files]),await U("git",["commit","-m",B,...a]),Ze(`${ye("\u2714")} Successfully committed!`)})().catch(d=>{Ze(`${Rt("\u2716")} ${d.message}`),qt(d),process.exit(1)});const tf="prepare-commit-msg-hook",uf=()=>{const e=process.argv.slice(2);return e[0]===tf?e.slice(1):e},nf=async()=>{const{stdout:e}=await U("git",["rev-parse","--git-path","COMMIT_EDITMSG"],{reject:!1}),t=e.trim();return t===""?void 0:t},rf=async e=>$.readFile(e,"utf8").catch(t=>{if(t.code==="ENOENT")return"";throw t});var Df=()=>(async()=>{const[e,t]=uf(),u=e?.trim()||await nf();if(!u)return;const n=await rf(u);if(t==="message"&&n.trim()!=="")return;const o=await Ht();if(!o)return;const r=await eu({}),i=r["include-submodule-commits"]?await Ht(void 0,void 0,{includeSubmoduleCommits:!0})??o:o,s={messageInstructionsMarkdown:r.messageInstructionsMarkdown,reasoningEffort:r["reasoning-effort"],requestOptionsJson:r["request-options"],apiMode:r["api-mode"],contextWindowTokens:r["context-window"],changedFiles:i.files},c=await Rr(r["api-key"],r.model,i.diff,r.generate,r.timeout,r.proxy,s,r["base-url"]);if(c.length===0)return;const f=c[0]?.trim();if(!f)return;let l=f;try{l=await jr(f,r.postResponseScriptPath,{candidateCount:1,candidateIndex:0,commitSource:"hook",configDirectoryPath:r.configDirectoryPath,cwd:process.cwd(),messageFilePath:r.messageFilePath})}catch{}const a=`${l}
144
+ `;await $.writeFile(u,a),process.stdout.write(a)})().catch(()=>{});const of=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 sf=Vu({name:"config",parameters:["<mode>","<key=value...>"]},e=>{(async()=>{const{mode:t,keyValue:u}=e._;if(t==="get"){const n=await eu({},!0);for(const D of u){const o=pr(D);o&&or(n,o)&&console.log(`${o}=${n[o]}`)}return}if(t==="set"){await Pc(u.map(of));return}throw new m(`Invalid mode: ${t}`)})().catch(t=>{console.error(`${Rt("\u2716")} ${t.message}`),qt(t),process.exit(1)})});const af=e=>$.lstat(e).then(()=>!0,()=>!1),Cu="prepare-commit-msg",cf="prepare-commit-msg-hook",lf=`/hooks/${Cu}`,zr=new URL(import.meta.url.endsWith(".ts")?"../cli.ts":"../cli.mjs",import.meta.url),Wr=Au(zr),ff=import.meta.url.endsWith(".ts")?new URL("../../node_modules/tsx/dist/cli.mjs",import.meta.url):zr,df=Au(ff),Ur=`
144
145
  #!/usr/bin/env node
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);
146
+ process.argv.splice(2, 0, ${JSON.stringify(cf)});
147
+ ${import.meta.url.endsWith(".ts")?`process.argv.splice(2, 0, ${JSON.stringify(Wr)});`:""}
148
+ import(${JSON.stringify(lD(df))})
149
+ `.trim(),Ff=(process.argv[1]||"").replace(/\\/g,"/").endsWith(lf),qr=async e=>await $.readFile(e,"utf8").catch(()=>{})===Ur,Hr=async e=>await $.realpath(e).catch(()=>{})===Wr;var pf=Vu({name:"hook",parameters:["<install/uninstall>"]},e=>{(async()=>{const t=await Vn(),{installUninstall:u}=e._,n=await ja("hooks",t),D=N.join(n,Cu),o=await af(D);if(u==="install"){if(o){if(await qr(D)){console.warn("The hook is already installed");return}if(await Hr(D))await $.rm(D);else throw new m(`A different ${Cu} hook seems to be installed. Please remove it before installing aicommits.`)}await $.mkdir(N.dirname(D),{recursive:!0}),await $.writeFile(D,Ur),await $.chmod(D,493),console.log(`${ye("\u2714")} Hook installed`);return}if(u==="uninstall"){if(!o){console.warn("Hook is not installed");return}if(!(await qr(D)||await Hr(D))){console.warn("Hook is not installed");return}await $.rm(D),console.log(`${ye("\u2714")} Hook uninstalled`);return}throw new m(`Invalid mode: ${u}`)})().catch(t=>{console.error(`${Rt("\u2716")} ${t.message}`),qt(t),process.exit(1)})});const Cf=Un(),rt=process.argv.slice(2),mf=rt[0]==="prepare-commit-msg-hook",hf=[{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"]}];Mo({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"},steer:{type:String,description:"One-off context describing the intended purpose of this commit"},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:[sf,pf],help:{description:Oo},ignoreArgv:e=>e==="unknown-flag"||e==="argument"},e=>{if(e.flags.type!==void 0)throw new m(Kt("--type"));if(e.flags.details!==void 0)throw new m(Kt("--details"));for(const{flag:t,matches:u}of hf)if(rt.some(n=>u.some(D=>n===D||n.startsWith(`${D}=`))))throw new m(Kt(t));if(e.flags.version&&(console.log(Cf),process.exit(0)),Ff||mf)Df();else{const t=e.flags.print||e.flags.noCommit,u=[...rt];ef(e.flags.generate,e.flags.exclude,e.flags.all,e.flags.showReasoning,e.flags.reasoningEffort,e.flags.apiMode,e.flags.messageFile,e.flags.steer,e.flags.postResponseScript,e.flags.baseUrl,e.flags.confirm||e.flags.yes||t,t,u)}},rt);