agentica 0.27.3 → 0.29.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 +17 -2
  2. package/dist/index.mjs +94 -89
  3. package/package.json +4 -3
package/dist/index.mjs CHANGED
@@ -1,98 +1,103 @@
1
- import Q,{stdin as xs,stdout as Ts}from"node:process";import{stripVTControlCharacters as Tr,promisify as $r}from"node:util";import*as We from"node:readline";import $s from"node:readline";import{WriteStream as Nr}from"node:tty";import Te from"events";import Ir from"child_process";import fe from"path";import Ce from"fs";import Ns from"process";import Se,{existsSync as at}from"node:fs";import Oe,{rm as Lr,appendFile as Pr,readFile as ht,writeFile as lt}from"node:fs/promises";import de,{join as we}from"node:path";import{fileURLToPath as Mr}from"node:url";import{spawn as kr}from"node:child_process";import{once as Is,on as jr}from"node:events";import{pipeline as Hr}from"node:stream/promises";import*as Ur from"node:readline/promises";import zr from"node:os";import{pipeline as Gr}from"node:stream";import Ls from"stream";import Ps from"string_decoder";import ct from"assert";import qr from"buffer";import Ms from"zlib";import Wr from"util";import Vr from"crypto";var Dt=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function ks(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}function Kr(s){if(Object.prototype.hasOwnProperty.call(s,"__esModule"))return s;var t=s.default;if(typeof t=="function"){var i=function n(){return this instanceof n?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};i.prototype=t.prototype}else i={};return Object.defineProperty(i,"__esModule",{value:!0}),Object.keys(s).forEach(function(n){var r=Object.getOwnPropertyDescriptor(s,n);Object.defineProperty(i,n,r.get?r:{enumerable:!0,get:function(){return s[n]}})}),i}var ft,js;function Yr(){if(js)return ft;js=1;const s="\x1B",t=`${s}[`,i="\x07",n={to(e,u){return u?`${t}${u+1};${e+1}H`:`${t}${e+1}G`},move(e,u){let h="";return e<0?h+=`${t}${-e}D`:e>0&&(h+=`${t}${e}C`),u<0?h+=`${t}${-u}A`:u>0&&(h+=`${t}${u}B`),h},up:(e=1)=>`${t}${e}A`,down:(e=1)=>`${t}${e}B`,forward:(e=1)=>`${t}${e}C`,backward:(e=1)=>`${t}${e}D`,nextLine:(e=1)=>`${t}E`.repeat(e),prevLine:(e=1)=>`${t}F`.repeat(e),left:`${t}G`,hide:`${t}?25l`,show:`${t}?25h`,save:`${s}7`,restore:`${s}8`},r={up:(e=1)=>`${t}S`.repeat(e),down:(e=1)=>`${t}T`.repeat(e)},a={screen:`${t}2J`,up:(e=1)=>`${t}1J`.repeat(e),down:(e=1)=>`${t}J`.repeat(e),line:`${t}2K`,lineEnd:`${t}K`,lineStart:`${t}1K`,lines(e){let u="";for(let h=0;h<e;h++)u+=this.line+(h<e-1?n.up():"");return e&&(u+=n.left),u}};return ft={cursor:n,scroll:r,erase:a,beep:i},ft}var pe=Yr(),Ve={exports:{}},Hs;function Zr(){if(Hs)return Ve.exports;Hs=1;let s=process||{},t=s.argv||[],i=s.env||{},n=!(i.NO_COLOR||t.includes("--no-color"))&&(!!i.FORCE_COLOR||t.includes("--color")||s.platform==="win32"||(s.stdout||{}).isTTY&&i.TERM!=="dumb"||!!i.CI),r=(u,h,m=u)=>y=>{let p=""+y,C=p.indexOf(h,u.length);return~C?u+a(p,h,m,C)+h:u+p+h},a=(u,h,m,y)=>{let p="",C=0;do p+=u.substring(C,y)+m,C=y+h.length,y=u.indexOf(h,C);while(~y);return p+u.substring(C)},e=(u=n)=>{let h=u?r:()=>String;return{isColorSupported:u,reset:h("\x1B[0m","\x1B[0m"),bold:h("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"),dim:h("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"),italic:h("\x1B[3m","\x1B[23m"),underline:h("\x1B[4m","\x1B[24m"),inverse:h("\x1B[7m","\x1B[27m"),hidden:h("\x1B[8m","\x1B[28m"),strikethrough:h("\x1B[9m","\x1B[29m"),black:h("\x1B[30m","\x1B[39m"),red:h("\x1B[31m","\x1B[39m"),green:h("\x1B[32m","\x1B[39m"),yellow:h("\x1B[33m","\x1B[39m"),blue:h("\x1B[34m","\x1B[39m"),magenta:h("\x1B[35m","\x1B[39m"),cyan:h("\x1B[36m","\x1B[39m"),white:h("\x1B[37m","\x1B[39m"),gray:h("\x1B[90m","\x1B[39m"),bgBlack:h("\x1B[40m","\x1B[49m"),bgRed:h("\x1B[41m","\x1B[49m"),bgGreen:h("\x1B[42m","\x1B[49m"),bgYellow:h("\x1B[43m","\x1B[49m"),bgBlue:h("\x1B[44m","\x1B[49m"),bgMagenta:h("\x1B[45m","\x1B[49m"),bgCyan:h("\x1B[46m","\x1B[49m"),bgWhite:h("\x1B[47m","\x1B[49m"),blackBright:h("\x1B[90m","\x1B[39m"),redBright:h("\x1B[91m","\x1B[39m"),greenBright:h("\x1B[92m","\x1B[39m"),yellowBright:h("\x1B[93m","\x1B[39m"),blueBright:h("\x1B[94m","\x1B[39m"),magentaBright:h("\x1B[95m","\x1B[39m"),cyanBright:h("\x1B[96m","\x1B[39m"),whiteBright:h("\x1B[97m","\x1B[39m"),bgBlackBright:h("\x1B[100m","\x1B[49m"),bgRedBright:h("\x1B[101m","\x1B[49m"),bgGreenBright:h("\x1B[102m","\x1B[49m"),bgYellowBright:h("\x1B[103m","\x1B[49m"),bgBlueBright:h("\x1B[104m","\x1B[49m"),bgMagentaBright:h("\x1B[105m","\x1B[49m"),bgCyanBright:h("\x1B[106m","\x1B[49m"),bgWhiteBright:h("\x1B[107m","\x1B[49m")}};return Ve.exports=e(),Ve.exports.createColors=e,Ve.exports}var Ee=Zr();const I=ks(Ee);function Xr({onlyFirst:s=!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,s?void 0:"g")}const Jr=Xr();function Us(s){if(typeof s!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof s}\``);return s.replace(Jr,"")}function zs(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}var Gs={exports:{}};(function(s){var t={};s.exports=t,t.eastAsianWidth=function(n){var r=n.charCodeAt(0),a=n.length==2?n.charCodeAt(1):0,e=r;return 55296<=r&&r<=56319&&56320<=a&&a<=57343&&(r&=1023,a&=1023,e=r<<10|a,e+=65536),e==12288||65281<=e&&e<=65376||65504<=e&&e<=65510?"F":e==8361||65377<=e&&e<=65470||65474<=e&&e<=65479||65482<=e&&e<=65487||65490<=e&&e<=65495||65498<=e&&e<=65500||65512<=e&&e<=65518?"H":4352<=e&&e<=4447||4515<=e&&e<=4519||4602<=e&&e<=4607||9001<=e&&e<=9002||11904<=e&&e<=11929||11931<=e&&e<=12019||12032<=e&&e<=12245||12272<=e&&e<=12283||12289<=e&&e<=12350||12353<=e&&e<=12438||12441<=e&&e<=12543||12549<=e&&e<=12589||12593<=e&&e<=12686||12688<=e&&e<=12730||12736<=e&&e<=12771||12784<=e&&e<=12830||12832<=e&&e<=12871||12880<=e&&e<=13054||13056<=e&&e<=19903||19968<=e&&e<=42124||42128<=e&&e<=42182||43360<=e&&e<=43388||44032<=e&&e<=55203||55216<=e&&e<=55238||55243<=e&&e<=55291||63744<=e&&e<=64255||65040<=e&&e<=65049||65072<=e&&e<=65106||65108<=e&&e<=65126||65128<=e&&e<=65131||110592<=e&&e<=110593||127488<=e&&e<=127490||127504<=e&&e<=127546||127552<=e&&e<=127560||127568<=e&&e<=127569||131072<=e&&e<=194367||177984<=e&&e<=196605||196608<=e&&e<=262141?"W":32<=e&&e<=126||162<=e&&e<=163||165<=e&&e<=166||e==172||e==175||10214<=e&&e<=10221||10629<=e&&e<=10630?"Na":e==161||e==164||167<=e&&e<=168||e==170||173<=e&&e<=174||176<=e&&e<=180||182<=e&&e<=186||188<=e&&e<=191||e==198||e==208||215<=e&&e<=216||222<=e&&e<=225||e==230||232<=e&&e<=234||236<=e&&e<=237||e==240||242<=e&&e<=243||247<=e&&e<=250||e==252||e==254||e==257||e==273||e==275||e==283||294<=e&&e<=295||e==299||305<=e&&e<=307||e==312||319<=e&&e<=322||e==324||328<=e&&e<=331||e==333||338<=e&&e<=339||358<=e&&e<=359||e==363||e==462||e==464||e==466||e==468||e==470||e==472||e==474||e==476||e==593||e==609||e==708||e==711||713<=e&&e<=715||e==717||e==720||728<=e&&e<=731||e==733||e==735||768<=e&&e<=879||913<=e&&e<=929||931<=e&&e<=937||945<=e&&e<=961||963<=e&&e<=969||e==1025||1040<=e&&e<=1103||e==1105||e==8208||8211<=e&&e<=8214||8216<=e&&e<=8217||8220<=e&&e<=8221||8224<=e&&e<=8226||8228<=e&&e<=8231||e==8240||8242<=e&&e<=8243||e==8245||e==8251||e==8254||e==8308||e==8319||8321<=e&&e<=8324||e==8364||e==8451||e==8453||e==8457||e==8467||e==8470||8481<=e&&e<=8482||e==8486||e==8491||8531<=e&&e<=8532||8539<=e&&e<=8542||8544<=e&&e<=8555||8560<=e&&e<=8569||e==8585||8592<=e&&e<=8601||8632<=e&&e<=8633||e==8658||e==8660||e==8679||e==8704||8706<=e&&e<=8707||8711<=e&&e<=8712||e==8715||e==8719||e==8721||e==8725||e==8730||8733<=e&&e<=8736||e==8739||e==8741||8743<=e&&e<=8748||e==8750||8756<=e&&e<=8759||8764<=e&&e<=8765||e==8776||e==8780||e==8786||8800<=e&&e<=8801||8804<=e&&e<=8807||8810<=e&&e<=8811||8814<=e&&e<=8815||8834<=e&&e<=8835||8838<=e&&e<=8839||e==8853||e==8857||e==8869||e==8895||e==8978||9312<=e&&e<=9449||9451<=e&&e<=9547||9552<=e&&e<=9587||9600<=e&&e<=9615||9618<=e&&e<=9621||9632<=e&&e<=9633||9635<=e&&e<=9641||9650<=e&&e<=9651||9654<=e&&e<=9655||9660<=e&&e<=9661||9664<=e&&e<=9665||9670<=e&&e<=9672||e==9675||9678<=e&&e<=9681||9698<=e&&e<=9701||e==9711||9733<=e&&e<=9734||e==9737||9742<=e&&e<=9743||9748<=e&&e<=9749||e==9756||e==9758||e==9792||e==9794||9824<=e&&e<=9825||9827<=e&&e<=9829||9831<=e&&e<=9834||9836<=e&&e<=9837||e==9839||9886<=e&&e<=9887||9918<=e&&e<=9919||9924<=e&&e<=9933||9935<=e&&e<=9953||e==9955||9960<=e&&e<=9983||e==10045||e==10071||10102<=e&&e<=10111||11093<=e&&e<=11097||12872<=e&&e<=12879||57344<=e&&e<=63743||65024<=e&&e<=65039||e==65533||127232<=e&&e<=127242||127248<=e&&e<=127277||127280<=e&&e<=127337||127344<=e&&e<=127386||917760<=e&&e<=917999||983040<=e&&e<=1048573||1048576<=e&&e<=1114109?"A":"N"},t.characterLength=function(n){var r=this.eastAsianWidth(n);return r=="F"||r=="W"||r=="A"?2:1};function i(n){return n.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g)||[]}t.length=function(n){for(var r=i(n),a=0,e=0;e<r.length;e++)a=a+this.characterLength(r[e]);return a},t.slice=function(n,r,a){textLen=t.length(n),r=r||0,a=a||1,r<0&&(r=textLen+r),a<0&&(a=textLen+a);for(var e="",u=0,h=i(n),m=0;m<h.length;m++){var y=h[m],p=t.length(y);if(u>=r-(p==2?1:0))if(u+p<=a)e+=y;else break;u+=p}return e}})(Gs);var Qr=Gs.exports;const en=zs(Qr);var tn=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 sn=zs(tn);function $e(s,t={}){if(typeof s!="string"||s.length===0||(t={ambiguousIsNarrow:!0,...t},s=Us(s),s.length===0))return 0;s=s.replace(sn()," ");const i=t.ambiguousIsNarrow?1:2;let n=0;for(const r of s){const a=r.codePointAt(0);if(!(a<=31||a>=127&&a<=159||a>=768&&a<=879))switch(en.eastAsianWidth(r)){case"F":case"W":n+=2;break;case"A":n+=i;break;default:n+=1}}return n}const dt=10,qs=(s=0)=>t=>`\x1B[${t+s}m`,Ws=(s=0)=>t=>`\x1B[${38+s};5;${t}m`,Vs=(s=0)=>(t,i,n)=>`\x1B[${38+s};2;${t};${i};${n}m`,ue={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(ue.modifier);const rn=Object.keys(ue.color),nn=Object.keys(ue.bgColor);[...rn,...nn];function un(){const s=new Map;for(const[t,i]of Object.entries(ue)){for(const[n,r]of Object.entries(i))ue[n]={open:`\x1B[${r[0]}m`,close:`\x1B[${r[1]}m`},i[n]=ue[n],s.set(r[0],r[1]);Object.defineProperty(ue,t,{value:i,enumerable:!1})}return Object.defineProperty(ue,"codes",{value:s,enumerable:!1}),ue.color.close="\x1B[39m",ue.bgColor.close="\x1B[49m",ue.color.ansi=qs(),ue.color.ansi256=Ws(),ue.color.ansi16m=Vs(),ue.bgColor.ansi=qs(dt),ue.bgColor.ansi256=Ws(dt),ue.bgColor.ansi16m=Vs(dt),Object.defineProperties(ue,{rgbToAnsi256:{value:(t,i,n)=>t===i&&i===n?t<8?16:t>248?231:Math.round((t-8)/247*24)+232:16+36*Math.round(t/255*5)+6*Math.round(i/255*5)+Math.round(n/255*5),enumerable:!1},hexToRgb:{value:t=>{const i=/[a-f\d]{6}|[a-f\d]{3}/i.exec(t.toString(16));if(!i)return[0,0,0];let[n]=i;n.length===3&&(n=[...n].map(a=>a+a).join(""));const r=Number.parseInt(n,16);return[r>>16&255,r>>8&255,r&255]},enumerable:!1},hexToAnsi256:{value:t=>ue.rgbToAnsi256(...ue.hexToRgb(t)),enumerable:!1},ansi256ToAnsi:{value:t=>{if(t<8)return 30+t;if(t<16)return 90+(t-8);let i,n,r;if(t>=232)i=((t-232)*10+8)/255,n=i,r=i;else{t-=16;const u=t%36;i=Math.floor(t/36)/5,n=Math.floor(u/6)/5,r=u%6/5}const a=Math.max(i,n,r)*2;if(a===0)return 30;let e=30+(Math.round(r)<<2|Math.round(n)<<1|Math.round(i));return a===2&&(e+=60),e},enumerable:!1},rgbToAnsi:{value:(t,i,n)=>ue.ansi256ToAnsi(ue.rgbToAnsi256(t,i,n)),enumerable:!1},hexToAnsi:{value:t=>ue.ansi256ToAnsi(ue.hexToAnsi256(t)),enumerable:!1}}),ue}const on=un(),Ke=new Set(["\x1B","\x9B"]),an=39,pt="\x07",Ks="[",hn="]",Ys="m",mt=`${hn}8;;`,Zs=s=>`${Ke.values().next().value}${Ks}${s}${Ys}`,Xs=s=>`${Ke.values().next().value}${mt}${s}${pt}`,ln=s=>s.split(" ").map(t=>$e(t)),Et=(s,t,i)=>{const n=[...t];let r=!1,a=!1,e=$e(Us(s[s.length-1]));for(const[u,h]of n.entries()){const m=$e(h);if(e+m<=i?s[s.length-1]+=h:(s.push(h),e=0),Ke.has(h)&&(r=!0,a=n.slice(u+1).join("").startsWith(mt)),r){a?h===pt&&(r=!1,a=!1):h===Ys&&(r=!1);continue}e+=m,e===i&&u<n.length-1&&(s.push(""),e=0)}!e&&s[s.length-1].length>0&&s.length>1&&(s[s.length-2]+=s.pop())},cn=s=>{const t=s.split(" ");let i=t.length;for(;i>0&&!($e(t[i-1])>0);)i--;return i===t.length?s:t.slice(0,i).join(" ")+t.slice(i).join("")},Dn=(s,t,i={})=>{if(i.trim!==!1&&s.trim()==="")return"";let n="",r,a;const e=ln(s);let u=[""];for(const[m,y]of s.split(" ").entries()){i.trim!==!1&&(u[u.length-1]=u[u.length-1].trimStart());let p=$e(u[u.length-1]);if(m!==0&&(p>=t&&(i.wordWrap===!1||i.trim===!1)&&(u.push(""),p=0),(p>0||i.trim===!1)&&(u[u.length-1]+=" ",p++)),i.hard&&e[m]>t){const C=t-p,w=1+Math.floor((e[m]-C-1)/t);Math.floor((e[m]-1)/t)<w&&u.push(""),Et(u,y,t);continue}if(p+e[m]>t&&p>0&&e[m]>0){if(i.wordWrap===!1&&p<t){Et(u,y,t);continue}u.push("")}if(p+e[m]>t&&i.wordWrap===!1){Et(u,y,t);continue}u[u.length-1]+=y}i.trim!==!1&&(u=u.map(m=>cn(m)));const h=[...u.join(`
2
- `)];for(const[m,y]of h.entries()){if(n+=y,Ke.has(y)){const{groups:C}=new RegExp(`(?:\\${Ks}(?<code>\\d+)m|\\${mt}(?<uri>.*)${pt})`).exec(h.slice(m).join(""))||{groups:{}};if(C.code!==void 0){const w=Number.parseFloat(C.code);r=w===an?void 0:w}else C.uri!==void 0&&(a=C.uri.length===0?void 0:C.uri)}const p=on.codes.get(Number(r));h[m+1]===`
3
- `?(a&&(n+=Xs("")),r&&p&&(n+=Zs(p))):y===`
4
- `&&(r&&p&&(n+=Zs(r)),a&&(n+=Xs(a)))}return n};function Js(s,t,i){return String(s).normalize().replace(/\r\n/g,`
1
+ import Q,{stdin as Bs,stdout as xs}from"node:process";import{stripVTControlCharacters as xr,promisify as Tr}from"node:util";import*as zt from"node:readline";import Ts from"node:readline";import{Writable as $r,pipeline as Ir}from"node:stream";import Nr,{once as $s,on as Lr}from"node:events";import Pr,{spawn as Mr}from"node:child_process";import dt,{join as wt}from"node:path";import At,{existsSync as le}from"node:fs";import Rt,{rm as kr,appendFile as Hr,readFile as ce,writeFile as De}from"node:fs/promises";import{fileURLToPath as jr}from"node:url";import{pipeline as Gr}from"node:stream/promises";import*as Ur from"node:readline/promises";import Wr from"detect-indent";import zr from"indent-string";import Vr from"node:os";import Vt from"events";import Is from"stream";import Ns from"string_decoder";import de from"assert";import qr from"buffer";import Ls from"zlib";import ft from"path";import yt from"fs";import Kr from"process";import Yr from"util";import Zr from"crypto";var fe=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Ps(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}function Xr(i){if(Object.prototype.hasOwnProperty.call(i,"__esModule"))return i;var e=i.default;if(typeof e=="function"){var r=function h(){return this instanceof h?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};r.prototype=e.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(i).forEach(function(h){var s=Object.getOwnPropertyDescriptor(i,h);Object.defineProperty(r,h,s.get?s:{enumerable:!0,get:function(){return i[h]}})}),r}var me,Ms;function Jr(){if(Ms)return me;Ms=1;const i="\x1B",e=`${i}[`,r="\x07",h={to(t,u){return u?`${e}${u+1};${t+1}H`:`${e}${t+1}G`},move(t,u){let a="";return t<0?a+=`${e}${-t}D`:t>0&&(a+=`${e}${t}C`),u<0?a+=`${e}${-u}A`:u>0&&(a+=`${e}${u}B`),a},up:(t=1)=>`${e}${t}A`,down:(t=1)=>`${e}${t}B`,forward:(t=1)=>`${e}${t}C`,backward:(t=1)=>`${e}${t}D`,nextLine:(t=1)=>`${e}E`.repeat(t),prevLine:(t=1)=>`${e}F`.repeat(t),left:`${e}G`,hide:`${e}?25l`,show:`${e}?25h`,save:`${i}7`,restore:`${i}8`},s={up:(t=1)=>`${e}S`.repeat(t),down:(t=1)=>`${e}T`.repeat(t)},n={screen:`${e}2J`,up:(t=1)=>`${e}1J`.repeat(t),down:(t=1)=>`${e}J`.repeat(t),line:`${e}2K`,lineEnd:`${e}K`,lineStart:`${e}1K`,lines(t){let u="";for(let a=0;a<t;a++)u+=this.line+(a<t-1?h.up():"");return t&&(u+=h.left),u}};return me={cursor:h,scroll:s,erase:n,beep:r},me}var mt=Jr(),qt={exports:{}},ks;function Qr(){if(ks)return qt.exports;ks=1;let i=process||{},e=i.argv||[],r=i.env||{},h=!(r.NO_COLOR||e.includes("--no-color"))&&(!!r.FORCE_COLOR||e.includes("--color")||i.platform==="win32"||(i.stdout||{}).isTTY&&r.TERM!=="dumb"||!!r.CI),s=(u,a,m=u)=>y=>{let g=""+y,F=g.indexOf(a,u.length);return~F?u+n(g,a,m,F)+a:u+g+a},n=(u,a,m,y)=>{let g="",F=0;do g+=u.substring(F,y)+m,F=y+a.length,y=u.indexOf(a,F);while(~y);return g+u.substring(F)},t=(u=h)=>{let a=u?s:()=>String;return{isColorSupported:u,reset:a("\x1B[0m","\x1B[0m"),bold:a("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"),dim:a("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"),italic:a("\x1B[3m","\x1B[23m"),underline:a("\x1B[4m","\x1B[24m"),inverse:a("\x1B[7m","\x1B[27m"),hidden:a("\x1B[8m","\x1B[28m"),strikethrough:a("\x1B[9m","\x1B[29m"),black:a("\x1B[30m","\x1B[39m"),red:a("\x1B[31m","\x1B[39m"),green:a("\x1B[32m","\x1B[39m"),yellow:a("\x1B[33m","\x1B[39m"),blue:a("\x1B[34m","\x1B[39m"),magenta:a("\x1B[35m","\x1B[39m"),cyan:a("\x1B[36m","\x1B[39m"),white:a("\x1B[37m","\x1B[39m"),gray:a("\x1B[90m","\x1B[39m"),bgBlack:a("\x1B[40m","\x1B[49m"),bgRed:a("\x1B[41m","\x1B[49m"),bgGreen:a("\x1B[42m","\x1B[49m"),bgYellow:a("\x1B[43m","\x1B[49m"),bgBlue:a("\x1B[44m","\x1B[49m"),bgMagenta:a("\x1B[45m","\x1B[49m"),bgCyan:a("\x1B[46m","\x1B[49m"),bgWhite:a("\x1B[47m","\x1B[49m"),blackBright:a("\x1B[90m","\x1B[39m"),redBright:a("\x1B[91m","\x1B[39m"),greenBright:a("\x1B[92m","\x1B[39m"),yellowBright:a("\x1B[93m","\x1B[39m"),blueBright:a("\x1B[94m","\x1B[39m"),magentaBright:a("\x1B[95m","\x1B[39m"),cyanBright:a("\x1B[96m","\x1B[39m"),whiteBright:a("\x1B[97m","\x1B[39m"),bgBlackBright:a("\x1B[100m","\x1B[49m"),bgRedBright:a("\x1B[101m","\x1B[49m"),bgGreenBright:a("\x1B[102m","\x1B[49m"),bgYellowBright:a("\x1B[103m","\x1B[49m"),bgBlueBright:a("\x1B[104m","\x1B[49m"),bgMagentaBright:a("\x1B[105m","\x1B[49m"),bgCyanBright:a("\x1B[106m","\x1B[49m"),bgWhiteBright:a("\x1B[107m","\x1B[49m")}};return qt.exports=t(),qt.exports.createColors=t,qt.exports}var gt=Qr();const I=Ps(gt);function tn({onlyFirst:i=!1}={}){const e=["[\\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(e,i?void 0:"g")}const en=tn();function Hs(i){if(typeof i!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof i}\``);return i.replace(en,"")}function js(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var Gs={exports:{}};(function(i){var e={};i.exports=e,e.eastAsianWidth=function(h){var s=h.charCodeAt(0),n=h.length==2?h.charCodeAt(1):0,t=s;return 55296<=s&&s<=56319&&56320<=n&&n<=57343&&(s&=1023,n&=1023,t=s<<10|n,t+=65536),t==12288||65281<=t&&t<=65376||65504<=t&&t<=65510?"F":t==8361||65377<=t&&t<=65470||65474<=t&&t<=65479||65482<=t&&t<=65487||65490<=t&&t<=65495||65498<=t&&t<=65500||65512<=t&&t<=65518?"H":4352<=t&&t<=4447||4515<=t&&t<=4519||4602<=t&&t<=4607||9001<=t&&t<=9002||11904<=t&&t<=11929||11931<=t&&t<=12019||12032<=t&&t<=12245||12272<=t&&t<=12283||12289<=t&&t<=12350||12353<=t&&t<=12438||12441<=t&&t<=12543||12549<=t&&t<=12589||12593<=t&&t<=12686||12688<=t&&t<=12730||12736<=t&&t<=12771||12784<=t&&t<=12830||12832<=t&&t<=12871||12880<=t&&t<=13054||13056<=t&&t<=19903||19968<=t&&t<=42124||42128<=t&&t<=42182||43360<=t&&t<=43388||44032<=t&&t<=55203||55216<=t&&t<=55238||55243<=t&&t<=55291||63744<=t&&t<=64255||65040<=t&&t<=65049||65072<=t&&t<=65106||65108<=t&&t<=65126||65128<=t&&t<=65131||110592<=t&&t<=110593||127488<=t&&t<=127490||127504<=t&&t<=127546||127552<=t&&t<=127560||127568<=t&&t<=127569||131072<=t&&t<=194367||177984<=t&&t<=196605||196608<=t&&t<=262141?"W":32<=t&&t<=126||162<=t&&t<=163||165<=t&&t<=166||t==172||t==175||10214<=t&&t<=10221||10629<=t&&t<=10630?"Na":t==161||t==164||167<=t&&t<=168||t==170||173<=t&&t<=174||176<=t&&t<=180||182<=t&&t<=186||188<=t&&t<=191||t==198||t==208||215<=t&&t<=216||222<=t&&t<=225||t==230||232<=t&&t<=234||236<=t&&t<=237||t==240||242<=t&&t<=243||247<=t&&t<=250||t==252||t==254||t==257||t==273||t==275||t==283||294<=t&&t<=295||t==299||305<=t&&t<=307||t==312||319<=t&&t<=322||t==324||328<=t&&t<=331||t==333||338<=t&&t<=339||358<=t&&t<=359||t==363||t==462||t==464||t==466||t==468||t==470||t==472||t==474||t==476||t==593||t==609||t==708||t==711||713<=t&&t<=715||t==717||t==720||728<=t&&t<=731||t==733||t==735||768<=t&&t<=879||913<=t&&t<=929||931<=t&&t<=937||945<=t&&t<=961||963<=t&&t<=969||t==1025||1040<=t&&t<=1103||t==1105||t==8208||8211<=t&&t<=8214||8216<=t&&t<=8217||8220<=t&&t<=8221||8224<=t&&t<=8226||8228<=t&&t<=8231||t==8240||8242<=t&&t<=8243||t==8245||t==8251||t==8254||t==8308||t==8319||8321<=t&&t<=8324||t==8364||t==8451||t==8453||t==8457||t==8467||t==8470||8481<=t&&t<=8482||t==8486||t==8491||8531<=t&&t<=8532||8539<=t&&t<=8542||8544<=t&&t<=8555||8560<=t&&t<=8569||t==8585||8592<=t&&t<=8601||8632<=t&&t<=8633||t==8658||t==8660||t==8679||t==8704||8706<=t&&t<=8707||8711<=t&&t<=8712||t==8715||t==8719||t==8721||t==8725||t==8730||8733<=t&&t<=8736||t==8739||t==8741||8743<=t&&t<=8748||t==8750||8756<=t&&t<=8759||8764<=t&&t<=8765||t==8776||t==8780||t==8786||8800<=t&&t<=8801||8804<=t&&t<=8807||8810<=t&&t<=8811||8814<=t&&t<=8815||8834<=t&&t<=8835||8838<=t&&t<=8839||t==8853||t==8857||t==8869||t==8895||t==8978||9312<=t&&t<=9449||9451<=t&&t<=9547||9552<=t&&t<=9587||9600<=t&&t<=9615||9618<=t&&t<=9621||9632<=t&&t<=9633||9635<=t&&t<=9641||9650<=t&&t<=9651||9654<=t&&t<=9655||9660<=t&&t<=9661||9664<=t&&t<=9665||9670<=t&&t<=9672||t==9675||9678<=t&&t<=9681||9698<=t&&t<=9701||t==9711||9733<=t&&t<=9734||t==9737||9742<=t&&t<=9743||9748<=t&&t<=9749||t==9756||t==9758||t==9792||t==9794||9824<=t&&t<=9825||9827<=t&&t<=9829||9831<=t&&t<=9834||9836<=t&&t<=9837||t==9839||9886<=t&&t<=9887||9918<=t&&t<=9919||9924<=t&&t<=9933||9935<=t&&t<=9953||t==9955||9960<=t&&t<=9983||t==10045||t==10071||10102<=t&&t<=10111||11093<=t&&t<=11097||12872<=t&&t<=12879||57344<=t&&t<=63743||65024<=t&&t<=65039||t==65533||127232<=t&&t<=127242||127248<=t&&t<=127277||127280<=t&&t<=127337||127344<=t&&t<=127386||917760<=t&&t<=917999||983040<=t&&t<=1048573||1048576<=t&&t<=1114109?"A":"N"},e.characterLength=function(h){var s=this.eastAsianWidth(h);return s=="F"||s=="W"||s=="A"?2:1};function r(h){return h.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g)||[]}e.length=function(h){for(var s=r(h),n=0,t=0;t<s.length;t++)n=n+this.characterLength(s[t]);return n},e.slice=function(h,s,n){textLen=e.length(h),s=s||0,n=n||1,s<0&&(s=textLen+s),n<0&&(n=textLen+n);for(var t="",u=0,a=r(h),m=0;m<a.length;m++){var y=a[m],g=e.length(y);if(u>=s-(g==2?1:0))if(u+g<=n)t+=y;else break;u+=g}return t}})(Gs);var sn=Gs.exports;const rn=js(sn);var nn=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 un=js(nn);function $t(i,e={}){if(typeof i!="string"||i.length===0||(e={ambiguousIsNarrow:!0,...e},i=Hs(i),i.length===0))return 0;i=i.replace(un()," ");const r=e.ambiguousIsNarrow?1:2;let h=0;for(const s of i){const n=s.codePointAt(0);if(!(n<=31||n>=127&&n<=159||n>=768&&n<=879))switch(rn.eastAsianWidth(s)){case"F":case"W":h+=2;break;case"A":h+=r;break;default:h+=1}}return h}const pe=10,Us=(i=0)=>e=>`\x1B[${e+i}m`,Ws=(i=0)=>e=>`\x1B[${38+i};5;${e}m`,zs=(i=0)=>(e,r,h)=>`\x1B[${38+i};2;${e};${r};${h}m`,ut={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(ut.modifier);const on=Object.keys(ut.color),an=Object.keys(ut.bgColor);[...on,...an];function hn(){const i=new Map;for(const[e,r]of Object.entries(ut)){for(const[h,s]of Object.entries(r))ut[h]={open:`\x1B[${s[0]}m`,close:`\x1B[${s[1]}m`},r[h]=ut[h],i.set(s[0],s[1]);Object.defineProperty(ut,e,{value:r,enumerable:!1})}return Object.defineProperty(ut,"codes",{value:i,enumerable:!1}),ut.color.close="\x1B[39m",ut.bgColor.close="\x1B[49m",ut.color.ansi=Us(),ut.color.ansi256=Ws(),ut.color.ansi16m=zs(),ut.bgColor.ansi=Us(pe),ut.bgColor.ansi256=Ws(pe),ut.bgColor.ansi16m=zs(pe),Object.defineProperties(ut,{rgbToAnsi256:{value:(e,r,h)=>e===r&&r===h?e<8?16:e>248?231:Math.round((e-8)/247*24)+232:16+36*Math.round(e/255*5)+6*Math.round(r/255*5)+Math.round(h/255*5),enumerable:!1},hexToRgb:{value:e=>{const r=/[a-f\d]{6}|[a-f\d]{3}/i.exec(e.toString(16));if(!r)return[0,0,0];let[h]=r;h.length===3&&(h=[...h].map(n=>n+n).join(""));const s=Number.parseInt(h,16);return[s>>16&255,s>>8&255,s&255]},enumerable:!1},hexToAnsi256:{value:e=>ut.rgbToAnsi256(...ut.hexToRgb(e)),enumerable:!1},ansi256ToAnsi:{value:e=>{if(e<8)return 30+e;if(e<16)return 90+(e-8);let r,h,s;if(e>=232)r=((e-232)*10+8)/255,h=r,s=r;else{e-=16;const u=e%36;r=Math.floor(e/36)/5,h=Math.floor(u/6)/5,s=u%6/5}const n=Math.max(r,h,s)*2;if(n===0)return 30;let t=30+(Math.round(s)<<2|Math.round(h)<<1|Math.round(r));return n===2&&(t+=60),t},enumerable:!1},rgbToAnsi:{value:(e,r,h)=>ut.ansi256ToAnsi(ut.rgbToAnsi256(e,r,h)),enumerable:!1},hexToAnsi:{value:e=>ut.ansi256ToAnsi(ut.hexToAnsi256(e)),enumerable:!1}}),ut}const ln=hn(),Kt=new Set(["\x1B","\x9B"]),cn=39,ge="\x07",Vs="[",Dn="]",qs="m",Ee=`${Dn}8;;`,Ks=i=>`${Kt.values().next().value}${Vs}${i}${qs}`,Ys=i=>`${Kt.values().next().value}${Ee}${i}${ge}`,dn=i=>i.split(" ").map(e=>$t(e)),Ce=(i,e,r)=>{const h=[...e];let s=!1,n=!1,t=$t(Hs(i[i.length-1]));for(const[u,a]of h.entries()){const m=$t(a);if(t+m<=r?i[i.length-1]+=a:(i.push(a),t=0),Kt.has(a)&&(s=!0,n=h.slice(u+1).join("").startsWith(Ee)),s){n?a===ge&&(s=!1,n=!1):a===qs&&(s=!1);continue}t+=m,t===r&&u<h.length-1&&(i.push(""),t=0)}!t&&i[i.length-1].length>0&&i.length>1&&(i[i.length-2]+=i.pop())},fn=i=>{const e=i.split(" ");let r=e.length;for(;r>0&&!($t(e[r-1])>0);)r--;return r===e.length?i:e.slice(0,r).join(" ")+e.slice(r).join("")},mn=(i,e,r={})=>{if(r.trim!==!1&&i.trim()==="")return"";let h="",s,n;const t=dn(i);let u=[""];for(const[m,y]of i.split(" ").entries()){r.trim!==!1&&(u[u.length-1]=u[u.length-1].trimStart());let g=$t(u[u.length-1]);if(m!==0&&(g>=e&&(r.wordWrap===!1||r.trim===!1)&&(u.push(""),g=0),(g>0||r.trim===!1)&&(u[u.length-1]+=" ",g++)),r.hard&&t[m]>e){const F=e-g,w=1+Math.floor((t[m]-F-1)/e);Math.floor((t[m]-1)/e)<w&&u.push(""),Ce(u,y,e);continue}if(g+t[m]>e&&g>0&&t[m]>0){if(r.wordWrap===!1&&g<e){Ce(u,y,e);continue}u.push("")}if(g+t[m]>e&&r.wordWrap===!1){Ce(u,y,e);continue}u[u.length-1]+=y}r.trim!==!1&&(u=u.map(m=>fn(m)));const a=[...u.join(`
2
+ `)];for(const[m,y]of a.entries()){if(h+=y,Kt.has(y)){const{groups:F}=new RegExp(`(?:\\${Vs}(?<code>\\d+)m|\\${Ee}(?<uri>.*)${ge})`).exec(a.slice(m).join(""))||{groups:{}};if(F.code!==void 0){const w=Number.parseFloat(F.code);s=w===cn?void 0:w}else F.uri!==void 0&&(n=F.uri.length===0?void 0:F.uri)}const g=ln.codes.get(Number(s));a[m+1]===`
3
+ `?(n&&(h+=Ys("")),s&&g&&(h+=Ks(g))):y===`
4
+ `&&(s&&g&&(h+=Ks(s)),n&&(h+=Ys(n)))}return h};function Zs(i,e,r){return String(i).normalize().replace(/\r\n/g,`
5
5
  `).split(`
6
- `).map(n=>Dn(n,t,i)).join(`
7
- `)}const fn=["up","down","left","right","space","enter","cancel"],Ye={actions:new Set(fn),aliases:new Map([["k","up"],["j","down"],["h","left"],["l","right"],["","cancel"],["escape","cancel"]])};function gt(s,t){if(typeof s=="string")return Ye.aliases.get(s)===t;for(const i of s)if(i!==void 0&&gt(i,t))return!0;return!1}function dn(s,t){if(s===t)return;const i=s.split(`
8
- `),n=t.split(`
9
- `),r=[];for(let a=0;a<Math.max(i.length,n.length);a++)i[a]!==n[a]&&r.push(a);return r}const pn=globalThis.process.platform.startsWith("win"),Ct=Symbol("clack:cancel");function _e(s){return s===Ct}function Ze(s,t){const i=s;i.isTTY&&i.setRawMode(t)}function mn({input:s=xs,output:t=Ts,overwrite:i=!0,hideCursor:n=!0}={}){const r=We.createInterface({input:s,output:t,prompt:"",tabSize:1});We.emitKeypressEvents(s,r),s.isTTY&&s.setRawMode(!0);const a=(e,{name:u,sequence:h})=>{const m=String(e);if(gt([m,u,h],"cancel")){n&&t.write(pe.cursor.show),process.exit(0);return}if(!i)return;const y=u==="return"?0:-1,p=u==="return"?-1:0;We.moveCursor(t,y,p,()=>{We.clearLine(t,1,()=>{s.once("keypress",a)})})};return n&&t.write(pe.cursor.hide),s.once("keypress",a),()=>{s.off("keypress",a),n&&t.write(pe.cursor.show),s.isTTY&&!pn&&s.setRawMode(!1),r.terminal=!1,r.close()}}var En=Object.defineProperty,gn=(s,t,i)=>t in s?En(s,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):s[t]=i,Fe=(s,t,i)=>(gn(s,typeof t!="symbol"?t+"":t,i),i);class Xe{constructor(t,i=!0){Fe(this,"input"),Fe(this,"output"),Fe(this,"_abortSignal"),Fe(this,"rl"),Fe(this,"opts"),Fe(this,"_render"),Fe(this,"_track",!1),Fe(this,"_prevFrame",""),Fe(this,"_subscribers",new Map),Fe(this,"_cursor",0),Fe(this,"state","initial"),Fe(this,"error",""),Fe(this,"value");const{input:n=xs,output:r=Ts,render:a,signal:e,...u}=t;this.opts=u,this.onKeypress=this.onKeypress.bind(this),this.close=this.close.bind(this),this.render=this.render.bind(this),this._render=a.bind(this),this._track=i,this._abortSignal=e,this.input=n,this.output=r}unsubscribe(){this._subscribers.clear()}setSubscriber(t,i){const n=this._subscribers.get(t)??[];n.push(i),this._subscribers.set(t,n)}on(t,i){this.setSubscriber(t,{cb:i})}once(t,i){this.setSubscriber(t,{cb:i,once:!0})}emit(t,...i){const n=this._subscribers.get(t)??[],r=[];for(const a of n)a.cb(...i),a.once&&r.push(()=>n.splice(n.indexOf(a),1));for(const a of r)a()}prompt(){return new Promise((t,i)=>{if(this._abortSignal){if(this._abortSignal.aborted)return this.state="cancel",this.close(),t(Ct);this._abortSignal.addEventListener("abort",()=>{this.state="cancel",this.close()},{once:!0})}const n=new Nr(0);n._write=(r,a,e)=>{this._track&&(this.value=this.rl?.line.replace(/\t/g,""),this._cursor=this.rl?.cursor??0,this.emit("value",this.value)),e()},this.input.pipe(n),this.rl=$s.createInterface({input:this.input,output:n,tabSize:2,prompt:"",escapeCodeTimeout:50}),$s.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),Ze(this.input,!0),this.output.on("resize",this.render),this.render(),this.once("submit",()=>{this.output.write(pe.cursor.show),this.output.off("resize",this.render),Ze(this.input,!1),t(this.value)}),this.once("cancel",()=>{this.output.write(pe.cursor.show),this.output.off("resize",this.render),Ze(this.input,!1),t(Ct)})})}onKeypress(t,i){if(this.state==="error"&&(this.state="active"),i?.name&&(!this._track&&Ye.aliases.has(i.name)&&this.emit("cursor",Ye.aliases.get(i.name)),Ye.actions.has(i.name)&&this.emit("cursor",i.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()),i?.name==="return"){if(this.opts.validate){const n=this.opts.validate(this.value);n&&(this.error=n instanceof Error?n.message:n,this.state="error",this.rl?.write(this.value))}this.state!=="error"&&(this.state="submit")}gt([t,i?.name,i?.sequence],"cancel")&&(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(`
10
- `),Ze(this.input,!1),this.rl?.close(),this.rl=void 0,this.emit(`${this.state}`,this.value),this.unsubscribe()}restoreCursor(){const t=Js(this._prevFrame,process.stdout.columns,{hard:!0}).split(`
11
- `).length-1;this.output.write(pe.cursor.move(-999,t*-1))}render(){const t=Js(this._render(this)??"",process.stdout.columns,{hard:!0});if(t!==this._prevFrame){if(this.state==="initial")this.output.write(pe.cursor.hide);else{const i=dn(this._prevFrame,t);if(this.restoreCursor(),i&&i?.length===1){const n=i[0];this.output.write(pe.cursor.move(0,n)),this.output.write(pe.erase.lines(1));const r=t.split(`
12
- `);this.output.write(r[n]),this._prevFrame=t,this.output.write(pe.cursor.move(0,r.length-n-1));return}if(i&&i?.length>1){const n=i[0];this.output.write(pe.cursor.move(0,n)),this.output.write(pe.erase.down());const r=t.split(`
13
- `).slice(n);this.output.write(r.join(`
14
- `)),this._prevFrame=t;return}this.output.write(pe.erase.down())}this.output.write(t),this.state==="initial"&&(this.state="active"),this._prevFrame=t}}}class Cn extends Xe{get cursor(){return this.value?0:1}get _value(){return this.cursor===0}constructor(t){super(t,!1),this.value=!!t.initialValue,this.on("value",()=>{this.value=this._value}),this.on("confirm",i=>{this.output.write(pe.cursor.move(0,-1)),this.value=i,this.state="submit",this.close()}),this.on("cursor",()=>{this.value=!this.value})}}var Fn=Object.defineProperty,yn=(s,t,i)=>t in s?Fn(s,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):s[t]=i,Qs=(s,t,i)=>(yn(s,typeof t!="symbol"?t+"":t,i),i);let bn=class extends Xe{constructor(s){super(s,!1),Qs(this,"options"),Qs(this,"cursor",0),this.options=s.options,this.value=[...s.initialValues??[]],this.cursor=Math.max(this.options.findIndex(({value:t})=>t===s.cursorAt),0),this.on("key",t=>{t==="a"&&this.toggleAll()}),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;case"space":this.toggleValue();break}})}get _value(){return this.options[this.cursor].value}toggleAll(){const s=this.value.length===this.options.length;this.value=s?[]:this.options.map(t=>t.value)}toggleValue(){const s=this.value.includes(this._value);this.value=s?this.value.filter(t=>t!==this._value):[...this.value,this._value]}};var wn=Object.defineProperty,_n=(s,t,i)=>t in s?wn(s,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):s[t]=i,ei=(s,t,i)=>(_n(s,typeof t!="symbol"?t+"":t,i),i);class vn extends Xe{constructor(t){super(t,!1),ei(this,"options"),ei(this,"cursor",0),this.options=t.options,this.cursor=this.options.findIndex(({value:i})=>i===t.initialValue),this.cursor===-1&&(this.cursor=0),this.changeValue(),this.on("cursor",i=>{switch(i){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}}class An extends Xe{get valueWithCursor(){if(this.state==="submit")return this.value;if(this.cursor>=this.value.length)return`${this.value}\u2588`;const t=this.value.slice(0,this.cursor),[i,...n]=this.value.slice(this.cursor);return`${t}${I.inverse(i)}${n.join("")}`}get cursor(){return this._cursor}constructor(t){super(t),this.on("finalize",()=>{this.value||(this.value=t.defaultValue)})}}function Sn(){return Q.platform!=="win32"?Q.env.TERM!=="linux":!!Q.env.CI||!!Q.env.WT_SESSION||!!Q.env.TERMINUS_SUBLIME||Q.env.ConEmuTask==="{cmd::Cmder}"||Q.env.TERM_PROGRAM==="Terminus-Sublime"||Q.env.TERM_PROGRAM==="vscode"||Q.env.TERM==="xterm-256color"||Q.env.TERM==="alacritty"||Q.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}const Ft=Sn(),me=(s,t)=>Ft?s:t,On=me("\u25C6","*"),ti=me("\u25A0","x"),si=me("\u25B2","x"),yt=me("\u25C7","o"),Rn=me("\u250C","T"),ee=me("\u2502","|"),ve=me("\u2514","\u2014"),bt=me("\u25CF",">"),wt=me("\u25CB"," "),Bn=me("\u25FB","[\u2022]"),ii=me("\u25FC","[+]"),xn=me("\u25FB","[ ]"),Tn=me("\u25CF","\u2022"),$n=me("\u25C6","*"),Nn=me("\u25B2","!"),In=me("\u25A0","x"),Je=s=>{switch(s){case"initial":case"active":return I.cyan(On);case"cancel":return I.red(ti);case"error":return I.yellow(si);case"submit":return I.green(yt)}},_t=s=>{const{cursor:t,options:i,style:n}=s,r=s.maxItems??Number.POSITIVE_INFINITY,a=Math.max(process.stdout.rows-4,0),e=Math.min(a,Math.max(r,5));let u=0;t>=u+e-3?u=Math.max(Math.min(t-e+3,i.length-e),0):t<u+2&&(u=Math.max(t-2,0));const h=e<i.length&&u>0,m=e<i.length&&u+e<i.length;return i.slice(u,u+e).map((y,p,C)=>{const w=p===0&&h,b=p===C.length-1&&m;return w||b?I.dim("..."):n(y,p+u===t)})},Qe=s=>new An({validate:s.validate,placeholder:s.placeholder,defaultValue:s.defaultValue,initialValue:s.initialValue,render(){const t=`${I.gray(ee)}
15
- ${Je(this.state)} ${s.message}
16
- `,i=s.placeholder?I.inverse(s.placeholder[0])+I.dim(s.placeholder.slice(1)):I.inverse(I.hidden("_")),n=this.value?this.valueWithCursor:i;switch(this.state){case"error":return`${t.trim()}
17
- ${I.yellow(ee)} ${n}
18
- ${I.yellow(ve)} ${I.yellow(this.error)}
19
- `;case"submit":return`${t}${I.gray(ee)} ${I.dim(this.value||s.placeholder)}`;case"cancel":return`${t}${I.gray(ee)} ${I.strikethrough(I.dim(this.value??""))}${this.value?.trim()?`
20
- ${I.gray(ee)}`:""}`;default:return`${t}${I.cyan(ee)} ${n}
21
- ${I.cyan(ve)}
22
- `}}}).prompt(),ri=s=>{const t=s.active??"Yes",i=s.inactive??"No";return new Cn({active:t,inactive:i,initialValue:s.initialValue??!0,render(){const n=`${I.gray(ee)}
23
- ${Je(this.state)} ${s.message}
24
- `,r=this.value?t:i;switch(this.state){case"submit":return`${n}${I.gray(ee)} ${I.dim(r)}`;case"cancel":return`${n}${I.gray(ee)} ${I.strikethrough(I.dim(r))}
25
- ${I.gray(ee)}`;default:return`${n}${I.cyan(ee)} ${this.value?`${I.green(bt)} ${t}`:`${I.dim(wt)} ${I.dim(t)}`} ${I.dim("/")} ${this.value?`${I.dim(wt)} ${I.dim(i)}`:`${I.green(bt)} ${i}`}
26
- ${I.cyan(ve)}
27
- `}}}).prompt()},ni=s=>{const t=(i,n)=>{const r=i.label??String(i.value);switch(n){case"selected":return`${I.dim(r)}`;case"active":return`${I.green(bt)} ${r} ${i.hint?I.dim(`(${i.hint})`):""}`;case"cancelled":return`${I.strikethrough(I.dim(r))}`;default:return`${I.dim(wt)} ${I.dim(r)}`}};return new vn({options:s.options,initialValue:s.initialValue,render(){const i=`${I.gray(ee)}
28
- ${Je(this.state)} ${s.message}
29
- `;switch(this.state){case"submit":return`${i}${I.gray(ee)} ${t(this.options[this.cursor],"selected")}`;case"cancel":return`${i}${I.gray(ee)} ${t(this.options[this.cursor],"cancelled")}
30
- ${I.gray(ee)}`;default:return`${i}${I.cyan(ee)} ${_t({cursor:this.cursor,options:this.options,maxItems:s.maxItems,style:(n,r)=>t(n,r?"active":"inactive")}).join(`
31
- ${I.cyan(ee)} `)}
32
- ${I.cyan(ve)}
33
- `}}}).prompt()},Ln=s=>{const t=(i,n)=>{const r=i.label??String(i.value);return n==="active"?`${I.cyan(Bn)} ${r} ${i.hint?I.dim(`(${i.hint})`):""}`:n==="selected"?`${I.green(ii)} ${I.dim(r)}`:n==="cancelled"?`${I.strikethrough(I.dim(r))}`:n==="active-selected"?`${I.green(ii)} ${r} ${i.hint?I.dim(`(${i.hint})`):""}`:n==="submitted"?`${I.dim(r)}`:`${I.dim(xn)} ${I.dim(r)}`};return new bn({options:s.options,initialValues:s.initialValues,required:s.required??!0,cursorAt:s.cursorAt,validate(i){if(this.required&&i.length===0)return`Please select at least one option.
34
- ${I.reset(I.dim(`Press ${I.gray(I.bgWhite(I.inverse(" space ")))} to select, ${I.gray(I.bgWhite(I.inverse(" enter ")))} to submit`))}`},render(){const i=`${I.gray(ee)}
35
- ${Je(this.state)} ${s.message}
36
- `,n=(r,a)=>{const e=this.value.includes(r.value);return a&&e?t(r,"active-selected"):e?t(r,"selected"):t(r,a?"active":"inactive")};switch(this.state){case"submit":return`${i}${I.gray(ee)} ${this.options.filter(({value:r})=>this.value.includes(r)).map(r=>t(r,"submitted")).join(I.dim(", "))||I.dim("none")}`;case"cancel":{const r=this.options.filter(({value:a})=>this.value.includes(a)).map(a=>t(a,"cancelled")).join(I.dim(", "));return`${i}${I.gray(ee)} ${r.trim()?`${r}
37
- ${I.gray(ee)}`:""}`}case"error":{const r=this.error.split(`
38
- `).map((a,e)=>e===0?`${I.yellow(ve)} ${I.yellow(a)}`:` ${a}`).join(`
39
- `);return`${i+I.yellow(ee)} ${_t({options:this.options,cursor:this.cursor,maxItems:s.maxItems,style:n}).join(`
40
- ${I.yellow(ee)} `)}
41
- ${r}
42
- `}default:return`${i}${I.cyan(ee)} ${_t({options:this.options,cursor:this.cursor,maxItems:s.maxItems,style:n}).join(`
43
- ${I.cyan(ee)} `)}
44
- ${I.cyan(ve)}
45
- `}}}).prompt()},ui=(s="")=>{process.stdout.write(`${I.gray(ve)} ${I.red(s)}
6
+ `).map(h=>mn(h,e,r)).join(`
7
+ `)}const pn=["up","down","left","right","space","enter","cancel"],Yt={actions:new Set(pn),aliases:new Map([["k","up"],["j","down"],["h","left"],["l","right"],["","cancel"],["escape","cancel"]])};function Fe(i,e){if(typeof i=="string")return Yt.aliases.get(i)===e;for(const r of i)if(r!==void 0&&Fe(r,e))return!0;return!1}function gn(i,e){if(i===e)return;const r=i.split(`
8
+ `),h=e.split(`
9
+ `),s=[];for(let n=0;n<Math.max(r.length,h.length);n++)r[n]!==h[n]&&s.push(n);return s}const En=globalThis.process.platform.startsWith("win"),ye=Symbol("clack:cancel");function vt(i){return i===ye}function Zt(i,e){const r=i;r.isTTY&&r.setRawMode(e)}function Cn({input:i=Bs,output:e=xs,overwrite:r=!0,hideCursor:h=!0}={}){const s=zt.createInterface({input:i,output:e,prompt:"",tabSize:1});zt.emitKeypressEvents(i,s),i.isTTY&&i.setRawMode(!0);const n=(t,{name:u,sequence:a})=>{const m=String(t);if(Fe([m,u,a],"cancel")){h&&e.write(mt.cursor.show),process.exit(0);return}if(!r)return;const y=u==="return"?0:-1,g=u==="return"?-1:0;zt.moveCursor(e,y,g,()=>{zt.clearLine(e,1,()=>{i.once("keypress",n)})})};return h&&e.write(mt.cursor.hide),i.once("keypress",n),()=>{i.off("keypress",n),h&&e.write(mt.cursor.show),i.isTTY&&!En&&i.setRawMode(!1),s.terminal=!1,s.close()}}var Fn=Object.defineProperty,yn=(i,e,r)=>e in i?Fn(i,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):i[e]=r,Ct=(i,e,r)=>(yn(i,typeof e!="symbol"?e+"":e,r),r);class Xt{constructor(e,r=!0){Ct(this,"input"),Ct(this,"output"),Ct(this,"_abortSignal"),Ct(this,"rl"),Ct(this,"opts"),Ct(this,"_render"),Ct(this,"_track",!1),Ct(this,"_prevFrame",""),Ct(this,"_subscribers",new Map),Ct(this,"_cursor",0),Ct(this,"state","initial"),Ct(this,"error",""),Ct(this,"value");const{input:h=Bs,output:s=xs,render:n,signal:t,...u}=e;this.opts=u,this.onKeypress=this.onKeypress.bind(this),this.close=this.close.bind(this),this.render=this.render.bind(this),this._render=n.bind(this),this._track=r,this._abortSignal=t,this.input=h,this.output=s}unsubscribe(){this._subscribers.clear()}setSubscriber(e,r){const h=this._subscribers.get(e)??[];h.push(r),this._subscribers.set(e,h)}on(e,r){this.setSubscriber(e,{cb:r})}once(e,r){this.setSubscriber(e,{cb:r,once:!0})}emit(e,...r){const h=this._subscribers.get(e)??[],s=[];for(const n of h)n.cb(...r),n.once&&s.push(()=>h.splice(h.indexOf(n),1));for(const n of s)n()}prompt(){return new Promise((e,r)=>{if(this._abortSignal){if(this._abortSignal.aborted)return this.state="cancel",this.close(),e(ye);this._abortSignal.addEventListener("abort",()=>{this.state="cancel",this.close()},{once:!0})}const h=new $r;h._write=(s,n,t)=>{this._track&&(this.value=this.rl?.line.replace(/\t/g,""),this._cursor=this.rl?.cursor??0,this.emit("value",this.value)),t()},this.input.pipe(h),this.rl=Ts.createInterface({input:this.input,output:h,tabSize:2,prompt:"",escapeCodeTimeout:50,terminal:!0}),Ts.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),Zt(this.input,!0),this.output.on("resize",this.render),this.render(),this.once("submit",()=>{this.output.write(mt.cursor.show),this.output.off("resize",this.render),Zt(this.input,!1),e(this.value)}),this.once("cancel",()=>{this.output.write(mt.cursor.show),this.output.off("resize",this.render),Zt(this.input,!1),e(ye)})})}onKeypress(e,r){if(this.state==="error"&&(this.state="active"),r?.name&&(!this._track&&Yt.aliases.has(r.name)&&this.emit("cursor",Yt.aliases.get(r.name)),Yt.actions.has(r.name)&&this.emit("cursor",r.name)),e&&(e.toLowerCase()==="y"||e.toLowerCase()==="n")&&this.emit("confirm",e.toLowerCase()==="y"),e===" "&&this.opts.placeholder&&(this.value||(this.rl?.write(this.opts.placeholder),this.emit("value",this.opts.placeholder))),e&&this.emit("key",e.toLowerCase()),r?.name==="return"){if(this.opts.validate){const h=this.opts.validate(this.value);h&&(this.error=h instanceof Error?h.message:h,this.state="error",this.rl?.write(this.value))}this.state!=="error"&&(this.state="submit")}Fe([e,r?.name,r?.sequence],"cancel")&&(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(`
10
+ `),Zt(this.input,!1),this.rl?.close(),this.rl=void 0,this.emit(`${this.state}`,this.value),this.unsubscribe()}restoreCursor(){const e=Zs(this._prevFrame,process.stdout.columns,{hard:!0}).split(`
11
+ `).length-1;this.output.write(mt.cursor.move(-999,e*-1))}render(){const e=Zs(this._render(this)??"",process.stdout.columns,{hard:!0});if(e!==this._prevFrame){if(this.state==="initial")this.output.write(mt.cursor.hide);else{const r=gn(this._prevFrame,e);if(this.restoreCursor(),r&&r?.length===1){const h=r[0];this.output.write(mt.cursor.move(0,h)),this.output.write(mt.erase.lines(1));const s=e.split(`
12
+ `);this.output.write(s[h]),this._prevFrame=e,this.output.write(mt.cursor.move(0,s.length-h-1));return}if(r&&r?.length>1){const h=r[0];this.output.write(mt.cursor.move(0,h)),this.output.write(mt.erase.down());const s=e.split(`
13
+ `).slice(h);this.output.write(s.join(`
14
+ `)),this._prevFrame=e;return}this.output.write(mt.erase.down())}this.output.write(e),this.state==="initial"&&(this.state="active"),this._prevFrame=e}}}class bn extends Xt{get cursor(){return this.value?0:1}get _value(){return this.cursor===0}constructor(e){super(e,!1),this.value=!!e.initialValue,this.on("value",()=>{this.value=this._value}),this.on("confirm",r=>{this.output.write(mt.cursor.move(0,-1)),this.value=r,this.state="submit",this.close()}),this.on("cursor",()=>{this.value=!this.value})}}var _n=Object.defineProperty,wn=(i,e,r)=>e in i?_n(i,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):i[e]=r,Xs=(i,e,r)=>(wn(i,typeof e!="symbol"?e+"":e,r),r);let vn=class extends Xt{constructor(i){super(i,!1),Xs(this,"options"),Xs(this,"cursor",0),this.options=i.options,this.value=[...i.initialValues??[]],this.cursor=Math.max(this.options.findIndex(({value:e})=>e===i.cursorAt),0),this.on("key",e=>{e==="a"&&this.toggleAll()}),this.on("cursor",e=>{switch(e){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;case"space":this.toggleValue();break}})}get _value(){return this.options[this.cursor].value}toggleAll(){const i=this.value.length===this.options.length;this.value=i?[]:this.options.map(e=>e.value)}toggleValue(){const i=this.value.includes(this._value);this.value=i?this.value.filter(e=>e!==this._value):[...this.value,this._value]}};var An=Object.defineProperty,Sn=(i,e,r)=>e in i?An(i,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):i[e]=r,Js=(i,e,r)=>(Sn(i,typeof e!="symbol"?e+"":e,r),r);class On extends Xt{constructor(e){super(e,!1),Js(this,"options"),Js(this,"cursor",0),this.options=e.options,this.cursor=this.options.findIndex(({value:r})=>r===e.initialValue),this.cursor===-1&&(this.cursor=0),this.changeValue(),this.on("cursor",r=>{switch(r){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}}class Rn extends Xt{get valueWithCursor(){if(this.state==="submit")return this.value;if(this.cursor>=this.value.length)return`${this.value}\u2588`;const e=this.value.slice(0,this.cursor),[r,...h]=this.value.slice(this.cursor);return`${e}${I.inverse(r)}${h.join("")}`}get cursor(){return this._cursor}constructor(e){super(e),this.on("finalize",()=>{this.value||(this.value=e.defaultValue)})}}function Bn(){return Q.platform!=="win32"?Q.env.TERM!=="linux":!!Q.env.CI||!!Q.env.WT_SESSION||!!Q.env.TERMINUS_SUBLIME||Q.env.ConEmuTask==="{cmd::Cmder}"||Q.env.TERM_PROGRAM==="Terminus-Sublime"||Q.env.TERM_PROGRAM==="vscode"||Q.env.TERM==="xterm-256color"||Q.env.TERM==="alacritty"||Q.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}const be=Bn(),pt=(i,e)=>be?i:e,xn=pt("\u25C6","*"),Qs=pt("\u25A0","x"),ti=pt("\u25B2","x"),_e=pt("\u25C7","o"),Tn=pt("\u250C","T"),tt=pt("\u2502","|"),St=pt("\u2514","\u2014"),we=pt("\u25CF",">"),ve=pt("\u25CB"," "),$n=pt("\u25FB","[\u2022]"),ei=pt("\u25FC","[+]"),In=pt("\u25FB","[ ]"),Nn=pt("\u25CF","\u2022"),Ln=pt("\u25C6","*"),Pn=pt("\u25B2","!"),Mn=pt("\u25A0","x"),Jt=i=>{switch(i){case"initial":case"active":return I.cyan(xn);case"cancel":return I.red(Qs);case"error":return I.yellow(ti);case"submit":return I.green(_e)}},Ae=i=>{const{cursor:e,options:r,style:h}=i,s=i.maxItems??Number.POSITIVE_INFINITY,n=Math.max(process.stdout.rows-4,0),t=Math.min(n,Math.max(s,5));let u=0;e>=u+t-3?u=Math.max(Math.min(e-t+3,r.length-t),0):e<u+2&&(u=Math.max(e-2,0));const a=t<r.length&&u>0,m=t<r.length&&u+t<r.length;return r.slice(u,u+t).map((y,g,F)=>{const w=g===0&&a,b=g===F.length-1&&m;return w||b?I.dim("..."):h(y,g+u===e)})},Qt=i=>new Rn({validate:i.validate,placeholder:i.placeholder,defaultValue:i.defaultValue,initialValue:i.initialValue,render(){const e=`${I.gray(tt)}
15
+ ${Jt(this.state)} ${i.message}
16
+ `,r=i.placeholder?I.inverse(i.placeholder[0])+I.dim(i.placeholder.slice(1)):I.inverse(I.hidden("_")),h=this.value?this.valueWithCursor:r;switch(this.state){case"error":return`${e.trim()}
17
+ ${I.yellow(tt)} ${h}
18
+ ${I.yellow(St)} ${I.yellow(this.error)}
19
+ `;case"submit":return`${e}${I.gray(tt)} ${I.dim(this.value||i.placeholder)}`;case"cancel":return`${e}${I.gray(tt)} ${I.strikethrough(I.dim(this.value??""))}${this.value?.trim()?`
20
+ ${I.gray(tt)}`:""}`;default:return`${e}${I.cyan(tt)} ${h}
21
+ ${I.cyan(St)}
22
+ `}}}).prompt(),si=i=>{const e=i.active??"Yes",r=i.inactive??"No";return new bn({active:e,inactive:r,initialValue:i.initialValue??!0,render(){const h=`${I.gray(tt)}
23
+ ${Jt(this.state)} ${i.message}
24
+ `,s=this.value?e:r;switch(this.state){case"submit":return`${h}${I.gray(tt)} ${I.dim(s)}`;case"cancel":return`${h}${I.gray(tt)} ${I.strikethrough(I.dim(s))}
25
+ ${I.gray(tt)}`;default:return`${h}${I.cyan(tt)} ${this.value?`${I.green(we)} ${e}`:`${I.dim(ve)} ${I.dim(e)}`} ${I.dim("/")} ${this.value?`${I.dim(ve)} ${I.dim(r)}`:`${I.green(we)} ${r}`}
26
+ ${I.cyan(St)}
27
+ `}}}).prompt()},ii=i=>{const e=(r,h)=>{const s=r.label??String(r.value);switch(h){case"selected":return`${I.dim(s)}`;case"active":return`${I.green(we)} ${s} ${r.hint?I.dim(`(${r.hint})`):""}`;case"cancelled":return`${I.strikethrough(I.dim(s))}`;default:return`${I.dim(ve)} ${I.dim(s)}`}};return new On({options:i.options,initialValue:i.initialValue,render(){const r=`${I.gray(tt)}
28
+ ${Jt(this.state)} ${i.message}
29
+ `;switch(this.state){case"submit":return`${r}${I.gray(tt)} ${e(this.options[this.cursor],"selected")}`;case"cancel":return`${r}${I.gray(tt)} ${e(this.options[this.cursor],"cancelled")}
30
+ ${I.gray(tt)}`;default:return`${r}${I.cyan(tt)} ${Ae({cursor:this.cursor,options:this.options,maxItems:i.maxItems,style:(h,s)=>e(h,s?"active":"inactive")}).join(`
31
+ ${I.cyan(tt)} `)}
32
+ ${I.cyan(St)}
33
+ `}}}).prompt()},kn=i=>{const e=(r,h)=>{const s=r.label??String(r.value);return h==="active"?`${I.cyan($n)} ${s} ${r.hint?I.dim(`(${r.hint})`):""}`:h==="selected"?`${I.green(ei)} ${I.dim(s)} ${r.hint?I.dim(`(${r.hint})`):""}`:h==="cancelled"?`${I.strikethrough(I.dim(s))}`:h==="active-selected"?`${I.green(ei)} ${s} ${r.hint?I.dim(`(${r.hint})`):""}`:h==="submitted"?`${I.dim(s)}`:`${I.dim(In)} ${I.dim(s)}`};return new vn({options:i.options,initialValues:i.initialValues,required:i.required??!0,cursorAt:i.cursorAt,validate(r){if(this.required&&r.length===0)return`Please select at least one option.
34
+ ${I.reset(I.dim(`Press ${I.gray(I.bgWhite(I.inverse(" space ")))} to select, ${I.gray(I.bgWhite(I.inverse(" enter ")))} to submit`))}`},render(){const r=`${I.gray(tt)}
35
+ ${Jt(this.state)} ${i.message}
36
+ `,h=(s,n)=>{const t=this.value.includes(s.value);return n&&t?e(s,"active-selected"):t?e(s,"selected"):e(s,n?"active":"inactive")};switch(this.state){case"submit":return`${r}${I.gray(tt)} ${this.options.filter(({value:s})=>this.value.includes(s)).map(s=>e(s,"submitted")).join(I.dim(", "))||I.dim("none")}`;case"cancel":{const s=this.options.filter(({value:n})=>this.value.includes(n)).map(n=>e(n,"cancelled")).join(I.dim(", "));return`${r}${I.gray(tt)} ${s.trim()?`${s}
37
+ ${I.gray(tt)}`:""}`}case"error":{const s=this.error.split(`
38
+ `).map((n,t)=>t===0?`${I.yellow(St)} ${I.yellow(n)}`:` ${n}`).join(`
39
+ `);return`${r+I.yellow(tt)} ${Ae({options:this.options,cursor:this.cursor,maxItems:i.maxItems,style:h}).join(`
40
+ ${I.yellow(tt)} `)}
41
+ ${s}
42
+ `}default:return`${r}${I.cyan(tt)} ${Ae({options:this.options,cursor:this.cursor,maxItems:i.maxItems,style:h}).join(`
43
+ ${I.cyan(tt)} `)}
44
+ ${I.cyan(St)}
45
+ `}}}).prompt()},ri=(i="")=>{process.stdout.write(`${I.gray(St)} ${I.red(i)}
46
46
 
47
- `)},oi=(s="")=>{process.stdout.write(`${I.gray(Rn)} ${s}
48
- `)},Pn=(s="")=>{process.stdout.write(`${I.gray(ee)}
49
- ${I.gray(ve)} ${s}
47
+ `)},ni=(i="")=>{process.stdout.write(`${I.gray(Tn)} ${i}
48
+ `)},Hn=(i="")=>{process.stdout.write(`${I.gray(tt)}
49
+ ${I.gray(St)} ${i}
50
50
 
51
- `)},ce={message:(s="",{symbol:t=I.gray(ee)}={})=>{const i=[`${I.gray(ee)}`];if(s){const[n,...r]=s.split(`
52
- `);i.push(`${t} ${n}`,...r.map(a=>`${I.gray(ee)} ${a}`))}process.stdout.write(`${i.join(`
51
+ `)},ct={message:(i="",{symbol:e=I.gray(tt)}={})=>{const r=[`${I.gray(tt)}`];if(i){const[h,...s]=i.split(`
52
+ `);r.push(`${e} ${h}`,...s.map(n=>`${I.gray(tt)} ${n}`))}process.stdout.write(`${r.join(`
53
53
  `)}
54
- `)},info:s=>{ce.message(s,{symbol:I.blue(Tn)})},success:s=>{ce.message(s,{symbol:I.green($n)})},step:s=>{ce.message(s,{symbol:I.green(yt)})},warn:s=>{ce.message(s,{symbol:I.yellow(Nn)})},warning:s=>{ce.warn(s)},error:s=>{ce.message(s,{symbol:I.red(In)})}};`${I.gray(ee)}`;const ai=({indicator:s="dots"}={})=>{const t=Ft?["\u25D2","\u25D0","\u25D3","\u25D1"]:["\u2022","o","O","0"],i=Ft?80:120,n=process.env.CI==="true";let r,a,e=!1,u="",h,m=performance.now();const y=f=>{const d=f>1?"Something went wrong":"Canceled";e&&l(d,f)},p=()=>y(2),C=()=>y(1),w=()=>{process.on("uncaughtExceptionMonitor",p),process.on("unhandledRejection",p),process.on("SIGINT",C),process.on("SIGTERM",C),process.on("exit",y)},b=()=>{process.removeListener("uncaughtExceptionMonitor",p),process.removeListener("unhandledRejection",p),process.removeListener("SIGINT",C),process.removeListener("SIGTERM",C),process.removeListener("exit",y)},A=()=>{if(h===void 0)return;n&&process.stdout.write(`
55
- `);const f=h.split(`
56
- `);process.stdout.write(pe.cursor.move(-999,f.length-1)),process.stdout.write(pe.erase.down(f.length))},S=f=>f.replace(/\.+$/,""),v=f=>{const d=(performance.now()-f)/1e3,D=Math.floor(d/60),F=Math.floor(d%60);return D>0?`[${D}m ${F}s]`:`[${F}s]`},o=(f="")=>{e=!0,r=mn(),u=S(f),m=performance.now(),process.stdout.write(`${I.gray(ee)}
57
- `);let d=0,D=0;w(),a=setInterval(()=>{if(n&&u===h)return;A(),h=u;const F=I.magenta(t[d]);if(n)process.stdout.write(`${F} ${u}...`);else if(s==="timer")process.stdout.write(`${F} ${u} ${v(m)}`);else{const R=".".repeat(Math.floor(D)).slice(0,3);process.stdout.write(`${F} ${u}${R}`)}d=d+1<t.length?d+1:0,D=D<t.length?D+.125:0},i)},l=(f="",d=0)=>{e=!1,clearInterval(a),A();const D=d===0?I.green(yt):d===1?I.red(ti):I.red(si);u=S(f??u),s==="timer"?process.stdout.write(`${D} ${u} ${v(m)}
58
- `):process.stdout.write(`${D} ${u}
59
- `),b(),r()};return{start:o,stop:l,message:(f="")=>{u=S(f??u)}}};var et={exports:{}},tt={},st={},hi;function it(){if(hi)return st;hi=1;class s extends Error{constructor(n,r,a){super(a),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=r,this.exitCode=n,this.nestedError=void 0}}class t extends s{constructor(n){super(1,"commander.invalidArgument",n),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}}return st.CommanderError=s,st.InvalidArgumentError=t,st}var li;function vt(){if(li)return tt;li=1;const{InvalidArgumentError:s}=it();class t{constructor(r,a){switch(this.description=a||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,r[0]){case"<":this.required=!0,this._name=r.slice(1,-1);break;case"[":this.required=!1,this._name=r.slice(1,-1);break;default:this.required=!0,this._name=r;break}this._name.length>3&&this._name.slice(-3)==="..."&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_concatValue(r,a){return a===this.defaultValue||!Array.isArray(a)?[r]:a.concat(r)}default(r,a){return this.defaultValue=r,this.defaultValueDescription=a,this}argParser(r){return this.parseArg=r,this}choices(r){return this.argChoices=r.slice(),this.parseArg=(a,e)=>{if(!this.argChoices.includes(a))throw new s(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(a,e):a},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}}function i(n){const r=n.name()+(n.variadic===!0?"...":"");return n.required?"<"+r+">":"["+r+"]"}return tt.Argument=t,tt.humanReadableArgName=i,tt}var At={},St={},ci;function Di(){if(ci)return St;ci=1;const{humanReadableArgName:s}=vt();class t{constructor(){this.helpWidth=void 0,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}visibleCommands(n){const r=n.commands.filter(a=>!a._hidden);if(n._hasImplicitHelpCommand()){const[,a,e]=n._helpCommandnameAndArgs.match(/([^ ]+) *(.*)/),u=n.createCommand(a).helpOption(!1);u.description(n._helpCommandDescription),e&&u.arguments(e),r.push(u)}return this.sortSubcommands&&r.sort((a,e)=>a.name().localeCompare(e.name())),r}compareOptions(n,r){const a=e=>e.short?e.short.replace(/^-/,""):e.long.replace(/^--/,"");return a(n).localeCompare(a(r))}visibleOptions(n){const r=n.options.filter(u=>!u.hidden),a=n._hasHelpOption&&n._helpShortFlag&&!n._findOption(n._helpShortFlag),e=n._hasHelpOption&&!n._findOption(n._helpLongFlag);if(a||e){let u;a?e?u=n.createOption(n._helpFlags,n._helpDescription):u=n.createOption(n._helpShortFlag,n._helpDescription):u=n.createOption(n._helpLongFlag,n._helpDescription),r.push(u)}return this.sortOptions&&r.sort(this.compareOptions),r}visibleGlobalOptions(n){if(!this.showGlobalOptions)return[];const r=[];for(let a=n.parent;a;a=a.parent){const e=a.options.filter(u=>!u.hidden);r.push(...e)}return this.sortOptions&&r.sort(this.compareOptions),r}visibleArguments(n){return n._argsDescription&&n._args.forEach(r=>{r.description=r.description||n._argsDescription[r.name()]||""}),n._args.find(r=>r.description)?n._args:[]}subcommandTerm(n){const r=n._args.map(a=>s(a)).join(" ");return n._name+(n._aliases[0]?"|"+n._aliases[0]:"")+(n.options.length?" [options]":"")+(r?" "+r:"")}optionTerm(n){return n.flags}argumentTerm(n){return n.name()}longestSubcommandTermLength(n,r){return r.visibleCommands(n).reduce((a,e)=>Math.max(a,r.subcommandTerm(e).length),0)}longestOptionTermLength(n,r){return r.visibleOptions(n).reduce((a,e)=>Math.max(a,r.optionTerm(e).length),0)}longestGlobalOptionTermLength(n,r){return r.visibleGlobalOptions(n).reduce((a,e)=>Math.max(a,r.optionTerm(e).length),0)}longestArgumentTermLength(n,r){return r.visibleArguments(n).reduce((a,e)=>Math.max(a,r.argumentTerm(e).length),0)}commandUsage(n){let r=n._name;n._aliases[0]&&(r=r+"|"+n._aliases[0]);let a="";for(let e=n.parent;e;e=e.parent)a=e.name()+" "+a;return a+r+" "+n.usage()}commandDescription(n){return n.description()}subcommandDescription(n){return n.summary()||n.description()}optionDescription(n){const r=[];return n.argChoices&&r.push(`choices: ${n.argChoices.map(a=>JSON.stringify(a)).join(", ")}`),n.defaultValue!==void 0&&(n.required||n.optional||n.isBoolean()&&typeof n.defaultValue=="boolean")&&r.push(`default: ${n.defaultValueDescription||JSON.stringify(n.defaultValue)}`),n.presetArg!==void 0&&n.optional&&r.push(`preset: ${JSON.stringify(n.presetArg)}`),n.envVar!==void 0&&r.push(`env: ${n.envVar}`),r.length>0?`${n.description} (${r.join(", ")})`:n.description}argumentDescription(n){const r=[];if(n.argChoices&&r.push(`choices: ${n.argChoices.map(a=>JSON.stringify(a)).join(", ")}`),n.defaultValue!==void 0&&r.push(`default: ${n.defaultValueDescription||JSON.stringify(n.defaultValue)}`),r.length>0){const a=`(${r.join(", ")})`;return n.description?`${n.description} ${a}`:a}return n.description}formatHelp(n,r){const a=r.padWidth(n,r),e=r.helpWidth||80,u=2,h=2;function m(S,v){if(v){const o=`${S.padEnd(a+h)}${v}`;return r.wrap(o,e-u,a+h)}return S}function y(S){return S.join(`
60
- `).replace(/^/gm," ".repeat(u))}let p=[`Usage: ${r.commandUsage(n)}`,""];const C=r.commandDescription(n);C.length>0&&(p=p.concat([r.wrap(C,e,0),""]));const w=r.visibleArguments(n).map(S=>m(r.argumentTerm(S),r.argumentDescription(S)));w.length>0&&(p=p.concat(["Arguments:",y(w),""]));const b=r.visibleOptions(n).map(S=>m(r.optionTerm(S),r.optionDescription(S)));if(b.length>0&&(p=p.concat(["Options:",y(b),""])),this.showGlobalOptions){const S=r.visibleGlobalOptions(n).map(v=>m(r.optionTerm(v),r.optionDescription(v)));S.length>0&&(p=p.concat(["Global Options:",y(S),""]))}const A=r.visibleCommands(n).map(S=>m(r.subcommandTerm(S),r.subcommandDescription(S)));return A.length>0&&(p=p.concat(["Commands:",y(A),""])),p.join(`
61
- `)}padWidth(n,r){return Math.max(r.longestOptionTermLength(n,r),r.longestGlobalOptionTermLength(n,r),r.longestSubcommandTermLength(n,r),r.longestArgumentTermLength(n,r))}wrap(n,r,a,e=40){const u=" \\f\\t\\v\xA0\u1680\u2000-\u200A\u202F\u205F\u3000\uFEFF",h=new RegExp(`[\\n][${u}]+`);if(n.match(h))return n;const m=r-a;if(m<e)return n;const y=n.slice(0,a),p=n.slice(a).replace(`\r
62
- `,`
63
- `),C=" ".repeat(a),b="\\s\u200B",A=new RegExp(`
64
- |.{1,${m-1}}([${b}]|$)|[^${b}]+?([${b}]|$)`,"g"),S=p.match(A)||[];return y+S.map((v,o)=>v===`
65
- `?"":(o>0?C:"")+v.trimEnd()).join(`
66
- `)}}return St.Help=t,St}var Ne={},fi;function di(){if(fi)return Ne;fi=1;const{InvalidArgumentError:s}=it();class t{constructor(e,u){this.flags=e,this.description=u||"",this.required=e.includes("<"),this.optional=e.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test(e),this.mandatory=!1;const h=r(e);this.short=h.shortFlag,this.long=h.longFlag,this.negate=!1,this.long&&(this.negate=this.long.startsWith("--no-")),this.defaultValue=void 0,this.defaultValueDescription=void 0,this.presetArg=void 0,this.envVar=void 0,this.parseArg=void 0,this.hidden=!1,this.argChoices=void 0,this.conflictsWith=[],this.implied=void 0}default(e,u){return this.defaultValue=e,this.defaultValueDescription=u,this}preset(e){return this.presetArg=e,this}conflicts(e){return this.conflictsWith=this.conflictsWith.concat(e),this}implies(e){let u=e;return typeof e=="string"&&(u={[e]:!0}),this.implied=Object.assign(this.implied||{},u),this}env(e){return this.envVar=e,this}argParser(e){return this.parseArg=e,this}makeOptionMandatory(e=!0){return this.mandatory=!!e,this}hideHelp(e=!0){return this.hidden=!!e,this}_concatValue(e,u){return u===this.defaultValue||!Array.isArray(u)?[e]:u.concat(e)}choices(e){return this.argChoices=e.slice(),this.parseArg=(u,h)=>{if(!this.argChoices.includes(u))throw new s(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(u,h):u},this}name(){return this.long?this.long.replace(/^--/,""):this.short.replace(/^-/,"")}attributeName(){return n(this.name().replace(/^no-/,""))}is(e){return this.short===e||this.long===e}isBoolean(){return!this.required&&!this.optional&&!this.negate}}class i{constructor(e){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,e.forEach(u=>{u.negate?this.negativeOptions.set(u.attributeName(),u):this.positiveOptions.set(u.attributeName(),u)}),this.negativeOptions.forEach((u,h)=>{this.positiveOptions.has(h)&&this.dualOptions.add(h)})}valueFromOption(e,u){const h=u.attributeName();if(!this.dualOptions.has(h))return!0;const m=this.negativeOptions.get(h).presetArg,y=m!==void 0?m:!1;return u.negate===(y===e)}}function n(a){return a.split("-").reduce((e,u)=>e+u[0].toUpperCase()+u.slice(1))}function r(a){let e,u;const h=a.split(/[ |,]+/);return h.length>1&&!/^[[<]/.test(h[1])&&(e=h.shift()),u=h.shift(),!e&&/^-[^-]$/.test(u)&&(e=u,u=void 0),{shortFlag:e,longFlag:u}}return Ne.Option=t,Ne.splitOptionFlags=r,Ne.DualOptions=i,Ne}var Ot={},pi;function Mn(){if(pi)return Ot;pi=1;const s=3;function t(n,r){if(Math.abs(n.length-r.length)>s)return Math.max(n.length,r.length);const a=[];for(let e=0;e<=n.length;e++)a[e]=[e];for(let e=0;e<=r.length;e++)a[0][e]=e;for(let e=1;e<=r.length;e++)for(let u=1;u<=n.length;u++){let h=1;n[u-1]===r[e-1]?h=0:h=1,a[u][e]=Math.min(a[u-1][e]+1,a[u][e-1]+1,a[u-1][e-1]+h),u>1&&e>1&&n[u-1]===r[e-2]&&n[u-2]===r[e-1]&&(a[u][e]=Math.min(a[u][e],a[u-2][e-2]+1))}return a[n.length][r.length]}function i(n,r){if(!r||r.length===0)return"";r=Array.from(new Set(r));const a=n.startsWith("--");a&&(n=n.slice(2),r=r.map(m=>m.slice(2)));let e=[],u=s;const h=.4;return r.forEach(m=>{if(m.length<=1)return;const y=t(n,m),p=Math.max(n.length,m.length);(p-y)/p>h&&(y<u?(u=y,e=[m]):y===u&&e.push(m))}),e.sort((m,y)=>m.localeCompare(y)),a&&(e=e.map(m=>`--${m}`)),e.length>1?`
67
- (Did you mean one of ${e.join(", ")}?)`:e.length===1?`
68
- (Did you mean ${e[0]}?)`:""}return Ot.suggestSimilar=i,Ot}var mi;function kn(){if(mi)return At;mi=1;const s=Te.EventEmitter,t=Ir,i=fe,n=Ce,r=Ns,{Argument:a,humanReadableArgName:e}=vt(),{CommanderError:u}=it(),{Help:h}=Di(),{Option:m,splitOptionFlags:y,DualOptions:p}=di(),{suggestSimilar:C}=Mn();class w extends s{constructor(o){super(),this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=!1,this._allowExcessArguments=!0,this._args=[],this.args=[],this.rawArgs=[],this.processedArgs=[],this._scriptPath=null,this._name=o||"",this._optionValues={},this._optionValueSources={},this._storeOptionsAsProperties=!1,this._actionHandler=null,this._executableHandler=!1,this._executableFile=null,this._executableDir=null,this._defaultCommandName=null,this._exitCallback=null,this._aliases=[],this._combineFlagAndOptionalValue=!0,this._description="",this._summary="",this._argsDescription=void 0,this._enablePositionalOptions=!1,this._passThroughOptions=!1,this._lifeCycleHooks={},this._showHelpAfterError=!1,this._showSuggestionAfterError=!0,this._outputConfiguration={writeOut:l=>r.stdout.write(l),writeErr:l=>r.stderr.write(l),getOutHelpWidth:()=>r.stdout.isTTY?r.stdout.columns:void 0,getErrHelpWidth:()=>r.stderr.isTTY?r.stderr.columns:void 0,outputError:(l,f)=>f(l)},this._hidden=!1,this._hasHelpOption=!0,this._helpFlags="-h, --help",this._helpDescription="display help for command",this._helpShortFlag="-h",this._helpLongFlag="--help",this._addImplicitHelpCommand=void 0,this._helpCommandName="help",this._helpCommandnameAndArgs="help [command]",this._helpCommandDescription="display help for command",this._helpConfiguration={}}copyInheritedSettings(o){return this._outputConfiguration=o._outputConfiguration,this._hasHelpOption=o._hasHelpOption,this._helpFlags=o._helpFlags,this._helpDescription=o._helpDescription,this._helpShortFlag=o._helpShortFlag,this._helpLongFlag=o._helpLongFlag,this._helpCommandName=o._helpCommandName,this._helpCommandnameAndArgs=o._helpCommandnameAndArgs,this._helpCommandDescription=o._helpCommandDescription,this._helpConfiguration=o._helpConfiguration,this._exitCallback=o._exitCallback,this._storeOptionsAsProperties=o._storeOptionsAsProperties,this._combineFlagAndOptionalValue=o._combineFlagAndOptionalValue,this._allowExcessArguments=o._allowExcessArguments,this._enablePositionalOptions=o._enablePositionalOptions,this._showHelpAfterError=o._showHelpAfterError,this._showSuggestionAfterError=o._showSuggestionAfterError,this}command(o,l,f){let d=l,D=f;typeof d=="object"&&d!==null&&(D=d,d=null),D=D||{};const[,F,R]=o.match(/([^ ]+) *(.*)/),B=this.createCommand(F);return d&&(B.description(d),B._executableHandler=!0),D.isDefault&&(this._defaultCommandName=B._name),B._hidden=!!(D.noHelp||D.hidden),B._executableFile=D.executableFile||null,R&&B.arguments(R),this.commands.push(B),B.parent=this,B.copyInheritedSettings(this),d?this:B}createCommand(o){return new w(o)}createHelp(){return Object.assign(new h,this.configureHelp())}configureHelp(o){return o===void 0?this._helpConfiguration:(this._helpConfiguration=o,this)}configureOutput(o){return o===void 0?this._outputConfiguration:(Object.assign(this._outputConfiguration,o),this)}showHelpAfterError(o=!0){return typeof o!="string"&&(o=!!o),this._showHelpAfterError=o,this}showSuggestionAfterError(o=!0){return this._showSuggestionAfterError=!!o,this}addCommand(o,l){if(!o._name)throw new Error(`Command passed to .addCommand() must have a name
69
- - specify the name in Command constructor or using .name()`);return l=l||{},l.isDefault&&(this._defaultCommandName=o._name),(l.noHelp||l.hidden)&&(o._hidden=!0),this.commands.push(o),o.parent=this,this}createArgument(o,l){return new a(o,l)}argument(o,l,f,d){const D=this.createArgument(o,l);return typeof f=="function"?D.default(d).argParser(f):D.default(f),this.addArgument(D),this}arguments(o){return o.split(/ +/).forEach(l=>{this.argument(l)}),this}addArgument(o){const l=this._args.slice(-1)[0];if(l&&l.variadic)throw new Error(`only the last argument can be variadic '${l.name()}'`);if(o.required&&o.defaultValue!==void 0&&o.parseArg===void 0)throw new Error(`a default value for a required argument is never used: '${o.name()}'`);return this._args.push(o),this}addHelpCommand(o,l){return o===!1?this._addImplicitHelpCommand=!1:(this._addImplicitHelpCommand=!0,typeof o=="string"&&(this._helpCommandName=o.split(" ")[0],this._helpCommandnameAndArgs=o),this._helpCommandDescription=l||this._helpCommandDescription),this}_hasImplicitHelpCommand(){return this._addImplicitHelpCommand===void 0?this.commands.length&&!this._actionHandler&&!this._findCommand("help"):this._addImplicitHelpCommand}hook(o,l){const f=["preSubcommand","preAction","postAction"];if(!f.includes(o))throw new Error(`Unexpected value for event passed to hook : '${o}'.
70
- Expecting one of '${f.join("', '")}'`);return this._lifeCycleHooks[o]?this._lifeCycleHooks[o].push(l):this._lifeCycleHooks[o]=[l],this}exitOverride(o){return o?this._exitCallback=o:this._exitCallback=l=>{if(l.code!=="commander.executeSubCommandAsync")throw l},this}_exit(o,l,f){this._exitCallback&&this._exitCallback(new u(o,l,f)),r.exit(o)}action(o){const l=f=>{const d=this._args.length,D=f.slice(0,d);return this._storeOptionsAsProperties?D[d]=this:D[d]=this.opts(),D.push(this),o.apply(this,D)};return this._actionHandler=l,this}createOption(o,l){return new m(o,l)}addOption(o){const l=o.name(),f=o.attributeName();if(o.negate){const D=o.long.replace(/^--no-/,"--");this._findOption(D)||this.setOptionValueWithSource(f,o.defaultValue===void 0?!0:o.defaultValue,"default")}else o.defaultValue!==void 0&&this.setOptionValueWithSource(f,o.defaultValue,"default");this.options.push(o);const d=(D,F,R)=>{D==null&&o.presetArg!==void 0&&(D=o.presetArg);const B=this.getOptionValue(f);if(D!==null&&o.parseArg)try{D=o.parseArg(D,B)}catch(x){if(x.code==="commander.invalidArgument"){const P=`${F} ${x.message}`;this.error(P,{exitCode:x.exitCode,code:x.code})}throw x}else D!==null&&o.variadic&&(D=o._concatValue(D,B));D==null&&(o.negate?D=!1:o.isBoolean()||o.optional?D=!0:D=""),this.setOptionValueWithSource(f,D,R)};return this.on("option:"+l,D=>{const F=`error: option '${o.flags}' argument '${D}' is invalid.`;d(D,F,"cli")}),o.envVar&&this.on("optionEnv:"+l,D=>{const F=`error: option '${o.flags}' value '${D}' from env '${o.envVar}' is invalid.`;d(D,F,"env")}),this}_optionEx(o,l,f,d,D){if(typeof l=="object"&&l instanceof m)throw new Error("To add an Option object use addOption() instead of option() or requiredOption()");const F=this.createOption(l,f);if(F.makeOptionMandatory(!!o.mandatory),typeof d=="function")F.default(D).argParser(d);else if(d instanceof RegExp){const R=d;d=(B,x)=>{const P=R.exec(B);return P?P[0]:x},F.default(D).argParser(d)}else F.default(d);return this.addOption(F)}option(o,l,f,d){return this._optionEx({},o,l,f,d)}requiredOption(o,l,f,d){return this._optionEx({mandatory:!0},o,l,f,d)}combineFlagAndOptionalValue(o=!0){return this._combineFlagAndOptionalValue=!!o,this}allowUnknownOption(o=!0){return this._allowUnknownOption=!!o,this}allowExcessArguments(o=!0){return this._allowExcessArguments=!!o,this}enablePositionalOptions(o=!0){return this._enablePositionalOptions=!!o,this}passThroughOptions(o=!0){if(this._passThroughOptions=!!o,this.parent&&o&&!this.parent._enablePositionalOptions)throw new Error("passThroughOptions can not be used without turning on enablePositionalOptions for parent command(s)");return this}storeOptionsAsProperties(o=!0){if(this._storeOptionsAsProperties=!!o,this.options.length)throw new Error("call .storeOptionsAsProperties() before adding options");return this}getOptionValue(o){return this._storeOptionsAsProperties?this[o]:this._optionValues[o]}setOptionValue(o,l){return this.setOptionValueWithSource(o,l,void 0)}setOptionValueWithSource(o,l,f){return this._storeOptionsAsProperties?this[o]=l:this._optionValues[o]=l,this._optionValueSources[o]=f,this}getOptionValueSource(o){return this._optionValueSources[o]}getOptionValueSourceWithGlobals(o){let l;return S(this).forEach(f=>{f.getOptionValueSource(o)!==void 0&&(l=f.getOptionValueSource(o))}),l}_prepareUserArgs(o,l){if(o!==void 0&&!Array.isArray(o))throw new Error("first parameter to parse must be array or undefined");l=l||{},o===void 0&&(o=r.argv,r.versions&&r.versions.electron&&(l.from="electron")),this.rawArgs=o.slice();let f;switch(l.from){case void 0:case"node":this._scriptPath=o[1],f=o.slice(2);break;case"electron":r.defaultApp?(this._scriptPath=o[1],f=o.slice(2)):f=o.slice(1);break;case"user":f=o.slice(0);break;default:throw new Error(`unexpected parse option { from: '${l.from}' }`)}return!this._name&&this._scriptPath&&this.nameFromFilename(this._scriptPath),this._name=this._name||"program",f}parse(o,l){const f=this._prepareUserArgs(o,l);return this._parseCommand([],f),this}async parseAsync(o,l){const f=this._prepareUserArgs(o,l);return await this._parseCommand([],f),this}_executeSubCommand(o,l){l=l.slice();let f=!1;const d=[".js",".ts",".tsx",".mjs",".cjs"];function D(P,M){const U=i.resolve(P,M);if(n.existsSync(U))return U;if(d.includes(i.extname(M)))return;const G=d.find(Y=>n.existsSync(`${U}${Y}`));if(G)return`${U}${G}`}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let F=o._executableFile||`${this._name}-${o._name}`,R=this._executableDir||"";if(this._scriptPath){let P;try{P=n.realpathSync(this._scriptPath)}catch{P=this._scriptPath}R=i.resolve(i.dirname(P),R)}if(R){let P=D(R,F);if(!P&&!o._executableFile&&this._scriptPath){const M=i.basename(this._scriptPath,i.extname(this._scriptPath));M!==this._name&&(P=D(R,`${M}-${o._name}`))}F=P||F}f=d.includes(i.extname(F));let B;r.platform!=="win32"?f?(l.unshift(F),l=A(r.execArgv).concat(l),B=t.spawn(r.argv[0],l,{stdio:"inherit"})):B=t.spawn(F,l,{stdio:"inherit"}):(l.unshift(F),l=A(r.execArgv).concat(l),B=t.spawn(r.execPath,l,{stdio:"inherit"})),B.killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(M=>{r.on(M,()=>{B.killed===!1&&B.exitCode===null&&B.kill(M)})});const x=this._exitCallback;x?B.on("close",()=>{x(new u(r.exitCode||0,"commander.executeSubCommandAsync","(close)"))}):B.on("close",r.exit.bind(r)),B.on("error",P=>{if(P.code==="ENOENT"){const M=R?`searched for local subcommand relative to directory '${R}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",U=`'${F}' does not exist
71
- - if '${o._name}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
54
+ `)},info:i=>{ct.message(i,{symbol:I.blue(Nn)})},success:i=>{ct.message(i,{symbol:I.green(Ln)})},step:i=>{ct.message(i,{symbol:I.green(_e)})},warn:i=>{ct.message(i,{symbol:I.yellow(Pn)})},warning:i=>{ct.warn(i)},error:i=>{ct.message(i,{symbol:I.red(Mn)})}};`${I.gray(tt)}`;const ui=({indicator:i="dots"}={})=>{const e=be?["\u25D2","\u25D0","\u25D3","\u25D1"]:["\u2022","o","O","0"],r=be?80:120,h=process.env.CI==="true";let s,n,t=!1,u="",a,m=performance.now();const y=f=>{const d=f>1?"Something went wrong":"Canceled";t&&D(d,f)},g=()=>y(2),F=()=>y(1),w=()=>{process.on("uncaughtExceptionMonitor",g),process.on("unhandledRejection",g),process.on("SIGINT",F),process.on("SIGTERM",F),process.on("exit",y)},b=()=>{process.removeListener("uncaughtExceptionMonitor",g),process.removeListener("unhandledRejection",g),process.removeListener("SIGINT",F),process.removeListener("SIGTERM",F),process.removeListener("exit",y)},A=()=>{if(a===void 0)return;h&&process.stdout.write(`
55
+ `);const f=a.split(`
56
+ `);process.stdout.write(mt.cursor.move(-999,f.length-1)),process.stdout.write(mt.erase.down(f.length))},R=f=>f.replace(/\.+$/,""),o=f=>{const d=(performance.now()-f)/1e3,p=Math.floor(d/60),_=Math.floor(d%60);return p>0?`[${p}m ${_}s]`:`[${_}s]`},l=(f="")=>{t=!0,s=Cn(),u=R(f),m=performance.now(),process.stdout.write(`${I.gray(tt)}
57
+ `);let d=0,p=0;w(),n=setInterval(()=>{if(h&&u===a)return;A(),a=u;const _=I.magenta(e[d]);if(h)process.stdout.write(`${_} ${u}...`);else if(i==="timer")process.stdout.write(`${_} ${u} ${o(m)}`);else{const O=".".repeat(Math.floor(p)).slice(0,3);process.stdout.write(`${_} ${u}${O}`)}d=d+1<e.length?d+1:0,p=p<e.length?p+.125:0},r)},D=(f="",d=0)=>{t=!1,clearInterval(n),A();const p=d===0?I.green(_e):d===1?I.red(Qs):I.red(ti);u=R(f??u),i==="timer"?process.stdout.write(`${p} ${u} ${o(m)}
58
+ `):process.stdout.write(`${p} ${u}
59
+ `),b(),s()};return{start:l,stop:D,message:(f="")=>{u=R(f??u)}}};var Ft={},te={},ee={},oi;function se(){if(oi)return ee;oi=1;class i extends Error{constructor(h,s,n){super(n),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=s,this.exitCode=h,this.nestedError=void 0}}class e extends i{constructor(h){super(1,"commander.invalidArgument",h),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}}return ee.CommanderError=i,ee.InvalidArgumentError=e,ee}var ai;function Se(){if(ai)return te;ai=1;const{InvalidArgumentError:i}=se();class e{constructor(s,n){switch(this.description=n||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,s[0]){case"<":this.required=!0,this._name=s.slice(1,-1);break;case"[":this.required=!1,this._name=s.slice(1,-1);break;default:this.required=!0,this._name=s;break}this._name.length>3&&this._name.slice(-3)==="..."&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_concatValue(s,n){return n===this.defaultValue||!Array.isArray(n)?[s]:n.concat(s)}default(s,n){return this.defaultValue=s,this.defaultValueDescription=n,this}argParser(s){return this.parseArg=s,this}choices(s){return this.argChoices=s.slice(),this.parseArg=(n,t)=>{if(!this.argChoices.includes(n))throw new i(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(n,t):n},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}}function r(h){const s=h.name()+(h.variadic===!0?"...":"");return h.required?"<"+s+">":"["+s+"]"}return te.Argument=e,te.humanReadableArgName=r,te}var ie={},re={},hi;function li(){if(hi)return re;hi=1;const{humanReadableArgName:i}=Se();class e{constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}prepareContext(s){this.helpWidth=this.helpWidth??s.helpWidth??80}visibleCommands(s){const n=s.commands.filter(u=>!u._hidden),t=s._getHelpCommand();return t&&!t._hidden&&n.push(t),this.sortSubcommands&&n.sort((u,a)=>u.name().localeCompare(a.name())),n}compareOptions(s,n){const t=u=>u.short?u.short.replace(/^-/,""):u.long.replace(/^--/,"");return t(s).localeCompare(t(n))}visibleOptions(s){const n=s.options.filter(u=>!u.hidden),t=s._getHelpOption();if(t&&!t.hidden){const u=t.short&&s._findOption(t.short),a=t.long&&s._findOption(t.long);!u&&!a?n.push(t):t.long&&!a?n.push(s.createOption(t.long,t.description)):t.short&&!u&&n.push(s.createOption(t.short,t.description))}return this.sortOptions&&n.sort(this.compareOptions),n}visibleGlobalOptions(s){if(!this.showGlobalOptions)return[];const n=[];for(let t=s.parent;t;t=t.parent){const u=t.options.filter(a=>!a.hidden);n.push(...u)}return this.sortOptions&&n.sort(this.compareOptions),n}visibleArguments(s){return s._argsDescription&&s.registeredArguments.forEach(n=>{n.description=n.description||s._argsDescription[n.name()]||""}),s.registeredArguments.find(n=>n.description)?s.registeredArguments:[]}subcommandTerm(s){const n=s.registeredArguments.map(t=>i(t)).join(" ");return s._name+(s._aliases[0]?"|"+s._aliases[0]:"")+(s.options.length?" [options]":"")+(n?" "+n:"")}optionTerm(s){return s.flags}argumentTerm(s){return s.name()}longestSubcommandTermLength(s,n){return n.visibleCommands(s).reduce((t,u)=>Math.max(t,this.displayWidth(n.styleSubcommandTerm(n.subcommandTerm(u)))),0)}longestOptionTermLength(s,n){return n.visibleOptions(s).reduce((t,u)=>Math.max(t,this.displayWidth(n.styleOptionTerm(n.optionTerm(u)))),0)}longestGlobalOptionTermLength(s,n){return n.visibleGlobalOptions(s).reduce((t,u)=>Math.max(t,this.displayWidth(n.styleOptionTerm(n.optionTerm(u)))),0)}longestArgumentTermLength(s,n){return n.visibleArguments(s).reduce((t,u)=>Math.max(t,this.displayWidth(n.styleArgumentTerm(n.argumentTerm(u)))),0)}commandUsage(s){let n=s._name;s._aliases[0]&&(n=n+"|"+s._aliases[0]);let t="";for(let u=s.parent;u;u=u.parent)t=u.name()+" "+t;return t+n+" "+s.usage()}commandDescription(s){return s.description()}subcommandDescription(s){return s.summary()||s.description()}optionDescription(s){const n=[];if(s.argChoices&&n.push(`choices: ${s.argChoices.map(t=>JSON.stringify(t)).join(", ")}`),s.defaultValue!==void 0&&(s.required||s.optional||s.isBoolean()&&typeof s.defaultValue=="boolean")&&n.push(`default: ${s.defaultValueDescription||JSON.stringify(s.defaultValue)}`),s.presetArg!==void 0&&s.optional&&n.push(`preset: ${JSON.stringify(s.presetArg)}`),s.envVar!==void 0&&n.push(`env: ${s.envVar}`),n.length>0){const t=`(${n.join(", ")})`;return s.description?`${s.description} ${t}`:t}return s.description}argumentDescription(s){const n=[];if(s.argChoices&&n.push(`choices: ${s.argChoices.map(t=>JSON.stringify(t)).join(", ")}`),s.defaultValue!==void 0&&n.push(`default: ${s.defaultValueDescription||JSON.stringify(s.defaultValue)}`),n.length>0){const t=`(${n.join(", ")})`;return s.description?`${s.description} ${t}`:t}return s.description}formatItemList(s,n,t){return n.length===0?[]:[t.styleTitle(s),...n,""]}groupItems(s,n,t){const u=new Map;return s.forEach(a=>{const m=t(a);u.has(m)||u.set(m,[])}),n.forEach(a=>{const m=t(a);u.has(m)||u.set(m,[]),u.get(m).push(a)}),u}formatHelp(s,n){const t=n.padWidth(s,n),u=n.helpWidth??80;function a(b,A){return n.formatItem(b,t,A,n)}let m=[`${n.styleTitle("Usage:")} ${n.styleUsage(n.commandUsage(s))}`,""];const y=n.commandDescription(s);y.length>0&&(m=m.concat([n.boxWrap(n.styleCommandDescription(y),u),""]));const g=n.visibleArguments(s).map(b=>a(n.styleArgumentTerm(n.argumentTerm(b)),n.styleArgumentDescription(n.argumentDescription(b))));if(m=m.concat(this.formatItemList("Arguments:",g,n)),this.groupItems(s.options,n.visibleOptions(s),b=>b.helpGroupHeading??"Options:").forEach((b,A)=>{const R=b.map(o=>a(n.styleOptionTerm(n.optionTerm(o)),n.styleOptionDescription(n.optionDescription(o))));m=m.concat(this.formatItemList(A,R,n))}),n.showGlobalOptions){const b=n.visibleGlobalOptions(s).map(A=>a(n.styleOptionTerm(n.optionTerm(A)),n.styleOptionDescription(n.optionDescription(A))));m=m.concat(this.formatItemList("Global Options:",b,n))}return this.groupItems(s.commands,n.visibleCommands(s),b=>b.helpGroup()||"Commands:").forEach((b,A)=>{const R=b.map(o=>a(n.styleSubcommandTerm(n.subcommandTerm(o)),n.styleSubcommandDescription(n.subcommandDescription(o))));m=m.concat(this.formatItemList(A,R,n))}),m.join(`
60
+ `)}displayWidth(s){return r(s).length}styleTitle(s){return s}styleUsage(s){return s.split(" ").map(n=>n==="[options]"?this.styleOptionText(n):n==="[command]"?this.styleSubcommandText(n):n[0]==="["||n[0]==="<"?this.styleArgumentText(n):this.styleCommandText(n)).join(" ")}styleCommandDescription(s){return this.styleDescriptionText(s)}styleOptionDescription(s){return this.styleDescriptionText(s)}styleSubcommandDescription(s){return this.styleDescriptionText(s)}styleArgumentDescription(s){return this.styleDescriptionText(s)}styleDescriptionText(s){return s}styleOptionTerm(s){return this.styleOptionText(s)}styleSubcommandTerm(s){return s.split(" ").map(n=>n==="[options]"?this.styleOptionText(n):n[0]==="["||n[0]==="<"?this.styleArgumentText(n):this.styleSubcommandText(n)).join(" ")}styleArgumentTerm(s){return this.styleArgumentText(s)}styleOptionText(s){return s}styleArgumentText(s){return s}styleSubcommandText(s){return s}styleCommandText(s){return s}padWidth(s,n){return Math.max(n.longestOptionTermLength(s,n),n.longestGlobalOptionTermLength(s,n),n.longestSubcommandTermLength(s,n),n.longestArgumentTermLength(s,n))}preformatted(s){return/\n[^\S\r\n]/.test(s)}formatItem(s,n,t,u){const m=" ".repeat(2);if(!t)return m+s;const y=s.padEnd(n+s.length-u.displayWidth(s)),g=2,w=(this.helpWidth??80)-n-g-2;let b;return w<this.minWidthToWrap||u.preformatted(t)?b=t:b=u.boxWrap(t,w).replace(/\n/g,`
61
+ `+" ".repeat(n+g)),m+y+" ".repeat(g)+b.replace(/\n/g,`
62
+ ${m}`)}boxWrap(s,n){if(n<this.minWidthToWrap)return s;const t=s.split(/\r\n|\n/),u=/[\s]*[^\s]+/g,a=[];return t.forEach(m=>{const y=m.match(u);if(y===null){a.push("");return}let g=[y.shift()],F=this.displayWidth(g[0]);y.forEach(w=>{const b=this.displayWidth(w);if(F+b<=n){g.push(w),F+=b;return}a.push(g.join(""));const A=w.trimStart();g=[A],F=this.displayWidth(A)}),a.push(g.join(""))}),a.join(`
63
+ `)}}function r(h){const s=/\x1b\[\d*(;\d*)*m/g;return h.replace(s,"")}return re.Help=e,re.stripColor=r,re}var ne={},ci;function Di(){if(ci)return ne;ci=1;const{InvalidArgumentError:i}=se();class e{constructor(t,u){this.flags=t,this.description=u||"",this.required=t.includes("<"),this.optional=t.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test(t),this.mandatory=!1;const a=s(t);this.short=a.shortFlag,this.long=a.longFlag,this.negate=!1,this.long&&(this.negate=this.long.startsWith("--no-")),this.defaultValue=void 0,this.defaultValueDescription=void 0,this.presetArg=void 0,this.envVar=void 0,this.parseArg=void 0,this.hidden=!1,this.argChoices=void 0,this.conflictsWith=[],this.implied=void 0,this.helpGroupHeading=void 0}default(t,u){return this.defaultValue=t,this.defaultValueDescription=u,this}preset(t){return this.presetArg=t,this}conflicts(t){return this.conflictsWith=this.conflictsWith.concat(t),this}implies(t){let u=t;return typeof t=="string"&&(u={[t]:!0}),this.implied=Object.assign(this.implied||{},u),this}env(t){return this.envVar=t,this}argParser(t){return this.parseArg=t,this}makeOptionMandatory(t=!0){return this.mandatory=!!t,this}hideHelp(t=!0){return this.hidden=!!t,this}_concatValue(t,u){return u===this.defaultValue||!Array.isArray(u)?[t]:u.concat(t)}choices(t){return this.argChoices=t.slice(),this.parseArg=(u,a)=>{if(!this.argChoices.includes(u))throw new i(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(u,a):u},this}name(){return this.long?this.long.replace(/^--/,""):this.short.replace(/^-/,"")}attributeName(){return this.negate?h(this.name().replace(/^no-/,"")):h(this.name())}helpGroup(t){return this.helpGroupHeading=t,this}is(t){return this.short===t||this.long===t}isBoolean(){return!this.required&&!this.optional&&!this.negate}}class r{constructor(t){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,t.forEach(u=>{u.negate?this.negativeOptions.set(u.attributeName(),u):this.positiveOptions.set(u.attributeName(),u)}),this.negativeOptions.forEach((u,a)=>{this.positiveOptions.has(a)&&this.dualOptions.add(a)})}valueFromOption(t,u){const a=u.attributeName();if(!this.dualOptions.has(a))return!0;const m=this.negativeOptions.get(a).presetArg,y=m!==void 0?m:!1;return u.negate===(y===t)}}function h(n){return n.split("-").reduce((t,u)=>t+u[0].toUpperCase()+u.slice(1))}function s(n){let t,u;const a=/^-[^-]$/,m=/^--[^-]/,y=n.split(/[ |,]+/).concat("guard");if(a.test(y[0])&&(t=y.shift()),m.test(y[0])&&(u=y.shift()),!t&&a.test(y[0])&&(t=y.shift()),!t&&m.test(y[0])&&(t=u,u=y.shift()),y[0].startsWith("-")){const g=y[0],F=`option creation failed due to '${g}' in option flags '${n}'`;throw/^-[^-][^-]/.test(g)?new Error(`${F}
64
+ - a short flag is a single dash and a single character
65
+ - either use a single dash and a single character (for a short flag)
66
+ - or use a double dash for a long option (and can have two, like '--ws, --workspace')`):a.test(g)?new Error(`${F}
67
+ - too many short flags`):m.test(g)?new Error(`${F}
68
+ - too many long flags`):new Error(`${F}
69
+ - unrecognised flag format`)}if(t===void 0&&u===void 0)throw new Error(`option creation failed due to no flags found in '${n}'.`);return{shortFlag:t,longFlag:u}}return ne.Option=e,ne.DualOptions=r,ne}var Oe={},di;function jn(){if(di)return Oe;di=1;const i=3;function e(h,s){if(Math.abs(h.length-s.length)>i)return Math.max(h.length,s.length);const n=[];for(let t=0;t<=h.length;t++)n[t]=[t];for(let t=0;t<=s.length;t++)n[0][t]=t;for(let t=1;t<=s.length;t++)for(let u=1;u<=h.length;u++){let a=1;h[u-1]===s[t-1]?a=0:a=1,n[u][t]=Math.min(n[u-1][t]+1,n[u][t-1]+1,n[u-1][t-1]+a),u>1&&t>1&&h[u-1]===s[t-2]&&h[u-2]===s[t-1]&&(n[u][t]=Math.min(n[u][t],n[u-2][t-2]+1))}return n[h.length][s.length]}function r(h,s){if(!s||s.length===0)return"";s=Array.from(new Set(s));const n=h.startsWith("--");n&&(h=h.slice(2),s=s.map(m=>m.slice(2)));let t=[],u=i;const a=.4;return s.forEach(m=>{if(m.length<=1)return;const y=e(h,m),g=Math.max(h.length,m.length);(g-y)/g>a&&(y<u?(u=y,t=[m]):y===u&&t.push(m))}),t.sort((m,y)=>m.localeCompare(y)),n&&(t=t.map(m=>`--${m}`)),t.length>1?`
70
+ (Did you mean one of ${t.join(", ")}?)`:t.length===1?`
71
+ (Did you mean ${t[0]}?)`:""}return Oe.suggestSimilar=r,Oe}var fi;function Gn(){if(fi)return ie;fi=1;const i=Nr.EventEmitter,e=Pr,r=dt,h=At,s=Q,{Argument:n,humanReadableArgName:t}=Se(),{CommanderError:u}=se(),{Help:a,stripColor:m}=li(),{Option:y,DualOptions:g}=Di(),{suggestSimilar:F}=jn();class w extends i{constructor(o){super(),this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=!1,this._allowExcessArguments=!1,this.registeredArguments=[],this._args=this.registeredArguments,this.args=[],this.rawArgs=[],this.processedArgs=[],this._scriptPath=null,this._name=o||"",this._optionValues={},this._optionValueSources={},this._storeOptionsAsProperties=!1,this._actionHandler=null,this._executableHandler=!1,this._executableFile=null,this._executableDir=null,this._defaultCommandName=null,this._exitCallback=null,this._aliases=[],this._combineFlagAndOptionalValue=!0,this._description="",this._summary="",this._argsDescription=void 0,this._enablePositionalOptions=!1,this._passThroughOptions=!1,this._lifeCycleHooks={},this._showHelpAfterError=!1,this._showSuggestionAfterError=!0,this._savedState=null,this._outputConfiguration={writeOut:l=>s.stdout.write(l),writeErr:l=>s.stderr.write(l),outputError:(l,D)=>D(l),getOutHelpWidth:()=>s.stdout.isTTY?s.stdout.columns:void 0,getErrHelpWidth:()=>s.stderr.isTTY?s.stderr.columns:void 0,getOutHasColors:()=>A()??(s.stdout.isTTY&&s.stdout.hasColors?.()),getErrHasColors:()=>A()??(s.stderr.isTTY&&s.stderr.hasColors?.()),stripColor:l=>m(l)},this._hidden=!1,this._helpOption=void 0,this._addImplicitHelpCommand=void 0,this._helpCommand=void 0,this._helpConfiguration={},this._helpGroupHeading=void 0,this._defaultCommandGroup=void 0,this._defaultOptionGroup=void 0}copyInheritedSettings(o){return this._outputConfiguration=o._outputConfiguration,this._helpOption=o._helpOption,this._helpCommand=o._helpCommand,this._helpConfiguration=o._helpConfiguration,this._exitCallback=o._exitCallback,this._storeOptionsAsProperties=o._storeOptionsAsProperties,this._combineFlagAndOptionalValue=o._combineFlagAndOptionalValue,this._allowExcessArguments=o._allowExcessArguments,this._enablePositionalOptions=o._enablePositionalOptions,this._showHelpAfterError=o._showHelpAfterError,this._showSuggestionAfterError=o._showSuggestionAfterError,this}_getCommandAndAncestors(){const o=[];for(let l=this;l;l=l.parent)o.push(l);return o}command(o,l,D){let f=l,d=D;typeof f=="object"&&f!==null&&(d=f,f=null),d=d||{};const[,p,_]=o.match(/([^ ]+) *(.*)/),O=this.createCommand(p);return f&&(O.description(f),O._executableHandler=!0),d.isDefault&&(this._defaultCommandName=O._name),O._hidden=!!(d.noHelp||d.hidden),O._executableFile=d.executableFile||null,_&&O.arguments(_),this._registerCommand(O),O.parent=this,O.copyInheritedSettings(this),f?this:O}createCommand(o){return new w(o)}createHelp(){return Object.assign(new a,this.configureHelp())}configureHelp(o){return o===void 0?this._helpConfiguration:(this._helpConfiguration=o,this)}configureOutput(o){return o===void 0?this._outputConfiguration:(this._outputConfiguration=Object.assign({},this._outputConfiguration,o),this)}showHelpAfterError(o=!0){return typeof o!="string"&&(o=!!o),this._showHelpAfterError=o,this}showSuggestionAfterError(o=!0){return this._showSuggestionAfterError=!!o,this}addCommand(o,l){if(!o._name)throw new Error(`Command passed to .addCommand() must have a name
72
+ - specify the name in Command constructor or using .name()`);return l=l||{},l.isDefault&&(this._defaultCommandName=o._name),(l.noHelp||l.hidden)&&(o._hidden=!0),this._registerCommand(o),o.parent=this,o._checkForBrokenPassThrough(),this}createArgument(o,l){return new n(o,l)}argument(o,l,D,f){const d=this.createArgument(o,l);return typeof D=="function"?d.default(f).argParser(D):d.default(D),this.addArgument(d),this}arguments(o){return o.trim().split(/ +/).forEach(l=>{this.argument(l)}),this}addArgument(o){const l=this.registeredArguments.slice(-1)[0];if(l&&l.variadic)throw new Error(`only the last argument can be variadic '${l.name()}'`);if(o.required&&o.defaultValue!==void 0&&o.parseArg===void 0)throw new Error(`a default value for a required argument is never used: '${o.name()}'`);return this.registeredArguments.push(o),this}helpCommand(o,l){if(typeof o=="boolean")return this._addImplicitHelpCommand=o,o&&this._defaultCommandGroup&&this._initCommandGroup(this._getHelpCommand()),this;const D=o??"help [command]",[,f,d]=D.match(/([^ ]+) *(.*)/),p=l??"display help for command",_=this.createCommand(f);return _.helpOption(!1),d&&_.arguments(d),p&&_.description(p),this._addImplicitHelpCommand=!0,this._helpCommand=_,(o||l)&&this._initCommandGroup(_),this}addHelpCommand(o,l){return typeof o!="object"?(this.helpCommand(o,l),this):(this._addImplicitHelpCommand=!0,this._helpCommand=o,this._initCommandGroup(o),this)}_getHelpCommand(){return this._addImplicitHelpCommand??(this.commands.length&&!this._actionHandler&&!this._findCommand("help"))?(this._helpCommand===void 0&&this.helpCommand(void 0,void 0),this._helpCommand):null}hook(o,l){const D=["preSubcommand","preAction","postAction"];if(!D.includes(o))throw new Error(`Unexpected value for event passed to hook : '${o}'.
73
+ Expecting one of '${D.join("', '")}'`);return this._lifeCycleHooks[o]?this._lifeCycleHooks[o].push(l):this._lifeCycleHooks[o]=[l],this}exitOverride(o){return o?this._exitCallback=o:this._exitCallback=l=>{if(l.code!=="commander.executeSubCommandAsync")throw l},this}_exit(o,l,D){this._exitCallback&&this._exitCallback(new u(o,l,D)),s.exit(o)}action(o){const l=D=>{const f=this.registeredArguments.length,d=D.slice(0,f);return this._storeOptionsAsProperties?d[f]=this:d[f]=this.opts(),d.push(this),o.apply(this,d)};return this._actionHandler=l,this}createOption(o,l){return new y(o,l)}_callParseArg(o,l,D,f){try{return o.parseArg(l,D)}catch(d){if(d.code==="commander.invalidArgument"){const p=`${f} ${d.message}`;this.error(p,{exitCode:d.exitCode,code:d.code})}throw d}}_registerOption(o){const l=o.short&&this._findOption(o.short)||o.long&&this._findOption(o.long);if(l){const D=o.long&&this._findOption(o.long)?o.long:o.short;throw new Error(`Cannot add option '${o.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${D}'
74
+ - already used by option '${l.flags}'`)}this._initOptionGroup(o),this.options.push(o)}_registerCommand(o){const l=f=>[f.name()].concat(f.aliases()),D=l(o).find(f=>this._findCommand(f));if(D){const f=l(this._findCommand(D)).join("|"),d=l(o).join("|");throw new Error(`cannot add command '${d}' as already have command '${f}'`)}this._initCommandGroup(o),this.commands.push(o)}addOption(o){this._registerOption(o);const l=o.name(),D=o.attributeName();if(o.negate){const d=o.long.replace(/^--no-/,"--");this._findOption(d)||this.setOptionValueWithSource(D,o.defaultValue===void 0?!0:o.defaultValue,"default")}else o.defaultValue!==void 0&&this.setOptionValueWithSource(D,o.defaultValue,"default");const f=(d,p,_)=>{d==null&&o.presetArg!==void 0&&(d=o.presetArg);const O=this.getOptionValue(D);d!==null&&o.parseArg?d=this._callParseArg(o,d,O,p):d!==null&&o.variadic&&(d=o._concatValue(d,O)),d==null&&(o.negate?d=!1:o.isBoolean()||o.optional?d=!0:d=""),this.setOptionValueWithSource(D,d,_)};return this.on("option:"+l,d=>{const p=`error: option '${o.flags}' argument '${d}' is invalid.`;f(d,p,"cli")}),o.envVar&&this.on("optionEnv:"+l,d=>{const p=`error: option '${o.flags}' value '${d}' from env '${o.envVar}' is invalid.`;f(d,p,"env")}),this}_optionEx(o,l,D,f,d){if(typeof l=="object"&&l instanceof y)throw new Error("To add an Option object use addOption() instead of option() or requiredOption()");const p=this.createOption(l,D);if(p.makeOptionMandatory(!!o.mandatory),typeof f=="function")p.default(d).argParser(f);else if(f instanceof RegExp){const _=f;f=(O,B)=>{const x=_.exec(O);return x?x[0]:B},p.default(d).argParser(f)}else p.default(f);return this.addOption(p)}option(o,l,D,f){return this._optionEx({},o,l,D,f)}requiredOption(o,l,D,f){return this._optionEx({mandatory:!0},o,l,D,f)}combineFlagAndOptionalValue(o=!0){return this._combineFlagAndOptionalValue=!!o,this}allowUnknownOption(o=!0){return this._allowUnknownOption=!!o,this}allowExcessArguments(o=!0){return this._allowExcessArguments=!!o,this}enablePositionalOptions(o=!0){return this._enablePositionalOptions=!!o,this}passThroughOptions(o=!0){return this._passThroughOptions=!!o,this._checkForBrokenPassThrough(),this}_checkForBrokenPassThrough(){if(this.parent&&this._passThroughOptions&&!this.parent._enablePositionalOptions)throw new Error(`passThroughOptions cannot be used for '${this._name}' without turning on enablePositionalOptions for parent command(s)`)}storeOptionsAsProperties(o=!0){if(this.options.length)throw new Error("call .storeOptionsAsProperties() before adding options");if(Object.keys(this._optionValues).length)throw new Error("call .storeOptionsAsProperties() before setting option values");return this._storeOptionsAsProperties=!!o,this}getOptionValue(o){return this._storeOptionsAsProperties?this[o]:this._optionValues[o]}setOptionValue(o,l){return this.setOptionValueWithSource(o,l,void 0)}setOptionValueWithSource(o,l,D){return this._storeOptionsAsProperties?this[o]=l:this._optionValues[o]=l,this._optionValueSources[o]=D,this}getOptionValueSource(o){return this._optionValueSources[o]}getOptionValueSourceWithGlobals(o){let l;return this._getCommandAndAncestors().forEach(D=>{D.getOptionValueSource(o)!==void 0&&(l=D.getOptionValueSource(o))}),l}_prepareUserArgs(o,l){if(o!==void 0&&!Array.isArray(o))throw new Error("first parameter to parse must be array or undefined");if(l=l||{},o===void 0&&l.from===void 0){s.versions?.electron&&(l.from="electron");const f=s.execArgv??[];(f.includes("-e")||f.includes("--eval")||f.includes("-p")||f.includes("--print"))&&(l.from="eval")}o===void 0&&(o=s.argv),this.rawArgs=o.slice();let D;switch(l.from){case void 0:case"node":this._scriptPath=o[1],D=o.slice(2);break;case"electron":s.defaultApp?(this._scriptPath=o[1],D=o.slice(2)):D=o.slice(1);break;case"user":D=o.slice(0);break;case"eval":D=o.slice(1);break;default:throw new Error(`unexpected parse option { from: '${l.from}' }`)}return!this._name&&this._scriptPath&&this.nameFromFilename(this._scriptPath),this._name=this._name||"program",D}parse(o,l){this._prepareForParse();const D=this._prepareUserArgs(o,l);return this._parseCommand([],D),this}async parseAsync(o,l){this._prepareForParse();const D=this._prepareUserArgs(o,l);return await this._parseCommand([],D),this}_prepareForParse(){this._savedState===null?this.saveStateBeforeParse():this.restoreStateBeforeParse()}saveStateBeforeParse(){this._savedState={_name:this._name,_optionValues:{...this._optionValues},_optionValueSources:{...this._optionValueSources}}}restoreStateBeforeParse(){if(this._storeOptionsAsProperties)throw new Error(`Can not call parse again when storeOptionsAsProperties is true.
75
+ - either make a new Command for each call to parse, or stop storing options as properties`);this._name=this._savedState._name,this._scriptPath=null,this.rawArgs=[],this._optionValues={...this._savedState._optionValues},this._optionValueSources={...this._savedState._optionValueSources},this.args=[],this.processedArgs=[]}_checkForMissingExecutable(o,l,D){if(h.existsSync(o))return;const f=l?`searched for local subcommand relative to directory '${l}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",d=`'${o}' does not exist
76
+ - if '${D}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
72
77
  - if the default executable name is not suitable, use the executableFile option to supply a custom name or path
73
- - ${M}`;throw new Error(U)}else if(P.code==="EACCES")throw new Error(`'${F}' not executable`);if(!x)r.exit(1);else{const M=new u(1,"commander.executeSubCommandAsync","(error)");M.nestedError=P,x(M)}}),this.runningCommand=B}_dispatchSubcommand(o,l,f){const d=this._findCommand(o);d||this.help({error:!0});let D;return D=this._chainOrCallSubCommandHook(D,d,"preSubcommand"),D=this._chainOrCall(D,()=>{if(d._executableHandler)this._executeSubCommand(d,l.concat(f));else return d._parseCommand(l,f)}),D}_checkNumberOfArguments(){this._args.forEach((o,l)=>{o.required&&this.args[l]==null&&this.missingArgument(o.name())}),!(this._args.length>0&&this._args[this._args.length-1].variadic)&&this.args.length>this._args.length&&this._excessArguments(this.args)}_processArguments(){const o=(f,d,D)=>{let F=d;if(d!==null&&f.parseArg)try{F=f.parseArg(d,D)}catch(R){if(R.code==="commander.invalidArgument"){const B=`error: command-argument value '${d}' is invalid for argument '${f.name()}'. ${R.message}`;this.error(B,{exitCode:R.exitCode,code:R.code})}throw R}return F};this._checkNumberOfArguments();const l=[];this._args.forEach((f,d)=>{let D=f.defaultValue;f.variadic?d<this.args.length?(D=this.args.slice(d),f.parseArg&&(D=D.reduce((F,R)=>o(f,R,F),f.defaultValue))):D===void 0&&(D=[]):d<this.args.length&&(D=this.args[d],f.parseArg&&(D=o(f,D,f.defaultValue))),l[d]=D}),this.processedArgs=l}_chainOrCall(o,l){return o&&o.then&&typeof o.then=="function"?o.then(()=>l()):l()}_chainOrCallHooks(o,l){let f=o;const d=[];return S(this).reverse().filter(D=>D._lifeCycleHooks[l]!==void 0).forEach(D=>{D._lifeCycleHooks[l].forEach(F=>{d.push({hookedCommand:D,callback:F})})}),l==="postAction"&&d.reverse(),d.forEach(D=>{f=this._chainOrCall(f,()=>D.callback(D.hookedCommand,this))}),f}_chainOrCallSubCommandHook(o,l,f){let d=o;return this._lifeCycleHooks[f]!==void 0&&this._lifeCycleHooks[f].forEach(D=>{d=this._chainOrCall(d,()=>D(this,l))}),d}_parseCommand(o,l){const f=this.parseOptions(l);if(this._parseOptionsEnv(),this._parseOptionsImplied(),o=o.concat(f.operands),l=f.unknown,this.args=o.concat(l),o&&this._findCommand(o[0]))return this._dispatchSubcommand(o[0],o.slice(1),l);if(this._hasImplicitHelpCommand()&&o[0]===this._helpCommandName)return o.length===1&&this.help(),this._dispatchSubcommand(o[1],[],[this._helpLongFlag]);if(this._defaultCommandName)return b(this,l),this._dispatchSubcommand(this._defaultCommandName,o,l);this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName&&this.help({error:!0}),b(this,f.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();const d=()=>{f.unknown.length>0&&this.unknownOption(f.unknown[0])},D=`command:${this.name()}`;if(this._actionHandler){d(),this._processArguments();let F;return F=this._chainOrCallHooks(F,"preAction"),F=this._chainOrCall(F,()=>this._actionHandler(this.processedArgs)),this.parent&&(F=this._chainOrCall(F,()=>{this.parent.emit(D,o,l)})),F=this._chainOrCallHooks(F,"postAction"),F}if(this.parent&&this.parent.listenerCount(D))d(),this._processArguments(),this.parent.emit(D,o,l);else if(o.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",o,l);this.listenerCount("command:*")?this.emit("command:*",o,l):this.commands.length?this.unknownCommand():(d(),this._processArguments())}else this.commands.length?(d(),this.help({error:!0})):(d(),this._processArguments())}_findCommand(o){if(o)return this.commands.find(l=>l._name===o||l._aliases.includes(o))}_findOption(o){return this.options.find(l=>l.is(o))}_checkForMissingMandatoryOptions(){for(let o=this;o;o=o.parent)o.options.forEach(l=>{l.mandatory&&o.getOptionValue(l.attributeName())===void 0&&o.missingMandatoryOptionValue(l)})}_checkForConflictingLocalOptions(){const o=this.options.filter(f=>{const d=f.attributeName();return this.getOptionValue(d)===void 0?!1:this.getOptionValueSource(d)!=="default"});o.filter(f=>f.conflictsWith.length>0).forEach(f=>{const d=o.find(D=>f.conflictsWith.includes(D.attributeName()));d&&this._conflictingOption(f,d)})}_checkForConflictingOptions(){for(let o=this;o;o=o.parent)o._checkForConflictingLocalOptions()}parseOptions(o){const l=[],f=[];let d=l;const D=o.slice();function F(B){return B.length>1&&B[0]==="-"}let R=null;for(;D.length;){const B=D.shift();if(B==="--"){d===f&&d.push(B),d.push(...D);break}if(R&&!F(B)){this.emit(`option:${R.name()}`,B);continue}if(R=null,F(B)){const x=this._findOption(B);if(x){if(x.required){const P=D.shift();P===void 0&&this.optionMissingArgument(x),this.emit(`option:${x.name()}`,P)}else if(x.optional){let P=null;D.length>0&&!F(D[0])&&(P=D.shift()),this.emit(`option:${x.name()}`,P)}else this.emit(`option:${x.name()}`);R=x.variadic?x:null;continue}}if(B.length>2&&B[0]==="-"&&B[1]!=="-"){const x=this._findOption(`-${B[1]}`);if(x){x.required||x.optional&&this._combineFlagAndOptionalValue?this.emit(`option:${x.name()}`,B.slice(2)):(this.emit(`option:${x.name()}`),D.unshift(`-${B.slice(2)}`));continue}}if(/^--[^=]+=/.test(B)){const x=B.indexOf("="),P=this._findOption(B.slice(0,x));if(P&&(P.required||P.optional)){this.emit(`option:${P.name()}`,B.slice(x+1));continue}}if(F(B)&&(d=f),(this._enablePositionalOptions||this._passThroughOptions)&&l.length===0&&f.length===0){if(this._findCommand(B)){l.push(B),D.length>0&&f.push(...D);break}else if(B===this._helpCommandName&&this._hasImplicitHelpCommand()){l.push(B),D.length>0&&l.push(...D);break}else if(this._defaultCommandName){f.push(B),D.length>0&&f.push(...D);break}}if(this._passThroughOptions){d.push(B),D.length>0&&d.push(...D);break}d.push(B)}return{operands:l,unknown:f}}opts(){if(this._storeOptionsAsProperties){const o={},l=this.options.length;for(let f=0;f<l;f++){const d=this.options[f].attributeName();o[d]=d===this._versionOptionName?this._version:this[d]}return o}return this._optionValues}optsWithGlobals(){return S(this).reduce((o,l)=>Object.assign(o,l.opts()),{})}error(o,l){this._outputConfiguration.outputError(`${o}
78
+ - ${f}`;throw new Error(d)}_executeSubCommand(o,l){l=l.slice();let D=!1;const f=[".js",".ts",".tsx",".mjs",".cjs"];function d(x,P){const W=r.resolve(x,P);if(h.existsSync(W))return W;if(f.includes(r.extname(P)))return;const j=f.find(U=>h.existsSync(`${W}${U}`));if(j)return`${W}${j}`}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let p=o._executableFile||`${this._name}-${o._name}`,_=this._executableDir||"";if(this._scriptPath){let x;try{x=h.realpathSync(this._scriptPath)}catch{x=this._scriptPath}_=r.resolve(r.dirname(x),_)}if(_){let x=d(_,p);if(!x&&!o._executableFile&&this._scriptPath){const P=r.basename(this._scriptPath,r.extname(this._scriptPath));P!==this._name&&(x=d(_,`${P}-${o._name}`))}p=x||p}D=f.includes(r.extname(p));let O;s.platform!=="win32"?D?(l.unshift(p),l=b(s.execArgv).concat(l),O=e.spawn(s.argv[0],l,{stdio:"inherit"})):O=e.spawn(p,l,{stdio:"inherit"}):(this._checkForMissingExecutable(p,_,o._name),l.unshift(p),l=b(s.execArgv).concat(l),O=e.spawn(s.execPath,l,{stdio:"inherit"})),O.killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(P=>{s.on(P,()=>{O.killed===!1&&O.exitCode===null&&O.kill(P)})});const B=this._exitCallback;O.on("close",x=>{x=x??1,B?B(new u(x,"commander.executeSubCommandAsync","(close)")):s.exit(x)}),O.on("error",x=>{if(x.code==="ENOENT")this._checkForMissingExecutable(p,_,o._name);else if(x.code==="EACCES")throw new Error(`'${p}' not executable`);if(!B)s.exit(1);else{const P=new u(1,"commander.executeSubCommandAsync","(error)");P.nestedError=x,B(P)}}),this.runningCommand=O}_dispatchSubcommand(o,l,D){const f=this._findCommand(o);f||this.help({error:!0}),f._prepareForParse();let d;return d=this._chainOrCallSubCommandHook(d,f,"preSubcommand"),d=this._chainOrCall(d,()=>{if(f._executableHandler)this._executeSubCommand(f,l.concat(D));else return f._parseCommand(l,D)}),d}_dispatchHelpCommand(o){o||this.help();const l=this._findCommand(o);return l&&!l._executableHandler&&l.help(),this._dispatchSubcommand(o,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){this.registeredArguments.forEach((o,l)=>{o.required&&this.args[l]==null&&this.missingArgument(o.name())}),!(this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic)&&this.args.length>this.registeredArguments.length&&this._excessArguments(this.args)}_processArguments(){const o=(D,f,d)=>{let p=f;if(f!==null&&D.parseArg){const _=`error: command-argument value '${f}' is invalid for argument '${D.name()}'.`;p=this._callParseArg(D,f,d,_)}return p};this._checkNumberOfArguments();const l=[];this.registeredArguments.forEach((D,f)=>{let d=D.defaultValue;D.variadic?f<this.args.length?(d=this.args.slice(f),D.parseArg&&(d=d.reduce((p,_)=>o(D,_,p),D.defaultValue))):d===void 0&&(d=[]):f<this.args.length&&(d=this.args[f],D.parseArg&&(d=o(D,d,D.defaultValue))),l[f]=d}),this.processedArgs=l}_chainOrCall(o,l){return o&&o.then&&typeof o.then=="function"?o.then(()=>l()):l()}_chainOrCallHooks(o,l){let D=o;const f=[];return this._getCommandAndAncestors().reverse().filter(d=>d._lifeCycleHooks[l]!==void 0).forEach(d=>{d._lifeCycleHooks[l].forEach(p=>{f.push({hookedCommand:d,callback:p})})}),l==="postAction"&&f.reverse(),f.forEach(d=>{D=this._chainOrCall(D,()=>d.callback(d.hookedCommand,this))}),D}_chainOrCallSubCommandHook(o,l,D){let f=o;return this._lifeCycleHooks[D]!==void 0&&this._lifeCycleHooks[D].forEach(d=>{f=this._chainOrCall(f,()=>d(this,l))}),f}_parseCommand(o,l){const D=this.parseOptions(l);if(this._parseOptionsEnv(),this._parseOptionsImplied(),o=o.concat(D.operands),l=D.unknown,this.args=o.concat(l),o&&this._findCommand(o[0]))return this._dispatchSubcommand(o[0],o.slice(1),l);if(this._getHelpCommand()&&o[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(o[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(l),this._dispatchSubcommand(this._defaultCommandName,o,l);this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName&&this.help({error:!0}),this._outputHelpIfRequested(D.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();const f=()=>{D.unknown.length>0&&this.unknownOption(D.unknown[0])},d=`command:${this.name()}`;if(this._actionHandler){f(),this._processArguments();let p;return p=this._chainOrCallHooks(p,"preAction"),p=this._chainOrCall(p,()=>this._actionHandler(this.processedArgs)),this.parent&&(p=this._chainOrCall(p,()=>{this.parent.emit(d,o,l)})),p=this._chainOrCallHooks(p,"postAction"),p}if(this.parent&&this.parent.listenerCount(d))f(),this._processArguments(),this.parent.emit(d,o,l);else if(o.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",o,l);this.listenerCount("command:*")?this.emit("command:*",o,l):this.commands.length?this.unknownCommand():(f(),this._processArguments())}else this.commands.length?(f(),this.help({error:!0})):(f(),this._processArguments())}_findCommand(o){if(o)return this.commands.find(l=>l._name===o||l._aliases.includes(o))}_findOption(o){return this.options.find(l=>l.is(o))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach(o=>{o.options.forEach(l=>{l.mandatory&&o.getOptionValue(l.attributeName())===void 0&&o.missingMandatoryOptionValue(l)})})}_checkForConflictingLocalOptions(){const o=this.options.filter(D=>{const f=D.attributeName();return this.getOptionValue(f)===void 0?!1:this.getOptionValueSource(f)!=="default"});o.filter(D=>D.conflictsWith.length>0).forEach(D=>{const f=o.find(d=>D.conflictsWith.includes(d.attributeName()));f&&this._conflictingOption(D,f)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(o=>{o._checkForConflictingLocalOptions()})}parseOptions(o){const l=[],D=[];let f=l;const d=o.slice();function p(B){return B.length>1&&B[0]==="-"}const _=B=>/^-\d*\.?\d+(e[+-]?\d+)?$/.test(B)?!this._getCommandAndAncestors().some(x=>x.options.map(P=>P.short).some(P=>/^-\d$/.test(P))):!1;let O=null;for(;d.length;){const B=d.shift();if(B==="--"){f===D&&f.push(B),f.push(...d);break}if(O&&(!p(B)||_(B))){this.emit(`option:${O.name()}`,B);continue}if(O=null,p(B)){const x=this._findOption(B);if(x){if(x.required){const P=d.shift();P===void 0&&this.optionMissingArgument(x),this.emit(`option:${x.name()}`,P)}else if(x.optional){let P=null;d.length>0&&(!p(d[0])||_(d[0]))&&(P=d.shift()),this.emit(`option:${x.name()}`,P)}else this.emit(`option:${x.name()}`);O=x.variadic?x:null;continue}}if(B.length>2&&B[0]==="-"&&B[1]!=="-"){const x=this._findOption(`-${B[1]}`);if(x){x.required||x.optional&&this._combineFlagAndOptionalValue?this.emit(`option:${x.name()}`,B.slice(2)):(this.emit(`option:${x.name()}`),d.unshift(`-${B.slice(2)}`));continue}}if(/^--[^=]+=/.test(B)){const x=B.indexOf("="),P=this._findOption(B.slice(0,x));if(P&&(P.required||P.optional)){this.emit(`option:${P.name()}`,B.slice(x+1));continue}}if(f===l&&p(B)&&!(this.commands.length===0&&_(B))&&(f=D),(this._enablePositionalOptions||this._passThroughOptions)&&l.length===0&&D.length===0){if(this._findCommand(B)){l.push(B),d.length>0&&D.push(...d);break}else if(this._getHelpCommand()&&B===this._getHelpCommand().name()){l.push(B),d.length>0&&l.push(...d);break}else if(this._defaultCommandName){D.push(B),d.length>0&&D.push(...d);break}}if(this._passThroughOptions){f.push(B),d.length>0&&f.push(...d);break}f.push(B)}return{operands:l,unknown:D}}opts(){if(this._storeOptionsAsProperties){const o={},l=this.options.length;for(let D=0;D<l;D++){const f=this.options[D].attributeName();o[f]=f===this._versionOptionName?this._version:this[f]}return o}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce((o,l)=>Object.assign(o,l.opts()),{})}error(o,l){this._outputConfiguration.outputError(`${o}
74
79
  `,this._outputConfiguration.writeErr),typeof this._showHelpAfterError=="string"?this._outputConfiguration.writeErr(`${this._showHelpAfterError}
75
80
  `):this._showHelpAfterError&&(this._outputConfiguration.writeErr(`
76
- `),this.outputHelp({error:!0}));const f=l||{},d=f.exitCode||1,D=f.code||"commander.error";this._exit(d,D,o)}_parseOptionsEnv(){this.options.forEach(o=>{if(o.envVar&&o.envVar in r.env){const l=o.attributeName();(this.getOptionValue(l)===void 0||["default","config","env"].includes(this.getOptionValueSource(l)))&&(o.required||o.optional?this.emit(`optionEnv:${o.name()}`,r.env[o.envVar]):this.emit(`optionEnv:${o.name()}`))}})}_parseOptionsImplied(){const o=new p(this.options),l=f=>this.getOptionValue(f)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(f));this.options.filter(f=>f.implied!==void 0&&l(f.attributeName())&&o.valueFromOption(this.getOptionValue(f.attributeName()),f)).forEach(f=>{Object.keys(f.implied).filter(d=>!l(d)).forEach(d=>{this.setOptionValueWithSource(d,f.implied[d],"implied")})})}missingArgument(o){const l=`error: missing required argument '${o}'`;this.error(l,{code:"commander.missingArgument"})}optionMissingArgument(o){const l=`error: option '${o.flags}' argument missing`;this.error(l,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(o){const l=`error: required option '${o.flags}' not specified`;this.error(l,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(o,l){const f=F=>{const R=F.attributeName(),B=this.getOptionValue(R),x=this.options.find(M=>M.negate&&R===M.attributeName()),P=this.options.find(M=>!M.negate&&R===M.attributeName());return x&&(x.presetArg===void 0&&B===!1||x.presetArg!==void 0&&B===x.presetArg)?x:P||F},d=F=>{const R=f(F),B=R.attributeName();return this.getOptionValueSource(B)==="env"?`environment variable '${R.envVar}'`:`option '${R.flags}'`},D=`error: ${d(o)} cannot be used with ${d(l)}`;this.error(D,{code:"commander.conflictingOption"})}unknownOption(o){if(this._allowUnknownOption)return;let l="";if(o.startsWith("--")&&this._showSuggestionAfterError){let d=[],D=this;do{const F=D.createHelp().visibleOptions(D).filter(R=>R.long).map(R=>R.long);d=d.concat(F),D=D.parent}while(D&&!D._enablePositionalOptions);l=C(o,d)}const f=`error: unknown option '${o}'${l}`;this.error(f,{code:"commander.unknownOption"})}_excessArguments(o){if(this._allowExcessArguments)return;const l=this._args.length,f=l===1?"":"s",D=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${l} argument${f} but got ${o.length}.`;this.error(D,{code:"commander.excessArguments"})}unknownCommand(){const o=this.args[0];let l="";if(this._showSuggestionAfterError){const d=[];this.createHelp().visibleCommands(this).forEach(D=>{d.push(D.name()),D.alias()&&d.push(D.alias())}),l=C(o,d)}const f=`error: unknown command '${o}'${l}`;this.error(f,{code:"commander.unknownCommand"})}version(o,l,f){if(o===void 0)return this._version;this._version=o,l=l||"-V, --version",f=f||"output the version number";const d=this.createOption(l,f);return this._versionOptionName=d.attributeName(),this.options.push(d),this.on("option:"+d.name(),()=>{this._outputConfiguration.writeOut(`${o}
77
- `),this._exit(0,"commander.version",o)}),this}description(o,l){return o===void 0&&l===void 0?this._description:(this._description=o,l&&(this._argsDescription=l),this)}summary(o){return o===void 0?this._summary:(this._summary=o,this)}alias(o){if(o===void 0)return this._aliases[0];let l=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler&&(l=this.commands[this.commands.length-1]),o===l._name)throw new Error("Command alias can't be the same as its name");return l._aliases.push(o),this}aliases(o){return o===void 0?this._aliases:(o.forEach(l=>this.alias(l)),this)}usage(o){if(o===void 0){if(this._usage)return this._usage;const l=this._args.map(f=>e(f));return[].concat(this.options.length||this._hasHelpOption?"[options]":[],this.commands.length?"[command]":[],this._args.length?l:[]).join(" ")}return this._usage=o,this}name(o){return o===void 0?this._name:(this._name=o,this)}nameFromFilename(o){return this._name=i.basename(o,i.extname(o)),this}executableDir(o){return o===void 0?this._executableDir:(this._executableDir=o,this)}helpInformation(o){const l=this.createHelp();return l.helpWidth===void 0&&(l.helpWidth=o&&o.error?this._outputConfiguration.getErrHelpWidth():this._outputConfiguration.getOutHelpWidth()),l.formatHelp(this,l)}_getHelpContext(o){o=o||{};const l={error:!!o.error};let f;return l.error?f=d=>this._outputConfiguration.writeErr(d):f=d=>this._outputConfiguration.writeOut(d),l.write=o.write||f,l.command=this,l}outputHelp(o){let l;typeof o=="function"&&(l=o,o=void 0);const f=this._getHelpContext(o);S(this).reverse().forEach(D=>D.emit("beforeAllHelp",f)),this.emit("beforeHelp",f);let d=this.helpInformation(f);if(l&&(d=l(d),typeof d!="string"&&!Buffer.isBuffer(d)))throw new Error("outputHelp callback must return a string or a Buffer");f.write(d),this.emit(this._helpLongFlag),this.emit("afterHelp",f),S(this).forEach(D=>D.emit("afterAllHelp",f))}helpOption(o,l){if(typeof o=="boolean")return this._hasHelpOption=o,this;this._helpFlags=o||this._helpFlags,this._helpDescription=l||this._helpDescription;const f=y(this._helpFlags);return this._helpShortFlag=f.shortFlag,this._helpLongFlag=f.longFlag,this}help(o){this.outputHelp(o);let l=r.exitCode||0;l===0&&o&&typeof o!="function"&&o.error&&(l=1),this._exit(l,"commander.help","(outputHelp)")}addHelpText(o,l){const f=["beforeAll","before","after","afterAll"];if(!f.includes(o))throw new Error(`Unexpected value for position to addHelpText.
78
- Expecting one of '${f.join("', '")}'`);const d=`${o}Help`;return this.on(d,D=>{let F;typeof l=="function"?F=l({error:D.error,command:D.command}):F=l,F&&D.write(`${F}
79
- `)}),this}}function b(v,o){v._hasHelpOption&&o.find(f=>f===v._helpLongFlag||f===v._helpShortFlag)&&(v.outputHelp(),v._exit(0,"commander.helpDisplayed","(outputHelp)"))}function A(v){return v.map(o=>{if(!o.startsWith("--inspect"))return o;let l,f="127.0.0.1",d="9229",D;return(D=o.match(/^(--inspect(-brk)?)$/))!==null?l=D[1]:(D=o.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null?(l=D[1],/^\d+$/.test(D[3])?d=D[3]:f=D[3]):(D=o.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(l=D[1],f=D[3],d=D[4]),l&&d!=="0"?`${l}=${f}:${parseInt(d)+1}`:o})}function S(v){const o=[];for(let l=v;l;l=l.parent)o.push(l);return o}return At.Command=w,At}var Ei;function jn(){return Ei||(Ei=1,function(s,t){const{Argument:i}=vt(),{Command:n}=kn(),{CommanderError:r,InvalidArgumentError:a}=it(),{Help:e}=Di(),{Option:u}=di();t=s.exports=new n,t.program=t,t.Argument=i,t.Command=n,t.CommanderError=r,t.Help=e,t.InvalidArgumentError=a,t.InvalidOptionArgumentError=a,t.Option=u}(et,et.exports)),et.exports}var Hn=jn();const Un=ks(Hn),{program:Po,createCommand:Mo,createArgument:ko,createOption:jo,CommanderError:Ho,InvalidArgumentError:Uo,InvalidOptionArgumentError:zo,Command:zn,Argument:Go,Option:Gn,Help:qo}=Un,qn="0.27.3";var Ie={};class Wn extends Error{method;path;expected;value;fake_expected_typed_value_;constructor(t){super(t.message||`Error on ${t.method}(): invalid type${t.path?` on ${t.path}`:""}, expect to be ${t.expected}`);const i=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,i):this.__proto__=i,this.method=t.method,this.path=t.path,this.expected=t.expected,this.value=t.value}}const Vn={__proto__:null,TypeGuardError:Wn},Kn=Kr(Vn);var gi;function Yn(){if(gi)return Ie;gi=1,Object.defineProperty(Ie,"__esModule",{value:!0}),Ie._assertGuard=void 0;const s=Kn,t=(i,n,r)=>{if(i===!0)throw r?r(n):new s.TypeGuardError(n);return!1};return Ie._assertGuard=t,Ie}var ne=Yn();const Zn=s=>({start:Q.hrtime.bigint(),command:s.map(t=>Xn(Tr(t))).join(" "),state:{stdout:"",stderr:"",output:""}}),Xn=s=>/[^\w./-]/.test(s)?`'${s.replaceAll("'","'\\''")}'`:s,Jn=({stdin:s,stdout:t,stderr:i,stdio:n=[s,t,i],env:r,preferLocal:a,cwd:e=".",...u})=>{const h=e instanceof URL?Mr(e):de.resolve(e),m=r?{...Q.env,...r}:void 0,y=n[0]?.string;return{...u,input:y,stdio:y===void 0?n:["pipe",...n.slice(1)],env:a?Qn(m??Q.env,h):m,cwd:h}},Qn=({Path:s="",PATH:t=s,...i},n)=>{const r=t.split(de.delimiter),a=Ci([],de.resolve(n)).map(e=>de.join(e,"node_modules/.bin")).filter(e=>!r.includes(e));return{...i,PATH:[...a,t].filter(Boolean).join(de.delimiter)}},Ci=(s,t)=>s.at(-1)===t?s:Ci([...s,t],de.resolve(t,"..")),eu=async(s,t,i)=>await tu(s,i)?[Rt(s),t.map(n=>uu(n)),{...i,shell:!0}]:[s,t,i],tu=async(s,{shell:t,cwd:i,env:n=Q.env})=>Q.platform==="win32"&&!t&&!await su(s,i,n),su=(s,t,{Path:i="",PATH:n=i})=>yi.some(r=>s.toLowerCase().endsWith(r))||nu(s,t,n),iu={},Fi=s=>(...t)=>iu[t.join("\0")]??=s(...t),ru=Fi(Oe.access),nu=Fi(async(s,t,i)=>{const n=i.split(de.delimiter).filter(Boolean).map(r=>r.replace(/^"(.*)"$/,"$1"));try{await Promise.any([t,...n].flatMap(r=>yi.map(a=>ru(`${de.resolve(r,s)}${a}`))))}catch{return!1}return!0}),yi=[".exe",".com"],uu=s=>Rt(Rt(`"${s.replaceAll(/(\\*)"/g,'$1$1\\"').replace(/(\\*)$/,"$1$1")}"`)),Rt=s=>s.replaceAll(/([()\][%!^"`<>&|;, *?])/g,"^$1"),ou=async(s,{input:t},i)=>{const n=await s;t!==void 0&&n.stdin.end(t);const r=Is(n,"close");try{return await Promise.race([r,...n.stdio.filter(Boolean).map(a=>au(a))]),hu(i,wi(n)),_i(i)}catch(a){throw await Promise.allSettled([r]),bi(a,n,i)}},au=async s=>{for await(const[t]of jr(s,"error"))if(!["ERR_STREAM_PREMATURE_CLOSE","EPIPE"].includes(t?.code))throw t},hu=({command:s},{exitCode:t,signalName:i})=>{if(i!==void 0)throw new Re(`Command was terminated with ${i}: ${s}`);if(t!==void 0)throw new Re(`Command failed with exit code ${t}: ${s}`)},bi=(s,t,i)=>Object.assign(lu(s,i),wi(t),_i(i)),lu=(s,{command:t})=>s instanceof Re?s:new Re(`Command failed: ${t}`,{cause:s});class Re extends Error{name="SubprocessError"}const wi=({exitCode:s,signalCode:t})=>({...s<1?{}:{exitCode:s},...t===null?{}:{signalName:t}}),_i=({state:{stdout:s,stderr:t,output:i},command:n,start:r})=>({stdout:Bt(s),stderr:Bt(t),output:Bt(i),command:n,durationMs:Number(Q.hrtime.bigint()-r)/1e6}),Bt=s=>s.at(-1)===`
80
- `?s.slice(0,s.at(-2)==="\r"?-2:-1):s,cu=async(s,t,i,n)=>{try{["node","node.exe"].includes(s.toLowerCase())&&(s=Q.execPath,t=[...Q.execArgv.filter(a=>!a.startsWith("--inspect")),...t]),[s,t,i]=await eu(s,t,i),[s,t,i]=Du(s,t,i);const r=kr(s,t,i);return vi(r.stdout,n,"stdout"),vi(r.stderr,n,"stderr"),r.once("error",()=>{}),await Is(r,"spawn"),r}catch(r){throw bi(r,{},n)}},Du=(s,t,i)=>i.shell&&t.length>0?[[s,...t].join(" "),[],i]:[s,t,i],vi=(s,{state:t},i)=>{s&&(s.setEncoding("utf8"),t.isIterating||(t.isIterating=!1,s.on("data",n=>{t[i]+=n,t.output+=n})))},fu=async s=>{const[[t,i]]=await Promise.all([Promise.allSettled(s),du(s)]);if(i.reason)throw i.reason.pipedFrom=t.reason??t.value,i.reason;if(t.reason)throw t.reason;return{...i.value,pipedFrom:t.value}},du=async s=>{try{const[{stdout:t},{stdin:i}]=await Promise.all(s.map(({nodeChildProcess:n})=>n));if(i===null)throw new Error('The "stdin" option must be set on the first "spawn()" call in the pipeline.');if(t===null)throw new Error('The "stdout" option must be set on the last "spawn()" call in the pipeline.');Hr(t,i).catch(()=>{})}catch(t){throw await Promise.allSettled(s.map(({nodeChildProcess:i})=>pu(i))),t}},pu=async s=>{const{stdin:t}=await s;t.end()},Ai=async function*(s,{state:t},i){if(t.isIterating===!1)throw new Error(`The subprocess must be iterated right away, for example:
81
- for await (const line of spawn(...)) { ... }`);t.isIterating=!0;try{const{[i]:n}=await s.nodeChildProcess;if(!n)return;yield*Ur.createInterface({input:n})}finally{await s}},mu=async function*(...s){try{let t=[];for(;s.length>0;){t=s.map((e,u)=>t[u]??Eu(e));const[{value:i,done:n},r]=await Promise.race(t.map((e,u)=>Promise.all([e,u]))),[a]=s.splice(r,1);t.splice(r,1),n||(s.push(a),yield i)}}finally{await Promise.all(s.map(t=>t.return()))}},Eu=async s=>{try{return await s.next()}catch(t){await s.throw(t)}};function xt(s,t,i,n){const[r=[],a={}]=Array.isArray(t)?[t,i]:[[],t],e=Zn([s,...r]),u=Jn(a),h=cu(s,r,u,e);let m=ou(h,u,e);Object.assign(m,{nodeChildProcess:h}),m=n?fu([n,m]):m;const y=Ai(m,e,"stdout"),p=Ai(m,e,"stderr");return Object.assign(m,{nodeChildProcess:h,stdout:y,stderr:p,[Symbol.asyncIterator]:()=>mu(y,p),pipe:(C,w,b)=>xt(C,w,b,m)})}function Si(s){return s.split("-").map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join("")}async function Tt(s){try{return await(await import("prettier")).format(s,{parser:"typescript"})}catch{return s}}const gu="https://raw.githubusercontent.com/wrtnlabs/connectors/refs/heads/main/connectors-list.json",$t="@wrtnlabs/connector-";function Cu(s){return`${$t}${s}`}function Fu(s){return s.replace($t,"")}async function yu(){const s=await(await fetch(gu)).json();return(()=>{const t=u=>Array.isArray(u.connectors)&&u.connectors.every(h=>typeof h=="object"&&h!==null&&i(h))&&typeof u.version=="string",i=u=>typeof u.name=="string"&&RegExp(/^@wrtnlabs\/connector\x2d(.*)/).test(u.name)&&Array.isArray(u.envList)&&u.envList.every(h=>typeof h=="string"),n=(u,h,m=!0)=>((Array.isArray(u.connectors)||ne._assertGuard(m,{method:"typia.assert",path:h+".connectors",expected:"Array<UnwrapTaggedConnectorInfo>",value:u.connectors},e))&&u.connectors.every((y,p)=>(typeof y=="object"&&y!==null||ne._assertGuard(m,{method:"typia.assert",path:h+".connectors["+p+"]",expected:"UnwrapTaggedConnectorInfo",value:y},e))&&r(y,h+".connectors["+p+"]",m)||ne._assertGuard(m,{method:"typia.assert",path:h+".connectors["+p+"]",expected:"UnwrapTaggedConnectorInfo",value:y},e))||ne._assertGuard(m,{method:"typia.assert",path:h+".connectors",expected:"Array<UnwrapTaggedConnectorInfo>",value:u.connectors},e))&&(typeof u.version=="string"||ne._assertGuard(m,{method:"typia.assert",path:h+".version",expected:"string",value:u.version},e)),r=(u,h,m=!0)=>(typeof u.name=="string"&&RegExp(/^@wrtnlabs\/connector\x2d(.*)/).test(u.name)||ne._assertGuard(m,{method:"typia.assert",path:h+".name",expected:"`@wrtnlabs/connector-${string}`",value:u.name},e))&&((Array.isArray(u.envList)||ne._assertGuard(m,{method:"typia.assert",path:h+".envList",expected:"Array<string>",value:u.envList},e))&&u.envList.every((y,p)=>typeof y=="string"||ne._assertGuard(m,{method:"typia.assert",path:h+".envList["+p+"]",expected:"string",value:y},e))||ne._assertGuard(m,{method:"typia.assert",path:h+".envList",expected:"Array<string>",value:u.envList},e)),a=u=>typeof u=="object"&&u!==null&&t(u);let e;return(u,h)=>(a(u)===!1&&(e=h,((m,y,p=!0)=>(typeof m=="object"&&m!==null||ne._assertGuard(!0,{method:"typia.assert",path:y+"",expected:"UnwrapTaggedConnectors",value:m},e))&&n(m,y+"",!0)||ne._assertGuard(!0,{method:"typia.assert",path:y+"",expected:"UnwrapTaggedConnectors",value:m},e))(u,"$input",!0)),u)})()(s)}async function bu(){return(await yu()).connectors.map(({name:s,envList:t})=>{const i=Fu(s),n=i.replace("-"," ").toUpperCase();return{packageName:s,serviceName:i,displayName:n,envList:t}})}function Nt(s){return s.map(t=>{const i=Si(t);return`{
82
- name: "${i} Connector",
81
+ `),this.outputHelp({error:!0}));const D=l||{},f=D.exitCode||1,d=D.code||"commander.error";this._exit(f,d,o)}_parseOptionsEnv(){this.options.forEach(o=>{if(o.envVar&&o.envVar in s.env){const l=o.attributeName();(this.getOptionValue(l)===void 0||["default","config","env"].includes(this.getOptionValueSource(l)))&&(o.required||o.optional?this.emit(`optionEnv:${o.name()}`,s.env[o.envVar]):this.emit(`optionEnv:${o.name()}`))}})}_parseOptionsImplied(){const o=new g(this.options),l=D=>this.getOptionValue(D)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(D));this.options.filter(D=>D.implied!==void 0&&l(D.attributeName())&&o.valueFromOption(this.getOptionValue(D.attributeName()),D)).forEach(D=>{Object.keys(D.implied).filter(f=>!l(f)).forEach(f=>{this.setOptionValueWithSource(f,D.implied[f],"implied")})})}missingArgument(o){const l=`error: missing required argument '${o}'`;this.error(l,{code:"commander.missingArgument"})}optionMissingArgument(o){const l=`error: option '${o.flags}' argument missing`;this.error(l,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(o){const l=`error: required option '${o.flags}' not specified`;this.error(l,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(o,l){const D=p=>{const _=p.attributeName(),O=this.getOptionValue(_),B=this.options.find(P=>P.negate&&_===P.attributeName()),x=this.options.find(P=>!P.negate&&_===P.attributeName());return B&&(B.presetArg===void 0&&O===!1||B.presetArg!==void 0&&O===B.presetArg)?B:x||p},f=p=>{const _=D(p),O=_.attributeName();return this.getOptionValueSource(O)==="env"?`environment variable '${_.envVar}'`:`option '${_.flags}'`},d=`error: ${f(o)} cannot be used with ${f(l)}`;this.error(d,{code:"commander.conflictingOption"})}unknownOption(o){if(this._allowUnknownOption)return;let l="";if(o.startsWith("--")&&this._showSuggestionAfterError){let f=[],d=this;do{const p=d.createHelp().visibleOptions(d).filter(_=>_.long).map(_=>_.long);f=f.concat(p),d=d.parent}while(d&&!d._enablePositionalOptions);l=F(o,f)}const D=`error: unknown option '${o}'${l}`;this.error(D,{code:"commander.unknownOption"})}_excessArguments(o){if(this._allowExcessArguments)return;const l=this.registeredArguments.length,D=l===1?"":"s",d=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${l} argument${D} but got ${o.length}.`;this.error(d,{code:"commander.excessArguments"})}unknownCommand(){const o=this.args[0];let l="";if(this._showSuggestionAfterError){const f=[];this.createHelp().visibleCommands(this).forEach(d=>{f.push(d.name()),d.alias()&&f.push(d.alias())}),l=F(o,f)}const D=`error: unknown command '${o}'${l}`;this.error(D,{code:"commander.unknownCommand"})}version(o,l,D){if(o===void 0)return this._version;this._version=o,l=l||"-V, --version",D=D||"output the version number";const f=this.createOption(l,D);return this._versionOptionName=f.attributeName(),this._registerOption(f),this.on("option:"+f.name(),()=>{this._outputConfiguration.writeOut(`${o}
82
+ `),this._exit(0,"commander.version",o)}),this}description(o,l){return o===void 0&&l===void 0?this._description:(this._description=o,l&&(this._argsDescription=l),this)}summary(o){return o===void 0?this._summary:(this._summary=o,this)}alias(o){if(o===void 0)return this._aliases[0];let l=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler&&(l=this.commands[this.commands.length-1]),o===l._name)throw new Error("Command alias can't be the same as its name");const D=this.parent?._findCommand(o);if(D){const f=[D.name()].concat(D.aliases()).join("|");throw new Error(`cannot add alias '${o}' to command '${this.name()}' as already have command '${f}'`)}return l._aliases.push(o),this}aliases(o){return o===void 0?this._aliases:(o.forEach(l=>this.alias(l)),this)}usage(o){if(o===void 0){if(this._usage)return this._usage;const l=this.registeredArguments.map(D=>t(D));return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?l:[]).join(" ")}return this._usage=o,this}name(o){return o===void 0?this._name:(this._name=o,this)}helpGroup(o){return o===void 0?this._helpGroupHeading??"":(this._helpGroupHeading=o,this)}commandsGroup(o){return o===void 0?this._defaultCommandGroup??"":(this._defaultCommandGroup=o,this)}optionsGroup(o){return o===void 0?this._defaultOptionGroup??"":(this._defaultOptionGroup=o,this)}_initOptionGroup(o){this._defaultOptionGroup&&!o.helpGroupHeading&&o.helpGroup(this._defaultOptionGroup)}_initCommandGroup(o){this._defaultCommandGroup&&!o.helpGroup()&&o.helpGroup(this._defaultCommandGroup)}nameFromFilename(o){return this._name=r.basename(o,r.extname(o)),this}executableDir(o){return o===void 0?this._executableDir:(this._executableDir=o,this)}helpInformation(o){const l=this.createHelp(),D=this._getOutputContext(o);l.prepareContext({error:D.error,helpWidth:D.helpWidth,outputHasColors:D.hasColors});const f=l.formatHelp(this,l);return D.hasColors?f:this._outputConfiguration.stripColor(f)}_getOutputContext(o){o=o||{};const l=!!o.error;let D,f,d;return l?(D=_=>this._outputConfiguration.writeErr(_),f=this._outputConfiguration.getErrHasColors(),d=this._outputConfiguration.getErrHelpWidth()):(D=_=>this._outputConfiguration.writeOut(_),f=this._outputConfiguration.getOutHasColors(),d=this._outputConfiguration.getOutHelpWidth()),{error:l,write:_=>(f||(_=this._outputConfiguration.stripColor(_)),D(_)),hasColors:f,helpWidth:d}}outputHelp(o){let l;typeof o=="function"&&(l=o,o=void 0);const D=this._getOutputContext(o),f={error:D.error,write:D.write,command:this};this._getCommandAndAncestors().reverse().forEach(p=>p.emit("beforeAllHelp",f)),this.emit("beforeHelp",f);let d=this.helpInformation({error:D.error});if(l&&(d=l(d),typeof d!="string"&&!Buffer.isBuffer(d)))throw new Error("outputHelp callback must return a string or a Buffer");D.write(d),this._getHelpOption()?.long&&this.emit(this._getHelpOption().long),this.emit("afterHelp",f),this._getCommandAndAncestors().forEach(p=>p.emit("afterAllHelp",f))}helpOption(o,l){return typeof o=="boolean"?(o?(this._helpOption===null&&(this._helpOption=void 0),this._defaultOptionGroup&&this._initOptionGroup(this._getHelpOption())):this._helpOption=null,this):(this._helpOption=this.createOption(o??"-h, --help",l??"display help for command"),(o||l)&&this._initOptionGroup(this._helpOption),this)}_getHelpOption(){return this._helpOption===void 0&&this.helpOption(void 0,void 0),this._helpOption}addHelpOption(o){return this._helpOption=o,this._initOptionGroup(o),this}help(o){this.outputHelp(o);let l=Number(s.exitCode??0);l===0&&o&&typeof o!="function"&&o.error&&(l=1),this._exit(l,"commander.help","(outputHelp)")}addHelpText(o,l){const D=["beforeAll","before","after","afterAll"];if(!D.includes(o))throw new Error(`Unexpected value for position to addHelpText.
83
+ Expecting one of '${D.join("', '")}'`);const f=`${o}Help`;return this.on(f,d=>{let p;typeof l=="function"?p=l({error:d.error,command:d.command}):p=l,p&&d.write(`${p}
84
+ `)}),this}_outputHelpIfRequested(o){const l=this._getHelpOption();l&&o.find(f=>l.is(f))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}}function b(R){return R.map(o=>{if(!o.startsWith("--inspect"))return o;let l,D="127.0.0.1",f="9229",d;return(d=o.match(/^(--inspect(-brk)?)$/))!==null?l=d[1]:(d=o.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null?(l=d[1],/^\d+$/.test(d[3])?f=d[3]:D=d[3]):(d=o.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(l=d[1],D=d[3],f=d[4]),l&&f!=="0"?`${l}=${D}:${parseInt(f)+1}`:o})}function A(){if(s.env.NO_COLOR||s.env.FORCE_COLOR==="0"||s.env.FORCE_COLOR==="false")return!1;if(s.env.FORCE_COLOR||s.env.CLICOLOR_FORCE!==void 0)return!0}return ie.Command=w,ie.useColor=A,ie}var mi;function Un(){if(mi)return Ft;mi=1;const{Argument:i}=Se(),{Command:e}=Gn(),{CommanderError:r,InvalidArgumentError:h}=se(),{Help:s}=li(),{Option:n}=Di();return Ft.program=new e,Ft.createCommand=t=>new e(t),Ft.createOption=(t,u)=>new n(t,u),Ft.createArgument=(t,u)=>new i(t,u),Ft.Command=e,Ft.Option=n,Ft.Argument=i,Ft.Help=s,Ft.CommanderError=r,Ft.InvalidArgumentError=h,Ft.InvalidOptionArgumentError=h,Ft}var Wn=Un();const zn=Ps(Wn),{program:Ho,createCommand:jo,createArgument:Go,createOption:Uo,CommanderError:Wo,InvalidArgumentError:zo,InvalidOptionArgumentError:Vo,Command:Vn,Argument:qo,Option:qn,Help:Ko}=zn,Kn="0.29.0";var It={};class Yn extends Error{method;path;expected;value;fake_expected_typed_value_;constructor(e){super(e.message||`Error on ${e.method}(): invalid type${e.path?` on ${e.path}`:""}, expect to be ${e.expected}`);const r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.method=e.method,this.path=e.path,this.expected=e.expected,this.value=e.value}}const Zn={__proto__:null,TypeGuardError:Yn},Xn=Xr(Zn);var pi;function Jn(){if(pi)return It;pi=1,Object.defineProperty(It,"__esModule",{value:!0}),It._assertGuard=void 0;const i=Xn,e=(r,h,s)=>{if(r===!0)throw s?s(h):new i.TypeGuardError(h);return!1};return It._assertGuard=e,It}var nt=Jn();const Qn=i=>({start:Q.hrtime.bigint(),command:i.map(e=>tu(xr(e))).join(" "),state:{stdout:"",stderr:"",output:""}}),tu=i=>/[^\w./-]/.test(i)?`'${i.replaceAll("'","'\\''")}'`:i,eu=({stdin:i,stdout:e,stderr:r,stdio:h=[i,e,r],env:s,preferLocal:n,cwd:t=".",...u})=>{const a=t instanceof URL?jr(t):dt.resolve(t),m=s?{...Q.env,...s}:void 0,y=h[0]?.string;return{...u,input:y,stdio:y===void 0?h:["pipe",...h.slice(1)],env:n?su(m??Q.env,a):m,cwd:a}},su=({Path:i="",PATH:e=i,...r},h)=>{const s=e.split(dt.delimiter),n=gi([],dt.resolve(h)).map(t=>dt.join(t,"node_modules/.bin")).filter(t=>!s.includes(t));return{...r,PATH:[...n,e].filter(Boolean).join(dt.delimiter)}},gi=(i,e)=>i.at(-1)===e?i:gi([...i,e],dt.resolve(e,"..")),iu=async(i,e,r)=>await ru(i,r)?[Re(i),e.map(h=>hu(h)),{...r,shell:!0}]:[i,e,r],ru=async(i,{shell:e,cwd:r,env:h=Q.env})=>Q.platform==="win32"&&!e&&!await nu(i,r,h),nu=(i,e,{Path:r="",PATH:h=r})=>Ci.some(s=>i.toLowerCase().endsWith(s))||au(i,e,h),uu={},Ei=i=>(...e)=>uu[e.join("\0")]??=i(...e),ou=Ei(Rt.access),au=Ei(async(i,e,r)=>{const h=r.split(dt.delimiter).filter(Boolean).map(s=>s.replace(/^"(.*)"$/,"$1"));try{await Promise.any([e,...h].flatMap(s=>Ci.map(n=>ou(`${dt.resolve(s,i)}${n}`))))}catch{return!1}return!0}),Ci=[".exe",".com"],hu=i=>Re(Re(`"${i.replaceAll(/(\\*)"/g,'$1$1\\"').replace(/(\\*)$/,"$1$1")}"`)),Re=i=>i.replaceAll(/([()\][%!^"`<>&|;, *?])/g,"^$1"),lu=async(i,{input:e},r)=>{const h=await i;e!==void 0&&h.stdin.end(e);const s=$s(h,"close");try{return await Promise.race([s,...h.stdio.filter(Boolean).map(n=>cu(n))]),Du(r,yi(h)),bi(r)}catch(n){throw await Promise.allSettled([s]),Fi(n,h,r)}},cu=async i=>{for await(const[e]of Lr(i,"error"))if(!["ERR_STREAM_PREMATURE_CLOSE","EPIPE"].includes(e?.code))throw e},Du=({command:i},{exitCode:e,signalName:r})=>{if(r!==void 0)throw new Bt(`Command was terminated with ${r}: ${i}`);if(e!==void 0)throw new Bt(`Command failed with exit code ${e}: ${i}`)},Fi=(i,e,r)=>Object.assign(du(i,r),yi(e),bi(r)),du=(i,{command:e})=>i instanceof Bt?i:new Bt(`Command failed: ${e}`,{cause:i});class Bt extends Error{name="SubprocessError"}const yi=({exitCode:i,signalCode:e})=>({...i<1?{}:{exitCode:i},...e===null?{}:{signalName:e}}),bi=({state:{stdout:i,stderr:e,output:r},command:h,start:s})=>({stdout:Be(i),stderr:Be(e),output:Be(r),command:h,durationMs:Number(Q.hrtime.bigint()-s)/1e6}),Be=i=>i.at(-1)===`
85
+ `?i.slice(0,i.at(-2)==="\r"?-2:-1):i,fu=async(i,e,r,h)=>{try{["node","node.exe"].includes(i.toLowerCase())&&(i=Q.execPath,e=[...Q.execArgv.filter(n=>!n.startsWith("--inspect")),...e]),[i,e,r]=await iu(i,e,r),[i,e,r]=mu(i,e,r);const s=Mr(i,e,r);return _i(s.stdout,h,"stdout"),_i(s.stderr,h,"stderr"),s.once("error",()=>{}),await $s(s,"spawn"),s}catch(s){throw Fi(s,{},h)}},mu=(i,e,r)=>r.shell&&e.length>0?[[i,...e].join(" "),[],r]:[i,e,r],_i=(i,{state:e},r)=>{i&&(i.setEncoding("utf8"),e.isIterating||(e.isIterating=!1,i.on("data",h=>{e[r]+=h,e.output+=h})))},pu=async i=>{const[[e,r]]=await Promise.all([Promise.allSettled(i),gu(i)]);if(r.reason)throw r.reason.pipedFrom=e.reason??e.value,r.reason;if(e.reason)throw e.reason;return{...r.value,pipedFrom:e.value}},gu=async i=>{try{const[{stdout:e},{stdin:r}]=await Promise.all(i.map(({nodeChildProcess:h})=>h));if(r===null)throw new Error('The "stdin" option must be set on the first "spawn()" call in the pipeline.');if(e===null)throw new Error('The "stdout" option must be set on the last "spawn()" call in the pipeline.');Gr(e,r).catch(()=>{})}catch(e){throw await Promise.allSettled(i.map(({nodeChildProcess:r})=>Eu(r))),e}},Eu=async i=>{const{stdin:e}=await i;e.end()},wi=async function*(i,{state:e},r){if(e.isIterating===!1)throw new Error(`The subprocess must be iterated right away, for example:
86
+ for await (const line of spawn(...)) { ... }`);e.isIterating=!0;try{const{[r]:h}=await i.nodeChildProcess;if(!h)return;yield*Ur.createInterface({input:h})}finally{await i}},Cu=async function*(...i){try{let e=[];for(;i.length>0;){e=i.map((t,u)=>e[u]??Fu(t));const[{value:r,done:h},s]=await Promise.race(e.map((t,u)=>Promise.all([t,u]))),[n]=i.splice(s,1);e.splice(s,1),h||(i.push(n),yield r)}}finally{await Promise.all(i.map(e=>e.return()))}},Fu=async i=>{try{return await i.next()}catch(e){await i.throw(e)}};function xe(i,e,r,h){const[s=[],n={}]=Array.isArray(e)?[e,r]:[[],e],t=Qn([i,...s]),u=eu(n),a=fu(i,s,u,t);let m=lu(a,u,t);Object.assign(m,{nodeChildProcess:a}),m=h?pu([h,m]):m;const y=wi(m,t,"stdout"),g=wi(m,t,"stderr");return Object.assign(m,{nodeChildProcess:a,stdout:y,stderr:g,[Symbol.asyncIterator]:()=>Cu(y,g),pipe:(F,w,b)=>xe(F,w,b,m)})}function vi(i){return i.split("-").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join("")}function Ai(i,e,r){try{const h=Wr(i),s=zr(r,h.amount,{indent:" "});return i.replace(e,s)}catch{return i}}const yu="https://raw.githubusercontent.com/wrtnlabs/connectors/refs/heads/main/connectors-list.json",Te="@wrtnlabs/connector-";function bu(i){return`${Te}${i}`}function _u(i){return i.replace(Te,"")}async function wu(){const i=await(await fetch(yu)).json();return(()=>{const e=u=>Array.isArray(u.connectors)&&u.connectors.every(a=>typeof a=="object"&&a!==null&&r(a))&&typeof u.version=="string",r=u=>typeof u.name=="string"&&RegExp(/^@wrtnlabs\/connector\x2d(.*)/).test(u.name)&&Array.isArray(u.envList)&&u.envList.every(a=>typeof a=="string"),h=(u,a,m=!0)=>((Array.isArray(u.connectors)||nt._assertGuard(m,{method:"typia.assert",path:a+".connectors",expected:"Array<UnwrapTaggedConnectorInfo>",value:u.connectors},t))&&u.connectors.every((y,g)=>(typeof y=="object"&&y!==null||nt._assertGuard(m,{method:"typia.assert",path:a+".connectors["+g+"]",expected:"UnwrapTaggedConnectorInfo",value:y},t))&&s(y,a+".connectors["+g+"]",m)||nt._assertGuard(m,{method:"typia.assert",path:a+".connectors["+g+"]",expected:"UnwrapTaggedConnectorInfo",value:y},t))||nt._assertGuard(m,{method:"typia.assert",path:a+".connectors",expected:"Array<UnwrapTaggedConnectorInfo>",value:u.connectors},t))&&(typeof u.version=="string"||nt._assertGuard(m,{method:"typia.assert",path:a+".version",expected:"string",value:u.version},t)),s=(u,a,m=!0)=>(typeof u.name=="string"&&RegExp(/^@wrtnlabs\/connector\x2d(.*)/).test(u.name)||nt._assertGuard(m,{method:"typia.assert",path:a+".name",expected:"`@wrtnlabs/connector-${string}`",value:u.name},t))&&((Array.isArray(u.envList)||nt._assertGuard(m,{method:"typia.assert",path:a+".envList",expected:"Array<string>",value:u.envList},t))&&u.envList.every((y,g)=>typeof y=="string"||nt._assertGuard(m,{method:"typia.assert",path:a+".envList["+g+"]",expected:"string",value:y},t))||nt._assertGuard(m,{method:"typia.assert",path:a+".envList",expected:"Array<string>",value:u.envList},t)),n=u=>typeof u=="object"&&u!==null&&e(u);let t;return(u,a)=>(n(u)===!1&&(t=a,((m,y,g=!0)=>(typeof m=="object"&&m!==null||nt._assertGuard(!0,{method:"typia.assert",path:y+"",expected:"UnwrapTaggedConnectors",value:m},t))&&h(m,y+"",!0)||nt._assertGuard(!0,{method:"typia.assert",path:y+"",expected:"UnwrapTaggedConnectors",value:m},t))(u,"$input",!0)),u)})()(i)}async function vu(){return(await wu()).connectors.map(({name:i,envList:e})=>{const r=_u(i),h=r.replace("-"," ").toUpperCase();return{packageName:i,serviceName:r,displayName:h,envList:e}})}function $e(i){return i.map(e=>{const r=vi(e);return`{
87
+ name: "${r} Connector",
83
88
  protocol: "class",
84
- application: typia.llm.application<${i}Service, "chatgpt">(),
85
- execute: new ${i}Service(),
89
+ application: typia.llm.application<${r}Service, "chatgpt">(),
90
+ execute: new ${r}Service(),
86
91
  }`}).join(`,
87
- `)}function It(s){return s.map(t=>`import { ${Si(t)}Service } from "${$t}${t}";`).join(`
88
- `)}function Lt({content:s,importCode:t,connectorCode:i}){return s.replace("/// INSERT IMPORT HERE",t).replace("/// INSERT CONTROLLER HERE",i)}var he={},Pt,Oi;function Le(){if(Oi)return Pt;Oi=1;const s=new Map([["C","cwd"],["f","file"],["z","gzip"],["P","preservePaths"],["U","unlink"],["strip-components","strip"],["stripComponents","strip"],["keep-newer","newer"],["keepNewer","newer"],["keep-newer-files","newer"],["keepNewerFiles","newer"],["k","keep"],["keep-existing","keep"],["keepExisting","keep"],["m","noMtime"],["no-mtime","noMtime"],["p","preserveOwner"],["L","follow"],["h","follow"]]);return Pt=t=>t?Object.keys(t).map(i=>[s.has(i)?s.get(i):i,t[i]]).reduce((i,n)=>(i[n[0]]=n[1],i),Object.create(null)):{},Pt}var Mt={},Ri;function kt(){if(Ri)return Mt;Ri=1;const s=typeof process=="object"&&process?process:{stdout:null,stderr:null},t=Te,i=Ls,r=Ps.StringDecoder,a=Symbol("EOF"),e=Symbol("maybeEmitEnd"),u=Symbol("emittedEnd"),h=Symbol("emittingEnd"),m=Symbol("emittedError"),y=Symbol("closed"),p=Symbol("read"),C=Symbol("flush"),w=Symbol("flushChunk"),b=Symbol("encoding"),A=Symbol("decoder"),S=Symbol("flowing"),v=Symbol("paused"),o=Symbol("resume"),l=Symbol("buffer"),f=Symbol("pipes"),d=Symbol("bufferLength"),D=Symbol("bufferPush"),F=Symbol("bufferShift"),R=Symbol("objectMode"),B=Symbol("destroyed"),x=Symbol("error"),P=Symbol("emitData"),M=Symbol("emitEnd"),U=Symbol("emitEnd2"),G=Symbol("async"),Y=Symbol("abort"),N=Symbol("aborted"),W=Symbol("signal"),V=z=>Promise.resolve().then(z),te=Dt._MP_NO_ITERATOR_SYMBOLS_!=="1",_=te&&Symbol.asyncIterator||Symbol("asyncIterator not implemented"),c=te&&Symbol.iterator||Symbol("iterator not implemented"),g=z=>z==="end"||z==="finish"||z==="prefinish",L=z=>z instanceof ArrayBuffer||typeof z=="object"&&z.constructor&&z.constructor.name==="ArrayBuffer"&&z.byteLength>=0,j=z=>!Buffer.isBuffer(z)&&ArrayBuffer.isView(z);class J{constructor(O,T,K){this.src=O,this.dest=T,this.opts=K,this.ondrain=()=>O[o](),T.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(){}end(){this.unpipe(),this.opts.end&&this.dest.end()}}class $ extends J{unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(O,T,K){super(O,T,K),this.proxyErrors=ae=>T.emit("error",ae),O.on("error",this.proxyErrors)}}class q extends i{constructor(O){super(),this[S]=!1,this[v]=!1,this[f]=[],this[l]=[],this[R]=O&&O.objectMode||!1,this[R]?this[b]=null:this[b]=O&&O.encoding||null,this[b]==="buffer"&&(this[b]=null),this[G]=O&&!!O.async||!1,this[A]=this[b]?new r(this[b]):null,this[a]=!1,this[u]=!1,this[h]=!1,this[y]=!1,this[m]=null,this.writable=!0,this.readable=!0,this[d]=0,this[B]=!1,O&&O.debugExposeBuffer===!0&&Object.defineProperty(this,"buffer",{get:()=>this[l]}),O&&O.debugExposePipes===!0&&Object.defineProperty(this,"pipes",{get:()=>this[f]}),this[W]=O&&O.signal,this[N]=!1,this[W]&&(this[W].addEventListener("abort",()=>this[Y]()),this[W].aborted&&this[Y]())}get bufferLength(){return this[d]}get encoding(){return this[b]}set encoding(O){if(this[R])throw new Error("cannot set encoding in objectMode");if(this[b]&&O!==this[b]&&(this[A]&&this[A].lastNeed||this[d]))throw new Error("cannot change encoding");this[b]!==O&&(this[A]=O?new r(O):null,this[l].length&&(this[l]=this[l].map(T=>this[A].write(T)))),this[b]=O}setEncoding(O){this.encoding=O}get objectMode(){return this[R]}set objectMode(O){this[R]=this[R]||!!O}get async(){return this[G]}set async(O){this[G]=this[G]||!!O}[Y](){this[N]=!0,this.emit("abort",this[W].reason),this.destroy(this[W].reason)}get aborted(){return this[N]}set aborted(O){}write(O,T,K){if(this[N])return!1;if(this[a])throw new Error("write after end");if(this[B])return this.emit("error",Object.assign(new Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;typeof T=="function"&&(K=T,T="utf8"),T||(T="utf8");const ae=this[G]?V:De=>De();return!this[R]&&!Buffer.isBuffer(O)&&(j(O)?O=Buffer.from(O.buffer,O.byteOffset,O.byteLength):L(O)?O=Buffer.from(O):typeof O!="string"&&(this.objectMode=!0)),this[R]?(this.flowing&&this[d]!==0&&this[C](!0),this.flowing?this.emit("data",O):this[D](O),this[d]!==0&&this.emit("readable"),K&&ae(K),this.flowing):O.length?(typeof O=="string"&&!(T===this[b]&&!this[A].lastNeed)&&(O=Buffer.from(O,T)),Buffer.isBuffer(O)&&this[b]&&(O=this[A].write(O)),this.flowing&&this[d]!==0&&this[C](!0),this.flowing?this.emit("data",O):this[D](O),this[d]!==0&&this.emit("readable"),K&&ae(K),this.flowing):(this[d]!==0&&this.emit("readable"),K&&ae(K),this.flowing)}read(O){if(this[B])return null;if(this[d]===0||O===0||O>this[d])return this[e](),null;this[R]&&(O=null),this[l].length>1&&!this[R]&&(this.encoding?this[l]=[this[l].join("")]:this[l]=[Buffer.concat(this[l],this[d])]);const T=this[p](O||null,this[l][0]);return this[e](),T}[p](O,T){return O===T.length||O===null?this[F]():(this[l][0]=T.slice(O),T=T.slice(0,O),this[d]-=O),this.emit("data",T),!this[l].length&&!this[a]&&this.emit("drain"),T}end(O,T,K){return typeof O=="function"&&(K=O,O=null),typeof T=="function"&&(K=T,T="utf8"),O&&this.write(O,T),K&&this.once("end",K),this[a]=!0,this.writable=!1,(this.flowing||!this[v])&&this[e](),this}[o](){this[B]||(this[v]=!1,this[S]=!0,this.emit("resume"),this[l].length?this[C]():this[a]?this[e]():this.emit("drain"))}resume(){return this[o]()}pause(){this[S]=!1,this[v]=!0}get destroyed(){return this[B]}get flowing(){return this[S]}get paused(){return this[v]}[D](O){this[R]?this[d]+=1:this[d]+=O.length,this[l].push(O)}[F](){return this[R]?this[d]-=1:this[d]-=this[l][0].length,this[l].shift()}[C](O){do;while(this[w](this[F]())&&this[l].length);!O&&!this[l].length&&!this[a]&&this.emit("drain")}[w](O){return this.emit("data",O),this.flowing}pipe(O,T){if(this[B])return;const K=this[u];return T=T||{},O===s.stdout||O===s.stderr?T.end=!1:T.end=T.end!==!1,T.proxyErrors=!!T.proxyErrors,K?T.end&&O.end():(this[f].push(T.proxyErrors?new $(this,O,T):new J(this,O,T)),this[G]?V(()=>this[o]()):this[o]()),O}unpipe(O){const T=this[f].find(K=>K.dest===O);T&&(this[f].splice(this[f].indexOf(T),1),T.unpipe())}addListener(O,T){return this.on(O,T)}on(O,T){const K=super.on(O,T);return O==="data"&&!this[f].length&&!this.flowing?this[o]():O==="readable"&&this[d]!==0?super.emit("readable"):g(O)&&this[u]?(super.emit(O),this.removeAllListeners(O)):O==="error"&&this[m]&&(this[G]?V(()=>T.call(this,this[m])):T.call(this,this[m])),K}get emittedEnd(){return this[u]}[e](){!this[h]&&!this[u]&&!this[B]&&this[l].length===0&&this[a]&&(this[h]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[y]&&this.emit("close"),this[h]=!1)}emit(O,T,...K){if(O!=="error"&&O!=="close"&&O!==B&&this[B])return;if(O==="data")return!this[R]&&!T?!1:this[G]?V(()=>this[P](T)):this[P](T);if(O==="end")return this[M]();if(O==="close"){if(this[y]=!0,!this[u]&&!this[B])return;const De=super.emit("close");return this.removeAllListeners("close"),De}else if(O==="error"){this[m]=T,super.emit(x,T);const De=!this[W]||this.listeners("error").length?super.emit("error",T):!1;return this[e](),De}else if(O==="resume"){const De=super.emit("resume");return this[e](),De}else if(O==="finish"||O==="prefinish"){const De=super.emit(O);return this.removeAllListeners(O),De}const ae=super.emit(O,T,...K);return this[e](),ae}[P](O){for(const K of this[f])K.dest.write(O)===!1&&this.pause();const T=super.emit("data",O);return this[e](),T}[M](){this[u]||(this[u]=!0,this.readable=!1,this[G]?V(()=>this[U]()):this[U]())}[U](){if(this[A]){const T=this[A].end();if(T){for(const K of this[f])K.dest.write(T);super.emit("data",T)}}for(const T of this[f])T.end();const O=super.emit("end");return this.removeAllListeners("end"),O}collect(){const O=[];this[R]||(O.dataLength=0);const T=this.promise();return this.on("data",K=>{O.push(K),this[R]||(O.dataLength+=K.length)}),T.then(()=>O)}concat(){return this[R]?Promise.reject(new Error("cannot concat in objectMode")):this.collect().then(O=>this[R]?Promise.reject(new Error("cannot concat in objectMode")):this[b]?O.join(""):Buffer.concat(O,O.dataLength))}promise(){return new Promise((O,T)=>{this.on(B,()=>T(new Error("stream destroyed"))),this.on("error",K=>T(K)),this.on("end",()=>O())})}[_](){let O=!1;const T=()=>(this.pause(),O=!0,Promise.resolve({done:!0}));return{next:()=>{if(O)return T();const ae=this.read();if(ae!==null)return Promise.resolve({done:!1,value:ae});if(this[a])return T();let De=null,qe=null;const se=Z=>{this.removeListener("data",E),this.removeListener("end",k),this.removeListener(B,H),T(),qe(Z)},E=Z=>{this.removeListener("error",se),this.removeListener("end",k),this.removeListener(B,H),this.pause(),De({value:Z,done:!!this[a]})},k=()=>{this.removeListener("error",se),this.removeListener("data",E),this.removeListener(B,H),T(),De({done:!0})},H=()=>se(new Error("stream destroyed"));return new Promise((Z,X)=>{qe=X,De=Z,this.once(B,H),this.once("error",se),this.once("end",k),this.once("data",E)})},throw:T,return:T,[_](){return this}}}[c](){let O=!1;const T=()=>(this.pause(),this.removeListener(x,T),this.removeListener(B,T),this.removeListener("end",T),O=!0,{done:!0}),K=()=>{if(O)return T();const ae=this.read();return ae===null?T():{value:ae}};return this.once("end",T),this.once(x,T),this.once(B,T),{next:K,throw:T,return:T,[c](){return this}}}destroy(O){return this[B]?(O?this.emit("error",O):this.emit(B),this):(this[B]=!0,this[l].length=0,this[d]=0,typeof this.close=="function"&&!this[y]&&this.close(),O?this.emit("error",O):this.emit(B),this)}static isStream(O){return!!O&&(O instanceof q||O instanceof i||O instanceof t&&(typeof O.pipe=="function"||typeof O.write=="function"&&typeof O.end=="function"))}}return Mt.Minipass=q,Mt}var ge={},jt,Bi;function wu(){if(Bi)return jt;Bi=1;const s=Ms.constants||{ZLIB_VERNUM:4736};return jt=Object.freeze(Object.assign(Object.create(null),{Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_VERSION_ERROR:-6,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,DEFLATE:1,INFLATE:2,GZIP:3,GUNZIP:4,DEFLATERAW:5,INFLATERAW:6,UNZIP:7,BROTLI_DECODE:8,BROTLI_ENCODE:9,Z_MIN_WINDOWBITS:8,Z_MAX_WINDOWBITS:15,Z_DEFAULT_WINDOWBITS:15,Z_MIN_CHUNK:64,Z_MAX_CHUNK:1/0,Z_DEFAULT_CHUNK:16384,Z_MIN_MEMLEVEL:1,Z_MAX_MEMLEVEL:9,Z_DEFAULT_MEMLEVEL:8,Z_MIN_LEVEL:-1,Z_MAX_LEVEL:9,Z_DEFAULT_LEVEL:-1,BROTLI_OPERATION_PROCESS:0,BROTLI_OPERATION_FLUSH:1,BROTLI_OPERATION_FINISH:2,BROTLI_OPERATION_EMIT_METADATA:3,BROTLI_MODE_GENERIC:0,BROTLI_MODE_TEXT:1,BROTLI_MODE_FONT:2,BROTLI_DEFAULT_MODE:0,BROTLI_MIN_QUALITY:0,BROTLI_MAX_QUALITY:11,BROTLI_DEFAULT_QUALITY:11,BROTLI_MIN_WINDOW_BITS:10,BROTLI_MAX_WINDOW_BITS:24,BROTLI_LARGE_MAX_WINDOW_BITS:30,BROTLI_DEFAULT_WINDOW:22,BROTLI_MIN_INPUT_BLOCK_BITS:16,BROTLI_MAX_INPUT_BLOCK_BITS:24,BROTLI_PARAM_MODE:0,BROTLI_PARAM_QUALITY:1,BROTLI_PARAM_LGWIN:2,BROTLI_PARAM_LGBLOCK:3,BROTLI_PARAM_DISABLE_LITERAL_CONTEXT_MODELING:4,BROTLI_PARAM_SIZE_HINT:5,BROTLI_PARAM_LARGE_WINDOW:6,BROTLI_PARAM_NPOSTFIX:7,BROTLI_PARAM_NDIRECT:8,BROTLI_DECODER_RESULT_ERROR:0,BROTLI_DECODER_RESULT_SUCCESS:1,BROTLI_DECODER_RESULT_NEEDS_MORE_INPUT:2,BROTLI_DECODER_RESULT_NEEDS_MORE_OUTPUT:3,BROTLI_DECODER_PARAM_DISABLE_RING_BUFFER_REALLOCATION:0,BROTLI_DECODER_PARAM_LARGE_WINDOW:1,BROTLI_DECODER_NO_ERROR:0,BROTLI_DECODER_SUCCESS:1,BROTLI_DECODER_NEEDS_MORE_INPUT:2,BROTLI_DECODER_NEEDS_MORE_OUTPUT:3,BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_NIBBLE:-1,BROTLI_DECODER_ERROR_FORMAT_RESERVED:-2,BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_META_NIBBLE:-3,BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_ALPHABET:-4,BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_SAME:-5,BROTLI_DECODER_ERROR_FORMAT_CL_SPACE:-6,BROTLI_DECODER_ERROR_FORMAT_HUFFMAN_SPACE:-7,BROTLI_DECODER_ERROR_FORMAT_CONTEXT_MAP_REPEAT:-8,BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_1:-9,BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_2:-10,BROTLI_DECODER_ERROR_FORMAT_TRANSFORM:-11,BROTLI_DECODER_ERROR_FORMAT_DICTIONARY:-12,BROTLI_DECODER_ERROR_FORMAT_WINDOW_BITS:-13,BROTLI_DECODER_ERROR_FORMAT_PADDING_1:-14,BROTLI_DECODER_ERROR_FORMAT_PADDING_2:-15,BROTLI_DECODER_ERROR_FORMAT_DISTANCE:-16,BROTLI_DECODER_ERROR_DICTIONARY_NOT_SET:-19,BROTLI_DECODER_ERROR_INVALID_ARGUMENTS:-20,BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MODES:-21,BROTLI_DECODER_ERROR_ALLOC_TREE_GROUPS:-22,BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MAP:-25,BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_1:-26,BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_2:-27,BROTLI_DECODER_ERROR_ALLOC_BLOCK_TYPE_TREES:-30,BROTLI_DECODER_ERROR_UNREACHABLE:-31},s)),jt}var Ht,xi;function Ti(){if(xi)return Ht;xi=1;const s=typeof process=="object"&&process?process:{stdout:null,stderr:null},t=Te,i=Ls,n=Ps.StringDecoder,r=Symbol("EOF"),a=Symbol("maybeEmitEnd"),e=Symbol("emittedEnd"),u=Symbol("emittingEnd"),h=Symbol("emittedError"),m=Symbol("closed"),y=Symbol("read"),p=Symbol("flush"),C=Symbol("flushChunk"),w=Symbol("encoding"),b=Symbol("decoder"),A=Symbol("flowing"),S=Symbol("paused"),v=Symbol("resume"),o=Symbol("bufferLength"),l=Symbol("bufferPush"),f=Symbol("bufferShift"),d=Symbol("objectMode"),D=Symbol("destroyed"),F=Symbol("emitData"),R=Symbol("emitEnd"),B=Symbol("emitEnd2"),x=Symbol("async"),P=_=>Promise.resolve().then(_),M=Dt._MP_NO_ITERATOR_SYMBOLS_!=="1",U=M&&Symbol.asyncIterator||Symbol("asyncIterator not implemented"),G=M&&Symbol.iterator||Symbol("iterator not implemented"),Y=_=>_==="end"||_==="finish"||_==="prefinish",N=_=>_ instanceof ArrayBuffer||typeof _=="object"&&_.constructor&&_.constructor.name==="ArrayBuffer"&&_.byteLength>=0,W=_=>!Buffer.isBuffer(_)&&ArrayBuffer.isView(_);class V{constructor(c,g,L){this.src=c,this.dest=g,this.opts=L,this.ondrain=()=>c[v](),g.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(){}end(){this.unpipe(),this.opts.end&&this.dest.end()}}class te extends V{unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(c,g,L){super(c,g,L),this.proxyErrors=j=>g.emit("error",j),c.on("error",this.proxyErrors)}}return Ht=class xr extends i{constructor(c){super(),this[A]=!1,this[S]=!1,this.pipes=[],this.buffer=[],this[d]=c&&c.objectMode||!1,this[d]?this[w]=null:this[w]=c&&c.encoding||null,this[w]==="buffer"&&(this[w]=null),this[x]=c&&!!c.async||!1,this[b]=this[w]?new n(this[w]):null,this[r]=!1,this[e]=!1,this[u]=!1,this[m]=!1,this[h]=null,this.writable=!0,this.readable=!0,this[o]=0,this[D]=!1}get bufferLength(){return this[o]}get encoding(){return this[w]}set encoding(c){if(this[d])throw new Error("cannot set encoding in objectMode");if(this[w]&&c!==this[w]&&(this[b]&&this[b].lastNeed||this[o]))throw new Error("cannot change encoding");this[w]!==c&&(this[b]=c?new n(c):null,this.buffer.length&&(this.buffer=this.buffer.map(g=>this[b].write(g)))),this[w]=c}setEncoding(c){this.encoding=c}get objectMode(){return this[d]}set objectMode(c){this[d]=this[d]||!!c}get async(){return this[x]}set async(c){this[x]=this[x]||!!c}write(c,g,L){if(this[r])throw new Error("write after end");if(this[D])return this.emit("error",Object.assign(new Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;typeof g=="function"&&(L=g,g="utf8"),g||(g="utf8");const j=this[x]?P:J=>J();return!this[d]&&!Buffer.isBuffer(c)&&(W(c)?c=Buffer.from(c.buffer,c.byteOffset,c.byteLength):N(c)?c=Buffer.from(c):typeof c!="string"&&(this.objectMode=!0)),this[d]?(this.flowing&&this[o]!==0&&this[p](!0),this.flowing?this.emit("data",c):this[l](c),this[o]!==0&&this.emit("readable"),L&&j(L),this.flowing):c.length?(typeof c=="string"&&!(g===this[w]&&!this[b].lastNeed)&&(c=Buffer.from(c,g)),Buffer.isBuffer(c)&&this[w]&&(c=this[b].write(c)),this.flowing&&this[o]!==0&&this[p](!0),this.flowing?this.emit("data",c):this[l](c),this[o]!==0&&this.emit("readable"),L&&j(L),this.flowing):(this[o]!==0&&this.emit("readable"),L&&j(L),this.flowing)}read(c){if(this[D])return null;if(this[o]===0||c===0||c>this[o])return this[a](),null;this[d]&&(c=null),this.buffer.length>1&&!this[d]&&(this.encoding?this.buffer=[this.buffer.join("")]:this.buffer=[Buffer.concat(this.buffer,this[o])]);const g=this[y](c||null,this.buffer[0]);return this[a](),g}[y](c,g){return c===g.length||c===null?this[f]():(this.buffer[0]=g.slice(c),g=g.slice(0,c),this[o]-=c),this.emit("data",g),!this.buffer.length&&!this[r]&&this.emit("drain"),g}end(c,g,L){return typeof c=="function"&&(L=c,c=null),typeof g=="function"&&(L=g,g="utf8"),c&&this.write(c,g),L&&this.once("end",L),this[r]=!0,this.writable=!1,(this.flowing||!this[S])&&this[a](),this}[v](){this[D]||(this[S]=!1,this[A]=!0,this.emit("resume"),this.buffer.length?this[p]():this[r]?this[a]():this.emit("drain"))}resume(){return this[v]()}pause(){this[A]=!1,this[S]=!0}get destroyed(){return this[D]}get flowing(){return this[A]}get paused(){return this[S]}[l](c){this[d]?this[o]+=1:this[o]+=c.length,this.buffer.push(c)}[f](){return this.buffer.length&&(this[d]?this[o]-=1:this[o]-=this.buffer[0].length),this.buffer.shift()}[p](c){do;while(this[C](this[f]()));!c&&!this.buffer.length&&!this[r]&&this.emit("drain")}[C](c){return c?(this.emit("data",c),this.flowing):!1}pipe(c,g){if(this[D])return;const L=this[e];return g=g||{},c===s.stdout||c===s.stderr?g.end=!1:g.end=g.end!==!1,g.proxyErrors=!!g.proxyErrors,L?g.end&&c.end():(this.pipes.push(g.proxyErrors?new te(this,c,g):new V(this,c,g)),this[x]?P(()=>this[v]()):this[v]()),c}unpipe(c){const g=this.pipes.find(L=>L.dest===c);g&&(this.pipes.splice(this.pipes.indexOf(g),1),g.unpipe())}addListener(c,g){return this.on(c,g)}on(c,g){const L=super.on(c,g);return c==="data"&&!this.pipes.length&&!this.flowing?this[v]():c==="readable"&&this[o]!==0?super.emit("readable"):Y(c)&&this[e]?(super.emit(c),this.removeAllListeners(c)):c==="error"&&this[h]&&(this[x]?P(()=>g.call(this,this[h])):g.call(this,this[h])),L}get emittedEnd(){return this[e]}[a](){!this[u]&&!this[e]&&!this[D]&&this.buffer.length===0&&this[r]&&(this[u]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[m]&&this.emit("close"),this[u]=!1)}emit(c,g,...L){if(c!=="error"&&c!=="close"&&c!==D&&this[D])return;if(c==="data")return g?this[x]?P(()=>this[F](g)):this[F](g):!1;if(c==="end")return this[R]();if(c==="close"){if(this[m]=!0,!this[e]&&!this[D])return;const J=super.emit("close");return this.removeAllListeners("close"),J}else if(c==="error"){this[h]=g;const J=super.emit("error",g);return this[a](),J}else if(c==="resume"){const J=super.emit("resume");return this[a](),J}else if(c==="finish"||c==="prefinish"){const J=super.emit(c);return this.removeAllListeners(c),J}const j=super.emit(c,g,...L);return this[a](),j}[F](c){for(const L of this.pipes)L.dest.write(c)===!1&&this.pause();const g=super.emit("data",c);return this[a](),g}[R](){this[e]||(this[e]=!0,this.readable=!1,this[x]?P(()=>this[B]()):this[B]())}[B](){if(this[b]){const g=this[b].end();if(g){for(const L of this.pipes)L.dest.write(g);super.emit("data",g)}}for(const g of this.pipes)g.end();const c=super.emit("end");return this.removeAllListeners("end"),c}collect(){const c=[];this[d]||(c.dataLength=0);const g=this.promise();return this.on("data",L=>{c.push(L),this[d]||(c.dataLength+=L.length)}),g.then(()=>c)}concat(){return this[d]?Promise.reject(new Error("cannot concat in objectMode")):this.collect().then(c=>this[d]?Promise.reject(new Error("cannot concat in objectMode")):this[w]?c.join(""):Buffer.concat(c,c.dataLength))}promise(){return new Promise((c,g)=>{this.on(D,()=>g(new Error("stream destroyed"))),this.on("error",L=>g(L)),this.on("end",()=>c())})}[U](){return{next:()=>{const g=this.read();if(g!==null)return Promise.resolve({done:!1,value:g});if(this[r])return Promise.resolve({done:!0});let L=null,j=null;const J=O=>{this.removeListener("data",$),this.removeListener("end",q),j(O)},$=O=>{this.removeListener("error",J),this.removeListener("end",q),this.pause(),L({value:O,done:!!this[r]})},q=()=>{this.removeListener("error",J),this.removeListener("data",$),L({done:!0})},z=()=>J(new Error("stream destroyed"));return new Promise((O,T)=>{j=T,L=O,this.once(D,z),this.once("error",J),this.once("end",q),this.once("data",$)})}}}[G](){return{next:()=>{const g=this.read();return{value:g,done:g===null}}}}destroy(c){return this[D]?(c?this.emit("error",c):this.emit(D),this):(this[D]=!0,this.buffer.length=0,this[o]=0,typeof this.close=="function"&&!this[m]&&this.close(),c?this.emit("error",c):this.emit(D),this)}static isStream(c){return!!c&&(c instanceof xr||c instanceof i||c instanceof t&&(typeof c.pipe=="function"||typeof c.write=="function"&&typeof c.end=="function"))}},Ht}var $i;function Ni(){if($i)return ge;$i=1;const s=ct,t=qr.Buffer,i=Ms,n=ge.constants=wu(),r=Ti(),a=t.concat,e=Symbol("_superWrite");class u extends Error{constructor(N){super("zlib: "+N.message),this.code=N.code,this.errno=N.errno,this.code||(this.code="ZLIB_ERROR"),this.message="zlib: "+N.message,Error.captureStackTrace(this,this.constructor)}get name(){return"ZlibError"}}const h=Symbol("opts"),m=Symbol("flushFlag"),y=Symbol("finishFlushFlag"),p=Symbol("fullFlushFlag"),C=Symbol("handle"),w=Symbol("onError"),b=Symbol("sawError"),A=Symbol("level"),S=Symbol("strategy"),v=Symbol("ended");class o extends r{constructor(N,W){if(!N||typeof N!="object")throw new TypeError("invalid options for ZlibBase constructor");super(N),this[b]=!1,this[v]=!1,this[h]=N,this[m]=N.flush,this[y]=N.finishFlush;try{this[C]=new i[W](N)}catch(V){throw new u(V)}this[w]=V=>{this[b]||(this[b]=!0,this.close(),this.emit("error",V))},this[C].on("error",V=>this[w](new u(V))),this.once("end",()=>this.close)}close(){this[C]&&(this[C].close(),this[C]=null,this.emit("close"))}reset(){if(!this[b])return s(this[C],"zlib binding closed"),this[C].reset()}flush(N){this.ended||(typeof N!="number"&&(N=this[p]),this.write(Object.assign(t.alloc(0),{[m]:N})))}end(N,W,V){return N&&this.write(N,W),this.flush(this[y]),this[v]=!0,super.end(null,null,V)}get ended(){return this[v]}write(N,W,V){if(typeof W=="function"&&(V=W,W="utf8"),typeof N=="string"&&(N=t.from(N,W)),this[b])return;s(this[C],"zlib binding closed");const te=this[C]._handle,_=te.close;te.close=()=>{};const c=this[C].close;this[C].close=()=>{},t.concat=j=>j;let g;try{const j=typeof N[m]=="number"?N[m]:this[m];g=this[C]._processChunk(N,j),t.concat=a}catch(j){t.concat=a,this[w](new u(j))}finally{this[C]&&(this[C]._handle=te,te.close=_,this[C].close=c,this[C].removeAllListeners("error"))}this[C]&&this[C].on("error",j=>this[w](new u(j)));let L;if(g)if(Array.isArray(g)&&g.length>0){L=this[e](t.from(g[0]));for(let j=1;j<g.length;j++)L=this[e](g[j])}else L=this[e](t.from(g));return V&&V(),L}[e](N){return super.write(N)}}class l extends o{constructor(N,W){N=N||{},N.flush=N.flush||n.Z_NO_FLUSH,N.finishFlush=N.finishFlush||n.Z_FINISH,super(N,W),this[p]=n.Z_FULL_FLUSH,this[A]=N.level,this[S]=N.strategy}params(N,W){if(!this[b]){if(!this[C])throw new Error("cannot switch params when binding is closed");if(!this[C].params)throw new Error("not supported in this implementation");if(this[A]!==N||this[S]!==W){this.flush(n.Z_SYNC_FLUSH),s(this[C],"zlib binding closed");const V=this[C].flush;this[C].flush=(te,_)=>{this.flush(te),_()};try{this[C].params(N,W)}finally{this[C].flush=V}this[C]&&(this[A]=N,this[S]=W)}}}}class f extends l{constructor(N){super(N,"Deflate")}}class d extends l{constructor(N){super(N,"Inflate")}}const D=Symbol("_portable");class F extends l{constructor(N){super(N,"Gzip"),this[D]=N&&!!N.portable}[e](N){return this[D]?(this[D]=!1,N[9]=255,super[e](N)):super[e](N)}}class R extends l{constructor(N){super(N,"Gunzip")}}class B extends l{constructor(N){super(N,"DeflateRaw")}}class x extends l{constructor(N){super(N,"InflateRaw")}}class P extends l{constructor(N){super(N,"Unzip")}}class M extends o{constructor(N,W){N=N||{},N.flush=N.flush||n.BROTLI_OPERATION_PROCESS,N.finishFlush=N.finishFlush||n.BROTLI_OPERATION_FINISH,super(N,W),this[p]=n.BROTLI_OPERATION_FLUSH}}class U extends M{constructor(N){super(N,"BrotliCompress")}}class G extends M{constructor(N){super(N,"BrotliDecompress")}}return ge.Deflate=f,ge.Inflate=d,ge.Gzip=F,ge.Gunzip=R,ge.DeflateRaw=B,ge.InflateRaw=x,ge.Unzip=P,typeof i.BrotliCompress=="function"?(ge.BrotliCompress=U,ge.BrotliDecompress=G):ge.BrotliCompress=ge.BrotliDecompress=class{constructor(){throw new Error("Brotli is not supported in this version of Node.js")}},ge}var Ut,Ii;function Pe(){return Ii||(Ii=1,Ut=(process.env.TESTING_TAR_FAKE_PLATFORM||process.platform)!=="win32"?t=>t:t=>t&&t.replace(/\\/g,"/")),Ut}var zt,Li;function Gt(){if(Li)return zt;Li=1;const{Minipass:s}=kt(),t=Pe(),i=Symbol("slurp");return zt=class extends s{constructor(r,a,e){switch(super(),this.pause(),this.extended=a,this.globalExtended=e,this.header=r,this.startBlockSize=512*Math.ceil(r.size/512),this.blockRemain=this.startBlockSize,this.remain=r.size,this.type=r.type,this.meta=!1,this.ignore=!1,this.type){case"File":case"OldFile":case"Link":case"SymbolicLink":case"CharacterDevice":case"BlockDevice":case"Directory":case"FIFO":case"ContiguousFile":case"GNUDumpDir":break;case"NextFileHasLongLinkpath":case"NextFileHasLongPath":case"OldGnuLongPath":case"GlobalExtendedHeader":case"ExtendedHeader":case"OldExtendedHeader":this.meta=!0;break;default:this.ignore=!0}this.path=t(r.path),this.mode=r.mode,this.mode&&(this.mode=this.mode&4095),this.uid=r.uid,this.gid=r.gid,this.uname=r.uname,this.gname=r.gname,this.size=r.size,this.mtime=r.mtime,this.atime=r.atime,this.ctime=r.ctime,this.linkpath=t(r.linkpath),this.uname=r.uname,this.gname=r.gname,a&&this[i](a),e&&this[i](e,!0)}write(r){const a=r.length;if(a>this.blockRemain)throw new Error("writing more to entry than is appropriate");const e=this.remain,u=this.blockRemain;return this.remain=Math.max(0,e-a),this.blockRemain=Math.max(0,u-a),this.ignore?!0:e>=a?super.write(r):super.write(r.slice(0,e))}[i](r,a){for(const e in r)r[e]!==null&&r[e]!==void 0&&!(a&&e==="path")&&(this[e]=e==="path"||e==="linkpath"?t(r[e]):r[e])}},zt}var qt={},Pi;function Mi(){return Pi||(Pi=1,function(s){s.name=new Map([["0","File"],["","OldFile"],["1","Link"],["2","SymbolicLink"],["3","CharacterDevice"],["4","BlockDevice"],["5","Directory"],["6","FIFO"],["7","ContiguousFile"],["g","GlobalExtendedHeader"],["x","ExtendedHeader"],["A","SolarisACL"],["D","GNUDumpDir"],["I","Inode"],["K","NextFileHasLongLinkpath"],["L","NextFileHasLongPath"],["M","ContinuationFile"],["N","OldGnuLongPath"],["S","SparseFile"],["V","TapeVolumeHeader"],["X","OldExtendedHeader"]]),s.code=new Map(Array.from(s.name).map(t=>[t[1],t[0]]))}(qt)),qt}var Wt,ki;function _u(){if(ki)return Wt;ki=1;const s=(h,m)=>{if(Number.isSafeInteger(h))h<0?i(h,m):t(h,m);else throw Error("cannot encode number outside of javascript safe integer range");return m},t=(h,m)=>{m[0]=128;for(var y=m.length;y>1;y--)m[y-1]=h&255,h=Math.floor(h/256)},i=(h,m)=>{m[0]=255;var y=!1;h=h*-1;for(var p=m.length;p>1;p--){var C=h&255;h=Math.floor(h/256),y?m[p-1]=e(C):C===0?m[p-1]=0:(y=!0,m[p-1]=u(C))}},n=h=>{const m=h[0],y=m===128?a(h.slice(1,h.length)):m===255?r(h):null;if(y===null)throw Error("invalid base256 encoding");if(!Number.isSafeInteger(y))throw Error("parsed number outside of javascript safe integer range");return y},r=h=>{for(var m=h.length,y=0,p=!1,C=m-1;C>-1;C--){var w=h[C],b;p?b=e(w):w===0?b=w:(p=!0,b=u(w)),b!==0&&(y-=b*Math.pow(256,m-C-1))}return y},a=h=>{for(var m=h.length,y=0,p=m-1;p>-1;p--){var C=h[p];C!==0&&(y+=C*Math.pow(256,m-p-1))}return y},e=h=>(255^h)&255,u=h=>(255^h)+1&255;return Wt={encode:s,parse:n},Wt}var Vt,ji;function Me(){if(ji)return Vt;ji=1;const s=Mi(),t=fe.posix,i=_u(),n=Symbol("slurp"),r=Symbol("type");class a{constructor(D,F,R,B){this.cksumValid=!1,this.needPax=!1,this.nullBlock=!1,this.block=null,this.path=null,this.mode=null,this.uid=null,this.gid=null,this.size=null,this.mtime=null,this.cksum=null,this[r]="0",this.linkpath=null,this.uname=null,this.gname=null,this.devmaj=0,this.devmin=0,this.atime=null,this.ctime=null,Buffer.isBuffer(D)?this.decode(D,F||0,R,B):D&&this.set(D)}decode(D,F,R,B){if(F||(F=0),!D||!(D.length>=F+512))throw new Error("need 512 bytes for header");if(this.path=u(D,F,100),this.mode=y(D,F+100,8),this.uid=y(D,F+108,8),this.gid=y(D,F+116,8),this.size=y(D,F+124,12),this.mtime=h(D,F+136,12),this.cksum=y(D,F+148,12),this[n](R),this[n](B,!0),this[r]=u(D,F+156,1),this[r]===""&&(this[r]="0"),this[r]==="0"&&this.path.slice(-1)==="/"&&(this[r]="5"),this[r]==="5"&&(this.size=0),this.linkpath=u(D,F+157,100),D.slice(F+257,F+265).toString()==="ustar\x0000")if(this.uname=u(D,F+265,32),this.gname=u(D,F+297,32),this.devmaj=y(D,F+329,8),this.devmin=y(D,F+337,8),D[F+475]!==0){const P=u(D,F+345,155);this.path=P+"/"+this.path}else{const P=u(D,F+345,130);P&&(this.path=P+"/"+this.path),this.atime=h(D,F+476,12),this.ctime=h(D,F+488,12)}let x=8*32;for(let P=F;P<F+148;P++)x+=D[P];for(let P=F+156;P<F+512;P++)x+=D[P];this.cksumValid=x===this.cksum,this.cksum===null&&x===8*32&&(this.nullBlock=!0)}[n](D,F){for(const R in D)D[R]!==null&&D[R]!==void 0&&!(F&&R==="path")&&(this[R]=D[R])}encode(D,F){if(D||(D=this.block=Buffer.alloc(512),F=0),F||(F=0),!(D.length>=F+512))throw new Error("need 512 bytes for header");const R=this.ctime||this.atime?130:155,B=e(this.path||"",R),x=B[0],P=B[1];this.needPax=B[2],this.needPax=f(D,F,100,x)||this.needPax,this.needPax=b(D,F+100,8,this.mode)||this.needPax,this.needPax=b(D,F+108,8,this.uid)||this.needPax,this.needPax=b(D,F+116,8,this.gid)||this.needPax,this.needPax=b(D,F+124,12,this.size)||this.needPax,this.needPax=o(D,F+136,12,this.mtime)||this.needPax,D[F+156]=this[r].charCodeAt(0),this.needPax=f(D,F+157,100,this.linkpath)||this.needPax,D.write("ustar\x0000",F+257,8),this.needPax=f(D,F+265,32,this.uname)||this.needPax,this.needPax=f(D,F+297,32,this.gname)||this.needPax,this.needPax=b(D,F+329,8,this.devmaj)||this.needPax,this.needPax=b(D,F+337,8,this.devmin)||this.needPax,this.needPax=f(D,F+345,R,P)||this.needPax,D[F+475]!==0?this.needPax=f(D,F+345,155,P)||this.needPax:(this.needPax=f(D,F+345,130,P)||this.needPax,this.needPax=o(D,F+476,12,this.atime)||this.needPax,this.needPax=o(D,F+488,12,this.ctime)||this.needPax);let M=8*32;for(let U=F;U<F+148;U++)M+=D[U];for(let U=F+156;U<F+512;U++)M+=D[U];return this.cksum=M,b(D,F+148,8,this.cksum),this.cksumValid=!0,this.needPax}set(D){for(const F in D)D[F]!==null&&D[F]!==void 0&&(this[F]=D[F])}get type(){return s.name.get(this[r])||this[r]}get typeKey(){return this[r]}set type(D){s.code.has(D)?this[r]=s.code.get(D):this[r]=D}}const e=(d,D)=>{let R=d,B="",x;const P=t.parse(d).root||".";if(Buffer.byteLength(R)<100)x=[R,B,!1];else{B=t.dirname(R),R=t.basename(R);do Buffer.byteLength(R)<=100&&Buffer.byteLength(B)<=D?x=[R,B,!1]:Buffer.byteLength(R)>100&&Buffer.byteLength(B)<=D?x=[R.slice(0,99),B,!0]:(R=t.join(t.basename(B),R),B=t.dirname(B));while(B!==P&&!x);x||(x=[d.slice(0,99),"",!0])}return x},u=(d,D,F)=>d.slice(D,D+F).toString("utf8").replace(/\0.*/,""),h=(d,D,F)=>m(y(d,D,F)),m=d=>d===null?null:new Date(d*1e3),y=(d,D,F)=>d[D]&128?i.parse(d.slice(D,D+F)):C(d,D,F),p=d=>isNaN(d)?null:d,C=(d,D,F)=>p(parseInt(d.slice(D,D+F).toString("utf8").replace(/\0.*$/,"").trim(),8)),w={12:8589934591,8:2097151},b=(d,D,F,R)=>R===null?!1:R>w[F]||R<0?(i.encode(R,d.slice(D,D+F)),!0):(A(d,D,F,R),!1),A=(d,D,F,R)=>d.write(S(R,F),D,F,"ascii"),S=(d,D)=>v(Math.floor(d).toString(8),D),v=(d,D)=>(d.length===D-1?d:new Array(D-d.length-1).join("0")+d+" ")+"\0",o=(d,D,F,R)=>R===null?!1:b(d,D,F,R.getTime()/1e3),l=new Array(156).join("\0"),f=(d,D,F,R)=>R===null?!1:(d.write(R+l,D,F,"utf8"),R.length!==Buffer.byteLength(R)||R.length>F);return Vt=a,Vt}var Kt,Hi;function Yt(){if(Hi)return Kt;Hi=1;const s=Me(),t=fe;class i{constructor(u,h){this.atime=u.atime||null,this.charset=u.charset||null,this.comment=u.comment||null,this.ctime=u.ctime||null,this.gid=u.gid||null,this.gname=u.gname||null,this.linkpath=u.linkpath||null,this.mtime=u.mtime||null,this.path=u.path||null,this.size=u.size||null,this.uid=u.uid||null,this.uname=u.uname||null,this.dev=u.dev||null,this.ino=u.ino||null,this.nlink=u.nlink||null,this.global=h||!1}encode(){const u=this.encodeBody();if(u==="")return null;const h=Buffer.byteLength(u),m=512*Math.ceil(1+h/512),y=Buffer.allocUnsafe(m);for(let p=0;p<512;p++)y[p]=0;new s({path:("PaxHeader/"+t.basename(this.path)).slice(0,99),mode:this.mode||420,uid:this.uid||null,gid:this.gid||null,size:h,mtime:this.mtime||null,type:this.global?"GlobalExtendedHeader":"ExtendedHeader",linkpath:"",uname:this.uname||"",gname:this.gname||"",devmaj:0,devmin:0,atime:this.atime||null,ctime:this.ctime||null}).encode(y),y.write(u,512,h,"utf8");for(let p=h+512;p<y.length;p++)y[p]=0;return y}encodeBody(){return this.encodeField("path")+this.encodeField("ctime")+this.encodeField("atime")+this.encodeField("dev")+this.encodeField("ino")+this.encodeField("nlink")+this.encodeField("charset")+this.encodeField("comment")+this.encodeField("gid")+this.encodeField("gname")+this.encodeField("linkpath")+this.encodeField("mtime")+this.encodeField("size")+this.encodeField("uid")+this.encodeField("uname")}encodeField(u){if(this[u]===null||this[u]===void 0)return"";const h=this[u]instanceof Date?this[u].getTime()/1e3:this[u],m=" "+(u==="dev"||u==="ino"||u==="nlink"?"SCHILY.":"")+u+"="+h+`
89
- `,y=Buffer.byteLength(m);let p=Math.floor(Math.log(y)/Math.log(10))+1;return y+p>=Math.pow(10,p)&&(p+=1),p+y+m}}i.parse=(e,u,h)=>new i(n(r(e),u),h);const n=(e,u)=>u?Object.keys(e).reduce((h,m)=>(h[m]=e[m],h),u):e,r=e=>e.replace(/\n$/,"").split(`
90
- `).reduce(a,Object.create(null)),a=(e,u)=>{const h=parseInt(u,10);if(h!==Buffer.byteLength(u)+1)return e;u=u.slice((h+" ").length);const m=u.split("="),y=m.shift().replace(/^SCHILY\.(dev|ino|nlink)/,"$1");if(!y)return e;const p=m.join("=");return e[y]=/^([A-Z]+\.)?([mac]|birth|creation)time$/.test(y)?new Date(p*1e3):/^[0-9]+$/.test(p)?+p:p,e};return Kt=i,Kt}var Zt,Ui;function ke(){return Ui||(Ui=1,Zt=s=>{let t=s.length-1,i=-1;for(;t>-1&&s.charAt(t)==="/";)i=t,t--;return i===-1?s:s.slice(0,i)}),Zt}var Xt,zi;function Jt(){return zi||(zi=1,Xt=s=>class extends s{warn(t,i,n={}){this.file&&(n.file=this.file),this.cwd&&(n.cwd=this.cwd),n.code=i instanceof Error&&i.code||t,n.tarCode=t,!this.strict&&n.recoverable!==!1?(i instanceof Error&&(n=Object.assign(i,n),i=i.message),this.emit("warn",n.tarCode,i,n)):i instanceof Error?this.emit("error",Object.assign(i,n)):this.emit("error",Object.assign(new Error(`${t}: ${i}`),n))}}),Xt}var Qt,Gi;function qi(){if(Gi)return Qt;Gi=1;const s=["|","<",">","?",":"],t=s.map(r=>String.fromCharCode(61440+r.charCodeAt(0))),i=new Map(s.map((r,a)=>[r,t[a]])),n=new Map(t.map((r,a)=>[r,s[a]]));return Qt={encode:r=>s.reduce((a,e)=>a.split(e).join(i.get(e)),r),decode:r=>t.reduce((a,e)=>a.split(e).join(n.get(e)),r)},Qt}var es,Wi;function Vi(){if(Wi)return es;Wi=1;const{isAbsolute:s,parse:t}=fe.win32;return es=i=>{let n="",r=t(i);for(;s(i)||r.root;){const a=i.charAt(0)==="/"&&i.slice(0,4)!=="//?/"?"/":r.root;i=i.slice(a.length),n+=a,r=t(i)}return[n,i]},es}var ts,Ki;function vu(){return Ki||(Ki=1,ts=(s,t,i)=>(s&=4095,i&&(s=(s|384)&-19),t&&(s&256&&(s|=64),s&32&&(s|=8),s&4&&(s|=1)),s)),ts}var ss,Yi;function Zi(){if(Yi)return ss;Yi=1;const{Minipass:s}=kt(),t=Yt(),i=Me(),n=Ce,r=fe,a=Pe(),e=ke(),u=(_,c)=>c?(_=a(_).replace(/^\.(\/|$)/,""),e(c)+"/"+_):a(_),h=16*1024*1024,m=Symbol("process"),y=Symbol("file"),p=Symbol("directory"),C=Symbol("symlink"),w=Symbol("hardlink"),b=Symbol("header"),A=Symbol("read"),S=Symbol("lstat"),v=Symbol("onlstat"),o=Symbol("onread"),l=Symbol("onreadlink"),f=Symbol("openfile"),d=Symbol("onopenfile"),D=Symbol("close"),F=Symbol("mode"),R=Symbol("awaitDrain"),B=Symbol("ondrain"),x=Symbol("prefix"),P=Symbol("hadError"),M=Jt(),U=qi(),G=Vi(),Y=vu(),N=M(class extends s{constructor(c,g){if(g=g||{},super(g),typeof c!="string")throw new TypeError("path is required");this.path=a(c),this.portable=!!g.portable,this.myuid=process.getuid&&process.getuid()||0,this.myuser=process.env.USER||"",this.maxReadSize=g.maxReadSize||h,this.linkCache=g.linkCache||new Map,this.statCache=g.statCache||new Map,this.preservePaths=!!g.preservePaths,this.cwd=a(g.cwd||process.cwd()),this.strict=!!g.strict,this.noPax=!!g.noPax,this.noMtime=!!g.noMtime,this.mtime=g.mtime||null,this.prefix=g.prefix?a(g.prefix):null,this.fd=null,this.blockLen=null,this.blockRemain=null,this.buf=null,this.offset=null,this.length=null,this.pos=null,this.remain=null,typeof g.onwarn=="function"&&this.on("warn",g.onwarn);let L=!1;if(!this.preservePaths){const[j,J]=G(this.path);j&&(this.path=J,L=j)}this.win32=!!g.win32||process.platform==="win32",this.win32&&(this.path=U.decode(this.path.replace(/\\/g,"/")),c=c.replace(/\\/g,"/")),this.absolute=a(g.absolute||r.resolve(this.cwd,c)),this.path===""&&(this.path="./"),L&&this.warn("TAR_ENTRY_INFO",`stripping ${L} from absolute path`,{entry:this,path:L+this.path}),this.statCache.has(this.absolute)?this[v](this.statCache.get(this.absolute)):this[S]()}emit(c,...g){return c==="error"&&(this[P]=!0),super.emit(c,...g)}[S](){n.lstat(this.absolute,(c,g)=>{if(c)return this.emit("error",c);this[v](g)})}[v](c){this.statCache.set(this.absolute,c),this.stat=c,c.isFile()||(c.size=0),this.type=te(c),this.emit("stat",c),this[m]()}[m](){switch(this.type){case"File":return this[y]();case"Directory":return this[p]();case"SymbolicLink":return this[C]();default:return this.end()}}[F](c){return Y(c,this.type==="Directory",this.portable)}[x](c){return u(c,this.prefix)}[b](){this.type==="Directory"&&this.portable&&(this.noMtime=!0),this.header=new i({path:this[x](this.path),linkpath:this.type==="Link"?this[x](this.linkpath):this.linkpath,mode:this[F](this.stat.mode),uid:this.portable?null:this.stat.uid,gid:this.portable?null:this.stat.gid,size:this.stat.size,mtime:this.noMtime?null:this.mtime||this.stat.mtime,type:this.type,uname:this.portable?null:this.stat.uid===this.myuid?this.myuser:"",atime:this.portable?null:this.stat.atime,ctime:this.portable?null:this.stat.ctime}),this.header.encode()&&!this.noPax&&super.write(new t({atime:this.portable?null:this.header.atime,ctime:this.portable?null:this.header.ctime,gid:this.portable?null:this.header.gid,mtime:this.noMtime?null:this.mtime||this.header.mtime,path:this[x](this.path),linkpath:this.type==="Link"?this[x](this.linkpath):this.linkpath,size:this.header.size,uid:this.portable?null:this.header.uid,uname:this.portable?null:this.header.uname,dev:this.portable?null:this.stat.dev,ino:this.portable?null:this.stat.ino,nlink:this.portable?null:this.stat.nlink}).encode()),super.write(this.header.block)}[p](){this.path.slice(-1)!=="/"&&(this.path+="/"),this.stat.size=0,this[b](),this.end()}[C](){n.readlink(this.absolute,(c,g)=>{if(c)return this.emit("error",c);this[l](g)})}[l](c){this.linkpath=a(c),this[b](),this.end()}[w](c){this.type="Link",this.linkpath=a(r.relative(this.cwd,c)),this.stat.size=0,this[b](),this.end()}[y](){if(this.stat.nlink>1){const c=this.stat.dev+":"+this.stat.ino;if(this.linkCache.has(c)){const g=this.linkCache.get(c);if(g.indexOf(this.cwd)===0)return this[w](g)}this.linkCache.set(c,this.absolute)}if(this[b](),this.stat.size===0)return this.end();this[f]()}[f](){n.open(this.absolute,"r",(c,g)=>{if(c)return this.emit("error",c);this[d](g)})}[d](c){if(this.fd=c,this[P])return this[D]();this.blockLen=512*Math.ceil(this.stat.size/512),this.blockRemain=this.blockLen;const g=Math.min(this.blockLen,this.maxReadSize);this.buf=Buffer.allocUnsafe(g),this.offset=0,this.pos=0,this.remain=this.stat.size,this.length=this.buf.length,this[A]()}[A](){const{fd:c,buf:g,offset:L,length:j,pos:J}=this;n.read(c,g,L,j,J,($,q)=>{if($)return this[D](()=>this.emit("error",$));this[o](q)})}[D](c){n.close(this.fd,c)}[o](c){if(c<=0&&this.remain>0){const j=new Error("encountered unexpected EOF");return j.path=this.absolute,j.syscall="read",j.code="EOF",this[D](()=>this.emit("error",j))}if(c>this.remain){const j=new Error("did not encounter expected EOF");return j.path=this.absolute,j.syscall="read",j.code="EOF",this[D](()=>this.emit("error",j))}if(c===this.remain)for(let j=c;j<this.length&&c<this.blockRemain;j++)this.buf[j+this.offset]=0,c++,this.remain++;const g=this.offset===0&&c===this.buf.length?this.buf:this.buf.slice(this.offset,this.offset+c);this.write(g)?this[B]():this[R](()=>this[B]())}[R](c){this.once("drain",c)}write(c){if(this.blockRemain<c.length){const g=new Error("writing more data than expected");return g.path=this.absolute,this.emit("error",g)}return this.remain-=c.length,this.blockRemain-=c.length,this.pos+=c.length,this.offset+=c.length,super.write(c)}[B](){if(!this.remain)return this.blockRemain&&super.write(Buffer.alloc(this.blockRemain)),this[D](c=>c?this.emit("error",c):this.end());this.offset>=this.length&&(this.buf=Buffer.allocUnsafe(Math.min(this.blockRemain,this.buf.length)),this.offset=0),this.length=this.buf.length-this.offset,this[A]()}});class W extends N{[S](){this[v](n.lstatSync(this.absolute))}[C](){this[l](n.readlinkSync(this.absolute))}[f](){this[d](n.openSync(this.absolute,"r"))}[A](){let c=!0;try{const{fd:g,buf:L,offset:j,length:J,pos:$}=this,q=n.readSync(g,L,j,J,$);this[o](q),c=!1}finally{if(c)try{this[D](()=>{})}catch{}}}[R](c){c()}[D](c){n.closeSync(this.fd),c()}}const V=M(class extends s{constructor(c,g){g=g||{},super(g),this.preservePaths=!!g.preservePaths,this.portable=!!g.portable,this.strict=!!g.strict,this.noPax=!!g.noPax,this.noMtime=!!g.noMtime,this.readEntry=c,this.type=c.type,this.type==="Directory"&&this.portable&&(this.noMtime=!0),this.prefix=g.prefix||null,this.path=a(c.path),this.mode=this[F](c.mode),this.uid=this.portable?null:c.uid,this.gid=this.portable?null:c.gid,this.uname=this.portable?null:c.uname,this.gname=this.portable?null:c.gname,this.size=c.size,this.mtime=this.noMtime?null:g.mtime||c.mtime,this.atime=this.portable?null:c.atime,this.ctime=this.portable?null:c.ctime,this.linkpath=a(c.linkpath),typeof g.onwarn=="function"&&this.on("warn",g.onwarn);let L=!1;if(!this.preservePaths){const[j,J]=G(this.path);j&&(this.path=J,L=j)}this.remain=c.size,this.blockRemain=c.startBlockSize,this.header=new i({path:this[x](this.path),linkpath:this.type==="Link"?this[x](this.linkpath):this.linkpath,mode:this.mode,uid:this.portable?null:this.uid,gid:this.portable?null:this.gid,size:this.size,mtime:this.noMtime?null:this.mtime,type:this.type,uname:this.portable?null:this.uname,atime:this.portable?null:this.atime,ctime:this.portable?null:this.ctime}),L&&this.warn("TAR_ENTRY_INFO",`stripping ${L} from absolute path`,{entry:this,path:L+this.path}),this.header.encode()&&!this.noPax&&super.write(new t({atime:this.portable?null:this.atime,ctime:this.portable?null:this.ctime,gid:this.portable?null:this.gid,mtime:this.noMtime?null:this.mtime,path:this[x](this.path),linkpath:this.type==="Link"?this[x](this.linkpath):this.linkpath,size:this.size,uid:this.portable?null:this.uid,uname:this.portable?null:this.uname,dev:this.portable?null:this.readEntry.dev,ino:this.portable?null:this.readEntry.ino,nlink:this.portable?null:this.readEntry.nlink}).encode()),super.write(this.header.block),c.pipe(this)}[x](c){return u(c,this.prefix)}[F](c){return Y(c,this.type==="Directory",this.portable)}write(c){const g=c.length;if(g>this.blockRemain)throw new Error("writing more to entry than is appropriate");return this.blockRemain-=g,super.write(c)}end(){return this.blockRemain&&super.write(Buffer.alloc(this.blockRemain)),super.end()}});N.Sync=W,N.Tar=V;const te=_=>_.isFile()?"File":_.isDirectory()?"Directory":_.isSymbolicLink()?"SymbolicLink":"Unsupported";return ss=N,ss}var is,Xi;function Au(){return Xi||(Xi=1,is=function(s){s.prototype[Symbol.iterator]=function*(){for(let t=this.head;t;t=t.next)yield t.value}}),is}var rs,Ji;function Qi(){if(Ji)return rs;Ji=1,rs=s,s.Node=r,s.create=s;function s(a){var e=this;if(e instanceof s||(e=new s),e.tail=null,e.head=null,e.length=0,a&&typeof a.forEach=="function")a.forEach(function(m){e.push(m)});else if(arguments.length>0)for(var u=0,h=arguments.length;u<h;u++)e.push(arguments[u]);return e}s.prototype.removeNode=function(a){if(a.list!==this)throw new Error("removing node which does not belong to this list");var e=a.next,u=a.prev;return e&&(e.prev=u),u&&(u.next=e),a===this.head&&(this.head=e),a===this.tail&&(this.tail=u),a.list.length--,a.next=null,a.prev=null,a.list=null,e},s.prototype.unshiftNode=function(a){if(a!==this.head){a.list&&a.list.removeNode(a);var e=this.head;a.list=this,a.next=e,e&&(e.prev=a),this.head=a,this.tail||(this.tail=a),this.length++}},s.prototype.pushNode=function(a){if(a!==this.tail){a.list&&a.list.removeNode(a);var e=this.tail;a.list=this,a.prev=e,e&&(e.next=a),this.tail=a,this.head||(this.head=a),this.length++}},s.prototype.push=function(){for(var a=0,e=arguments.length;a<e;a++)i(this,arguments[a]);return this.length},s.prototype.unshift=function(){for(var a=0,e=arguments.length;a<e;a++)n(this,arguments[a]);return this.length},s.prototype.pop=function(){if(this.tail){var a=this.tail.value;return this.tail=this.tail.prev,this.tail?this.tail.next=null:this.head=null,this.length--,a}},s.prototype.shift=function(){if(this.head){var a=this.head.value;return this.head=this.head.next,this.head?this.head.prev=null:this.tail=null,this.length--,a}},s.prototype.forEach=function(a,e){e=e||this;for(var u=this.head,h=0;u!==null;h++)a.call(e,u.value,h,this),u=u.next},s.prototype.forEachReverse=function(a,e){e=e||this;for(var u=this.tail,h=this.length-1;u!==null;h--)a.call(e,u.value,h,this),u=u.prev},s.prototype.get=function(a){for(var e=0,u=this.head;u!==null&&e<a;e++)u=u.next;if(e===a&&u!==null)return u.value},s.prototype.getReverse=function(a){for(var e=0,u=this.tail;u!==null&&e<a;e++)u=u.prev;if(e===a&&u!==null)return u.value},s.prototype.map=function(a,e){e=e||this;for(var u=new s,h=this.head;h!==null;)u.push(a.call(e,h.value,this)),h=h.next;return u},s.prototype.mapReverse=function(a,e){e=e||this;for(var u=new s,h=this.tail;h!==null;)u.push(a.call(e,h.value,this)),h=h.prev;return u},s.prototype.reduce=function(a,e){var u,h=this.head;if(arguments.length>1)u=e;else if(this.head)h=this.head.next,u=this.head.value;else throw new TypeError("Reduce of empty list with no initial value");for(var m=0;h!==null;m++)u=a(u,h.value,m),h=h.next;return u},s.prototype.reduceReverse=function(a,e){var u,h=this.tail;if(arguments.length>1)u=e;else if(this.tail)h=this.tail.prev,u=this.tail.value;else throw new TypeError("Reduce of empty list with no initial value");for(var m=this.length-1;h!==null;m--)u=a(u,h.value,m),h=h.prev;return u},s.prototype.toArray=function(){for(var a=new Array(this.length),e=0,u=this.head;u!==null;e++)a[e]=u.value,u=u.next;return a},s.prototype.toArrayReverse=function(){for(var a=new Array(this.length),e=0,u=this.tail;u!==null;e++)a[e]=u.value,u=u.prev;return a},s.prototype.slice=function(a,e){e=e||this.length,e<0&&(e+=this.length),a=a||0,a<0&&(a+=this.length);var u=new s;if(e<a||e<0)return u;a<0&&(a=0),e>this.length&&(e=this.length);for(var h=0,m=this.head;m!==null&&h<a;h++)m=m.next;for(;m!==null&&h<e;h++,m=m.next)u.push(m.value);return u},s.prototype.sliceReverse=function(a,e){e=e||this.length,e<0&&(e+=this.length),a=a||0,a<0&&(a+=this.length);var u=new s;if(e<a||e<0)return u;a<0&&(a=0),e>this.length&&(e=this.length);for(var h=this.length,m=this.tail;m!==null&&h>e;h--)m=m.prev;for(;m!==null&&h>a;h--,m=m.prev)u.push(m.value);return u},s.prototype.splice=function(a,e,...u){a>this.length&&(a=this.length-1),a<0&&(a=this.length+a);for(var h=0,m=this.head;m!==null&&h<a;h++)m=m.next;for(var y=[],h=0;m&&h<e;h++)y.push(m.value),m=this.removeNode(m);m===null&&(m=this.tail),m!==this.head&&m!==this.tail&&(m=m.prev);for(var h=0;h<u.length;h++)m=t(this,m,u[h]);return y},s.prototype.reverse=function(){for(var a=this.head,e=this.tail,u=a;u!==null;u=u.prev){var h=u.prev;u.prev=u.next,u.next=h}return this.head=e,this.tail=a,this};function t(a,e,u){var h=e===a.head?new r(u,null,e,a):new r(u,e,e.next,a);return h.next===null&&(a.tail=h),h.prev===null&&(a.head=h),a.length++,h}function i(a,e){a.tail=new r(e,a.tail,null,a),a.head||(a.head=a.tail),a.length++}function n(a,e){a.head=new r(e,null,a.head,a),a.tail||(a.tail=a.head),a.length++}function r(a,e,u,h){if(!(this instanceof r))return new r(a,e,u,h);this.list=h,this.value=a,e?(e.next=this,this.prev=e):this.prev=null,u?(u.prev=this,this.next=u):this.next=null}try{Au()(s)}catch{}return rs}var ns,er;function us(){if(er)return ns;er=1;class s{constructor(_,c){this.path=_||"./",this.absolute=c,this.entry=null,this.stat=null,this.readdir=null,this.pending=!1,this.ignore=!1,this.piped=!1}}const{Minipass:t}=kt(),i=Ni(),n=Gt(),r=Zi(),a=r.Sync,e=r.Tar,u=Qi(),h=Buffer.alloc(1024),m=Symbol("onStat"),y=Symbol("ended"),p=Symbol("queue"),C=Symbol("current"),w=Symbol("process"),b=Symbol("processing"),A=Symbol("processJob"),S=Symbol("jobs"),v=Symbol("jobDone"),o=Symbol("addFSEntry"),l=Symbol("addTarEntry"),f=Symbol("stat"),d=Symbol("readdir"),D=Symbol("onreaddir"),F=Symbol("pipe"),R=Symbol("entry"),B=Symbol("entryOpt"),x=Symbol("writeEntryClass"),P=Symbol("write"),M=Symbol("ondrain"),U=Ce,G=fe,Y=Jt(),N=Pe(),W=Y(class extends t{constructor(_){if(super(_),_=_||Object.create(null),this.opt=_,this.file=_.file||"",this.cwd=_.cwd||process.cwd(),this.maxReadSize=_.maxReadSize,this.preservePaths=!!_.preservePaths,this.strict=!!_.strict,this.noPax=!!_.noPax,this.prefix=N(_.prefix||""),this.linkCache=_.linkCache||new Map,this.statCache=_.statCache||new Map,this.readdirCache=_.readdirCache||new Map,this[x]=r,typeof _.onwarn=="function"&&this.on("warn",_.onwarn),this.portable=!!_.portable,this.zip=null,_.gzip||_.brotli){if(_.gzip&&_.brotli)throw new TypeError("gzip and brotli are mutually exclusive");_.gzip&&(typeof _.gzip!="object"&&(_.gzip={}),this.portable&&(_.gzip.portable=!0),this.zip=new i.Gzip(_.gzip)),_.brotli&&(typeof _.brotli!="object"&&(_.brotli={}),this.zip=new i.BrotliCompress(_.brotli)),this.zip.on("data",c=>super.write(c)),this.zip.on("end",c=>super.end()),this.zip.on("drain",c=>this[M]()),this.on("resume",c=>this.zip.resume())}else this.on("drain",this[M]);this.noDirRecurse=!!_.noDirRecurse,this.follow=!!_.follow,this.noMtime=!!_.noMtime,this.mtime=_.mtime||null,this.filter=typeof _.filter=="function"?_.filter:c=>!0,this[p]=new u,this[S]=0,this.jobs=+_.jobs||4,this[b]=!1,this[y]=!1}[P](_){return super.write(_)}add(_){return this.write(_),this}end(_){return _&&this.write(_),this[y]=!0,this[w](),this}write(_){if(this[y])throw new Error("write after end");return _ instanceof n?this[l](_):this[o](_),this.flowing}[l](_){const c=N(G.resolve(this.cwd,_.path));if(!this.filter(_.path,_))_.resume();else{const g=new s(_.path,c,!1);g.entry=new e(_,this[B](g)),g.entry.on("end",L=>this[v](g)),this[S]+=1,this[p].push(g)}this[w]()}[o](_){const c=N(G.resolve(this.cwd,_));this[p].push(new s(_,c)),this[w]()}[f](_){_.pending=!0,this[S]+=1;const c=this.follow?"stat":"lstat";U[c](_.absolute,(g,L)=>{_.pending=!1,this[S]-=1,g?this.emit("error",g):this[m](_,L)})}[m](_,c){this.statCache.set(_.absolute,c),_.stat=c,this.filter(_.path,c)||(_.ignore=!0),this[w]()}[d](_){_.pending=!0,this[S]+=1,U.readdir(_.absolute,(c,g)=>{if(_.pending=!1,this[S]-=1,c)return this.emit("error",c);this[D](_,g)})}[D](_,c){this.readdirCache.set(_.absolute,c),_.readdir=c,this[w]()}[w](){if(!this[b]){this[b]=!0;for(let _=this[p].head;_!==null&&this[S]<this.jobs;_=_.next)if(this[A](_.value),_.value.ignore){const c=_.next;this[p].removeNode(_),_.next=c}this[b]=!1,this[y]&&!this[p].length&&this[S]===0&&(this.zip?this.zip.end(h):(super.write(h),super.end()))}}get[C](){return this[p]&&this[p].head&&this[p].head.value}[v](_){this[p].shift(),this[S]-=1,this[w]()}[A](_){if(!_.pending){if(_.entry){_===this[C]&&!_.piped&&this[F](_);return}if(_.stat||(this.statCache.has(_.absolute)?this[m](_,this.statCache.get(_.absolute)):this[f](_)),!!_.stat&&!_.ignore&&!(!this.noDirRecurse&&_.stat.isDirectory()&&!_.readdir&&(this.readdirCache.has(_.absolute)?this[D](_,this.readdirCache.get(_.absolute)):this[d](_),!_.readdir))){if(_.entry=this[R](_),!_.entry){_.ignore=!0;return}_===this[C]&&!_.piped&&this[F](_)}}}[B](_){return{onwarn:(c,g,L)=>this.warn(c,g,L),noPax:this.noPax,cwd:this.cwd,absolute:_.absolute,preservePaths:this.preservePaths,maxReadSize:this.maxReadSize,strict:this.strict,portable:this.portable,linkCache:this.linkCache,statCache:this.statCache,noMtime:this.noMtime,mtime:this.mtime,prefix:this.prefix}}[R](_){this[S]+=1;try{return new this[x](_.path,this[B](_)).on("end",()=>this[v](_)).on("error",c=>this.emit("error",c))}catch(c){this.emit("error",c)}}[M](){this[C]&&this[C].entry&&this[C].entry.resume()}[F](_){_.piped=!0,_.readdir&&_.readdir.forEach(L=>{const j=_.path,J=j==="./"?"":j.replace(/\/*$/,"/");this[o](J+L)});const c=_.entry,g=this.zip;g?c.on("data",L=>{g.write(L)||c.pause()}):c.on("data",L=>{super.write(L)||c.pause()})}pause(){return this.zip&&this.zip.pause(),super.pause()}});class V extends W{constructor(_){super(_),this[x]=a}pause(){}resume(){}[f](_){const c=this.follow?"statSync":"lstatSync";this[m](_,U[c](_.absolute))}[d](_,c){this[D](_,U.readdirSync(_.absolute))}[F](_){const c=_.entry,g=this.zip;_.readdir&&_.readdir.forEach(L=>{const j=_.path,J=j==="./"?"":j.replace(/\/*$/,"/");this[o](J+L)}),g?c.on("data",L=>{g.write(L)}):c.on("data",L=>{super[P](L)})}}return W.Sync=V,ns=W,ns}var Be={},tr;function je(){if(tr)return Be;tr=1;const s=Ti(),t=Te.EventEmitter,i=Ce;let n=i.writev;if(!n){const _=process.binding("fs"),c=_.FSReqWrap||_.FSReqCallback;n=(g,L,j,J)=>{const $=(z,O)=>J(z,O,L),q=new c;q.oncomplete=$,_.writeBuffers(g,L,j,q)}}const r=Symbol("_autoClose"),a=Symbol("_close"),e=Symbol("_ended"),u=Symbol("_fd"),h=Symbol("_finished"),m=Symbol("_flags"),y=Symbol("_flush"),p=Symbol("_handleChunk"),C=Symbol("_makeBuf"),w=Symbol("_mode"),b=Symbol("_needDrain"),A=Symbol("_onerror"),S=Symbol("_onopen"),v=Symbol("_onread"),o=Symbol("_onwrite"),l=Symbol("_open"),f=Symbol("_path"),d=Symbol("_pos"),D=Symbol("_queue"),F=Symbol("_read"),R=Symbol("_readSize"),B=Symbol("_reading"),x=Symbol("_remain"),P=Symbol("_size"),M=Symbol("_write"),U=Symbol("_writing"),G=Symbol("_defaultFlag"),Y=Symbol("_errored");class N extends s{constructor(c,g){if(g=g||{},super(g),this.readable=!0,this.writable=!1,typeof c!="string")throw new TypeError("path must be a string");this[Y]=!1,this[u]=typeof g.fd=="number"?g.fd:null,this[f]=c,this[R]=g.readSize||16*1024*1024,this[B]=!1,this[P]=typeof g.size=="number"?g.size:1/0,this[x]=this[P],this[r]=typeof g.autoClose=="boolean"?g.autoClose:!0,typeof this[u]=="number"?this[F]():this[l]()}get fd(){return this[u]}get path(){return this[f]}write(){throw new TypeError("this is a readable stream")}end(){throw new TypeError("this is a readable stream")}[l](){i.open(this[f],"r",(c,g)=>this[S](c,g))}[S](c,g){c?this[A](c):(this[u]=g,this.emit("open",g),this[F]())}[C](){return Buffer.allocUnsafe(Math.min(this[R],this[x]))}[F](){if(!this[B]){this[B]=!0;const c=this[C]();if(c.length===0)return process.nextTick(()=>this[v](null,0,c));i.read(this[u],c,0,c.length,null,(g,L,j)=>this[v](g,L,j))}}[v](c,g,L){this[B]=!1,c?this[A](c):this[p](g,L)&&this[F]()}[a](){if(this[r]&&typeof this[u]=="number"){const c=this[u];this[u]=null,i.close(c,g=>g?this.emit("error",g):this.emit("close"))}}[A](c){this[B]=!0,this[a](),this.emit("error",c)}[p](c,g){let L=!1;return this[x]-=c,c>0&&(L=super.write(c<g.length?g.slice(0,c):g)),(c===0||this[x]<=0)&&(L=!1,this[a](),super.end()),L}emit(c,g){switch(c){case"prefinish":case"finish":break;case"drain":typeof this[u]=="number"&&this[F]();break;case"error":return this[Y]?void 0:(this[Y]=!0,super.emit(c,g));default:return super.emit(c,g)}}}class W extends N{[l](){let c=!0;try{this[S](null,i.openSync(this[f],"r")),c=!1}finally{c&&this[a]()}}[F](){let c=!0;try{if(!this[B]){this[B]=!0;do{const g=this[C](),L=g.length===0?0:i.readSync(this[u],g,0,g.length,null);if(!this[p](L,g))break}while(!0);this[B]=!1}c=!1}finally{c&&this[a]()}}[a](){if(this[r]&&typeof this[u]=="number"){const c=this[u];this[u]=null,i.closeSync(c),this.emit("close")}}}class V extends t{constructor(c,g){g=g||{},super(g),this.readable=!1,this.writable=!0,this[Y]=!1,this[U]=!1,this[e]=!1,this[b]=!1,this[D]=[],this[f]=c,this[u]=typeof g.fd=="number"?g.fd:null,this[w]=g.mode===void 0?438:g.mode,this[d]=typeof g.start=="number"?g.start:null,this[r]=typeof g.autoClose=="boolean"?g.autoClose:!0;const L=this[d]!==null?"r+":"w";this[G]=g.flags===void 0,this[m]=this[G]?L:g.flags,this[u]===null&&this[l]()}emit(c,g){if(c==="error"){if(this[Y])return;this[Y]=!0}return super.emit(c,g)}get fd(){return this[u]}get path(){return this[f]}[A](c){this[a](),this[U]=!0,this.emit("error",c)}[l](){i.open(this[f],this[m],this[w],(c,g)=>this[S](c,g))}[S](c,g){this[G]&&this[m]==="r+"&&c&&c.code==="ENOENT"?(this[m]="w",this[l]()):c?this[A](c):(this[u]=g,this.emit("open",g),this[y]())}end(c,g){return c&&this.write(c,g),this[e]=!0,!this[U]&&!this[D].length&&typeof this[u]=="number"&&this[o](null,0),this}write(c,g){return typeof c=="string"&&(c=Buffer.from(c,g)),this[e]?(this.emit("error",new Error("write() after end()")),!1):this[u]===null||this[U]||this[D].length?(this[D].push(c),this[b]=!0,!1):(this[U]=!0,this[M](c),!0)}[M](c){i.write(this[u],c,0,c.length,this[d],(g,L)=>this[o](g,L))}[o](c,g){c?this[A](c):(this[d]!==null&&(this[d]+=g),this[D].length?this[y]():(this[U]=!1,this[e]&&!this[h]?(this[h]=!0,this[a](),this.emit("finish")):this[b]&&(this[b]=!1,this.emit("drain"))))}[y](){if(this[D].length===0)this[e]&&this[o](null,0);else if(this[D].length===1)this[M](this[D].pop());else{const c=this[D];this[D]=[],n(this[u],c,this[d],(g,L)=>this[o](g,L))}}[a](){if(this[r]&&typeof this[u]=="number"){const c=this[u];this[u]=null,i.close(c,g=>g?this.emit("error",g):this.emit("close"))}}}class te extends V{[l](){let c;if(this[G]&&this[m]==="r+")try{c=i.openSync(this[f],this[m],this[w])}catch(g){if(g.code==="ENOENT")return this[m]="w",this[l]();throw g}else c=i.openSync(this[f],this[m],this[w]);this[S](null,c)}[a](){if(this[r]&&typeof this[u]=="number"){const c=this[u];this[u]=null,i.closeSync(c),this.emit("close")}}[M](c){let g=!0;try{this[o](null,i.writeSync(this[u],c,0,c.length,this[d])),g=!1}finally{if(g)try{this[a]()}catch{}}}}return Be.ReadStream=N,Be.ReadStreamSync=W,Be.WriteStream=V,Be.WriteStreamSync=te,Be}var os,sr;function as(){if(sr)return os;sr=1;const s=Jt(),t=Me(),i=Te,n=Qi(),r=1024*1024,a=Gt(),e=Yt(),u=Ni(),{nextTick:h}=Ns,m=Buffer.from([31,139]),y=Symbol("state"),p=Symbol("writeEntry"),C=Symbol("readEntry"),w=Symbol("nextEntry"),b=Symbol("processEntry"),A=Symbol("extendedHeader"),S=Symbol("globalExtendedHeader"),v=Symbol("meta"),o=Symbol("emitMeta"),l=Symbol("buffer"),f=Symbol("queue"),d=Symbol("ended"),D=Symbol("emittedEnd"),F=Symbol("emit"),R=Symbol("unzip"),B=Symbol("consumeChunk"),x=Symbol("consumeChunkSub"),P=Symbol("consumeBody"),M=Symbol("consumeMeta"),U=Symbol("consumeHeader"),G=Symbol("consuming"),Y=Symbol("bufferConcat"),N=Symbol("maybeEnd"),W=Symbol("writing"),V=Symbol("aborted"),te=Symbol("onDone"),_=Symbol("sawValidEntry"),c=Symbol("sawNullBlock"),g=Symbol("sawEOF"),L=Symbol("closeStream"),j=J=>!0;return os=s(class extends i{constructor($){$=$||{},super($),this.file=$.file||"",this[_]=null,this.on(te,z=>{(this[y]==="begin"||this[_]===!1)&&this.warn("TAR_BAD_ARCHIVE","Unrecognized archive format")}),$.ondone?this.on(te,$.ondone):this.on(te,z=>{this.emit("prefinish"),this.emit("finish"),this.emit("end")}),this.strict=!!$.strict,this.maxMetaEntrySize=$.maxMetaEntrySize||r,this.filter=typeof $.filter=="function"?$.filter:j;const q=$.file&&($.file.endsWith(".tar.br")||$.file.endsWith(".tbr"));this.brotli=!$.gzip&&$.brotli!==void 0?$.brotli:q?void 0:!1,this.writable=!0,this.readable=!1,this[f]=new n,this[l]=null,this[C]=null,this[p]=null,this[y]="begin",this[v]="",this[A]=null,this[S]=null,this[d]=!1,this[R]=null,this[V]=!1,this[c]=!1,this[g]=!1,this.on("end",()=>this[L]()),typeof $.onwarn=="function"&&this.on("warn",$.onwarn),typeof $.onentry=="function"&&this.on("entry",$.onentry)}[U]($,q){this[_]===null&&(this[_]=!1);let z;try{z=new t($,q,this[A],this[S])}catch(O){return this.warn("TAR_ENTRY_INVALID",O)}if(z.nullBlock)this[c]?(this[g]=!0,this[y]==="begin"&&(this[y]="header"),this[F]("eof")):(this[c]=!0,this[F]("nullBlock"));else if(this[c]=!1,!z.cksumValid)this.warn("TAR_ENTRY_INVALID","checksum failure",{header:z});else if(!z.path)this.warn("TAR_ENTRY_INVALID","path is required",{header:z});else{const O=z.type;if(/^(Symbolic)?Link$/.test(O)&&!z.linkpath)this.warn("TAR_ENTRY_INVALID","linkpath required",{header:z});else if(!/^(Symbolic)?Link$/.test(O)&&z.linkpath)this.warn("TAR_ENTRY_INVALID","linkpath forbidden",{header:z});else{const T=this[p]=new a(z,this[A],this[S]);if(!this[_])if(T.remain){const K=()=>{T.invalid||(this[_]=!0)};T.on("end",K)}else this[_]=!0;T.meta?T.size>this.maxMetaEntrySize?(T.ignore=!0,this[F]("ignoredEntry",T),this[y]="ignore",T.resume()):T.size>0&&(this[v]="",T.on("data",K=>this[v]+=K),this[y]="meta"):(this[A]=null,T.ignore=T.ignore||!this.filter(T.path,T),T.ignore?(this[F]("ignoredEntry",T),this[y]=T.remain?"ignore":"header",T.resume()):(T.remain?this[y]="body":(this[y]="header",T.end()),this[C]?this[f].push(T):(this[f].push(T),this[w]())))}}}[L](){h(()=>this.emit("close"))}[b]($){let q=!0;return $?Array.isArray($)?this.emit.apply(this,$):(this[C]=$,this.emit("entry",$),$.emittedEnd||($.on("end",z=>this[w]()),q=!1)):(this[C]=null,q=!1),q}[w](){do;while(this[b](this[f].shift()));if(!this[f].length){const $=this[C];!$||$.flowing||$.size===$.remain?this[W]||this.emit("drain"):$.once("drain",z=>this.emit("drain"))}}[P]($,q){const z=this[p],O=z.blockRemain,T=O>=$.length&&q===0?$:$.slice(q,q+O);return z.write(T),z.blockRemain||(this[y]="header",this[p]=null,z.end()),T.length}[M]($,q){const z=this[p],O=this[P]($,q);return this[p]||this[o](z),O}[F]($,q,z){!this[f].length&&!this[C]?this.emit($,q,z):this[f].push([$,q,z])}[o]($){switch(this[F]("meta",this[v]),$.type){case"ExtendedHeader":case"OldExtendedHeader":this[A]=e.parse(this[v],this[A],!1);break;case"GlobalExtendedHeader":this[S]=e.parse(this[v],this[S],!0);break;case"NextFileHasLongPath":case"OldGnuLongPath":this[A]=this[A]||Object.create(null),this[A].path=this[v].replace(/\0.*/,"");break;case"NextFileHasLongLinkpath":this[A]=this[A]||Object.create(null),this[A].linkpath=this[v].replace(/\0.*/,"");break;default:throw new Error("unknown meta: "+$.type)}}abort($){this[V]=!0,this.emit("abort",$),this.warn("TAR_ABORT",$,{recoverable:!1})}write($){if(this[V])return;if((this[R]===null||this.brotli===void 0&&this[R]===!1)&&$){if(this[l]&&($=Buffer.concat([this[l],$]),this[l]=null),$.length<m.length)return this[l]=$,!0;for(let T=0;this[R]===null&&T<m.length;T++)$[T]!==m[T]&&(this[R]=!1);const O=this.brotli===void 0;if(this[R]===!1&&O)if($.length<512)if(this[d])this.brotli=!0;else return this[l]=$,!0;else try{new t($.slice(0,512)),this.brotli=!1}catch{this.brotli=!0}if(this[R]===null||this[R]===!1&&this.brotli){const T=this[d];this[d]=!1,this[R]=this[R]===null?new u.Unzip:new u.BrotliDecompress,this[R].on("data",ae=>this[B](ae)),this[R].on("error",ae=>this.abort(ae)),this[R].on("end",ae=>{this[d]=!0,this[B]()}),this[W]=!0;const K=this[R][T?"end":"write"]($);return this[W]=!1,K}}this[W]=!0,this[R]?this[R].write($):this[B]($),this[W]=!1;const z=this[f].length?!1:this[C]?this[C].flowing:!0;return!z&&!this[f].length&&this[C].once("drain",O=>this.emit("drain")),z}[Y]($){$&&!this[V]&&(this[l]=this[l]?Buffer.concat([this[l],$]):$)}[N](){if(this[d]&&!this[D]&&!this[V]&&!this[G]){this[D]=!0;const $=this[p];if($&&$.blockRemain){const q=this[l]?this[l].length:0;this.warn("TAR_BAD_ARCHIVE",`Truncated input (needed ${$.blockRemain} more bytes, only ${q} available)`,{entry:$}),this[l]&&$.write(this[l]),$.end()}this[F](te)}}[B]($){if(this[G])this[Y]($);else if(!$&&!this[l])this[N]();else{if(this[G]=!0,this[l]){this[Y]($);const q=this[l];this[l]=null,this[x](q)}else this[x]($);for(;this[l]&&this[l].length>=512&&!this[V]&&!this[g];){const q=this[l];this[l]=null,this[x](q)}this[G]=!1}(!this[l]||this[d])&&this[N]()}[x]($){let q=0;const z=$.length;for(;q+512<=z&&!this[V]&&!this[g];)switch(this[y]){case"begin":case"header":this[U]($,q),q+=512;break;case"ignore":case"body":q+=this[P]($,q);break;case"meta":q+=this[M]($,q);break;default:throw new Error("invalid state: "+this[y])}q<z&&(this[l]?this[l]=Buffer.concat([$.slice(q),this[l]]):this[l]=$.slice(q))}end($){this[V]||(this[R]?this[R].end($):(this[d]=!0,this.brotli===void 0&&($=$||Buffer.alloc(0)),this.write($)))}}),os}var hs,ir;function ls(){if(ir)return hs;ir=1;const s=Le(),t=as(),i=Ce,n=je(),r=fe,a=ke();hs=(p,C,w)=>{typeof p=="function"?(w=p,C=null,p={}):Array.isArray(p)&&(C=p,p={}),typeof C=="function"&&(w=C,C=null),C?C=Array.from(C):C=[];const b=s(p);if(b.sync&&typeof w=="function")throw new TypeError("callback not supported for sync tar functions");if(!b.file&&typeof w=="function")throw new TypeError("callback only supported with file option");return C.length&&u(b,C),b.noResume||e(b),b.file&&b.sync?h(b):b.file?m(b,w):y(b)};const e=p=>{const C=p.onentry;p.onentry=C?w=>{C(w),w.resume()}:w=>w.resume()},u=(p,C)=>{const w=new Map(C.map(S=>[a(S),!0])),b=p.filter,A=(S,v)=>{const o=v||r.parse(S).root||".",l=S===o?!1:w.has(S)?w.get(S):A(r.dirname(S),o);return w.set(S,l),l};p.filter=b?(S,v)=>b(S,v)&&A(a(S)):S=>A(a(S))},h=p=>{const C=y(p),w=p.file;let b=!0,A;try{const S=i.statSync(w),v=p.maxReadSize||16*1024*1024;if(S.size<v)C.end(i.readFileSync(w));else{let o=0;const l=Buffer.allocUnsafe(v);for(A=i.openSync(w,"r");o<S.size;){const f=i.readSync(A,l,0,v,o);o+=f,C.write(l.slice(0,f))}C.end()}b=!1}finally{if(b&&A)try{i.closeSync(A)}catch{}}},m=(p,C)=>{const w=new t(p),b=p.maxReadSize||16*1024*1024,A=p.file,S=new Promise((v,o)=>{w.on("error",o),w.on("end",v),i.stat(A,(l,f)=>{if(l)o(l);else{const d=new n.ReadStream(A,{readSize:b,size:f.size});d.on("error",o),d.pipe(w)}})});return C?S.then(C,C):S},y=p=>new t(p);return hs}var cs,rr;function Su(){if(rr)return cs;rr=1;const s=Le(),t=us(),i=je(),n=ls(),r=fe;cs=(p,C,w)=>{if(typeof C=="function"&&(w=C),Array.isArray(p)&&(C=p,p={}),!C||!Array.isArray(C)||!C.length)throw new TypeError("no files or directories specified");C=Array.from(C);const b=s(p);if(b.sync&&typeof w=="function")throw new TypeError("callback not supported for sync tar functions");if(!b.file&&typeof w=="function")throw new TypeError("callback only supported with file option");return b.file&&b.sync?a(b,C):b.file?e(b,C,w):b.sync?m(b,C):y(b,C)};const a=(p,C)=>{const w=new t.Sync(p),b=new i.WriteStreamSync(p.file,{mode:p.mode||438});w.pipe(b),u(w,C)},e=(p,C,w)=>{const b=new t(p),A=new i.WriteStream(p.file,{mode:p.mode||438});b.pipe(A);const S=new Promise((v,o)=>{A.on("error",o),A.on("close",v),b.on("error",o)});return h(b,C),w?S.then(w,w):S},u=(p,C)=>{C.forEach(w=>{w.charAt(0)==="@"?n({file:r.resolve(p.cwd,w.slice(1)),sync:!0,noResume:!0,onentry:b=>p.add(b)}):p.add(w)}),p.end()},h=(p,C)=>{for(;C.length;){const w=C.shift();if(w.charAt(0)==="@")return n({file:r.resolve(p.cwd,w.slice(1)),noResume:!0,onentry:b=>p.add(b)}).then(b=>h(p,C));p.add(w)}p.end()},m=(p,C)=>{const w=new t.Sync(p);return u(w,C),w},y=(p,C)=>{const w=new t(p);return h(w,C),w};return cs}var Ds,nr;function ur(){if(nr)return Ds;nr=1;const s=Le(),t=us(),i=Ce,n=je(),r=ls(),a=fe,e=Me();Ds=(C,w,b)=>{const A=s(C);if(!A.file)throw new TypeError("file is required");if(A.gzip||A.brotli||A.file.endsWith(".br")||A.file.endsWith(".tbr"))throw new TypeError("cannot append to compressed archives");if(!w||!Array.isArray(w)||!w.length)throw new TypeError("no files or directories specified");return w=Array.from(w),A.sync?u(A,w):m(A,w,b)};const u=(C,w)=>{const b=new t.Sync(C);let A=!0,S,v;try{try{S=i.openSync(C.file,"r+")}catch(f){if(f.code==="ENOENT")S=i.openSync(C.file,"w+");else throw f}const o=i.fstatSync(S),l=Buffer.alloc(512);e:for(v=0;v<o.size;v+=512){for(let D=0,F=0;D<512;D+=F){if(F=i.readSync(S,l,D,l.length-D,v+D),v===0&&l[0]===31&&l[1]===139)throw new Error("cannot append to compressed archives");if(!F)break e}const f=new e(l);if(!f.cksumValid)break;const d=512*Math.ceil(f.size/512);if(v+d+512>o.size)break;v+=d,C.mtimeCache&&C.mtimeCache.set(f.path,f.mtime)}A=!1,h(C,b,v,S,w)}finally{if(A)try{i.closeSync(S)}catch{}}},h=(C,w,b,A,S)=>{const v=new n.WriteStreamSync(C.file,{fd:A,start:b});w.pipe(v),y(w,S)},m=(C,w,b)=>{w=Array.from(w);const A=new t(C),S=(o,l,f)=>{const d=(x,P)=>{x?i.close(o,M=>f(x)):f(null,P)};let D=0;if(l===0)return d(null,0);let F=0;const R=Buffer.alloc(512),B=(x,P)=>{if(x)return d(x);if(F+=P,F<512&&P)return i.read(o,R,F,R.length-F,D+F,B);if(D===0&&R[0]===31&&R[1]===139)return d(new Error("cannot append to compressed archives"));if(F<512)return d(null,D);const M=new e(R);if(!M.cksumValid)return d(null,D);const U=512*Math.ceil(M.size/512);if(D+U+512>l||(D+=U+512,D>=l))return d(null,D);C.mtimeCache&&C.mtimeCache.set(M.path,M.mtime),F=0,i.read(o,R,0,512,D,B)};i.read(o,R,0,512,D,B)},v=new Promise((o,l)=>{A.on("error",l);let f="r+";const d=(D,F)=>{if(D&&D.code==="ENOENT"&&f==="r+")return f="w+",i.open(C.file,f,d);if(D)return l(D);i.fstat(F,(R,B)=>{if(R)return i.close(F,()=>l(R));S(F,B.size,(x,P)=>{if(x)return l(x);const M=new n.WriteStream(C.file,{fd:F,start:P});A.pipe(M),M.on("error",l),M.on("close",o),p(A,w)})})};i.open(C.file,f,d)});return b?v.then(b,b):v},y=(C,w)=>{w.forEach(b=>{b.charAt(0)==="@"?r({file:a.resolve(C.cwd,b.slice(1)),sync:!0,noResume:!0,onentry:A=>C.add(A)}):C.add(b)}),C.end()},p=(C,w)=>{for(;w.length;){const b=w.shift();if(b.charAt(0)==="@")return r({file:a.resolve(C.cwd,b.slice(1)),noResume:!0,onentry:A=>C.add(A)}).then(A=>p(C,w));C.add(b)}C.end()};return Ds}var fs,or;function Ou(){if(or)return fs;or=1;const s=Le(),t=ur();fs=(n,r,a)=>{const e=s(n);if(!e.file)throw new TypeError("file is required");if(e.gzip||e.brotli||e.file.endsWith(".br")||e.file.endsWith(".tbr"))throw new TypeError("cannot append to compressed archives");if(!r||!Array.isArray(r)||!r.length)throw new TypeError("no files or directories specified");return r=Array.from(r),i(e),t(e,r,a)};const i=n=>{const r=n.filter;n.mtimeCache||(n.mtimeCache=new Map),n.filter=r?(a,e)=>r(a,e)&&!(n.mtimeCache.get(a)>e.mtime):(a,e)=>!(n.mtimeCache.get(a)>e.mtime)};return fs}var rt={exports:{}},ds,ar;function Ru(){if(ar)return ds;ar=1;const{promisify:s}=Wr,t=Ce;return ds=n=>{if(!n)n={mode:511,fs:t};else if(typeof n=="object")n={mode:511,fs:t,...n};else if(typeof n=="number")n={mode:n,fs:t};else if(typeof n=="string")n={mode:parseInt(n,8),fs:t};else throw new TypeError("invalid options argument");return n.mkdir=n.mkdir||n.fs.mkdir||t.mkdir,n.mkdirAsync=s(n.mkdir),n.stat=n.stat||n.fs.stat||t.stat,n.statAsync=s(n.stat),n.statSync=n.statSync||n.fs.statSync||t.statSync,n.mkdirSync=n.mkdirSync||n.fs.mkdirSync||t.mkdirSync,n},ds}var ps,hr;function Bu(){if(hr)return ps;hr=1;const s=process.env.__TESTING_MKDIRP_PLATFORM__||process.platform,{resolve:t,parse:i}=fe;return ps=r=>{if(/\0/.test(r))throw Object.assign(new TypeError("path must be a string without null bytes"),{path:r,code:"ERR_INVALID_ARG_VALUE"});if(r=t(r),s==="win32"){const a=/[*|"<>?:]/,{root:e}=i(r);if(a.test(r.substr(e.length)))throw Object.assign(new Error("Illegal characters in path."),{path:r,code:"EINVAL"})}return r},ps}var ms,lr;function xu(){if(lr)return ms;lr=1;const{dirname:s}=fe,t=(n,r,a=void 0)=>a===r?Promise.resolve():n.statAsync(r).then(e=>e.isDirectory()?a:void 0,e=>e.code==="ENOENT"?t(n,s(r),r):void 0),i=(n,r,a=void 0)=>{if(a!==r)try{return n.statSync(r).isDirectory()?a:void 0}catch(e){return e.code==="ENOENT"?i(n,s(r),r):void 0}};return ms={findMade:t,findMadeSync:i},ms}var Es,cr;function Dr(){if(cr)return Es;cr=1;const{dirname:s}=fe,t=(n,r,a)=>{r.recursive=!1;const e=s(n);return e===n?r.mkdirAsync(n,r).catch(u=>{if(u.code!=="EISDIR")throw u}):r.mkdirAsync(n,r).then(()=>a||n,u=>{if(u.code==="ENOENT")return t(e,r).then(h=>t(n,r,h));if(u.code!=="EEXIST"&&u.code!=="EROFS")throw u;return r.statAsync(n).then(h=>{if(h.isDirectory())return a;throw u},()=>{throw u})})},i=(n,r,a)=>{const e=s(n);if(r.recursive=!1,e===n)try{return r.mkdirSync(n,r)}catch(u){if(u.code!=="EISDIR")throw u;return}try{return r.mkdirSync(n,r),a||n}catch(u){if(u.code==="ENOENT")return i(n,r,i(e,r,a));if(u.code!=="EEXIST"&&u.code!=="EROFS")throw u;try{if(!r.statSync(n).isDirectory())throw u}catch{throw u}}};return Es={mkdirpManual:t,mkdirpManualSync:i},Es}var gs,fr;function Tu(){if(fr)return gs;fr=1;const{dirname:s}=fe,{findMade:t,findMadeSync:i}=xu(),{mkdirpManual:n,mkdirpManualSync:r}=Dr();return gs={mkdirpNative:(u,h)=>(h.recursive=!0,s(u)===u?h.mkdirAsync(u,h):t(h,u).then(y=>h.mkdirAsync(u,h).then(()=>y).catch(p=>{if(p.code==="ENOENT")return n(u,h);throw p}))),mkdirpNativeSync:(u,h)=>{if(h.recursive=!0,s(u)===u)return h.mkdirSync(u,h);const y=i(h,u);try{return h.mkdirSync(u,h),y}catch(p){if(p.code==="ENOENT")return r(u,h);throw p}}},gs}var Cs,dr;function $u(){if(dr)return Cs;dr=1;const s=Ce,i=(process.env.__TESTING_MKDIRP_NODE_VERSION__||process.version).replace(/^v/,"").split("."),n=+i[0]>10||+i[0]==10&&+i[1]>=12;return Cs={useNative:n?e=>e.mkdir===s.mkdir:()=>!1,useNativeSync:n?e=>e.mkdirSync===s.mkdirSync:()=>!1},Cs}var Fs,pr;function Nu(){if(pr)return Fs;pr=1;const s=Ru(),t=Bu(),{mkdirpNative:i,mkdirpNativeSync:n}=Tu(),{mkdirpManual:r,mkdirpManualSync:a}=Dr(),{useNative:e,useNativeSync:u}=$u(),h=(y,p)=>(y=t(y),p=s(p),e(p)?i(y,p):r(y,p)),m=(y,p)=>(y=t(y),p=s(p),u(p)?n(y,p):a(y,p));return h.sync=m,h.native=(y,p)=>i(t(y),s(p)),h.manual=(y,p)=>r(t(y),s(p)),h.nativeSync=(y,p)=>n(t(y),s(p)),h.manualSync=(y,p)=>a(t(y),s(p)),Fs=h,Fs}var ys,mr;function Iu(){if(mr)return ys;mr=1;const s=Ce,t=fe,i=s.lchown?"lchown":"chown",n=s.lchownSync?"lchownSync":"chownSync",r=s.lchown&&!process.version.match(/v1[1-9]+\./)&&!process.version.match(/v10\.[6-9]/),a=(v,o,l)=>{try{return s[n](v,o,l)}catch(f){if(f.code!=="ENOENT")throw f}},e=(v,o,l)=>{try{return s.chownSync(v,o,l)}catch(f){if(f.code!=="ENOENT")throw f}},u=r?(v,o,l,f)=>d=>{!d||d.code!=="EISDIR"?f(d):s.chown(v,o,l,f)}:(v,o,l,f)=>f,h=r?(v,o,l)=>{try{return a(v,o,l)}catch(f){if(f.code!=="EISDIR")throw f;e(v,o,l)}}:(v,o,l)=>a(v,o,l),m=process.version;let y=(v,o,l)=>s.readdir(v,o,l),p=(v,o)=>s.readdirSync(v,o);/^v4\./.test(m)&&(y=(v,o,l)=>s.readdir(v,l));const C=(v,o,l,f)=>{s[i](v,o,l,u(v,o,l,d=>{f(d&&d.code!=="ENOENT"?d:null)}))},w=(v,o,l,f,d)=>{if(typeof o=="string")return s.lstat(t.resolve(v,o),(D,F)=>{if(D)return d(D.code!=="ENOENT"?D:null);F.name=o,w(v,F,l,f,d)});if(o.isDirectory())b(t.resolve(v,o.name),l,f,D=>{if(D)return d(D);const F=t.resolve(v,o.name);C(F,l,f,d)});else{const D=t.resolve(v,o.name);C(D,l,f,d)}},b=(v,o,l,f)=>{y(v,{withFileTypes:!0},(d,D)=>{if(d){if(d.code==="ENOENT")return f();if(d.code!=="ENOTDIR"&&d.code!=="ENOTSUP")return f(d)}if(d||!D.length)return C(v,o,l,f);let F=D.length,R=null;const B=x=>{if(!R){if(x)return f(R=x);if(--F===0)return C(v,o,l,f)}};D.forEach(x=>w(v,x,o,l,B))})},A=(v,o,l,f)=>{if(typeof o=="string")try{const d=s.lstatSync(t.resolve(v,o));d.name=o,o=d}catch(d){if(d.code==="ENOENT")return;throw d}o.isDirectory()&&S(t.resolve(v,o.name),l,f),h(t.resolve(v,o.name),l,f)},S=(v,o,l)=>{let f;try{f=p(v,{withFileTypes:!0})}catch(d){if(d.code==="ENOENT")return;if(d.code==="ENOTDIR"||d.code==="ENOTSUP")return h(v,o,l);throw d}return f&&f.length&&f.forEach(d=>A(v,d,o,l)),h(v,o,l)};return ys=b,b.sync=S,ys}var Er;function Lu(){if(Er)return rt.exports;Er=1;const s=Nu(),t=Ce,i=fe,n=Iu(),r=Pe();class a extends Error{constructor(b,A){super("Cannot extract through symbolic link"),this.path=A,this.symlink=b}get name(){return"SylinkError"}}class e extends Error{constructor(b,A){super(A+": Cannot cd into '"+b+"'"),this.path=b,this.code=A}get name(){return"CwdError"}}const u=(w,b)=>w.get(r(b)),h=(w,b,A)=>w.set(r(b),A),m=(w,b)=>{t.stat(w,(A,S)=>{(A||!S.isDirectory())&&(A=new e(w,A&&A.code||"ENOTDIR")),b(A)})};rt.exports=(w,b,A)=>{w=r(w);const S=b.umask,v=b.mode|448,o=(v&S)!==0,l=b.uid,f=b.gid,d=typeof l=="number"&&typeof f=="number"&&(l!==b.processUid||f!==b.processGid),D=b.preserve,F=b.unlink,R=b.cache,B=r(b.cwd),x=(U,G)=>{U?A(U):(h(R,w,!0),G&&d?n(G,l,f,Y=>x(Y)):o?t.chmod(w,v,A):A())};if(R&&u(R,w)===!0)return x();if(w===B)return m(w,x);if(D)return s(w,{mode:v}).then(U=>x(null,U),x);const M=r(i.relative(B,w)).split("/");y(B,M,v,R,F,B,null,x)};const y=(w,b,A,S,v,o,l,f)=>{if(!b.length)return f(null,l);const d=b.shift(),D=r(i.resolve(w+"/"+d));if(u(S,D))return y(D,b,A,S,v,o,l,f);t.mkdir(D,A,p(D,b,A,S,v,o,l,f))},p=(w,b,A,S,v,o,l,f)=>d=>{d?t.lstat(w,(D,F)=>{if(D)D.path=D.path&&r(D.path),f(D);else if(F.isDirectory())y(w,b,A,S,v,o,l,f);else if(v)t.unlink(w,R=>{if(R)return f(R);t.mkdir(w,A,p(w,b,A,S,v,o,l,f))});else{if(F.isSymbolicLink())return f(new a(w,w+"/"+b.join("/")));f(d)}}):(l=l||w,y(w,b,A,S,v,o,l,f))},C=w=>{let b=!1,A="ENOTDIR";try{b=t.statSync(w).isDirectory()}catch(S){A=S.code}finally{if(!b)throw new e(w,A)}};return rt.exports.sync=(w,b)=>{w=r(w);const A=b.umask,S=b.mode|448,v=(S&A)!==0,o=b.uid,l=b.gid,f=typeof o=="number"&&typeof l=="number"&&(o!==b.processUid||l!==b.processGid),d=b.preserve,D=b.unlink,F=b.cache,R=r(b.cwd),B=U=>{h(F,w,!0),U&&f&&n.sync(U,o,l),v&&t.chmodSync(w,S)};if(F&&u(F,w)===!0)return B();if(w===R)return C(R),B();if(d)return B(s.sync(w,S));const P=r(i.relative(R,w)).split("/");let M=null;for(let U=P.shift(),G=R;U&&(G+="/"+U);U=P.shift())if(G=r(i.resolve(G)),!u(F,G))try{t.mkdirSync(G,S),M=M||G,h(F,G,!0)}catch{const N=t.lstatSync(G);if(N.isDirectory()){h(F,G,!0);continue}else if(D){t.unlinkSync(G),t.mkdirSync(G,S),M=M||G,h(F,G,!0);continue}else if(N.isSymbolicLink())return new a(G,G+"/"+P.join("/"))}return B(M)},rt.exports}var bs,gr;function Cr(){if(gr)return bs;gr=1;const s=Object.create(null),{hasOwnProperty:t}=Object.prototype;return bs=i=>(t.call(s,i)||(s[i]=i.normalize("NFD")),s[i]),bs}var ws,Fr;function Pu(){if(Fr)return ws;Fr=1;const s=ct,t=Cr(),i=ke(),{join:n}=fe,a=(process.env.TESTING_TAR_FAKE_PLATFORM||process.platform)==="win32";return ws=()=>{const e=new Map,u=new Map,h=A=>A.split("/").slice(0,-1).reduce((v,o)=>(v.length&&(o=n(v[v.length-1],o)),v.push(o||"/"),v),[]),m=new Set,y=A=>{const S=u.get(A);if(!S)throw new Error("function does not have any path reservations");return{paths:S.paths.map(v=>e.get(v)),dirs:[...S.dirs].map(v=>e.get(v))}},p=A=>{const{paths:S,dirs:v}=y(A);return S.every(o=>o[0]===A)&&v.every(o=>o[0]instanceof Set&&o[0].has(A))},C=A=>m.has(A)||!p(A)?!1:(m.add(A),A(()=>w(A)),!0),w=A=>{if(!m.has(A))return!1;const{paths:S,dirs:v}=u.get(A),o=new Set;return S.forEach(l=>{const f=e.get(l);s.equal(f[0],A),f.length===1?e.delete(l):(f.shift(),typeof f[0]=="function"?o.add(f[0]):f[0].forEach(d=>o.add(d)))}),v.forEach(l=>{const f=e.get(l);s(f[0]instanceof Set),f[0].size===1&&f.length===1?e.delete(l):f[0].size===1?(f.shift(),o.add(f[0])):f[0].delete(A)}),m.delete(A),o.forEach(l=>C(l)),!0};return{check:p,reserve:(A,S)=>{A=a?["win32 parallelization disabled"]:A.map(o=>i(n(t(o))).toLowerCase());const v=new Set(A.map(o=>h(o)).reduce((o,l)=>o.concat(l)));return u.set(S,{dirs:v,paths:A}),A.forEach(o=>{const l=e.get(o);l?l.push(S):e.set(o,[S])}),v.forEach(o=>{const l=e.get(o);l?l[l.length-1]instanceof Set?l[l.length-1].add(S):l.push(new Set([S])):e.set(o,[new Set([S])])}),C(S)}}},ws}var _s,yr;function Mu(){if(yr)return _s;yr=1;const t=(process.env.__FAKE_PLATFORM__||process.platform)==="win32",i=Dt.__FAKE_TESTING_FS__||Ce,{O_CREAT:n,O_TRUNC:r,O_WRONLY:a,UV_FS_O_FILEMAP:e=0}=i.constants,u=t&&!!e,h=512*1024,m=e|r|n|a;return _s=u?y=>y<h?m:"w":()=>"w",_s}var vs,br;function wr(){if(br)return vs;br=1;const s=ct,t=as(),i=Ce,n=je(),r=fe,a=Lu(),e=qi(),u=Pu(),h=Vi(),m=Pe(),y=ke(),p=Cr(),C=Symbol("onEntry"),w=Symbol("checkFs"),b=Symbol("checkFs2"),A=Symbol("pruneCache"),S=Symbol("isReusable"),v=Symbol("makeFs"),o=Symbol("file"),l=Symbol("directory"),f=Symbol("link"),d=Symbol("symlink"),D=Symbol("hardlink"),F=Symbol("unsupported"),R=Symbol("checkPath"),B=Symbol("mkdir"),x=Symbol("onError"),P=Symbol("pending"),M=Symbol("pend"),U=Symbol("unpend"),G=Symbol("ended"),Y=Symbol("maybeClose"),N=Symbol("skip"),W=Symbol("doChown"),V=Symbol("uid"),te=Symbol("gid"),_=Symbol("checkedCwd"),c=Vr,g=Mu(),j=(process.env.TESTING_TAR_FAKE_PLATFORM||process.platform)==="win32",J=1024,$=(se,E)=>{if(!j)return i.unlink(se,E);const k=se+".DELETE."+c.randomBytes(16).toString("hex");i.rename(se,k,H=>{if(H)return E(H);i.unlink(k,E)})},q=se=>{if(!j)return i.unlinkSync(se);const E=se+".DELETE."+c.randomBytes(16).toString("hex");i.renameSync(se,E),i.unlinkSync(E)},z=(se,E,k)=>se===se>>>0?se:E===E>>>0?E:k,O=se=>y(m(p(se))).toLowerCase(),T=(se,E)=>{E=O(E);for(const k of se.keys()){const H=O(k);(H===E||H.indexOf(E+"/")===0)&&se.delete(k)}},K=se=>{for(const E of se.keys())se.delete(E)};class ae extends t{constructor(E){if(E||(E={}),E.ondone=k=>{this[G]=!0,this[Y]()},super(E),this[_]=!1,this.reservations=u(),this.transform=typeof E.transform=="function"?E.transform:null,this.writable=!0,this.readable=!1,this[P]=0,this[G]=!1,this.dirCache=E.dirCache||new Map,typeof E.uid=="number"||typeof E.gid=="number"){if(typeof E.uid!="number"||typeof E.gid!="number")throw new TypeError("cannot set owner without number uid and gid");if(E.preserveOwner)throw new TypeError("cannot preserve owner in archive and also set owner explicitly");this.uid=E.uid,this.gid=E.gid,this.setOwner=!0}else this.uid=null,this.gid=null,this.setOwner=!1;E.preserveOwner===void 0&&typeof E.uid!="number"?this.preserveOwner=process.getuid&&process.getuid()===0:this.preserveOwner=!!E.preserveOwner,this.processUid=(this.preserveOwner||this.setOwner)&&process.getuid?process.getuid():null,this.processGid=(this.preserveOwner||this.setOwner)&&process.getgid?process.getgid():null,this.maxDepth=typeof E.maxDepth=="number"?E.maxDepth:J,this.forceChown=E.forceChown===!0,this.win32=!!E.win32||j,this.newer=!!E.newer,this.keep=!!E.keep,this.noMtime=!!E.noMtime,this.preservePaths=!!E.preservePaths,this.unlink=!!E.unlink,this.cwd=m(r.resolve(E.cwd||process.cwd())),this.strip=+E.strip||0,this.processUmask=E.noChmod?0:process.umask(),this.umask=typeof E.umask=="number"?E.umask:this.processUmask,this.dmode=E.dmode||511&~this.umask,this.fmode=E.fmode||438&~this.umask,this.on("entry",k=>this[C](k))}warn(E,k,H={}){return(E==="TAR_BAD_ARCHIVE"||E==="TAR_ABORT")&&(H.recoverable=!1),super.warn(E,k,H)}[Y](){this[G]&&this[P]===0&&(this.emit("prefinish"),this.emit("finish"),this.emit("end"))}[R](E){const k=m(E.path),H=k.split("/");if(this.strip){if(H.length<this.strip)return!1;if(E.type==="Link"){const Z=m(E.linkpath).split("/");if(Z.length>=this.strip)E.linkpath=Z.slice(this.strip).join("/");else return!1}H.splice(0,this.strip),E.path=H.join("/")}if(isFinite(this.maxDepth)&&H.length>this.maxDepth)return this.warn("TAR_ENTRY_ERROR","path excessively deep",{entry:E,path:k,depth:H.length,maxDepth:this.maxDepth}),!1;if(!this.preservePaths){if(H.includes("..")||j&&/^[a-z]:\.\.$/i.test(H[0]))return this.warn("TAR_ENTRY_ERROR","path contains '..'",{entry:E,path:k}),!1;const[Z,X]=h(k);Z&&(E.path=X,this.warn("TAR_ENTRY_INFO",`stripping ${Z} from absolute path`,{entry:E,path:k}))}if(r.isAbsolute(E.path)?E.absolute=m(r.resolve(E.path)):E.absolute=m(r.resolve(this.cwd,E.path)),!this.preservePaths&&E.absolute.indexOf(this.cwd+"/")!==0&&E.absolute!==this.cwd)return this.warn("TAR_ENTRY_ERROR","path escaped extraction target",{entry:E,path:m(E.path),resolvedPath:E.absolute,cwd:this.cwd}),!1;if(E.absolute===this.cwd&&E.type!=="Directory"&&E.type!=="GNUDumpDir")return!1;if(this.win32){const{root:Z}=r.win32.parse(E.absolute);E.absolute=Z+e.encode(E.absolute.slice(Z.length));const{root:X}=r.win32.parse(E.path);E.path=X+e.encode(E.path.slice(X.length))}return!0}[C](E){if(!this[R](E))return E.resume();switch(s.equal(typeof E.absolute,"string"),E.type){case"Directory":case"GNUDumpDir":E.mode&&(E.mode=E.mode|448);case"File":case"OldFile":case"ContiguousFile":case"Link":case"SymbolicLink":return this[w](E);case"CharacterDevice":case"BlockDevice":case"FIFO":default:return this[F](E)}}[x](E,k){E.name==="CwdError"?this.emit("error",E):(this.warn("TAR_ENTRY_ERROR",E,{entry:k}),this[U](),k.resume())}[B](E,k,H){a(m(E),{uid:this.uid,gid:this.gid,processUid:this.processUid,processGid:this.processGid,umask:this.processUmask,preserve:this.preservePaths,unlink:this.unlink,cache:this.dirCache,cwd:this.cwd,mode:k,noChmod:this.noChmod},H)}[W](E){return this.forceChown||this.preserveOwner&&(typeof E.uid=="number"&&E.uid!==this.processUid||typeof E.gid=="number"&&E.gid!==this.processGid)||typeof this.uid=="number"&&this.uid!==this.processUid||typeof this.gid=="number"&&this.gid!==this.processGid}[V](E){return z(this.uid,E.uid,this.processUid)}[te](E){return z(this.gid,E.gid,this.processGid)}[o](E,k){const H=E.mode&4095||this.fmode,Z=new n.WriteStream(E.absolute,{flags:g(E.size),mode:H,autoClose:!1});Z.on("error",re=>{Z.fd&&i.close(Z.fd,()=>{}),Z.write=()=>!0,this[x](re,E),k()});let X=1;const oe=re=>{if(re){Z.fd&&i.close(Z.fd,()=>{}),this[x](re,E),k();return}--X===0&&i.close(Z.fd,le=>{le?this[x](le,E):this[U](),k()})};Z.on("finish",re=>{const le=E.absolute,ye=Z.fd;if(E.mtime&&!this.noMtime){X++;const be=E.atime||new Date,Ae=E.mtime;i.futimes(ye,be,Ae,xe=>xe?i.utimes(le,be,Ae,ot=>oe(ot&&xe)):oe())}if(this[W](E)){X++;const be=this[V](E),Ae=this[te](E);i.fchown(ye,be,Ae,xe=>xe?i.chown(le,be,Ae,ot=>oe(ot&&xe)):oe())}oe()});const ie=this.transform&&this.transform(E)||E;ie!==E&&(ie.on("error",re=>{this[x](re,E),k()}),E.pipe(ie)),ie.pipe(Z)}[l](E,k){const H=E.mode&4095||this.dmode;this[B](E.absolute,H,Z=>{if(Z){this[x](Z,E),k();return}let X=1;const oe=ie=>{--X===0&&(k(),this[U](),E.resume())};E.mtime&&!this.noMtime&&(X++,i.utimes(E.absolute,E.atime||new Date,E.mtime,oe)),this[W](E)&&(X++,i.chown(E.absolute,this[V](E),this[te](E),oe)),oe()})}[F](E){E.unsupported=!0,this.warn("TAR_ENTRY_UNSUPPORTED",`unsupported entry type: ${E.type}`,{entry:E}),E.resume()}[d](E,k){this[f](E,E.linkpath,"symlink",k)}[D](E,k){const H=m(r.resolve(this.cwd,E.linkpath));this[f](E,H,"link",k)}[M](){this[P]++}[U](){this[P]--,this[Y]()}[N](E){this[U](),E.resume()}[S](E,k){return E.type==="File"&&!this.unlink&&k.isFile()&&k.nlink<=1&&!j}[w](E){this[M]();const k=[E.path];E.linkpath&&k.push(E.linkpath),this.reservations.reserve(k,H=>this[b](E,H))}[A](E){E.type==="SymbolicLink"?K(this.dirCache):E.type!=="Directory"&&T(this.dirCache,E.absolute)}[b](E,k){this[A](E);const H=ie=>{this[A](E),k(ie)},Z=()=>{this[B](this.cwd,this.dmode,ie=>{if(ie){this[x](ie,E),H();return}this[_]=!0,X()})},X=()=>{if(E.absolute!==this.cwd){const ie=m(r.dirname(E.absolute));if(ie!==this.cwd)return this[B](ie,this.dmode,re=>{if(re){this[x](re,E),H();return}oe()})}oe()},oe=()=>{i.lstat(E.absolute,(ie,re)=>{if(re&&(this.keep||this.newer&&re.mtime>E.mtime)){this[N](E),H();return}if(ie||this[S](E,re))return this[v](null,E,H);if(re.isDirectory()){if(E.type==="Directory"){const le=!this.noChmod&&E.mode&&(re.mode&4095)!==E.mode,ye=be=>this[v](be,E,H);return le?i.chmod(E.absolute,E.mode,ye):ye()}if(E.absolute!==this.cwd)return i.rmdir(E.absolute,le=>this[v](le,E,H))}if(E.absolute===this.cwd)return this[v](null,E,H);$(E.absolute,le=>this[v](le,E,H))})};this[_]?X():Z()}[v](E,k,H){if(E){this[x](E,k),H();return}switch(k.type){case"File":case"OldFile":case"ContiguousFile":return this[o](k,H);case"Link":return this[D](k,H);case"SymbolicLink":return this[d](k,H);case"Directory":case"GNUDumpDir":return this[l](k,H)}}[f](E,k,H,Z){i[H](k,E.absolute,X=>{X?this[x](X,E):(this[U](),E.resume()),Z()})}}const De=se=>{try{return[null,se()]}catch(E){return[E,null]}};class qe extends ae{[v](E,k){return super[v](E,k,()=>{})}[w](E){if(this[A](E),!this[_]){const X=this[B](this.cwd,this.dmode);if(X)return this[x](X,E);this[_]=!0}if(E.absolute!==this.cwd){const X=m(r.dirname(E.absolute));if(X!==this.cwd){const oe=this[B](X,this.dmode);if(oe)return this[x](oe,E)}}const[k,H]=De(()=>i.lstatSync(E.absolute));if(H&&(this.keep||this.newer&&H.mtime>E.mtime))return this[N](E);if(k||this[S](E,H))return this[v](null,E);if(H.isDirectory()){if(E.type==="Directory"){const oe=!this.noChmod&&E.mode&&(H.mode&4095)!==E.mode,[ie]=oe?De(()=>{i.chmodSync(E.absolute,E.mode)}):[];return this[v](ie,E)}const[X]=De(()=>i.rmdirSync(E.absolute));this[v](X,E)}const[Z]=E.absolute===this.cwd?[]:De(()=>q(E.absolute));this[v](Z,E)}[o](E,k){const H=E.mode&4095||this.fmode,Z=ie=>{let re;try{i.closeSync(X)}catch(le){re=le}(ie||re)&&this[x](ie||re,E),k()};let X;try{X=i.openSync(E.absolute,g(E.size),H)}catch(ie){return Z(ie)}const oe=this.transform&&this.transform(E)||E;oe!==E&&(oe.on("error",ie=>this[x](ie,E)),E.pipe(oe)),oe.on("data",ie=>{try{i.writeSync(X,ie,0,ie.length)}catch(re){Z(re)}}),oe.on("end",ie=>{let re=null;if(E.mtime&&!this.noMtime){const le=E.atime||new Date,ye=E.mtime;try{i.futimesSync(X,le,ye)}catch(be){try{i.utimesSync(E.absolute,le,ye)}catch{re=be}}}if(this[W](E)){const le=this[V](E),ye=this[te](E);try{i.fchownSync(X,le,ye)}catch(be){try{i.chownSync(E.absolute,le,ye)}catch{re=re||be}}}Z(re)})}[l](E,k){const H=E.mode&4095||this.dmode,Z=this[B](E.absolute,H);if(Z){this[x](Z,E),k();return}if(E.mtime&&!this.noMtime)try{i.utimesSync(E.absolute,E.atime||new Date,E.mtime)}catch{}if(this[W](E))try{i.chownSync(E.absolute,this[V](E),this[te](E))}catch{}k(),E.resume()}[B](E,k){try{return a.sync(m(E),{uid:this.uid,gid:this.gid,processUid:this.processUid,processGid:this.processGid,umask:this.processUmask,preserve:this.preservePaths,unlink:this.unlink,cache:this.dirCache,cwd:this.cwd,mode:k})}catch(H){return H}}[f](E,k,H,Z){try{i[H+"Sync"](k,E.absolute),Z(),E.resume()}catch(X){return this[x](X,E)}}}return ae.Sync=qe,vs=ae,vs}var As,_r;function ku(){if(_r)return As;_r=1;const s=Le(),t=wr(),i=Ce,n=je(),r=fe,a=ke();As=(p,C,w)=>{typeof p=="function"?(w=p,C=null,p={}):Array.isArray(p)&&(C=p,p={}),typeof C=="function"&&(w=C,C=null),C?C=Array.from(C):C=[];const b=s(p);if(b.sync&&typeof w=="function")throw new TypeError("callback not supported for sync tar functions");if(!b.file&&typeof w=="function")throw new TypeError("callback only supported with file option");return C.length&&e(b,C),b.file&&b.sync?u(b):b.file?h(b,w):b.sync?m(b):y(b)};const e=(p,C)=>{const w=new Map(C.map(S=>[a(S),!0])),b=p.filter,A=(S,v)=>{const o=v||r.parse(S).root||".",l=S===o?!1:w.has(S)?w.get(S):A(r.dirname(S),o);return w.set(S,l),l};p.filter=b?(S,v)=>b(S,v)&&A(a(S)):S=>A(a(S))},u=p=>{const C=new t.Sync(p),w=p.file,b=i.statSync(w),A=p.maxReadSize||16*1024*1024;new n.ReadStreamSync(w,{readSize:A,size:b.size}).pipe(C)},h=(p,C)=>{const w=new t(p),b=p.maxReadSize||16*1024*1024,A=p.file,S=new Promise((v,o)=>{w.on("error",o),w.on("close",v),i.stat(A,(l,f)=>{if(l)o(l);else{const d=new n.ReadStream(A,{readSize:b,size:f.size});d.on("error",o),d.pipe(w)}})});return C?S.then(C,C):S},m=p=>new t.Sync(p),y=p=>new t(p);return As}var vr;function ju(){return vr||(vr=1,he.c=he.create=Su(),he.r=he.replace=ur(),he.t=he.list=ls(),he.u=he.update=Ou(),he.x=he.extract=ku(),he.Pack=us(),he.Unpack=wr(),he.Parse=as(),he.ReadEntry=Gt(),he.WriteEntry=Zi(),he.Header=Me(),he.Pax=Yt(),he.types=Mi()),he}var Hu=ju();class Uu extends Error{}class Ar extends Error{}class zu extends Error{}class Gu extends Error{}const Sr=async(s,t)=>{const i=new URL(s),n=de.basename(i.pathname);return{name:n,version:void 0,subdir:void 0,url:i.href,tar:i.href,defaultDir:n,headers:t.auth?{Authorization:`Bearer ${t.auth}`}:void 0}},Or=async(s,t)=>{const i=nt(s),n=await Ss(i,t,async()=>(await(await He(`https://api.github.com/repos/${i.repo}`)).json())?.default_branch);return{name:i.repo.replace("/","-"),version:n,subdir:i.subdir,headers:{...t.auth?{Authorization:`Bearer ${t.auth}`}:{},Accept:"application/vnd.github+json","X-GitHub-Api-Version":"2022-11-28"},url:`https://github.com/${i.repo}/tree/${n}${i.subdir}`,tar:`https://api.github.com/repos/${i.repo}/tarball/${n}`}},qu=async(s,t)=>{const i=nt(s),n=await Ss(i,t,async()=>(await(await He(`https://gitlab.com/api/v4/projects/${encodeURIComponent(i.repo)}`)).json())?.default_branch);return{name:i.repo.replace("/","-"),version:n,subdir:i.subdir,headers:{...t.auth?{Authorization:`Bearer ${t.auth}`}:{},"sec-fetch-mode":"same-origin"},url:`https://gitlab.com/${i.repo}/tree/${n}${i.subdir}`,tar:`https://gitlab.com/${i.repo}/-/archive/${n}.tar.gz`}},Wu=async(s,t)=>{const i=nt(s),n=await Ss(i,t,async()=>(await(await He(`https://api.bitbucket.org/2.0/repositories/${i.repo}`)).json())?.mainbranch?.name);return{name:i.repo.replace("/","-"),version:n,subdir:i.subdir,headers:t.auth?{Authorization:`Bearer ${t.auth}`}:{},url:`https://bitbucket.com/${i.repo}/src/${n}${i.subdir}`,tar:`https://bitbucket.org/${i.repo}/get/${n}.tar.gz`}},Vu=(s,t)=>{const i=nt(s),n=i.ref||"main";return{name:i.repo.replace("/","-"),version:n,subdir:i.subdir,headers:t.auth?{Authorization:`Bearer ${t.auth}`}:{},url:`https://git.sr.ht/~${i.repo}/tree/${n}/item${i.subdir}`,tar:`https://git.sr.ht/~${i.repo}/archive/${n}.tar.gz`}},Ku={http:Sr,https:Sr,github:Or,gh:Or,gitlab:qu,bitbucket:Wu,sourcehut:Vu};async function Ss(s,t,i){if(s.ref)return s.ref;if(t.offline!==!0)try{const n=await i();if(n)return n}catch(n){Os(`Failed to fetch ref for ${s.repo}`,n)}return"main"}const Yu=/^([\w-.]+):/;function Zu(s,t,i){t||="github";let n=s;const r=s.match(Yu);r&&(t=r[1],t!=="http"&&t!=="https"&&(n=s.slice(r[0].length)));const a=i?.[t]||Ku[t];return{source:n,providerName:t,provider:a}}async function Xu(s,t,i={}){const n=t+".json",r=JSON.parse(await Oe.readFile(n,"utf8").catch(()=>"{}")),e=(await He(s,{...i,method:"HEAD"}).catch(()=>{}))?.headers.get("etag");if(r.etag===e&&Se.existsSync(t))return;typeof e=="string"&&(r.etag=e);const u=await He(s,{headers:i.headers});if(u.status>=400)throw new Ar(`Failed to download ${s}: ${u.status} ${u.statusText}`);if(u.body==null)throw new Ar(`Failed to download ${s}: empty response body`);await Oe.mkdir(de.dirname(t),{recursive:!0});const h=Se.createWriteStream(t);await $r(Gr)(u.body,h),await Oe.writeFile(n,JSON.stringify(r),"utf8")}const Ju=/^(?<repo>[\w\-.]+\/[\w\-.]+)(?<subdir>[^#]+)?(?<ref>#[\w\-./@]+)?/;function nt(s){const t=s.match(Ju)?.groups||{};return{repo:t.repo,subdir:t.subdir||"/",ref:t.ref?.slice(1)}}function Os(...s){process.env.DEBUG&&console.debug("[giget]",...s)}async function He(s,t={}){t.headers?.["sec-fetch-mode"]&&(t.mode=t.headers["sec-fetch-mode"]);const i=await fetch(s,t).catch(n=>{throw new Error(`Failed to fetch ${s}`,{cause:n})});if(t.validateStatus&&i.status>=400)throw new Error(`Failed to fetch ${s}: ${i.status} ${i.statusText}`);return i}function Qu(){return process.env.XDG_CACHE_HOME?de.resolve(process.env.XDG_CACHE_HOME,"bluwy-giget"):de.resolve(zr.homedir(),".cache/bluwy-giget")}async function eo(s,t,i){i==="/"&&(i=void 0),i&&(i.startsWith("/")&&(i=i.slice(1)),i.endsWith("/")||(i+="/"));let n=!1;if(await Oe.mkdir(t,{recursive:!0}),await Hu.extract({file:s,cwd:t,onentry(r){r.path=r.path.split("/").splice(1).join("/"),i&&(r.path.startsWith(i)?(r.path=r.path.slice(i.length-1),n=!0):r.path="")}}),i&&!n)throw await Oe.rm(t,{recursive:!0,force:!0}),new zu(`Subdirectory not found in tar: ${i}`)}async function to(s,t={}){const{source:i,providerName:n,provider:r}=Zu(s,t.provider,t.providers);if(!r)throw new Uu(`Unsupported provider: ${n}`);const a={...t.providerOptions,offline:t.offline},e=await Promise.resolve().then(()=>r(i,a)).catch(p=>{throw new Error(`The ${n} provider failed with errors`,{cause:p})});e.name=(e.name||"template").replace(/[^\da-z-]/gi,"-"),e.defaultDir=(e.defaultDir||e.name).replace(/[^\da-z-]/gi,"-");const u=de.resolve(Qu(),n,e.name),h=de.resolve(u,(e.version||e.name)+".tar.gz");if((t.offline==="prefer"?!Se.existsSync(h):!t.offline)&&(await Xu(e.tar,h,{headers:e.headers}).catch(p=>{if(!Se.existsSync(h))throw p;Os("Download error. Using cached version:",p)}),Os(`Downloaded ${e.tar} to ${h}`)),!Se.existsSync(h))throw new Error(`Tarball not found: ${h} (offline: ${t.offline})`);const m=de.resolve(t.cwd||"."),y=de.resolve(m,t.dir||e.defaultDir);if(t.force==="clean")await Oe.rm(y,{recursive:!0,force:!0});else if(!t.force&&Se.existsSync(y)&&Se.readdirSync(y).length>0)throw new Gu(`Destination ${y} already exists.`);return await eo(h,y,e.subdir),{info:e,source:i,dir:y}}async function Ue({template:s,project:t}){await to(`wrtnlabs/agentica.template.${s}`,{provider:"github",dir:t}),await Lr(we(t,".github"),{force:!0,recursive:!0})}async function ze({projectPath:s,dotEnvfileName:t,apiKeys:i}){if(!at(s))throw new Error(`${s} directory does not exist.`);const n=we(s,t??".env"),r=(at(n)?`
91
- `:"")+i.map(({key:a,value:e})=>`${a}=${e}`).join(`
92
- `);await Pr(n,r)}function so({packageManager:s,pkg:t}){switch(s){case"npm":return`npm install ${t??""}`.trim();case"yarn":return t!=null?`yarn add ${t}`:"yarn";case"pnpm":return`pnpm install ${t??""}`.trim();case"bun":return`bun install ${t??""}`.trim();default:throw new Error(`Unsupported package manager: ${s}`)}}function io({packageManager:s,command:t}){switch(s){case"npm":return`npm run ${t}`.trim();case"yarn":return`yarn ${t}`.trim();case"pnpm":return`pnpm ${t}`.trim();case"bun":return`bun ${t}`.trim();default:throw new Error(`Unsupported package manager: ${s}`)}}function ro(){const s=Q.env.npm_config_user_agent;switch(!0){case s?.startsWith("npm"):return"npm";case s?.startsWith("yarn"):return"yarn";case s?.startsWith("pnpm"):return"pnpm";case s?.startsWith("bun"):return"bun";default:return"npm"}}const no=["nodejs","nestjs","react","react-native","standalone","nestjs+react","nodejs+react"];async function Ge({packageManager:s,projectAbsolutePath:t,services:i}){const n=i.length>0?[...i.map(u=>Cu(u))].join(" "):void 0,[r,...a]=so({packageManager:s,pkg:n}).split(" "),e=ai();e.start("\u{1F4E6} Package installation in progress...");try{await xt(r,a,{cwd:t})}catch(u){throw u instanceof Re&&(ce.error(`\u274C Package installation failed: ${u.output}`),Q.exit(1)),u}e.stop("\u2705 Package installation completed")}async function Rs({packageManager:s,projectAbsolutePath:t}){const[i,...n]=io({packageManager:s,command:"prepare"}).split(" "),r=ai();r.start("\u{1F4E6} Package installation in progress...");try{await xt(i,n,{cwd:t})}catch(a){throw a instanceof Re&&(ce.error(`\u274C Package installation failed: ${a.output}`),Q.exit(1)),a}r.stop("\u2705 Package installation completed")}async function uo({template:s}){const t={template:s,services:[]};{const i=await Qe({message:"Enter the project directory path:",placeholder:"./my-agentica-project",validate(r){if(r==="")return"Please enter a directory path";if(r[0]!==".")return"Please enter a relative path.";if(at(r))return"Directory already exists"}});_e(i)&&Q.exit(0);const n=we(Q.cwd(),i);t.projectAbsolutePath=n}{const i=await ni({message:"Which package manager do you want to use?",initialValue:ro(),options:[{value:"npm",label:"npm"},{value:"pnpm",label:"pnpm"},{value:"yarn",label:`yarn (${Ee.blueBright("berry is not supported")})`},{value:"bun",label:"bun"}]});_e(i)&&Q.exit(0),ce.info(`\u{1F4E6} Using ${i} as package manager`),t.packageManager=i}if(t.template==null){const i=await ni({message:"Which project type do you want to start?",options:[{value:"standalone",label:`Standalone ${Ee.blueBright("Agent Server")}`},{value:"nodejs",label:`NodeJS ${Ee.blueBright("Agent Server")}`},{value:"nestjs",label:`NestJS ${Ee.blueBright("Agent Server")}`},{value:"react",label:`React ${Ee.blueBright("Application")}`},{value:"react-native",label:`React Native ${Ee.blueBright("Application")}`},{value:"nestjs+react",label:`NestJS + React ${Ee.blueBright("Agent Server + Client Application")}`},{value:"nodejs+react",label:`NodeJS + React ${Ee.blueBright("Agent Server + Client Application")}`}]});_e(i)&&Q.exit(0),t.template=i}if(t.template!=="standalone"){const i=await Qe({message:"Server Port(if project is client app, this port mean ws server port):",initialValue:"3000",validate(n){if(Number.isNaN(Number.parseInt(n)))return"Port must be an integer"}});_e(i)&&Q.exit(0),t.port=Number(i)}if(t.template!=="react"){const i=await bu(),n=i.sort((h,m)=>h.displayName.localeCompare(m.displayName)).map(({displayName:h,serviceName:m})=>({label:h,value:m})),r=await Ln({message:`Which connectors do you want to include? (Press ${Ee.cyan("<space>")} to select, ${Ee.cyan("<a>")} to select all, ${Ee.cyan("<enter>")} to proceed)`,options:n,required:!1});_e(r)&&Q.exit(0),t.services=r;const a=Array.from(new Set(i.filter(h=>r.includes(h.serviceName)).flatMap(h=>h.envList))),e=a.length===0?!1:await ri({message:`Do you want to enter environment variables? (Number of environment variables to enter: ${a.length})
93
- ${Ee.cyan("If you press <ctrl+c>, you can skip this step.")}`,initialValue:!1}),u=[];if(_e(e)||!e)a.forEach(h=>{u.push({key:h,value:""})}),ui("Skipping environment variables input.");else for(let h=0;h<a.length;h++){const m=a[h],y=await Qe({message:`${m}: `,defaultValue:""});if(_e(y)){const p=a.splice(h);p.forEach(C=>{u.push({key:C,value:""})}),ui(`Skipping environment variables input: ${p.slice(0,3).join(", ")}... (count: ${p.length})`);break}u.push({key:m,value:y})}t.envList=u}{const i=await ri({message:"Enter your OpenAI API key?",initialValue:!1});if(_e(i)&&Q.exit(0),i){const n=await Qe({message:"Please enter your OPENAI API key:"});_e(n)&&Q.exit(0),t.openAIKey=n}else t.openAIKey=null}try{(()=>{const i=h=>(h.packageManager==="npm"||h.packageManager==="yarn"||h.packageManager==="pnpm"||h.packageManager==="bun")&&typeof h.projectAbsolutePath=="string"&&(h.template==="nodejs"||h.template==="nestjs"||h.template==="react"||h.template==="react-native"||h.template==="standalone"||h.template==="nestjs+react"||h.template==="nodejs+react")&&(h.openAIKey===null||typeof h.openAIKey=="string")&&(h.port===void 0||typeof h.port=="number")&&Array.isArray(h.services)&&h.services.every(m=>typeof m=="string")&&(h.envList===void 0||Array.isArray(h.envList)&&h.envList.every(m=>typeof m=="object"&&m!==null&&n(m))),n=h=>typeof h.key=="string"&&typeof h.value=="string",r=(h,m,y=!0)=>(h.packageManager==="npm"||h.packageManager==="yarn"||h.packageManager==="pnpm"||h.packageManager==="bun"||ne._assertGuard(y,{method:"typia.assertGuard",path:m+".packageManager",expected:'("bun" | "npm" | "pnpm" | "yarn")',value:h.packageManager},u))&&(typeof h.projectAbsolutePath=="string"||ne._assertGuard(y,{method:"typia.assertGuard",path:m+".projectAbsolutePath",expected:"string",value:h.projectAbsolutePath},u))&&(h.template==="nodejs"||h.template==="nestjs"||h.template==="react"||h.template==="react-native"||h.template==="standalone"||h.template==="nestjs+react"||h.template==="nodejs+react"||ne._assertGuard(y,{method:"typia.assertGuard",path:m+".template",expected:'("nestjs" | "nestjs+react" | "nodejs" | "nodejs+react" | "react" | "react-native" | "standalone")',value:h.template},u))&&(h.openAIKey===null||typeof h.openAIKey=="string"||ne._assertGuard(y,{method:"typia.assertGuard",path:m+".openAIKey",expected:"(null | string)",value:h.openAIKey},u))&&(h.port===void 0||typeof h.port=="number"||ne._assertGuard(y,{method:"typia.assertGuard",path:m+".port",expected:"(number | undefined)",value:h.port},u))&&((Array.isArray(h.services)||ne._assertGuard(y,{method:"typia.assertGuard",path:m+".services",expected:"Array<string>",value:h.services},u))&&h.services.every((p,C)=>typeof p=="string"||ne._assertGuard(y,{method:"typia.assertGuard",path:m+".services["+C+"]",expected:"string",value:p},u))||ne._assertGuard(y,{method:"typia.assertGuard",path:m+".services",expected:"Array<string>",value:h.services},u))&&(h.envList===void 0||(Array.isArray(h.envList)||ne._assertGuard(y,{method:"typia.assertGuard",path:m+".envList",expected:"(Array<__type> | undefined)",value:h.envList},u))&&h.envList.every((p,C)=>(typeof p=="object"&&p!==null||ne._assertGuard(y,{method:"typia.assertGuard",path:m+".envList["+C+"]",expected:"__type.o1",value:p},u))&&a(p,m+".envList["+C+"]",y)||ne._assertGuard(y,{method:"typia.assertGuard",path:m+".envList["+C+"]",expected:"__type.o1",value:p},u))||ne._assertGuard(y,{method:"typia.assertGuard",path:m+".envList",expected:"(Array<__type> | undefined)",value:h.envList},u)),a=(h,m,y=!0)=>(typeof h.key=="string"||ne._assertGuard(y,{method:"typia.assertGuard",path:m+".key",expected:"string",value:h.key},u))&&(typeof h.value=="string"||ne._assertGuard(y,{method:"typia.assertGuard",path:m+".value",expected:"string",value:h.value},u)),e=h=>typeof h=="object"&&h!==null&&i(h);let u;return(h,m)=>{e(h)===!1&&(u=m,((y,p,C=!0)=>(typeof y=="object"&&y!==null||ne._assertGuard(!0,{method:"typia.assertGuard",path:p+"",expected:"__type",value:y},u))&&r(y,p+"",!0)||ne._assertGuard(!0,{method:"typia.assertGuard",path:p+"",expected:"__type",value:y},u))(h,"$input",!0))}})()(t)}catch(i){throw new Error(`\u274C ${i.toString()}`)}return t}async function oo({projectAbsolutePath:s,context:t}){await Ue({template:"standalone",project:s}),ce.success("\u2705 Template downloaded");const i=It(t.services),n=Nt(t.services),r=we(s,"src/index.ts"),a=await ht(r,"utf-8"),e=Lt({content:a,importCode:i,connectorCode:n}),u=await Tt(e);await lt(r,u),await ze({projectPath:s,apiKeys:[{key:"OPENAI_API_KEY",value:t.openAIKey??""},...t.envList??[]]}),ce.success("\u2705 .env created"),await Ge({packageManager:t.packageManager,projectAbsolutePath:s,services:t.services}),await Rs({packageManager:t.packageManager,projectAbsolutePath:s})}async function Rr({projectAbsolutePath:s,context:t}){await Ue({template:"nodejs",project:s}),ce.success("\u2705 Template downloaded");const i=It(t.services),n=Nt(t.services),r=we(s,"src/index.ts"),a=await ht(r,"utf-8").then(h=>t.services.length===0?h:h.replace(/import \{ BbsArticleService \}.*;\n/g,"").replace(/controllers:\s*\[[\s\S]*?\],\n/,`controllers: [/// INSERT CONTROLLER HERE],
94
- `)),e=Lt({content:a,importCode:i,connectorCode:n}),u=await Tt(e);await lt(r,u),await ze({projectPath:s,apiKeys:[{key:"OPENAI_API_KEY",value:t.openAIKey??""},{key:"PORT",value:t.port?.toString()??"3000"},...t.envList??[]]}),ce.success("\u2705 .env created"),await Ge({packageManager:t.packageManager,projectAbsolutePath:s,services:t.services}),await Rs({packageManager:t.packageManager,projectAbsolutePath:s})}async function Br({projectAbsolutePath:s,context:t}){await Ue({template:"nestjs",project:s}),ce.success("\u2705 Template downloaded");const i=It(t.services),n=Nt(t.services),r=we(s,"src/controllers/chat/ChatController.ts"),a=await ht(r,"utf-8").then(h=>t.services.length===0?h:h.replace(/import \{ BbsArticleService \}.*;\n/g,"").replace(/controllers:\s*\[[\s\S]*?\],\n/,`controllers: [/// INSERT CONTROLLER HERE],
95
- `)),e=Lt({content:a,importCode:i,connectorCode:n}),u=await Tt(e);await lt(r,u),await ze({projectPath:s,apiKeys:[{key:"OPENAI_API_KEY",value:t.openAIKey??""},{key:"API_PORT",value:t.port?.toString()??"3000"},...t.envList??[]]}),ce.success("\u2705 .env created"),await Ge({packageManager:t.packageManager,projectAbsolutePath:s,services:t.services}),await Rs({packageManager:t.packageManager,projectAbsolutePath:s})}async function Bs({projectAbsolutePath:s,context:t}){await Ue({template:"react",project:s}),ce.success("\u2705 Template downloaded"),await ze({projectPath:s,apiKeys:[{key:"OPENAI_API_KEY",value:t.openAIKey??""},{key:"VITE_AGENTICA_WS_URL",value:`ws://localhost:${t.port}/chat`}]}),ce.success("\u2705 .env created"),await Ge({packageManager:t.packageManager,projectAbsolutePath:s,services:t.services})}async function ao({projectAbsolutePath:s,context:t}){await Ue({template:"react-native",project:s}),ce.success("\u2705 Template downloaded"),await ze({projectPath:s,apiKeys:[{key:"OPENAI_API_KEY",value:t.openAIKey??""}]}),ce.success("\u2705 .env created"),await Ge({packageManager:t.packageManager,projectAbsolutePath:s,services:t.services})}async function ho({template:s}){oi("Agentica Start Wizard");const t=await uo({template:s}),{projectAbsolutePath:i}=t;switch(t.template){case"standalone":await oo({projectAbsolutePath:i,context:t});break;case"nodejs":await Rr({projectAbsolutePath:i,context:t});break;case"nestjs":await Br({projectAbsolutePath:i,context:t});break;case"react":await Bs({projectAbsolutePath:i,context:t});break;case"react-native":await ao({projectAbsolutePath:i,context:t});break;case"nestjs+react":await Br({projectAbsolutePath:we(i,"server"),context:t}),await Bs({projectAbsolutePath:we(i,"client"),context:t});break;case"nodejs+react":await Rr({projectAbsolutePath:we(i,"server"),context:t}),await Bs({projectAbsolutePath:we(i,"client"),context:t});break;default:throw t.template,new Error(`\u274C Template ${t.template} not supported`)}Pn(`
96
- \u{1F389} Project ${i} created
97
- \u26A0\uFE0F ${Ee.yellow("Note:")} Please implement constructor values for each controller generated in index.ts
98
- `)}const ut=new zn;ut.version(qn),ut.command("start").description("Start a new project").addOption(new Gn("-p, --project <project>","The project type").choices(no)).action(async s=>{oi(`\u{1F680} ${Ee.blueBright("Agentica")} Setup Wizard`),await ho({template:s.project})});function lo(){ut.parse(Q.argv)}export{ut as program,lo as run};
92
+ `)}function Ie(i){return i.map(e=>`import { ${vi(e)}Service } from "${Te}${e}";`).join(`
93
+ `)}function Ne({content:i,importCode:e,connectorCode:r}){const h=Ai(i,"/// INSERT IMPORT HERE",e);return Ai(h,"/// INSERT CONTROLLER HERE",r)}var ht={},Le,Si;function Nt(){if(Si)return Le;Si=1;const i=new Map([["C","cwd"],["f","file"],["z","gzip"],["P","preservePaths"],["U","unlink"],["strip-components","strip"],["stripComponents","strip"],["keep-newer","newer"],["keepNewer","newer"],["keep-newer-files","newer"],["keepNewerFiles","newer"],["k","keep"],["keep-existing","keep"],["keepExisting","keep"],["m","noMtime"],["no-mtime","noMtime"],["p","preserveOwner"],["L","follow"],["h","follow"]]);return Le=e=>e?Object.keys(e).map(r=>[i.has(r)?i.get(r):r,e[r]]).reduce((r,h)=>(r[h[0]]=h[1],r),Object.create(null)):{},Le}var Pe={},Oi;function Me(){if(Oi)return Pe;Oi=1;const i=typeof process=="object"&&process?process:{stdout:null,stderr:null},e=Vt,r=Is,s=Ns.StringDecoder,n=Symbol("EOF"),t=Symbol("maybeEmitEnd"),u=Symbol("emittedEnd"),a=Symbol("emittingEnd"),m=Symbol("emittedError"),y=Symbol("closed"),g=Symbol("read"),F=Symbol("flush"),w=Symbol("flushChunk"),b=Symbol("encoding"),A=Symbol("decoder"),R=Symbol("flowing"),o=Symbol("paused"),l=Symbol("resume"),D=Symbol("buffer"),f=Symbol("pipes"),d=Symbol("bufferLength"),p=Symbol("bufferPush"),_=Symbol("bufferShift"),O=Symbol("objectMode"),B=Symbol("destroyed"),x=Symbol("error"),P=Symbol("emitData"),W=Symbol("emitEnd"),j=Symbol("emitEnd2"),U=Symbol("async"),Z=Symbol("abort"),N=Symbol("aborted"),V=Symbol("signal"),q=G=>Promise.resolve().then(G),et=fe._MP_NO_ITERATOR_SYMBOLS_!=="1",v=et&&Symbol.asyncIterator||Symbol("asyncIterator not implemented"),c=et&&Symbol.iterator||Symbol("iterator not implemented"),C=G=>G==="end"||G==="finish"||G==="prefinish",L=G=>G instanceof ArrayBuffer||typeof G=="object"&&G.constructor&&G.constructor.name==="ArrayBuffer"&&G.byteLength>=0,k=G=>!Buffer.isBuffer(G)&&ArrayBuffer.isView(G);class J{constructor(S,T,K){this.src=S,this.dest=T,this.opts=K,this.ondrain=()=>S[l](),T.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(){}end(){this.unpipe(),this.opts.end&&this.dest.end()}}class $ extends J{unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(S,T,K){super(S,T,K),this.proxyErrors=at=>T.emit("error",at),S.on("error",this.proxyErrors)}}class z extends r{constructor(S){super(),this[R]=!1,this[o]=!1,this[f]=[],this[D]=[],this[O]=S&&S.objectMode||!1,this[O]?this[b]=null:this[b]=S&&S.encoding||null,this[b]==="buffer"&&(this[b]=null),this[U]=S&&!!S.async||!1,this[A]=this[b]?new s(this[b]):null,this[n]=!1,this[u]=!1,this[a]=!1,this[y]=!1,this[m]=null,this.writable=!0,this.readable=!0,this[d]=0,this[B]=!1,S&&S.debugExposeBuffer===!0&&Object.defineProperty(this,"buffer",{get:()=>this[D]}),S&&S.debugExposePipes===!0&&Object.defineProperty(this,"pipes",{get:()=>this[f]}),this[V]=S&&S.signal,this[N]=!1,this[V]&&(this[V].addEventListener("abort",()=>this[Z]()),this[V].aborted&&this[Z]())}get bufferLength(){return this[d]}get encoding(){return this[b]}set encoding(S){if(this[O])throw new Error("cannot set encoding in objectMode");if(this[b]&&S!==this[b]&&(this[A]&&this[A].lastNeed||this[d]))throw new Error("cannot change encoding");this[b]!==S&&(this[A]=S?new s(S):null,this[D].length&&(this[D]=this[D].map(T=>this[A].write(T)))),this[b]=S}setEncoding(S){this.encoding=S}get objectMode(){return this[O]}set objectMode(S){this[O]=this[O]||!!S}get async(){return this[U]}set async(S){this[U]=this[U]||!!S}[Z](){this[N]=!0,this.emit("abort",this[V].reason),this.destroy(this[V].reason)}get aborted(){return this[N]}set aborted(S){}write(S,T,K){if(this[N])return!1;if(this[n])throw new Error("write after end");if(this[B])return this.emit("error",Object.assign(new Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;typeof T=="function"&&(K=T,T="utf8"),T||(T="utf8");const at=this[U]?q:Dt=>Dt();return!this[O]&&!Buffer.isBuffer(S)&&(k(S)?S=Buffer.from(S.buffer,S.byteOffset,S.byteLength):L(S)?S=Buffer.from(S):typeof S!="string"&&(this.objectMode=!0)),this[O]?(this.flowing&&this[d]!==0&&this[F](!0),this.flowing?this.emit("data",S):this[p](S),this[d]!==0&&this.emit("readable"),K&&at(K),this.flowing):S.length?(typeof S=="string"&&!(T===this[b]&&!this[A].lastNeed)&&(S=Buffer.from(S,T)),Buffer.isBuffer(S)&&this[b]&&(S=this[A].write(S)),this.flowing&&this[d]!==0&&this[F](!0),this.flowing?this.emit("data",S):this[p](S),this[d]!==0&&this.emit("readable"),K&&at(K),this.flowing):(this[d]!==0&&this.emit("readable"),K&&at(K),this.flowing)}read(S){if(this[B])return null;if(this[d]===0||S===0||S>this[d])return this[t](),null;this[O]&&(S=null),this[D].length>1&&!this[O]&&(this.encoding?this[D]=[this[D].join("")]:this[D]=[Buffer.concat(this[D],this[d])]);const T=this[g](S||null,this[D][0]);return this[t](),T}[g](S,T){return S===T.length||S===null?this[_]():(this[D][0]=T.slice(S),T=T.slice(0,S),this[d]-=S),this.emit("data",T),!this[D].length&&!this[n]&&this.emit("drain"),T}end(S,T,K){return typeof S=="function"&&(K=S,S=null),typeof T=="function"&&(K=T,T="utf8"),S&&this.write(S,T),K&&this.once("end",K),this[n]=!0,this.writable=!1,(this.flowing||!this[o])&&this[t](),this}[l](){this[B]||(this[o]=!1,this[R]=!0,this.emit("resume"),this[D].length?this[F]():this[n]?this[t]():this.emit("drain"))}resume(){return this[l]()}pause(){this[R]=!1,this[o]=!0}get destroyed(){return this[B]}get flowing(){return this[R]}get paused(){return this[o]}[p](S){this[O]?this[d]+=1:this[d]+=S.length,this[D].push(S)}[_](){return this[O]?this[d]-=1:this[d]-=this[D][0].length,this[D].shift()}[F](S){do;while(this[w](this[_]())&&this[D].length);!S&&!this[D].length&&!this[n]&&this.emit("drain")}[w](S){return this.emit("data",S),this.flowing}pipe(S,T){if(this[B])return;const K=this[u];return T=T||{},S===i.stdout||S===i.stderr?T.end=!1:T.end=T.end!==!1,T.proxyErrors=!!T.proxyErrors,K?T.end&&S.end():(this[f].push(T.proxyErrors?new $(this,S,T):new J(this,S,T)),this[U]?q(()=>this[l]()):this[l]()),S}unpipe(S){const T=this[f].find(K=>K.dest===S);T&&(this[f].splice(this[f].indexOf(T),1),T.unpipe())}addListener(S,T){return this.on(S,T)}on(S,T){const K=super.on(S,T);return S==="data"&&!this[f].length&&!this.flowing?this[l]():S==="readable"&&this[d]!==0?super.emit("readable"):C(S)&&this[u]?(super.emit(S),this.removeAllListeners(S)):S==="error"&&this[m]&&(this[U]?q(()=>T.call(this,this[m])):T.call(this,this[m])),K}get emittedEnd(){return this[u]}[t](){!this[a]&&!this[u]&&!this[B]&&this[D].length===0&&this[n]&&(this[a]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[y]&&this.emit("close"),this[a]=!1)}emit(S,T,...K){if(S!=="error"&&S!=="close"&&S!==B&&this[B])return;if(S==="data")return!this[O]&&!T?!1:this[U]?q(()=>this[P](T)):this[P](T);if(S==="end")return this[W]();if(S==="close"){if(this[y]=!0,!this[u]&&!this[B])return;const Dt=super.emit("close");return this.removeAllListeners("close"),Dt}else if(S==="error"){this[m]=T,super.emit(x,T);const Dt=!this[V]||this.listeners("error").length?super.emit("error",T):!1;return this[t](),Dt}else if(S==="resume"){const Dt=super.emit("resume");return this[t](),Dt}else if(S==="finish"||S==="prefinish"){const Dt=super.emit(S);return this.removeAllListeners(S),Dt}const at=super.emit(S,T,...K);return this[t](),at}[P](S){for(const K of this[f])K.dest.write(S)===!1&&this.pause();const T=super.emit("data",S);return this[t](),T}[W](){this[u]||(this[u]=!0,this.readable=!1,this[U]?q(()=>this[j]()):this[j]())}[j](){if(this[A]){const T=this[A].end();if(T){for(const K of this[f])K.dest.write(T);super.emit("data",T)}}for(const T of this[f])T.end();const S=super.emit("end");return this.removeAllListeners("end"),S}collect(){const S=[];this[O]||(S.dataLength=0);const T=this.promise();return this.on("data",K=>{S.push(K),this[O]||(S.dataLength+=K.length)}),T.then(()=>S)}concat(){return this[O]?Promise.reject(new Error("cannot concat in objectMode")):this.collect().then(S=>this[O]?Promise.reject(new Error("cannot concat in objectMode")):this[b]?S.join(""):Buffer.concat(S,S.dataLength))}promise(){return new Promise((S,T)=>{this.on(B,()=>T(new Error("stream destroyed"))),this.on("error",K=>T(K)),this.on("end",()=>S())})}[v](){let S=!1;const T=()=>(this.pause(),S=!0,Promise.resolve({done:!0}));return{next:()=>{if(S)return T();const at=this.read();if(at!==null)return Promise.resolve({done:!1,value:at});if(this[n])return T();let Dt=null,Wt=null;const st=Y=>{this.removeListener("data",E),this.removeListener("end",M),this.removeListener(B,H),T(),Wt(Y)},E=Y=>{this.removeListener("error",st),this.removeListener("end",M),this.removeListener(B,H),this.pause(),Dt({value:Y,done:!!this[n]})},M=()=>{this.removeListener("error",st),this.removeListener("data",E),this.removeListener(B,H),T(),Dt({done:!0})},H=()=>st(new Error("stream destroyed"));return new Promise((Y,X)=>{Wt=X,Dt=Y,this.once(B,H),this.once("error",st),this.once("end",M),this.once("data",E)})},throw:T,return:T,[v](){return this}}}[c](){let S=!1;const T=()=>(this.pause(),this.removeListener(x,T),this.removeListener(B,T),this.removeListener("end",T),S=!0,{done:!0}),K=()=>{if(S)return T();const at=this.read();return at===null?T():{value:at}};return this.once("end",T),this.once(x,T),this.once(B,T),{next:K,throw:T,return:T,[c](){return this}}}destroy(S){return this[B]?(S?this.emit("error",S):this.emit(B),this):(this[B]=!0,this[D].length=0,this[d]=0,typeof this.close=="function"&&!this[y]&&this.close(),S?this.emit("error",S):this.emit(B),this)}static isStream(S){return!!S&&(S instanceof z||S instanceof r||S instanceof e&&(typeof S.pipe=="function"||typeof S.write=="function"&&typeof S.end=="function"))}}return Pe.Minipass=z,Pe}var Et={},ke,Ri;function Au(){if(Ri)return ke;Ri=1;const i=Ls.constants||{ZLIB_VERNUM:4736};return ke=Object.freeze(Object.assign(Object.create(null),{Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_VERSION_ERROR:-6,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,DEFLATE:1,INFLATE:2,GZIP:3,GUNZIP:4,DEFLATERAW:5,INFLATERAW:6,UNZIP:7,BROTLI_DECODE:8,BROTLI_ENCODE:9,Z_MIN_WINDOWBITS:8,Z_MAX_WINDOWBITS:15,Z_DEFAULT_WINDOWBITS:15,Z_MIN_CHUNK:64,Z_MAX_CHUNK:1/0,Z_DEFAULT_CHUNK:16384,Z_MIN_MEMLEVEL:1,Z_MAX_MEMLEVEL:9,Z_DEFAULT_MEMLEVEL:8,Z_MIN_LEVEL:-1,Z_MAX_LEVEL:9,Z_DEFAULT_LEVEL:-1,BROTLI_OPERATION_PROCESS:0,BROTLI_OPERATION_FLUSH:1,BROTLI_OPERATION_FINISH:2,BROTLI_OPERATION_EMIT_METADATA:3,BROTLI_MODE_GENERIC:0,BROTLI_MODE_TEXT:1,BROTLI_MODE_FONT:2,BROTLI_DEFAULT_MODE:0,BROTLI_MIN_QUALITY:0,BROTLI_MAX_QUALITY:11,BROTLI_DEFAULT_QUALITY:11,BROTLI_MIN_WINDOW_BITS:10,BROTLI_MAX_WINDOW_BITS:24,BROTLI_LARGE_MAX_WINDOW_BITS:30,BROTLI_DEFAULT_WINDOW:22,BROTLI_MIN_INPUT_BLOCK_BITS:16,BROTLI_MAX_INPUT_BLOCK_BITS:24,BROTLI_PARAM_MODE:0,BROTLI_PARAM_QUALITY:1,BROTLI_PARAM_LGWIN:2,BROTLI_PARAM_LGBLOCK:3,BROTLI_PARAM_DISABLE_LITERAL_CONTEXT_MODELING:4,BROTLI_PARAM_SIZE_HINT:5,BROTLI_PARAM_LARGE_WINDOW:6,BROTLI_PARAM_NPOSTFIX:7,BROTLI_PARAM_NDIRECT:8,BROTLI_DECODER_RESULT_ERROR:0,BROTLI_DECODER_RESULT_SUCCESS:1,BROTLI_DECODER_RESULT_NEEDS_MORE_INPUT:2,BROTLI_DECODER_RESULT_NEEDS_MORE_OUTPUT:3,BROTLI_DECODER_PARAM_DISABLE_RING_BUFFER_REALLOCATION:0,BROTLI_DECODER_PARAM_LARGE_WINDOW:1,BROTLI_DECODER_NO_ERROR:0,BROTLI_DECODER_SUCCESS:1,BROTLI_DECODER_NEEDS_MORE_INPUT:2,BROTLI_DECODER_NEEDS_MORE_OUTPUT:3,BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_NIBBLE:-1,BROTLI_DECODER_ERROR_FORMAT_RESERVED:-2,BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_META_NIBBLE:-3,BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_ALPHABET:-4,BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_SAME:-5,BROTLI_DECODER_ERROR_FORMAT_CL_SPACE:-6,BROTLI_DECODER_ERROR_FORMAT_HUFFMAN_SPACE:-7,BROTLI_DECODER_ERROR_FORMAT_CONTEXT_MAP_REPEAT:-8,BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_1:-9,BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_2:-10,BROTLI_DECODER_ERROR_FORMAT_TRANSFORM:-11,BROTLI_DECODER_ERROR_FORMAT_DICTIONARY:-12,BROTLI_DECODER_ERROR_FORMAT_WINDOW_BITS:-13,BROTLI_DECODER_ERROR_FORMAT_PADDING_1:-14,BROTLI_DECODER_ERROR_FORMAT_PADDING_2:-15,BROTLI_DECODER_ERROR_FORMAT_DISTANCE:-16,BROTLI_DECODER_ERROR_DICTIONARY_NOT_SET:-19,BROTLI_DECODER_ERROR_INVALID_ARGUMENTS:-20,BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MODES:-21,BROTLI_DECODER_ERROR_ALLOC_TREE_GROUPS:-22,BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MAP:-25,BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_1:-26,BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_2:-27,BROTLI_DECODER_ERROR_ALLOC_BLOCK_TYPE_TREES:-30,BROTLI_DECODER_ERROR_UNREACHABLE:-31},i)),ke}var He,Bi;function xi(){if(Bi)return He;Bi=1;const i=typeof process=="object"&&process?process:{stdout:null,stderr:null},e=Vt,r=Is,h=Ns.StringDecoder,s=Symbol("EOF"),n=Symbol("maybeEmitEnd"),t=Symbol("emittedEnd"),u=Symbol("emittingEnd"),a=Symbol("emittedError"),m=Symbol("closed"),y=Symbol("read"),g=Symbol("flush"),F=Symbol("flushChunk"),w=Symbol("encoding"),b=Symbol("decoder"),A=Symbol("flowing"),R=Symbol("paused"),o=Symbol("resume"),l=Symbol("bufferLength"),D=Symbol("bufferPush"),f=Symbol("bufferShift"),d=Symbol("objectMode"),p=Symbol("destroyed"),_=Symbol("emitData"),O=Symbol("emitEnd"),B=Symbol("emitEnd2"),x=Symbol("async"),P=v=>Promise.resolve().then(v),W=fe._MP_NO_ITERATOR_SYMBOLS_!=="1",j=W&&Symbol.asyncIterator||Symbol("asyncIterator not implemented"),U=W&&Symbol.iterator||Symbol("iterator not implemented"),Z=v=>v==="end"||v==="finish"||v==="prefinish",N=v=>v instanceof ArrayBuffer||typeof v=="object"&&v.constructor&&v.constructor.name==="ArrayBuffer"&&v.byteLength>=0,V=v=>!Buffer.isBuffer(v)&&ArrayBuffer.isView(v);class q{constructor(c,C,L){this.src=c,this.dest=C,this.opts=L,this.ondrain=()=>c[o](),C.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(){}end(){this.unpipe(),this.opts.end&&this.dest.end()}}class et extends q{unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(c,C,L){super(c,C,L),this.proxyErrors=k=>C.emit("error",k),c.on("error",this.proxyErrors)}}return He=class Br extends r{constructor(c){super(),this[A]=!1,this[R]=!1,this.pipes=[],this.buffer=[],this[d]=c&&c.objectMode||!1,this[d]?this[w]=null:this[w]=c&&c.encoding||null,this[w]==="buffer"&&(this[w]=null),this[x]=c&&!!c.async||!1,this[b]=this[w]?new h(this[w]):null,this[s]=!1,this[t]=!1,this[u]=!1,this[m]=!1,this[a]=null,this.writable=!0,this.readable=!0,this[l]=0,this[p]=!1}get bufferLength(){return this[l]}get encoding(){return this[w]}set encoding(c){if(this[d])throw new Error("cannot set encoding in objectMode");if(this[w]&&c!==this[w]&&(this[b]&&this[b].lastNeed||this[l]))throw new Error("cannot change encoding");this[w]!==c&&(this[b]=c?new h(c):null,this.buffer.length&&(this.buffer=this.buffer.map(C=>this[b].write(C)))),this[w]=c}setEncoding(c){this.encoding=c}get objectMode(){return this[d]}set objectMode(c){this[d]=this[d]||!!c}get async(){return this[x]}set async(c){this[x]=this[x]||!!c}write(c,C,L){if(this[s])throw new Error("write after end");if(this[p])return this.emit("error",Object.assign(new Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;typeof C=="function"&&(L=C,C="utf8"),C||(C="utf8");const k=this[x]?P:J=>J();return!this[d]&&!Buffer.isBuffer(c)&&(V(c)?c=Buffer.from(c.buffer,c.byteOffset,c.byteLength):N(c)?c=Buffer.from(c):typeof c!="string"&&(this.objectMode=!0)),this[d]?(this.flowing&&this[l]!==0&&this[g](!0),this.flowing?this.emit("data",c):this[D](c),this[l]!==0&&this.emit("readable"),L&&k(L),this.flowing):c.length?(typeof c=="string"&&!(C===this[w]&&!this[b].lastNeed)&&(c=Buffer.from(c,C)),Buffer.isBuffer(c)&&this[w]&&(c=this[b].write(c)),this.flowing&&this[l]!==0&&this[g](!0),this.flowing?this.emit("data",c):this[D](c),this[l]!==0&&this.emit("readable"),L&&k(L),this.flowing):(this[l]!==0&&this.emit("readable"),L&&k(L),this.flowing)}read(c){if(this[p])return null;if(this[l]===0||c===0||c>this[l])return this[n](),null;this[d]&&(c=null),this.buffer.length>1&&!this[d]&&(this.encoding?this.buffer=[this.buffer.join("")]:this.buffer=[Buffer.concat(this.buffer,this[l])]);const C=this[y](c||null,this.buffer[0]);return this[n](),C}[y](c,C){return c===C.length||c===null?this[f]():(this.buffer[0]=C.slice(c),C=C.slice(0,c),this[l]-=c),this.emit("data",C),!this.buffer.length&&!this[s]&&this.emit("drain"),C}end(c,C,L){return typeof c=="function"&&(L=c,c=null),typeof C=="function"&&(L=C,C="utf8"),c&&this.write(c,C),L&&this.once("end",L),this[s]=!0,this.writable=!1,(this.flowing||!this[R])&&this[n](),this}[o](){this[p]||(this[R]=!1,this[A]=!0,this.emit("resume"),this.buffer.length?this[g]():this[s]?this[n]():this.emit("drain"))}resume(){return this[o]()}pause(){this[A]=!1,this[R]=!0}get destroyed(){return this[p]}get flowing(){return this[A]}get paused(){return this[R]}[D](c){this[d]?this[l]+=1:this[l]+=c.length,this.buffer.push(c)}[f](){return this.buffer.length&&(this[d]?this[l]-=1:this[l]-=this.buffer[0].length),this.buffer.shift()}[g](c){do;while(this[F](this[f]()));!c&&!this.buffer.length&&!this[s]&&this.emit("drain")}[F](c){return c?(this.emit("data",c),this.flowing):!1}pipe(c,C){if(this[p])return;const L=this[t];return C=C||{},c===i.stdout||c===i.stderr?C.end=!1:C.end=C.end!==!1,C.proxyErrors=!!C.proxyErrors,L?C.end&&c.end():(this.pipes.push(C.proxyErrors?new et(this,c,C):new q(this,c,C)),this[x]?P(()=>this[o]()):this[o]()),c}unpipe(c){const C=this.pipes.find(L=>L.dest===c);C&&(this.pipes.splice(this.pipes.indexOf(C),1),C.unpipe())}addListener(c,C){return this.on(c,C)}on(c,C){const L=super.on(c,C);return c==="data"&&!this.pipes.length&&!this.flowing?this[o]():c==="readable"&&this[l]!==0?super.emit("readable"):Z(c)&&this[t]?(super.emit(c),this.removeAllListeners(c)):c==="error"&&this[a]&&(this[x]?P(()=>C.call(this,this[a])):C.call(this,this[a])),L}get emittedEnd(){return this[t]}[n](){!this[u]&&!this[t]&&!this[p]&&this.buffer.length===0&&this[s]&&(this[u]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[m]&&this.emit("close"),this[u]=!1)}emit(c,C,...L){if(c!=="error"&&c!=="close"&&c!==p&&this[p])return;if(c==="data")return C?this[x]?P(()=>this[_](C)):this[_](C):!1;if(c==="end")return this[O]();if(c==="close"){if(this[m]=!0,!this[t]&&!this[p])return;const J=super.emit("close");return this.removeAllListeners("close"),J}else if(c==="error"){this[a]=C;const J=super.emit("error",C);return this[n](),J}else if(c==="resume"){const J=super.emit("resume");return this[n](),J}else if(c==="finish"||c==="prefinish"){const J=super.emit(c);return this.removeAllListeners(c),J}const k=super.emit(c,C,...L);return this[n](),k}[_](c){for(const L of this.pipes)L.dest.write(c)===!1&&this.pause();const C=super.emit("data",c);return this[n](),C}[O](){this[t]||(this[t]=!0,this.readable=!1,this[x]?P(()=>this[B]()):this[B]())}[B](){if(this[b]){const C=this[b].end();if(C){for(const L of this.pipes)L.dest.write(C);super.emit("data",C)}}for(const C of this.pipes)C.end();const c=super.emit("end");return this.removeAllListeners("end"),c}collect(){const c=[];this[d]||(c.dataLength=0);const C=this.promise();return this.on("data",L=>{c.push(L),this[d]||(c.dataLength+=L.length)}),C.then(()=>c)}concat(){return this[d]?Promise.reject(new Error("cannot concat in objectMode")):this.collect().then(c=>this[d]?Promise.reject(new Error("cannot concat in objectMode")):this[w]?c.join(""):Buffer.concat(c,c.dataLength))}promise(){return new Promise((c,C)=>{this.on(p,()=>C(new Error("stream destroyed"))),this.on("error",L=>C(L)),this.on("end",()=>c())})}[j](){return{next:()=>{const C=this.read();if(C!==null)return Promise.resolve({done:!1,value:C});if(this[s])return Promise.resolve({done:!0});let L=null,k=null;const J=S=>{this.removeListener("data",$),this.removeListener("end",z),k(S)},$=S=>{this.removeListener("error",J),this.removeListener("end",z),this.pause(),L({value:S,done:!!this[s]})},z=()=>{this.removeListener("error",J),this.removeListener("data",$),L({done:!0})},G=()=>J(new Error("stream destroyed"));return new Promise((S,T)=>{k=T,L=S,this.once(p,G),this.once("error",J),this.once("end",z),this.once("data",$)})}}}[U](){return{next:()=>{const C=this.read();return{value:C,done:C===null}}}}destroy(c){return this[p]?(c?this.emit("error",c):this.emit(p),this):(this[p]=!0,this.buffer.length=0,this[l]=0,typeof this.close=="function"&&!this[m]&&this.close(),c?this.emit("error",c):this.emit(p),this)}static isStream(c){return!!c&&(c instanceof Br||c instanceof r||c instanceof e&&(typeof c.pipe=="function"||typeof c.write=="function"&&typeof c.end=="function"))}},He}var Ti;function $i(){if(Ti)return Et;Ti=1;const i=de,e=qr.Buffer,r=Ls,h=Et.constants=Au(),s=xi(),n=e.concat,t=Symbol("_superWrite");class u extends Error{constructor(N){super("zlib: "+N.message),this.code=N.code,this.errno=N.errno,this.code||(this.code="ZLIB_ERROR"),this.message="zlib: "+N.message,Error.captureStackTrace(this,this.constructor)}get name(){return"ZlibError"}}const a=Symbol("opts"),m=Symbol("flushFlag"),y=Symbol("finishFlushFlag"),g=Symbol("fullFlushFlag"),F=Symbol("handle"),w=Symbol("onError"),b=Symbol("sawError"),A=Symbol("level"),R=Symbol("strategy"),o=Symbol("ended");class l extends s{constructor(N,V){if(!N||typeof N!="object")throw new TypeError("invalid options for ZlibBase constructor");super(N),this[b]=!1,this[o]=!1,this[a]=N,this[m]=N.flush,this[y]=N.finishFlush;try{this[F]=new r[V](N)}catch(q){throw new u(q)}this[w]=q=>{this[b]||(this[b]=!0,this.close(),this.emit("error",q))},this[F].on("error",q=>this[w](new u(q))),this.once("end",()=>this.close)}close(){this[F]&&(this[F].close(),this[F]=null,this.emit("close"))}reset(){if(!this[b])return i(this[F],"zlib binding closed"),this[F].reset()}flush(N){this.ended||(typeof N!="number"&&(N=this[g]),this.write(Object.assign(e.alloc(0),{[m]:N})))}end(N,V,q){return N&&this.write(N,V),this.flush(this[y]),this[o]=!0,super.end(null,null,q)}get ended(){return this[o]}write(N,V,q){if(typeof V=="function"&&(q=V,V="utf8"),typeof N=="string"&&(N=e.from(N,V)),this[b])return;i(this[F],"zlib binding closed");const et=this[F]._handle,v=et.close;et.close=()=>{};const c=this[F].close;this[F].close=()=>{},e.concat=k=>k;let C;try{const k=typeof N[m]=="number"?N[m]:this[m];C=this[F]._processChunk(N,k),e.concat=n}catch(k){e.concat=n,this[w](new u(k))}finally{this[F]&&(this[F]._handle=et,et.close=v,this[F].close=c,this[F].removeAllListeners("error"))}this[F]&&this[F].on("error",k=>this[w](new u(k)));let L;if(C)if(Array.isArray(C)&&C.length>0){L=this[t](e.from(C[0]));for(let k=1;k<C.length;k++)L=this[t](C[k])}else L=this[t](e.from(C));return q&&q(),L}[t](N){return super.write(N)}}class D extends l{constructor(N,V){N=N||{},N.flush=N.flush||h.Z_NO_FLUSH,N.finishFlush=N.finishFlush||h.Z_FINISH,super(N,V),this[g]=h.Z_FULL_FLUSH,this[A]=N.level,this[R]=N.strategy}params(N,V){if(!this[b]){if(!this[F])throw new Error("cannot switch params when binding is closed");if(!this[F].params)throw new Error("not supported in this implementation");if(this[A]!==N||this[R]!==V){this.flush(h.Z_SYNC_FLUSH),i(this[F],"zlib binding closed");const q=this[F].flush;this[F].flush=(et,v)=>{this.flush(et),v()};try{this[F].params(N,V)}finally{this[F].flush=q}this[F]&&(this[A]=N,this[R]=V)}}}}class f extends D{constructor(N){super(N,"Deflate")}}class d extends D{constructor(N){super(N,"Inflate")}}const p=Symbol("_portable");class _ extends D{constructor(N){super(N,"Gzip"),this[p]=N&&!!N.portable}[t](N){return this[p]?(this[p]=!1,N[9]=255,super[t](N)):super[t](N)}}class O extends D{constructor(N){super(N,"Gunzip")}}class B extends D{constructor(N){super(N,"DeflateRaw")}}class x extends D{constructor(N){super(N,"InflateRaw")}}class P extends D{constructor(N){super(N,"Unzip")}}class W extends l{constructor(N,V){N=N||{},N.flush=N.flush||h.BROTLI_OPERATION_PROCESS,N.finishFlush=N.finishFlush||h.BROTLI_OPERATION_FINISH,super(N,V),this[g]=h.BROTLI_OPERATION_FLUSH}}class j extends W{constructor(N){super(N,"BrotliCompress")}}class U extends W{constructor(N){super(N,"BrotliDecompress")}}return Et.Deflate=f,Et.Inflate=d,Et.Gzip=_,Et.Gunzip=O,Et.DeflateRaw=B,Et.InflateRaw=x,Et.Unzip=P,typeof r.BrotliCompress=="function"?(Et.BrotliCompress=j,Et.BrotliDecompress=U):Et.BrotliCompress=Et.BrotliDecompress=class{constructor(){throw new Error("Brotli is not supported in this version of Node.js")}},Et}var je,Ii;function Lt(){return Ii||(Ii=1,je=(process.env.TESTING_TAR_FAKE_PLATFORM||process.platform)!=="win32"?e=>e:e=>e&&e.replace(/\\/g,"/")),je}var Ge,Ni;function Ue(){if(Ni)return Ge;Ni=1;const{Minipass:i}=Me(),e=Lt(),r=Symbol("slurp");return Ge=class extends i{constructor(s,n,t){switch(super(),this.pause(),this.extended=n,this.globalExtended=t,this.header=s,this.startBlockSize=512*Math.ceil(s.size/512),this.blockRemain=this.startBlockSize,this.remain=s.size,this.type=s.type,this.meta=!1,this.ignore=!1,this.type){case"File":case"OldFile":case"Link":case"SymbolicLink":case"CharacterDevice":case"BlockDevice":case"Directory":case"FIFO":case"ContiguousFile":case"GNUDumpDir":break;case"NextFileHasLongLinkpath":case"NextFileHasLongPath":case"OldGnuLongPath":case"GlobalExtendedHeader":case"ExtendedHeader":case"OldExtendedHeader":this.meta=!0;break;default:this.ignore=!0}this.path=e(s.path),this.mode=s.mode,this.mode&&(this.mode=this.mode&4095),this.uid=s.uid,this.gid=s.gid,this.uname=s.uname,this.gname=s.gname,this.size=s.size,this.mtime=s.mtime,this.atime=s.atime,this.ctime=s.ctime,this.linkpath=e(s.linkpath),this.uname=s.uname,this.gname=s.gname,n&&this[r](n),t&&this[r](t,!0)}write(s){const n=s.length;if(n>this.blockRemain)throw new Error("writing more to entry than is appropriate");const t=this.remain,u=this.blockRemain;return this.remain=Math.max(0,t-n),this.blockRemain=Math.max(0,u-n),this.ignore?!0:t>=n?super.write(s):super.write(s.slice(0,t))}[r](s,n){for(const t in s)s[t]!==null&&s[t]!==void 0&&!(n&&t==="path")&&(this[t]=t==="path"||t==="linkpath"?e(s[t]):s[t])}},Ge}var We={},Li;function Pi(){return Li||(Li=1,function(i){i.name=new Map([["0","File"],["","OldFile"],["1","Link"],["2","SymbolicLink"],["3","CharacterDevice"],["4","BlockDevice"],["5","Directory"],["6","FIFO"],["7","ContiguousFile"],["g","GlobalExtendedHeader"],["x","ExtendedHeader"],["A","SolarisACL"],["D","GNUDumpDir"],["I","Inode"],["K","NextFileHasLongLinkpath"],["L","NextFileHasLongPath"],["M","ContinuationFile"],["N","OldGnuLongPath"],["S","SparseFile"],["V","TapeVolumeHeader"],["X","OldExtendedHeader"]]),i.code=new Map(Array.from(i.name).map(e=>[e[1],e[0]]))}(We)),We}var ze,Mi;function Su(){if(Mi)return ze;Mi=1;const i=(a,m)=>{if(Number.isSafeInteger(a))a<0?r(a,m):e(a,m);else throw Error("cannot encode number outside of javascript safe integer range");return m},e=(a,m)=>{m[0]=128;for(var y=m.length;y>1;y--)m[y-1]=a&255,a=Math.floor(a/256)},r=(a,m)=>{m[0]=255;var y=!1;a=a*-1;for(var g=m.length;g>1;g--){var F=a&255;a=Math.floor(a/256),y?m[g-1]=t(F):F===0?m[g-1]=0:(y=!0,m[g-1]=u(F))}},h=a=>{const m=a[0],y=m===128?n(a.slice(1,a.length)):m===255?s(a):null;if(y===null)throw Error("invalid base256 encoding");if(!Number.isSafeInteger(y))throw Error("parsed number outside of javascript safe integer range");return y},s=a=>{for(var m=a.length,y=0,g=!1,F=m-1;F>-1;F--){var w=a[F],b;g?b=t(w):w===0?b=w:(g=!0,b=u(w)),b!==0&&(y-=b*Math.pow(256,m-F-1))}return y},n=a=>{for(var m=a.length,y=0,g=m-1;g>-1;g--){var F=a[g];F!==0&&(y+=F*Math.pow(256,m-g-1))}return y},t=a=>(255^a)&255,u=a=>(255^a)+1&255;return ze={encode:i,parse:h},ze}var Ve,ki;function Pt(){if(ki)return Ve;ki=1;const i=Pi(),e=ft.posix,r=Su(),h=Symbol("slurp"),s=Symbol("type");class n{constructor(p,_,O,B){this.cksumValid=!1,this.needPax=!1,this.nullBlock=!1,this.block=null,this.path=null,this.mode=null,this.uid=null,this.gid=null,this.size=null,this.mtime=null,this.cksum=null,this[s]="0",this.linkpath=null,this.uname=null,this.gname=null,this.devmaj=0,this.devmin=0,this.atime=null,this.ctime=null,Buffer.isBuffer(p)?this.decode(p,_||0,O,B):p&&this.set(p)}decode(p,_,O,B){if(_||(_=0),!p||!(p.length>=_+512))throw new Error("need 512 bytes for header");if(this.path=u(p,_,100),this.mode=y(p,_+100,8),this.uid=y(p,_+108,8),this.gid=y(p,_+116,8),this.size=y(p,_+124,12),this.mtime=a(p,_+136,12),this.cksum=y(p,_+148,12),this[h](O),this[h](B,!0),this[s]=u(p,_+156,1),this[s]===""&&(this[s]="0"),this[s]==="0"&&this.path.slice(-1)==="/"&&(this[s]="5"),this[s]==="5"&&(this.size=0),this.linkpath=u(p,_+157,100),p.slice(_+257,_+265).toString()==="ustar\x0000")if(this.uname=u(p,_+265,32),this.gname=u(p,_+297,32),this.devmaj=y(p,_+329,8),this.devmin=y(p,_+337,8),p[_+475]!==0){const P=u(p,_+345,155);this.path=P+"/"+this.path}else{const P=u(p,_+345,130);P&&(this.path=P+"/"+this.path),this.atime=a(p,_+476,12),this.ctime=a(p,_+488,12)}let x=8*32;for(let P=_;P<_+148;P++)x+=p[P];for(let P=_+156;P<_+512;P++)x+=p[P];this.cksumValid=x===this.cksum,this.cksum===null&&x===8*32&&(this.nullBlock=!0)}[h](p,_){for(const O in p)p[O]!==null&&p[O]!==void 0&&!(_&&O==="path")&&(this[O]=p[O])}encode(p,_){if(p||(p=this.block=Buffer.alloc(512),_=0),_||(_=0),!(p.length>=_+512))throw new Error("need 512 bytes for header");const O=this.ctime||this.atime?130:155,B=t(this.path||"",O),x=B[0],P=B[1];this.needPax=B[2],this.needPax=f(p,_,100,x)||this.needPax,this.needPax=b(p,_+100,8,this.mode)||this.needPax,this.needPax=b(p,_+108,8,this.uid)||this.needPax,this.needPax=b(p,_+116,8,this.gid)||this.needPax,this.needPax=b(p,_+124,12,this.size)||this.needPax,this.needPax=l(p,_+136,12,this.mtime)||this.needPax,p[_+156]=this[s].charCodeAt(0),this.needPax=f(p,_+157,100,this.linkpath)||this.needPax,p.write("ustar\x0000",_+257,8),this.needPax=f(p,_+265,32,this.uname)||this.needPax,this.needPax=f(p,_+297,32,this.gname)||this.needPax,this.needPax=b(p,_+329,8,this.devmaj)||this.needPax,this.needPax=b(p,_+337,8,this.devmin)||this.needPax,this.needPax=f(p,_+345,O,P)||this.needPax,p[_+475]!==0?this.needPax=f(p,_+345,155,P)||this.needPax:(this.needPax=f(p,_+345,130,P)||this.needPax,this.needPax=l(p,_+476,12,this.atime)||this.needPax,this.needPax=l(p,_+488,12,this.ctime)||this.needPax);let W=8*32;for(let j=_;j<_+148;j++)W+=p[j];for(let j=_+156;j<_+512;j++)W+=p[j];return this.cksum=W,b(p,_+148,8,this.cksum),this.cksumValid=!0,this.needPax}set(p){for(const _ in p)p[_]!==null&&p[_]!==void 0&&(this[_]=p[_])}get type(){return i.name.get(this[s])||this[s]}get typeKey(){return this[s]}set type(p){i.code.has(p)?this[s]=i.code.get(p):this[s]=p}}const t=(d,p)=>{let O=d,B="",x;const P=e.parse(d).root||".";if(Buffer.byteLength(O)<100)x=[O,B,!1];else{B=e.dirname(O),O=e.basename(O);do Buffer.byteLength(O)<=100&&Buffer.byteLength(B)<=p?x=[O,B,!1]:Buffer.byteLength(O)>100&&Buffer.byteLength(B)<=p?x=[O.slice(0,99),B,!0]:(O=e.join(e.basename(B),O),B=e.dirname(B));while(B!==P&&!x);x||(x=[d.slice(0,99),"",!0])}return x},u=(d,p,_)=>d.slice(p,p+_).toString("utf8").replace(/\0.*/,""),a=(d,p,_)=>m(y(d,p,_)),m=d=>d===null?null:new Date(d*1e3),y=(d,p,_)=>d[p]&128?r.parse(d.slice(p,p+_)):F(d,p,_),g=d=>isNaN(d)?null:d,F=(d,p,_)=>g(parseInt(d.slice(p,p+_).toString("utf8").replace(/\0.*$/,"").trim(),8)),w={12:8589934591,8:2097151},b=(d,p,_,O)=>O===null?!1:O>w[_]||O<0?(r.encode(O,d.slice(p,p+_)),!0):(A(d,p,_,O),!1),A=(d,p,_,O)=>d.write(R(O,_),p,_,"ascii"),R=(d,p)=>o(Math.floor(d).toString(8),p),o=(d,p)=>(d.length===p-1?d:new Array(p-d.length-1).join("0")+d+" ")+"\0",l=(d,p,_,O)=>O===null?!1:b(d,p,_,O.getTime()/1e3),D=new Array(156).join("\0"),f=(d,p,_,O)=>O===null?!1:(d.write(O+D,p,_,"utf8"),O.length!==Buffer.byteLength(O)||O.length>_);return Ve=n,Ve}var qe,Hi;function Ke(){if(Hi)return qe;Hi=1;const i=Pt(),e=ft;class r{constructor(u,a){this.atime=u.atime||null,this.charset=u.charset||null,this.comment=u.comment||null,this.ctime=u.ctime||null,this.gid=u.gid||null,this.gname=u.gname||null,this.linkpath=u.linkpath||null,this.mtime=u.mtime||null,this.path=u.path||null,this.size=u.size||null,this.uid=u.uid||null,this.uname=u.uname||null,this.dev=u.dev||null,this.ino=u.ino||null,this.nlink=u.nlink||null,this.global=a||!1}encode(){const u=this.encodeBody();if(u==="")return null;const a=Buffer.byteLength(u),m=512*Math.ceil(1+a/512),y=Buffer.allocUnsafe(m);for(let g=0;g<512;g++)y[g]=0;new i({path:("PaxHeader/"+e.basename(this.path)).slice(0,99),mode:this.mode||420,uid:this.uid||null,gid:this.gid||null,size:a,mtime:this.mtime||null,type:this.global?"GlobalExtendedHeader":"ExtendedHeader",linkpath:"",uname:this.uname||"",gname:this.gname||"",devmaj:0,devmin:0,atime:this.atime||null,ctime:this.ctime||null}).encode(y),y.write(u,512,a,"utf8");for(let g=a+512;g<y.length;g++)y[g]=0;return y}encodeBody(){return this.encodeField("path")+this.encodeField("ctime")+this.encodeField("atime")+this.encodeField("dev")+this.encodeField("ino")+this.encodeField("nlink")+this.encodeField("charset")+this.encodeField("comment")+this.encodeField("gid")+this.encodeField("gname")+this.encodeField("linkpath")+this.encodeField("mtime")+this.encodeField("size")+this.encodeField("uid")+this.encodeField("uname")}encodeField(u){if(this[u]===null||this[u]===void 0)return"";const a=this[u]instanceof Date?this[u].getTime()/1e3:this[u],m=" "+(u==="dev"||u==="ino"||u==="nlink"?"SCHILY.":"")+u+"="+a+`
94
+ `,y=Buffer.byteLength(m);let g=Math.floor(Math.log(y)/Math.log(10))+1;return y+g>=Math.pow(10,g)&&(g+=1),g+y+m}}r.parse=(t,u,a)=>new r(h(s(t),u),a);const h=(t,u)=>u?Object.keys(t).reduce((a,m)=>(a[m]=t[m],a),u):t,s=t=>t.replace(/\n$/,"").split(`
95
+ `).reduce(n,Object.create(null)),n=(t,u)=>{const a=parseInt(u,10);if(a!==Buffer.byteLength(u)+1)return t;u=u.slice((a+" ").length);const m=u.split("="),y=m.shift().replace(/^SCHILY\.(dev|ino|nlink)/,"$1");if(!y)return t;const g=m.join("=");return t[y]=/^([A-Z]+\.)?([mac]|birth|creation)time$/.test(y)?new Date(g*1e3):/^[0-9]+$/.test(g)?+g:g,t};return qe=r,qe}var Ye,ji;function Mt(){return ji||(ji=1,Ye=i=>{let e=i.length-1,r=-1;for(;e>-1&&i.charAt(e)==="/";)r=e,e--;return r===-1?i:i.slice(0,r)}),Ye}var Ze,Gi;function Xe(){return Gi||(Gi=1,Ze=i=>class extends i{warn(e,r,h={}){this.file&&(h.file=this.file),this.cwd&&(h.cwd=this.cwd),h.code=r instanceof Error&&r.code||e,h.tarCode=e,!this.strict&&h.recoverable!==!1?(r instanceof Error&&(h=Object.assign(r,h),r=r.message),this.emit("warn",h.tarCode,r,h)):r instanceof Error?this.emit("error",Object.assign(r,h)):this.emit("error",Object.assign(new Error(`${e}: ${r}`),h))}}),Ze}var Je,Ui;function Wi(){if(Ui)return Je;Ui=1;const i=["|","<",">","?",":"],e=i.map(s=>String.fromCharCode(61440+s.charCodeAt(0))),r=new Map(i.map((s,n)=>[s,e[n]])),h=new Map(e.map((s,n)=>[s,i[n]]));return Je={encode:s=>i.reduce((n,t)=>n.split(t).join(r.get(t)),s),decode:s=>e.reduce((n,t)=>n.split(t).join(h.get(t)),s)},Je}var Qe,zi;function Vi(){if(zi)return Qe;zi=1;const{isAbsolute:i,parse:e}=ft.win32;return Qe=r=>{let h="",s=e(r);for(;i(r)||s.root;){const n=r.charAt(0)==="/"&&r.slice(0,4)!=="//?/"?"/":s.root;r=r.slice(n.length),h+=n,s=e(r)}return[h,r]},Qe}var ts,qi;function Ou(){return qi||(qi=1,ts=(i,e,r)=>(i&=4095,r&&(i=(i|384)&-19),e&&(i&256&&(i|=64),i&32&&(i|=8),i&4&&(i|=1)),i)),ts}var es,Ki;function Yi(){if(Ki)return es;Ki=1;const{Minipass:i}=Me(),e=Ke(),r=Pt(),h=yt,s=ft,n=Lt(),t=Mt(),u=(v,c)=>c?(v=n(v).replace(/^\.(\/|$)/,""),t(c)+"/"+v):n(v),a=16*1024*1024,m=Symbol("process"),y=Symbol("file"),g=Symbol("directory"),F=Symbol("symlink"),w=Symbol("hardlink"),b=Symbol("header"),A=Symbol("read"),R=Symbol("lstat"),o=Symbol("onlstat"),l=Symbol("onread"),D=Symbol("onreadlink"),f=Symbol("openfile"),d=Symbol("onopenfile"),p=Symbol("close"),_=Symbol("mode"),O=Symbol("awaitDrain"),B=Symbol("ondrain"),x=Symbol("prefix"),P=Symbol("hadError"),W=Xe(),j=Wi(),U=Vi(),Z=Ou(),N=W(class extends i{constructor(c,C){if(C=C||{},super(C),typeof c!="string")throw new TypeError("path is required");this.path=n(c),this.portable=!!C.portable,this.myuid=process.getuid&&process.getuid()||0,this.myuser=process.env.USER||"",this.maxReadSize=C.maxReadSize||a,this.linkCache=C.linkCache||new Map,this.statCache=C.statCache||new Map,this.preservePaths=!!C.preservePaths,this.cwd=n(C.cwd||process.cwd()),this.strict=!!C.strict,this.noPax=!!C.noPax,this.noMtime=!!C.noMtime,this.mtime=C.mtime||null,this.prefix=C.prefix?n(C.prefix):null,this.fd=null,this.blockLen=null,this.blockRemain=null,this.buf=null,this.offset=null,this.length=null,this.pos=null,this.remain=null,typeof C.onwarn=="function"&&this.on("warn",C.onwarn);let L=!1;if(!this.preservePaths){const[k,J]=U(this.path);k&&(this.path=J,L=k)}this.win32=!!C.win32||process.platform==="win32",this.win32&&(this.path=j.decode(this.path.replace(/\\/g,"/")),c=c.replace(/\\/g,"/")),this.absolute=n(C.absolute||s.resolve(this.cwd,c)),this.path===""&&(this.path="./"),L&&this.warn("TAR_ENTRY_INFO",`stripping ${L} from absolute path`,{entry:this,path:L+this.path}),this.statCache.has(this.absolute)?this[o](this.statCache.get(this.absolute)):this[R]()}emit(c,...C){return c==="error"&&(this[P]=!0),super.emit(c,...C)}[R](){h.lstat(this.absolute,(c,C)=>{if(c)return this.emit("error",c);this[o](C)})}[o](c){this.statCache.set(this.absolute,c),this.stat=c,c.isFile()||(c.size=0),this.type=et(c),this.emit("stat",c),this[m]()}[m](){switch(this.type){case"File":return this[y]();case"Directory":return this[g]();case"SymbolicLink":return this[F]();default:return this.end()}}[_](c){return Z(c,this.type==="Directory",this.portable)}[x](c){return u(c,this.prefix)}[b](){this.type==="Directory"&&this.portable&&(this.noMtime=!0),this.header=new r({path:this[x](this.path),linkpath:this.type==="Link"?this[x](this.linkpath):this.linkpath,mode:this[_](this.stat.mode),uid:this.portable?null:this.stat.uid,gid:this.portable?null:this.stat.gid,size:this.stat.size,mtime:this.noMtime?null:this.mtime||this.stat.mtime,type:this.type,uname:this.portable?null:this.stat.uid===this.myuid?this.myuser:"",atime:this.portable?null:this.stat.atime,ctime:this.portable?null:this.stat.ctime}),this.header.encode()&&!this.noPax&&super.write(new e({atime:this.portable?null:this.header.atime,ctime:this.portable?null:this.header.ctime,gid:this.portable?null:this.header.gid,mtime:this.noMtime?null:this.mtime||this.header.mtime,path:this[x](this.path),linkpath:this.type==="Link"?this[x](this.linkpath):this.linkpath,size:this.header.size,uid:this.portable?null:this.header.uid,uname:this.portable?null:this.header.uname,dev:this.portable?null:this.stat.dev,ino:this.portable?null:this.stat.ino,nlink:this.portable?null:this.stat.nlink}).encode()),super.write(this.header.block)}[g](){this.path.slice(-1)!=="/"&&(this.path+="/"),this.stat.size=0,this[b](),this.end()}[F](){h.readlink(this.absolute,(c,C)=>{if(c)return this.emit("error",c);this[D](C)})}[D](c){this.linkpath=n(c),this[b](),this.end()}[w](c){this.type="Link",this.linkpath=n(s.relative(this.cwd,c)),this.stat.size=0,this[b](),this.end()}[y](){if(this.stat.nlink>1){const c=this.stat.dev+":"+this.stat.ino;if(this.linkCache.has(c)){const C=this.linkCache.get(c);if(C.indexOf(this.cwd)===0)return this[w](C)}this.linkCache.set(c,this.absolute)}if(this[b](),this.stat.size===0)return this.end();this[f]()}[f](){h.open(this.absolute,"r",(c,C)=>{if(c)return this.emit("error",c);this[d](C)})}[d](c){if(this.fd=c,this[P])return this[p]();this.blockLen=512*Math.ceil(this.stat.size/512),this.blockRemain=this.blockLen;const C=Math.min(this.blockLen,this.maxReadSize);this.buf=Buffer.allocUnsafe(C),this.offset=0,this.pos=0,this.remain=this.stat.size,this.length=this.buf.length,this[A]()}[A](){const{fd:c,buf:C,offset:L,length:k,pos:J}=this;h.read(c,C,L,k,J,($,z)=>{if($)return this[p](()=>this.emit("error",$));this[l](z)})}[p](c){h.close(this.fd,c)}[l](c){if(c<=0&&this.remain>0){const k=new Error("encountered unexpected EOF");return k.path=this.absolute,k.syscall="read",k.code="EOF",this[p](()=>this.emit("error",k))}if(c>this.remain){const k=new Error("did not encounter expected EOF");return k.path=this.absolute,k.syscall="read",k.code="EOF",this[p](()=>this.emit("error",k))}if(c===this.remain)for(let k=c;k<this.length&&c<this.blockRemain;k++)this.buf[k+this.offset]=0,c++,this.remain++;const C=this.offset===0&&c===this.buf.length?this.buf:this.buf.slice(this.offset,this.offset+c);this.write(C)?this[B]():this[O](()=>this[B]())}[O](c){this.once("drain",c)}write(c){if(this.blockRemain<c.length){const C=new Error("writing more data than expected");return C.path=this.absolute,this.emit("error",C)}return this.remain-=c.length,this.blockRemain-=c.length,this.pos+=c.length,this.offset+=c.length,super.write(c)}[B](){if(!this.remain)return this.blockRemain&&super.write(Buffer.alloc(this.blockRemain)),this[p](c=>c?this.emit("error",c):this.end());this.offset>=this.length&&(this.buf=Buffer.allocUnsafe(Math.min(this.blockRemain,this.buf.length)),this.offset=0),this.length=this.buf.length-this.offset,this[A]()}});class V extends N{[R](){this[o](h.lstatSync(this.absolute))}[F](){this[D](h.readlinkSync(this.absolute))}[f](){this[d](h.openSync(this.absolute,"r"))}[A](){let c=!0;try{const{fd:C,buf:L,offset:k,length:J,pos:$}=this,z=h.readSync(C,L,k,J,$);this[l](z),c=!1}finally{if(c)try{this[p](()=>{})}catch{}}}[O](c){c()}[p](c){h.closeSync(this.fd),c()}}const q=W(class extends i{constructor(c,C){C=C||{},super(C),this.preservePaths=!!C.preservePaths,this.portable=!!C.portable,this.strict=!!C.strict,this.noPax=!!C.noPax,this.noMtime=!!C.noMtime,this.readEntry=c,this.type=c.type,this.type==="Directory"&&this.portable&&(this.noMtime=!0),this.prefix=C.prefix||null,this.path=n(c.path),this.mode=this[_](c.mode),this.uid=this.portable?null:c.uid,this.gid=this.portable?null:c.gid,this.uname=this.portable?null:c.uname,this.gname=this.portable?null:c.gname,this.size=c.size,this.mtime=this.noMtime?null:C.mtime||c.mtime,this.atime=this.portable?null:c.atime,this.ctime=this.portable?null:c.ctime,this.linkpath=n(c.linkpath),typeof C.onwarn=="function"&&this.on("warn",C.onwarn);let L=!1;if(!this.preservePaths){const[k,J]=U(this.path);k&&(this.path=J,L=k)}this.remain=c.size,this.blockRemain=c.startBlockSize,this.header=new r({path:this[x](this.path),linkpath:this.type==="Link"?this[x](this.linkpath):this.linkpath,mode:this.mode,uid:this.portable?null:this.uid,gid:this.portable?null:this.gid,size:this.size,mtime:this.noMtime?null:this.mtime,type:this.type,uname:this.portable?null:this.uname,atime:this.portable?null:this.atime,ctime:this.portable?null:this.ctime}),L&&this.warn("TAR_ENTRY_INFO",`stripping ${L} from absolute path`,{entry:this,path:L+this.path}),this.header.encode()&&!this.noPax&&super.write(new e({atime:this.portable?null:this.atime,ctime:this.portable?null:this.ctime,gid:this.portable?null:this.gid,mtime:this.noMtime?null:this.mtime,path:this[x](this.path),linkpath:this.type==="Link"?this[x](this.linkpath):this.linkpath,size:this.size,uid:this.portable?null:this.uid,uname:this.portable?null:this.uname,dev:this.portable?null:this.readEntry.dev,ino:this.portable?null:this.readEntry.ino,nlink:this.portable?null:this.readEntry.nlink}).encode()),super.write(this.header.block),c.pipe(this)}[x](c){return u(c,this.prefix)}[_](c){return Z(c,this.type==="Directory",this.portable)}write(c){const C=c.length;if(C>this.blockRemain)throw new Error("writing more to entry than is appropriate");return this.blockRemain-=C,super.write(c)}end(){return this.blockRemain&&super.write(Buffer.alloc(this.blockRemain)),super.end()}});N.Sync=V,N.Tar=q;const et=v=>v.isFile()?"File":v.isDirectory()?"Directory":v.isSymbolicLink()?"SymbolicLink":"Unsupported";return es=N,es}var ss,Zi;function Ru(){return Zi||(Zi=1,ss=function(i){i.prototype[Symbol.iterator]=function*(){for(let e=this.head;e;e=e.next)yield e.value}}),ss}var is,Xi;function Ji(){if(Xi)return is;Xi=1,is=i,i.Node=s,i.create=i;function i(n){var t=this;if(t instanceof i||(t=new i),t.tail=null,t.head=null,t.length=0,n&&typeof n.forEach=="function")n.forEach(function(m){t.push(m)});else if(arguments.length>0)for(var u=0,a=arguments.length;u<a;u++)t.push(arguments[u]);return t}i.prototype.removeNode=function(n){if(n.list!==this)throw new Error("removing node which does not belong to this list");var t=n.next,u=n.prev;return t&&(t.prev=u),u&&(u.next=t),n===this.head&&(this.head=t),n===this.tail&&(this.tail=u),n.list.length--,n.next=null,n.prev=null,n.list=null,t},i.prototype.unshiftNode=function(n){if(n!==this.head){n.list&&n.list.removeNode(n);var t=this.head;n.list=this,n.next=t,t&&(t.prev=n),this.head=n,this.tail||(this.tail=n),this.length++}},i.prototype.pushNode=function(n){if(n!==this.tail){n.list&&n.list.removeNode(n);var t=this.tail;n.list=this,n.prev=t,t&&(t.next=n),this.tail=n,this.head||(this.head=n),this.length++}},i.prototype.push=function(){for(var n=0,t=arguments.length;n<t;n++)r(this,arguments[n]);return this.length},i.prototype.unshift=function(){for(var n=0,t=arguments.length;n<t;n++)h(this,arguments[n]);return this.length},i.prototype.pop=function(){if(this.tail){var n=this.tail.value;return this.tail=this.tail.prev,this.tail?this.tail.next=null:this.head=null,this.length--,n}},i.prototype.shift=function(){if(this.head){var n=this.head.value;return this.head=this.head.next,this.head?this.head.prev=null:this.tail=null,this.length--,n}},i.prototype.forEach=function(n,t){t=t||this;for(var u=this.head,a=0;u!==null;a++)n.call(t,u.value,a,this),u=u.next},i.prototype.forEachReverse=function(n,t){t=t||this;for(var u=this.tail,a=this.length-1;u!==null;a--)n.call(t,u.value,a,this),u=u.prev},i.prototype.get=function(n){for(var t=0,u=this.head;u!==null&&t<n;t++)u=u.next;if(t===n&&u!==null)return u.value},i.prototype.getReverse=function(n){for(var t=0,u=this.tail;u!==null&&t<n;t++)u=u.prev;if(t===n&&u!==null)return u.value},i.prototype.map=function(n,t){t=t||this;for(var u=new i,a=this.head;a!==null;)u.push(n.call(t,a.value,this)),a=a.next;return u},i.prototype.mapReverse=function(n,t){t=t||this;for(var u=new i,a=this.tail;a!==null;)u.push(n.call(t,a.value,this)),a=a.prev;return u},i.prototype.reduce=function(n,t){var u,a=this.head;if(arguments.length>1)u=t;else if(this.head)a=this.head.next,u=this.head.value;else throw new TypeError("Reduce of empty list with no initial value");for(var m=0;a!==null;m++)u=n(u,a.value,m),a=a.next;return u},i.prototype.reduceReverse=function(n,t){var u,a=this.tail;if(arguments.length>1)u=t;else if(this.tail)a=this.tail.prev,u=this.tail.value;else throw new TypeError("Reduce of empty list with no initial value");for(var m=this.length-1;a!==null;m--)u=n(u,a.value,m),a=a.prev;return u},i.prototype.toArray=function(){for(var n=new Array(this.length),t=0,u=this.head;u!==null;t++)n[t]=u.value,u=u.next;return n},i.prototype.toArrayReverse=function(){for(var n=new Array(this.length),t=0,u=this.tail;u!==null;t++)n[t]=u.value,u=u.prev;return n},i.prototype.slice=function(n,t){t=t||this.length,t<0&&(t+=this.length),n=n||0,n<0&&(n+=this.length);var u=new i;if(t<n||t<0)return u;n<0&&(n=0),t>this.length&&(t=this.length);for(var a=0,m=this.head;m!==null&&a<n;a++)m=m.next;for(;m!==null&&a<t;a++,m=m.next)u.push(m.value);return u},i.prototype.sliceReverse=function(n,t){t=t||this.length,t<0&&(t+=this.length),n=n||0,n<0&&(n+=this.length);var u=new i;if(t<n||t<0)return u;n<0&&(n=0),t>this.length&&(t=this.length);for(var a=this.length,m=this.tail;m!==null&&a>t;a--)m=m.prev;for(;m!==null&&a>n;a--,m=m.prev)u.push(m.value);return u},i.prototype.splice=function(n,t,...u){n>this.length&&(n=this.length-1),n<0&&(n=this.length+n);for(var a=0,m=this.head;m!==null&&a<n;a++)m=m.next;for(var y=[],a=0;m&&a<t;a++)y.push(m.value),m=this.removeNode(m);m===null&&(m=this.tail),m!==this.head&&m!==this.tail&&(m=m.prev);for(var a=0;a<u.length;a++)m=e(this,m,u[a]);return y},i.prototype.reverse=function(){for(var n=this.head,t=this.tail,u=n;u!==null;u=u.prev){var a=u.prev;u.prev=u.next,u.next=a}return this.head=t,this.tail=n,this};function e(n,t,u){var a=t===n.head?new s(u,null,t,n):new s(u,t,t.next,n);return a.next===null&&(n.tail=a),a.prev===null&&(n.head=a),n.length++,a}function r(n,t){n.tail=new s(t,n.tail,null,n),n.head||(n.head=n.tail),n.length++}function h(n,t){n.head=new s(t,null,n.head,n),n.tail||(n.tail=n.head),n.length++}function s(n,t,u,a){if(!(this instanceof s))return new s(n,t,u,a);this.list=a,this.value=n,t?(t.next=this,this.prev=t):this.prev=null,u?(u.prev=this,this.next=u):this.next=null}try{Ru()(i)}catch{}return is}var rs,Qi;function ns(){if(Qi)return rs;Qi=1;class i{constructor(v,c){this.path=v||"./",this.absolute=c,this.entry=null,this.stat=null,this.readdir=null,this.pending=!1,this.ignore=!1,this.piped=!1}}const{Minipass:e}=Me(),r=$i(),h=Ue(),s=Yi(),n=s.Sync,t=s.Tar,u=Ji(),a=Buffer.alloc(1024),m=Symbol("onStat"),y=Symbol("ended"),g=Symbol("queue"),F=Symbol("current"),w=Symbol("process"),b=Symbol("processing"),A=Symbol("processJob"),R=Symbol("jobs"),o=Symbol("jobDone"),l=Symbol("addFSEntry"),D=Symbol("addTarEntry"),f=Symbol("stat"),d=Symbol("readdir"),p=Symbol("onreaddir"),_=Symbol("pipe"),O=Symbol("entry"),B=Symbol("entryOpt"),x=Symbol("writeEntryClass"),P=Symbol("write"),W=Symbol("ondrain"),j=yt,U=ft,Z=Xe(),N=Lt(),V=Z(class extends e{constructor(v){if(super(v),v=v||Object.create(null),this.opt=v,this.file=v.file||"",this.cwd=v.cwd||process.cwd(),this.maxReadSize=v.maxReadSize,this.preservePaths=!!v.preservePaths,this.strict=!!v.strict,this.noPax=!!v.noPax,this.prefix=N(v.prefix||""),this.linkCache=v.linkCache||new Map,this.statCache=v.statCache||new Map,this.readdirCache=v.readdirCache||new Map,this[x]=s,typeof v.onwarn=="function"&&this.on("warn",v.onwarn),this.portable=!!v.portable,this.zip=null,v.gzip||v.brotli){if(v.gzip&&v.brotli)throw new TypeError("gzip and brotli are mutually exclusive");v.gzip&&(typeof v.gzip!="object"&&(v.gzip={}),this.portable&&(v.gzip.portable=!0),this.zip=new r.Gzip(v.gzip)),v.brotli&&(typeof v.brotli!="object"&&(v.brotli={}),this.zip=new r.BrotliCompress(v.brotli)),this.zip.on("data",c=>super.write(c)),this.zip.on("end",c=>super.end()),this.zip.on("drain",c=>this[W]()),this.on("resume",c=>this.zip.resume())}else this.on("drain",this[W]);this.noDirRecurse=!!v.noDirRecurse,this.follow=!!v.follow,this.noMtime=!!v.noMtime,this.mtime=v.mtime||null,this.filter=typeof v.filter=="function"?v.filter:c=>!0,this[g]=new u,this[R]=0,this.jobs=+v.jobs||4,this[b]=!1,this[y]=!1}[P](v){return super.write(v)}add(v){return this.write(v),this}end(v){return v&&this.write(v),this[y]=!0,this[w](),this}write(v){if(this[y])throw new Error("write after end");return v instanceof h?this[D](v):this[l](v),this.flowing}[D](v){const c=N(U.resolve(this.cwd,v.path));if(!this.filter(v.path,v))v.resume();else{const C=new i(v.path,c,!1);C.entry=new t(v,this[B](C)),C.entry.on("end",L=>this[o](C)),this[R]+=1,this[g].push(C)}this[w]()}[l](v){const c=N(U.resolve(this.cwd,v));this[g].push(new i(v,c)),this[w]()}[f](v){v.pending=!0,this[R]+=1;const c=this.follow?"stat":"lstat";j[c](v.absolute,(C,L)=>{v.pending=!1,this[R]-=1,C?this.emit("error",C):this[m](v,L)})}[m](v,c){this.statCache.set(v.absolute,c),v.stat=c,this.filter(v.path,c)||(v.ignore=!0),this[w]()}[d](v){v.pending=!0,this[R]+=1,j.readdir(v.absolute,(c,C)=>{if(v.pending=!1,this[R]-=1,c)return this.emit("error",c);this[p](v,C)})}[p](v,c){this.readdirCache.set(v.absolute,c),v.readdir=c,this[w]()}[w](){if(!this[b]){this[b]=!0;for(let v=this[g].head;v!==null&&this[R]<this.jobs;v=v.next)if(this[A](v.value),v.value.ignore){const c=v.next;this[g].removeNode(v),v.next=c}this[b]=!1,this[y]&&!this[g].length&&this[R]===0&&(this.zip?this.zip.end(a):(super.write(a),super.end()))}}get[F](){return this[g]&&this[g].head&&this[g].head.value}[o](v){this[g].shift(),this[R]-=1,this[w]()}[A](v){if(!v.pending){if(v.entry){v===this[F]&&!v.piped&&this[_](v);return}if(v.stat||(this.statCache.has(v.absolute)?this[m](v,this.statCache.get(v.absolute)):this[f](v)),!!v.stat&&!v.ignore&&!(!this.noDirRecurse&&v.stat.isDirectory()&&!v.readdir&&(this.readdirCache.has(v.absolute)?this[p](v,this.readdirCache.get(v.absolute)):this[d](v),!v.readdir))){if(v.entry=this[O](v),!v.entry){v.ignore=!0;return}v===this[F]&&!v.piped&&this[_](v)}}}[B](v){return{onwarn:(c,C,L)=>this.warn(c,C,L),noPax:this.noPax,cwd:this.cwd,absolute:v.absolute,preservePaths:this.preservePaths,maxReadSize:this.maxReadSize,strict:this.strict,portable:this.portable,linkCache:this.linkCache,statCache:this.statCache,noMtime:this.noMtime,mtime:this.mtime,prefix:this.prefix}}[O](v){this[R]+=1;try{return new this[x](v.path,this[B](v)).on("end",()=>this[o](v)).on("error",c=>this.emit("error",c))}catch(c){this.emit("error",c)}}[W](){this[F]&&this[F].entry&&this[F].entry.resume()}[_](v){v.piped=!0,v.readdir&&v.readdir.forEach(L=>{const k=v.path,J=k==="./"?"":k.replace(/\/*$/,"/");this[l](J+L)});const c=v.entry,C=this.zip;C?c.on("data",L=>{C.write(L)||c.pause()}):c.on("data",L=>{super.write(L)||c.pause()})}pause(){return this.zip&&this.zip.pause(),super.pause()}});class q extends V{constructor(v){super(v),this[x]=n}pause(){}resume(){}[f](v){const c=this.follow?"statSync":"lstatSync";this[m](v,j[c](v.absolute))}[d](v,c){this[p](v,j.readdirSync(v.absolute))}[_](v){const c=v.entry,C=this.zip;v.readdir&&v.readdir.forEach(L=>{const k=v.path,J=k==="./"?"":k.replace(/\/*$/,"/");this[l](J+L)}),C?c.on("data",L=>{C.write(L)}):c.on("data",L=>{super[P](L)})}}return V.Sync=q,rs=V,rs}var xt={},tr;function kt(){if(tr)return xt;tr=1;const i=xi(),e=Vt.EventEmitter,r=yt;let h=r.writev;if(!h){const v=process.binding("fs"),c=v.FSReqWrap||v.FSReqCallback;h=(C,L,k,J)=>{const $=(G,S)=>J(G,S,L),z=new c;z.oncomplete=$,v.writeBuffers(C,L,k,z)}}const s=Symbol("_autoClose"),n=Symbol("_close"),t=Symbol("_ended"),u=Symbol("_fd"),a=Symbol("_finished"),m=Symbol("_flags"),y=Symbol("_flush"),g=Symbol("_handleChunk"),F=Symbol("_makeBuf"),w=Symbol("_mode"),b=Symbol("_needDrain"),A=Symbol("_onerror"),R=Symbol("_onopen"),o=Symbol("_onread"),l=Symbol("_onwrite"),D=Symbol("_open"),f=Symbol("_path"),d=Symbol("_pos"),p=Symbol("_queue"),_=Symbol("_read"),O=Symbol("_readSize"),B=Symbol("_reading"),x=Symbol("_remain"),P=Symbol("_size"),W=Symbol("_write"),j=Symbol("_writing"),U=Symbol("_defaultFlag"),Z=Symbol("_errored");class N extends i{constructor(c,C){if(C=C||{},super(C),this.readable=!0,this.writable=!1,typeof c!="string")throw new TypeError("path must be a string");this[Z]=!1,this[u]=typeof C.fd=="number"?C.fd:null,this[f]=c,this[O]=C.readSize||16*1024*1024,this[B]=!1,this[P]=typeof C.size=="number"?C.size:1/0,this[x]=this[P],this[s]=typeof C.autoClose=="boolean"?C.autoClose:!0,typeof this[u]=="number"?this[_]():this[D]()}get fd(){return this[u]}get path(){return this[f]}write(){throw new TypeError("this is a readable stream")}end(){throw new TypeError("this is a readable stream")}[D](){r.open(this[f],"r",(c,C)=>this[R](c,C))}[R](c,C){c?this[A](c):(this[u]=C,this.emit("open",C),this[_]())}[F](){return Buffer.allocUnsafe(Math.min(this[O],this[x]))}[_](){if(!this[B]){this[B]=!0;const c=this[F]();if(c.length===0)return process.nextTick(()=>this[o](null,0,c));r.read(this[u],c,0,c.length,null,(C,L,k)=>this[o](C,L,k))}}[o](c,C,L){this[B]=!1,c?this[A](c):this[g](C,L)&&this[_]()}[n](){if(this[s]&&typeof this[u]=="number"){const c=this[u];this[u]=null,r.close(c,C=>C?this.emit("error",C):this.emit("close"))}}[A](c){this[B]=!0,this[n](),this.emit("error",c)}[g](c,C){let L=!1;return this[x]-=c,c>0&&(L=super.write(c<C.length?C.slice(0,c):C)),(c===0||this[x]<=0)&&(L=!1,this[n](),super.end()),L}emit(c,C){switch(c){case"prefinish":case"finish":break;case"drain":typeof this[u]=="number"&&this[_]();break;case"error":return this[Z]?void 0:(this[Z]=!0,super.emit(c,C));default:return super.emit(c,C)}}}class V extends N{[D](){let c=!0;try{this[R](null,r.openSync(this[f],"r")),c=!1}finally{c&&this[n]()}}[_](){let c=!0;try{if(!this[B]){this[B]=!0;do{const C=this[F](),L=C.length===0?0:r.readSync(this[u],C,0,C.length,null);if(!this[g](L,C))break}while(!0);this[B]=!1}c=!1}finally{c&&this[n]()}}[n](){if(this[s]&&typeof this[u]=="number"){const c=this[u];this[u]=null,r.closeSync(c),this.emit("close")}}}class q extends e{constructor(c,C){C=C||{},super(C),this.readable=!1,this.writable=!0,this[Z]=!1,this[j]=!1,this[t]=!1,this[b]=!1,this[p]=[],this[f]=c,this[u]=typeof C.fd=="number"?C.fd:null,this[w]=C.mode===void 0?438:C.mode,this[d]=typeof C.start=="number"?C.start:null,this[s]=typeof C.autoClose=="boolean"?C.autoClose:!0;const L=this[d]!==null?"r+":"w";this[U]=C.flags===void 0,this[m]=this[U]?L:C.flags,this[u]===null&&this[D]()}emit(c,C){if(c==="error"){if(this[Z])return;this[Z]=!0}return super.emit(c,C)}get fd(){return this[u]}get path(){return this[f]}[A](c){this[n](),this[j]=!0,this.emit("error",c)}[D](){r.open(this[f],this[m],this[w],(c,C)=>this[R](c,C))}[R](c,C){this[U]&&this[m]==="r+"&&c&&c.code==="ENOENT"?(this[m]="w",this[D]()):c?this[A](c):(this[u]=C,this.emit("open",C),this[y]())}end(c,C){return c&&this.write(c,C),this[t]=!0,!this[j]&&!this[p].length&&typeof this[u]=="number"&&this[l](null,0),this}write(c,C){return typeof c=="string"&&(c=Buffer.from(c,C)),this[t]?(this.emit("error",new Error("write() after end()")),!1):this[u]===null||this[j]||this[p].length?(this[p].push(c),this[b]=!0,!1):(this[j]=!0,this[W](c),!0)}[W](c){r.write(this[u],c,0,c.length,this[d],(C,L)=>this[l](C,L))}[l](c,C){c?this[A](c):(this[d]!==null&&(this[d]+=C),this[p].length?this[y]():(this[j]=!1,this[t]&&!this[a]?(this[a]=!0,this[n](),this.emit("finish")):this[b]&&(this[b]=!1,this.emit("drain"))))}[y](){if(this[p].length===0)this[t]&&this[l](null,0);else if(this[p].length===1)this[W](this[p].pop());else{const c=this[p];this[p]=[],h(this[u],c,this[d],(C,L)=>this[l](C,L))}}[n](){if(this[s]&&typeof this[u]=="number"){const c=this[u];this[u]=null,r.close(c,C=>C?this.emit("error",C):this.emit("close"))}}}class et extends q{[D](){let c;if(this[U]&&this[m]==="r+")try{c=r.openSync(this[f],this[m],this[w])}catch(C){if(C.code==="ENOENT")return this[m]="w",this[D]();throw C}else c=r.openSync(this[f],this[m],this[w]);this[R](null,c)}[n](){if(this[s]&&typeof this[u]=="number"){const c=this[u];this[u]=null,r.closeSync(c),this.emit("close")}}[W](c){let C=!0;try{this[l](null,r.writeSync(this[u],c,0,c.length,this[d])),C=!1}finally{if(C)try{this[n]()}catch{}}}}return xt.ReadStream=N,xt.ReadStreamSync=V,xt.WriteStream=q,xt.WriteStreamSync=et,xt}var us,er;function os(){if(er)return us;er=1;const i=Xe(),e=Pt(),r=Vt,h=Ji(),s=1024*1024,n=Ue(),t=Ke(),u=$i(),{nextTick:a}=Kr,m=Buffer.from([31,139]),y=Symbol("state"),g=Symbol("writeEntry"),F=Symbol("readEntry"),w=Symbol("nextEntry"),b=Symbol("processEntry"),A=Symbol("extendedHeader"),R=Symbol("globalExtendedHeader"),o=Symbol("meta"),l=Symbol("emitMeta"),D=Symbol("buffer"),f=Symbol("queue"),d=Symbol("ended"),p=Symbol("emittedEnd"),_=Symbol("emit"),O=Symbol("unzip"),B=Symbol("consumeChunk"),x=Symbol("consumeChunkSub"),P=Symbol("consumeBody"),W=Symbol("consumeMeta"),j=Symbol("consumeHeader"),U=Symbol("consuming"),Z=Symbol("bufferConcat"),N=Symbol("maybeEnd"),V=Symbol("writing"),q=Symbol("aborted"),et=Symbol("onDone"),v=Symbol("sawValidEntry"),c=Symbol("sawNullBlock"),C=Symbol("sawEOF"),L=Symbol("closeStream"),k=J=>!0;return us=i(class extends r{constructor($){$=$||{},super($),this.file=$.file||"",this[v]=null,this.on(et,G=>{(this[y]==="begin"||this[v]===!1)&&this.warn("TAR_BAD_ARCHIVE","Unrecognized archive format")}),$.ondone?this.on(et,$.ondone):this.on(et,G=>{this.emit("prefinish"),this.emit("finish"),this.emit("end")}),this.strict=!!$.strict,this.maxMetaEntrySize=$.maxMetaEntrySize||s,this.filter=typeof $.filter=="function"?$.filter:k;const z=$.file&&($.file.endsWith(".tar.br")||$.file.endsWith(".tbr"));this.brotli=!$.gzip&&$.brotli!==void 0?$.brotli:z?void 0:!1,this.writable=!0,this.readable=!1,this[f]=new h,this[D]=null,this[F]=null,this[g]=null,this[y]="begin",this[o]="",this[A]=null,this[R]=null,this[d]=!1,this[O]=null,this[q]=!1,this[c]=!1,this[C]=!1,this.on("end",()=>this[L]()),typeof $.onwarn=="function"&&this.on("warn",$.onwarn),typeof $.onentry=="function"&&this.on("entry",$.onentry)}[j]($,z){this[v]===null&&(this[v]=!1);let G;try{G=new e($,z,this[A],this[R])}catch(S){return this.warn("TAR_ENTRY_INVALID",S)}if(G.nullBlock)this[c]?(this[C]=!0,this[y]==="begin"&&(this[y]="header"),this[_]("eof")):(this[c]=!0,this[_]("nullBlock"));else if(this[c]=!1,!G.cksumValid)this.warn("TAR_ENTRY_INVALID","checksum failure",{header:G});else if(!G.path)this.warn("TAR_ENTRY_INVALID","path is required",{header:G});else{const S=G.type;if(/^(Symbolic)?Link$/.test(S)&&!G.linkpath)this.warn("TAR_ENTRY_INVALID","linkpath required",{header:G});else if(!/^(Symbolic)?Link$/.test(S)&&G.linkpath)this.warn("TAR_ENTRY_INVALID","linkpath forbidden",{header:G});else{const T=this[g]=new n(G,this[A],this[R]);if(!this[v])if(T.remain){const K=()=>{T.invalid||(this[v]=!0)};T.on("end",K)}else this[v]=!0;T.meta?T.size>this.maxMetaEntrySize?(T.ignore=!0,this[_]("ignoredEntry",T),this[y]="ignore",T.resume()):T.size>0&&(this[o]="",T.on("data",K=>this[o]+=K),this[y]="meta"):(this[A]=null,T.ignore=T.ignore||!this.filter(T.path,T),T.ignore?(this[_]("ignoredEntry",T),this[y]=T.remain?"ignore":"header",T.resume()):(T.remain?this[y]="body":(this[y]="header",T.end()),this[F]?this[f].push(T):(this[f].push(T),this[w]())))}}}[L](){a(()=>this.emit("close"))}[b]($){let z=!0;return $?Array.isArray($)?this.emit.apply(this,$):(this[F]=$,this.emit("entry",$),$.emittedEnd||($.on("end",G=>this[w]()),z=!1)):(this[F]=null,z=!1),z}[w](){do;while(this[b](this[f].shift()));if(!this[f].length){const $=this[F];!$||$.flowing||$.size===$.remain?this[V]||this.emit("drain"):$.once("drain",G=>this.emit("drain"))}}[P]($,z){const G=this[g],S=G.blockRemain,T=S>=$.length&&z===0?$:$.slice(z,z+S);return G.write(T),G.blockRemain||(this[y]="header",this[g]=null,G.end()),T.length}[W]($,z){const G=this[g],S=this[P]($,z);return this[g]||this[l](G),S}[_]($,z,G){!this[f].length&&!this[F]?this.emit($,z,G):this[f].push([$,z,G])}[l]($){switch(this[_]("meta",this[o]),$.type){case"ExtendedHeader":case"OldExtendedHeader":this[A]=t.parse(this[o],this[A],!1);break;case"GlobalExtendedHeader":this[R]=t.parse(this[o],this[R],!0);break;case"NextFileHasLongPath":case"OldGnuLongPath":this[A]=this[A]||Object.create(null),this[A].path=this[o].replace(/\0.*/,"");break;case"NextFileHasLongLinkpath":this[A]=this[A]||Object.create(null),this[A].linkpath=this[o].replace(/\0.*/,"");break;default:throw new Error("unknown meta: "+$.type)}}abort($){this[q]=!0,this.emit("abort",$),this.warn("TAR_ABORT",$,{recoverable:!1})}write($){if(this[q])return;if((this[O]===null||this.brotli===void 0&&this[O]===!1)&&$){if(this[D]&&($=Buffer.concat([this[D],$]),this[D]=null),$.length<m.length)return this[D]=$,!0;for(let T=0;this[O]===null&&T<m.length;T++)$[T]!==m[T]&&(this[O]=!1);const S=this.brotli===void 0;if(this[O]===!1&&S)if($.length<512)if(this[d])this.brotli=!0;else return this[D]=$,!0;else try{new e($.slice(0,512)),this.brotli=!1}catch{this.brotli=!0}if(this[O]===null||this[O]===!1&&this.brotli){const T=this[d];this[d]=!1,this[O]=this[O]===null?new u.Unzip:new u.BrotliDecompress,this[O].on("data",at=>this[B](at)),this[O].on("error",at=>this.abort(at)),this[O].on("end",at=>{this[d]=!0,this[B]()}),this[V]=!0;const K=this[O][T?"end":"write"]($);return this[V]=!1,K}}this[V]=!0,this[O]?this[O].write($):this[B]($),this[V]=!1;const G=this[f].length?!1:this[F]?this[F].flowing:!0;return!G&&!this[f].length&&this[F].once("drain",S=>this.emit("drain")),G}[Z]($){$&&!this[q]&&(this[D]=this[D]?Buffer.concat([this[D],$]):$)}[N](){if(this[d]&&!this[p]&&!this[q]&&!this[U]){this[p]=!0;const $=this[g];if($&&$.blockRemain){const z=this[D]?this[D].length:0;this.warn("TAR_BAD_ARCHIVE",`Truncated input (needed ${$.blockRemain} more bytes, only ${z} available)`,{entry:$}),this[D]&&$.write(this[D]),$.end()}this[_](et)}}[B]($){if(this[U])this[Z]($);else if(!$&&!this[D])this[N]();else{if(this[U]=!0,this[D]){this[Z]($);const z=this[D];this[D]=null,this[x](z)}else this[x]($);for(;this[D]&&this[D].length>=512&&!this[q]&&!this[C];){const z=this[D];this[D]=null,this[x](z)}this[U]=!1}(!this[D]||this[d])&&this[N]()}[x]($){let z=0;const G=$.length;for(;z+512<=G&&!this[q]&&!this[C];)switch(this[y]){case"begin":case"header":this[j]($,z),z+=512;break;case"ignore":case"body":z+=this[P]($,z);break;case"meta":z+=this[W]($,z);break;default:throw new Error("invalid state: "+this[y])}z<G&&(this[D]?this[D]=Buffer.concat([$.slice(z),this[D]]):this[D]=$.slice(z))}end($){this[q]||(this[O]?this[O].end($):(this[d]=!0,this.brotli===void 0&&($=$||Buffer.alloc(0)),this.write($)))}}),us}var as,sr;function hs(){if(sr)return as;sr=1;const i=Nt(),e=os(),r=yt,h=kt(),s=ft,n=Mt();as=(g,F,w)=>{typeof g=="function"?(w=g,F=null,g={}):Array.isArray(g)&&(F=g,g={}),typeof F=="function"&&(w=F,F=null),F?F=Array.from(F):F=[];const b=i(g);if(b.sync&&typeof w=="function")throw new TypeError("callback not supported for sync tar functions");if(!b.file&&typeof w=="function")throw new TypeError("callback only supported with file option");return F.length&&u(b,F),b.noResume||t(b),b.file&&b.sync?a(b):b.file?m(b,w):y(b)};const t=g=>{const F=g.onentry;g.onentry=F?w=>{F(w),w.resume()}:w=>w.resume()},u=(g,F)=>{const w=new Map(F.map(R=>[n(R),!0])),b=g.filter,A=(R,o)=>{const l=o||s.parse(R).root||".",D=R===l?!1:w.has(R)?w.get(R):A(s.dirname(R),l);return w.set(R,D),D};g.filter=b?(R,o)=>b(R,o)&&A(n(R)):R=>A(n(R))},a=g=>{const F=y(g),w=g.file;let b=!0,A;try{const R=r.statSync(w),o=g.maxReadSize||16*1024*1024;if(R.size<o)F.end(r.readFileSync(w));else{let l=0;const D=Buffer.allocUnsafe(o);for(A=r.openSync(w,"r");l<R.size;){const f=r.readSync(A,D,0,o,l);l+=f,F.write(D.slice(0,f))}F.end()}b=!1}finally{if(b&&A)try{r.closeSync(A)}catch{}}},m=(g,F)=>{const w=new e(g),b=g.maxReadSize||16*1024*1024,A=g.file,R=new Promise((o,l)=>{w.on("error",l),w.on("end",o),r.stat(A,(D,f)=>{if(D)l(D);else{const d=new h.ReadStream(A,{readSize:b,size:f.size});d.on("error",l),d.pipe(w)}})});return F?R.then(F,F):R},y=g=>new e(g);return as}var ls,ir;function Bu(){if(ir)return ls;ir=1;const i=Nt(),e=ns(),r=kt(),h=hs(),s=ft;ls=(g,F,w)=>{if(typeof F=="function"&&(w=F),Array.isArray(g)&&(F=g,g={}),!F||!Array.isArray(F)||!F.length)throw new TypeError("no files or directories specified");F=Array.from(F);const b=i(g);if(b.sync&&typeof w=="function")throw new TypeError("callback not supported for sync tar functions");if(!b.file&&typeof w=="function")throw new TypeError("callback only supported with file option");return b.file&&b.sync?n(b,F):b.file?t(b,F,w):b.sync?m(b,F):y(b,F)};const n=(g,F)=>{const w=new e.Sync(g),b=new r.WriteStreamSync(g.file,{mode:g.mode||438});w.pipe(b),u(w,F)},t=(g,F,w)=>{const b=new e(g),A=new r.WriteStream(g.file,{mode:g.mode||438});b.pipe(A);const R=new Promise((o,l)=>{A.on("error",l),A.on("close",o),b.on("error",l)});return a(b,F),w?R.then(w,w):R},u=(g,F)=>{F.forEach(w=>{w.charAt(0)==="@"?h({file:s.resolve(g.cwd,w.slice(1)),sync:!0,noResume:!0,onentry:b=>g.add(b)}):g.add(w)}),g.end()},a=(g,F)=>{for(;F.length;){const w=F.shift();if(w.charAt(0)==="@")return h({file:s.resolve(g.cwd,w.slice(1)),noResume:!0,onentry:b=>g.add(b)}).then(b=>a(g,F));g.add(w)}g.end()},m=(g,F)=>{const w=new e.Sync(g);return u(w,F),w},y=(g,F)=>{const w=new e(g);return a(w,F),w};return ls}var cs,rr;function nr(){if(rr)return cs;rr=1;const i=Nt(),e=ns(),r=yt,h=kt(),s=hs(),n=ft,t=Pt();cs=(F,w,b)=>{const A=i(F);if(!A.file)throw new TypeError("file is required");if(A.gzip||A.brotli||A.file.endsWith(".br")||A.file.endsWith(".tbr"))throw new TypeError("cannot append to compressed archives");if(!w||!Array.isArray(w)||!w.length)throw new TypeError("no files or directories specified");return w=Array.from(w),A.sync?u(A,w):m(A,w,b)};const u=(F,w)=>{const b=new e.Sync(F);let A=!0,R,o;try{try{R=r.openSync(F.file,"r+")}catch(f){if(f.code==="ENOENT")R=r.openSync(F.file,"w+");else throw f}const l=r.fstatSync(R),D=Buffer.alloc(512);t:for(o=0;o<l.size;o+=512){for(let p=0,_=0;p<512;p+=_){if(_=r.readSync(R,D,p,D.length-p,o+p),o===0&&D[0]===31&&D[1]===139)throw new Error("cannot append to compressed archives");if(!_)break t}const f=new t(D);if(!f.cksumValid)break;const d=512*Math.ceil(f.size/512);if(o+d+512>l.size)break;o+=d,F.mtimeCache&&F.mtimeCache.set(f.path,f.mtime)}A=!1,a(F,b,o,R,w)}finally{if(A)try{r.closeSync(R)}catch{}}},a=(F,w,b,A,R)=>{const o=new h.WriteStreamSync(F.file,{fd:A,start:b});w.pipe(o),y(w,R)},m=(F,w,b)=>{w=Array.from(w);const A=new e(F),R=(l,D,f)=>{const d=(x,P)=>{x?r.close(l,W=>f(x)):f(null,P)};let p=0;if(D===0)return d(null,0);let _=0;const O=Buffer.alloc(512),B=(x,P)=>{if(x)return d(x);if(_+=P,_<512&&P)return r.read(l,O,_,O.length-_,p+_,B);if(p===0&&O[0]===31&&O[1]===139)return d(new Error("cannot append to compressed archives"));if(_<512)return d(null,p);const W=new t(O);if(!W.cksumValid)return d(null,p);const j=512*Math.ceil(W.size/512);if(p+j+512>D||(p+=j+512,p>=D))return d(null,p);F.mtimeCache&&F.mtimeCache.set(W.path,W.mtime),_=0,r.read(l,O,0,512,p,B)};r.read(l,O,0,512,p,B)},o=new Promise((l,D)=>{A.on("error",D);let f="r+";const d=(p,_)=>{if(p&&p.code==="ENOENT"&&f==="r+")return f="w+",r.open(F.file,f,d);if(p)return D(p);r.fstat(_,(O,B)=>{if(O)return r.close(_,()=>D(O));R(_,B.size,(x,P)=>{if(x)return D(x);const W=new h.WriteStream(F.file,{fd:_,start:P});A.pipe(W),W.on("error",D),W.on("close",l),g(A,w)})})};r.open(F.file,f,d)});return b?o.then(b,b):o},y=(F,w)=>{w.forEach(b=>{b.charAt(0)==="@"?s({file:n.resolve(F.cwd,b.slice(1)),sync:!0,noResume:!0,onentry:A=>F.add(A)}):F.add(b)}),F.end()},g=(F,w)=>{for(;w.length;){const b=w.shift();if(b.charAt(0)==="@")return s({file:n.resolve(F.cwd,b.slice(1)),noResume:!0,onentry:A=>F.add(A)}).then(A=>g(F,w));F.add(b)}F.end()};return cs}var Ds,ur;function xu(){if(ur)return Ds;ur=1;const i=Nt(),e=nr();Ds=(h,s,n)=>{const t=i(h);if(!t.file)throw new TypeError("file is required");if(t.gzip||t.brotli||t.file.endsWith(".br")||t.file.endsWith(".tbr"))throw new TypeError("cannot append to compressed archives");if(!s||!Array.isArray(s)||!s.length)throw new TypeError("no files or directories specified");return s=Array.from(s),r(t),e(t,s,n)};const r=h=>{const s=h.filter;h.mtimeCache||(h.mtimeCache=new Map),h.filter=s?(n,t)=>s(n,t)&&!(h.mtimeCache.get(n)>t.mtime):(n,t)=>!(h.mtimeCache.get(n)>t.mtime)};return Ds}var ue={exports:{}},ds,or;function Tu(){if(or)return ds;or=1;const{promisify:i}=Yr,e=yt;return ds=h=>{if(!h)h={mode:511,fs:e};else if(typeof h=="object")h={mode:511,fs:e,...h};else if(typeof h=="number")h={mode:h,fs:e};else if(typeof h=="string")h={mode:parseInt(h,8),fs:e};else throw new TypeError("invalid options argument");return h.mkdir=h.mkdir||h.fs.mkdir||e.mkdir,h.mkdirAsync=i(h.mkdir),h.stat=h.stat||h.fs.stat||e.stat,h.statAsync=i(h.stat),h.statSync=h.statSync||h.fs.statSync||e.statSync,h.mkdirSync=h.mkdirSync||h.fs.mkdirSync||e.mkdirSync,h},ds}var fs,ar;function $u(){if(ar)return fs;ar=1;const i=process.env.__TESTING_MKDIRP_PLATFORM__||process.platform,{resolve:e,parse:r}=ft;return fs=s=>{if(/\0/.test(s))throw Object.assign(new TypeError("path must be a string without null bytes"),{path:s,code:"ERR_INVALID_ARG_VALUE"});if(s=e(s),i==="win32"){const n=/[*|"<>?:]/,{root:t}=r(s);if(n.test(s.substr(t.length)))throw Object.assign(new Error("Illegal characters in path."),{path:s,code:"EINVAL"})}return s},fs}var ms,hr;function Iu(){if(hr)return ms;hr=1;const{dirname:i}=ft,e=(h,s,n=void 0)=>n===s?Promise.resolve():h.statAsync(s).then(t=>t.isDirectory()?n:void 0,t=>t.code==="ENOENT"?e(h,i(s),s):void 0),r=(h,s,n=void 0)=>{if(n!==s)try{return h.statSync(s).isDirectory()?n:void 0}catch(t){return t.code==="ENOENT"?r(h,i(s),s):void 0}};return ms={findMade:e,findMadeSync:r},ms}var ps,lr;function cr(){if(lr)return ps;lr=1;const{dirname:i}=ft,e=(h,s,n)=>{s.recursive=!1;const t=i(h);return t===h?s.mkdirAsync(h,s).catch(u=>{if(u.code!=="EISDIR")throw u}):s.mkdirAsync(h,s).then(()=>n||h,u=>{if(u.code==="ENOENT")return e(t,s).then(a=>e(h,s,a));if(u.code!=="EEXIST"&&u.code!=="EROFS")throw u;return s.statAsync(h).then(a=>{if(a.isDirectory())return n;throw u},()=>{throw u})})},r=(h,s,n)=>{const t=i(h);if(s.recursive=!1,t===h)try{return s.mkdirSync(h,s)}catch(u){if(u.code!=="EISDIR")throw u;return}try{return s.mkdirSync(h,s),n||h}catch(u){if(u.code==="ENOENT")return r(h,s,r(t,s,n));if(u.code!=="EEXIST"&&u.code!=="EROFS")throw u;try{if(!s.statSync(h).isDirectory())throw u}catch{throw u}}};return ps={mkdirpManual:e,mkdirpManualSync:r},ps}var gs,Dr;function Nu(){if(Dr)return gs;Dr=1;const{dirname:i}=ft,{findMade:e,findMadeSync:r}=Iu(),{mkdirpManual:h,mkdirpManualSync:s}=cr();return gs={mkdirpNative:(u,a)=>(a.recursive=!0,i(u)===u?a.mkdirAsync(u,a):e(a,u).then(y=>a.mkdirAsync(u,a).then(()=>y).catch(g=>{if(g.code==="ENOENT")return h(u,a);throw g}))),mkdirpNativeSync:(u,a)=>{if(a.recursive=!0,i(u)===u)return a.mkdirSync(u,a);const y=r(a,u);try{return a.mkdirSync(u,a),y}catch(g){if(g.code==="ENOENT")return s(u,a);throw g}}},gs}var Es,dr;function Lu(){if(dr)return Es;dr=1;const i=yt,r=(process.env.__TESTING_MKDIRP_NODE_VERSION__||process.version).replace(/^v/,"").split("."),h=+r[0]>10||+r[0]==10&&+r[1]>=12;return Es={useNative:h?t=>t.mkdir===i.mkdir:()=>!1,useNativeSync:h?t=>t.mkdirSync===i.mkdirSync:()=>!1},Es}var Cs,fr;function Pu(){if(fr)return Cs;fr=1;const i=Tu(),e=$u(),{mkdirpNative:r,mkdirpNativeSync:h}=Nu(),{mkdirpManual:s,mkdirpManualSync:n}=cr(),{useNative:t,useNativeSync:u}=Lu(),a=(y,g)=>(y=e(y),g=i(g),t(g)?r(y,g):s(y,g)),m=(y,g)=>(y=e(y),g=i(g),u(g)?h(y,g):n(y,g));return a.sync=m,a.native=(y,g)=>r(e(y),i(g)),a.manual=(y,g)=>s(e(y),i(g)),a.nativeSync=(y,g)=>h(e(y),i(g)),a.manualSync=(y,g)=>n(e(y),i(g)),Cs=a,Cs}var Fs,mr;function Mu(){if(mr)return Fs;mr=1;const i=yt,e=ft,r=i.lchown?"lchown":"chown",h=i.lchownSync?"lchownSync":"chownSync",s=i.lchown&&!process.version.match(/v1[1-9]+\./)&&!process.version.match(/v10\.[6-9]/),n=(o,l,D)=>{try{return i[h](o,l,D)}catch(f){if(f.code!=="ENOENT")throw f}},t=(o,l,D)=>{try{return i.chownSync(o,l,D)}catch(f){if(f.code!=="ENOENT")throw f}},u=s?(o,l,D,f)=>d=>{!d||d.code!=="EISDIR"?f(d):i.chown(o,l,D,f)}:(o,l,D,f)=>f,a=s?(o,l,D)=>{try{return n(o,l,D)}catch(f){if(f.code!=="EISDIR")throw f;t(o,l,D)}}:(o,l,D)=>n(o,l,D),m=process.version;let y=(o,l,D)=>i.readdir(o,l,D),g=(o,l)=>i.readdirSync(o,l);/^v4\./.test(m)&&(y=(o,l,D)=>i.readdir(o,D));const F=(o,l,D,f)=>{i[r](o,l,D,u(o,l,D,d=>{f(d&&d.code!=="ENOENT"?d:null)}))},w=(o,l,D,f,d)=>{if(typeof l=="string")return i.lstat(e.resolve(o,l),(p,_)=>{if(p)return d(p.code!=="ENOENT"?p:null);_.name=l,w(o,_,D,f,d)});if(l.isDirectory())b(e.resolve(o,l.name),D,f,p=>{if(p)return d(p);const _=e.resolve(o,l.name);F(_,D,f,d)});else{const p=e.resolve(o,l.name);F(p,D,f,d)}},b=(o,l,D,f)=>{y(o,{withFileTypes:!0},(d,p)=>{if(d){if(d.code==="ENOENT")return f();if(d.code!=="ENOTDIR"&&d.code!=="ENOTSUP")return f(d)}if(d||!p.length)return F(o,l,D,f);let _=p.length,O=null;const B=x=>{if(!O){if(x)return f(O=x);if(--_===0)return F(o,l,D,f)}};p.forEach(x=>w(o,x,l,D,B))})},A=(o,l,D,f)=>{if(typeof l=="string")try{const d=i.lstatSync(e.resolve(o,l));d.name=l,l=d}catch(d){if(d.code==="ENOENT")return;throw d}l.isDirectory()&&R(e.resolve(o,l.name),D,f),a(e.resolve(o,l.name),D,f)},R=(o,l,D)=>{let f;try{f=g(o,{withFileTypes:!0})}catch(d){if(d.code==="ENOENT")return;if(d.code==="ENOTDIR"||d.code==="ENOTSUP")return a(o,l,D);throw d}return f&&f.length&&f.forEach(d=>A(o,d,l,D)),a(o,l,D)};return Fs=b,b.sync=R,Fs}var pr;function ku(){if(pr)return ue.exports;pr=1;const i=Pu(),e=yt,r=ft,h=Mu(),s=Lt();class n extends Error{constructor(b,A){super("Cannot extract through symbolic link"),this.path=A,this.symlink=b}get name(){return"SylinkError"}}class t extends Error{constructor(b,A){super(A+": Cannot cd into '"+b+"'"),this.path=b,this.code=A}get name(){return"CwdError"}}const u=(w,b)=>w.get(s(b)),a=(w,b,A)=>w.set(s(b),A),m=(w,b)=>{e.stat(w,(A,R)=>{(A||!R.isDirectory())&&(A=new t(w,A&&A.code||"ENOTDIR")),b(A)})};ue.exports=(w,b,A)=>{w=s(w);const R=b.umask,o=b.mode|448,l=(o&R)!==0,D=b.uid,f=b.gid,d=typeof D=="number"&&typeof f=="number"&&(D!==b.processUid||f!==b.processGid),p=b.preserve,_=b.unlink,O=b.cache,B=s(b.cwd),x=(j,U)=>{j?A(j):(a(O,w,!0),U&&d?h(U,D,f,Z=>x(Z)):l?e.chmod(w,o,A):A())};if(O&&u(O,w)===!0)return x();if(w===B)return m(w,x);if(p)return i(w,{mode:o}).then(j=>x(null,j),x);const W=s(r.relative(B,w)).split("/");y(B,W,o,O,_,B,null,x)};const y=(w,b,A,R,o,l,D,f)=>{if(!b.length)return f(null,D);const d=b.shift(),p=s(r.resolve(w+"/"+d));if(u(R,p))return y(p,b,A,R,o,l,D,f);e.mkdir(p,A,g(p,b,A,R,o,l,D,f))},g=(w,b,A,R,o,l,D,f)=>d=>{d?e.lstat(w,(p,_)=>{if(p)p.path=p.path&&s(p.path),f(p);else if(_.isDirectory())y(w,b,A,R,o,l,D,f);else if(o)e.unlink(w,O=>{if(O)return f(O);e.mkdir(w,A,g(w,b,A,R,o,l,D,f))});else{if(_.isSymbolicLink())return f(new n(w,w+"/"+b.join("/")));f(d)}}):(D=D||w,y(w,b,A,R,o,l,D,f))},F=w=>{let b=!1,A="ENOTDIR";try{b=e.statSync(w).isDirectory()}catch(R){A=R.code}finally{if(!b)throw new t(w,A)}};return ue.exports.sync=(w,b)=>{w=s(w);const A=b.umask,R=b.mode|448,o=(R&A)!==0,l=b.uid,D=b.gid,f=typeof l=="number"&&typeof D=="number"&&(l!==b.processUid||D!==b.processGid),d=b.preserve,p=b.unlink,_=b.cache,O=s(b.cwd),B=j=>{a(_,w,!0),j&&f&&h.sync(j,l,D),o&&e.chmodSync(w,R)};if(_&&u(_,w)===!0)return B();if(w===O)return F(O),B();if(d)return B(i.sync(w,R));const P=s(r.relative(O,w)).split("/");let W=null;for(let j=P.shift(),U=O;j&&(U+="/"+j);j=P.shift())if(U=s(r.resolve(U)),!u(_,U))try{e.mkdirSync(U,R),W=W||U,a(_,U,!0)}catch{const N=e.lstatSync(U);if(N.isDirectory()){a(_,U,!0);continue}else if(p){e.unlinkSync(U),e.mkdirSync(U,R),W=W||U,a(_,U,!0);continue}else if(N.isSymbolicLink())return new n(U,U+"/"+P.join("/"))}return B(W)},ue.exports}var ys,gr;function Er(){if(gr)return ys;gr=1;const i=Object.create(null),{hasOwnProperty:e}=Object.prototype;return ys=r=>(e.call(i,r)||(i[r]=r.normalize("NFD")),i[r]),ys}var bs,Cr;function Hu(){if(Cr)return bs;Cr=1;const i=de,e=Er(),r=Mt(),{join:h}=ft,n=(process.env.TESTING_TAR_FAKE_PLATFORM||process.platform)==="win32";return bs=()=>{const t=new Map,u=new Map,a=A=>A.split("/").slice(0,-1).reduce((o,l)=>(o.length&&(l=h(o[o.length-1],l)),o.push(l||"/"),o),[]),m=new Set,y=A=>{const R=u.get(A);if(!R)throw new Error("function does not have any path reservations");return{paths:R.paths.map(o=>t.get(o)),dirs:[...R.dirs].map(o=>t.get(o))}},g=A=>{const{paths:R,dirs:o}=y(A);return R.every(l=>l[0]===A)&&o.every(l=>l[0]instanceof Set&&l[0].has(A))},F=A=>m.has(A)||!g(A)?!1:(m.add(A),A(()=>w(A)),!0),w=A=>{if(!m.has(A))return!1;const{paths:R,dirs:o}=u.get(A),l=new Set;return R.forEach(D=>{const f=t.get(D);i.equal(f[0],A),f.length===1?t.delete(D):(f.shift(),typeof f[0]=="function"?l.add(f[0]):f[0].forEach(d=>l.add(d)))}),o.forEach(D=>{const f=t.get(D);i(f[0]instanceof Set),f[0].size===1&&f.length===1?t.delete(D):f[0].size===1?(f.shift(),l.add(f[0])):f[0].delete(A)}),m.delete(A),l.forEach(D=>F(D)),!0};return{check:g,reserve:(A,R)=>{A=n?["win32 parallelization disabled"]:A.map(l=>r(h(e(l))).toLowerCase());const o=new Set(A.map(l=>a(l)).reduce((l,D)=>l.concat(D)));return u.set(R,{dirs:o,paths:A}),A.forEach(l=>{const D=t.get(l);D?D.push(R):t.set(l,[R])}),o.forEach(l=>{const D=t.get(l);D?D[D.length-1]instanceof Set?D[D.length-1].add(R):D.push(new Set([R])):t.set(l,[new Set([R])])}),F(R)}}},bs}var _s,Fr;function ju(){if(Fr)return _s;Fr=1;const e=(process.env.__FAKE_PLATFORM__||process.platform)==="win32",r=fe.__FAKE_TESTING_FS__||yt,{O_CREAT:h,O_TRUNC:s,O_WRONLY:n,UV_FS_O_FILEMAP:t=0}=r.constants,u=e&&!!t,a=512*1024,m=t|s|h|n;return _s=u?y=>y<a?m:"w":()=>"w",_s}var ws,yr;function br(){if(yr)return ws;yr=1;const i=de,e=os(),r=yt,h=kt(),s=ft,n=ku(),t=Wi(),u=Hu(),a=Vi(),m=Lt(),y=Mt(),g=Er(),F=Symbol("onEntry"),w=Symbol("checkFs"),b=Symbol("checkFs2"),A=Symbol("pruneCache"),R=Symbol("isReusable"),o=Symbol("makeFs"),l=Symbol("file"),D=Symbol("directory"),f=Symbol("link"),d=Symbol("symlink"),p=Symbol("hardlink"),_=Symbol("unsupported"),O=Symbol("checkPath"),B=Symbol("mkdir"),x=Symbol("onError"),P=Symbol("pending"),W=Symbol("pend"),j=Symbol("unpend"),U=Symbol("ended"),Z=Symbol("maybeClose"),N=Symbol("skip"),V=Symbol("doChown"),q=Symbol("uid"),et=Symbol("gid"),v=Symbol("checkedCwd"),c=Zr,C=ju(),k=(process.env.TESTING_TAR_FAKE_PLATFORM||process.platform)==="win32",J=1024,$=(st,E)=>{if(!k)return r.unlink(st,E);const M=st+".DELETE."+c.randomBytes(16).toString("hex");r.rename(st,M,H=>{if(H)return E(H);r.unlink(M,E)})},z=st=>{if(!k)return r.unlinkSync(st);const E=st+".DELETE."+c.randomBytes(16).toString("hex");r.renameSync(st,E),r.unlinkSync(E)},G=(st,E,M)=>st===st>>>0?st:E===E>>>0?E:M,S=st=>y(m(g(st))).toLowerCase(),T=(st,E)=>{E=S(E);for(const M of st.keys()){const H=S(M);(H===E||H.indexOf(E+"/")===0)&&st.delete(M)}},K=st=>{for(const E of st.keys())st.delete(E)};class at extends e{constructor(E){if(E||(E={}),E.ondone=M=>{this[U]=!0,this[Z]()},super(E),this[v]=!1,this.reservations=u(),this.transform=typeof E.transform=="function"?E.transform:null,this.writable=!0,this.readable=!1,this[P]=0,this[U]=!1,this.dirCache=E.dirCache||new Map,typeof E.uid=="number"||typeof E.gid=="number"){if(typeof E.uid!="number"||typeof E.gid!="number")throw new TypeError("cannot set owner without number uid and gid");if(E.preserveOwner)throw new TypeError("cannot preserve owner in archive and also set owner explicitly");this.uid=E.uid,this.gid=E.gid,this.setOwner=!0}else this.uid=null,this.gid=null,this.setOwner=!1;E.preserveOwner===void 0&&typeof E.uid!="number"?this.preserveOwner=process.getuid&&process.getuid()===0:this.preserveOwner=!!E.preserveOwner,this.processUid=(this.preserveOwner||this.setOwner)&&process.getuid?process.getuid():null,this.processGid=(this.preserveOwner||this.setOwner)&&process.getgid?process.getgid():null,this.maxDepth=typeof E.maxDepth=="number"?E.maxDepth:J,this.forceChown=E.forceChown===!0,this.win32=!!E.win32||k,this.newer=!!E.newer,this.keep=!!E.keep,this.noMtime=!!E.noMtime,this.preservePaths=!!E.preservePaths,this.unlink=!!E.unlink,this.cwd=m(s.resolve(E.cwd||process.cwd())),this.strip=+E.strip||0,this.processUmask=E.noChmod?0:process.umask(),this.umask=typeof E.umask=="number"?E.umask:this.processUmask,this.dmode=E.dmode||511&~this.umask,this.fmode=E.fmode||438&~this.umask,this.on("entry",M=>this[F](M))}warn(E,M,H={}){return(E==="TAR_BAD_ARCHIVE"||E==="TAR_ABORT")&&(H.recoverable=!1),super.warn(E,M,H)}[Z](){this[U]&&this[P]===0&&(this.emit("prefinish"),this.emit("finish"),this.emit("end"))}[O](E){const M=m(E.path),H=M.split("/");if(this.strip){if(H.length<this.strip)return!1;if(E.type==="Link"){const Y=m(E.linkpath).split("/");if(Y.length>=this.strip)E.linkpath=Y.slice(this.strip).join("/");else return!1}H.splice(0,this.strip),E.path=H.join("/")}if(isFinite(this.maxDepth)&&H.length>this.maxDepth)return this.warn("TAR_ENTRY_ERROR","path excessively deep",{entry:E,path:M,depth:H.length,maxDepth:this.maxDepth}),!1;if(!this.preservePaths){if(H.includes("..")||k&&/^[a-z]:\.\.$/i.test(H[0]))return this.warn("TAR_ENTRY_ERROR","path contains '..'",{entry:E,path:M}),!1;const[Y,X]=a(M);Y&&(E.path=X,this.warn("TAR_ENTRY_INFO",`stripping ${Y} from absolute path`,{entry:E,path:M}))}if(s.isAbsolute(E.path)?E.absolute=m(s.resolve(E.path)):E.absolute=m(s.resolve(this.cwd,E.path)),!this.preservePaths&&E.absolute.indexOf(this.cwd+"/")!==0&&E.absolute!==this.cwd)return this.warn("TAR_ENTRY_ERROR","path escaped extraction target",{entry:E,path:m(E.path),resolvedPath:E.absolute,cwd:this.cwd}),!1;if(E.absolute===this.cwd&&E.type!=="Directory"&&E.type!=="GNUDumpDir")return!1;if(this.win32){const{root:Y}=s.win32.parse(E.absolute);E.absolute=Y+t.encode(E.absolute.slice(Y.length));const{root:X}=s.win32.parse(E.path);E.path=X+t.encode(E.path.slice(X.length))}return!0}[F](E){if(!this[O](E))return E.resume();switch(i.equal(typeof E.absolute,"string"),E.type){case"Directory":case"GNUDumpDir":E.mode&&(E.mode=E.mode|448);case"File":case"OldFile":case"ContiguousFile":case"Link":case"SymbolicLink":return this[w](E);case"CharacterDevice":case"BlockDevice":case"FIFO":default:return this[_](E)}}[x](E,M){E.name==="CwdError"?this.emit("error",E):(this.warn("TAR_ENTRY_ERROR",E,{entry:M}),this[j](),M.resume())}[B](E,M,H){n(m(E),{uid:this.uid,gid:this.gid,processUid:this.processUid,processGid:this.processGid,umask:this.processUmask,preserve:this.preservePaths,unlink:this.unlink,cache:this.dirCache,cwd:this.cwd,mode:M,noChmod:this.noChmod},H)}[V](E){return this.forceChown||this.preserveOwner&&(typeof E.uid=="number"&&E.uid!==this.processUid||typeof E.gid=="number"&&E.gid!==this.processGid)||typeof this.uid=="number"&&this.uid!==this.processUid||typeof this.gid=="number"&&this.gid!==this.processGid}[q](E){return G(this.uid,E.uid,this.processUid)}[et](E){return G(this.gid,E.gid,this.processGid)}[l](E,M){const H=E.mode&4095||this.fmode,Y=new h.WriteStream(E.absolute,{flags:C(E.size),mode:H,autoClose:!1});Y.on("error",rt=>{Y.fd&&r.close(Y.fd,()=>{}),Y.write=()=>!0,this[x](rt,E),M()});let X=1;const ot=rt=>{if(rt){Y.fd&&r.close(Y.fd,()=>{}),this[x](rt,E),M();return}--X===0&&r.close(Y.fd,lt=>{lt?this[x](lt,E):this[j](),M()})};Y.on("finish",rt=>{const lt=E.absolute,bt=Y.fd;if(E.mtime&&!this.noMtime){X++;const _t=E.atime||new Date,Ot=E.mtime;r.futimes(bt,_t,Ot,Tt=>Tt?r.utimes(lt,_t,Ot,he=>ot(he&&Tt)):ot())}if(this[V](E)){X++;const _t=this[q](E),Ot=this[et](E);r.fchown(bt,_t,Ot,Tt=>Tt?r.chown(lt,_t,Ot,he=>ot(he&&Tt)):ot())}ot()});const it=this.transform&&this.transform(E)||E;it!==E&&(it.on("error",rt=>{this[x](rt,E),M()}),E.pipe(it)),it.pipe(Y)}[D](E,M){const H=E.mode&4095||this.dmode;this[B](E.absolute,H,Y=>{if(Y){this[x](Y,E),M();return}let X=1;const ot=it=>{--X===0&&(M(),this[j](),E.resume())};E.mtime&&!this.noMtime&&(X++,r.utimes(E.absolute,E.atime||new Date,E.mtime,ot)),this[V](E)&&(X++,r.chown(E.absolute,this[q](E),this[et](E),ot)),ot()})}[_](E){E.unsupported=!0,this.warn("TAR_ENTRY_UNSUPPORTED",`unsupported entry type: ${E.type}`,{entry:E}),E.resume()}[d](E,M){this[f](E,E.linkpath,"symlink",M)}[p](E,M){const H=m(s.resolve(this.cwd,E.linkpath));this[f](E,H,"link",M)}[W](){this[P]++}[j](){this[P]--,this[Z]()}[N](E){this[j](),E.resume()}[R](E,M){return E.type==="File"&&!this.unlink&&M.isFile()&&M.nlink<=1&&!k}[w](E){this[W]();const M=[E.path];E.linkpath&&M.push(E.linkpath),this.reservations.reserve(M,H=>this[b](E,H))}[A](E){E.type==="SymbolicLink"?K(this.dirCache):E.type!=="Directory"&&T(this.dirCache,E.absolute)}[b](E,M){this[A](E);const H=it=>{this[A](E),M(it)},Y=()=>{this[B](this.cwd,this.dmode,it=>{if(it){this[x](it,E),H();return}this[v]=!0,X()})},X=()=>{if(E.absolute!==this.cwd){const it=m(s.dirname(E.absolute));if(it!==this.cwd)return this[B](it,this.dmode,rt=>{if(rt){this[x](rt,E),H();return}ot()})}ot()},ot=()=>{r.lstat(E.absolute,(it,rt)=>{if(rt&&(this.keep||this.newer&&rt.mtime>E.mtime)){this[N](E),H();return}if(it||this[R](E,rt))return this[o](null,E,H);if(rt.isDirectory()){if(E.type==="Directory"){const lt=!this.noChmod&&E.mode&&(rt.mode&4095)!==E.mode,bt=_t=>this[o](_t,E,H);return lt?r.chmod(E.absolute,E.mode,bt):bt()}if(E.absolute!==this.cwd)return r.rmdir(E.absolute,lt=>this[o](lt,E,H))}if(E.absolute===this.cwd)return this[o](null,E,H);$(E.absolute,lt=>this[o](lt,E,H))})};this[v]?X():Y()}[o](E,M,H){if(E){this[x](E,M),H();return}switch(M.type){case"File":case"OldFile":case"ContiguousFile":return this[l](M,H);case"Link":return this[p](M,H);case"SymbolicLink":return this[d](M,H);case"Directory":case"GNUDumpDir":return this[D](M,H)}}[f](E,M,H,Y){r[H](M,E.absolute,X=>{X?this[x](X,E):(this[j](),E.resume()),Y()})}}const Dt=st=>{try{return[null,st()]}catch(E){return[E,null]}};class Wt extends at{[o](E,M){return super[o](E,M,()=>{})}[w](E){if(this[A](E),!this[v]){const X=this[B](this.cwd,this.dmode);if(X)return this[x](X,E);this[v]=!0}if(E.absolute!==this.cwd){const X=m(s.dirname(E.absolute));if(X!==this.cwd){const ot=this[B](X,this.dmode);if(ot)return this[x](ot,E)}}const[M,H]=Dt(()=>r.lstatSync(E.absolute));if(H&&(this.keep||this.newer&&H.mtime>E.mtime))return this[N](E);if(M||this[R](E,H))return this[o](null,E);if(H.isDirectory()){if(E.type==="Directory"){const ot=!this.noChmod&&E.mode&&(H.mode&4095)!==E.mode,[it]=ot?Dt(()=>{r.chmodSync(E.absolute,E.mode)}):[];return this[o](it,E)}const[X]=Dt(()=>r.rmdirSync(E.absolute));this[o](X,E)}const[Y]=E.absolute===this.cwd?[]:Dt(()=>z(E.absolute));this[o](Y,E)}[l](E,M){const H=E.mode&4095||this.fmode,Y=it=>{let rt;try{r.closeSync(X)}catch(lt){rt=lt}(it||rt)&&this[x](it||rt,E),M()};let X;try{X=r.openSync(E.absolute,C(E.size),H)}catch(it){return Y(it)}const ot=this.transform&&this.transform(E)||E;ot!==E&&(ot.on("error",it=>this[x](it,E)),E.pipe(ot)),ot.on("data",it=>{try{r.writeSync(X,it,0,it.length)}catch(rt){Y(rt)}}),ot.on("end",it=>{let rt=null;if(E.mtime&&!this.noMtime){const lt=E.atime||new Date,bt=E.mtime;try{r.futimesSync(X,lt,bt)}catch(_t){try{r.utimesSync(E.absolute,lt,bt)}catch{rt=_t}}}if(this[V](E)){const lt=this[q](E),bt=this[et](E);try{r.fchownSync(X,lt,bt)}catch(_t){try{r.chownSync(E.absolute,lt,bt)}catch{rt=rt||_t}}}Y(rt)})}[D](E,M){const H=E.mode&4095||this.dmode,Y=this[B](E.absolute,H);if(Y){this[x](Y,E),M();return}if(E.mtime&&!this.noMtime)try{r.utimesSync(E.absolute,E.atime||new Date,E.mtime)}catch{}if(this[V](E))try{r.chownSync(E.absolute,this[q](E),this[et](E))}catch{}M(),E.resume()}[B](E,M){try{return n.sync(m(E),{uid:this.uid,gid:this.gid,processUid:this.processUid,processGid:this.processGid,umask:this.processUmask,preserve:this.preservePaths,unlink:this.unlink,cache:this.dirCache,cwd:this.cwd,mode:M})}catch(H){return H}}[f](E,M,H,Y){try{r[H+"Sync"](M,E.absolute),Y(),E.resume()}catch(X){return this[x](X,E)}}}return at.Sync=Wt,ws=at,ws}var vs,_r;function Gu(){if(_r)return vs;_r=1;const i=Nt(),e=br(),r=yt,h=kt(),s=ft,n=Mt();vs=(g,F,w)=>{typeof g=="function"?(w=g,F=null,g={}):Array.isArray(g)&&(F=g,g={}),typeof F=="function"&&(w=F,F=null),F?F=Array.from(F):F=[];const b=i(g);if(b.sync&&typeof w=="function")throw new TypeError("callback not supported for sync tar functions");if(!b.file&&typeof w=="function")throw new TypeError("callback only supported with file option");return F.length&&t(b,F),b.file&&b.sync?u(b):b.file?a(b,w):b.sync?m(b):y(b)};const t=(g,F)=>{const w=new Map(F.map(R=>[n(R),!0])),b=g.filter,A=(R,o)=>{const l=o||s.parse(R).root||".",D=R===l?!1:w.has(R)?w.get(R):A(s.dirname(R),l);return w.set(R,D),D};g.filter=b?(R,o)=>b(R,o)&&A(n(R)):R=>A(n(R))},u=g=>{const F=new e.Sync(g),w=g.file,b=r.statSync(w),A=g.maxReadSize||16*1024*1024;new h.ReadStreamSync(w,{readSize:A,size:b.size}).pipe(F)},a=(g,F)=>{const w=new e(g),b=g.maxReadSize||16*1024*1024,A=g.file,R=new Promise((o,l)=>{w.on("error",l),w.on("close",o),r.stat(A,(D,f)=>{if(D)l(D);else{const d=new h.ReadStream(A,{readSize:b,size:f.size});d.on("error",l),d.pipe(w)}})});return F?R.then(F,F):R},m=g=>new e.Sync(g),y=g=>new e(g);return vs}var wr;function Uu(){return wr||(wr=1,ht.c=ht.create=Bu(),ht.r=ht.replace=nr(),ht.t=ht.list=hs(),ht.u=ht.update=xu(),ht.x=ht.extract=Gu(),ht.Pack=ns(),ht.Unpack=br(),ht.Parse=os(),ht.ReadEntry=Ue(),ht.WriteEntry=Yi(),ht.Header=Pt(),ht.Pax=Ke(),ht.types=Pi()),ht}var Wu=Uu();class zu extends Error{}class vr extends Error{}class Vu extends Error{}class qu extends Error{}const Ar=async(i,e)=>{const r=new URL(i),h=dt.basename(r.pathname);return{name:h,version:void 0,subdir:void 0,url:r.href,tar:r.href,defaultDir:h,headers:e.auth?{Authorization:`Bearer ${e.auth}`}:void 0}},Sr=async(i,e)=>{const r=oe(i),h=await As(r,e,async()=>(await(await Ht(`https://api.github.com/repos/${r.repo}`)).json())?.default_branch);return{name:r.repo.replace("/","-"),version:h,subdir:r.subdir,headers:{...e.auth?{Authorization:`Bearer ${e.auth}`}:{},Accept:"application/vnd.github+json","X-GitHub-Api-Version":"2022-11-28"},url:`https://github.com/${r.repo}/tree/${h}${r.subdir}`,tar:`https://api.github.com/repos/${r.repo}/tarball/${h}`}},Ku=async(i,e)=>{const r=oe(i),h=await As(r,e,async()=>(await(await Ht(`https://gitlab.com/api/v4/projects/${encodeURIComponent(r.repo)}`)).json())?.default_branch);return{name:r.repo.replace("/","-"),version:h,subdir:r.subdir,headers:{...e.auth?{Authorization:`Bearer ${e.auth}`}:{},"sec-fetch-mode":"same-origin"},url:`https://gitlab.com/${r.repo}/tree/${h}${r.subdir}`,tar:`https://gitlab.com/${r.repo}/-/archive/${h}.tar.gz`}},Yu=async(i,e)=>{const r=oe(i),h=await As(r,e,async()=>(await(await Ht(`https://api.bitbucket.org/2.0/repositories/${r.repo}`)).json())?.mainbranch?.name);return{name:r.repo.replace("/","-"),version:h,subdir:r.subdir,headers:e.auth?{Authorization:`Bearer ${e.auth}`}:{},url:`https://bitbucket.com/${r.repo}/src/${h}${r.subdir}`,tar:`https://bitbucket.org/${r.repo}/get/${h}.tar.gz`}},Zu=(i,e)=>{const r=oe(i),h=r.ref||"main";return{name:r.repo.replace("/","-"),version:h,subdir:r.subdir,headers:e.auth?{Authorization:`Bearer ${e.auth}`}:{},url:`https://git.sr.ht/~${r.repo}/tree/${h}/item${r.subdir}`,tar:`https://git.sr.ht/~${r.repo}/archive/${h}.tar.gz`}},Xu={http:Ar,https:Ar,github:Sr,gh:Sr,gitlab:Ku,bitbucket:Yu,sourcehut:Zu};async function As(i,e,r){if(i.ref)return i.ref;if(e.offline!==!0)try{const h=await r();if(h)return h}catch(h){Ss(`Failed to fetch ref for ${i.repo}`,h)}return"main"}const Ju=/^([\w-.]+):/;function Qu(i,e,r){e||="github";let h=i;const s=i.match(Ju);s&&(e=s[1],e!=="http"&&e!=="https"&&(h=i.slice(s[0].length)));const n=r?.[e]||Xu[e];return{source:h,providerName:e,provider:n}}async function to(i,e,r={}){const h=e+".json",s=JSON.parse(await Rt.readFile(h,"utf8").catch(()=>"{}")),t=(await Ht(i,{...r,method:"HEAD"}).catch(()=>{}))?.headers.get("etag");if(s.etag===t&&At.existsSync(e))return;typeof t=="string"&&(s.etag=t);const u=await Ht(i,{headers:r.headers});if(u.status>=400)throw new vr(`Failed to download ${i}: ${u.status} ${u.statusText}`);if(u.body==null)throw new vr(`Failed to download ${i}: empty response body`);await Rt.mkdir(dt.dirname(e),{recursive:!0});const a=At.createWriteStream(e);await Tr(Ir)(u.body,a),await Rt.writeFile(h,JSON.stringify(s),"utf8")}const eo=/^(?<repo>[\w\-.]+\/[\w\-.]+)(?<subdir>[^#]+)?(?<ref>#[\w\-./@]+)?/;function oe(i){const e=i.match(eo)?.groups||{};return{repo:e.repo,subdir:e.subdir||"/",ref:e.ref?.slice(1)}}function Ss(...i){process.env.DEBUG&&console.debug("[giget]",...i)}async function Ht(i,e={}){e.headers?.["sec-fetch-mode"]&&(e.mode=e.headers["sec-fetch-mode"]);const r=await fetch(i,e).catch(h=>{throw new Error(`Failed to fetch ${i}`,{cause:h})});if(e.validateStatus&&r.status>=400)throw new Error(`Failed to fetch ${i}: ${r.status} ${r.statusText}`);return r}function so(){return process.env.XDG_CACHE_HOME?dt.resolve(process.env.XDG_CACHE_HOME,"bluwy-giget"):dt.resolve(Vr.homedir(),".cache/bluwy-giget")}async function io(i,e,r){r==="/"&&(r=void 0),r&&(r.startsWith("/")&&(r=r.slice(1)),r.endsWith("/")||(r+="/"));let h=!1;if(await Rt.mkdir(e,{recursive:!0}),await Wu.extract({file:i,cwd:e,onentry(s){s.path=s.path.split("/").splice(1).join("/"),r&&(s.path.startsWith(r)?(s.path=s.path.slice(r.length-1),h=!0):s.path="")}}),r&&!h)throw await Rt.rm(e,{recursive:!0,force:!0}),new Vu(`Subdirectory not found in tar: ${r}`)}async function ro(i,e={}){const{source:r,providerName:h,provider:s}=Qu(i,e.provider,e.providers);if(!s)throw new zu(`Unsupported provider: ${h}`);const n={...e.providerOptions,offline:e.offline},t=await Promise.resolve().then(()=>s(r,n)).catch(g=>{throw new Error(`The ${h} provider failed with errors`,{cause:g})});t.name=(t.name||"template").replace(/[^\da-z-]/gi,"-"),t.defaultDir=(t.defaultDir||t.name).replace(/[^\da-z-]/gi,"-");const u=dt.resolve(so(),h,t.name),a=dt.resolve(u,(t.version||t.name)+".tar.gz");if((e.offline==="prefer"?!At.existsSync(a):!e.offline)&&(await to(t.tar,a,{headers:t.headers}).catch(g=>{if(!At.existsSync(a))throw g;Ss("Download error. Using cached version:",g)}),Ss(`Downloaded ${t.tar} to ${a}`)),!At.existsSync(a))throw new Error(`Tarball not found: ${a} (offline: ${e.offline})`);const m=dt.resolve(e.cwd||"."),y=dt.resolve(m,e.dir||t.defaultDir);if(e.force==="clean")await Rt.rm(y,{recursive:!0,force:!0});else if(!e.force&&At.existsSync(y)&&At.readdirSync(y).length>0)throw new qu(`Destination ${y} already exists.`);return await io(a,y,t.subdir),{info:t,source:r,dir:y}}async function jt({template:i,project:e}){await ro(`wrtnlabs/agentica.template.${i}`,{provider:"github",dir:e}),await kr(wt(e,".github"),{force:!0,recursive:!0})}async function Gt({projectPath:i,dotEnvfileName:e,apiKeys:r}){if(!le(i))throw new Error(`${i} directory does not exist.`);const h=wt(i,e??".env"),s=(le(h)?`
96
+ `:"")+r.map(({key:n,value:t})=>`${n}=${t}`).join(`
97
+ `);await Hr(h,s)}function no({packageManager:i,pkg:e}){switch(i){case"npm":return`npm install ${e??""}`.trim();case"yarn":return e!=null?`yarn add ${e}`:"yarn";case"pnpm":return`pnpm install ${e??""}`.trim();case"bun":return`bun install ${e??""}`.trim();default:throw new Error(`Unsupported package manager: ${i}`)}}function uo({packageManager:i,command:e}){switch(i){case"npm":return`npm run ${e}`.trim();case"yarn":return`yarn ${e}`.trim();case"pnpm":return`pnpm ${e}`.trim();case"bun":return`bun ${e}`.trim();default:throw new Error(`Unsupported package manager: ${i}`)}}function oo(){const i=Q.env.npm_config_user_agent;switch(!0){case i?.startsWith("npm"):return"npm";case i?.startsWith("yarn"):return"yarn";case i?.startsWith("pnpm"):return"pnpm";case i?.startsWith("bun"):return"bun";default:return"npm"}}const ao=["nodejs","nestjs","react","react-native","standalone","nestjs+react","nodejs+react"];async function Ut({packageManager:i,projectAbsolutePath:e,services:r}){const h=r.length>0?[...r.map(u=>bu(u))].join(" "):void 0,[s,...n]=no({packageManager:i,pkg:h}).split(" "),t=ui();t.start("\u{1F4E6} Package installation in progress...");try{await xe(s,n,{cwd:e})}catch(u){throw u instanceof Bt&&(ct.error(`\u274C Package installation failed: ${u.output}`),Q.exit(1)),u}t.stop("\u2705 Package installation completed")}async function Os({packageManager:i,projectAbsolutePath:e}){const[r,...h]=uo({packageManager:i,command:"prepare"}).split(" "),s=ui();s.start("\u{1F4E6} Package installation in progress...");try{await xe(r,h,{cwd:e})}catch(n){throw n instanceof Bt&&(ct.error(`\u274C Package installation failed: ${n.output}`),Q.exit(1)),n}s.stop("\u2705 Package installation completed")}async function ho({template:i}){const e={template:i,services:[]};{const r=await Qt({message:"Enter the project directory path:",placeholder:"./my-agentica-project",validate(s){if(s==="")return"Please enter a directory path";if(s[0]!==".")return"Please enter a relative path.";if(le(s))return"Directory already exists"}});vt(r)&&Q.exit(0);const h=wt(Q.cwd(),r);e.projectAbsolutePath=h}{const r=await ii({message:"Which package manager do you want to use?",initialValue:oo(),options:[{value:"npm",label:"npm"},{value:"pnpm",label:"pnpm"},{value:"yarn",label:`yarn (${gt.blueBright("berry is not supported")})`},{value:"bun",label:"bun"}]});vt(r)&&Q.exit(0),ct.info(`\u{1F4E6} Using ${r} as package manager`),e.packageManager=r}if(e.template==null){const r=await ii({message:"Which project type do you want to start?",options:[{value:"standalone",label:`Standalone ${gt.blueBright("Agent Server")}`},{value:"nodejs",label:`NodeJS ${gt.blueBright("Agent Server")}`},{value:"nestjs",label:`NestJS ${gt.blueBright("Agent Server")}`},{value:"react",label:`React ${gt.blueBright("Application")}`},{value:"react-native",label:`React Native ${gt.blueBright("Application")}`},{value:"nestjs+react",label:`NestJS + React ${gt.blueBright("Agent Server + Client Application")}`},{value:"nodejs+react",label:`NodeJS + React ${gt.blueBright("Agent Server + Client Application")}`}]});vt(r)&&Q.exit(0),e.template=r}if(e.template!=="standalone"){const r=await Qt({message:"Server Port(if project is client app, this port mean ws server port):",initialValue:"3000",validate(h){if(Number.isNaN(Number.parseInt(h)))return"Port must be an integer"}});vt(r)&&Q.exit(0),e.port=Number(r)}if(e.template!=="react"){const r=await vu(),h=r.sort((a,m)=>a.displayName.localeCompare(m.displayName)).map(({displayName:a,serviceName:m})=>({label:a,value:m})),s=await kn({message:`Which connectors do you want to include? (Press ${gt.cyan("<space>")} to select, ${gt.cyan("<a>")} to select all, ${gt.cyan("<enter>")} to proceed)`,options:h,required:!1});vt(s)&&Q.exit(0),e.services=s;const n=Array.from(new Set(r.filter(a=>s.includes(a.serviceName)).flatMap(a=>a.envList))),t=n.length===0?!1:await si({message:`Do you want to enter environment variables? (Number of environment variables to enter: ${n.length})
98
+ ${gt.cyan("If you press <ctrl+c>, you can skip this step.")}`,initialValue:!1}),u=[];if(vt(t)||!t)n.forEach(a=>{u.push({key:a,value:""})}),ri("Skipping environment variables input.");else for(let a=0;a<n.length;a++){const m=n[a],y=await Qt({message:`${m}: `,defaultValue:""});if(vt(y)){const g=n.splice(a);g.forEach(F=>{u.push({key:F,value:""})}),ri(`Skipping environment variables input: ${g.slice(0,3).join(", ")}... (count: ${g.length})`);break}u.push({key:m,value:y})}e.envList=u}{const r=await si({message:"Enter your OpenAI API key?",initialValue:!1});if(vt(r)&&Q.exit(0),r){const h=await Qt({message:"Please enter your OPENAI API key:"});vt(h)&&Q.exit(0),e.openAIKey=h}else e.openAIKey=null}try{(()=>{const r=a=>(a.packageManager==="npm"||a.packageManager==="yarn"||a.packageManager==="pnpm"||a.packageManager==="bun")&&typeof a.projectAbsolutePath=="string"&&(a.template==="nodejs"||a.template==="nestjs"||a.template==="react"||a.template==="react-native"||a.template==="standalone"||a.template==="nestjs+react"||a.template==="nodejs+react")&&(a.openAIKey===null||typeof a.openAIKey=="string")&&(a.port===void 0||typeof a.port=="number")&&Array.isArray(a.services)&&a.services.every(m=>typeof m=="string")&&(a.envList===void 0||Array.isArray(a.envList)&&a.envList.every(m=>typeof m=="object"&&m!==null&&h(m))),h=a=>typeof a.key=="string"&&typeof a.value=="string",s=(a,m,y=!0)=>(a.packageManager==="npm"||a.packageManager==="yarn"||a.packageManager==="pnpm"||a.packageManager==="bun"||nt._assertGuard(y,{method:"typia.assertGuard",path:m+".packageManager",expected:'("bun" | "npm" | "pnpm" | "yarn")',value:a.packageManager},u))&&(typeof a.projectAbsolutePath=="string"||nt._assertGuard(y,{method:"typia.assertGuard",path:m+".projectAbsolutePath",expected:"string",value:a.projectAbsolutePath},u))&&(a.template==="nodejs"||a.template==="nestjs"||a.template==="react"||a.template==="react-native"||a.template==="standalone"||a.template==="nestjs+react"||a.template==="nodejs+react"||nt._assertGuard(y,{method:"typia.assertGuard",path:m+".template",expected:'("nestjs" | "nestjs+react" | "nodejs" | "nodejs+react" | "react" | "react-native" | "standalone")',value:a.template},u))&&(a.openAIKey===null||typeof a.openAIKey=="string"||nt._assertGuard(y,{method:"typia.assertGuard",path:m+".openAIKey",expected:"(null | string)",value:a.openAIKey},u))&&(a.port===void 0||typeof a.port=="number"||nt._assertGuard(y,{method:"typia.assertGuard",path:m+".port",expected:"(number | undefined)",value:a.port},u))&&((Array.isArray(a.services)||nt._assertGuard(y,{method:"typia.assertGuard",path:m+".services",expected:"Array<string>",value:a.services},u))&&a.services.every((g,F)=>typeof g=="string"||nt._assertGuard(y,{method:"typia.assertGuard",path:m+".services["+F+"]",expected:"string",value:g},u))||nt._assertGuard(y,{method:"typia.assertGuard",path:m+".services",expected:"Array<string>",value:a.services},u))&&(a.envList===void 0||(Array.isArray(a.envList)||nt._assertGuard(y,{method:"typia.assertGuard",path:m+".envList",expected:"(Array<__type> | undefined)",value:a.envList},u))&&a.envList.every((g,F)=>(typeof g=="object"&&g!==null||nt._assertGuard(y,{method:"typia.assertGuard",path:m+".envList["+F+"]",expected:"__type.o1",value:g},u))&&n(g,m+".envList["+F+"]",y)||nt._assertGuard(y,{method:"typia.assertGuard",path:m+".envList["+F+"]",expected:"__type.o1",value:g},u))||nt._assertGuard(y,{method:"typia.assertGuard",path:m+".envList",expected:"(Array<__type> | undefined)",value:a.envList},u)),n=(a,m,y=!0)=>(typeof a.key=="string"||nt._assertGuard(y,{method:"typia.assertGuard",path:m+".key",expected:"string",value:a.key},u))&&(typeof a.value=="string"||nt._assertGuard(y,{method:"typia.assertGuard",path:m+".value",expected:"string",value:a.value},u)),t=a=>typeof a=="object"&&a!==null&&r(a);let u;return(a,m)=>{t(a)===!1&&(u=m,((y,g,F=!0)=>(typeof y=="object"&&y!==null||nt._assertGuard(!0,{method:"typia.assertGuard",path:g+"",expected:"__type",value:y},u))&&s(y,g+"",!0)||nt._assertGuard(!0,{method:"typia.assertGuard",path:g+"",expected:"__type",value:y},u))(a,"$input",!0))}})()(e)}catch(r){throw new Error(`\u274C ${r.toString()}`)}return e}async function lo({projectAbsolutePath:i,context:e}){await jt({template:"standalone",project:i}),ct.success("\u2705 Template downloaded");const r=Ie(e.services),h=$e(e.services),s=wt(i,"src/index.ts"),n=await ce(s,"utf-8"),t=Ne({content:n,importCode:r,connectorCode:h});await De(s,t),await Gt({projectPath:i,apiKeys:[{key:"OPENAI_API_KEY",value:e.openAIKey??""},...e.envList??[]]}),ct.success("\u2705 .env created"),await Ut({packageManager:e.packageManager,projectAbsolutePath:i,services:e.services}),await Os({packageManager:e.packageManager,projectAbsolutePath:i})}async function Or({projectAbsolutePath:i,context:e}){await jt({template:"nodejs",project:i}),ct.success("\u2705 Template downloaded");const r=Ie(e.services),h=$e(e.services),s=wt(i,"src/index.ts"),n=await ce(s,"utf-8").then(u=>e.services.length===0?u:u.replace(/import \{ BbsArticleService \}.*;\n/g,"").replace(/controllers:\s*\[[\s\S]*?\],\n/,`controllers: [/// INSERT CONTROLLER HERE],
99
+ `)),t=Ne({content:n,importCode:r,connectorCode:h});await De(s,t),await Gt({projectPath:i,apiKeys:[{key:"OPENAI_API_KEY",value:e.openAIKey??""},{key:"PORT",value:e.port?.toString()??"3000"},...e.envList??[]]}),ct.success("\u2705 .env created"),await Ut({packageManager:e.packageManager,projectAbsolutePath:i,services:e.services}),await Os({packageManager:e.packageManager,projectAbsolutePath:i})}async function Rr({projectAbsolutePath:i,context:e}){await jt({template:"nestjs",project:i}),ct.success("\u2705 Template downloaded");const r=Ie(e.services),h=$e(e.services),s=wt(i,"src/controllers/chat/ChatController.ts"),n=await ce(s,"utf-8").then(u=>e.services.length===0?u:u.replace(/import \{ BbsArticleService \}.*;\n/g,"").replace(/controllers:\s*\[[\s\S]*?\],\n/,`controllers: [/// INSERT CONTROLLER HERE],
100
+ `)),t=Ne({content:n,importCode:r,connectorCode:h});await De(s,t),await Gt({projectPath:i,apiKeys:[{key:"OPENAI_API_KEY",value:e.openAIKey??""},{key:"API_PORT",value:e.port?.toString()??"3000"},...e.envList??[]]}),ct.success("\u2705 .env created"),await Ut({packageManager:e.packageManager,projectAbsolutePath:i,services:e.services}),await Os({packageManager:e.packageManager,projectAbsolutePath:i})}async function Rs({projectAbsolutePath:i,context:e}){await jt({template:"react",project:i}),ct.success("\u2705 Template downloaded"),await Gt({projectPath:i,apiKeys:[{key:"OPENAI_API_KEY",value:e.openAIKey??""},{key:"VITE_AGENTICA_WS_URL",value:`ws://localhost:${e.port}/chat`}]}),ct.success("\u2705 .env created"),await Ut({packageManager:e.packageManager,projectAbsolutePath:i,services:e.services})}async function co({projectAbsolutePath:i,context:e}){await jt({template:"react-native",project:i}),ct.success("\u2705 Template downloaded"),await Gt({projectPath:i,apiKeys:[{key:"OPENAI_API_KEY",value:e.openAIKey??""}]}),ct.success("\u2705 .env created"),await Ut({packageManager:e.packageManager,projectAbsolutePath:i,services:e.services})}async function Do({template:i}){ni("Agentica Start Wizard");const e=await ho({template:i}),{projectAbsolutePath:r}=e;switch(e.template){case"standalone":await lo({projectAbsolutePath:r,context:e});break;case"nodejs":await Or({projectAbsolutePath:r,context:e});break;case"nestjs":await Rr({projectAbsolutePath:r,context:e});break;case"react":await Rs({projectAbsolutePath:r,context:e});break;case"react-native":await co({projectAbsolutePath:r,context:e});break;case"nestjs+react":await Rr({projectAbsolutePath:wt(r,"server"),context:e}),await Rs({projectAbsolutePath:wt(r,"client"),context:e});break;case"nodejs+react":await Or({projectAbsolutePath:wt(r,"server"),context:e}),await Rs({projectAbsolutePath:wt(r,"client"),context:e});break;default:throw e.template,new Error(`\u274C Template ${e.template} not supported`)}Hn(`
101
+ \u{1F389} Project ${r} created
102
+ \u26A0\uFE0F ${gt.yellow("Note:")} Please implement constructor values for each controller generated in index.ts
103
+ `)}const ae=new Vn;ae.version(Kn),ae.command("start").description("Start a new project").addOption(new qn("-p, --project <project>","The project type").choices(ao)).action(async i=>{ni(`\u{1F680} ${gt.blueBright("Agentica")} Setup Wizard`),await Do({template:i.project})});function fo(){ae.parse(Q.argv)}export{ae as program,fo as run};