agentica 0.18.0 → 0.19.1
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.
- package/dist/index.mjs +61 -60
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,95 +1,96 @@
|
|
|
1
|
-
import oe,{stdin as Si,stdout as Oi}from"node:process";import{promisify as Ri}from"node:util";import*as We from"node:readline";import Bi from"node:readline";import{WriteStream as Cr}from"node:tty";import xe from"events";import Fr from"child_process";import De from"path";import ge from"fs";import xi from"process";import ve,{existsSync as ut}from"node:fs";import Oe,{rm as yr,appendFile as br,readFile as ot,writeFile as at}from"node:fs/promises";import we,{join as be}from"node:path";import{exec as wr}from"node:child_process";import _r from"node:os";import{pipeline as vr}from"node:stream";import Ti from"stream";import $i from"string_decoder";import ht from"assert";import Ar from"buffer";import Ni from"zlib";import Sr from"util";import Or from"crypto";var lt=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Ii(u){return u&&u.__esModule&&Object.prototype.hasOwnProperty.call(u,"default")?u.default:u}function Rr(u){if(Object.prototype.hasOwnProperty.call(u,"__esModule"))return u;var t=u.default;if(typeof t=="function"){var s=function r(){return this instanceof r?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};s.prototype=t.prototype}else s={};return Object.defineProperty(s,"__esModule",{value:!0}),Object.keys(u).forEach(function(r){var i=Object.getOwnPropertyDescriptor(u,r);Object.defineProperty(s,r,i.get?i:{enumerable:!0,get:function(){return u[r]}})}),s}var ct,Li;function Br(){if(Li)return ct;Li=1;const u="\x1B",t=`${u}[`,s="\x07",r={to(e,a){return a?`${t}${a+1};${e+1}H`:`${t}${e+1}G`},move(e,a){let D="";return e<0?D+=`${t}${-e}D`:e>0&&(D+=`${t}${e}C`),a<0?D+=`${t}${-a}A`:a>0&&(D+=`${t}${a}B`),D},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:`${u}7`,restore:`${u}8`},i={up:(e=1)=>`${t}S`.repeat(e),down:(e=1)=>`${t}T`.repeat(e)},o={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 a="";for(let D=0;D<e;D++)a+=this.line+(D<e-1?r.up():"");return e&&(a+=r.left),a}};return ct={cursor:r,scroll:i,erase:o,beep:s},ct}var fe=Br(),Ve={exports:{}},Mi;function xr(){if(Mi)return Ve.exports;Mi=1;let u=process||{},t=u.argv||[],s=u.env||{},r=!(s.NO_COLOR||t.includes("--no-color"))&&(!!s.FORCE_COLOR||t.includes("--color")||u.platform==="win32"||(u.stdout||{}).isTTY&&s.TERM!=="dumb"||!!s.CI),i=(a,D,F=a)=>_=>{let E=""+_,C=E.indexOf(D,a.length);return~C?a+o(E,D,F,C)+D:a+E+D},o=(a,D,F,_)=>{let E="",C=0;do E+=a.substring(C,_)+F,C=_+D.length,_=a.indexOf(D,C);while(~_);return E+a.substring(C)},e=(a=r)=>{let D=a?i:()=>String;return{isColorSupported:a,reset:D("\x1B[0m","\x1B[0m"),bold:D("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"),dim:D("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"),italic:D("\x1B[3m","\x1B[23m"),underline:D("\x1B[4m","\x1B[24m"),inverse:D("\x1B[7m","\x1B[27m"),hidden:D("\x1B[8m","\x1B[28m"),strikethrough:D("\x1B[9m","\x1B[29m"),black:D("\x1B[30m","\x1B[39m"),red:D("\x1B[31m","\x1B[39m"),green:D("\x1B[32m","\x1B[39m"),yellow:D("\x1B[33m","\x1B[39m"),blue:D("\x1B[34m","\x1B[39m"),magenta:D("\x1B[35m","\x1B[39m"),cyan:D("\x1B[36m","\x1B[39m"),white:D("\x1B[37m","\x1B[39m"),gray:D("\x1B[90m","\x1B[39m"),bgBlack:D("\x1B[40m","\x1B[49m"),bgRed:D("\x1B[41m","\x1B[49m"),bgGreen:D("\x1B[42m","\x1B[49m"),bgYellow:D("\x1B[43m","\x1B[49m"),bgBlue:D("\x1B[44m","\x1B[49m"),bgMagenta:D("\x1B[45m","\x1B[49m"),bgCyan:D("\x1B[46m","\x1B[49m"),bgWhite:D("\x1B[47m","\x1B[49m"),blackBright:D("\x1B[90m","\x1B[39m"),redBright:D("\x1B[91m","\x1B[39m"),greenBright:D("\x1B[92m","\x1B[39m"),yellowBright:D("\x1B[93m","\x1B[39m"),blueBright:D("\x1B[94m","\x1B[39m"),magentaBright:D("\x1B[95m","\x1B[39m"),cyanBright:D("\x1B[96m","\x1B[39m"),whiteBright:D("\x1B[97m","\x1B[39m"),bgBlackBright:D("\x1B[100m","\x1B[49m"),bgRedBright:D("\x1B[101m","\x1B[49m"),bgGreenBright:D("\x1B[102m","\x1B[49m"),bgYellowBright:D("\x1B[103m","\x1B[49m"),bgBlueBright:D("\x1B[104m","\x1B[49m"),bgMagentaBright:D("\x1B[105m","\x1B[49m"),bgCyanBright:D("\x1B[106m","\x1B[49m"),bgWhiteBright:D("\x1B[107m","\x1B[49m")}};return Ve.exports=e(),Ve.exports.createColors=e,Ve.exports}var de=xr();const I=Ii(de);function Tr({onlyFirst:u=!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,u?void 0:"g")}const $r=Tr();function Pi(u){if(typeof u!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof u}\``);return u.replace($r,"")}function ki(u){return u&&u.__esModule&&Object.prototype.hasOwnProperty.call(u,"default")?u.default:u}var Hi={exports:{}};(function(u){var t={};u.exports=t,t.eastAsianWidth=function(r){var i=r.charCodeAt(0),o=r.length==2?r.charCodeAt(1):0,e=i;return 55296<=i&&i<=56319&&56320<=o&&o<=57343&&(i&=1023,o&=1023,e=i<<10|o,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(r){var i=this.eastAsianWidth(r);return i=="F"||i=="W"||i=="A"?2:1};function s(r){return r.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g)||[]}t.length=function(r){for(var i=s(r),o=0,e=0;e<i.length;e++)o=o+this.characterLength(i[e]);return o},t.slice=function(r,i,o){textLen=t.length(r),i=i||0,o=o||1,i<0&&(i=textLen+i),o<0&&(o=textLen+o);for(var e="",a=0,D=s(r),F=0;F<D.length;F++){var _=D[F],E=t.length(_);if(a>=i-(E==2?1:0))if(a+E<=o)e+=_;else break;a+=E}return e}})(Hi);var Nr=Hi.exports;const Ir=ki(Nr);var Lr=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 Mr=ki(Lr);function Te(u,t={}){if(typeof u!="string"||u.length===0||(t={ambiguousIsNarrow:!0,...t},u=Pi(u),u.length===0))return 0;u=u.replace(Mr()," ");const s=t.ambiguousIsNarrow?1:2;let r=0;for(const i of u){const o=i.codePointAt(0);if(!(o<=31||o>=127&&o<=159||o>=768&&o<=879))switch(Ir.eastAsianWidth(i)){case"F":case"W":r+=2;break;case"A":r+=s;break;default:r+=1}}return r}const Dt=10,ji=(u=0)=>t=>`\x1B[${t+u}m`,Ui=(u=0)=>t=>`\x1B[${38+u};5;${t}m`,zi=(u=0)=>(t,s,r)=>`\x1B[${38+u};2;${t};${s};${r}m`,re={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(re.modifier);const Pr=Object.keys(re.color),kr=Object.keys(re.bgColor);[...Pr,...kr];function Hr(){const u=new Map;for(const[t,s]of Object.entries(re)){for(const[r,i]of Object.entries(s))re[r]={open:`\x1B[${i[0]}m`,close:`\x1B[${i[1]}m`},s[r]=re[r],u.set(i[0],i[1]);Object.defineProperty(re,t,{value:s,enumerable:!1})}return Object.defineProperty(re,"codes",{value:u,enumerable:!1}),re.color.close="\x1B[39m",re.bgColor.close="\x1B[49m",re.color.ansi=ji(),re.color.ansi256=Ui(),re.color.ansi16m=zi(),re.bgColor.ansi=ji(Dt),re.bgColor.ansi256=Ui(Dt),re.bgColor.ansi16m=zi(Dt),Object.defineProperties(re,{rgbToAnsi256:{value:(t,s,r)=>t===s&&s===r?t<8?16:t>248?231:Math.round((t-8)/247*24)+232:16+36*Math.round(t/255*5)+6*Math.round(s/255*5)+Math.round(r/255*5),enumerable:!1},hexToRgb:{value:t=>{const s=/[a-f\d]{6}|[a-f\d]{3}/i.exec(t.toString(16));if(!s)return[0,0,0];let[r]=s;r.length===3&&(r=[...r].map(o=>o+o).join(""));const i=Number.parseInt(r,16);return[i>>16&255,i>>8&255,i&255]},enumerable:!1},hexToAnsi256:{value:t=>re.rgbToAnsi256(...re.hexToRgb(t)),enumerable:!1},ansi256ToAnsi:{value:t=>{if(t<8)return 30+t;if(t<16)return 90+(t-8);let s,r,i;if(t>=232)s=((t-232)*10+8)/255,r=s,i=s;else{t-=16;const a=t%36;s=Math.floor(t/36)/5,r=Math.floor(a/6)/5,i=a%6/5}const o=Math.max(s,r,i)*2;if(o===0)return 30;let e=30+(Math.round(i)<<2|Math.round(r)<<1|Math.round(s));return o===2&&(e+=60),e},enumerable:!1},rgbToAnsi:{value:(t,s,r)=>re.ansi256ToAnsi(re.rgbToAnsi256(t,s,r)),enumerable:!1},hexToAnsi:{value:t=>re.ansi256ToAnsi(re.hexToAnsi256(t)),enumerable:!1}}),re}const jr=Hr(),Ge=new Set(["\x1B","\x9B"]),Ur=39,ft="\x07",qi="[",zr="]",Wi="m",dt=`${zr}8;;`,Vi=u=>`${Ge.values().next().value}${qi}${u}${Wi}`,Gi=u=>`${Ge.values().next().value}${dt}${u}${ft}`,qr=u=>u.split(" ").map(t=>Te(t)),mt=(u,t,s)=>{const r=[...t];let i=!1,o=!1,e=Te(Pi(u[u.length-1]));for(const[a,D]of r.entries()){const F=Te(D);if(e+F<=s?u[u.length-1]+=D:(u.push(D),e=0),Ge.has(D)&&(i=!0,o=r.slice(a+1).join("").startsWith(dt)),i){o?D===ft&&(i=!1,o=!1):D===Wi&&(i=!1);continue}e+=F,e===s&&a<r.length-1&&(u.push(""),e=0)}!e&&u[u.length-1].length>0&&u.length>1&&(u[u.length-2]+=u.pop())},Wr=u=>{const t=u.split(" ");let s=t.length;for(;s>0&&!(Te(t[s-1])>0);)s--;return s===t.length?u:t.slice(0,s).join(" ")+t.slice(s).join("")},Vr=(u,t,s={})=>{if(s.trim!==!1&&u.trim()==="")return"";let r="",i,o;const e=qr(u);let a=[""];for(const[F,_]of u.split(" ").entries()){s.trim!==!1&&(a[a.length-1]=a[a.length-1].trimStart());let E=Te(a[a.length-1]);if(F!==0&&(E>=t&&(s.wordWrap===!1||s.trim===!1)&&(a.push(""),E=0),(E>0||s.trim===!1)&&(a[a.length-1]+=" ",E++)),s.hard&&e[F]>t){const C=t-E,b=1+Math.floor((e[F]-C-1)/t);Math.floor((e[F]-1)/t)<b&&a.push(""),mt(a,_,t);continue}if(E+e[F]>t&&E>0&&e[F]>0){if(s.wordWrap===!1&&E<t){mt(a,_,t);continue}a.push("")}if(E+e[F]>t&&s.wordWrap===!1){mt(a,_,t);continue}a[a.length-1]+=_}s.trim!==!1&&(a=a.map(F=>Wr(F)));const D=[...a.join(`
|
|
2
|
-
`)];for(const[
|
|
3
|
-
`?(
|
|
4
|
-
`&&(i&&
|
|
1
|
+
import ae,{stdin as Si,stdout as Oi}from"node:process";import{promisify as Ri}from"node:util";import*as qe from"node:readline";import Bi from"node:readline";import{WriteStream as yr}from"node:tty";import xe from"events";import br from"child_process";import De from"path";import ge from"fs";import xi from"process";import Se,{existsSync as ot}from"node:fs";import Oe,{rm as _r,appendFile as wr,readFile as at,writeFile as ht}from"node:fs/promises";import we,{join as be}from"node:path";import{exec as vr}from"node:child_process";import Ar from"node:os";import{pipeline as Sr}from"node:stream";import Ti from"stream";import $i from"string_decoder";import lt from"assert";import Or from"buffer";import Ni from"zlib";import Rr from"util";import Br from"crypto";var ct=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Ii(u){return u&&u.__esModule&&Object.prototype.hasOwnProperty.call(u,"default")?u.default:u}function xr(u){if(Object.prototype.hasOwnProperty.call(u,"__esModule"))return u;var t=u.default;if(typeof t=="function"){var s=function r(){return this instanceof r?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};s.prototype=t.prototype}else s={};return Object.defineProperty(s,"__esModule",{value:!0}),Object.keys(u).forEach(function(r){var i=Object.getOwnPropertyDescriptor(u,r);Object.defineProperty(s,r,i.get?i:{enumerable:!0,get:function(){return u[r]}})}),s}var Dt,Li;function Tr(){if(Li)return Dt;Li=1;const u="\x1B",t=`${u}[`,s="\x07",r={to(e,o){return o?`${t}${o+1};${e+1}H`:`${t}${e+1}G`},move(e,o){let h="";return e<0?h+=`${t}${-e}D`:e>0&&(h+=`${t}${e}C`),o<0?h+=`${t}${-o}A`:o>0&&(h+=`${t}${o}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:`${u}7`,restore:`${u}8`},i={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 o="";for(let h=0;h<e;h++)o+=this.line+(h<e-1?r.up():"");return e&&(o+=r.left),o}};return Dt={cursor:r,scroll:i,erase:a,beep:s},Dt}var de=Tr(),Ve={exports:{}},Mi;function $r(){if(Mi)return Ve.exports;Mi=1;let u=process||{},t=u.argv||[],s=u.env||{},r=!(s.NO_COLOR||t.includes("--no-color"))&&(!!s.FORCE_COLOR||t.includes("--color")||u.platform==="win32"||(u.stdout||{}).isTTY&&s.TERM!=="dumb"||!!s.CI),i=(o,h,E=o)=>y=>{let m=""+y,C=m.indexOf(h,o.length);return~C?o+a(m,h,E,C)+h:o+m+h},a=(o,h,E,y)=>{let m="",C=0;do m+=o.substring(C,y)+E,C=y+h.length,y=o.indexOf(h,C);while(~y);return m+o.substring(C)},e=(o=r)=>{let h=o?i:()=>String;return{isColorSupported:o,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 pe=$r();const I=Ii(pe);function Nr({onlyFirst:u=!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,u?void 0:"g")}const Ir=Nr();function Pi(u){if(typeof u!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof u}\``);return u.replace(Ir,"")}function ki(u){return u&&u.__esModule&&Object.prototype.hasOwnProperty.call(u,"default")?u.default:u}var Hi={exports:{}};(function(u){var t={};u.exports=t,t.eastAsianWidth=function(r){var i=r.charCodeAt(0),a=r.length==2?r.charCodeAt(1):0,e=i;return 55296<=i&&i<=56319&&56320<=a&&a<=57343&&(i&=1023,a&=1023,e=i<<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(r){var i=this.eastAsianWidth(r);return i=="F"||i=="W"||i=="A"?2:1};function s(r){return r.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g)||[]}t.length=function(r){for(var i=s(r),a=0,e=0;e<i.length;e++)a=a+this.characterLength(i[e]);return a},t.slice=function(r,i,a){textLen=t.length(r),i=i||0,a=a||1,i<0&&(i=textLen+i),a<0&&(a=textLen+a);for(var e="",o=0,h=s(r),E=0;E<h.length;E++){var y=h[E],m=t.length(y);if(o>=i-(m==2?1:0))if(o+m<=a)e+=y;else break;o+=m}return e}})(Hi);var Lr=Hi.exports;const Mr=ki(Lr);var Pr=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 kr=ki(Pr);function Te(u,t={}){if(typeof u!="string"||u.length===0||(t={ambiguousIsNarrow:!0,...t},u=Pi(u),u.length===0))return 0;u=u.replace(kr()," ");const s=t.ambiguousIsNarrow?1:2;let r=0;for(const i of u){const a=i.codePointAt(0);if(!(a<=31||a>=127&&a<=159||a>=768&&a<=879))switch(Mr.eastAsianWidth(i)){case"F":case"W":r+=2;break;case"A":r+=s;break;default:r+=1}}return r}const ft=10,ji=(u=0)=>t=>`\x1B[${t+u}m`,Ui=(u=0)=>t=>`\x1B[${38+u};5;${t}m`,zi=(u=0)=>(t,s,r)=>`\x1B[${38+u};2;${t};${s};${r}m`,ne={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(ne.modifier);const Hr=Object.keys(ne.color),jr=Object.keys(ne.bgColor);[...Hr,...jr];function Ur(){const u=new Map;for(const[t,s]of Object.entries(ne)){for(const[r,i]of Object.entries(s))ne[r]={open:`\x1B[${i[0]}m`,close:`\x1B[${i[1]}m`},s[r]=ne[r],u.set(i[0],i[1]);Object.defineProperty(ne,t,{value:s,enumerable:!1})}return Object.defineProperty(ne,"codes",{value:u,enumerable:!1}),ne.color.close="\x1B[39m",ne.bgColor.close="\x1B[49m",ne.color.ansi=ji(),ne.color.ansi256=Ui(),ne.color.ansi16m=zi(),ne.bgColor.ansi=ji(ft),ne.bgColor.ansi256=Ui(ft),ne.bgColor.ansi16m=zi(ft),Object.defineProperties(ne,{rgbToAnsi256:{value:(t,s,r)=>t===s&&s===r?t<8?16:t>248?231:Math.round((t-8)/247*24)+232:16+36*Math.round(t/255*5)+6*Math.round(s/255*5)+Math.round(r/255*5),enumerable:!1},hexToRgb:{value:t=>{const s=/[a-f\d]{6}|[a-f\d]{3}/i.exec(t.toString(16));if(!s)return[0,0,0];let[r]=s;r.length===3&&(r=[...r].map(a=>a+a).join(""));const i=Number.parseInt(r,16);return[i>>16&255,i>>8&255,i&255]},enumerable:!1},hexToAnsi256:{value:t=>ne.rgbToAnsi256(...ne.hexToRgb(t)),enumerable:!1},ansi256ToAnsi:{value:t=>{if(t<8)return 30+t;if(t<16)return 90+(t-8);let s,r,i;if(t>=232)s=((t-232)*10+8)/255,r=s,i=s;else{t-=16;const o=t%36;s=Math.floor(t/36)/5,r=Math.floor(o/6)/5,i=o%6/5}const a=Math.max(s,r,i)*2;if(a===0)return 30;let e=30+(Math.round(i)<<2|Math.round(r)<<1|Math.round(s));return a===2&&(e+=60),e},enumerable:!1},rgbToAnsi:{value:(t,s,r)=>ne.ansi256ToAnsi(ne.rgbToAnsi256(t,s,r)),enumerable:!1},hexToAnsi:{value:t=>ne.ansi256ToAnsi(ne.hexToAnsi256(t)),enumerable:!1}}),ne}const zr=Ur(),We=new Set(["\x1B","\x9B"]),Gr=39,dt="\x07",Gi="[",qr="]",qi="m",mt=`${qr}8;;`,Vi=u=>`${We.values().next().value}${Gi}${u}${qi}`,Wi=u=>`${We.values().next().value}${mt}${u}${dt}`,Vr=u=>u.split(" ").map(t=>Te(t)),pt=(u,t,s)=>{const r=[...t];let i=!1,a=!1,e=Te(Pi(u[u.length-1]));for(const[o,h]of r.entries()){const E=Te(h);if(e+E<=s?u[u.length-1]+=h:(u.push(h),e=0),We.has(h)&&(i=!0,a=r.slice(o+1).join("").startsWith(mt)),i){a?h===dt&&(i=!1,a=!1):h===qi&&(i=!1);continue}e+=E,e===s&&o<r.length-1&&(u.push(""),e=0)}!e&&u[u.length-1].length>0&&u.length>1&&(u[u.length-2]+=u.pop())},Wr=u=>{const t=u.split(" ");let s=t.length;for(;s>0&&!(Te(t[s-1])>0);)s--;return s===t.length?u:t.slice(0,s).join(" ")+t.slice(s).join("")},Kr=(u,t,s={})=>{if(s.trim!==!1&&u.trim()==="")return"";let r="",i,a;const e=Vr(u);let o=[""];for(const[E,y]of u.split(" ").entries()){s.trim!==!1&&(o[o.length-1]=o[o.length-1].trimStart());let m=Te(o[o.length-1]);if(E!==0&&(m>=t&&(s.wordWrap===!1||s.trim===!1)&&(o.push(""),m=0),(m>0||s.trim===!1)&&(o[o.length-1]+=" ",m++)),s.hard&&e[E]>t){const C=t-m,_=1+Math.floor((e[E]-C-1)/t);Math.floor((e[E]-1)/t)<_&&o.push(""),pt(o,y,t);continue}if(m+e[E]>t&&m>0&&e[E]>0){if(s.wordWrap===!1&&m<t){pt(o,y,t);continue}o.push("")}if(m+e[E]>t&&s.wordWrap===!1){pt(o,y,t);continue}o[o.length-1]+=y}s.trim!==!1&&(o=o.map(E=>Wr(E)));const h=[...o.join(`
|
|
2
|
+
`)];for(const[E,y]of h.entries()){if(r+=y,We.has(y)){const{groups:C}=new RegExp(`(?:\\${Gi}(?<code>\\d+)m|\\${mt}(?<uri>.*)${dt})`).exec(h.slice(E).join(""))||{groups:{}};if(C.code!==void 0){const _=Number.parseFloat(C.code);i=_===Gr?void 0:_}else C.uri!==void 0&&(a=C.uri.length===0?void 0:C.uri)}const m=zr.codes.get(Number(i));h[E+1]===`
|
|
3
|
+
`?(a&&(r+=Wi("")),i&&m&&(r+=Vi(m))):y===`
|
|
4
|
+
`&&(i&&m&&(r+=Vi(i)),a&&(r+=Wi(a)))}return r};function Ki(u,t,s){return String(u).normalize().replace(/\r\n/g,`
|
|
5
5
|
`).split(`
|
|
6
|
-
`).map(r=>
|
|
7
|
-
`)}const
|
|
6
|
+
`).map(r=>Kr(r,t,s)).join(`
|
|
7
|
+
`)}const Yr=["up","down","left","right","space","enter","cancel"],Ke={actions:new Set(Yr),aliases:new Map([["k","up"],["j","down"],["h","left"],["l","right"],["","cancel"],["escape","cancel"]])};function Et(u,t){if(typeof u=="string")return Ke.aliases.get(u)===t;for(const s of u)if(s!==void 0&&Et(s,t))return!0;return!1}function Zr(u,t){if(u===t)return;const s=u.split(`
|
|
8
8
|
`),r=t.split(`
|
|
9
|
-
`),i=[];for(let
|
|
9
|
+
`),i=[];for(let a=0;a<Math.max(s.length,r.length);a++)s[a]!==r[a]&&i.push(a);return i}const Xr=globalThis.process.platform.startsWith("win"),gt=Symbol("clack:cancel");function _e(u){return u===gt}function Ye(u,t){const s=u;s.isTTY&&s.setRawMode(t)}function Jr({input:u=Si,output:t=Oi,overwrite:s=!0,hideCursor:r=!0}={}){const i=qe.createInterface({input:u,output:t,prompt:"",tabSize:1});qe.emitKeypressEvents(u,i),u.isTTY&&u.setRawMode(!0);const a=(e,{name:o,sequence:h})=>{const E=String(e);if(Et([E,o,h],"cancel")){r&&t.write(de.cursor.show),process.exit(0);return}if(!s)return;const y=o==="return"?0:-1,m=o==="return"?-1:0;qe.moveCursor(t,y,m,()=>{qe.clearLine(t,1,()=>{u.once("keypress",a)})})};return r&&t.write(de.cursor.hide),u.once("keypress",a),()=>{u.off("keypress",a),r&&t.write(de.cursor.show),u.isTTY&&!Xr&&u.setRawMode(!1),i.terminal=!1,i.close()}}var Qr=Object.defineProperty,en=(u,t,s)=>t in u?Qr(u,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):u[t]=s,Ce=(u,t,s)=>(en(u,typeof t!="symbol"?t+"":t,s),s);class Ze{constructor(t,s=!0){Ce(this,"input"),Ce(this,"output"),Ce(this,"_abortSignal"),Ce(this,"rl"),Ce(this,"opts"),Ce(this,"_render"),Ce(this,"_track",!1),Ce(this,"_prevFrame",""),Ce(this,"_subscribers",new Map),Ce(this,"_cursor",0),Ce(this,"state","initial"),Ce(this,"error",""),Ce(this,"value");const{input:r=Si,output:i=Oi,render:a,signal:e,...o}=t;this.opts=o,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=s,this._abortSignal=e,this.input=r,this.output=i}unsubscribe(){this._subscribers.clear()}setSubscriber(t,s){const r=this._subscribers.get(t)??[];r.push(s),this._subscribers.set(t,r)}on(t,s){this.setSubscriber(t,{cb:s})}once(t,s){this.setSubscriber(t,{cb:s,once:!0})}emit(t,...s){const r=this._subscribers.get(t)??[],i=[];for(const a of r)a.cb(...s),a.once&&i.push(()=>r.splice(r.indexOf(a),1));for(const a of i)a()}prompt(){return new Promise((t,s)=>{if(this._abortSignal){if(this._abortSignal.aborted)return this.state="cancel",this.close(),t(gt);this._abortSignal.addEventListener("abort",()=>{this.state="cancel",this.close()},{once:!0})}const r=new yr(0);r._write=(i,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(r),this.rl=Bi.createInterface({input:this.input,output:r,tabSize:2,prompt:"",escapeCodeTimeout:50}),Bi.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),Ye(this.input,!0),this.output.on("resize",this.render),this.render(),this.once("submit",()=>{this.output.write(de.cursor.show),this.output.off("resize",this.render),Ye(this.input,!1),t(this.value)}),this.once("cancel",()=>{this.output.write(de.cursor.show),this.output.off("resize",this.render),Ye(this.input,!1),t(gt)})})}onKeypress(t,s){if(this.state==="error"&&(this.state="active"),s?.name&&(!this._track&&Ke.aliases.has(s.name)&&this.emit("cursor",Ke.aliases.get(s.name)),Ke.actions.has(s.name)&&this.emit("cursor",s.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()),s?.name==="return"){if(this.opts.validate){const r=this.opts.validate(this.value);r&&(this.error=r instanceof Error?r.message:r,this.state="error",this.rl?.write(this.value))}this.state!=="error"&&(this.state="submit")}Et([t,s?.name,s?.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
10
|
`),Ye(this.input,!1),this.rl?.close(),this.rl=void 0,this.emit(`${this.state}`,this.value),this.unsubscribe()}restoreCursor(){const t=Ki(this._prevFrame,process.stdout.columns,{hard:!0}).split(`
|
|
11
|
-
`).length-1;this.output.write(
|
|
12
|
-
`);this.output.write(i[r]),this._prevFrame=t,this.output.write(
|
|
11
|
+
`).length-1;this.output.write(de.cursor.move(-999,t*-1))}render(){const t=Ki(this._render(this)??"",process.stdout.columns,{hard:!0});if(t!==this._prevFrame){if(this.state==="initial")this.output.write(de.cursor.hide);else{const s=Zr(this._prevFrame,t);if(this.restoreCursor(),s&&s?.length===1){const r=s[0];this.output.write(de.cursor.move(0,r)),this.output.write(de.erase.lines(1));const i=t.split(`
|
|
12
|
+
`);this.output.write(i[r]),this._prevFrame=t,this.output.write(de.cursor.move(0,i.length-r-1));return}if(s&&s?.length>1){const r=s[0];this.output.write(de.cursor.move(0,r)),this.output.write(de.erase.down());const i=t.split(`
|
|
13
13
|
`).slice(r);this.output.write(i.join(`
|
|
14
|
-
`)),this._prevFrame=t;return}this.output.write(
|
|
14
|
+
`)),this._prevFrame=t;return}this.output.write(de.erase.down())}this.output.write(t),this.state==="initial"&&(this.state="active"),this._prevFrame=t}}}class tn extends Ze{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",s=>{this.output.write(de.cursor.move(0,-1)),this.value=s,this.state="submit",this.close()}),this.on("cursor",()=>{this.value=!this.value})}}var sn=Object.defineProperty,rn=(u,t,s)=>t in u?sn(u,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):u[t]=s,Yi=(u,t,s)=>(rn(u,typeof t!="symbol"?t+"":t,s),s);let nn=class extends Ze{constructor(u){super(u,!1),Yi(this,"options"),Yi(this,"cursor",0),this.options=u.options,this.value=[...u.initialValues??[]],this.cursor=Math.max(this.options.findIndex(({value:t})=>t===u.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 u=this.value.length===this.options.length;this.value=u?[]:this.options.map(t=>t.value)}toggleValue(){const u=this.value.includes(this._value);this.value=u?this.value.filter(t=>t!==this._value):[...this.value,this._value]}};var un=Object.defineProperty,on=(u,t,s)=>t in u?un(u,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):u[t]=s,Zi=(u,t,s)=>(on(u,typeof t!="symbol"?t+"":t,s),s);class an extends Ze{constructor(t){super(t,!1),Zi(this,"options"),Zi(this,"cursor",0),this.options=t.options,this.cursor=this.options.findIndex(({value:s})=>s===t.initialValue),this.cursor===-1&&(this.cursor=0),this.changeValue(),this.on("cursor",s=>{switch(s){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 hn extends Ze{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),[s,...r]=this.value.slice(this.cursor);return`${t}${I.inverse(s)}${r.join("")}`}get cursor(){return this._cursor}constructor(t){super(t),this.on("finalize",()=>{this.value||(this.value=t.defaultValue)})}}function ln(){return ae.platform!=="win32"?ae.env.TERM!=="linux":!!ae.env.CI||!!ae.env.WT_SESSION||!!ae.env.TERMINUS_SUBLIME||ae.env.ConEmuTask==="{cmd::Cmder}"||ae.env.TERM_PROGRAM==="Terminus-Sublime"||ae.env.TERM_PROGRAM==="vscode"||ae.env.TERM==="xterm-256color"||ae.env.TERM==="alacritty"||ae.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}const Ct=ln(),me=(u,t)=>Ct?u:t,cn=me("\u25C6","*"),Xi=me("\u25A0","x"),Ji=me("\u25B2","x"),Ft=me("\u25C7","o"),Dn=me("\u250C","T"),Q=me("\u2502","|"),ve=me("\u2514","\u2014"),yt=me("\u25CF",">"),bt=me("\u25CB"," "),fn=me("\u25FB","[\u2022]"),Qi=me("\u25FC","[+]"),dn=me("\u25FB","[ ]"),mn=me("\u25CF","\u2022"),pn=me("\u25C6","*"),En=me("\u25B2","!"),gn=me("\u25A0","x"),Xe=u=>{switch(u){case"initial":case"active":return I.cyan(cn);case"cancel":return I.red(Xi);case"error":return I.yellow(Ji);case"submit":return I.green(Ft)}},_t=u=>{const{cursor:t,options:s,style:r}=u,i=u.maxItems??Number.POSITIVE_INFINITY,a=Math.max(process.stdout.rows-4,0),e=Math.min(a,Math.max(i,5));let o=0;t>=o+e-3?o=Math.max(Math.min(t-e+3,s.length-e),0):t<o+2&&(o=Math.max(t-2,0));const h=e<s.length&&o>0,E=e<s.length&&o+e<s.length;return s.slice(o,o+e).map((y,m,C)=>{const _=m===0&&h,b=m===C.length-1&&E;return _||b?I.dim("..."):r(y,m+o===t)})},Je=u=>new hn({validate:u.validate,placeholder:u.placeholder,defaultValue:u.defaultValue,initialValue:u.initialValue,render(){const t=`${I.gray(Q)}
|
|
15
15
|
${Xe(this.state)} ${u.message}
|
|
16
16
|
`,s=u.placeholder?I.inverse(u.placeholder[0])+I.dim(u.placeholder.slice(1)):I.inverse(I.hidden("_")),r=this.value?this.valueWithCursor:s;switch(this.state){case"error":return`${t.trim()}
|
|
17
17
|
${I.yellow(Q)} ${r}
|
|
18
|
-
${I.yellow(
|
|
18
|
+
${I.yellow(ve)} ${I.yellow(this.error)}
|
|
19
19
|
`;case"submit":return`${t}${I.gray(Q)} ${I.dim(this.value||u.placeholder)}`;case"cancel":return`${t}${I.gray(Q)} ${I.strikethrough(I.dim(this.value??""))}${this.value?.trim()?`
|
|
20
20
|
${I.gray(Q)}`:""}`;default:return`${t}${I.cyan(Q)} ${r}
|
|
21
|
-
${I.cyan(
|
|
22
|
-
`}}}).prompt(),
|
|
21
|
+
${I.cyan(ve)}
|
|
22
|
+
`}}}).prompt(),es=u=>{const t=u.active??"Yes",s=u.inactive??"No";return new tn({active:t,inactive:s,initialValue:u.initialValue??!0,render(){const r=`${I.gray(Q)}
|
|
23
23
|
${Xe(this.state)} ${u.message}
|
|
24
24
|
`,i=this.value?t:s;switch(this.state){case"submit":return`${r}${I.gray(Q)} ${I.dim(i)}`;case"cancel":return`${r}${I.gray(Q)} ${I.strikethrough(I.dim(i))}
|
|
25
|
-
${I.gray(Q)}`;default:return`${r}${I.cyan(Q)} ${this.value?`${I.green(
|
|
26
|
-
${I.cyan(
|
|
27
|
-
`}}}).prompt()},
|
|
25
|
+
${I.gray(Q)}`;default:return`${r}${I.cyan(Q)} ${this.value?`${I.green(yt)} ${t}`:`${I.dim(bt)} ${I.dim(t)}`} ${I.dim("/")} ${this.value?`${I.dim(bt)} ${I.dim(s)}`:`${I.green(yt)} ${s}`}
|
|
26
|
+
${I.cyan(ve)}
|
|
27
|
+
`}}}).prompt()},ts=u=>{const t=(s,r)=>{const i=s.label??String(s.value);switch(r){case"selected":return`${I.dim(i)}`;case"active":return`${I.green(yt)} ${i} ${s.hint?I.dim(`(${s.hint})`):""}`;case"cancelled":return`${I.strikethrough(I.dim(i))}`;default:return`${I.dim(bt)} ${I.dim(i)}`}};return new an({options:u.options,initialValue:u.initialValue,render(){const s=`${I.gray(Q)}
|
|
28
28
|
${Xe(this.state)} ${u.message}
|
|
29
29
|
`;switch(this.state){case"submit":return`${s}${I.gray(Q)} ${t(this.options[this.cursor],"selected")}`;case"cancel":return`${s}${I.gray(Q)} ${t(this.options[this.cursor],"cancelled")}
|
|
30
|
-
${I.gray(Q)}`;default:return`${s}${I.cyan(Q)} ${
|
|
30
|
+
${I.gray(Q)}`;default:return`${s}${I.cyan(Q)} ${_t({cursor:this.cursor,options:this.options,maxItems:u.maxItems,style:(r,i)=>t(r,i?"active":"inactive")}).join(`
|
|
31
31
|
${I.cyan(Q)} `)}
|
|
32
|
-
${I.cyan(
|
|
33
|
-
`}}}).prompt()},
|
|
32
|
+
${I.cyan(ve)}
|
|
33
|
+
`}}}).prompt()},Cn=u=>{const t=(s,r)=>{const i=s.label??String(s.value);return r==="active"?`${I.cyan(fn)} ${i} ${s.hint?I.dim(`(${s.hint})`):""}`:r==="selected"?`${I.green(Qi)} ${I.dim(i)}`:r==="cancelled"?`${I.strikethrough(I.dim(i))}`:r==="active-selected"?`${I.green(Qi)} ${i} ${s.hint?I.dim(`(${s.hint})`):""}`:r==="submitted"?`${I.dim(i)}`:`${I.dim(dn)} ${I.dim(i)}`};return new nn({options:u.options,initialValues:u.initialValues,required:u.required??!0,cursorAt:u.cursorAt,validate(s){if(this.required&&s.length===0)return`Please select at least one option.
|
|
34
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 s=`${I.gray(Q)}
|
|
35
35
|
${Xe(this.state)} ${u.message}
|
|
36
|
-
`,r=(i,
|
|
36
|
+
`,r=(i,a)=>{const e=this.value.includes(i.value);return a&&e?t(i,"active-selected"):e?t(i,"selected"):t(i,a?"active":"inactive")};switch(this.state){case"submit":return`${s}${I.gray(Q)} ${this.options.filter(({value:i})=>this.value.includes(i)).map(i=>t(i,"submitted")).join(I.dim(", "))||I.dim("none")}`;case"cancel":{const i=this.options.filter(({value:a})=>this.value.includes(a)).map(a=>t(a,"cancelled")).join(I.dim(", "));return`${s}${I.gray(Q)} ${i.trim()?`${i}
|
|
37
37
|
${I.gray(Q)}`:""}`}case"error":{const i=this.error.split(`
|
|
38
|
-
`).map((
|
|
39
|
-
`);return`${s+I.yellow(Q)} ${
|
|
38
|
+
`).map((a,e)=>e===0?`${I.yellow(ve)} ${I.yellow(a)}`:` ${a}`).join(`
|
|
39
|
+
`);return`${s+I.yellow(Q)} ${_t({options:this.options,cursor:this.cursor,maxItems:u.maxItems,style:r}).join(`
|
|
40
40
|
${I.yellow(Q)} `)}
|
|
41
41
|
${i}
|
|
42
|
-
`}default:return`${s}${I.cyan(Q)} ${
|
|
42
|
+
`}default:return`${s}${I.cyan(Q)} ${_t({options:this.options,cursor:this.cursor,maxItems:u.maxItems,style:r}).join(`
|
|
43
43
|
${I.cyan(Q)} `)}
|
|
44
|
-
${I.cyan(
|
|
45
|
-
`}}}).prompt()},
|
|
46
|
-
`)},Cn=(u="")=>{process.stdout.write(`${I.gray(Q)}
|
|
47
|
-
${I.gray(Se)} ${u}
|
|
44
|
+
${I.cyan(ve)}
|
|
45
|
+
`}}}).prompt()},is=(u="")=>{process.stdout.write(`${I.gray(ve)} ${I.red(u)}
|
|
48
46
|
|
|
49
|
-
`)},
|
|
50
|
-
`)
|
|
47
|
+
`)},ss=(u="")=>{process.stdout.write(`${I.gray(Dn)} ${u}
|
|
48
|
+
`)},Fn=(u="")=>{process.stdout.write(`${I.gray(Q)}
|
|
49
|
+
${I.gray(ve)} ${u}
|
|
50
|
+
|
|
51
|
+
`)},fe={message:(u="",{symbol:t=I.gray(Q)}={})=>{const s=[`${I.gray(Q)}`];if(u){const[r,...i]=u.split(`
|
|
52
|
+
`);s.push(`${t} ${r}`,...i.map(a=>`${I.gray(Q)} ${a}`))}process.stdout.write(`${s.join(`
|
|
51
53
|
`)}
|
|
52
|
-
`)},info:u=>{
|
|
53
|
-
`);const f=
|
|
54
|
-
`);process.stdout.write(
|
|
55
|
-
`);let d=0,
|
|
56
|
-
`):process.stdout.write(`${
|
|
57
|
-
`),
|
|
58
|
-
`).replace(/^/gm," ".repeat(
|
|
59
|
-
`)}padWidth(r,i){return Math.max(i.longestOptionTermLength(r,i),i.longestGlobalOptionTermLength(r,i),i.longestSubcommandTermLength(r,i),i.longestArgumentTermLength(r,i))}wrap(r,i,
|
|
54
|
+
`)},info:u=>{fe.message(u,{symbol:I.blue(mn)})},success:u=>{fe.message(u,{symbol:I.green(pn)})},step:u=>{fe.message(u,{symbol:I.green(Ft)})},warn:u=>{fe.message(u,{symbol:I.yellow(En)})},warning:u=>{fe.warn(u)},error:u=>{fe.message(u,{symbol:I.red(gn)})}};`${I.gray(Q)}`;const rs=({indicator:u="dots"}={})=>{const t=Ct?["\u25D2","\u25D0","\u25D3","\u25D1"]:["\u2022","o","O","0"],s=Ct?80:120,r=process.env.CI==="true";let i,a,e=!1,o="",h,E=performance.now();const y=f=>{const d=f>1?"Something went wrong":"Canceled";e&&l(d,f)},m=()=>y(2),C=()=>y(1),_=()=>{process.on("uncaughtExceptionMonitor",m),process.on("unhandledRejection",m),process.on("SIGINT",C),process.on("SIGTERM",C),process.on("exit",y)},b=()=>{process.removeListener("uncaughtExceptionMonitor",m),process.removeListener("unhandledRejection",m),process.removeListener("SIGINT",C),process.removeListener("SIGTERM",C),process.removeListener("exit",y)},A=()=>{if(h===void 0)return;r&&process.stdout.write(`
|
|
55
|
+
`);const f=h.split(`
|
|
56
|
+
`);process.stdout.write(de.cursor.move(-999,f.length-1)),process.stdout.write(de.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]`},n=(f="")=>{e=!0,i=Jr(),o=S(f),E=performance.now(),process.stdout.write(`${I.gray(Q)}
|
|
57
|
+
`);let d=0,D=0;_(),a=setInterval(()=>{if(r&&o===h)return;A(),h=o;const F=I.magenta(t[d]);if(r)process.stdout.write(`${F} ${o}...`);else if(u==="timer")process.stdout.write(`${F} ${o} ${v(E)}`);else{const R=".".repeat(Math.floor(D)).slice(0,3);process.stdout.write(`${F} ${o}${R}`)}d=d+1<t.length?d+1:0,D=D<t.length?D+.125:0},s)},l=(f="",d=0)=>{e=!1,clearInterval(a),A();const D=d===0?I.green(Ft):d===1?I.red(Xi):I.red(Ji);o=S(f??o),u==="timer"?process.stdout.write(`${D} ${o} ${v(E)}
|
|
58
|
+
`):process.stdout.write(`${D} ${o}
|
|
59
|
+
`),b(),i()};return{start:n,stop:l,message:(f="")=>{o=S(f??o)}}};var Qe={exports:{}},et={},tt={},ns;function it(){if(ns)return tt;ns=1;class u extends Error{constructor(r,i,a){super(a),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=i,this.exitCode=r,this.nestedError=void 0}}class t extends u{constructor(r){super(1,"commander.invalidArgument",r),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}}return tt.CommanderError=u,tt.InvalidArgumentError=t,tt}var us;function wt(){if(us)return et;us=1;const{InvalidArgumentError:u}=it();class t{constructor(i,a){switch(this.description=a||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,i[0]){case"<":this.required=!0,this._name=i.slice(1,-1);break;case"[":this.required=!1,this._name=i.slice(1,-1);break;default:this.required=!0,this._name=i;break}this._name.length>3&&this._name.slice(-3)==="..."&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_concatValue(i,a){return a===this.defaultValue||!Array.isArray(a)?[i]:a.concat(i)}default(i,a){return this.defaultValue=i,this.defaultValueDescription=a,this}argParser(i){return this.parseArg=i,this}choices(i){return this.argChoices=i.slice(),this.parseArg=(a,e)=>{if(!this.argChoices.includes(a))throw new u(`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 s(r){const i=r.name()+(r.variadic===!0?"...":"");return r.required?"<"+i+">":"["+i+"]"}return et.Argument=t,et.humanReadableArgName=s,et}var vt={},At={},os;function as(){if(os)return At;os=1;const{humanReadableArgName:u}=wt();class t{constructor(){this.helpWidth=void 0,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}visibleCommands(r){const i=r.commands.filter(a=>!a._hidden);if(r._hasImplicitHelpCommand()){const[,a,e]=r._helpCommandnameAndArgs.match(/([^ ]+) *(.*)/),o=r.createCommand(a).helpOption(!1);o.description(r._helpCommandDescription),e&&o.arguments(e),i.push(o)}return this.sortSubcommands&&i.sort((a,e)=>a.name().localeCompare(e.name())),i}compareOptions(r,i){const a=e=>e.short?e.short.replace(/^-/,""):e.long.replace(/^--/,"");return a(r).localeCompare(a(i))}visibleOptions(r){const i=r.options.filter(o=>!o.hidden),a=r._hasHelpOption&&r._helpShortFlag&&!r._findOption(r._helpShortFlag),e=r._hasHelpOption&&!r._findOption(r._helpLongFlag);if(a||e){let o;a?e?o=r.createOption(r._helpFlags,r._helpDescription):o=r.createOption(r._helpShortFlag,r._helpDescription):o=r.createOption(r._helpLongFlag,r._helpDescription),i.push(o)}return this.sortOptions&&i.sort(this.compareOptions),i}visibleGlobalOptions(r){if(!this.showGlobalOptions)return[];const i=[];for(let a=r.parent;a;a=a.parent){const e=a.options.filter(o=>!o.hidden);i.push(...e)}return this.sortOptions&&i.sort(this.compareOptions),i}visibleArguments(r){return r._argsDescription&&r._args.forEach(i=>{i.description=i.description||r._argsDescription[i.name()]||""}),r._args.find(i=>i.description)?r._args:[]}subcommandTerm(r){const i=r._args.map(a=>u(a)).join(" ");return r._name+(r._aliases[0]?"|"+r._aliases[0]:"")+(r.options.length?" [options]":"")+(i?" "+i:"")}optionTerm(r){return r.flags}argumentTerm(r){return r.name()}longestSubcommandTermLength(r,i){return i.visibleCommands(r).reduce((a,e)=>Math.max(a,i.subcommandTerm(e).length),0)}longestOptionTermLength(r,i){return i.visibleOptions(r).reduce((a,e)=>Math.max(a,i.optionTerm(e).length),0)}longestGlobalOptionTermLength(r,i){return i.visibleGlobalOptions(r).reduce((a,e)=>Math.max(a,i.optionTerm(e).length),0)}longestArgumentTermLength(r,i){return i.visibleArguments(r).reduce((a,e)=>Math.max(a,i.argumentTerm(e).length),0)}commandUsage(r){let i=r._name;r._aliases[0]&&(i=i+"|"+r._aliases[0]);let a="";for(let e=r.parent;e;e=e.parent)a=e.name()+" "+a;return a+i+" "+r.usage()}commandDescription(r){return r.description()}subcommandDescription(r){return r.summary()||r.description()}optionDescription(r){const i=[];return r.argChoices&&i.push(`choices: ${r.argChoices.map(a=>JSON.stringify(a)).join(", ")}`),r.defaultValue!==void 0&&(r.required||r.optional||r.isBoolean()&&typeof r.defaultValue=="boolean")&&i.push(`default: ${r.defaultValueDescription||JSON.stringify(r.defaultValue)}`),r.presetArg!==void 0&&r.optional&&i.push(`preset: ${JSON.stringify(r.presetArg)}`),r.envVar!==void 0&&i.push(`env: ${r.envVar}`),i.length>0?`${r.description} (${i.join(", ")})`:r.description}argumentDescription(r){const i=[];if(r.argChoices&&i.push(`choices: ${r.argChoices.map(a=>JSON.stringify(a)).join(", ")}`),r.defaultValue!==void 0&&i.push(`default: ${r.defaultValueDescription||JSON.stringify(r.defaultValue)}`),i.length>0){const a=`(${i.join(", ")})`;return r.description?`${r.description} ${a}`:a}return r.description}formatHelp(r,i){const a=i.padWidth(r,i),e=i.helpWidth||80,o=2,h=2;function E(S,v){if(v){const n=`${S.padEnd(a+h)}${v}`;return i.wrap(n,e-o,a+h)}return S}function y(S){return S.join(`
|
|
60
|
+
`).replace(/^/gm," ".repeat(o))}let m=[`Usage: ${i.commandUsage(r)}`,""];const C=i.commandDescription(r);C.length>0&&(m=m.concat([i.wrap(C,e,0),""]));const _=i.visibleArguments(r).map(S=>E(i.argumentTerm(S),i.argumentDescription(S)));_.length>0&&(m=m.concat(["Arguments:",y(_),""]));const b=i.visibleOptions(r).map(S=>E(i.optionTerm(S),i.optionDescription(S)));if(b.length>0&&(m=m.concat(["Options:",y(b),""])),this.showGlobalOptions){const S=i.visibleGlobalOptions(r).map(v=>E(i.optionTerm(v),i.optionDescription(v)));S.length>0&&(m=m.concat(["Global Options:",y(S),""]))}const A=i.visibleCommands(r).map(S=>E(i.subcommandTerm(S),i.subcommandDescription(S)));return A.length>0&&(m=m.concat(["Commands:",y(A),""])),m.join(`
|
|
61
|
+
`)}padWidth(r,i){return Math.max(i.longestOptionTermLength(r,i),i.longestGlobalOptionTermLength(r,i),i.longestSubcommandTermLength(r,i),i.longestArgumentTermLength(r,i))}wrap(r,i,a,e=40){const o=" \\f\\t\\v\xA0\u1680\u2000-\u200A\u202F\u205F\u3000\uFEFF",h=new RegExp(`[\\n][${o}]+`);if(r.match(h))return r;const E=i-a;if(E<e)return r;const y=r.slice(0,a),m=r.slice(a).replace(`\r
|
|
60
62
|
`,`
|
|
61
|
-
`),C=" ".repeat(
|
|
62
|
-
|.{1,${
|
|
63
|
+
`),C=" ".repeat(a),b="\\s\u200B",A=new RegExp(`
|
|
64
|
+
|.{1,${E-1}}([${b}]|$)|[^${b}]+?([${b}]|$)`,"g"),S=m.match(A)||[];return y+S.map((v,n)=>v===`
|
|
63
65
|
`?"":(n>0?C:"")+v.trimEnd()).join(`
|
|
64
|
-
`)}}return At.Help=t,At}var $e={},
|
|
66
|
+
`)}}return At.Help=t,At}var $e={},hs;function ls(){if(hs)return $e;hs=1;const{InvalidArgumentError:u}=it();class t{constructor(e,o){this.flags=e,this.description=o||"",this.required=e.includes("<"),this.optional=e.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test(e),this.mandatory=!1;const h=i(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,o){return this.defaultValue=e,this.defaultValueDescription=o,this}preset(e){return this.presetArg=e,this}conflicts(e){return this.conflictsWith=this.conflictsWith.concat(e),this}implies(e){let o=e;return typeof e=="string"&&(o={[e]:!0}),this.implied=Object.assign(this.implied||{},o),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,o){return o===this.defaultValue||!Array.isArray(o)?[e]:o.concat(e)}choices(e){return this.argChoices=e.slice(),this.parseArg=(o,h)=>{if(!this.argChoices.includes(o))throw new u(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(o,h):o},this}name(){return this.long?this.long.replace(/^--/,""):this.short.replace(/^-/,"")}attributeName(){return r(this.name().replace(/^no-/,""))}is(e){return this.short===e||this.long===e}isBoolean(){return!this.required&&!this.optional&&!this.negate}}class s{constructor(e){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,e.forEach(o=>{o.negate?this.negativeOptions.set(o.attributeName(),o):this.positiveOptions.set(o.attributeName(),o)}),this.negativeOptions.forEach((o,h)=>{this.positiveOptions.has(h)&&this.dualOptions.add(h)})}valueFromOption(e,o){const h=o.attributeName();if(!this.dualOptions.has(h))return!0;const E=this.negativeOptions.get(h).presetArg,y=E!==void 0?E:!1;return o.negate===(y===e)}}function r(a){return a.split("-").reduce((e,o)=>e+o[0].toUpperCase()+o.slice(1))}function i(a){let e,o;const h=a.split(/[ |,]+/);return h.length>1&&!/^[[<]/.test(h[1])&&(e=h.shift()),o=h.shift(),!e&&/^-[^-]$/.test(o)&&(e=o,o=void 0),{shortFlag:e,longFlag:o}}return $e.Option=t,$e.splitOptionFlags=i,$e.DualOptions=s,$e}var St={},cs;function yn(){if(cs)return St;cs=1;const u=3;function t(r,i){if(Math.abs(r.length-i.length)>u)return Math.max(r.length,i.length);const a=[];for(let e=0;e<=r.length;e++)a[e]=[e];for(let e=0;e<=i.length;e++)a[0][e]=e;for(let e=1;e<=i.length;e++)for(let o=1;o<=r.length;o++){let h=1;r[o-1]===i[e-1]?h=0:h=1,a[o][e]=Math.min(a[o-1][e]+1,a[o][e-1]+1,a[o-1][e-1]+h),o>1&&e>1&&r[o-1]===i[e-2]&&r[o-2]===i[e-1]&&(a[o][e]=Math.min(a[o][e],a[o-2][e-2]+1))}return a[r.length][i.length]}function s(r,i){if(!i||i.length===0)return"";i=Array.from(new Set(i));const a=r.startsWith("--");a&&(r=r.slice(2),i=i.map(E=>E.slice(2)));let e=[],o=u;const h=.4;return i.forEach(E=>{if(E.length<=1)return;const y=t(r,E),m=Math.max(r.length,E.length);(m-y)/m>h&&(y<o?(o=y,e=[E]):y===o&&e.push(E))}),e.sort((E,y)=>E.localeCompare(y)),a&&(e=e.map(E=>`--${E}`)),e.length>1?`
|
|
65
67
|
(Did you mean one of ${e.join(", ")}?)`:e.length===1?`
|
|
66
|
-
(Did you mean ${e[0]}?)`:""}return St.suggestSimilar=s,St}var
|
|
67
|
-
- specify the name in Command constructor or using .name()`);return
|
|
68
|
-
Expecting one of '${f.join("', '")}'`);return this._lifeCycleHooks[n]?this._lifeCycleHooks[n].push(
|
|
68
|
+
(Did you mean ${e[0]}?)`:""}return St.suggestSimilar=s,St}var Ds;function bn(){if(Ds)return vt;Ds=1;const u=xe.EventEmitter,t=br,s=De,r=ge,i=xi,{Argument:a,humanReadableArgName:e}=wt(),{CommanderError:o}=it(),{Help:h}=as(),{Option:E,splitOptionFlags:y,DualOptions:m}=ls(),{suggestSimilar:C}=yn();class _ extends u{constructor(n){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=n||"",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=>i.stdout.write(l),writeErr:l=>i.stderr.write(l),getOutHelpWidth:()=>i.stdout.isTTY?i.stdout.columns:void 0,getErrHelpWidth:()=>i.stderr.isTTY?i.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(n){return this._outputConfiguration=n._outputConfiguration,this._hasHelpOption=n._hasHelpOption,this._helpFlags=n._helpFlags,this._helpDescription=n._helpDescription,this._helpShortFlag=n._helpShortFlag,this._helpLongFlag=n._helpLongFlag,this._helpCommandName=n._helpCommandName,this._helpCommandnameAndArgs=n._helpCommandnameAndArgs,this._helpCommandDescription=n._helpCommandDescription,this._helpConfiguration=n._helpConfiguration,this._exitCallback=n._exitCallback,this._storeOptionsAsProperties=n._storeOptionsAsProperties,this._combineFlagAndOptionalValue=n._combineFlagAndOptionalValue,this._allowExcessArguments=n._allowExcessArguments,this._enablePositionalOptions=n._enablePositionalOptions,this._showHelpAfterError=n._showHelpAfterError,this._showSuggestionAfterError=n._showSuggestionAfterError,this}command(n,l,f){let d=l,D=f;typeof d=="object"&&d!==null&&(D=d,d=null),D=D||{};const[,F,R]=n.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(n){return new _(n)}createHelp(){return Object.assign(new h,this.configureHelp())}configureHelp(n){return n===void 0?this._helpConfiguration:(this._helpConfiguration=n,this)}configureOutput(n){return n===void 0?this._outputConfiguration:(Object.assign(this._outputConfiguration,n),this)}showHelpAfterError(n=!0){return typeof n!="string"&&(n=!!n),this._showHelpAfterError=n,this}showSuggestionAfterError(n=!0){return this._showSuggestionAfterError=!!n,this}addCommand(n,l){if(!n._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=n._name),(l.noHelp||l.hidden)&&(n._hidden=!0),this.commands.push(n),n.parent=this,this}createArgument(n,l){return new a(n,l)}argument(n,l,f,d){const D=this.createArgument(n,l);return typeof f=="function"?D.default(d).argParser(f):D.default(f),this.addArgument(D),this}arguments(n){return n.split(/ +/).forEach(l=>{this.argument(l)}),this}addArgument(n){const l=this._args.slice(-1)[0];if(l&&l.variadic)throw new Error(`only the last argument can be variadic '${l.name()}'`);if(n.required&&n.defaultValue!==void 0&&n.parseArg===void 0)throw new Error(`a default value for a required argument is never used: '${n.name()}'`);return this._args.push(n),this}addHelpCommand(n,l){return n===!1?this._addImplicitHelpCommand=!1:(this._addImplicitHelpCommand=!0,typeof n=="string"&&(this._helpCommandName=n.split(" ")[0],this._helpCommandnameAndArgs=n),this._helpCommandDescription=l||this._helpCommandDescription),this}_hasImplicitHelpCommand(){return this._addImplicitHelpCommand===void 0?this.commands.length&&!this._actionHandler&&!this._findCommand("help"):this._addImplicitHelpCommand}hook(n,l){const f=["preSubcommand","preAction","postAction"];if(!f.includes(n))throw new Error(`Unexpected value for event passed to hook : '${n}'.
|
|
70
|
+
Expecting one of '${f.join("', '")}'`);return this._lifeCycleHooks[n]?this._lifeCycleHooks[n].push(l):this._lifeCycleHooks[n]=[l],this}exitOverride(n){return n?this._exitCallback=n:this._exitCallback=l=>{if(l.code!=="commander.executeSubCommandAsync")throw l},this}_exit(n,l,f){this._exitCallback&&this._exitCallback(new o(n,l,f)),i.exit(n)}action(n){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),n.apply(this,D)};return this._actionHandler=l,this}createOption(n,l){return new E(n,l)}addOption(n){const l=n.name(),f=n.attributeName();if(n.negate){const D=n.long.replace(/^--no-/,"--");this._findOption(D)||this.setOptionValueWithSource(f,n.defaultValue===void 0?!0:n.defaultValue,"default")}else n.defaultValue!==void 0&&this.setOptionValueWithSource(f,n.defaultValue,"default");this.options.push(n);const d=(D,F,R)=>{D==null&&n.presetArg!==void 0&&(D=n.presetArg);const B=this.getOptionValue(f);if(D!==null&&n.parseArg)try{D=n.parseArg(D,B)}catch(x){if(x.code==="commander.invalidArgument"){const M=`${F} ${x.message}`;this.error(M,{exitCode:x.exitCode,code:x.code})}throw x}else D!==null&&n.variadic&&(D=n._concatValue(D,B));D==null&&(n.negate?D=!1:n.isBoolean()||n.optional?D=!0:D=""),this.setOptionValueWithSource(f,D,R)};return this.on("option:"+l,D=>{const F=`error: option '${n.flags}' argument '${D}' is invalid.`;d(D,F,"cli")}),n.envVar&&this.on("optionEnv:"+l,D=>{const F=`error: option '${n.flags}' value '${D}' from env '${n.envVar}' is invalid.`;d(D,F,"env")}),this}_optionEx(n,l,f,d,D){if(typeof l=="object"&&l instanceof E)throw new Error("To add an Option object use addOption() instead of option() or requiredOption()");const F=this.createOption(l,f);if(F.makeOptionMandatory(!!n.mandatory),typeof d=="function")F.default(D).argParser(d);else if(d instanceof RegExp){const R=d;d=(B,x)=>{const M=R.exec(B);return M?M[0]:x},F.default(D).argParser(d)}else F.default(d);return this.addOption(F)}option(n,l,f,d){return this._optionEx({},n,l,f,d)}requiredOption(n,l,f,d){return this._optionEx({mandatory:!0},n,l,f,d)}combineFlagAndOptionalValue(n=!0){return this._combineFlagAndOptionalValue=!!n,this}allowUnknownOption(n=!0){return this._allowUnknownOption=!!n,this}allowExcessArguments(n=!0){return this._allowExcessArguments=!!n,this}enablePositionalOptions(n=!0){return this._enablePositionalOptions=!!n,this}passThroughOptions(n=!0){if(this._passThroughOptions=!!n,this.parent&&n&&!this.parent._enablePositionalOptions)throw new Error("passThroughOptions can not be used without turning on enablePositionalOptions for parent command(s)");return this}storeOptionsAsProperties(n=!0){if(this._storeOptionsAsProperties=!!n,this.options.length)throw new Error("call .storeOptionsAsProperties() before adding options");return this}getOptionValue(n){return this._storeOptionsAsProperties?this[n]:this._optionValues[n]}setOptionValue(n,l){return this.setOptionValueWithSource(n,l,void 0)}setOptionValueWithSource(n,l,f){return this._storeOptionsAsProperties?this[n]=l:this._optionValues[n]=l,this._optionValueSources[n]=f,this}getOptionValueSource(n){return this._optionValueSources[n]}getOptionValueSourceWithGlobals(n){let l;return S(this).forEach(f=>{f.getOptionValueSource(n)!==void 0&&(l=f.getOptionValueSource(n))}),l}_prepareUserArgs(n,l){if(n!==void 0&&!Array.isArray(n))throw new Error("first parameter to parse must be array or undefined");l=l||{},n===void 0&&(n=i.argv,i.versions&&i.versions.electron&&(l.from="electron")),this.rawArgs=n.slice();let f;switch(l.from){case void 0:case"node":this._scriptPath=n[1],f=n.slice(2);break;case"electron":i.defaultApp?(this._scriptPath=n[1],f=n.slice(2)):f=n.slice(1);break;case"user":f=n.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(n,l){const f=this._prepareUserArgs(n,l);return this._parseCommand([],f),this}async parseAsync(n,l){const f=this._prepareUserArgs(n,l);return await this._parseCommand([],f),this}_executeSubCommand(n,l){l=l.slice();let f=!1;const d=[".js",".ts",".tsx",".mjs",".cjs"];function D(M,P){const U=s.resolve(M,P);if(r.existsSync(U))return U;if(d.includes(s.extname(P)))return;const G=d.find(Y=>r.existsSync(`${U}${Y}`));if(G)return`${U}${G}`}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let F=n._executableFile||`${this._name}-${n._name}`,R=this._executableDir||"";if(this._scriptPath){let M;try{M=r.realpathSync(this._scriptPath)}catch{M=this._scriptPath}R=s.resolve(s.dirname(M),R)}if(R){let M=D(R,F);if(!M&&!n._executableFile&&this._scriptPath){const P=s.basename(this._scriptPath,s.extname(this._scriptPath));P!==this._name&&(M=D(R,`${P}-${n._name}`))}F=M||F}f=d.includes(s.extname(F));let B;i.platform!=="win32"?f?(l.unshift(F),l=A(i.execArgv).concat(l),B=t.spawn(i.argv[0],l,{stdio:"inherit"})):B=t.spawn(F,l,{stdio:"inherit"}):(l.unshift(F),l=A(i.execArgv).concat(l),B=t.spawn(i.execPath,l,{stdio:"inherit"})),B.killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(P=>{i.on(P,()=>{B.killed===!1&&B.exitCode===null&&B.kill(P)})});const x=this._exitCallback;x?B.on("close",()=>{x(new o(i.exitCode||0,"commander.executeSubCommandAsync","(close)"))}):B.on("close",i.exit.bind(i)),B.on("error",M=>{if(M.code==="ENOENT"){const P=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
|
|
69
71
|
- if '${n._name}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
|
|
70
72
|
- if the default executable name is not suitable, use the executableFile option to supply a custom name or path
|
|
71
|
-
- ${P}`;throw new Error(U)}else if(M.code==="EACCES")throw new Error(`'${
|
|
73
|
+
- ${P}`;throw new Error(U)}else if(M.code==="EACCES")throw new Error(`'${F}' not executable`);if(!x)i.exit(1);else{const P=new o(1,"commander.executeSubCommandAsync","(error)");P.nestedError=M,x(P)}}),this.runningCommand=B}_dispatchSubcommand(n,l,f){const d=this._findCommand(n);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((n,l)=>{n.required&&this.args[l]==null&&this.missingArgument(n.name())}),!(this._args.length>0&&this._args[this._args.length-1].variadic)&&this.args.length>this._args.length&&this._excessArguments(this.args)}_processArguments(){const n=(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)=>n(f,R,F),f.defaultValue))):D===void 0&&(D=[]):d<this.args.length&&(D=this.args[d],f.parseArg&&(D=n(f,D,f.defaultValue))),l[d]=D}),this.processedArgs=l}_chainOrCall(n,l){return n&&n.then&&typeof n.then=="function"?n.then(()=>l()):l()}_chainOrCallHooks(n,l){let f=n;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(n,l,f){let d=n;return this._lifeCycleHooks[f]!==void 0&&this._lifeCycleHooks[f].forEach(D=>{d=this._chainOrCall(d,()=>D(this,l))}),d}_parseCommand(n,l){const f=this.parseOptions(l);if(this._parseOptionsEnv(),this._parseOptionsImplied(),n=n.concat(f.operands),l=f.unknown,this.args=n.concat(l),n&&this._findCommand(n[0]))return this._dispatchSubcommand(n[0],n.slice(1),l);if(this._hasImplicitHelpCommand()&&n[0]===this._helpCommandName)return n.length===1&&this.help(),this._dispatchSubcommand(n[1],[],[this._helpLongFlag]);if(this._defaultCommandName)return b(this,l),this._dispatchSubcommand(this._defaultCommandName,n,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,n,l)})),F=this._chainOrCallHooks(F,"postAction"),F}if(this.parent&&this.parent.listenerCount(D))d(),this._processArguments(),this.parent.emit(D,n,l);else if(n.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",n,l);this.listenerCount("command:*")?this.emit("command:*",n,l):this.commands.length?this.unknownCommand():(d(),this._processArguments())}else this.commands.length?(d(),this.help({error:!0})):(d(),this._processArguments())}_findCommand(n){if(n)return this.commands.find(l=>l._name===n||l._aliases.includes(n))}_findOption(n){return this.options.find(l=>l.is(n))}_checkForMissingMandatoryOptions(){for(let n=this;n;n=n.parent)n.options.forEach(l=>{l.mandatory&&n.getOptionValue(l.attributeName())===void 0&&n.missingMandatoryOptionValue(l)})}_checkForConflictingLocalOptions(){const n=this.options.filter(f=>{const d=f.attributeName();return this.getOptionValue(d)===void 0?!1:this.getOptionValueSource(d)!=="default"});n.filter(f=>f.conflictsWith.length>0).forEach(f=>{const d=n.find(D=>f.conflictsWith.includes(D.attributeName()));d&&this._conflictingOption(f,d)})}_checkForConflictingOptions(){for(let n=this;n;n=n.parent)n._checkForConflictingLocalOptions()}parseOptions(n){const l=[],f=[];let d=l;const D=n.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 M=D.shift();M===void 0&&this.optionMissingArgument(x),this.emit(`option:${x.name()}`,M)}else if(x.optional){let M=null;D.length>0&&!F(D[0])&&(M=D.shift()),this.emit(`option:${x.name()}`,M)}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("="),M=this._findOption(B.slice(0,x));if(M&&(M.required||M.optional)){this.emit(`option:${M.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 n={},l=this.options.length;for(let f=0;f<l;f++){const d=this.options[f].attributeName();n[d]=d===this._versionOptionName?this._version:this[d]}return n}return this._optionValues}optsWithGlobals(){return S(this).reduce((n,l)=>Object.assign(n,l.opts()),{})}error(n,l){this._outputConfiguration.outputError(`${n}
|
|
72
74
|
`,this._outputConfiguration.writeErr),typeof this._showHelpAfterError=="string"?this._outputConfiguration.writeErr(`${this._showHelpAfterError}
|
|
73
75
|
`):this._showHelpAfterError&&(this._outputConfiguration.writeErr(`
|
|
74
|
-
`),this.outputHelp({error:!0}));const f=
|
|
75
|
-
`),this._exit(0,"commander.version",n)}),this}description(n,
|
|
76
|
-
Expecting one of '${f.join("', '")}'`);const d=`${n}Help`;return this.on(d,
|
|
77
|
-
`)}),this}}function
|
|
76
|
+
`),this.outputHelp({error:!0}));const f=l||{},d=f.exitCode||1,D=f.code||"commander.error";this._exit(d,D,n)}_parseOptionsEnv(){this.options.forEach(n=>{if(n.envVar&&n.envVar in i.env){const l=n.attributeName();(this.getOptionValue(l)===void 0||["default","config","env"].includes(this.getOptionValueSource(l)))&&(n.required||n.optional?this.emit(`optionEnv:${n.name()}`,i.env[n.envVar]):this.emit(`optionEnv:${n.name()}`))}})}_parseOptionsImplied(){const n=new m(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())&&n.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(n){const l=`error: missing required argument '${n}'`;this.error(l,{code:"commander.missingArgument"})}optionMissingArgument(n){const l=`error: option '${n.flags}' argument missing`;this.error(l,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(n){const l=`error: required option '${n.flags}' not specified`;this.error(l,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(n,l){const f=F=>{const R=F.attributeName(),B=this.getOptionValue(R),x=this.options.find(P=>P.negate&&R===P.attributeName()),M=this.options.find(P=>!P.negate&&R===P.attributeName());return x&&(x.presetArg===void 0&&B===!1||x.presetArg!==void 0&&B===x.presetArg)?x:M||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(n)} cannot be used with ${d(l)}`;this.error(D,{code:"commander.conflictingOption"})}unknownOption(n){if(this._allowUnknownOption)return;let l="";if(n.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(n,d)}const f=`error: unknown option '${n}'${l}`;this.error(f,{code:"commander.unknownOption"})}_excessArguments(n){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 ${n.length}.`;this.error(D,{code:"commander.excessArguments"})}unknownCommand(){const n=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(n,d)}const f=`error: unknown command '${n}'${l}`;this.error(f,{code:"commander.unknownCommand"})}version(n,l,f){if(n===void 0)return this._version;this._version=n,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(`${n}
|
|
77
|
+
`),this._exit(0,"commander.version",n)}),this}description(n,l){return n===void 0&&l===void 0?this._description:(this._description=n,l&&(this._argsDescription=l),this)}summary(n){return n===void 0?this._summary:(this._summary=n,this)}alias(n){if(n===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]),n===l._name)throw new Error("Command alias can't be the same as its name");return l._aliases.push(n),this}aliases(n){return n===void 0?this._aliases:(n.forEach(l=>this.alias(l)),this)}usage(n){if(n===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=n,this}name(n){return n===void 0?this._name:(this._name=n,this)}nameFromFilename(n){return this._name=s.basename(n,s.extname(n)),this}executableDir(n){return n===void 0?this._executableDir:(this._executableDir=n,this)}helpInformation(n){const l=this.createHelp();return l.helpWidth===void 0&&(l.helpWidth=n&&n.error?this._outputConfiguration.getErrHelpWidth():this._outputConfiguration.getOutHelpWidth()),l.formatHelp(this,l)}_getHelpContext(n){n=n||{};const l={error:!!n.error};let f;return l.error?f=d=>this._outputConfiguration.writeErr(d):f=d=>this._outputConfiguration.writeOut(d),l.write=n.write||f,l.command=this,l}outputHelp(n){let l;typeof n=="function"&&(l=n,n=void 0);const f=this._getHelpContext(n);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(n,l){if(typeof n=="boolean")return this._hasHelpOption=n,this;this._helpFlags=n||this._helpFlags,this._helpDescription=l||this._helpDescription;const f=y(this._helpFlags);return this._helpShortFlag=f.shortFlag,this._helpLongFlag=f.longFlag,this}help(n){this.outputHelp(n);let l=i.exitCode||0;l===0&&n&&typeof n!="function"&&n.error&&(l=1),this._exit(l,"commander.help","(outputHelp)")}addHelpText(n,l){const f=["beforeAll","before","after","afterAll"];if(!f.includes(n))throw new Error(`Unexpected value for position to addHelpText.
|
|
78
|
+
Expecting one of '${f.join("', '")}'`);const d=`${n}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,n){v._hasHelpOption&&n.find(f=>f===v._helpLongFlag||f===v._helpShortFlag)&&(v.outputHelp(),v._exit(0,"commander.helpDisplayed","(outputHelp)"))}function A(v){return v.map(n=>{if(!n.startsWith("--inspect"))return n;let l,f="127.0.0.1",d="9229",D;return(D=n.match(/^(--inspect(-brk)?)$/))!==null?l=D[1]:(D=n.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null?(l=D[1],/^\d+$/.test(D[3])?d=D[3]:f=D[3]):(D=n.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(l=D[1],f=D[3],d=D[4]),l&&d!=="0"?`${l}=${f}:${parseInt(d)+1}`:n})}function S(v){const n=[];for(let l=v;l;l=l.parent)n.push(l);return n}return vt.Command=_,vt}var fs;function _n(){return fs||(fs=1,function(u,t){const{Argument:s}=wt(),{Command:r}=bn(),{CommanderError:i,InvalidArgumentError:a}=it(),{Help:e}=as(),{Option:o}=ls();t=u.exports=new r,t.program=t,t.Argument=s,t.Command=r,t.CommanderError=i,t.Help=e,t.InvalidArgumentError=a,t.InvalidOptionArgumentError=a,t.Option=o}(Qe,Qe.exports)),Qe.exports}var wn=_n();const vn=Ii(wn),{program:Ku,createCommand:Yu,createArgument:Zu,createOption:Xu,CommanderError:Ju,InvalidArgumentError:Qu,InvalidOptionArgumentError:eo,Command:An,Argument:to,Option:Sn,Help:io}=vn;var Ne={};class On 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 s=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,s):this.__proto__=s,this.method=t.method,this.path=t.path,this.expected=t.expected,this.value=t.value}}const Rn={__proto__:null,TypeGuardError:On},Bn=xr(Rn);var ds;function xn(){if(ds)return Ne;ds=1,Object.defineProperty(Ne,"__esModule",{value:!0}),Ne._assertGuard=void 0;const u=Bn,t=(s,r,i)=>{if(s===!0)throw i?i(r):new u.TypeGuardError(r);return!1};return Ne._assertGuard=t,Ne}var re=xn();function ms(u){return u.split("-").map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join("")}async function Ot(u){try{return await(await import("prettier")).format(u,{parser:"typescript"})}catch{return u}}const ps=Ri(vr),Tn="https://raw.githubusercontent.com/wrtnlabs/connectors/refs/heads/main/connectors-list.json",Rt="@wrtnlabs/connector-";function $n(u){return`${Rt}${u}`}function Nn(u){return u.replace(Rt,"")}async function In(){const u=await(await fetch(Tn)).json();return(()=>{const t=o=>Array.isArray(o.connectors)&&o.connectors.every(h=>typeof h=="object"&&h!==null&&s(h))&&typeof o.version=="string",s=o=>typeof o.name=="string"&&RegExp(/^@wrtnlabs\/connector\x2d(.*)/).test(o.name)&&Array.isArray(o.envList)&&o.envList.every(h=>typeof h=="string"),r=(o,h,E=!0)=>((Array.isArray(o.connectors)||re._assertGuard(E,{method:"typia.assert",path:h+".connectors",expected:"Array<UnwrapTaggedConnectorInfo>",value:o.connectors},e))&&o.connectors.every((y,m)=>(typeof y=="object"&&y!==null||re._assertGuard(E,{method:"typia.assert",path:h+".connectors["+m+"]",expected:"UnwrapTaggedConnectorInfo",value:y},e))&&i(y,h+".connectors["+m+"]",E)||re._assertGuard(E,{method:"typia.assert",path:h+".connectors["+m+"]",expected:"UnwrapTaggedConnectorInfo",value:y},e))||re._assertGuard(E,{method:"typia.assert",path:h+".connectors",expected:"Array<UnwrapTaggedConnectorInfo>",value:o.connectors},e))&&(typeof o.version=="string"||re._assertGuard(E,{method:"typia.assert",path:h+".version",expected:"string",value:o.version},e)),i=(o,h,E=!0)=>(typeof o.name=="string"&&RegExp(/^@wrtnlabs\/connector\x2d(.*)/).test(o.name)||re._assertGuard(E,{method:"typia.assert",path:h+".name",expected:"`@wrtnlabs/connector-${string}`",value:o.name},e))&&((Array.isArray(o.envList)||re._assertGuard(E,{method:"typia.assert",path:h+".envList",expected:"Array<string>",value:o.envList},e))&&o.envList.every((y,m)=>typeof y=="string"||re._assertGuard(E,{method:"typia.assert",path:h+".envList["+m+"]",expected:"string",value:y},e))||re._assertGuard(E,{method:"typia.assert",path:h+".envList",expected:"Array<string>",value:o.envList},e)),a=o=>typeof o=="object"&&o!==null&&t(o);let e;return(o,h)=>(a(o)===!1&&(e=h,((E,y,m=!0)=>(typeof E=="object"&&E!==null||re._assertGuard(!0,{method:"typia.assert",path:y+"",expected:"UnwrapTaggedConnectors",value:E},e))&&r(E,y+"",!0)||re._assertGuard(!0,{method:"typia.assert",path:y+"",expected:"UnwrapTaggedConnectors",value:E},e))(o,"$input",!0)),o)})()(u)}async function Ln(){return(await In()).connectors.map(({name:u,envList:t})=>{const s=Nn(u),r=s.replace("-"," ").toUpperCase();return{packageName:u,serviceName:s,displayName:r,envList:t}})}function Bt(u){return u.map(t=>{const s=ms(t);return`{
|
|
78
80
|
name: "${s} Connector",
|
|
79
81
|
protocol: "class",
|
|
80
82
|
application: typia.llm.application<${s}Service, "chatgpt">(),
|
|
81
83
|
execute: new ${s}Service(),
|
|
82
84
|
}`}).join(`,
|
|
83
|
-
`)}function xt(u){return u.map(t=>`import { ${
|
|
84
|
-
`)}function Tt({content:u,importCode:t,connectorCode:s}){return u.replace("/// INSERT IMPORT HERE",t).replace("/// INSERT CONTROLLER HERE",s)}var ae={},$t,ms;function Ie(){if(ms)return $t;ms=1;const u=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 $t=t=>t?Object.keys(t).map(s=>[u.has(s)?u.get(s):s,t[s]]).reduce((s,r)=>(s[r[0]]=r[1],s),Object.create(null)):{},$t}var Nt={},ps;function It(){if(ps)return Nt;ps=1;const u=typeof process=="object"&&process?process:{stdout:null,stderr:null},t=xe,s=Ti,i=$i.StringDecoder,o=Symbol("EOF"),e=Symbol("maybeEmitEnd"),a=Symbol("emittedEnd"),D=Symbol("emittingEnd"),F=Symbol("emittedError"),_=Symbol("closed"),E=Symbol("read"),C=Symbol("flush"),b=Symbol("flushChunk"),y=Symbol("encoding"),A=Symbol("decoder"),S=Symbol("flowing"),v=Symbol("paused"),n=Symbol("resume"),h=Symbol("buffer"),f=Symbol("pipes"),d=Symbol("bufferLength"),c=Symbol("bufferPush"),g=Symbol("bufferShift"),R=Symbol("objectMode"),B=Symbol("destroyed"),x=Symbol("error"),M=Symbol("emitData"),P=Symbol("emitEnd"),U=Symbol("emitEnd2"),q=Symbol("async"),Y=Symbol("abort"),N=Symbol("aborted"),V=Symbol("signal"),G=z=>Promise.resolve().then(z),ee=lt._MP_NO_ITERATOR_SYMBOLS_!=="1",w=ee&&Symbol.asyncIterator||Symbol("asyncIterator not implemented"),l=ee&&Symbol.iterator||Symbol("iterator not implemented"),p=z=>z==="end"||z==="finish"||z==="prefinish",L=z=>z instanceof ArrayBuffer||typeof z=="object"&&z.constructor&&z.constructor.name==="ArrayBuffer"&&z.byteLength>=0,H=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[n](),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=ue=>T.emit("error",ue),O.on("error",this.proxyErrors)}}class W extends s{constructor(O){super(),this[S]=!1,this[v]=!1,this[f]=[],this[h]=[],this[R]=O&&O.objectMode||!1,this[R]?this[y]=null:this[y]=O&&O.encoding||null,this[y]==="buffer"&&(this[y]=null),this[q]=O&&!!O.async||!1,this[A]=this[y]?new i(this[y]):null,this[o]=!1,this[a]=!1,this[D]=!1,this[_]=!1,this[F]=null,this.writable=!0,this.readable=!0,this[d]=0,this[B]=!1,O&&O.debugExposeBuffer===!0&&Object.defineProperty(this,"buffer",{get:()=>this[h]}),O&&O.debugExposePipes===!0&&Object.defineProperty(this,"pipes",{get:()=>this[f]}),this[V]=O&&O.signal,this[N]=!1,this[V]&&(this[V].addEventListener("abort",()=>this[Y]()),this[V].aborted&&this[Y]())}get bufferLength(){return this[d]}get encoding(){return this[y]}set encoding(O){if(this[R])throw new Error("cannot set encoding in objectMode");if(this[y]&&O!==this[y]&&(this[A]&&this[A].lastNeed||this[d]))throw new Error("cannot change encoding");this[y]!==O&&(this[A]=O?new i(O):null,this[h].length&&(this[h]=this[h].map(T=>this[A].write(T)))),this[y]=O}setEncoding(O){this.encoding=O}get objectMode(){return this[R]}set objectMode(O){this[R]=this[R]||!!O}get async(){return this[q]}set async(O){this[q]=this[q]||!!O}[Y](){this[N]=!0,this.emit("abort",this[V].reason),this.destroy(this[V].reason)}get aborted(){return this[N]}set aborted(O){}write(O,T,K){if(this[N])return!1;if(this[o])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 ue=this[q]?G:ce=>ce();return!this[R]&&!Buffer.isBuffer(O)&&(H(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[c](O),this[d]!==0&&this.emit("readable"),K&&ue(K),this.flowing):O.length?(typeof O=="string"&&!(T===this[y]&&!this[A].lastNeed)&&(O=Buffer.from(O,T)),Buffer.isBuffer(O)&&this[y]&&(O=this[A].write(O)),this.flowing&&this[d]!==0&&this[C](!0),this.flowing?this.emit("data",O):this[c](O),this[d]!==0&&this.emit("readable"),K&&ue(K),this.flowing):(this[d]!==0&&this.emit("readable"),K&&ue(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[h].length>1&&!this[R]&&(this.encoding?this[h]=[this[h].join("")]:this[h]=[Buffer.concat(this[h],this[d])]);const T=this[E](O||null,this[h][0]);return this[e](),T}[E](O,T){return O===T.length||O===null?this[g]():(this[h][0]=T.slice(O),T=T.slice(0,O),this[d]-=O),this.emit("data",T),!this[h].length&&!this[o]&&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[o]=!0,this.writable=!1,(this.flowing||!this[v])&&this[e](),this}[n](){this[B]||(this[v]=!1,this[S]=!0,this.emit("resume"),this[h].length?this[C]():this[o]?this[e]():this.emit("drain"))}resume(){return this[n]()}pause(){this[S]=!1,this[v]=!0}get destroyed(){return this[B]}get flowing(){return this[S]}get paused(){return this[v]}[c](O){this[R]?this[d]+=1:this[d]+=O.length,this[h].push(O)}[g](){return this[R]?this[d]-=1:this[d]-=this[h][0].length,this[h].shift()}[C](O){do;while(this[b](this[g]())&&this[h].length);!O&&!this[h].length&&!this[o]&&this.emit("drain")}[b](O){return this.emit("data",O),this.flowing}pipe(O,T){if(this[B])return;const K=this[a];return T=T||{},O===u.stdout||O===u.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[q]?G(()=>this[n]()):this[n]()),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[n]():O==="readable"&&this[d]!==0?super.emit("readable"):p(O)&&this[a]?(super.emit(O),this.removeAllListeners(O)):O==="error"&&this[F]&&(this[q]?G(()=>T.call(this,this[F])):T.call(this,this[F])),K}get emittedEnd(){return this[a]}[e](){!this[D]&&!this[a]&&!this[B]&&this[h].length===0&&this[o]&&(this[D]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[_]&&this.emit("close"),this[D]=!1)}emit(O,T,...K){if(O!=="error"&&O!=="close"&&O!==B&&this[B])return;if(O==="data")return!this[R]&&!T?!1:this[q]?G(()=>this[M](T)):this[M](T);if(O==="end")return this[P]();if(O==="close"){if(this[_]=!0,!this[a]&&!this[B])return;const ce=super.emit("close");return this.removeAllListeners("close"),ce}else if(O==="error"){this[F]=T,super.emit(x,T);const ce=!this[V]||this.listeners("error").length?super.emit("error",T):!1;return this[e](),ce}else if(O==="resume"){const ce=super.emit("resume");return this[e](),ce}else if(O==="finish"||O==="prefinish"){const ce=super.emit(O);return this.removeAllListeners(O),ce}const ue=super.emit(O,T,...K);return this[e](),ue}[M](O){for(const K of this[f])K.dest.write(O)===!1&&this.pause();const T=super.emit("data",O);return this[e](),T}[P](){this[a]||(this[a]=!0,this.readable=!1,this[q]?G(()=>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[y]?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())})}[w](){let O=!1;const T=()=>(this.pause(),O=!0,Promise.resolve({done:!0}));return{next:()=>{if(O)return T();const ue=this.read();if(ue!==null)return Promise.resolve({done:!1,value:ue});if(this[o])return T();let ce=null,qe=null;const te=Z=>{this.removeListener("data",m),this.removeListener("end",k),this.removeListener(B,j),T(),qe(Z)},m=Z=>{this.removeListener("error",te),this.removeListener("end",k),this.removeListener(B,j),this.pause(),ce({value:Z,done:!!this[o]})},k=()=>{this.removeListener("error",te),this.removeListener("data",m),this.removeListener(B,j),T(),ce({done:!0})},j=()=>te(new Error("stream destroyed"));return new Promise((Z,X)=>{qe=X,ce=Z,this.once(B,j),this.once("error",te),this.once("end",k),this.once("data",m)})},throw:T,return:T,[w](){return this}}}[l](){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 ue=this.read();return ue===null?T():{value:ue}};return this.once("end",T),this.once(x,T),this.once(B,T),{next:K,throw:T,return:T,[l](){return this}}}destroy(O){return this[B]?(O?this.emit("error",O):this.emit(B),this):(this[B]=!0,this[h].length=0,this[d]=0,typeof this.close=="function"&&!this[_]&&this.close(),O?this.emit("error",O):this.emit(B),this)}static isStream(O){return!!O&&(O instanceof W||O instanceof s||O instanceof t&&(typeof O.pipe=="function"||typeof O.write=="function"&&typeof O.end=="function"))}}return Nt.Minipass=W,Nt}var Ee={},Lt,Es;function In(){if(Es)return Lt;Es=1;const u=Ni.constants||{ZLIB_VERNUM:4736};return Lt=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},u)),Lt}var Mt,gs;function Cs(){if(gs)return Mt;gs=1;const u=typeof process=="object"&&process?process:{stdout:null,stderr:null},t=xe,s=Ti,r=$i.StringDecoder,i=Symbol("EOF"),o=Symbol("maybeEmitEnd"),e=Symbol("emittedEnd"),a=Symbol("emittingEnd"),D=Symbol("emittedError"),F=Symbol("closed"),_=Symbol("read"),E=Symbol("flush"),C=Symbol("flushChunk"),b=Symbol("encoding"),y=Symbol("decoder"),A=Symbol("flowing"),S=Symbol("paused"),v=Symbol("resume"),n=Symbol("bufferLength"),h=Symbol("bufferPush"),f=Symbol("bufferShift"),d=Symbol("objectMode"),c=Symbol("destroyed"),g=Symbol("emitData"),R=Symbol("emitEnd"),B=Symbol("emitEnd2"),x=Symbol("async"),M=w=>Promise.resolve().then(w),P=lt._MP_NO_ITERATOR_SYMBOLS_!=="1",U=P&&Symbol.asyncIterator||Symbol("asyncIterator not implemented"),q=P&&Symbol.iterator||Symbol("iterator not implemented"),Y=w=>w==="end"||w==="finish"||w==="prefinish",N=w=>w instanceof ArrayBuffer||typeof w=="object"&&w.constructor&&w.constructor.name==="ArrayBuffer"&&w.byteLength>=0,V=w=>!Buffer.isBuffer(w)&&ArrayBuffer.isView(w);class G{constructor(l,p,L){this.src=l,this.dest=p,this.opts=L,this.ondrain=()=>l[v](),p.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(){}end(){this.unpipe(),this.opts.end&&this.dest.end()}}class ee extends G{unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(l,p,L){super(l,p,L),this.proxyErrors=H=>p.emit("error",H),l.on("error",this.proxyErrors)}}return Mt=class gr extends s{constructor(l){super(),this[A]=!1,this[S]=!1,this.pipes=[],this.buffer=[],this[d]=l&&l.objectMode||!1,this[d]?this[b]=null:this[b]=l&&l.encoding||null,this[b]==="buffer"&&(this[b]=null),this[x]=l&&!!l.async||!1,this[y]=this[b]?new r(this[b]):null,this[i]=!1,this[e]=!1,this[a]=!1,this[F]=!1,this[D]=null,this.writable=!0,this.readable=!0,this[n]=0,this[c]=!1}get bufferLength(){return this[n]}get encoding(){return this[b]}set encoding(l){if(this[d])throw new Error("cannot set encoding in objectMode");if(this[b]&&l!==this[b]&&(this[y]&&this[y].lastNeed||this[n]))throw new Error("cannot change encoding");this[b]!==l&&(this[y]=l?new r(l):null,this.buffer.length&&(this.buffer=this.buffer.map(p=>this[y].write(p)))),this[b]=l}setEncoding(l){this.encoding=l}get objectMode(){return this[d]}set objectMode(l){this[d]=this[d]||!!l}get async(){return this[x]}set async(l){this[x]=this[x]||!!l}write(l,p,L){if(this[i])throw new Error("write after end");if(this[c])return this.emit("error",Object.assign(new Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;typeof p=="function"&&(L=p,p="utf8"),p||(p="utf8");const H=this[x]?M:J=>J();return!this[d]&&!Buffer.isBuffer(l)&&(V(l)?l=Buffer.from(l.buffer,l.byteOffset,l.byteLength):N(l)?l=Buffer.from(l):typeof l!="string"&&(this.objectMode=!0)),this[d]?(this.flowing&&this[n]!==0&&this[E](!0),this.flowing?this.emit("data",l):this[h](l),this[n]!==0&&this.emit("readable"),L&&H(L),this.flowing):l.length?(typeof l=="string"&&!(p===this[b]&&!this[y].lastNeed)&&(l=Buffer.from(l,p)),Buffer.isBuffer(l)&&this[b]&&(l=this[y].write(l)),this.flowing&&this[n]!==0&&this[E](!0),this.flowing?this.emit("data",l):this[h](l),this[n]!==0&&this.emit("readable"),L&&H(L),this.flowing):(this[n]!==0&&this.emit("readable"),L&&H(L),this.flowing)}read(l){if(this[c])return null;if(this[n]===0||l===0||l>this[n])return this[o](),null;this[d]&&(l=null),this.buffer.length>1&&!this[d]&&(this.encoding?this.buffer=[this.buffer.join("")]:this.buffer=[Buffer.concat(this.buffer,this[n])]);const p=this[_](l||null,this.buffer[0]);return this[o](),p}[_](l,p){return l===p.length||l===null?this[f]():(this.buffer[0]=p.slice(l),p=p.slice(0,l),this[n]-=l),this.emit("data",p),!this.buffer.length&&!this[i]&&this.emit("drain"),p}end(l,p,L){return typeof l=="function"&&(L=l,l=null),typeof p=="function"&&(L=p,p="utf8"),l&&this.write(l,p),L&&this.once("end",L),this[i]=!0,this.writable=!1,(this.flowing||!this[S])&&this[o](),this}[v](){this[c]||(this[S]=!1,this[A]=!0,this.emit("resume"),this.buffer.length?this[E]():this[i]?this[o]():this.emit("drain"))}resume(){return this[v]()}pause(){this[A]=!1,this[S]=!0}get destroyed(){return this[c]}get flowing(){return this[A]}get paused(){return this[S]}[h](l){this[d]?this[n]+=1:this[n]+=l.length,this.buffer.push(l)}[f](){return this.buffer.length&&(this[d]?this[n]-=1:this[n]-=this.buffer[0].length),this.buffer.shift()}[E](l){do;while(this[C](this[f]()));!l&&!this.buffer.length&&!this[i]&&this.emit("drain")}[C](l){return l?(this.emit("data",l),this.flowing):!1}pipe(l,p){if(this[c])return;const L=this[e];return p=p||{},l===u.stdout||l===u.stderr?p.end=!1:p.end=p.end!==!1,p.proxyErrors=!!p.proxyErrors,L?p.end&&l.end():(this.pipes.push(p.proxyErrors?new ee(this,l,p):new G(this,l,p)),this[x]?M(()=>this[v]()):this[v]()),l}unpipe(l){const p=this.pipes.find(L=>L.dest===l);p&&(this.pipes.splice(this.pipes.indexOf(p),1),p.unpipe())}addListener(l,p){return this.on(l,p)}on(l,p){const L=super.on(l,p);return l==="data"&&!this.pipes.length&&!this.flowing?this[v]():l==="readable"&&this[n]!==0?super.emit("readable"):Y(l)&&this[e]?(super.emit(l),this.removeAllListeners(l)):l==="error"&&this[D]&&(this[x]?M(()=>p.call(this,this[D])):p.call(this,this[D])),L}get emittedEnd(){return this[e]}[o](){!this[a]&&!this[e]&&!this[c]&&this.buffer.length===0&&this[i]&&(this[a]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[F]&&this.emit("close"),this[a]=!1)}emit(l,p,...L){if(l!=="error"&&l!=="close"&&l!==c&&this[c])return;if(l==="data")return p?this[x]?M(()=>this[g](p)):this[g](p):!1;if(l==="end")return this[R]();if(l==="close"){if(this[F]=!0,!this[e]&&!this[c])return;const J=super.emit("close");return this.removeAllListeners("close"),J}else if(l==="error"){this[D]=p;const J=super.emit("error",p);return this[o](),J}else if(l==="resume"){const J=super.emit("resume");return this[o](),J}else if(l==="finish"||l==="prefinish"){const J=super.emit(l);return this.removeAllListeners(l),J}const H=super.emit(l,p,...L);return this[o](),H}[g](l){for(const L of this.pipes)L.dest.write(l)===!1&&this.pause();const p=super.emit("data",l);return this[o](),p}[R](){this[e]||(this[e]=!0,this.readable=!1,this[x]?M(()=>this[B]()):this[B]())}[B](){if(this[y]){const p=this[y].end();if(p){for(const L of this.pipes)L.dest.write(p);super.emit("data",p)}}for(const p of this.pipes)p.end();const l=super.emit("end");return this.removeAllListeners("end"),l}collect(){const l=[];this[d]||(l.dataLength=0);const p=this.promise();return this.on("data",L=>{l.push(L),this[d]||(l.dataLength+=L.length)}),p.then(()=>l)}concat(){return this[d]?Promise.reject(new Error("cannot concat in objectMode")):this.collect().then(l=>this[d]?Promise.reject(new Error("cannot concat in objectMode")):this[b]?l.join(""):Buffer.concat(l,l.dataLength))}promise(){return new Promise((l,p)=>{this.on(c,()=>p(new Error("stream destroyed"))),this.on("error",L=>p(L)),this.on("end",()=>l())})}[U](){return{next:()=>{const p=this.read();if(p!==null)return Promise.resolve({done:!1,value:p});if(this[i])return Promise.resolve({done:!0});let L=null,H=null;const J=O=>{this.removeListener("data",$),this.removeListener("end",W),H(O)},$=O=>{this.removeListener("error",J),this.removeListener("end",W),this.pause(),L({value:O,done:!!this[i]})},W=()=>{this.removeListener("error",J),this.removeListener("data",$),L({done:!0})},z=()=>J(new Error("stream destroyed"));return new Promise((O,T)=>{H=T,L=O,this.once(c,z),this.once("error",J),this.once("end",W),this.once("data",$)})}}}[q](){return{next:()=>{const p=this.read();return{value:p,done:p===null}}}}destroy(l){return this[c]?(l?this.emit("error",l):this.emit(c),this):(this[c]=!0,this.buffer.length=0,this[n]=0,typeof this.close=="function"&&!this[F]&&this.close(),l?this.emit("error",l):this.emit(c),this)}static isStream(l){return!!l&&(l instanceof gr||l instanceof s||l instanceof t&&(typeof l.pipe=="function"||typeof l.write=="function"&&typeof l.end=="function"))}},Mt}var Fs;function ys(){if(Fs)return Ee;Fs=1;const u=ht,t=Ar.Buffer,s=Ni,r=Ee.constants=In(),i=Cs(),o=t.concat,e=Symbol("_superWrite");class a 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 D=Symbol("opts"),F=Symbol("flushFlag"),_=Symbol("finishFlushFlag"),E=Symbol("fullFlushFlag"),C=Symbol("handle"),b=Symbol("onError"),y=Symbol("sawError"),A=Symbol("level"),S=Symbol("strategy"),v=Symbol("ended");class n extends i{constructor(N,V){if(!N||typeof N!="object")throw new TypeError("invalid options for ZlibBase constructor");super(N),this[y]=!1,this[v]=!1,this[D]=N,this[F]=N.flush,this[_]=N.finishFlush;try{this[C]=new s[V](N)}catch(G){throw new a(G)}this[b]=G=>{this[y]||(this[y]=!0,this.close(),this.emit("error",G))},this[C].on("error",G=>this[b](new a(G))),this.once("end",()=>this.close)}close(){this[C]&&(this[C].close(),this[C]=null,this.emit("close"))}reset(){if(!this[y])return u(this[C],"zlib binding closed"),this[C].reset()}flush(N){this.ended||(typeof N!="number"&&(N=this[E]),this.write(Object.assign(t.alloc(0),{[F]:N})))}end(N,V,G){return N&&this.write(N,V),this.flush(this[_]),this[v]=!0,super.end(null,null,G)}get ended(){return this[v]}write(N,V,G){if(typeof V=="function"&&(G=V,V="utf8"),typeof N=="string"&&(N=t.from(N,V)),this[y])return;u(this[C],"zlib binding closed");const ee=this[C]._handle,w=ee.close;ee.close=()=>{};const l=this[C].close;this[C].close=()=>{},t.concat=H=>H;let p;try{const H=typeof N[F]=="number"?N[F]:this[F];p=this[C]._processChunk(N,H),t.concat=o}catch(H){t.concat=o,this[b](new a(H))}finally{this[C]&&(this[C]._handle=ee,ee.close=w,this[C].close=l,this[C].removeAllListeners("error"))}this[C]&&this[C].on("error",H=>this[b](new a(H)));let L;if(p)if(Array.isArray(p)&&p.length>0){L=this[e](t.from(p[0]));for(let H=1;H<p.length;H++)L=this[e](p[H])}else L=this[e](t.from(p));return G&&G(),L}[e](N){return super.write(N)}}class h extends n{constructor(N,V){N=N||{},N.flush=N.flush||r.Z_NO_FLUSH,N.finishFlush=N.finishFlush||r.Z_FINISH,super(N,V),this[E]=r.Z_FULL_FLUSH,this[A]=N.level,this[S]=N.strategy}params(N,V){if(!this[y]){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]!==V){this.flush(r.Z_SYNC_FLUSH),u(this[C],"zlib binding closed");const G=this[C].flush;this[C].flush=(ee,w)=>{this.flush(ee),w()};try{this[C].params(N,V)}finally{this[C].flush=G}this[C]&&(this[A]=N,this[S]=V)}}}}class f extends h{constructor(N){super(N,"Deflate")}}class d extends h{constructor(N){super(N,"Inflate")}}const c=Symbol("_portable");class g extends h{constructor(N){super(N,"Gzip"),this[c]=N&&!!N.portable}[e](N){return this[c]?(this[c]=!1,N[9]=255,super[e](N)):super[e](N)}}class R extends h{constructor(N){super(N,"Gunzip")}}class B extends h{constructor(N){super(N,"DeflateRaw")}}class x extends h{constructor(N){super(N,"InflateRaw")}}class M extends h{constructor(N){super(N,"Unzip")}}class P extends n{constructor(N,V){N=N||{},N.flush=N.flush||r.BROTLI_OPERATION_PROCESS,N.finishFlush=N.finishFlush||r.BROTLI_OPERATION_FINISH,super(N,V),this[E]=r.BROTLI_OPERATION_FLUSH}}class U extends P{constructor(N){super(N,"BrotliCompress")}}class q extends P{constructor(N){super(N,"BrotliDecompress")}}return Ee.Deflate=f,Ee.Inflate=d,Ee.Gzip=g,Ee.Gunzip=R,Ee.DeflateRaw=B,Ee.InflateRaw=x,Ee.Unzip=M,typeof s.BrotliCompress=="function"?(Ee.BrotliCompress=U,Ee.BrotliDecompress=q):Ee.BrotliCompress=Ee.BrotliDecompress=class{constructor(){throw new Error("Brotli is not supported in this version of Node.js")}},Ee}var Pt,bs;function Le(){return bs||(bs=1,Pt=(process.env.TESTING_TAR_FAKE_PLATFORM||process.platform)!=="win32"?t=>t:t=>t&&t.replace(/\\/g,"/")),Pt}var kt,ws;function Ht(){if(ws)return kt;ws=1;const{Minipass:u}=It(),t=Le(),s=Symbol("slurp");return kt=class extends u{constructor(i,o,e){switch(super(),this.pause(),this.extended=o,this.globalExtended=e,this.header=i,this.startBlockSize=512*Math.ceil(i.size/512),this.blockRemain=this.startBlockSize,this.remain=i.size,this.type=i.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(i.path),this.mode=i.mode,this.mode&&(this.mode=this.mode&4095),this.uid=i.uid,this.gid=i.gid,this.uname=i.uname,this.gname=i.gname,this.size=i.size,this.mtime=i.mtime,this.atime=i.atime,this.ctime=i.ctime,this.linkpath=t(i.linkpath),this.uname=i.uname,this.gname=i.gname,o&&this[s](o),e&&this[s](e,!0)}write(i){const o=i.length;if(o>this.blockRemain)throw new Error("writing more to entry than is appropriate");const e=this.remain,a=this.blockRemain;return this.remain=Math.max(0,e-o),this.blockRemain=Math.max(0,a-o),this.ignore?!0:e>=o?super.write(i):super.write(i.slice(0,e))}[s](i,o){for(const e in i)i[e]!==null&&i[e]!==void 0&&!(o&&e==="path")&&(this[e]=e==="path"||e==="linkpath"?t(i[e]):i[e])}},kt}var jt={},_s;function vs(){return _s||(_s=1,function(u){u.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"]]),u.code=new Map(Array.from(u.name).map(t=>[t[1],t[0]]))}(jt)),jt}var Ut,As;function Ln(){if(As)return Ut;As=1;const u=(D,F)=>{if(Number.isSafeInteger(D))D<0?s(D,F):t(D,F);else throw Error("cannot encode number outside of javascript safe integer range");return F},t=(D,F)=>{F[0]=128;for(var _=F.length;_>1;_--)F[_-1]=D&255,D=Math.floor(D/256)},s=(D,F)=>{F[0]=255;var _=!1;D=D*-1;for(var E=F.length;E>1;E--){var C=D&255;D=Math.floor(D/256),_?F[E-1]=e(C):C===0?F[E-1]=0:(_=!0,F[E-1]=a(C))}},r=D=>{const F=D[0],_=F===128?o(D.slice(1,D.length)):F===255?i(D):null;if(_===null)throw Error("invalid base256 encoding");if(!Number.isSafeInteger(_))throw Error("parsed number outside of javascript safe integer range");return _},i=D=>{for(var F=D.length,_=0,E=!1,C=F-1;C>-1;C--){var b=D[C],y;E?y=e(b):b===0?y=b:(E=!0,y=a(b)),y!==0&&(_-=y*Math.pow(256,F-C-1))}return _},o=D=>{for(var F=D.length,_=0,E=F-1;E>-1;E--){var C=D[E];C!==0&&(_+=C*Math.pow(256,F-E-1))}return _},e=D=>(255^D)&255,a=D=>(255^D)+1&255;return Ut={encode:u,parse:r},Ut}var zt,Ss;function Me(){if(Ss)return zt;Ss=1;const u=vs(),t=De.posix,s=Ln(),r=Symbol("slurp"),i=Symbol("type");class o{constructor(c,g,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[i]="0",this.linkpath=null,this.uname=null,this.gname=null,this.devmaj=0,this.devmin=0,this.atime=null,this.ctime=null,Buffer.isBuffer(c)?this.decode(c,g||0,R,B):c&&this.set(c)}decode(c,g,R,B){if(g||(g=0),!c||!(c.length>=g+512))throw new Error("need 512 bytes for header");if(this.path=a(c,g,100),this.mode=_(c,g+100,8),this.uid=_(c,g+108,8),this.gid=_(c,g+116,8),this.size=_(c,g+124,12),this.mtime=D(c,g+136,12),this.cksum=_(c,g+148,12),this[r](R),this[r](B,!0),this[i]=a(c,g+156,1),this[i]===""&&(this[i]="0"),this[i]==="0"&&this.path.slice(-1)==="/"&&(this[i]="5"),this[i]==="5"&&(this.size=0),this.linkpath=a(c,g+157,100),c.slice(g+257,g+265).toString()==="ustar\x0000")if(this.uname=a(c,g+265,32),this.gname=a(c,g+297,32),this.devmaj=_(c,g+329,8),this.devmin=_(c,g+337,8),c[g+475]!==0){const M=a(c,g+345,155);this.path=M+"/"+this.path}else{const M=a(c,g+345,130);M&&(this.path=M+"/"+this.path),this.atime=D(c,g+476,12),this.ctime=D(c,g+488,12)}let x=8*32;for(let M=g;M<g+148;M++)x+=c[M];for(let M=g+156;M<g+512;M++)x+=c[M];this.cksumValid=x===this.cksum,this.cksum===null&&x===8*32&&(this.nullBlock=!0)}[r](c,g){for(const R in c)c[R]!==null&&c[R]!==void 0&&!(g&&R==="path")&&(this[R]=c[R])}encode(c,g){if(c||(c=this.block=Buffer.alloc(512),g=0),g||(g=0),!(c.length>=g+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],M=B[1];this.needPax=B[2],this.needPax=f(c,g,100,x)||this.needPax,this.needPax=y(c,g+100,8,this.mode)||this.needPax,this.needPax=y(c,g+108,8,this.uid)||this.needPax,this.needPax=y(c,g+116,8,this.gid)||this.needPax,this.needPax=y(c,g+124,12,this.size)||this.needPax,this.needPax=n(c,g+136,12,this.mtime)||this.needPax,c[g+156]=this[i].charCodeAt(0),this.needPax=f(c,g+157,100,this.linkpath)||this.needPax,c.write("ustar\x0000",g+257,8),this.needPax=f(c,g+265,32,this.uname)||this.needPax,this.needPax=f(c,g+297,32,this.gname)||this.needPax,this.needPax=y(c,g+329,8,this.devmaj)||this.needPax,this.needPax=y(c,g+337,8,this.devmin)||this.needPax,this.needPax=f(c,g+345,R,M)||this.needPax,c[g+475]!==0?this.needPax=f(c,g+345,155,M)||this.needPax:(this.needPax=f(c,g+345,130,M)||this.needPax,this.needPax=n(c,g+476,12,this.atime)||this.needPax,this.needPax=n(c,g+488,12,this.ctime)||this.needPax);let P=8*32;for(let U=g;U<g+148;U++)P+=c[U];for(let U=g+156;U<g+512;U++)P+=c[U];return this.cksum=P,y(c,g+148,8,this.cksum),this.cksumValid=!0,this.needPax}set(c){for(const g in c)c[g]!==null&&c[g]!==void 0&&(this[g]=c[g])}get type(){return u.name.get(this[i])||this[i]}get typeKey(){return this[i]}set type(c){u.code.has(c)?this[i]=u.code.get(c):this[i]=c}}const e=(d,c)=>{let R=d,B="",x;const M=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)<=c?x=[R,B,!1]:Buffer.byteLength(R)>100&&Buffer.byteLength(B)<=c?x=[R.slice(0,99),B,!0]:(R=t.join(t.basename(B),R),B=t.dirname(B));while(B!==M&&!x);x||(x=[d.slice(0,99),"",!0])}return x},a=(d,c,g)=>d.slice(c,c+g).toString("utf8").replace(/\0.*/,""),D=(d,c,g)=>F(_(d,c,g)),F=d=>d===null?null:new Date(d*1e3),_=(d,c,g)=>d[c]&128?s.parse(d.slice(c,c+g)):C(d,c,g),E=d=>isNaN(d)?null:d,C=(d,c,g)=>E(parseInt(d.slice(c,c+g).toString("utf8").replace(/\0.*$/,"").trim(),8)),b={12:8589934591,8:2097151},y=(d,c,g,R)=>R===null?!1:R>b[g]||R<0?(s.encode(R,d.slice(c,c+g)),!0):(A(d,c,g,R),!1),A=(d,c,g,R)=>d.write(S(R,g),c,g,"ascii"),S=(d,c)=>v(Math.floor(d).toString(8),c),v=(d,c)=>(d.length===c-1?d:new Array(c-d.length-1).join("0")+d+" ")+"\0",n=(d,c,g,R)=>R===null?!1:y(d,c,g,R.getTime()/1e3),h=new Array(156).join("\0"),f=(d,c,g,R)=>R===null?!1:(d.write(R+h,c,g,"utf8"),R.length!==Buffer.byteLength(R)||R.length>g);return zt=o,zt}var qt,Os;function Wt(){if(Os)return qt;Os=1;const u=Me(),t=De;class s{constructor(a,D){this.atime=a.atime||null,this.charset=a.charset||null,this.comment=a.comment||null,this.ctime=a.ctime||null,this.gid=a.gid||null,this.gname=a.gname||null,this.linkpath=a.linkpath||null,this.mtime=a.mtime||null,this.path=a.path||null,this.size=a.size||null,this.uid=a.uid||null,this.uname=a.uname||null,this.dev=a.dev||null,this.ino=a.ino||null,this.nlink=a.nlink||null,this.global=D||!1}encode(){const a=this.encodeBody();if(a==="")return null;const D=Buffer.byteLength(a),F=512*Math.ceil(1+D/512),_=Buffer.allocUnsafe(F);for(let E=0;E<512;E++)_[E]=0;new u({path:("PaxHeader/"+t.basename(this.path)).slice(0,99),mode:this.mode||420,uid:this.uid||null,gid:this.gid||null,size:D,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(_),_.write(a,512,D,"utf8");for(let E=D+512;E<_.length;E++)_[E]=0;return _}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(a){if(this[a]===null||this[a]===void 0)return"";const D=this[a]instanceof Date?this[a].getTime()/1e3:this[a],F=" "+(a==="dev"||a==="ino"||a==="nlink"?"SCHILY.":"")+a+"="+D+`
|
|
85
|
-
`,
|
|
86
|
-
`).reduce(o,Object.create(null)),o=(e,a)=>{const D=parseInt(a,10);if(D!==Buffer.byteLength(a)+1)return e;a=a.slice((D+" ").length);const F=a.split("="),_=F.shift().replace(/^SCHILY\.(dev|ino|nlink)/,"$1");if(!_)return e;const E=F.join("=");return e[_]=/^([A-Z]+\.)?([mac]|birth|creation)time$/.test(_)?new Date(E*1e3):/^[0-9]+$/.test(E)?+E:E,e};return qt=s,qt}var Vt,Rs;function Pe(){return Rs||(Rs=1,Vt=u=>{let t=u.length-1,s=-1;for(;t>-1&&u.charAt(t)==="/";)s=t,t--;return s===-1?u:u.slice(0,s)}),Vt}var Gt,Bs;function Kt(){return Bs||(Bs=1,Gt=u=>class extends u{warn(t,s,r={}){this.file&&(r.file=this.file),this.cwd&&(r.cwd=this.cwd),r.code=s instanceof Error&&s.code||t,r.tarCode=t,!this.strict&&r.recoverable!==!1?(s instanceof Error&&(r=Object.assign(s,r),s=s.message),this.emit("warn",r.tarCode,s,r)):s instanceof Error?this.emit("error",Object.assign(s,r)):this.emit("error",Object.assign(new Error(`${t}: ${s}`),r))}}),Gt}var Yt,xs;function Ts(){if(xs)return Yt;xs=1;const u=["|","<",">","?",":"],t=u.map(i=>String.fromCharCode(61440+i.charCodeAt(0))),s=new Map(u.map((i,o)=>[i,t[o]])),r=new Map(t.map((i,o)=>[i,u[o]]));return Yt={encode:i=>u.reduce((o,e)=>o.split(e).join(s.get(e)),i),decode:i=>t.reduce((o,e)=>o.split(e).join(r.get(e)),i)},Yt}var Zt,$s;function Ns(){if($s)return Zt;$s=1;const{isAbsolute:u,parse:t}=De.win32;return Zt=s=>{let r="",i=t(s);for(;u(s)||i.root;){const o=s.charAt(0)==="/"&&s.slice(0,4)!=="//?/"?"/":i.root;s=s.slice(o.length),r+=o,i=t(s)}return[r,s]},Zt}var Xt,Is;function Mn(){return Is||(Is=1,Xt=(u,t,s)=>(u&=4095,s&&(u=(u|384)&-19),t&&(u&256&&(u|=64),u&32&&(u|=8),u&4&&(u|=1)),u)),Xt}var Jt,Ls;function Ms(){if(Ls)return Jt;Ls=1;const{Minipass:u}=It(),t=Wt(),s=Me(),r=ge,i=De,o=Le(),e=Pe(),a=(w,l)=>l?(w=o(w).replace(/^\.(\/|$)/,""),e(l)+"/"+w):o(w),D=16*1024*1024,F=Symbol("process"),_=Symbol("file"),E=Symbol("directory"),C=Symbol("symlink"),b=Symbol("hardlink"),y=Symbol("header"),A=Symbol("read"),S=Symbol("lstat"),v=Symbol("onlstat"),n=Symbol("onread"),h=Symbol("onreadlink"),f=Symbol("openfile"),d=Symbol("onopenfile"),c=Symbol("close"),g=Symbol("mode"),R=Symbol("awaitDrain"),B=Symbol("ondrain"),x=Symbol("prefix"),M=Symbol("hadError"),P=Kt(),U=Ts(),q=Ns(),Y=Mn(),N=P(class extends u{constructor(l,p){if(p=p||{},super(p),typeof l!="string")throw new TypeError("path is required");this.path=o(l),this.portable=!!p.portable,this.myuid=process.getuid&&process.getuid()||0,this.myuser=process.env.USER||"",this.maxReadSize=p.maxReadSize||D,this.linkCache=p.linkCache||new Map,this.statCache=p.statCache||new Map,this.preservePaths=!!p.preservePaths,this.cwd=o(p.cwd||process.cwd()),this.strict=!!p.strict,this.noPax=!!p.noPax,this.noMtime=!!p.noMtime,this.mtime=p.mtime||null,this.prefix=p.prefix?o(p.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 p.onwarn=="function"&&this.on("warn",p.onwarn);let L=!1;if(!this.preservePaths){const[H,J]=q(this.path);H&&(this.path=J,L=H)}this.win32=!!p.win32||process.platform==="win32",this.win32&&(this.path=U.decode(this.path.replace(/\\/g,"/")),l=l.replace(/\\/g,"/")),this.absolute=o(p.absolute||i.resolve(this.cwd,l)),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(l,...p){return l==="error"&&(this[M]=!0),super.emit(l,...p)}[S](){r.lstat(this.absolute,(l,p)=>{if(l)return this.emit("error",l);this[v](p)})}[v](l){this.statCache.set(this.absolute,l),this.stat=l,l.isFile()||(l.size=0),this.type=ee(l),this.emit("stat",l),this[F]()}[F](){switch(this.type){case"File":return this[_]();case"Directory":return this[E]();case"SymbolicLink":return this[C]();default:return this.end()}}[g](l){return Y(l,this.type==="Directory",this.portable)}[x](l){return a(l,this.prefix)}[y](){this.type==="Directory"&&this.portable&&(this.noMtime=!0),this.header=new s({path:this[x](this.path),linkpath:this.type==="Link"?this[x](this.linkpath):this.linkpath,mode:this[g](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)}[E](){this.path.slice(-1)!=="/"&&(this.path+="/"),this.stat.size=0,this[y](),this.end()}[C](){r.readlink(this.absolute,(l,p)=>{if(l)return this.emit("error",l);this[h](p)})}[h](l){this.linkpath=o(l),this[y](),this.end()}[b](l){this.type="Link",this.linkpath=o(i.relative(this.cwd,l)),this.stat.size=0,this[y](),this.end()}[_](){if(this.stat.nlink>1){const l=this.stat.dev+":"+this.stat.ino;if(this.linkCache.has(l)){const p=this.linkCache.get(l);if(p.indexOf(this.cwd)===0)return this[b](p)}this.linkCache.set(l,this.absolute)}if(this[y](),this.stat.size===0)return this.end();this[f]()}[f](){r.open(this.absolute,"r",(l,p)=>{if(l)return this.emit("error",l);this[d](p)})}[d](l){if(this.fd=l,this[M])return this[c]();this.blockLen=512*Math.ceil(this.stat.size/512),this.blockRemain=this.blockLen;const p=Math.min(this.blockLen,this.maxReadSize);this.buf=Buffer.allocUnsafe(p),this.offset=0,this.pos=0,this.remain=this.stat.size,this.length=this.buf.length,this[A]()}[A](){const{fd:l,buf:p,offset:L,length:H,pos:J}=this;r.read(l,p,L,H,J,($,W)=>{if($)return this[c](()=>this.emit("error",$));this[n](W)})}[c](l){r.close(this.fd,l)}[n](l){if(l<=0&&this.remain>0){const H=new Error("encountered unexpected EOF");return H.path=this.absolute,H.syscall="read",H.code="EOF",this[c](()=>this.emit("error",H))}if(l>this.remain){const H=new Error("did not encounter expected EOF");return H.path=this.absolute,H.syscall="read",H.code="EOF",this[c](()=>this.emit("error",H))}if(l===this.remain)for(let H=l;H<this.length&&l<this.blockRemain;H++)this.buf[H+this.offset]=0,l++,this.remain++;const p=this.offset===0&&l===this.buf.length?this.buf:this.buf.slice(this.offset,this.offset+l);this.write(p)?this[B]():this[R](()=>this[B]())}[R](l){this.once("drain",l)}write(l){if(this.blockRemain<l.length){const p=new Error("writing more data than expected");return p.path=this.absolute,this.emit("error",p)}return this.remain-=l.length,this.blockRemain-=l.length,this.pos+=l.length,this.offset+=l.length,super.write(l)}[B](){if(!this.remain)return this.blockRemain&&super.write(Buffer.alloc(this.blockRemain)),this[c](l=>l?this.emit("error",l):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{[S](){this[v](r.lstatSync(this.absolute))}[C](){this[h](r.readlinkSync(this.absolute))}[f](){this[d](r.openSync(this.absolute,"r"))}[A](){let l=!0;try{const{fd:p,buf:L,offset:H,length:J,pos:$}=this,W=r.readSync(p,L,H,J,$);this[n](W),l=!1}finally{if(l)try{this[c](()=>{})}catch{}}}[R](l){l()}[c](l){r.closeSync(this.fd),l()}}const G=P(class extends u{constructor(l,p){p=p||{},super(p),this.preservePaths=!!p.preservePaths,this.portable=!!p.portable,this.strict=!!p.strict,this.noPax=!!p.noPax,this.noMtime=!!p.noMtime,this.readEntry=l,this.type=l.type,this.type==="Directory"&&this.portable&&(this.noMtime=!0),this.prefix=p.prefix||null,this.path=o(l.path),this.mode=this[g](l.mode),this.uid=this.portable?null:l.uid,this.gid=this.portable?null:l.gid,this.uname=this.portable?null:l.uname,this.gname=this.portable?null:l.gname,this.size=l.size,this.mtime=this.noMtime?null:p.mtime||l.mtime,this.atime=this.portable?null:l.atime,this.ctime=this.portable?null:l.ctime,this.linkpath=o(l.linkpath),typeof p.onwarn=="function"&&this.on("warn",p.onwarn);let L=!1;if(!this.preservePaths){const[H,J]=q(this.path);H&&(this.path=J,L=H)}this.remain=l.size,this.blockRemain=l.startBlockSize,this.header=new s({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),l.pipe(this)}[x](l){return a(l,this.prefix)}[g](l){return Y(l,this.type==="Directory",this.portable)}write(l){const p=l.length;if(p>this.blockRemain)throw new Error("writing more to entry than is appropriate");return this.blockRemain-=p,super.write(l)}end(){return this.blockRemain&&super.write(Buffer.alloc(this.blockRemain)),super.end()}});N.Sync=V,N.Tar=G;const ee=w=>w.isFile()?"File":w.isDirectory()?"Directory":w.isSymbolicLink()?"SymbolicLink":"Unsupported";return Jt=N,Jt}var Qt,Ps;function Pn(){return Ps||(Ps=1,Qt=function(u){u.prototype[Symbol.iterator]=function*(){for(let t=this.head;t;t=t.next)yield t.value}}),Qt}var ei,ks;function Hs(){if(ks)return ei;ks=1,ei=u,u.Node=i,u.create=u;function u(o){var e=this;if(e instanceof u||(e=new u),e.tail=null,e.head=null,e.length=0,o&&typeof o.forEach=="function")o.forEach(function(F){e.push(F)});else if(arguments.length>0)for(var a=0,D=arguments.length;a<D;a++)e.push(arguments[a]);return e}u.prototype.removeNode=function(o){if(o.list!==this)throw new Error("removing node which does not belong to this list");var e=o.next,a=o.prev;return e&&(e.prev=a),a&&(a.next=e),o===this.head&&(this.head=e),o===this.tail&&(this.tail=a),o.list.length--,o.next=null,o.prev=null,o.list=null,e},u.prototype.unshiftNode=function(o){if(o!==this.head){o.list&&o.list.removeNode(o);var e=this.head;o.list=this,o.next=e,e&&(e.prev=o),this.head=o,this.tail||(this.tail=o),this.length++}},u.prototype.pushNode=function(o){if(o!==this.tail){o.list&&o.list.removeNode(o);var e=this.tail;o.list=this,o.prev=e,e&&(e.next=o),this.tail=o,this.head||(this.head=o),this.length++}},u.prototype.push=function(){for(var o=0,e=arguments.length;o<e;o++)s(this,arguments[o]);return this.length},u.prototype.unshift=function(){for(var o=0,e=arguments.length;o<e;o++)r(this,arguments[o]);return this.length},u.prototype.pop=function(){if(this.tail){var o=this.tail.value;return this.tail=this.tail.prev,this.tail?this.tail.next=null:this.head=null,this.length--,o}},u.prototype.shift=function(){if(this.head){var o=this.head.value;return this.head=this.head.next,this.head?this.head.prev=null:this.tail=null,this.length--,o}},u.prototype.forEach=function(o,e){e=e||this;for(var a=this.head,D=0;a!==null;D++)o.call(e,a.value,D,this),a=a.next},u.prototype.forEachReverse=function(o,e){e=e||this;for(var a=this.tail,D=this.length-1;a!==null;D--)o.call(e,a.value,D,this),a=a.prev},u.prototype.get=function(o){for(var e=0,a=this.head;a!==null&&e<o;e++)a=a.next;if(e===o&&a!==null)return a.value},u.prototype.getReverse=function(o){for(var e=0,a=this.tail;a!==null&&e<o;e++)a=a.prev;if(e===o&&a!==null)return a.value},u.prototype.map=function(o,e){e=e||this;for(var a=new u,D=this.head;D!==null;)a.push(o.call(e,D.value,this)),D=D.next;return a},u.prototype.mapReverse=function(o,e){e=e||this;for(var a=new u,D=this.tail;D!==null;)a.push(o.call(e,D.value,this)),D=D.prev;return a},u.prototype.reduce=function(o,e){var a,D=this.head;if(arguments.length>1)a=e;else if(this.head)D=this.head.next,a=this.head.value;else throw new TypeError("Reduce of empty list with no initial value");for(var F=0;D!==null;F++)a=o(a,D.value,F),D=D.next;return a},u.prototype.reduceReverse=function(o,e){var a,D=this.tail;if(arguments.length>1)a=e;else if(this.tail)D=this.tail.prev,a=this.tail.value;else throw new TypeError("Reduce of empty list with no initial value");for(var F=this.length-1;D!==null;F--)a=o(a,D.value,F),D=D.prev;return a},u.prototype.toArray=function(){for(var o=new Array(this.length),e=0,a=this.head;a!==null;e++)o[e]=a.value,a=a.next;return o},u.prototype.toArrayReverse=function(){for(var o=new Array(this.length),e=0,a=this.tail;a!==null;e++)o[e]=a.value,a=a.prev;return o},u.prototype.slice=function(o,e){e=e||this.length,e<0&&(e+=this.length),o=o||0,o<0&&(o+=this.length);var a=new u;if(e<o||e<0)return a;o<0&&(o=0),e>this.length&&(e=this.length);for(var D=0,F=this.head;F!==null&&D<o;D++)F=F.next;for(;F!==null&&D<e;D++,F=F.next)a.push(F.value);return a},u.prototype.sliceReverse=function(o,e){e=e||this.length,e<0&&(e+=this.length),o=o||0,o<0&&(o+=this.length);var a=new u;if(e<o||e<0)return a;o<0&&(o=0),e>this.length&&(e=this.length);for(var D=this.length,F=this.tail;F!==null&&D>e;D--)F=F.prev;for(;F!==null&&D>o;D--,F=F.prev)a.push(F.value);return a},u.prototype.splice=function(o,e,...a){o>this.length&&(o=this.length-1),o<0&&(o=this.length+o);for(var D=0,F=this.head;F!==null&&D<o;D++)F=F.next;for(var _=[],D=0;F&&D<e;D++)_.push(F.value),F=this.removeNode(F);F===null&&(F=this.tail),F!==this.head&&F!==this.tail&&(F=F.prev);for(var D=0;D<a.length;D++)F=t(this,F,a[D]);return _},u.prototype.reverse=function(){for(var o=this.head,e=this.tail,a=o;a!==null;a=a.prev){var D=a.prev;a.prev=a.next,a.next=D}return this.head=e,this.tail=o,this};function t(o,e,a){var D=e===o.head?new i(a,null,e,o):new i(a,e,e.next,o);return D.next===null&&(o.tail=D),D.prev===null&&(o.head=D),o.length++,D}function s(o,e){o.tail=new i(e,o.tail,null,o),o.head||(o.head=o.tail),o.length++}function r(o,e){o.head=new i(e,null,o.head,o),o.tail||(o.tail=o.head),o.length++}function i(o,e,a,D){if(!(this instanceof i))return new i(o,e,a,D);this.list=D,this.value=o,e?(e.next=this,this.prev=e):this.prev=null,a?(a.prev=this,this.next=a):this.next=null}try{Pn()(u)}catch{}return ei}var ti,js;function ii(){if(js)return ti;js=1;class u{constructor(w,l){this.path=w||"./",this.absolute=l,this.entry=null,this.stat=null,this.readdir=null,this.pending=!1,this.ignore=!1,this.piped=!1}}const{Minipass:t}=It(),s=ys(),r=Ht(),i=Ms(),o=i.Sync,e=i.Tar,a=Hs(),D=Buffer.alloc(1024),F=Symbol("onStat"),_=Symbol("ended"),E=Symbol("queue"),C=Symbol("current"),b=Symbol("process"),y=Symbol("processing"),A=Symbol("processJob"),S=Symbol("jobs"),v=Symbol("jobDone"),n=Symbol("addFSEntry"),h=Symbol("addTarEntry"),f=Symbol("stat"),d=Symbol("readdir"),c=Symbol("onreaddir"),g=Symbol("pipe"),R=Symbol("entry"),B=Symbol("entryOpt"),x=Symbol("writeEntryClass"),M=Symbol("write"),P=Symbol("ondrain"),U=ge,q=De,Y=Kt(),N=Le(),V=Y(class extends t{constructor(w){if(super(w),w=w||Object.create(null),this.opt=w,this.file=w.file||"",this.cwd=w.cwd||process.cwd(),this.maxReadSize=w.maxReadSize,this.preservePaths=!!w.preservePaths,this.strict=!!w.strict,this.noPax=!!w.noPax,this.prefix=N(w.prefix||""),this.linkCache=w.linkCache||new Map,this.statCache=w.statCache||new Map,this.readdirCache=w.readdirCache||new Map,this[x]=i,typeof w.onwarn=="function"&&this.on("warn",w.onwarn),this.portable=!!w.portable,this.zip=null,w.gzip||w.brotli){if(w.gzip&&w.brotli)throw new TypeError("gzip and brotli are mutually exclusive");w.gzip&&(typeof w.gzip!="object"&&(w.gzip={}),this.portable&&(w.gzip.portable=!0),this.zip=new s.Gzip(w.gzip)),w.brotli&&(typeof w.brotli!="object"&&(w.brotli={}),this.zip=new s.BrotliCompress(w.brotli)),this.zip.on("data",l=>super.write(l)),this.zip.on("end",l=>super.end()),this.zip.on("drain",l=>this[P]()),this.on("resume",l=>this.zip.resume())}else this.on("drain",this[P]);this.noDirRecurse=!!w.noDirRecurse,this.follow=!!w.follow,this.noMtime=!!w.noMtime,this.mtime=w.mtime||null,this.filter=typeof w.filter=="function"?w.filter:l=>!0,this[E]=new a,this[S]=0,this.jobs=+w.jobs||4,this[y]=!1,this[_]=!1}[M](w){return super.write(w)}add(w){return this.write(w),this}end(w){return w&&this.write(w),this[_]=!0,this[b](),this}write(w){if(this[_])throw new Error("write after end");return w instanceof r?this[h](w):this[n](w),this.flowing}[h](w){const l=N(q.resolve(this.cwd,w.path));if(!this.filter(w.path,w))w.resume();else{const p=new u(w.path,l,!1);p.entry=new e(w,this[B](p)),p.entry.on("end",L=>this[v](p)),this[S]+=1,this[E].push(p)}this[b]()}[n](w){const l=N(q.resolve(this.cwd,w));this[E].push(new u(w,l)),this[b]()}[f](w){w.pending=!0,this[S]+=1;const l=this.follow?"stat":"lstat";U[l](w.absolute,(p,L)=>{w.pending=!1,this[S]-=1,p?this.emit("error",p):this[F](w,L)})}[F](w,l){this.statCache.set(w.absolute,l),w.stat=l,this.filter(w.path,l)||(w.ignore=!0),this[b]()}[d](w){w.pending=!0,this[S]+=1,U.readdir(w.absolute,(l,p)=>{if(w.pending=!1,this[S]-=1,l)return this.emit("error",l);this[c](w,p)})}[c](w,l){this.readdirCache.set(w.absolute,l),w.readdir=l,this[b]()}[b](){if(!this[y]){this[y]=!0;for(let w=this[E].head;w!==null&&this[S]<this.jobs;w=w.next)if(this[A](w.value),w.value.ignore){const l=w.next;this[E].removeNode(w),w.next=l}this[y]=!1,this[_]&&!this[E].length&&this[S]===0&&(this.zip?this.zip.end(D):(super.write(D),super.end()))}}get[C](){return this[E]&&this[E].head&&this[E].head.value}[v](w){this[E].shift(),this[S]-=1,this[b]()}[A](w){if(!w.pending){if(w.entry){w===this[C]&&!w.piped&&this[g](w);return}if(w.stat||(this.statCache.has(w.absolute)?this[F](w,this.statCache.get(w.absolute)):this[f](w)),!!w.stat&&!w.ignore&&!(!this.noDirRecurse&&w.stat.isDirectory()&&!w.readdir&&(this.readdirCache.has(w.absolute)?this[c](w,this.readdirCache.get(w.absolute)):this[d](w),!w.readdir))){if(w.entry=this[R](w),!w.entry){w.ignore=!0;return}w===this[C]&&!w.piped&&this[g](w)}}}[B](w){return{onwarn:(l,p,L)=>this.warn(l,p,L),noPax:this.noPax,cwd:this.cwd,absolute:w.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](w){this[S]+=1;try{return new this[x](w.path,this[B](w)).on("end",()=>this[v](w)).on("error",l=>this.emit("error",l))}catch(l){this.emit("error",l)}}[P](){this[C]&&this[C].entry&&this[C].entry.resume()}[g](w){w.piped=!0,w.readdir&&w.readdir.forEach(L=>{const H=w.path,J=H==="./"?"":H.replace(/\/*$/,"/");this[n](J+L)});const l=w.entry,p=this.zip;p?l.on("data",L=>{p.write(L)||l.pause()}):l.on("data",L=>{super.write(L)||l.pause()})}pause(){return this.zip&&this.zip.pause(),super.pause()}});class G extends V{constructor(w){super(w),this[x]=o}pause(){}resume(){}[f](w){const l=this.follow?"statSync":"lstatSync";this[F](w,U[l](w.absolute))}[d](w,l){this[c](w,U.readdirSync(w.absolute))}[g](w){const l=w.entry,p=this.zip;w.readdir&&w.readdir.forEach(L=>{const H=w.path,J=H==="./"?"":H.replace(/\/*$/,"/");this[n](J+L)}),p?l.on("data",L=>{p.write(L)}):l.on("data",L=>{super[M](L)})}}return V.Sync=G,ti=V,ti}var Re={},Us;function ke(){if(Us)return Re;Us=1;const u=Cs(),t=xe.EventEmitter,s=ge;let r=s.writev;if(!r){const w=process.binding("fs"),l=w.FSReqWrap||w.FSReqCallback;r=(p,L,H,J)=>{const $=(z,O)=>J(z,O,L),W=new l;W.oncomplete=$,w.writeBuffers(p,L,H,W)}}const i=Symbol("_autoClose"),o=Symbol("_close"),e=Symbol("_ended"),a=Symbol("_fd"),D=Symbol("_finished"),F=Symbol("_flags"),_=Symbol("_flush"),E=Symbol("_handleChunk"),C=Symbol("_makeBuf"),b=Symbol("_mode"),y=Symbol("_needDrain"),A=Symbol("_onerror"),S=Symbol("_onopen"),v=Symbol("_onread"),n=Symbol("_onwrite"),h=Symbol("_open"),f=Symbol("_path"),d=Symbol("_pos"),c=Symbol("_queue"),g=Symbol("_read"),R=Symbol("_readSize"),B=Symbol("_reading"),x=Symbol("_remain"),M=Symbol("_size"),P=Symbol("_write"),U=Symbol("_writing"),q=Symbol("_defaultFlag"),Y=Symbol("_errored");class N extends u{constructor(l,p){if(p=p||{},super(p),this.readable=!0,this.writable=!1,typeof l!="string")throw new TypeError("path must be a string");this[Y]=!1,this[a]=typeof p.fd=="number"?p.fd:null,this[f]=l,this[R]=p.readSize||16*1024*1024,this[B]=!1,this[M]=typeof p.size=="number"?p.size:1/0,this[x]=this[M],this[i]=typeof p.autoClose=="boolean"?p.autoClose:!0,typeof this[a]=="number"?this[g]():this[h]()}get fd(){return this[a]}get path(){return this[f]}write(){throw new TypeError("this is a readable stream")}end(){throw new TypeError("this is a readable stream")}[h](){s.open(this[f],"r",(l,p)=>this[S](l,p))}[S](l,p){l?this[A](l):(this[a]=p,this.emit("open",p),this[g]())}[C](){return Buffer.allocUnsafe(Math.min(this[R],this[x]))}[g](){if(!this[B]){this[B]=!0;const l=this[C]();if(l.length===0)return process.nextTick(()=>this[v](null,0,l));s.read(this[a],l,0,l.length,null,(p,L,H)=>this[v](p,L,H))}}[v](l,p,L){this[B]=!1,l?this[A](l):this[E](p,L)&&this[g]()}[o](){if(this[i]&&typeof this[a]=="number"){const l=this[a];this[a]=null,s.close(l,p=>p?this.emit("error",p):this.emit("close"))}}[A](l){this[B]=!0,this[o](),this.emit("error",l)}[E](l,p){let L=!1;return this[x]-=l,l>0&&(L=super.write(l<p.length?p.slice(0,l):p)),(l===0||this[x]<=0)&&(L=!1,this[o](),super.end()),L}emit(l,p){switch(l){case"prefinish":case"finish":break;case"drain":typeof this[a]=="number"&&this[g]();break;case"error":return this[Y]?void 0:(this[Y]=!0,super.emit(l,p));default:return super.emit(l,p)}}}class V extends N{[h](){let l=!0;try{this[S](null,s.openSync(this[f],"r")),l=!1}finally{l&&this[o]()}}[g](){let l=!0;try{if(!this[B]){this[B]=!0;do{const p=this[C](),L=p.length===0?0:s.readSync(this[a],p,0,p.length,null);if(!this[E](L,p))break}while(!0);this[B]=!1}l=!1}finally{l&&this[o]()}}[o](){if(this[i]&&typeof this[a]=="number"){const l=this[a];this[a]=null,s.closeSync(l),this.emit("close")}}}class G extends t{constructor(l,p){p=p||{},super(p),this.readable=!1,this.writable=!0,this[Y]=!1,this[U]=!1,this[e]=!1,this[y]=!1,this[c]=[],this[f]=l,this[a]=typeof p.fd=="number"?p.fd:null,this[b]=p.mode===void 0?438:p.mode,this[d]=typeof p.start=="number"?p.start:null,this[i]=typeof p.autoClose=="boolean"?p.autoClose:!0;const L=this[d]!==null?"r+":"w";this[q]=p.flags===void 0,this[F]=this[q]?L:p.flags,this[a]===null&&this[h]()}emit(l,p){if(l==="error"){if(this[Y])return;this[Y]=!0}return super.emit(l,p)}get fd(){return this[a]}get path(){return this[f]}[A](l){this[o](),this[U]=!0,this.emit("error",l)}[h](){s.open(this[f],this[F],this[b],(l,p)=>this[S](l,p))}[S](l,p){this[q]&&this[F]==="r+"&&l&&l.code==="ENOENT"?(this[F]="w",this[h]()):l?this[A](l):(this[a]=p,this.emit("open",p),this[_]())}end(l,p){return l&&this.write(l,p),this[e]=!0,!this[U]&&!this[c].length&&typeof this[a]=="number"&&this[n](null,0),this}write(l,p){return typeof l=="string"&&(l=Buffer.from(l,p)),this[e]?(this.emit("error",new Error("write() after end()")),!1):this[a]===null||this[U]||this[c].length?(this[c].push(l),this[y]=!0,!1):(this[U]=!0,this[P](l),!0)}[P](l){s.write(this[a],l,0,l.length,this[d],(p,L)=>this[n](p,L))}[n](l,p){l?this[A](l):(this[d]!==null&&(this[d]+=p),this[c].length?this[_]():(this[U]=!1,this[e]&&!this[D]?(this[D]=!0,this[o](),this.emit("finish")):this[y]&&(this[y]=!1,this.emit("drain"))))}[_](){if(this[c].length===0)this[e]&&this[n](null,0);else if(this[c].length===1)this[P](this[c].pop());else{const l=this[c];this[c]=[],r(this[a],l,this[d],(p,L)=>this[n](p,L))}}[o](){if(this[i]&&typeof this[a]=="number"){const l=this[a];this[a]=null,s.close(l,p=>p?this.emit("error",p):this.emit("close"))}}}class ee extends G{[h](){let l;if(this[q]&&this[F]==="r+")try{l=s.openSync(this[f],this[F],this[b])}catch(p){if(p.code==="ENOENT")return this[F]="w",this[h]();throw p}else l=s.openSync(this[f],this[F],this[b]);this[S](null,l)}[o](){if(this[i]&&typeof this[a]=="number"){const l=this[a];this[a]=null,s.closeSync(l),this.emit("close")}}[P](l){let p=!0;try{this[n](null,s.writeSync(this[a],l,0,l.length,this[d])),p=!1}finally{if(p)try{this[o]()}catch{}}}}return Re.ReadStream=N,Re.ReadStreamSync=V,Re.WriteStream=G,Re.WriteStreamSync=ee,Re}var si,zs;function ri(){if(zs)return si;zs=1;const u=Kt(),t=Me(),s=xe,r=Hs(),i=1024*1024,o=Ht(),e=Wt(),a=ys(),{nextTick:D}=xi,F=Buffer.from([31,139]),_=Symbol("state"),E=Symbol("writeEntry"),C=Symbol("readEntry"),b=Symbol("nextEntry"),y=Symbol("processEntry"),A=Symbol("extendedHeader"),S=Symbol("globalExtendedHeader"),v=Symbol("meta"),n=Symbol("emitMeta"),h=Symbol("buffer"),f=Symbol("queue"),d=Symbol("ended"),c=Symbol("emittedEnd"),g=Symbol("emit"),R=Symbol("unzip"),B=Symbol("consumeChunk"),x=Symbol("consumeChunkSub"),M=Symbol("consumeBody"),P=Symbol("consumeMeta"),U=Symbol("consumeHeader"),q=Symbol("consuming"),Y=Symbol("bufferConcat"),N=Symbol("maybeEnd"),V=Symbol("writing"),G=Symbol("aborted"),ee=Symbol("onDone"),w=Symbol("sawValidEntry"),l=Symbol("sawNullBlock"),p=Symbol("sawEOF"),L=Symbol("closeStream"),H=J=>!0;return si=u(class extends s{constructor($){$=$||{},super($),this.file=$.file||"",this[w]=null,this.on(ee,z=>{(this[_]==="begin"||this[w]===!1)&&this.warn("TAR_BAD_ARCHIVE","Unrecognized archive format")}),$.ondone?this.on(ee,$.ondone):this.on(ee,z=>{this.emit("prefinish"),this.emit("finish"),this.emit("end")}),this.strict=!!$.strict,this.maxMetaEntrySize=$.maxMetaEntrySize||i,this.filter=typeof $.filter=="function"?$.filter:H;const W=$.file&&($.file.endsWith(".tar.br")||$.file.endsWith(".tbr"));this.brotli=!$.gzip&&$.brotli!==void 0?$.brotli:W?void 0:!1,this.writable=!0,this.readable=!1,this[f]=new r,this[h]=null,this[C]=null,this[E]=null,this[_]="begin",this[v]="",this[A]=null,this[S]=null,this[d]=!1,this[R]=null,this[G]=!1,this[l]=!1,this[p]=!1,this.on("end",()=>this[L]()),typeof $.onwarn=="function"&&this.on("warn",$.onwarn),typeof $.onentry=="function"&&this.on("entry",$.onentry)}[U]($,W){this[w]===null&&(this[w]=!1);let z;try{z=new t($,W,this[A],this[S])}catch(O){return this.warn("TAR_ENTRY_INVALID",O)}if(z.nullBlock)this[l]?(this[p]=!0,this[_]==="begin"&&(this[_]="header"),this[g]("eof")):(this[l]=!0,this[g]("nullBlock"));else if(this[l]=!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[E]=new o(z,this[A],this[S]);if(!this[w])if(T.remain){const K=()=>{T.invalid||(this[w]=!0)};T.on("end",K)}else this[w]=!0;T.meta?T.size>this.maxMetaEntrySize?(T.ignore=!0,this[g]("ignoredEntry",T),this[_]="ignore",T.resume()):T.size>0&&(this[v]="",T.on("data",K=>this[v]+=K),this[_]="meta"):(this[A]=null,T.ignore=T.ignore||!this.filter(T.path,T),T.ignore?(this[g]("ignoredEntry",T),this[_]=T.remain?"ignore":"header",T.resume()):(T.remain?this[_]="body":(this[_]="header",T.end()),this[C]?this[f].push(T):(this[f].push(T),this[b]())))}}}[L](){D(()=>this.emit("close"))}[y]($){let W=!0;return $?Array.isArray($)?this.emit.apply(this,$):(this[C]=$,this.emit("entry",$),$.emittedEnd||($.on("end",z=>this[b]()),W=!1)):(this[C]=null,W=!1),W}[b](){do;while(this[y](this[f].shift()));if(!this[f].length){const $=this[C];!$||$.flowing||$.size===$.remain?this[V]||this.emit("drain"):$.once("drain",z=>this.emit("drain"))}}[M]($,W){const z=this[E],O=z.blockRemain,T=O>=$.length&&W===0?$:$.slice(W,W+O);return z.write(T),z.blockRemain||(this[_]="header",this[E]=null,z.end()),T.length}[P]($,W){const z=this[E],O=this[M]($,W);return this[E]||this[n](z),O}[g]($,W,z){!this[f].length&&!this[C]?this.emit($,W,z):this[f].push([$,W,z])}[n]($){switch(this[g]("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[G]=!0,this.emit("abort",$),this.warn("TAR_ABORT",$,{recoverable:!1})}write($){if(this[G])return;if((this[R]===null||this.brotli===void 0&&this[R]===!1)&&$){if(this[h]&&($=Buffer.concat([this[h],$]),this[h]=null),$.length<F.length)return this[h]=$,!0;for(let T=0;this[R]===null&&T<F.length;T++)$[T]!==F[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[h]=$,!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 a.Unzip:new a.BrotliDecompress,this[R].on("data",ue=>this[B](ue)),this[R].on("error",ue=>this.abort(ue)),this[R].on("end",ue=>{this[d]=!0,this[B]()}),this[V]=!0;const K=this[R][T?"end":"write"]($);return this[V]=!1,K}}this[V]=!0,this[R]?this[R].write($):this[B]($),this[V]=!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[G]&&(this[h]=this[h]?Buffer.concat([this[h],$]):$)}[N](){if(this[d]&&!this[c]&&!this[G]&&!this[q]){this[c]=!0;const $=this[E];if($&&$.blockRemain){const W=this[h]?this[h].length:0;this.warn("TAR_BAD_ARCHIVE",`Truncated input (needed ${$.blockRemain} more bytes, only ${W} available)`,{entry:$}),this[h]&&$.write(this[h]),$.end()}this[g](ee)}}[B]($){if(this[q])this[Y]($);else if(!$&&!this[h])this[N]();else{if(this[q]=!0,this[h]){this[Y]($);const W=this[h];this[h]=null,this[x](W)}else this[x]($);for(;this[h]&&this[h].length>=512&&!this[G]&&!this[p];){const W=this[h];this[h]=null,this[x](W)}this[q]=!1}(!this[h]||this[d])&&this[N]()}[x]($){let W=0;const z=$.length;for(;W+512<=z&&!this[G]&&!this[p];)switch(this[_]){case"begin":case"header":this[U]($,W),W+=512;break;case"ignore":case"body":W+=this[M]($,W);break;case"meta":W+=this[P]($,W);break;default:throw new Error("invalid state: "+this[_])}W<z&&(this[h]?this[h]=Buffer.concat([$.slice(W),this[h]]):this[h]=$.slice(W))}end($){this[G]||(this[R]?this[R].end($):(this[d]=!0,this.brotli===void 0&&($=$||Buffer.alloc(0)),this.write($)))}}),si}var ni,qs;function ui(){if(qs)return ni;qs=1;const u=Ie(),t=ri(),s=ge,r=ke(),i=De,o=Pe();ni=(E,C,b)=>{typeof E=="function"?(b=E,C=null,E={}):Array.isArray(E)&&(C=E,E={}),typeof C=="function"&&(b=C,C=null),C?C=Array.from(C):C=[];const y=u(E);if(y.sync&&typeof b=="function")throw new TypeError("callback not supported for sync tar functions");if(!y.file&&typeof b=="function")throw new TypeError("callback only supported with file option");return C.length&&a(y,C),y.noResume||e(y),y.file&&y.sync?D(y):y.file?F(y,b):_(y)};const e=E=>{const C=E.onentry;E.onentry=C?b=>{C(b),b.resume()}:b=>b.resume()},a=(E,C)=>{const b=new Map(C.map(S=>[o(S),!0])),y=E.filter,A=(S,v)=>{const n=v||i.parse(S).root||".",h=S===n?!1:b.has(S)?b.get(S):A(i.dirname(S),n);return b.set(S,h),h};E.filter=y?(S,v)=>y(S,v)&&A(o(S)):S=>A(o(S))},D=E=>{const C=_(E),b=E.file;let y=!0,A;try{const S=s.statSync(b),v=E.maxReadSize||16*1024*1024;if(S.size<v)C.end(s.readFileSync(b));else{let n=0;const h=Buffer.allocUnsafe(v);for(A=s.openSync(b,"r");n<S.size;){const f=s.readSync(A,h,0,v,n);n+=f,C.write(h.slice(0,f))}C.end()}y=!1}finally{if(y&&A)try{s.closeSync(A)}catch{}}},F=(E,C)=>{const b=new t(E),y=E.maxReadSize||16*1024*1024,A=E.file,S=new Promise((v,n)=>{b.on("error",n),b.on("end",v),s.stat(A,(h,f)=>{if(h)n(h);else{const d=new r.ReadStream(A,{readSize:y,size:f.size});d.on("error",n),d.pipe(b)}})});return C?S.then(C,C):S},_=E=>new t(E);return ni}var oi,Ws;function kn(){if(Ws)return oi;Ws=1;const u=Ie(),t=ii(),s=ke(),r=ui(),i=De;oi=(E,C,b)=>{if(typeof C=="function"&&(b=C),Array.isArray(E)&&(C=E,E={}),!C||!Array.isArray(C)||!C.length)throw new TypeError("no files or directories specified");C=Array.from(C);const y=u(E);if(y.sync&&typeof b=="function")throw new TypeError("callback not supported for sync tar functions");if(!y.file&&typeof b=="function")throw new TypeError("callback only supported with file option");return y.file&&y.sync?o(y,C):y.file?e(y,C,b):y.sync?F(y,C):_(y,C)};const o=(E,C)=>{const b=new t.Sync(E),y=new s.WriteStreamSync(E.file,{mode:E.mode||438});b.pipe(y),a(b,C)},e=(E,C,b)=>{const y=new t(E),A=new s.WriteStream(E.file,{mode:E.mode||438});y.pipe(A);const S=new Promise((v,n)=>{A.on("error",n),A.on("close",v),y.on("error",n)});return D(y,C),b?S.then(b,b):S},a=(E,C)=>{C.forEach(b=>{b.charAt(0)==="@"?r({file:i.resolve(E.cwd,b.slice(1)),sync:!0,noResume:!0,onentry:y=>E.add(y)}):E.add(b)}),E.end()},D=(E,C)=>{for(;C.length;){const b=C.shift();if(b.charAt(0)==="@")return r({file:i.resolve(E.cwd,b.slice(1)),noResume:!0,onentry:y=>E.add(y)}).then(y=>D(E,C));E.add(b)}E.end()},F=(E,C)=>{const b=new t.Sync(E);return a(b,C),b},_=(E,C)=>{const b=new t(E);return D(b,C),b};return oi}var ai,Vs;function Gs(){if(Vs)return ai;Vs=1;const u=Ie(),t=ii(),s=ge,r=ke(),i=ui(),o=De,e=Me();ai=(C,b,y)=>{const A=u(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(!b||!Array.isArray(b)||!b.length)throw new TypeError("no files or directories specified");return b=Array.from(b),A.sync?a(A,b):F(A,b,y)};const a=(C,b)=>{const y=new t.Sync(C);let A=!0,S,v;try{try{S=s.openSync(C.file,"r+")}catch(f){if(f.code==="ENOENT")S=s.openSync(C.file,"w+");else throw f}const n=s.fstatSync(S),h=Buffer.alloc(512);e:for(v=0;v<n.size;v+=512){for(let c=0,g=0;c<512;c+=g){if(g=s.readSync(S,h,c,h.length-c,v+c),v===0&&h[0]===31&&h[1]===139)throw new Error("cannot append to compressed archives");if(!g)break e}const f=new e(h);if(!f.cksumValid)break;const d=512*Math.ceil(f.size/512);if(v+d+512>n.size)break;v+=d,C.mtimeCache&&C.mtimeCache.set(f.path,f.mtime)}A=!1,D(C,y,v,S,b)}finally{if(A)try{s.closeSync(S)}catch{}}},D=(C,b,y,A,S)=>{const v=new r.WriteStreamSync(C.file,{fd:A,start:y});b.pipe(v),_(b,S)},F=(C,b,y)=>{b=Array.from(b);const A=new t(C),S=(n,h,f)=>{const d=(x,M)=>{x?s.close(n,P=>f(x)):f(null,M)};let c=0;if(h===0)return d(null,0);let g=0;const R=Buffer.alloc(512),B=(x,M)=>{if(x)return d(x);if(g+=M,g<512&&M)return s.read(n,R,g,R.length-g,c+g,B);if(c===0&&R[0]===31&&R[1]===139)return d(new Error("cannot append to compressed archives"));if(g<512)return d(null,c);const P=new e(R);if(!P.cksumValid)return d(null,c);const U=512*Math.ceil(P.size/512);if(c+U+512>h||(c+=U+512,c>=h))return d(null,c);C.mtimeCache&&C.mtimeCache.set(P.path,P.mtime),g=0,s.read(n,R,0,512,c,B)};s.read(n,R,0,512,c,B)},v=new Promise((n,h)=>{A.on("error",h);let f="r+";const d=(c,g)=>{if(c&&c.code==="ENOENT"&&f==="r+")return f="w+",s.open(C.file,f,d);if(c)return h(c);s.fstat(g,(R,B)=>{if(R)return s.close(g,()=>h(R));S(g,B.size,(x,M)=>{if(x)return h(x);const P=new r.WriteStream(C.file,{fd:g,start:M});A.pipe(P),P.on("error",h),P.on("close",n),E(A,b)})})};s.open(C.file,f,d)});return y?v.then(y,y):v},_=(C,b)=>{b.forEach(y=>{y.charAt(0)==="@"?i({file:o.resolve(C.cwd,y.slice(1)),sync:!0,noResume:!0,onentry:A=>C.add(A)}):C.add(y)}),C.end()},E=(C,b)=>{for(;b.length;){const y=b.shift();if(y.charAt(0)==="@")return i({file:o.resolve(C.cwd,y.slice(1)),noResume:!0,onentry:A=>C.add(A)}).then(A=>E(C,b));C.add(y)}C.end()};return ai}var hi,Ks;function Hn(){if(Ks)return hi;Ks=1;const u=Ie(),t=Gs();hi=(r,i,o)=>{const e=u(r);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(!i||!Array.isArray(i)||!i.length)throw new TypeError("no files or directories specified");return i=Array.from(i),s(e),t(e,i,o)};const s=r=>{const i=r.filter;r.mtimeCache||(r.mtimeCache=new Map),r.filter=i?(o,e)=>i(o,e)&&!(r.mtimeCache.get(o)>e.mtime):(o,e)=>!(r.mtimeCache.get(o)>e.mtime)};return hi}var it={exports:{}},li,Ys;function jn(){if(Ys)return li;Ys=1;const{promisify:u}=Sr,t=ge;return li=r=>{if(!r)r={mode:511,fs:t};else if(typeof r=="object")r={mode:511,fs:t,...r};else if(typeof r=="number")r={mode:r,fs:t};else if(typeof r=="string")r={mode:parseInt(r,8),fs:t};else throw new TypeError("invalid options argument");return r.mkdir=r.mkdir||r.fs.mkdir||t.mkdir,r.mkdirAsync=u(r.mkdir),r.stat=r.stat||r.fs.stat||t.stat,r.statAsync=u(r.stat),r.statSync=r.statSync||r.fs.statSync||t.statSync,r.mkdirSync=r.mkdirSync||r.fs.mkdirSync||t.mkdirSync,r},li}var ci,Zs;function Un(){if(Zs)return ci;Zs=1;const u=process.env.__TESTING_MKDIRP_PLATFORM__||process.platform,{resolve:t,parse:s}=De;return ci=i=>{if(/\0/.test(i))throw Object.assign(new TypeError("path must be a string without null bytes"),{path:i,code:"ERR_INVALID_ARG_VALUE"});if(i=t(i),u==="win32"){const o=/[*|"<>?:]/,{root:e}=s(i);if(o.test(i.substr(e.length)))throw Object.assign(new Error("Illegal characters in path."),{path:i,code:"EINVAL"})}return i},ci}var Di,Xs;function zn(){if(Xs)return Di;Xs=1;const{dirname:u}=De,t=(r,i,o=void 0)=>o===i?Promise.resolve():r.statAsync(i).then(e=>e.isDirectory()?o:void 0,e=>e.code==="ENOENT"?t(r,u(i),i):void 0),s=(r,i,o=void 0)=>{if(o!==i)try{return r.statSync(i).isDirectory()?o:void 0}catch(e){return e.code==="ENOENT"?s(r,u(i),i):void 0}};return Di={findMade:t,findMadeSync:s},Di}var fi,Js;function Qs(){if(Js)return fi;Js=1;const{dirname:u}=De,t=(r,i,o)=>{i.recursive=!1;const e=u(r);return e===r?i.mkdirAsync(r,i).catch(a=>{if(a.code!=="EISDIR")throw a}):i.mkdirAsync(r,i).then(()=>o||r,a=>{if(a.code==="ENOENT")return t(e,i).then(D=>t(r,i,D));if(a.code!=="EEXIST"&&a.code!=="EROFS")throw a;return i.statAsync(r).then(D=>{if(D.isDirectory())return o;throw a},()=>{throw a})})},s=(r,i,o)=>{const e=u(r);if(i.recursive=!1,e===r)try{return i.mkdirSync(r,i)}catch(a){if(a.code!=="EISDIR")throw a;return}try{return i.mkdirSync(r,i),o||r}catch(a){if(a.code==="ENOENT")return s(r,i,s(e,i,o));if(a.code!=="EEXIST"&&a.code!=="EROFS")throw a;try{if(!i.statSync(r).isDirectory())throw a}catch{throw a}}};return fi={mkdirpManual:t,mkdirpManualSync:s},fi}var di,er;function qn(){if(er)return di;er=1;const{dirname:u}=De,{findMade:t,findMadeSync:s}=zn(),{mkdirpManual:r,mkdirpManualSync:i}=Qs();return di={mkdirpNative:(a,D)=>(D.recursive=!0,u(a)===a?D.mkdirAsync(a,D):t(D,a).then(_=>D.mkdirAsync(a,D).then(()=>_).catch(E=>{if(E.code==="ENOENT")return r(a,D);throw E}))),mkdirpNativeSync:(a,D)=>{if(D.recursive=!0,u(a)===a)return D.mkdirSync(a,D);const _=s(D,a);try{return D.mkdirSync(a,D),_}catch(E){if(E.code==="ENOENT")return i(a,D);throw E}}},di}var mi,tr;function Wn(){if(tr)return mi;tr=1;const u=ge,s=(process.env.__TESTING_MKDIRP_NODE_VERSION__||process.version).replace(/^v/,"").split("."),r=+s[0]>10||+s[0]==10&&+s[1]>=12;return mi={useNative:r?e=>e.mkdir===u.mkdir:()=>!1,useNativeSync:r?e=>e.mkdirSync===u.mkdirSync:()=>!1},mi}var pi,ir;function Vn(){if(ir)return pi;ir=1;const u=jn(),t=Un(),{mkdirpNative:s,mkdirpNativeSync:r}=qn(),{mkdirpManual:i,mkdirpManualSync:o}=Qs(),{useNative:e,useNativeSync:a}=Wn(),D=(_,E)=>(_=t(_),E=u(E),e(E)?s(_,E):i(_,E)),F=(_,E)=>(_=t(_),E=u(E),a(E)?r(_,E):o(_,E));return D.sync=F,D.native=(_,E)=>s(t(_),u(E)),D.manual=(_,E)=>i(t(_),u(E)),D.nativeSync=(_,E)=>r(t(_),u(E)),D.manualSync=(_,E)=>o(t(_),u(E)),pi=D,pi}var Ei,sr;function Gn(){if(sr)return Ei;sr=1;const u=ge,t=De,s=u.lchown?"lchown":"chown",r=u.lchownSync?"lchownSync":"chownSync",i=u.lchown&&!process.version.match(/v1[1-9]+\./)&&!process.version.match(/v10\.[6-9]/),o=(v,n,h)=>{try{return u[r](v,n,h)}catch(f){if(f.code!=="ENOENT")throw f}},e=(v,n,h)=>{try{return u.chownSync(v,n,h)}catch(f){if(f.code!=="ENOENT")throw f}},a=i?(v,n,h,f)=>d=>{!d||d.code!=="EISDIR"?f(d):u.chown(v,n,h,f)}:(v,n,h,f)=>f,D=i?(v,n,h)=>{try{return o(v,n,h)}catch(f){if(f.code!=="EISDIR")throw f;e(v,n,h)}}:(v,n,h)=>o(v,n,h),F=process.version;let _=(v,n,h)=>u.readdir(v,n,h),E=(v,n)=>u.readdirSync(v,n);/^v4\./.test(F)&&(_=(v,n,h)=>u.readdir(v,h));const C=(v,n,h,f)=>{u[s](v,n,h,a(v,n,h,d=>{f(d&&d.code!=="ENOENT"?d:null)}))},b=(v,n,h,f,d)=>{if(typeof n=="string")return u.lstat(t.resolve(v,n),(c,g)=>{if(c)return d(c.code!=="ENOENT"?c:null);g.name=n,b(v,g,h,f,d)});if(n.isDirectory())y(t.resolve(v,n.name),h,f,c=>{if(c)return d(c);const g=t.resolve(v,n.name);C(g,h,f,d)});else{const c=t.resolve(v,n.name);C(c,h,f,d)}},y=(v,n,h,f)=>{_(v,{withFileTypes:!0},(d,c)=>{if(d){if(d.code==="ENOENT")return f();if(d.code!=="ENOTDIR"&&d.code!=="ENOTSUP")return f(d)}if(d||!c.length)return C(v,n,h,f);let g=c.length,R=null;const B=x=>{if(!R){if(x)return f(R=x);if(--g===0)return C(v,n,h,f)}};c.forEach(x=>b(v,x,n,h,B))})},A=(v,n,h,f)=>{if(typeof n=="string")try{const d=u.lstatSync(t.resolve(v,n));d.name=n,n=d}catch(d){if(d.code==="ENOENT")return;throw d}n.isDirectory()&&S(t.resolve(v,n.name),h,f),D(t.resolve(v,n.name),h,f)},S=(v,n,h)=>{let f;try{f=E(v,{withFileTypes:!0})}catch(d){if(d.code==="ENOENT")return;if(d.code==="ENOTDIR"||d.code==="ENOTSUP")return D(v,n,h);throw d}return f&&f.length&&f.forEach(d=>A(v,d,n,h)),D(v,n,h)};return Ei=y,y.sync=S,Ei}var rr;function Kn(){if(rr)return it.exports;rr=1;const u=Vn(),t=ge,s=De,r=Gn(),i=Le();class o extends Error{constructor(y,A){super("Cannot extract through symbolic link"),this.path=A,this.symlink=y}get name(){return"SylinkError"}}class e extends Error{constructor(y,A){super(A+": Cannot cd into '"+y+"'"),this.path=y,this.code=A}get name(){return"CwdError"}}const a=(b,y)=>b.get(i(y)),D=(b,y,A)=>b.set(i(y),A),F=(b,y)=>{t.stat(b,(A,S)=>{(A||!S.isDirectory())&&(A=new e(b,A&&A.code||"ENOTDIR")),y(A)})};it.exports=(b,y,A)=>{b=i(b);const S=y.umask,v=y.mode|448,n=(v&S)!==0,h=y.uid,f=y.gid,d=typeof h=="number"&&typeof f=="number"&&(h!==y.processUid||f!==y.processGid),c=y.preserve,g=y.unlink,R=y.cache,B=i(y.cwd),x=(U,q)=>{U?A(U):(D(R,b,!0),q&&d?r(q,h,f,Y=>x(Y)):n?t.chmod(b,v,A):A())};if(R&&a(R,b)===!0)return x();if(b===B)return F(b,x);if(c)return u(b,{mode:v}).then(U=>x(null,U),x);const P=i(s.relative(B,b)).split("/");_(B,P,v,R,g,B,null,x)};const _=(b,y,A,S,v,n,h,f)=>{if(!y.length)return f(null,h);const d=y.shift(),c=i(s.resolve(b+"/"+d));if(a(S,c))return _(c,y,A,S,v,n,h,f);t.mkdir(c,A,E(c,y,A,S,v,n,h,f))},E=(b,y,A,S,v,n,h,f)=>d=>{d?t.lstat(b,(c,g)=>{if(c)c.path=c.path&&i(c.path),f(c);else if(g.isDirectory())_(b,y,A,S,v,n,h,f);else if(v)t.unlink(b,R=>{if(R)return f(R);t.mkdir(b,A,E(b,y,A,S,v,n,h,f))});else{if(g.isSymbolicLink())return f(new o(b,b+"/"+y.join("/")));f(d)}}):(h=h||b,_(b,y,A,S,v,n,h,f))},C=b=>{let y=!1,A="ENOTDIR";try{y=t.statSync(b).isDirectory()}catch(S){A=S.code}finally{if(!y)throw new e(b,A)}};return it.exports.sync=(b,y)=>{b=i(b);const A=y.umask,S=y.mode|448,v=(S&A)!==0,n=y.uid,h=y.gid,f=typeof n=="number"&&typeof h=="number"&&(n!==y.processUid||h!==y.processGid),d=y.preserve,c=y.unlink,g=y.cache,R=i(y.cwd),B=U=>{D(g,b,!0),U&&f&&r.sync(U,n,h),v&&t.chmodSync(b,S)};if(g&&a(g,b)===!0)return B();if(b===R)return C(R),B();if(d)return B(u.sync(b,S));const M=i(s.relative(R,b)).split("/");let P=null;for(let U=M.shift(),q=R;U&&(q+="/"+U);U=M.shift())if(q=i(s.resolve(q)),!a(g,q))try{t.mkdirSync(q,S),P=P||q,D(g,q,!0)}catch{const N=t.lstatSync(q);if(N.isDirectory()){D(g,q,!0);continue}else if(c){t.unlinkSync(q),t.mkdirSync(q,S),P=P||q,D(g,q,!0);continue}else if(N.isSymbolicLink())return new o(q,q+"/"+M.join("/"))}return B(P)},it.exports}var gi,nr;function ur(){if(nr)return gi;nr=1;const u=Object.create(null),{hasOwnProperty:t}=Object.prototype;return gi=s=>(t.call(u,s)||(u[s]=s.normalize("NFD")),u[s]),gi}var Ci,or;function Yn(){if(or)return Ci;or=1;const u=ht,t=ur(),s=Pe(),{join:r}=De,o=(process.env.TESTING_TAR_FAKE_PLATFORM||process.platform)==="win32";return Ci=()=>{const e=new Map,a=new Map,D=A=>A.split("/").slice(0,-1).reduce((v,n)=>(v.length&&(n=r(v[v.length-1],n)),v.push(n||"/"),v),[]),F=new Set,_=A=>{const S=a.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))}},E=A=>{const{paths:S,dirs:v}=_(A);return S.every(n=>n[0]===A)&&v.every(n=>n[0]instanceof Set&&n[0].has(A))},C=A=>F.has(A)||!E(A)?!1:(F.add(A),A(()=>b(A)),!0),b=A=>{if(!F.has(A))return!1;const{paths:S,dirs:v}=a.get(A),n=new Set;return S.forEach(h=>{const f=e.get(h);u.equal(f[0],A),f.length===1?e.delete(h):(f.shift(),typeof f[0]=="function"?n.add(f[0]):f[0].forEach(d=>n.add(d)))}),v.forEach(h=>{const f=e.get(h);u(f[0]instanceof Set),f[0].size===1&&f.length===1?e.delete(h):f[0].size===1?(f.shift(),n.add(f[0])):f[0].delete(A)}),F.delete(A),n.forEach(h=>C(h)),!0};return{check:E,reserve:(A,S)=>{A=o?["win32 parallelization disabled"]:A.map(n=>s(r(t(n))).toLowerCase());const v=new Set(A.map(n=>D(n)).reduce((n,h)=>n.concat(h)));return a.set(S,{dirs:v,paths:A}),A.forEach(n=>{const h=e.get(n);h?h.push(S):e.set(n,[S])}),v.forEach(n=>{const h=e.get(n);h?h[h.length-1]instanceof Set?h[h.length-1].add(S):h.push(new Set([S])):e.set(n,[new Set([S])])}),C(S)}}},Ci}var Fi,ar;function Zn(){if(ar)return Fi;ar=1;const t=(process.env.__FAKE_PLATFORM__||process.platform)==="win32",s=lt.__FAKE_TESTING_FS__||ge,{O_CREAT:r,O_TRUNC:i,O_WRONLY:o,UV_FS_O_FILEMAP:e=0}=s.constants,a=t&&!!e,D=512*1024,F=e|i|r|o;return Fi=a?_=>_<D?F:"w":()=>"w",Fi}var yi,hr;function lr(){if(hr)return yi;hr=1;const u=ht,t=ri(),s=ge,r=ke(),i=De,o=Kn(),e=Ts(),a=Yn(),D=Ns(),F=Le(),_=Pe(),E=ur(),C=Symbol("onEntry"),b=Symbol("checkFs"),y=Symbol("checkFs2"),A=Symbol("pruneCache"),S=Symbol("isReusable"),v=Symbol("makeFs"),n=Symbol("file"),h=Symbol("directory"),f=Symbol("link"),d=Symbol("symlink"),c=Symbol("hardlink"),g=Symbol("unsupported"),R=Symbol("checkPath"),B=Symbol("mkdir"),x=Symbol("onError"),M=Symbol("pending"),P=Symbol("pend"),U=Symbol("unpend"),q=Symbol("ended"),Y=Symbol("maybeClose"),N=Symbol("skip"),V=Symbol("doChown"),G=Symbol("uid"),ee=Symbol("gid"),w=Symbol("checkedCwd"),l=Or,p=Zn(),H=(process.env.TESTING_TAR_FAKE_PLATFORM||process.platform)==="win32",J=1024,$=(te,m)=>{if(!H)return s.unlink(te,m);const k=te+".DELETE."+l.randomBytes(16).toString("hex");s.rename(te,k,j=>{if(j)return m(j);s.unlink(k,m)})},W=te=>{if(!H)return s.unlinkSync(te);const m=te+".DELETE."+l.randomBytes(16).toString("hex");s.renameSync(te,m),s.unlinkSync(m)},z=(te,m,k)=>te===te>>>0?te:m===m>>>0?m:k,O=te=>_(F(E(te))).toLowerCase(),T=(te,m)=>{m=O(m);for(const k of te.keys()){const j=O(k);(j===m||j.indexOf(m+"/")===0)&&te.delete(k)}},K=te=>{for(const m of te.keys())te.delete(m)};class ue extends t{constructor(m){if(m||(m={}),m.ondone=k=>{this[q]=!0,this[Y]()},super(m),this[w]=!1,this.reservations=a(),this.transform=typeof m.transform=="function"?m.transform:null,this.writable=!0,this.readable=!1,this[M]=0,this[q]=!1,this.dirCache=m.dirCache||new Map,typeof m.uid=="number"||typeof m.gid=="number"){if(typeof m.uid!="number"||typeof m.gid!="number")throw new TypeError("cannot set owner without number uid and gid");if(m.preserveOwner)throw new TypeError("cannot preserve owner in archive and also set owner explicitly");this.uid=m.uid,this.gid=m.gid,this.setOwner=!0}else this.uid=null,this.gid=null,this.setOwner=!1;m.preserveOwner===void 0&&typeof m.uid!="number"?this.preserveOwner=process.getuid&&process.getuid()===0:this.preserveOwner=!!m.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 m.maxDepth=="number"?m.maxDepth:J,this.forceChown=m.forceChown===!0,this.win32=!!m.win32||H,this.newer=!!m.newer,this.keep=!!m.keep,this.noMtime=!!m.noMtime,this.preservePaths=!!m.preservePaths,this.unlink=!!m.unlink,this.cwd=F(i.resolve(m.cwd||process.cwd())),this.strip=+m.strip||0,this.processUmask=m.noChmod?0:process.umask(),this.umask=typeof m.umask=="number"?m.umask:this.processUmask,this.dmode=m.dmode||511&~this.umask,this.fmode=m.fmode||438&~this.umask,this.on("entry",k=>this[C](k))}warn(m,k,j={}){return(m==="TAR_BAD_ARCHIVE"||m==="TAR_ABORT")&&(j.recoverable=!1),super.warn(m,k,j)}[Y](){this[q]&&this[M]===0&&(this.emit("prefinish"),this.emit("finish"),this.emit("end"))}[R](m){const k=F(m.path),j=k.split("/");if(this.strip){if(j.length<this.strip)return!1;if(m.type==="Link"){const Z=F(m.linkpath).split("/");if(Z.length>=this.strip)m.linkpath=Z.slice(this.strip).join("/");else return!1}j.splice(0,this.strip),m.path=j.join("/")}if(isFinite(this.maxDepth)&&j.length>this.maxDepth)return this.warn("TAR_ENTRY_ERROR","path excessively deep",{entry:m,path:k,depth:j.length,maxDepth:this.maxDepth}),!1;if(!this.preservePaths){if(j.includes("..")||H&&/^[a-z]:\.\.$/i.test(j[0]))return this.warn("TAR_ENTRY_ERROR","path contains '..'",{entry:m,path:k}),!1;const[Z,X]=D(k);Z&&(m.path=X,this.warn("TAR_ENTRY_INFO",`stripping ${Z} from absolute path`,{entry:m,path:k}))}if(i.isAbsolute(m.path)?m.absolute=F(i.resolve(m.path)):m.absolute=F(i.resolve(this.cwd,m.path)),!this.preservePaths&&m.absolute.indexOf(this.cwd+"/")!==0&&m.absolute!==this.cwd)return this.warn("TAR_ENTRY_ERROR","path escaped extraction target",{entry:m,path:F(m.path),resolvedPath:m.absolute,cwd:this.cwd}),!1;if(m.absolute===this.cwd&&m.type!=="Directory"&&m.type!=="GNUDumpDir")return!1;if(this.win32){const{root:Z}=i.win32.parse(m.absolute);m.absolute=Z+e.encode(m.absolute.slice(Z.length));const{root:X}=i.win32.parse(m.path);m.path=X+e.encode(m.path.slice(X.length))}return!0}[C](m){if(!this[R](m))return m.resume();switch(u.equal(typeof m.absolute,"string"),m.type){case"Directory":case"GNUDumpDir":m.mode&&(m.mode=m.mode|448);case"File":case"OldFile":case"ContiguousFile":case"Link":case"SymbolicLink":return this[b](m);case"CharacterDevice":case"BlockDevice":case"FIFO":default:return this[g](m)}}[x](m,k){m.name==="CwdError"?this.emit("error",m):(this.warn("TAR_ENTRY_ERROR",m,{entry:k}),this[U](),k.resume())}[B](m,k,j){o(F(m),{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},j)}[V](m){return this.forceChown||this.preserveOwner&&(typeof m.uid=="number"&&m.uid!==this.processUid||typeof m.gid=="number"&&m.gid!==this.processGid)||typeof this.uid=="number"&&this.uid!==this.processUid||typeof this.gid=="number"&&this.gid!==this.processGid}[G](m){return z(this.uid,m.uid,this.processUid)}[ee](m){return z(this.gid,m.gid,this.processGid)}[n](m,k){const j=m.mode&4095||this.fmode,Z=new r.WriteStream(m.absolute,{flags:p(m.size),mode:j,autoClose:!1});Z.on("error",se=>{Z.fd&&s.close(Z.fd,()=>{}),Z.write=()=>!0,this[x](se,m),k()});let X=1;const ne=se=>{if(se){Z.fd&&s.close(Z.fd,()=>{}),this[x](se,m),k();return}--X===0&&s.close(Z.fd,he=>{he?this[x](he,m):this[U](),k()})};Z.on("finish",se=>{const he=m.absolute,Fe=Z.fd;if(m.mtime&&!this.noMtime){X++;const ye=m.atime||new Date,_e=m.mtime;s.futimes(Fe,ye,_e,Be=>Be?s.utimes(he,ye,_e,nt=>ne(nt&&Be)):ne())}if(this[V](m)){X++;const ye=this[G](m),_e=this[ee](m);s.fchown(Fe,ye,_e,Be=>Be?s.chown(he,ye,_e,nt=>ne(nt&&Be)):ne())}ne()});const ie=this.transform&&this.transform(m)||m;ie!==m&&(ie.on("error",se=>{this[x](se,m),k()}),m.pipe(ie)),ie.pipe(Z)}[h](m,k){const j=m.mode&4095||this.dmode;this[B](m.absolute,j,Z=>{if(Z){this[x](Z,m),k();return}let X=1;const ne=ie=>{--X===0&&(k(),this[U](),m.resume())};m.mtime&&!this.noMtime&&(X++,s.utimes(m.absolute,m.atime||new Date,m.mtime,ne)),this[V](m)&&(X++,s.chown(m.absolute,this[G](m),this[ee](m),ne)),ne()})}[g](m){m.unsupported=!0,this.warn("TAR_ENTRY_UNSUPPORTED",`unsupported entry type: ${m.type}`,{entry:m}),m.resume()}[d](m,k){this[f](m,m.linkpath,"symlink",k)}[c](m,k){const j=F(i.resolve(this.cwd,m.linkpath));this[f](m,j,"link",k)}[P](){this[M]++}[U](){this[M]--,this[Y]()}[N](m){this[U](),m.resume()}[S](m,k){return m.type==="File"&&!this.unlink&&k.isFile()&&k.nlink<=1&&!H}[b](m){this[P]();const k=[m.path];m.linkpath&&k.push(m.linkpath),this.reservations.reserve(k,j=>this[y](m,j))}[A](m){m.type==="SymbolicLink"?K(this.dirCache):m.type!=="Directory"&&T(this.dirCache,m.absolute)}[y](m,k){this[A](m);const j=ie=>{this[A](m),k(ie)},Z=()=>{this[B](this.cwd,this.dmode,ie=>{if(ie){this[x](ie,m),j();return}this[w]=!0,X()})},X=()=>{if(m.absolute!==this.cwd){const ie=F(i.dirname(m.absolute));if(ie!==this.cwd)return this[B](ie,this.dmode,se=>{if(se){this[x](se,m),j();return}ne()})}ne()},ne=()=>{s.lstat(m.absolute,(ie,se)=>{if(se&&(this.keep||this.newer&&se.mtime>m.mtime)){this[N](m),j();return}if(ie||this[S](m,se))return this[v](null,m,j);if(se.isDirectory()){if(m.type==="Directory"){const he=!this.noChmod&&m.mode&&(se.mode&4095)!==m.mode,Fe=ye=>this[v](ye,m,j);return he?s.chmod(m.absolute,m.mode,Fe):Fe()}if(m.absolute!==this.cwd)return s.rmdir(m.absolute,he=>this[v](he,m,j))}if(m.absolute===this.cwd)return this[v](null,m,j);$(m.absolute,he=>this[v](he,m,j))})};this[w]?X():Z()}[v](m,k,j){if(m){this[x](m,k),j();return}switch(k.type){case"File":case"OldFile":case"ContiguousFile":return this[n](k,j);case"Link":return this[c](k,j);case"SymbolicLink":return this[d](k,j);case"Directory":case"GNUDumpDir":return this[h](k,j)}}[f](m,k,j,Z){s[j](k,m.absolute,X=>{X?this[x](X,m):(this[U](),m.resume()),Z()})}}const ce=te=>{try{return[null,te()]}catch(m){return[m,null]}};class qe extends ue{[v](m,k){return super[v](m,k,()=>{})}[b](m){if(this[A](m),!this[w]){const X=this[B](this.cwd,this.dmode);if(X)return this[x](X,m);this[w]=!0}if(m.absolute!==this.cwd){const X=F(i.dirname(m.absolute));if(X!==this.cwd){const ne=this[B](X,this.dmode);if(ne)return this[x](ne,m)}}const[k,j]=ce(()=>s.lstatSync(m.absolute));if(j&&(this.keep||this.newer&&j.mtime>m.mtime))return this[N](m);if(k||this[S](m,j))return this[v](null,m);if(j.isDirectory()){if(m.type==="Directory"){const ne=!this.noChmod&&m.mode&&(j.mode&4095)!==m.mode,[ie]=ne?ce(()=>{s.chmodSync(m.absolute,m.mode)}):[];return this[v](ie,m)}const[X]=ce(()=>s.rmdirSync(m.absolute));this[v](X,m)}const[Z]=m.absolute===this.cwd?[]:ce(()=>W(m.absolute));this[v](Z,m)}[n](m,k){const j=m.mode&4095||this.fmode,Z=ie=>{let se;try{s.closeSync(X)}catch(he){se=he}(ie||se)&&this[x](ie||se,m),k()};let X;try{X=s.openSync(m.absolute,p(m.size),j)}catch(ie){return Z(ie)}const ne=this.transform&&this.transform(m)||m;ne!==m&&(ne.on("error",ie=>this[x](ie,m)),m.pipe(ne)),ne.on("data",ie=>{try{s.writeSync(X,ie,0,ie.length)}catch(se){Z(se)}}),ne.on("end",ie=>{let se=null;if(m.mtime&&!this.noMtime){const he=m.atime||new Date,Fe=m.mtime;try{s.futimesSync(X,he,Fe)}catch(ye){try{s.utimesSync(m.absolute,he,Fe)}catch{se=ye}}}if(this[V](m)){const he=this[G](m),Fe=this[ee](m);try{s.fchownSync(X,he,Fe)}catch(ye){try{s.chownSync(m.absolute,he,Fe)}catch{se=se||ye}}}Z(se)})}[h](m,k){const j=m.mode&4095||this.dmode,Z=this[B](m.absolute,j);if(Z){this[x](Z,m),k();return}if(m.mtime&&!this.noMtime)try{s.utimesSync(m.absolute,m.atime||new Date,m.mtime)}catch{}if(this[V](m))try{s.chownSync(m.absolute,this[G](m),this[ee](m))}catch{}k(),m.resume()}[B](m,k){try{return o.sync(F(m),{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(j){return j}}[f](m,k,j,Z){try{s[j+"Sync"](k,m.absolute),Z(),m.resume()}catch(X){return this[x](X,m)}}}return ue.Sync=qe,yi=ue,yi}var bi,cr;function Xn(){if(cr)return bi;cr=1;const u=Ie(),t=lr(),s=ge,r=ke(),i=De,o=Pe();bi=(E,C,b)=>{typeof E=="function"?(b=E,C=null,E={}):Array.isArray(E)&&(C=E,E={}),typeof C=="function"&&(b=C,C=null),C?C=Array.from(C):C=[];const y=u(E);if(y.sync&&typeof b=="function")throw new TypeError("callback not supported for sync tar functions");if(!y.file&&typeof b=="function")throw new TypeError("callback only supported with file option");return C.length&&e(y,C),y.file&&y.sync?a(y):y.file?D(y,b):y.sync?F(y):_(y)};const e=(E,C)=>{const b=new Map(C.map(S=>[o(S),!0])),y=E.filter,A=(S,v)=>{const n=v||i.parse(S).root||".",h=S===n?!1:b.has(S)?b.get(S):A(i.dirname(S),n);return b.set(S,h),h};E.filter=y?(S,v)=>y(S,v)&&A(o(S)):S=>A(o(S))},a=E=>{const C=new t.Sync(E),b=E.file,y=s.statSync(b),A=E.maxReadSize||16*1024*1024;new r.ReadStreamSync(b,{readSize:A,size:y.size}).pipe(C)},D=(E,C)=>{const b=new t(E),y=E.maxReadSize||16*1024*1024,A=E.file,S=new Promise((v,n)=>{b.on("error",n),b.on("close",v),s.stat(A,(h,f)=>{if(h)n(h);else{const d=new r.ReadStream(A,{readSize:y,size:f.size});d.on("error",n),d.pipe(b)}})});return C?S.then(C,C):S},F=E=>new t.Sync(E),_=E=>new t(E);return bi}var Dr;function Jn(){return Dr||(Dr=1,ae.c=ae.create=kn(),ae.r=ae.replace=Gs(),ae.t=ae.list=ui(),ae.u=ae.update=Hn(),ae.x=ae.extract=Xn(),ae.Pack=ii(),ae.Unpack=lr(),ae.Parse=ri(),ae.ReadEntry=Ht(),ae.WriteEntry=Ms(),ae.Header=Me(),ae.Pax=Wt(),ae.types=vs()),ae}var Qn=Jn();class eu extends Error{}class fr extends Error{}class tu extends Error{}class iu extends Error{}const dr=async(u,t)=>{const s=new URL(u),r=we.basename(s.pathname);return{name:r,version:void 0,subdir:void 0,url:s.href,tar:s.href,defaultDir:r,headers:t.auth?{Authorization:`Bearer ${t.auth}`}:void 0}},mr=async(u,t)=>{const s=st(u),r=await wi(s,t,async()=>(await(await He(`https://api.github.com/repos/${s.repo}`)).json())?.default_branch);return{name:s.repo.replace("/","-"),version:r,subdir:s.subdir,headers:{...t.auth?{Authorization:`Bearer ${t.auth}`}:{},Accept:"application/vnd.github+json","X-GitHub-Api-Version":"2022-11-28"},url:`https://github.com/${s.repo}/tree/${r}${s.subdir}`,tar:`https://api.github.com/repos/${s.repo}/tarball/${r}`}},su=async(u,t)=>{const s=st(u),r=await wi(s,t,async()=>(await(await He(`https://gitlab.com/api/v4/projects/${encodeURIComponent(s.repo)}`)).json())?.default_branch);return{name:s.repo.replace("/","-"),version:r,subdir:s.subdir,headers:{...t.auth?{Authorization:`Bearer ${t.auth}`}:{},"sec-fetch-mode":"same-origin"},url:`https://gitlab.com/${s.repo}/tree/${r}${s.subdir}`,tar:`https://gitlab.com/${s.repo}/-/archive/${r}.tar.gz`}},ru=async(u,t)=>{const s=st(u),r=await wi(s,t,async()=>(await(await He(`https://api.bitbucket.org/2.0/repositories/${s.repo}`)).json())?.mainbranch?.name);return{name:s.repo.replace("/","-"),version:r,subdir:s.subdir,headers:t.auth?{Authorization:`Bearer ${t.auth}`}:{},url:`https://bitbucket.com/${s.repo}/src/${r}${s.subdir}`,tar:`https://bitbucket.org/${s.repo}/get/${r}.tar.gz`}},nu=(u,t)=>{const s=st(u),r=s.ref||"main";return{name:s.repo.replace("/","-"),version:r,subdir:s.subdir,headers:t.auth?{Authorization:`Bearer ${t.auth}`}:{},url:`https://git.sr.ht/~${s.repo}/tree/${r}/item${s.subdir}`,tar:`https://git.sr.ht/~${s.repo}/archive/${r}.tar.gz`}},uu={http:dr,https:dr,github:mr,gh:mr,gitlab:su,bitbucket:ru,sourcehut:nu};async function wi(u,t,s){if(u.ref)return u.ref;if(t.offline!==!0)try{const r=await s();if(r)return r}catch(r){_i(`Failed to fetch ref for ${u.repo}`,r)}return"main"}const ou=/^([\w-.]+):/;function au(u,t,s){t||="github";let r=u;const i=u.match(ou);i&&(t=i[1],t!=="http"&&t!=="https"&&(r=u.slice(i[0].length)));const o=s?.[t]||uu[t];return{source:r,providerName:t,provider:o}}async function hu(u,t,s={}){const r=t+".json",i=JSON.parse(await Oe.readFile(r,"utf8").catch(()=>"{}")),e=(await He(u,{...s,method:"HEAD"}).catch(()=>{}))?.headers.get("etag");if(i.etag===e&&ve.existsSync(t))return;typeof e=="string"&&(i.etag=e);const a=await He(u,{headers:s.headers});if(a.status>=400)throw new fr(`Failed to download ${u}: ${a.status} ${a.statusText}`);if(a.body==null)throw new fr(`Failed to download ${u}: empty response body`);await Oe.mkdir(we.dirname(t),{recursive:!0});const D=ve.createWriteStream(t);await Ri(vr)(a.body,D),await Oe.writeFile(r,JSON.stringify(i),"utf8")}const lu=/^(?<repo>[\w\-.]+\/[\w\-.]+)(?<subdir>[^#]+)?(?<ref>#[\w\-./@]+)?/;function st(u){const t=u.match(lu)?.groups||{};return{repo:t.repo,subdir:t.subdir||"/",ref:t.ref?.slice(1)}}function _i(...u){process.env.DEBUG&&console.debug("[giget]",...u)}async function He(u,t={}){t.headers?.["sec-fetch-mode"]&&(t.mode=t.headers["sec-fetch-mode"]);const s=await fetch(u,t).catch(r=>{throw new Error(`Failed to fetch ${u}`,{cause:r})});if(t.validateStatus&&s.status>=400)throw new Error(`Failed to fetch ${u}: ${s.status} ${s.statusText}`);return s}function cu(){return process.env.XDG_CACHE_HOME?we.resolve(process.env.XDG_CACHE_HOME,"bluwy-giget"):we.resolve(_r.homedir(),".cache/bluwy-giget")}async function Du(u,t,s){s==="/"&&(s=void 0),s&&(s.startsWith("/")&&(s=s.slice(1)),s.endsWith("/")||(s+="/"));let r=!1;if(await Oe.mkdir(t,{recursive:!0}),await Qn.extract({file:u,cwd:t,onentry(i){i.path=i.path.split("/").splice(1).join("/"),s&&(i.path.startsWith(s)?(i.path=i.path.slice(s.length-1),r=!0):i.path="")}}),s&&!r)throw await Oe.rm(t,{recursive:!0,force:!0}),new tu(`Subdirectory not found in tar: ${s}`)}async function fu(u,t={}){const{source:s,providerName:r,provider:i}=au(u,t.provider,t.providers);if(!i)throw new eu(`Unsupported provider: ${r}`);const o={...t.providerOptions,offline:t.offline},e=await Promise.resolve().then(()=>i(s,o)).catch(E=>{throw new Error(`The ${r} provider failed with errors`,{cause:E})});e.name=(e.name||"template").replace(/[^\da-z-]/gi,"-"),e.defaultDir=(e.defaultDir||e.name).replace(/[^\da-z-]/gi,"-");const a=we.resolve(cu(),r,e.name),D=we.resolve(a,(e.version||e.name)+".tar.gz");if((t.offline==="prefer"?!ve.existsSync(D):!t.offline)&&(await hu(e.tar,D,{headers:e.headers}).catch(E=>{if(!ve.existsSync(D))throw E;_i("Download error. Using cached version:",E)}),_i(`Downloaded ${e.tar} to ${D}`)),!ve.existsSync(D))throw new Error(`Tarball not found: ${D} (offline: ${t.offline})`);const F=we.resolve(t.cwd||"."),_=we.resolve(F,t.dir||e.defaultDir);if(t.force==="clean")await Oe.rm(_,{recursive:!0,force:!0});else if(!t.force&&ve.existsSync(_)&&ve.readdirSync(_).length>0)throw new iu(`Destination ${_} already exists.`);return await Du(D,_,e.subdir),{info:e,source:s,dir:_}}async function je({template:u,project:t}){await fu(`wrtnlabs/agentica.template.${u}`,{provider:"github",dir:t}),await yr(be(t,".github"),{force:!0,recursive:!0})}async function Ue({projectPath:u,dotEnvfileName:t,apiKeys:s}){if(!ut(u))throw new Error(`${u} directory does not exist.`);const r=be(u,t??".env"),i=(ut(r)?`
|
|
87
|
-
`:"")+s.map(({key:
|
|
88
|
-
`);await
|
|
89
|
-
`)),e=Tt({content:
|
|
90
|
-
`)),e=Tt({content:
|
|
85
|
+
`)}function xt(u){return u.map(t=>`import { ${ms(t)}Service } from "${Rt}${t}";`).join(`
|
|
86
|
+
`)}function Tt({content:u,importCode:t,connectorCode:s}){return u.replace("/// INSERT IMPORT HERE",t).replace("/// INSERT CONTROLLER HERE",s)}var he={},$t,Es;function Ie(){if(Es)return $t;Es=1;const u=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 $t=t=>t?Object.keys(t).map(s=>[u.has(s)?u.get(s):s,t[s]]).reduce((s,r)=>(s[r[0]]=r[1],s),Object.create(null)):{},$t}var Nt={},gs;function It(){if(gs)return Nt;gs=1;const u=typeof process=="object"&&process?process:{stdout:null,stderr:null},t=xe,s=Ti,i=$i.StringDecoder,a=Symbol("EOF"),e=Symbol("maybeEmitEnd"),o=Symbol("emittedEnd"),h=Symbol("emittingEnd"),E=Symbol("emittedError"),y=Symbol("closed"),m=Symbol("read"),C=Symbol("flush"),_=Symbol("flushChunk"),b=Symbol("encoding"),A=Symbol("decoder"),S=Symbol("flowing"),v=Symbol("paused"),n=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"),M=Symbol("emitData"),P=Symbol("emitEnd"),U=Symbol("emitEnd2"),G=Symbol("async"),Y=Symbol("abort"),N=Symbol("aborted"),V=Symbol("signal"),W=z=>Promise.resolve().then(z),ee=ct._MP_NO_ITERATOR_SYMBOLS_!=="1",w=ee&&Symbol.asyncIterator||Symbol("asyncIterator not implemented"),c=ee&&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,H=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[n](),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=oe=>T.emit("error",oe),O.on("error",this.proxyErrors)}}class q extends s{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 i(this[b]):null,this[a]=!1,this[o]=!1,this[h]=!1,this[y]=!1,this[E]=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[V]=O&&O.signal,this[N]=!1,this[V]&&(this[V].addEventListener("abort",()=>this[Y]()),this[V].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 i(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[V].reason),this.destroy(this[V].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 oe=this[G]?W:ce=>ce();return!this[R]&&!Buffer.isBuffer(O)&&(H(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&&oe(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&&oe(K),this.flowing):(this[d]!==0&&this.emit("readable"),K&&oe(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[m](O||null,this[l][0]);return this[e](),T}[m](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}[n](){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[n]()}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[_](this[F]())&&this[l].length);!O&&!this[l].length&&!this[a]&&this.emit("drain")}[_](O){return this.emit("data",O),this.flowing}pipe(O,T){if(this[B])return;const K=this[o];return T=T||{},O===u.stdout||O===u.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]?W(()=>this[n]()):this[n]()),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[n]():O==="readable"&&this[d]!==0?super.emit("readable"):g(O)&&this[o]?(super.emit(O),this.removeAllListeners(O)):O==="error"&&this[E]&&(this[G]?W(()=>T.call(this,this[E])):T.call(this,this[E])),K}get emittedEnd(){return this[o]}[e](){!this[h]&&!this[o]&&!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]?W(()=>this[M](T)):this[M](T);if(O==="end")return this[P]();if(O==="close"){if(this[y]=!0,!this[o]&&!this[B])return;const ce=super.emit("close");return this.removeAllListeners("close"),ce}else if(O==="error"){this[E]=T,super.emit(x,T);const ce=!this[V]||this.listeners("error").length?super.emit("error",T):!1;return this[e](),ce}else if(O==="resume"){const ce=super.emit("resume");return this[e](),ce}else if(O==="finish"||O==="prefinish"){const ce=super.emit(O);return this.removeAllListeners(O),ce}const oe=super.emit(O,T,...K);return this[e](),oe}[M](O){for(const K of this[f])K.dest.write(O)===!1&&this.pause();const T=super.emit("data",O);return this[e](),T}[P](){this[o]||(this[o]=!0,this.readable=!1,this[G]?W(()=>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())})}[w](){let O=!1;const T=()=>(this.pause(),O=!0,Promise.resolve({done:!0}));return{next:()=>{if(O)return T();const oe=this.read();if(oe!==null)return Promise.resolve({done:!1,value:oe});if(this[a])return T();let ce=null,Ge=null;const te=Z=>{this.removeListener("data",p),this.removeListener("end",k),this.removeListener(B,j),T(),Ge(Z)},p=Z=>{this.removeListener("error",te),this.removeListener("end",k),this.removeListener(B,j),this.pause(),ce({value:Z,done:!!this[a]})},k=()=>{this.removeListener("error",te),this.removeListener("data",p),this.removeListener(B,j),T(),ce({done:!0})},j=()=>te(new Error("stream destroyed"));return new Promise((Z,X)=>{Ge=X,ce=Z,this.once(B,j),this.once("error",te),this.once("end",k),this.once("data",p)})},throw:T,return:T,[w](){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 oe=this.read();return oe===null?T():{value:oe}};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 s||O instanceof t&&(typeof O.pipe=="function"||typeof O.write=="function"&&typeof O.end=="function"))}}return Nt.Minipass=q,Nt}var Ee={},Lt,Cs;function Mn(){if(Cs)return Lt;Cs=1;const u=Ni.constants||{ZLIB_VERNUM:4736};return Lt=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},u)),Lt}var Mt,Fs;function ys(){if(Fs)return Mt;Fs=1;const u=typeof process=="object"&&process?process:{stdout:null,stderr:null},t=xe,s=Ti,r=$i.StringDecoder,i=Symbol("EOF"),a=Symbol("maybeEmitEnd"),e=Symbol("emittedEnd"),o=Symbol("emittingEnd"),h=Symbol("emittedError"),E=Symbol("closed"),y=Symbol("read"),m=Symbol("flush"),C=Symbol("flushChunk"),_=Symbol("encoding"),b=Symbol("decoder"),A=Symbol("flowing"),S=Symbol("paused"),v=Symbol("resume"),n=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"),M=w=>Promise.resolve().then(w),P=ct._MP_NO_ITERATOR_SYMBOLS_!=="1",U=P&&Symbol.asyncIterator||Symbol("asyncIterator not implemented"),G=P&&Symbol.iterator||Symbol("iterator not implemented"),Y=w=>w==="end"||w==="finish"||w==="prefinish",N=w=>w instanceof ArrayBuffer||typeof w=="object"&&w.constructor&&w.constructor.name==="ArrayBuffer"&&w.byteLength>=0,V=w=>!Buffer.isBuffer(w)&&ArrayBuffer.isView(w);class W{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 ee extends W{unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(c,g,L){super(c,g,L),this.proxyErrors=H=>g.emit("error",H),c.on("error",this.proxyErrors)}}return Mt=class Fr extends s{constructor(c){super(),this[A]=!1,this[S]=!1,this.pipes=[],this.buffer=[],this[d]=c&&c.objectMode||!1,this[d]?this[_]=null:this[_]=c&&c.encoding||null,this[_]==="buffer"&&(this[_]=null),this[x]=c&&!!c.async||!1,this[b]=this[_]?new r(this[_]):null,this[i]=!1,this[e]=!1,this[o]=!1,this[E]=!1,this[h]=null,this.writable=!0,this.readable=!0,this[n]=0,this[D]=!1}get bufferLength(){return this[n]}get encoding(){return this[_]}set encoding(c){if(this[d])throw new Error("cannot set encoding in objectMode");if(this[_]&&c!==this[_]&&(this[b]&&this[b].lastNeed||this[n]))throw new Error("cannot change encoding");this[_]!==c&&(this[b]=c?new r(c):null,this.buffer.length&&(this.buffer=this.buffer.map(g=>this[b].write(g)))),this[_]=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[i])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 H=this[x]?M: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[n]!==0&&this[m](!0),this.flowing?this.emit("data",c):this[l](c),this[n]!==0&&this.emit("readable"),L&&H(L),this.flowing):c.length?(typeof c=="string"&&!(g===this[_]&&!this[b].lastNeed)&&(c=Buffer.from(c,g)),Buffer.isBuffer(c)&&this[_]&&(c=this[b].write(c)),this.flowing&&this[n]!==0&&this[m](!0),this.flowing?this.emit("data",c):this[l](c),this[n]!==0&&this.emit("readable"),L&&H(L),this.flowing):(this[n]!==0&&this.emit("readable"),L&&H(L),this.flowing)}read(c){if(this[D])return null;if(this[n]===0||c===0||c>this[n])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[n])]);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[n]-=c),this.emit("data",g),!this.buffer.length&&!this[i]&&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[i]=!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[m]():this[i]?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[n]+=1:this[n]+=c.length,this.buffer.push(c)}[f](){return this.buffer.length&&(this[d]?this[n]-=1:this[n]-=this.buffer[0].length),this.buffer.shift()}[m](c){do;while(this[C](this[f]()));!c&&!this.buffer.length&&!this[i]&&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===u.stdout||c===u.stderr?g.end=!1:g.end=g.end!==!1,g.proxyErrors=!!g.proxyErrors,L?g.end&&c.end():(this.pipes.push(g.proxyErrors?new ee(this,c,g):new W(this,c,g)),this[x]?M(()=>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[n]!==0?super.emit("readable"):Y(c)&&this[e]?(super.emit(c),this.removeAllListeners(c)):c==="error"&&this[h]&&(this[x]?M(()=>g.call(this,this[h])):g.call(this,this[h])),L}get emittedEnd(){return this[e]}[a](){!this[o]&&!this[e]&&!this[D]&&this.buffer.length===0&&this[i]&&(this[o]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[E]&&this.emit("close"),this[o]=!1)}emit(c,g,...L){if(c!=="error"&&c!=="close"&&c!==D&&this[D])return;if(c==="data")return g?this[x]?M(()=>this[F](g)):this[F](g):!1;if(c==="end")return this[R]();if(c==="close"){if(this[E]=!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 H=super.emit(c,g,...L);return this[a](),H}[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]?M(()=>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[_]?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[i])return Promise.resolve({done:!0});let L=null,H=null;const J=O=>{this.removeListener("data",$),this.removeListener("end",q),H(O)},$=O=>{this.removeListener("error",J),this.removeListener("end",q),this.pause(),L({value:O,done:!!this[i]})},q=()=>{this.removeListener("error",J),this.removeListener("data",$),L({done:!0})},z=()=>J(new Error("stream destroyed"));return new Promise((O,T)=>{H=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[n]=0,typeof this.close=="function"&&!this[E]&&this.close(),c?this.emit("error",c):this.emit(D),this)}static isStream(c){return!!c&&(c instanceof Fr||c instanceof s||c instanceof t&&(typeof c.pipe=="function"||typeof c.write=="function"&&typeof c.end=="function"))}},Mt}var bs;function _s(){if(bs)return Ee;bs=1;const u=lt,t=Or.Buffer,s=Ni,r=Ee.constants=Mn(),i=ys(),a=t.concat,e=Symbol("_superWrite");class o 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"),E=Symbol("flushFlag"),y=Symbol("finishFlushFlag"),m=Symbol("fullFlushFlag"),C=Symbol("handle"),_=Symbol("onError"),b=Symbol("sawError"),A=Symbol("level"),S=Symbol("strategy"),v=Symbol("ended");class n extends i{constructor(N,V){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[E]=N.flush,this[y]=N.finishFlush;try{this[C]=new s[V](N)}catch(W){throw new o(W)}this[_]=W=>{this[b]||(this[b]=!0,this.close(),this.emit("error",W))},this[C].on("error",W=>this[_](new o(W))),this.once("end",()=>this.close)}close(){this[C]&&(this[C].close(),this[C]=null,this.emit("close"))}reset(){if(!this[b])return u(this[C],"zlib binding closed"),this[C].reset()}flush(N){this.ended||(typeof N!="number"&&(N=this[m]),this.write(Object.assign(t.alloc(0),{[E]:N})))}end(N,V,W){return N&&this.write(N,V),this.flush(this[y]),this[v]=!0,super.end(null,null,W)}get ended(){return this[v]}write(N,V,W){if(typeof V=="function"&&(W=V,V="utf8"),typeof N=="string"&&(N=t.from(N,V)),this[b])return;u(this[C],"zlib binding closed");const ee=this[C]._handle,w=ee.close;ee.close=()=>{};const c=this[C].close;this[C].close=()=>{},t.concat=H=>H;let g;try{const H=typeof N[E]=="number"?N[E]:this[E];g=this[C]._processChunk(N,H),t.concat=a}catch(H){t.concat=a,this[_](new o(H))}finally{this[C]&&(this[C]._handle=ee,ee.close=w,this[C].close=c,this[C].removeAllListeners("error"))}this[C]&&this[C].on("error",H=>this[_](new o(H)));let L;if(g)if(Array.isArray(g)&&g.length>0){L=this[e](t.from(g[0]));for(let H=1;H<g.length;H++)L=this[e](g[H])}else L=this[e](t.from(g));return W&&W(),L}[e](N){return super.write(N)}}class l extends n{constructor(N,V){N=N||{},N.flush=N.flush||r.Z_NO_FLUSH,N.finishFlush=N.finishFlush||r.Z_FINISH,super(N,V),this[m]=r.Z_FULL_FLUSH,this[A]=N.level,this[S]=N.strategy}params(N,V){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]!==V){this.flush(r.Z_SYNC_FLUSH),u(this[C],"zlib binding closed");const W=this[C].flush;this[C].flush=(ee,w)=>{this.flush(ee),w()};try{this[C].params(N,V)}finally{this[C].flush=W}this[C]&&(this[A]=N,this[S]=V)}}}}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 M extends l{constructor(N){super(N,"Unzip")}}class P extends n{constructor(N,V){N=N||{},N.flush=N.flush||r.BROTLI_OPERATION_PROCESS,N.finishFlush=N.finishFlush||r.BROTLI_OPERATION_FINISH,super(N,V),this[m]=r.BROTLI_OPERATION_FLUSH}}class U extends P{constructor(N){super(N,"BrotliCompress")}}class G extends P{constructor(N){super(N,"BrotliDecompress")}}return Ee.Deflate=f,Ee.Inflate=d,Ee.Gzip=F,Ee.Gunzip=R,Ee.DeflateRaw=B,Ee.InflateRaw=x,Ee.Unzip=M,typeof s.BrotliCompress=="function"?(Ee.BrotliCompress=U,Ee.BrotliDecompress=G):Ee.BrotliCompress=Ee.BrotliDecompress=class{constructor(){throw new Error("Brotli is not supported in this version of Node.js")}},Ee}var Pt,ws;function Le(){return ws||(ws=1,Pt=(process.env.TESTING_TAR_FAKE_PLATFORM||process.platform)!=="win32"?t=>t:t=>t&&t.replace(/\\/g,"/")),Pt}var kt,vs;function Ht(){if(vs)return kt;vs=1;const{Minipass:u}=It(),t=Le(),s=Symbol("slurp");return kt=class extends u{constructor(i,a,e){switch(super(),this.pause(),this.extended=a,this.globalExtended=e,this.header=i,this.startBlockSize=512*Math.ceil(i.size/512),this.blockRemain=this.startBlockSize,this.remain=i.size,this.type=i.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(i.path),this.mode=i.mode,this.mode&&(this.mode=this.mode&4095),this.uid=i.uid,this.gid=i.gid,this.uname=i.uname,this.gname=i.gname,this.size=i.size,this.mtime=i.mtime,this.atime=i.atime,this.ctime=i.ctime,this.linkpath=t(i.linkpath),this.uname=i.uname,this.gname=i.gname,a&&this[s](a),e&&this[s](e,!0)}write(i){const a=i.length;if(a>this.blockRemain)throw new Error("writing more to entry than is appropriate");const e=this.remain,o=this.blockRemain;return this.remain=Math.max(0,e-a),this.blockRemain=Math.max(0,o-a),this.ignore?!0:e>=a?super.write(i):super.write(i.slice(0,e))}[s](i,a){for(const e in i)i[e]!==null&&i[e]!==void 0&&!(a&&e==="path")&&(this[e]=e==="path"||e==="linkpath"?t(i[e]):i[e])}},kt}var jt={},As;function Ss(){return As||(As=1,function(u){u.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"]]),u.code=new Map(Array.from(u.name).map(t=>[t[1],t[0]]))}(jt)),jt}var Ut,Os;function Pn(){if(Os)return Ut;Os=1;const u=(h,E)=>{if(Number.isSafeInteger(h))h<0?s(h,E):t(h,E);else throw Error("cannot encode number outside of javascript safe integer range");return E},t=(h,E)=>{E[0]=128;for(var y=E.length;y>1;y--)E[y-1]=h&255,h=Math.floor(h/256)},s=(h,E)=>{E[0]=255;var y=!1;h=h*-1;for(var m=E.length;m>1;m--){var C=h&255;h=Math.floor(h/256),y?E[m-1]=e(C):C===0?E[m-1]=0:(y=!0,E[m-1]=o(C))}},r=h=>{const E=h[0],y=E===128?a(h.slice(1,h.length)):E===255?i(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},i=h=>{for(var E=h.length,y=0,m=!1,C=E-1;C>-1;C--){var _=h[C],b;m?b=e(_):_===0?b=_:(m=!0,b=o(_)),b!==0&&(y-=b*Math.pow(256,E-C-1))}return y},a=h=>{for(var E=h.length,y=0,m=E-1;m>-1;m--){var C=h[m];C!==0&&(y+=C*Math.pow(256,E-m-1))}return y},e=h=>(255^h)&255,o=h=>(255^h)+1&255;return Ut={encode:u,parse:r},Ut}var zt,Rs;function Me(){if(Rs)return zt;Rs=1;const u=Ss(),t=De.posix,s=Pn(),r=Symbol("slurp"),i=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[i]="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=o(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[r](R),this[r](B,!0),this[i]=o(D,F+156,1),this[i]===""&&(this[i]="0"),this[i]==="0"&&this.path.slice(-1)==="/"&&(this[i]="5"),this[i]==="5"&&(this.size=0),this.linkpath=o(D,F+157,100),D.slice(F+257,F+265).toString()==="ustar\x0000")if(this.uname=o(D,F+265,32),this.gname=o(D,F+297,32),this.devmaj=y(D,F+329,8),this.devmin=y(D,F+337,8),D[F+475]!==0){const M=o(D,F+345,155);this.path=M+"/"+this.path}else{const M=o(D,F+345,130);M&&(this.path=M+"/"+this.path),this.atime=h(D,F+476,12),this.ctime=h(D,F+488,12)}let x=8*32;for(let M=F;M<F+148;M++)x+=D[M];for(let M=F+156;M<F+512;M++)x+=D[M];this.cksumValid=x===this.cksum,this.cksum===null&&x===8*32&&(this.nullBlock=!0)}[r](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],M=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=n(D,F+136,12,this.mtime)||this.needPax,D[F+156]=this[i].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,M)||this.needPax,D[F+475]!==0?this.needPax=f(D,F+345,155,M)||this.needPax:(this.needPax=f(D,F+345,130,M)||this.needPax,this.needPax=n(D,F+476,12,this.atime)||this.needPax,this.needPax=n(D,F+488,12,this.ctime)||this.needPax);let P=8*32;for(let U=F;U<F+148;U++)P+=D[U];for(let U=F+156;U<F+512;U++)P+=D[U];return this.cksum=P,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 u.name.get(this[i])||this[i]}get typeKey(){return this[i]}set type(D){u.code.has(D)?this[i]=u.code.get(D):this[i]=D}}const e=(d,D)=>{let R=d,B="",x;const M=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!==M&&!x);x||(x=[d.slice(0,99),"",!0])}return x},o=(d,D,F)=>d.slice(D,D+F).toString("utf8").replace(/\0.*/,""),h=(d,D,F)=>E(y(d,D,F)),E=d=>d===null?null:new Date(d*1e3),y=(d,D,F)=>d[D]&128?s.parse(d.slice(D,D+F)):C(d,D,F),m=d=>isNaN(d)?null:d,C=(d,D,F)=>m(parseInt(d.slice(D,D+F).toString("utf8").replace(/\0.*$/,"").trim(),8)),_={12:8589934591,8:2097151},b=(d,D,F,R)=>R===null?!1:R>_[F]||R<0?(s.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",n=(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 zt=a,zt}var Gt,Bs;function qt(){if(Bs)return Gt;Bs=1;const u=Me(),t=De;class s{constructor(o,h){this.atime=o.atime||null,this.charset=o.charset||null,this.comment=o.comment||null,this.ctime=o.ctime||null,this.gid=o.gid||null,this.gname=o.gname||null,this.linkpath=o.linkpath||null,this.mtime=o.mtime||null,this.path=o.path||null,this.size=o.size||null,this.uid=o.uid||null,this.uname=o.uname||null,this.dev=o.dev||null,this.ino=o.ino||null,this.nlink=o.nlink||null,this.global=h||!1}encode(){const o=this.encodeBody();if(o==="")return null;const h=Buffer.byteLength(o),E=512*Math.ceil(1+h/512),y=Buffer.allocUnsafe(E);for(let m=0;m<512;m++)y[m]=0;new u({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(o,512,h,"utf8");for(let m=h+512;m<y.length;m++)y[m]=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(o){if(this[o]===null||this[o]===void 0)return"";const h=this[o]instanceof Date?this[o].getTime()/1e3:this[o],E=" "+(o==="dev"||o==="ino"||o==="nlink"?"SCHILY.":"")+o+"="+h+`
|
|
87
|
+
`,y=Buffer.byteLength(E);let m=Math.floor(Math.log(y)/Math.log(10))+1;return y+m>=Math.pow(10,m)&&(m+=1),m+y+E}}s.parse=(e,o,h)=>new s(r(i(e),o),h);const r=(e,o)=>o?Object.keys(e).reduce((h,E)=>(h[E]=e[E],h),o):e,i=e=>e.replace(/\n$/,"").split(`
|
|
88
|
+
`).reduce(a,Object.create(null)),a=(e,o)=>{const h=parseInt(o,10);if(h!==Buffer.byteLength(o)+1)return e;o=o.slice((h+" ").length);const E=o.split("="),y=E.shift().replace(/^SCHILY\.(dev|ino|nlink)/,"$1");if(!y)return e;const m=E.join("=");return e[y]=/^([A-Z]+\.)?([mac]|birth|creation)time$/.test(y)?new Date(m*1e3):/^[0-9]+$/.test(m)?+m:m,e};return Gt=s,Gt}var Vt,xs;function Pe(){return xs||(xs=1,Vt=u=>{let t=u.length-1,s=-1;for(;t>-1&&u.charAt(t)==="/";)s=t,t--;return s===-1?u:u.slice(0,s)}),Vt}var Wt,Ts;function Kt(){return Ts||(Ts=1,Wt=u=>class extends u{warn(t,s,r={}){this.file&&(r.file=this.file),this.cwd&&(r.cwd=this.cwd),r.code=s instanceof Error&&s.code||t,r.tarCode=t,!this.strict&&r.recoverable!==!1?(s instanceof Error&&(r=Object.assign(s,r),s=s.message),this.emit("warn",r.tarCode,s,r)):s instanceof Error?this.emit("error",Object.assign(s,r)):this.emit("error",Object.assign(new Error(`${t}: ${s}`),r))}}),Wt}var Yt,$s;function Ns(){if($s)return Yt;$s=1;const u=["|","<",">","?",":"],t=u.map(i=>String.fromCharCode(61440+i.charCodeAt(0))),s=new Map(u.map((i,a)=>[i,t[a]])),r=new Map(t.map((i,a)=>[i,u[a]]));return Yt={encode:i=>u.reduce((a,e)=>a.split(e).join(s.get(e)),i),decode:i=>t.reduce((a,e)=>a.split(e).join(r.get(e)),i)},Yt}var Zt,Is;function Ls(){if(Is)return Zt;Is=1;const{isAbsolute:u,parse:t}=De.win32;return Zt=s=>{let r="",i=t(s);for(;u(s)||i.root;){const a=s.charAt(0)==="/"&&s.slice(0,4)!=="//?/"?"/":i.root;s=s.slice(a.length),r+=a,i=t(s)}return[r,s]},Zt}var Xt,Ms;function kn(){return Ms||(Ms=1,Xt=(u,t,s)=>(u&=4095,s&&(u=(u|384)&-19),t&&(u&256&&(u|=64),u&32&&(u|=8),u&4&&(u|=1)),u)),Xt}var Jt,Ps;function ks(){if(Ps)return Jt;Ps=1;const{Minipass:u}=It(),t=qt(),s=Me(),r=ge,i=De,a=Le(),e=Pe(),o=(w,c)=>c?(w=a(w).replace(/^\.(\/|$)/,""),e(c)+"/"+w):a(w),h=16*1024*1024,E=Symbol("process"),y=Symbol("file"),m=Symbol("directory"),C=Symbol("symlink"),_=Symbol("hardlink"),b=Symbol("header"),A=Symbol("read"),S=Symbol("lstat"),v=Symbol("onlstat"),n=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"),M=Symbol("hadError"),P=Kt(),U=Ns(),G=Ls(),Y=kn(),N=P(class extends u{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[H,J]=G(this.path);H&&(this.path=J,L=H)}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||i.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[M]=!0),super.emit(c,...g)}[S](){r.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=ee(c),this.emit("stat",c),this[E]()}[E](){switch(this.type){case"File":return this[y]();case"Directory":return this[m]();case"SymbolicLink":return this[C]();default:return this.end()}}[F](c){return Y(c,this.type==="Directory",this.portable)}[x](c){return o(c,this.prefix)}[b](){this.type==="Directory"&&this.portable&&(this.noMtime=!0),this.header=new s({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)}[m](){this.path.slice(-1)!=="/"&&(this.path+="/"),this.stat.size=0,this[b](),this.end()}[C](){r.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()}[_](c){this.type="Link",this.linkpath=a(i.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[_](g)}this.linkCache.set(c,this.absolute)}if(this[b](),this.stat.size===0)return this.end();this[f]()}[f](){r.open(this.absolute,"r",(c,g)=>{if(c)return this.emit("error",c);this[d](g)})}[d](c){if(this.fd=c,this[M])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:H,pos:J}=this;r.read(c,g,L,H,J,($,q)=>{if($)return this[D](()=>this.emit("error",$));this[n](q)})}[D](c){r.close(this.fd,c)}[n](c){if(c<=0&&this.remain>0){const H=new Error("encountered unexpected EOF");return H.path=this.absolute,H.syscall="read",H.code="EOF",this[D](()=>this.emit("error",H))}if(c>this.remain){const H=new Error("did not encounter expected EOF");return H.path=this.absolute,H.syscall="read",H.code="EOF",this[D](()=>this.emit("error",H))}if(c===this.remain)for(let H=c;H<this.length&&c<this.blockRemain;H++)this.buf[H+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 V extends N{[S](){this[v](r.lstatSync(this.absolute))}[C](){this[l](r.readlinkSync(this.absolute))}[f](){this[d](r.openSync(this.absolute,"r"))}[A](){let c=!0;try{const{fd:g,buf:L,offset:H,length:J,pos:$}=this,q=r.readSync(g,L,H,J,$);this[n](q),c=!1}finally{if(c)try{this[D](()=>{})}catch{}}}[R](c){c()}[D](c){r.closeSync(this.fd),c()}}const W=P(class extends u{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[H,J]=G(this.path);H&&(this.path=J,L=H)}this.remain=c.size,this.blockRemain=c.startBlockSize,this.header=new s({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 o(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=V,N.Tar=W;const ee=w=>w.isFile()?"File":w.isDirectory()?"Directory":w.isSymbolicLink()?"SymbolicLink":"Unsupported";return Jt=N,Jt}var Qt,Hs;function Hn(){return Hs||(Hs=1,Qt=function(u){u.prototype[Symbol.iterator]=function*(){for(let t=this.head;t;t=t.next)yield t.value}}),Qt}var ei,js;function Us(){if(js)return ei;js=1,ei=u,u.Node=i,u.create=u;function u(a){var e=this;if(e instanceof u||(e=new u),e.tail=null,e.head=null,e.length=0,a&&typeof a.forEach=="function")a.forEach(function(E){e.push(E)});else if(arguments.length>0)for(var o=0,h=arguments.length;o<h;o++)e.push(arguments[o]);return e}u.prototype.removeNode=function(a){if(a.list!==this)throw new Error("removing node which does not belong to this list");var e=a.next,o=a.prev;return e&&(e.prev=o),o&&(o.next=e),a===this.head&&(this.head=e),a===this.tail&&(this.tail=o),a.list.length--,a.next=null,a.prev=null,a.list=null,e},u.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++}},u.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++}},u.prototype.push=function(){for(var a=0,e=arguments.length;a<e;a++)s(this,arguments[a]);return this.length},u.prototype.unshift=function(){for(var a=0,e=arguments.length;a<e;a++)r(this,arguments[a]);return this.length},u.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}},u.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}},u.prototype.forEach=function(a,e){e=e||this;for(var o=this.head,h=0;o!==null;h++)a.call(e,o.value,h,this),o=o.next},u.prototype.forEachReverse=function(a,e){e=e||this;for(var o=this.tail,h=this.length-1;o!==null;h--)a.call(e,o.value,h,this),o=o.prev},u.prototype.get=function(a){for(var e=0,o=this.head;o!==null&&e<a;e++)o=o.next;if(e===a&&o!==null)return o.value},u.prototype.getReverse=function(a){for(var e=0,o=this.tail;o!==null&&e<a;e++)o=o.prev;if(e===a&&o!==null)return o.value},u.prototype.map=function(a,e){e=e||this;for(var o=new u,h=this.head;h!==null;)o.push(a.call(e,h.value,this)),h=h.next;return o},u.prototype.mapReverse=function(a,e){e=e||this;for(var o=new u,h=this.tail;h!==null;)o.push(a.call(e,h.value,this)),h=h.prev;return o},u.prototype.reduce=function(a,e){var o,h=this.head;if(arguments.length>1)o=e;else if(this.head)h=this.head.next,o=this.head.value;else throw new TypeError("Reduce of empty list with no initial value");for(var E=0;h!==null;E++)o=a(o,h.value,E),h=h.next;return o},u.prototype.reduceReverse=function(a,e){var o,h=this.tail;if(arguments.length>1)o=e;else if(this.tail)h=this.tail.prev,o=this.tail.value;else throw new TypeError("Reduce of empty list with no initial value");for(var E=this.length-1;h!==null;E--)o=a(o,h.value,E),h=h.prev;return o},u.prototype.toArray=function(){for(var a=new Array(this.length),e=0,o=this.head;o!==null;e++)a[e]=o.value,o=o.next;return a},u.prototype.toArrayReverse=function(){for(var a=new Array(this.length),e=0,o=this.tail;o!==null;e++)a[e]=o.value,o=o.prev;return a},u.prototype.slice=function(a,e){e=e||this.length,e<0&&(e+=this.length),a=a||0,a<0&&(a+=this.length);var o=new u;if(e<a||e<0)return o;a<0&&(a=0),e>this.length&&(e=this.length);for(var h=0,E=this.head;E!==null&&h<a;h++)E=E.next;for(;E!==null&&h<e;h++,E=E.next)o.push(E.value);return o},u.prototype.sliceReverse=function(a,e){e=e||this.length,e<0&&(e+=this.length),a=a||0,a<0&&(a+=this.length);var o=new u;if(e<a||e<0)return o;a<0&&(a=0),e>this.length&&(e=this.length);for(var h=this.length,E=this.tail;E!==null&&h>e;h--)E=E.prev;for(;E!==null&&h>a;h--,E=E.prev)o.push(E.value);return o},u.prototype.splice=function(a,e,...o){a>this.length&&(a=this.length-1),a<0&&(a=this.length+a);for(var h=0,E=this.head;E!==null&&h<a;h++)E=E.next;for(var y=[],h=0;E&&h<e;h++)y.push(E.value),E=this.removeNode(E);E===null&&(E=this.tail),E!==this.head&&E!==this.tail&&(E=E.prev);for(var h=0;h<o.length;h++)E=t(this,E,o[h]);return y},u.prototype.reverse=function(){for(var a=this.head,e=this.tail,o=a;o!==null;o=o.prev){var h=o.prev;o.prev=o.next,o.next=h}return this.head=e,this.tail=a,this};function t(a,e,o){var h=e===a.head?new i(o,null,e,a):new i(o,e,e.next,a);return h.next===null&&(a.tail=h),h.prev===null&&(a.head=h),a.length++,h}function s(a,e){a.tail=new i(e,a.tail,null,a),a.head||(a.head=a.tail),a.length++}function r(a,e){a.head=new i(e,null,a.head,a),a.tail||(a.tail=a.head),a.length++}function i(a,e,o,h){if(!(this instanceof i))return new i(a,e,o,h);this.list=h,this.value=a,e?(e.next=this,this.prev=e):this.prev=null,o?(o.prev=this,this.next=o):this.next=null}try{Hn()(u)}catch{}return ei}var ti,zs;function ii(){if(zs)return ti;zs=1;class u{constructor(w,c){this.path=w||"./",this.absolute=c,this.entry=null,this.stat=null,this.readdir=null,this.pending=!1,this.ignore=!1,this.piped=!1}}const{Minipass:t}=It(),s=_s(),r=Ht(),i=ks(),a=i.Sync,e=i.Tar,o=Us(),h=Buffer.alloc(1024),E=Symbol("onStat"),y=Symbol("ended"),m=Symbol("queue"),C=Symbol("current"),_=Symbol("process"),b=Symbol("processing"),A=Symbol("processJob"),S=Symbol("jobs"),v=Symbol("jobDone"),n=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"),M=Symbol("write"),P=Symbol("ondrain"),U=ge,G=De,Y=Kt(),N=Le(),V=Y(class extends t{constructor(w){if(super(w),w=w||Object.create(null),this.opt=w,this.file=w.file||"",this.cwd=w.cwd||process.cwd(),this.maxReadSize=w.maxReadSize,this.preservePaths=!!w.preservePaths,this.strict=!!w.strict,this.noPax=!!w.noPax,this.prefix=N(w.prefix||""),this.linkCache=w.linkCache||new Map,this.statCache=w.statCache||new Map,this.readdirCache=w.readdirCache||new Map,this[x]=i,typeof w.onwarn=="function"&&this.on("warn",w.onwarn),this.portable=!!w.portable,this.zip=null,w.gzip||w.brotli){if(w.gzip&&w.brotli)throw new TypeError("gzip and brotli are mutually exclusive");w.gzip&&(typeof w.gzip!="object"&&(w.gzip={}),this.portable&&(w.gzip.portable=!0),this.zip=new s.Gzip(w.gzip)),w.brotli&&(typeof w.brotli!="object"&&(w.brotli={}),this.zip=new s.BrotliCompress(w.brotli)),this.zip.on("data",c=>super.write(c)),this.zip.on("end",c=>super.end()),this.zip.on("drain",c=>this[P]()),this.on("resume",c=>this.zip.resume())}else this.on("drain",this[P]);this.noDirRecurse=!!w.noDirRecurse,this.follow=!!w.follow,this.noMtime=!!w.noMtime,this.mtime=w.mtime||null,this.filter=typeof w.filter=="function"?w.filter:c=>!0,this[m]=new o,this[S]=0,this.jobs=+w.jobs||4,this[b]=!1,this[y]=!1}[M](w){return super.write(w)}add(w){return this.write(w),this}end(w){return w&&this.write(w),this[y]=!0,this[_](),this}write(w){if(this[y])throw new Error("write after end");return w instanceof r?this[l](w):this[n](w),this.flowing}[l](w){const c=N(G.resolve(this.cwd,w.path));if(!this.filter(w.path,w))w.resume();else{const g=new u(w.path,c,!1);g.entry=new e(w,this[B](g)),g.entry.on("end",L=>this[v](g)),this[S]+=1,this[m].push(g)}this[_]()}[n](w){const c=N(G.resolve(this.cwd,w));this[m].push(new u(w,c)),this[_]()}[f](w){w.pending=!0,this[S]+=1;const c=this.follow?"stat":"lstat";U[c](w.absolute,(g,L)=>{w.pending=!1,this[S]-=1,g?this.emit("error",g):this[E](w,L)})}[E](w,c){this.statCache.set(w.absolute,c),w.stat=c,this.filter(w.path,c)||(w.ignore=!0),this[_]()}[d](w){w.pending=!0,this[S]+=1,U.readdir(w.absolute,(c,g)=>{if(w.pending=!1,this[S]-=1,c)return this.emit("error",c);this[D](w,g)})}[D](w,c){this.readdirCache.set(w.absolute,c),w.readdir=c,this[_]()}[_](){if(!this[b]){this[b]=!0;for(let w=this[m].head;w!==null&&this[S]<this.jobs;w=w.next)if(this[A](w.value),w.value.ignore){const c=w.next;this[m].removeNode(w),w.next=c}this[b]=!1,this[y]&&!this[m].length&&this[S]===0&&(this.zip?this.zip.end(h):(super.write(h),super.end()))}}get[C](){return this[m]&&this[m].head&&this[m].head.value}[v](w){this[m].shift(),this[S]-=1,this[_]()}[A](w){if(!w.pending){if(w.entry){w===this[C]&&!w.piped&&this[F](w);return}if(w.stat||(this.statCache.has(w.absolute)?this[E](w,this.statCache.get(w.absolute)):this[f](w)),!!w.stat&&!w.ignore&&!(!this.noDirRecurse&&w.stat.isDirectory()&&!w.readdir&&(this.readdirCache.has(w.absolute)?this[D](w,this.readdirCache.get(w.absolute)):this[d](w),!w.readdir))){if(w.entry=this[R](w),!w.entry){w.ignore=!0;return}w===this[C]&&!w.piped&&this[F](w)}}}[B](w){return{onwarn:(c,g,L)=>this.warn(c,g,L),noPax:this.noPax,cwd:this.cwd,absolute:w.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](w){this[S]+=1;try{return new this[x](w.path,this[B](w)).on("end",()=>this[v](w)).on("error",c=>this.emit("error",c))}catch(c){this.emit("error",c)}}[P](){this[C]&&this[C].entry&&this[C].entry.resume()}[F](w){w.piped=!0,w.readdir&&w.readdir.forEach(L=>{const H=w.path,J=H==="./"?"":H.replace(/\/*$/,"/");this[n](J+L)});const c=w.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 W extends V{constructor(w){super(w),this[x]=a}pause(){}resume(){}[f](w){const c=this.follow?"statSync":"lstatSync";this[E](w,U[c](w.absolute))}[d](w,c){this[D](w,U.readdirSync(w.absolute))}[F](w){const c=w.entry,g=this.zip;w.readdir&&w.readdir.forEach(L=>{const H=w.path,J=H==="./"?"":H.replace(/\/*$/,"/");this[n](J+L)}),g?c.on("data",L=>{g.write(L)}):c.on("data",L=>{super[M](L)})}}return V.Sync=W,ti=V,ti}var Re={},Gs;function ke(){if(Gs)return Re;Gs=1;const u=ys(),t=xe.EventEmitter,s=ge;let r=s.writev;if(!r){const w=process.binding("fs"),c=w.FSReqWrap||w.FSReqCallback;r=(g,L,H,J)=>{const $=(z,O)=>J(z,O,L),q=new c;q.oncomplete=$,w.writeBuffers(g,L,H,q)}}const i=Symbol("_autoClose"),a=Symbol("_close"),e=Symbol("_ended"),o=Symbol("_fd"),h=Symbol("_finished"),E=Symbol("_flags"),y=Symbol("_flush"),m=Symbol("_handleChunk"),C=Symbol("_makeBuf"),_=Symbol("_mode"),b=Symbol("_needDrain"),A=Symbol("_onerror"),S=Symbol("_onopen"),v=Symbol("_onread"),n=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"),M=Symbol("_size"),P=Symbol("_write"),U=Symbol("_writing"),G=Symbol("_defaultFlag"),Y=Symbol("_errored");class N extends u{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[o]=typeof g.fd=="number"?g.fd:null,this[f]=c,this[R]=g.readSize||16*1024*1024,this[B]=!1,this[M]=typeof g.size=="number"?g.size:1/0,this[x]=this[M],this[i]=typeof g.autoClose=="boolean"?g.autoClose:!0,typeof this[o]=="number"?this[F]():this[l]()}get fd(){return this[o]}get path(){return this[f]}write(){throw new TypeError("this is a readable stream")}end(){throw new TypeError("this is a readable stream")}[l](){s.open(this[f],"r",(c,g)=>this[S](c,g))}[S](c,g){c?this[A](c):(this[o]=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));s.read(this[o],c,0,c.length,null,(g,L,H)=>this[v](g,L,H))}}[v](c,g,L){this[B]=!1,c?this[A](c):this[m](g,L)&&this[F]()}[a](){if(this[i]&&typeof this[o]=="number"){const c=this[o];this[o]=null,s.close(c,g=>g?this.emit("error",g):this.emit("close"))}}[A](c){this[B]=!0,this[a](),this.emit("error",c)}[m](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[o]=="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 V extends N{[l](){let c=!0;try{this[S](null,s.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:s.readSync(this[o],g,0,g.length,null);if(!this[m](L,g))break}while(!0);this[B]=!1}c=!1}finally{c&&this[a]()}}[a](){if(this[i]&&typeof this[o]=="number"){const c=this[o];this[o]=null,s.closeSync(c),this.emit("close")}}}class W 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[o]=typeof g.fd=="number"?g.fd:null,this[_]=g.mode===void 0?438:g.mode,this[d]=typeof g.start=="number"?g.start:null,this[i]=typeof g.autoClose=="boolean"?g.autoClose:!0;const L=this[d]!==null?"r+":"w";this[G]=g.flags===void 0,this[E]=this[G]?L:g.flags,this[o]===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[o]}get path(){return this[f]}[A](c){this[a](),this[U]=!0,this.emit("error",c)}[l](){s.open(this[f],this[E],this[_],(c,g)=>this[S](c,g))}[S](c,g){this[G]&&this[E]==="r+"&&c&&c.code==="ENOENT"?(this[E]="w",this[l]()):c?this[A](c):(this[o]=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[o]=="number"&&this[n](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[o]===null||this[U]||this[D].length?(this[D].push(c),this[b]=!0,!1):(this[U]=!0,this[P](c),!0)}[P](c){s.write(this[o],c,0,c.length,this[d],(g,L)=>this[n](g,L))}[n](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[n](null,0);else if(this[D].length===1)this[P](this[D].pop());else{const c=this[D];this[D]=[],r(this[o],c,this[d],(g,L)=>this[n](g,L))}}[a](){if(this[i]&&typeof this[o]=="number"){const c=this[o];this[o]=null,s.close(c,g=>g?this.emit("error",g):this.emit("close"))}}}class ee extends W{[l](){let c;if(this[G]&&this[E]==="r+")try{c=s.openSync(this[f],this[E],this[_])}catch(g){if(g.code==="ENOENT")return this[E]="w",this[l]();throw g}else c=s.openSync(this[f],this[E],this[_]);this[S](null,c)}[a](){if(this[i]&&typeof this[o]=="number"){const c=this[o];this[o]=null,s.closeSync(c),this.emit("close")}}[P](c){let g=!0;try{this[n](null,s.writeSync(this[o],c,0,c.length,this[d])),g=!1}finally{if(g)try{this[a]()}catch{}}}}return Re.ReadStream=N,Re.ReadStreamSync=V,Re.WriteStream=W,Re.WriteStreamSync=ee,Re}var si,qs;function ri(){if(qs)return si;qs=1;const u=Kt(),t=Me(),s=xe,r=Us(),i=1024*1024,a=Ht(),e=qt(),o=_s(),{nextTick:h}=xi,E=Buffer.from([31,139]),y=Symbol("state"),m=Symbol("writeEntry"),C=Symbol("readEntry"),_=Symbol("nextEntry"),b=Symbol("processEntry"),A=Symbol("extendedHeader"),S=Symbol("globalExtendedHeader"),v=Symbol("meta"),n=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"),M=Symbol("consumeBody"),P=Symbol("consumeMeta"),U=Symbol("consumeHeader"),G=Symbol("consuming"),Y=Symbol("bufferConcat"),N=Symbol("maybeEnd"),V=Symbol("writing"),W=Symbol("aborted"),ee=Symbol("onDone"),w=Symbol("sawValidEntry"),c=Symbol("sawNullBlock"),g=Symbol("sawEOF"),L=Symbol("closeStream"),H=J=>!0;return si=u(class extends s{constructor($){$=$||{},super($),this.file=$.file||"",this[w]=null,this.on(ee,z=>{(this[y]==="begin"||this[w]===!1)&&this.warn("TAR_BAD_ARCHIVE","Unrecognized archive format")}),$.ondone?this.on(ee,$.ondone):this.on(ee,z=>{this.emit("prefinish"),this.emit("finish"),this.emit("end")}),this.strict=!!$.strict,this.maxMetaEntrySize=$.maxMetaEntrySize||i,this.filter=typeof $.filter=="function"?$.filter:H;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 r,this[l]=null,this[C]=null,this[m]=null,this[y]="begin",this[v]="",this[A]=null,this[S]=null,this[d]=!1,this[R]=null,this[W]=!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[w]===null&&(this[w]=!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[m]=new a(z,this[A],this[S]);if(!this[w])if(T.remain){const K=()=>{T.invalid||(this[w]=!0)};T.on("end",K)}else this[w]=!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[_]())))}}}[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[_]()),q=!1)):(this[C]=null,q=!1),q}[_](){do;while(this[b](this[f].shift()));if(!this[f].length){const $=this[C];!$||$.flowing||$.size===$.remain?this[V]||this.emit("drain"):$.once("drain",z=>this.emit("drain"))}}[M]($,q){const z=this[m],O=z.blockRemain,T=O>=$.length&&q===0?$:$.slice(q,q+O);return z.write(T),z.blockRemain||(this[y]="header",this[m]=null,z.end()),T.length}[P]($,q){const z=this[m],O=this[M]($,q);return this[m]||this[n](z),O}[F]($,q,z){!this[f].length&&!this[C]?this.emit($,q,z):this[f].push([$,q,z])}[n]($){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[W]=!0,this.emit("abort",$),this.warn("TAR_ABORT",$,{recoverable:!1})}write($){if(this[W])return;if((this[R]===null||this.brotli===void 0&&this[R]===!1)&&$){if(this[l]&&($=Buffer.concat([this[l],$]),this[l]=null),$.length<E.length)return this[l]=$,!0;for(let T=0;this[R]===null&&T<E.length;T++)$[T]!==E[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 o.Unzip:new o.BrotliDecompress,this[R].on("data",oe=>this[B](oe)),this[R].on("error",oe=>this.abort(oe)),this[R].on("end",oe=>{this[d]=!0,this[B]()}),this[V]=!0;const K=this[R][T?"end":"write"]($);return this[V]=!1,K}}this[V]=!0,this[R]?this[R].write($):this[B]($),this[V]=!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[W]&&(this[l]=this[l]?Buffer.concat([this[l],$]):$)}[N](){if(this[d]&&!this[D]&&!this[W]&&!this[G]){this[D]=!0;const $=this[m];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](ee)}}[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[W]&&!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[W]&&!this[g];)switch(this[y]){case"begin":case"header":this[U]($,q),q+=512;break;case"ignore":case"body":q+=this[M]($,q);break;case"meta":q+=this[P]($,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[W]||(this[R]?this[R].end($):(this[d]=!0,this.brotli===void 0&&($=$||Buffer.alloc(0)),this.write($)))}}),si}var ni,Vs;function ui(){if(Vs)return ni;Vs=1;const u=Ie(),t=ri(),s=ge,r=ke(),i=De,a=Pe();ni=(m,C,_)=>{typeof m=="function"?(_=m,C=null,m={}):Array.isArray(m)&&(C=m,m={}),typeof C=="function"&&(_=C,C=null),C?C=Array.from(C):C=[];const b=u(m);if(b.sync&&typeof _=="function")throw new TypeError("callback not supported for sync tar functions");if(!b.file&&typeof _=="function")throw new TypeError("callback only supported with file option");return C.length&&o(b,C),b.noResume||e(b),b.file&&b.sync?h(b):b.file?E(b,_):y(b)};const e=m=>{const C=m.onentry;m.onentry=C?_=>{C(_),_.resume()}:_=>_.resume()},o=(m,C)=>{const _=new Map(C.map(S=>[a(S),!0])),b=m.filter,A=(S,v)=>{const n=v||i.parse(S).root||".",l=S===n?!1:_.has(S)?_.get(S):A(i.dirname(S),n);return _.set(S,l),l};m.filter=b?(S,v)=>b(S,v)&&A(a(S)):S=>A(a(S))},h=m=>{const C=y(m),_=m.file;let b=!0,A;try{const S=s.statSync(_),v=m.maxReadSize||16*1024*1024;if(S.size<v)C.end(s.readFileSync(_));else{let n=0;const l=Buffer.allocUnsafe(v);for(A=s.openSync(_,"r");n<S.size;){const f=s.readSync(A,l,0,v,n);n+=f,C.write(l.slice(0,f))}C.end()}b=!1}finally{if(b&&A)try{s.closeSync(A)}catch{}}},E=(m,C)=>{const _=new t(m),b=m.maxReadSize||16*1024*1024,A=m.file,S=new Promise((v,n)=>{_.on("error",n),_.on("end",v),s.stat(A,(l,f)=>{if(l)n(l);else{const d=new r.ReadStream(A,{readSize:b,size:f.size});d.on("error",n),d.pipe(_)}})});return C?S.then(C,C):S},y=m=>new t(m);return ni}var oi,Ws;function jn(){if(Ws)return oi;Ws=1;const u=Ie(),t=ii(),s=ke(),r=ui(),i=De;oi=(m,C,_)=>{if(typeof C=="function"&&(_=C),Array.isArray(m)&&(C=m,m={}),!C||!Array.isArray(C)||!C.length)throw new TypeError("no files or directories specified");C=Array.from(C);const b=u(m);if(b.sync&&typeof _=="function")throw new TypeError("callback not supported for sync tar functions");if(!b.file&&typeof _=="function")throw new TypeError("callback only supported with file option");return b.file&&b.sync?a(b,C):b.file?e(b,C,_):b.sync?E(b,C):y(b,C)};const a=(m,C)=>{const _=new t.Sync(m),b=new s.WriteStreamSync(m.file,{mode:m.mode||438});_.pipe(b),o(_,C)},e=(m,C,_)=>{const b=new t(m),A=new s.WriteStream(m.file,{mode:m.mode||438});b.pipe(A);const S=new Promise((v,n)=>{A.on("error",n),A.on("close",v),b.on("error",n)});return h(b,C),_?S.then(_,_):S},o=(m,C)=>{C.forEach(_=>{_.charAt(0)==="@"?r({file:i.resolve(m.cwd,_.slice(1)),sync:!0,noResume:!0,onentry:b=>m.add(b)}):m.add(_)}),m.end()},h=(m,C)=>{for(;C.length;){const _=C.shift();if(_.charAt(0)==="@")return r({file:i.resolve(m.cwd,_.slice(1)),noResume:!0,onentry:b=>m.add(b)}).then(b=>h(m,C));m.add(_)}m.end()},E=(m,C)=>{const _=new t.Sync(m);return o(_,C),_},y=(m,C)=>{const _=new t(m);return h(_,C),_};return oi}var ai,Ks;function Ys(){if(Ks)return ai;Ks=1;const u=Ie(),t=ii(),s=ge,r=ke(),i=ui(),a=De,e=Me();ai=(C,_,b)=>{const A=u(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(!_||!Array.isArray(_)||!_.length)throw new TypeError("no files or directories specified");return _=Array.from(_),A.sync?o(A,_):E(A,_,b)};const o=(C,_)=>{const b=new t.Sync(C);let A=!0,S,v;try{try{S=s.openSync(C.file,"r+")}catch(f){if(f.code==="ENOENT")S=s.openSync(C.file,"w+");else throw f}const n=s.fstatSync(S),l=Buffer.alloc(512);e:for(v=0;v<n.size;v+=512){for(let D=0,F=0;D<512;D+=F){if(F=s.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>n.size)break;v+=d,C.mtimeCache&&C.mtimeCache.set(f.path,f.mtime)}A=!1,h(C,b,v,S,_)}finally{if(A)try{s.closeSync(S)}catch{}}},h=(C,_,b,A,S)=>{const v=new r.WriteStreamSync(C.file,{fd:A,start:b});_.pipe(v),y(_,S)},E=(C,_,b)=>{_=Array.from(_);const A=new t(C),S=(n,l,f)=>{const d=(x,M)=>{x?s.close(n,P=>f(x)):f(null,M)};let D=0;if(l===0)return d(null,0);let F=0;const R=Buffer.alloc(512),B=(x,M)=>{if(x)return d(x);if(F+=M,F<512&&M)return s.read(n,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 P=new e(R);if(!P.cksumValid)return d(null,D);const U=512*Math.ceil(P.size/512);if(D+U+512>l||(D+=U+512,D>=l))return d(null,D);C.mtimeCache&&C.mtimeCache.set(P.path,P.mtime),F=0,s.read(n,R,0,512,D,B)};s.read(n,R,0,512,D,B)},v=new Promise((n,l)=>{A.on("error",l);let f="r+";const d=(D,F)=>{if(D&&D.code==="ENOENT"&&f==="r+")return f="w+",s.open(C.file,f,d);if(D)return l(D);s.fstat(F,(R,B)=>{if(R)return s.close(F,()=>l(R));S(F,B.size,(x,M)=>{if(x)return l(x);const P=new r.WriteStream(C.file,{fd:F,start:M});A.pipe(P),P.on("error",l),P.on("close",n),m(A,_)})})};s.open(C.file,f,d)});return b?v.then(b,b):v},y=(C,_)=>{_.forEach(b=>{b.charAt(0)==="@"?i({file:a.resolve(C.cwd,b.slice(1)),sync:!0,noResume:!0,onentry:A=>C.add(A)}):C.add(b)}),C.end()},m=(C,_)=>{for(;_.length;){const b=_.shift();if(b.charAt(0)==="@")return i({file:a.resolve(C.cwd,b.slice(1)),noResume:!0,onentry:A=>C.add(A)}).then(A=>m(C,_));C.add(b)}C.end()};return ai}var hi,Zs;function Un(){if(Zs)return hi;Zs=1;const u=Ie(),t=Ys();hi=(r,i,a)=>{const e=u(r);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(!i||!Array.isArray(i)||!i.length)throw new TypeError("no files or directories specified");return i=Array.from(i),s(e),t(e,i,a)};const s=r=>{const i=r.filter;r.mtimeCache||(r.mtimeCache=new Map),r.filter=i?(a,e)=>i(a,e)&&!(r.mtimeCache.get(a)>e.mtime):(a,e)=>!(r.mtimeCache.get(a)>e.mtime)};return hi}var st={exports:{}},li,Xs;function zn(){if(Xs)return li;Xs=1;const{promisify:u}=Rr,t=ge;return li=r=>{if(!r)r={mode:511,fs:t};else if(typeof r=="object")r={mode:511,fs:t,...r};else if(typeof r=="number")r={mode:r,fs:t};else if(typeof r=="string")r={mode:parseInt(r,8),fs:t};else throw new TypeError("invalid options argument");return r.mkdir=r.mkdir||r.fs.mkdir||t.mkdir,r.mkdirAsync=u(r.mkdir),r.stat=r.stat||r.fs.stat||t.stat,r.statAsync=u(r.stat),r.statSync=r.statSync||r.fs.statSync||t.statSync,r.mkdirSync=r.mkdirSync||r.fs.mkdirSync||t.mkdirSync,r},li}var ci,Js;function Gn(){if(Js)return ci;Js=1;const u=process.env.__TESTING_MKDIRP_PLATFORM__||process.platform,{resolve:t,parse:s}=De;return ci=i=>{if(/\0/.test(i))throw Object.assign(new TypeError("path must be a string without null bytes"),{path:i,code:"ERR_INVALID_ARG_VALUE"});if(i=t(i),u==="win32"){const a=/[*|"<>?:]/,{root:e}=s(i);if(a.test(i.substr(e.length)))throw Object.assign(new Error("Illegal characters in path."),{path:i,code:"EINVAL"})}return i},ci}var Di,Qs;function qn(){if(Qs)return Di;Qs=1;const{dirname:u}=De,t=(r,i,a=void 0)=>a===i?Promise.resolve():r.statAsync(i).then(e=>e.isDirectory()?a:void 0,e=>e.code==="ENOENT"?t(r,u(i),i):void 0),s=(r,i,a=void 0)=>{if(a!==i)try{return r.statSync(i).isDirectory()?a:void 0}catch(e){return e.code==="ENOENT"?s(r,u(i),i):void 0}};return Di={findMade:t,findMadeSync:s},Di}var fi,er;function tr(){if(er)return fi;er=1;const{dirname:u}=De,t=(r,i,a)=>{i.recursive=!1;const e=u(r);return e===r?i.mkdirAsync(r,i).catch(o=>{if(o.code!=="EISDIR")throw o}):i.mkdirAsync(r,i).then(()=>a||r,o=>{if(o.code==="ENOENT")return t(e,i).then(h=>t(r,i,h));if(o.code!=="EEXIST"&&o.code!=="EROFS")throw o;return i.statAsync(r).then(h=>{if(h.isDirectory())return a;throw o},()=>{throw o})})},s=(r,i,a)=>{const e=u(r);if(i.recursive=!1,e===r)try{return i.mkdirSync(r,i)}catch(o){if(o.code!=="EISDIR")throw o;return}try{return i.mkdirSync(r,i),a||r}catch(o){if(o.code==="ENOENT")return s(r,i,s(e,i,a));if(o.code!=="EEXIST"&&o.code!=="EROFS")throw o;try{if(!i.statSync(r).isDirectory())throw o}catch{throw o}}};return fi={mkdirpManual:t,mkdirpManualSync:s},fi}var di,ir;function Vn(){if(ir)return di;ir=1;const{dirname:u}=De,{findMade:t,findMadeSync:s}=qn(),{mkdirpManual:r,mkdirpManualSync:i}=tr();return di={mkdirpNative:(o,h)=>(h.recursive=!0,u(o)===o?h.mkdirAsync(o,h):t(h,o).then(y=>h.mkdirAsync(o,h).then(()=>y).catch(m=>{if(m.code==="ENOENT")return r(o,h);throw m}))),mkdirpNativeSync:(o,h)=>{if(h.recursive=!0,u(o)===o)return h.mkdirSync(o,h);const y=s(h,o);try{return h.mkdirSync(o,h),y}catch(m){if(m.code==="ENOENT")return i(o,h);throw m}}},di}var mi,sr;function Wn(){if(sr)return mi;sr=1;const u=ge,s=(process.env.__TESTING_MKDIRP_NODE_VERSION__||process.version).replace(/^v/,"").split("."),r=+s[0]>10||+s[0]==10&&+s[1]>=12;return mi={useNative:r?e=>e.mkdir===u.mkdir:()=>!1,useNativeSync:r?e=>e.mkdirSync===u.mkdirSync:()=>!1},mi}var pi,rr;function Kn(){if(rr)return pi;rr=1;const u=zn(),t=Gn(),{mkdirpNative:s,mkdirpNativeSync:r}=Vn(),{mkdirpManual:i,mkdirpManualSync:a}=tr(),{useNative:e,useNativeSync:o}=Wn(),h=(y,m)=>(y=t(y),m=u(m),e(m)?s(y,m):i(y,m)),E=(y,m)=>(y=t(y),m=u(m),o(m)?r(y,m):a(y,m));return h.sync=E,h.native=(y,m)=>s(t(y),u(m)),h.manual=(y,m)=>i(t(y),u(m)),h.nativeSync=(y,m)=>r(t(y),u(m)),h.manualSync=(y,m)=>a(t(y),u(m)),pi=h,pi}var Ei,nr;function Yn(){if(nr)return Ei;nr=1;const u=ge,t=De,s=u.lchown?"lchown":"chown",r=u.lchownSync?"lchownSync":"chownSync",i=u.lchown&&!process.version.match(/v1[1-9]+\./)&&!process.version.match(/v10\.[6-9]/),a=(v,n,l)=>{try{return u[r](v,n,l)}catch(f){if(f.code!=="ENOENT")throw f}},e=(v,n,l)=>{try{return u.chownSync(v,n,l)}catch(f){if(f.code!=="ENOENT")throw f}},o=i?(v,n,l,f)=>d=>{!d||d.code!=="EISDIR"?f(d):u.chown(v,n,l,f)}:(v,n,l,f)=>f,h=i?(v,n,l)=>{try{return a(v,n,l)}catch(f){if(f.code!=="EISDIR")throw f;e(v,n,l)}}:(v,n,l)=>a(v,n,l),E=process.version;let y=(v,n,l)=>u.readdir(v,n,l),m=(v,n)=>u.readdirSync(v,n);/^v4\./.test(E)&&(y=(v,n,l)=>u.readdir(v,l));const C=(v,n,l,f)=>{u[s](v,n,l,o(v,n,l,d=>{f(d&&d.code!=="ENOENT"?d:null)}))},_=(v,n,l,f,d)=>{if(typeof n=="string")return u.lstat(t.resolve(v,n),(D,F)=>{if(D)return d(D.code!=="ENOENT"?D:null);F.name=n,_(v,F,l,f,d)});if(n.isDirectory())b(t.resolve(v,n.name),l,f,D=>{if(D)return d(D);const F=t.resolve(v,n.name);C(F,l,f,d)});else{const D=t.resolve(v,n.name);C(D,l,f,d)}},b=(v,n,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,n,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,n,l,f)}};D.forEach(x=>_(v,x,n,l,B))})},A=(v,n,l,f)=>{if(typeof n=="string")try{const d=u.lstatSync(t.resolve(v,n));d.name=n,n=d}catch(d){if(d.code==="ENOENT")return;throw d}n.isDirectory()&&S(t.resolve(v,n.name),l,f),h(t.resolve(v,n.name),l,f)},S=(v,n,l)=>{let f;try{f=m(v,{withFileTypes:!0})}catch(d){if(d.code==="ENOENT")return;if(d.code==="ENOTDIR"||d.code==="ENOTSUP")return h(v,n,l);throw d}return f&&f.length&&f.forEach(d=>A(v,d,n,l)),h(v,n,l)};return Ei=b,b.sync=S,Ei}var ur;function Zn(){if(ur)return st.exports;ur=1;const u=Kn(),t=ge,s=De,r=Yn(),i=Le();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 o=(_,b)=>_.get(i(b)),h=(_,b,A)=>_.set(i(b),A),E=(_,b)=>{t.stat(_,(A,S)=>{(A||!S.isDirectory())&&(A=new e(_,A&&A.code||"ENOTDIR")),b(A)})};st.exports=(_,b,A)=>{_=i(_);const S=b.umask,v=b.mode|448,n=(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=i(b.cwd),x=(U,G)=>{U?A(U):(h(R,_,!0),G&&d?r(G,l,f,Y=>x(Y)):n?t.chmod(_,v,A):A())};if(R&&o(R,_)===!0)return x();if(_===B)return E(_,x);if(D)return u(_,{mode:v}).then(U=>x(null,U),x);const P=i(s.relative(B,_)).split("/");y(B,P,v,R,F,B,null,x)};const y=(_,b,A,S,v,n,l,f)=>{if(!b.length)return f(null,l);const d=b.shift(),D=i(s.resolve(_+"/"+d));if(o(S,D))return y(D,b,A,S,v,n,l,f);t.mkdir(D,A,m(D,b,A,S,v,n,l,f))},m=(_,b,A,S,v,n,l,f)=>d=>{d?t.lstat(_,(D,F)=>{if(D)D.path=D.path&&i(D.path),f(D);else if(F.isDirectory())y(_,b,A,S,v,n,l,f);else if(v)t.unlink(_,R=>{if(R)return f(R);t.mkdir(_,A,m(_,b,A,S,v,n,l,f))});else{if(F.isSymbolicLink())return f(new a(_,_+"/"+b.join("/")));f(d)}}):(l=l||_,y(_,b,A,S,v,n,l,f))},C=_=>{let b=!1,A="ENOTDIR";try{b=t.statSync(_).isDirectory()}catch(S){A=S.code}finally{if(!b)throw new e(_,A)}};return st.exports.sync=(_,b)=>{_=i(_);const A=b.umask,S=b.mode|448,v=(S&A)!==0,n=b.uid,l=b.gid,f=typeof n=="number"&&typeof l=="number"&&(n!==b.processUid||l!==b.processGid),d=b.preserve,D=b.unlink,F=b.cache,R=i(b.cwd),B=U=>{h(F,_,!0),U&&f&&r.sync(U,n,l),v&&t.chmodSync(_,S)};if(F&&o(F,_)===!0)return B();if(_===R)return C(R),B();if(d)return B(u.sync(_,S));const M=i(s.relative(R,_)).split("/");let P=null;for(let U=M.shift(),G=R;U&&(G+="/"+U);U=M.shift())if(G=i(s.resolve(G)),!o(F,G))try{t.mkdirSync(G,S),P=P||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),P=P||G,h(F,G,!0);continue}else if(N.isSymbolicLink())return new a(G,G+"/"+M.join("/"))}return B(P)},st.exports}var gi,or;function ar(){if(or)return gi;or=1;const u=Object.create(null),{hasOwnProperty:t}=Object.prototype;return gi=s=>(t.call(u,s)||(u[s]=s.normalize("NFD")),u[s]),gi}var Ci,hr;function Xn(){if(hr)return Ci;hr=1;const u=lt,t=ar(),s=Pe(),{join:r}=De,a=(process.env.TESTING_TAR_FAKE_PLATFORM||process.platform)==="win32";return Ci=()=>{const e=new Map,o=new Map,h=A=>A.split("/").slice(0,-1).reduce((v,n)=>(v.length&&(n=r(v[v.length-1],n)),v.push(n||"/"),v),[]),E=new Set,y=A=>{const S=o.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))}},m=A=>{const{paths:S,dirs:v}=y(A);return S.every(n=>n[0]===A)&&v.every(n=>n[0]instanceof Set&&n[0].has(A))},C=A=>E.has(A)||!m(A)?!1:(E.add(A),A(()=>_(A)),!0),_=A=>{if(!E.has(A))return!1;const{paths:S,dirs:v}=o.get(A),n=new Set;return S.forEach(l=>{const f=e.get(l);u.equal(f[0],A),f.length===1?e.delete(l):(f.shift(),typeof f[0]=="function"?n.add(f[0]):f[0].forEach(d=>n.add(d)))}),v.forEach(l=>{const f=e.get(l);u(f[0]instanceof Set),f[0].size===1&&f.length===1?e.delete(l):f[0].size===1?(f.shift(),n.add(f[0])):f[0].delete(A)}),E.delete(A),n.forEach(l=>C(l)),!0};return{check:m,reserve:(A,S)=>{A=a?["win32 parallelization disabled"]:A.map(n=>s(r(t(n))).toLowerCase());const v=new Set(A.map(n=>h(n)).reduce((n,l)=>n.concat(l)));return o.set(S,{dirs:v,paths:A}),A.forEach(n=>{const l=e.get(n);l?l.push(S):e.set(n,[S])}),v.forEach(n=>{const l=e.get(n);l?l[l.length-1]instanceof Set?l[l.length-1].add(S):l.push(new Set([S])):e.set(n,[new Set([S])])}),C(S)}}},Ci}var Fi,lr;function Jn(){if(lr)return Fi;lr=1;const t=(process.env.__FAKE_PLATFORM__||process.platform)==="win32",s=ct.__FAKE_TESTING_FS__||ge,{O_CREAT:r,O_TRUNC:i,O_WRONLY:a,UV_FS_O_FILEMAP:e=0}=s.constants,o=t&&!!e,h=512*1024,E=e|i|r|a;return Fi=o?y=>y<h?E:"w":()=>"w",Fi}var yi,cr;function Dr(){if(cr)return yi;cr=1;const u=lt,t=ri(),s=ge,r=ke(),i=De,a=Zn(),e=Ns(),o=Xn(),h=Ls(),E=Le(),y=Pe(),m=ar(),C=Symbol("onEntry"),_=Symbol("checkFs"),b=Symbol("checkFs2"),A=Symbol("pruneCache"),S=Symbol("isReusable"),v=Symbol("makeFs"),n=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"),M=Symbol("pending"),P=Symbol("pend"),U=Symbol("unpend"),G=Symbol("ended"),Y=Symbol("maybeClose"),N=Symbol("skip"),V=Symbol("doChown"),W=Symbol("uid"),ee=Symbol("gid"),w=Symbol("checkedCwd"),c=Br,g=Jn(),H=(process.env.TESTING_TAR_FAKE_PLATFORM||process.platform)==="win32",J=1024,$=(te,p)=>{if(!H)return s.unlink(te,p);const k=te+".DELETE."+c.randomBytes(16).toString("hex");s.rename(te,k,j=>{if(j)return p(j);s.unlink(k,p)})},q=te=>{if(!H)return s.unlinkSync(te);const p=te+".DELETE."+c.randomBytes(16).toString("hex");s.renameSync(te,p),s.unlinkSync(p)},z=(te,p,k)=>te===te>>>0?te:p===p>>>0?p:k,O=te=>y(E(m(te))).toLowerCase(),T=(te,p)=>{p=O(p);for(const k of te.keys()){const j=O(k);(j===p||j.indexOf(p+"/")===0)&&te.delete(k)}},K=te=>{for(const p of te.keys())te.delete(p)};class oe extends t{constructor(p){if(p||(p={}),p.ondone=k=>{this[G]=!0,this[Y]()},super(p),this[w]=!1,this.reservations=o(),this.transform=typeof p.transform=="function"?p.transform:null,this.writable=!0,this.readable=!1,this[M]=0,this[G]=!1,this.dirCache=p.dirCache||new Map,typeof p.uid=="number"||typeof p.gid=="number"){if(typeof p.uid!="number"||typeof p.gid!="number")throw new TypeError("cannot set owner without number uid and gid");if(p.preserveOwner)throw new TypeError("cannot preserve owner in archive and also set owner explicitly");this.uid=p.uid,this.gid=p.gid,this.setOwner=!0}else this.uid=null,this.gid=null,this.setOwner=!1;p.preserveOwner===void 0&&typeof p.uid!="number"?this.preserveOwner=process.getuid&&process.getuid()===0:this.preserveOwner=!!p.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 p.maxDepth=="number"?p.maxDepth:J,this.forceChown=p.forceChown===!0,this.win32=!!p.win32||H,this.newer=!!p.newer,this.keep=!!p.keep,this.noMtime=!!p.noMtime,this.preservePaths=!!p.preservePaths,this.unlink=!!p.unlink,this.cwd=E(i.resolve(p.cwd||process.cwd())),this.strip=+p.strip||0,this.processUmask=p.noChmod?0:process.umask(),this.umask=typeof p.umask=="number"?p.umask:this.processUmask,this.dmode=p.dmode||511&~this.umask,this.fmode=p.fmode||438&~this.umask,this.on("entry",k=>this[C](k))}warn(p,k,j={}){return(p==="TAR_BAD_ARCHIVE"||p==="TAR_ABORT")&&(j.recoverable=!1),super.warn(p,k,j)}[Y](){this[G]&&this[M]===0&&(this.emit("prefinish"),this.emit("finish"),this.emit("end"))}[R](p){const k=E(p.path),j=k.split("/");if(this.strip){if(j.length<this.strip)return!1;if(p.type==="Link"){const Z=E(p.linkpath).split("/");if(Z.length>=this.strip)p.linkpath=Z.slice(this.strip).join("/");else return!1}j.splice(0,this.strip),p.path=j.join("/")}if(isFinite(this.maxDepth)&&j.length>this.maxDepth)return this.warn("TAR_ENTRY_ERROR","path excessively deep",{entry:p,path:k,depth:j.length,maxDepth:this.maxDepth}),!1;if(!this.preservePaths){if(j.includes("..")||H&&/^[a-z]:\.\.$/i.test(j[0]))return this.warn("TAR_ENTRY_ERROR","path contains '..'",{entry:p,path:k}),!1;const[Z,X]=h(k);Z&&(p.path=X,this.warn("TAR_ENTRY_INFO",`stripping ${Z} from absolute path`,{entry:p,path:k}))}if(i.isAbsolute(p.path)?p.absolute=E(i.resolve(p.path)):p.absolute=E(i.resolve(this.cwd,p.path)),!this.preservePaths&&p.absolute.indexOf(this.cwd+"/")!==0&&p.absolute!==this.cwd)return this.warn("TAR_ENTRY_ERROR","path escaped extraction target",{entry:p,path:E(p.path),resolvedPath:p.absolute,cwd:this.cwd}),!1;if(p.absolute===this.cwd&&p.type!=="Directory"&&p.type!=="GNUDumpDir")return!1;if(this.win32){const{root:Z}=i.win32.parse(p.absolute);p.absolute=Z+e.encode(p.absolute.slice(Z.length));const{root:X}=i.win32.parse(p.path);p.path=X+e.encode(p.path.slice(X.length))}return!0}[C](p){if(!this[R](p))return p.resume();switch(u.equal(typeof p.absolute,"string"),p.type){case"Directory":case"GNUDumpDir":p.mode&&(p.mode=p.mode|448);case"File":case"OldFile":case"ContiguousFile":case"Link":case"SymbolicLink":return this[_](p);case"CharacterDevice":case"BlockDevice":case"FIFO":default:return this[F](p)}}[x](p,k){p.name==="CwdError"?this.emit("error",p):(this.warn("TAR_ENTRY_ERROR",p,{entry:k}),this[U](),k.resume())}[B](p,k,j){a(E(p),{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},j)}[V](p){return this.forceChown||this.preserveOwner&&(typeof p.uid=="number"&&p.uid!==this.processUid||typeof p.gid=="number"&&p.gid!==this.processGid)||typeof this.uid=="number"&&this.uid!==this.processUid||typeof this.gid=="number"&&this.gid!==this.processGid}[W](p){return z(this.uid,p.uid,this.processUid)}[ee](p){return z(this.gid,p.gid,this.processGid)}[n](p,k){const j=p.mode&4095||this.fmode,Z=new r.WriteStream(p.absolute,{flags:g(p.size),mode:j,autoClose:!1});Z.on("error",se=>{Z.fd&&s.close(Z.fd,()=>{}),Z.write=()=>!0,this[x](se,p),k()});let X=1;const ue=se=>{if(se){Z.fd&&s.close(Z.fd,()=>{}),this[x](se,p),k();return}--X===0&&s.close(Z.fd,le=>{le?this[x](le,p):this[U](),k()})};Z.on("finish",se=>{const le=p.absolute,Fe=Z.fd;if(p.mtime&&!this.noMtime){X++;const ye=p.atime||new Date,Ae=p.mtime;s.futimes(Fe,ye,Ae,Be=>Be?s.utimes(le,ye,Ae,ut=>ue(ut&&Be)):ue())}if(this[V](p)){X++;const ye=this[W](p),Ae=this[ee](p);s.fchown(Fe,ye,Ae,Be=>Be?s.chown(le,ye,Ae,ut=>ue(ut&&Be)):ue())}ue()});const ie=this.transform&&this.transform(p)||p;ie!==p&&(ie.on("error",se=>{this[x](se,p),k()}),p.pipe(ie)),ie.pipe(Z)}[l](p,k){const j=p.mode&4095||this.dmode;this[B](p.absolute,j,Z=>{if(Z){this[x](Z,p),k();return}let X=1;const ue=ie=>{--X===0&&(k(),this[U](),p.resume())};p.mtime&&!this.noMtime&&(X++,s.utimes(p.absolute,p.atime||new Date,p.mtime,ue)),this[V](p)&&(X++,s.chown(p.absolute,this[W](p),this[ee](p),ue)),ue()})}[F](p){p.unsupported=!0,this.warn("TAR_ENTRY_UNSUPPORTED",`unsupported entry type: ${p.type}`,{entry:p}),p.resume()}[d](p,k){this[f](p,p.linkpath,"symlink",k)}[D](p,k){const j=E(i.resolve(this.cwd,p.linkpath));this[f](p,j,"link",k)}[P](){this[M]++}[U](){this[M]--,this[Y]()}[N](p){this[U](),p.resume()}[S](p,k){return p.type==="File"&&!this.unlink&&k.isFile()&&k.nlink<=1&&!H}[_](p){this[P]();const k=[p.path];p.linkpath&&k.push(p.linkpath),this.reservations.reserve(k,j=>this[b](p,j))}[A](p){p.type==="SymbolicLink"?K(this.dirCache):p.type!=="Directory"&&T(this.dirCache,p.absolute)}[b](p,k){this[A](p);const j=ie=>{this[A](p),k(ie)},Z=()=>{this[B](this.cwd,this.dmode,ie=>{if(ie){this[x](ie,p),j();return}this[w]=!0,X()})},X=()=>{if(p.absolute!==this.cwd){const ie=E(i.dirname(p.absolute));if(ie!==this.cwd)return this[B](ie,this.dmode,se=>{if(se){this[x](se,p),j();return}ue()})}ue()},ue=()=>{s.lstat(p.absolute,(ie,se)=>{if(se&&(this.keep||this.newer&&se.mtime>p.mtime)){this[N](p),j();return}if(ie||this[S](p,se))return this[v](null,p,j);if(se.isDirectory()){if(p.type==="Directory"){const le=!this.noChmod&&p.mode&&(se.mode&4095)!==p.mode,Fe=ye=>this[v](ye,p,j);return le?s.chmod(p.absolute,p.mode,Fe):Fe()}if(p.absolute!==this.cwd)return s.rmdir(p.absolute,le=>this[v](le,p,j))}if(p.absolute===this.cwd)return this[v](null,p,j);$(p.absolute,le=>this[v](le,p,j))})};this[w]?X():Z()}[v](p,k,j){if(p){this[x](p,k),j();return}switch(k.type){case"File":case"OldFile":case"ContiguousFile":return this[n](k,j);case"Link":return this[D](k,j);case"SymbolicLink":return this[d](k,j);case"Directory":case"GNUDumpDir":return this[l](k,j)}}[f](p,k,j,Z){s[j](k,p.absolute,X=>{X?this[x](X,p):(this[U](),p.resume()),Z()})}}const ce=te=>{try{return[null,te()]}catch(p){return[p,null]}};class Ge extends oe{[v](p,k){return super[v](p,k,()=>{})}[_](p){if(this[A](p),!this[w]){const X=this[B](this.cwd,this.dmode);if(X)return this[x](X,p);this[w]=!0}if(p.absolute!==this.cwd){const X=E(i.dirname(p.absolute));if(X!==this.cwd){const ue=this[B](X,this.dmode);if(ue)return this[x](ue,p)}}const[k,j]=ce(()=>s.lstatSync(p.absolute));if(j&&(this.keep||this.newer&&j.mtime>p.mtime))return this[N](p);if(k||this[S](p,j))return this[v](null,p);if(j.isDirectory()){if(p.type==="Directory"){const ue=!this.noChmod&&p.mode&&(j.mode&4095)!==p.mode,[ie]=ue?ce(()=>{s.chmodSync(p.absolute,p.mode)}):[];return this[v](ie,p)}const[X]=ce(()=>s.rmdirSync(p.absolute));this[v](X,p)}const[Z]=p.absolute===this.cwd?[]:ce(()=>q(p.absolute));this[v](Z,p)}[n](p,k){const j=p.mode&4095||this.fmode,Z=ie=>{let se;try{s.closeSync(X)}catch(le){se=le}(ie||se)&&this[x](ie||se,p),k()};let X;try{X=s.openSync(p.absolute,g(p.size),j)}catch(ie){return Z(ie)}const ue=this.transform&&this.transform(p)||p;ue!==p&&(ue.on("error",ie=>this[x](ie,p)),p.pipe(ue)),ue.on("data",ie=>{try{s.writeSync(X,ie,0,ie.length)}catch(se){Z(se)}}),ue.on("end",ie=>{let se=null;if(p.mtime&&!this.noMtime){const le=p.atime||new Date,Fe=p.mtime;try{s.futimesSync(X,le,Fe)}catch(ye){try{s.utimesSync(p.absolute,le,Fe)}catch{se=ye}}}if(this[V](p)){const le=this[W](p),Fe=this[ee](p);try{s.fchownSync(X,le,Fe)}catch(ye){try{s.chownSync(p.absolute,le,Fe)}catch{se=se||ye}}}Z(se)})}[l](p,k){const j=p.mode&4095||this.dmode,Z=this[B](p.absolute,j);if(Z){this[x](Z,p),k();return}if(p.mtime&&!this.noMtime)try{s.utimesSync(p.absolute,p.atime||new Date,p.mtime)}catch{}if(this[V](p))try{s.chownSync(p.absolute,this[W](p),this[ee](p))}catch{}k(),p.resume()}[B](p,k){try{return a.sync(E(p),{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(j){return j}}[f](p,k,j,Z){try{s[j+"Sync"](k,p.absolute),Z(),p.resume()}catch(X){return this[x](X,p)}}}return oe.Sync=Ge,yi=oe,yi}var bi,fr;function Qn(){if(fr)return bi;fr=1;const u=Ie(),t=Dr(),s=ge,r=ke(),i=De,a=Pe();bi=(m,C,_)=>{typeof m=="function"?(_=m,C=null,m={}):Array.isArray(m)&&(C=m,m={}),typeof C=="function"&&(_=C,C=null),C?C=Array.from(C):C=[];const b=u(m);if(b.sync&&typeof _=="function")throw new TypeError("callback not supported for sync tar functions");if(!b.file&&typeof _=="function")throw new TypeError("callback only supported with file option");return C.length&&e(b,C),b.file&&b.sync?o(b):b.file?h(b,_):b.sync?E(b):y(b)};const e=(m,C)=>{const _=new Map(C.map(S=>[a(S),!0])),b=m.filter,A=(S,v)=>{const n=v||i.parse(S).root||".",l=S===n?!1:_.has(S)?_.get(S):A(i.dirname(S),n);return _.set(S,l),l};m.filter=b?(S,v)=>b(S,v)&&A(a(S)):S=>A(a(S))},o=m=>{const C=new t.Sync(m),_=m.file,b=s.statSync(_),A=m.maxReadSize||16*1024*1024;new r.ReadStreamSync(_,{readSize:A,size:b.size}).pipe(C)},h=(m,C)=>{const _=new t(m),b=m.maxReadSize||16*1024*1024,A=m.file,S=new Promise((v,n)=>{_.on("error",n),_.on("close",v),s.stat(A,(l,f)=>{if(l)n(l);else{const d=new r.ReadStream(A,{readSize:b,size:f.size});d.on("error",n),d.pipe(_)}})});return C?S.then(C,C):S},E=m=>new t.Sync(m),y=m=>new t(m);return bi}var dr;function eu(){return dr||(dr=1,he.c=he.create=jn(),he.r=he.replace=Ys(),he.t=he.list=ui(),he.u=he.update=Un(),he.x=he.extract=Qn(),he.Pack=ii(),he.Unpack=Dr(),he.Parse=ri(),he.ReadEntry=Ht(),he.WriteEntry=ks(),he.Header=Me(),he.Pax=qt(),he.types=Ss()),he}var tu=eu();class iu extends Error{}class mr extends Error{}class su extends Error{}class ru extends Error{}const pr=async(u,t)=>{const s=new URL(u),r=we.basename(s.pathname);return{name:r,version:void 0,subdir:void 0,url:s.href,tar:s.href,defaultDir:r,headers:t.auth?{Authorization:`Bearer ${t.auth}`}:void 0}},Er=async(u,t)=>{const s=rt(u),r=await _i(s,t,async()=>(await(await He(`https://api.github.com/repos/${s.repo}`)).json())?.default_branch);return{name:s.repo.replace("/","-"),version:r,subdir:s.subdir,headers:{...t.auth?{Authorization:`Bearer ${t.auth}`}:{},Accept:"application/vnd.github+json","X-GitHub-Api-Version":"2022-11-28"},url:`https://github.com/${s.repo}/tree/${r}${s.subdir}`,tar:`https://api.github.com/repos/${s.repo}/tarball/${r}`}},nu=async(u,t)=>{const s=rt(u),r=await _i(s,t,async()=>(await(await He(`https://gitlab.com/api/v4/projects/${encodeURIComponent(s.repo)}`)).json())?.default_branch);return{name:s.repo.replace("/","-"),version:r,subdir:s.subdir,headers:{...t.auth?{Authorization:`Bearer ${t.auth}`}:{},"sec-fetch-mode":"same-origin"},url:`https://gitlab.com/${s.repo}/tree/${r}${s.subdir}`,tar:`https://gitlab.com/${s.repo}/-/archive/${r}.tar.gz`}},uu=async(u,t)=>{const s=rt(u),r=await _i(s,t,async()=>(await(await He(`https://api.bitbucket.org/2.0/repositories/${s.repo}`)).json())?.mainbranch?.name);return{name:s.repo.replace("/","-"),version:r,subdir:s.subdir,headers:t.auth?{Authorization:`Bearer ${t.auth}`}:{},url:`https://bitbucket.com/${s.repo}/src/${r}${s.subdir}`,tar:`https://bitbucket.org/${s.repo}/get/${r}.tar.gz`}},ou=(u,t)=>{const s=rt(u),r=s.ref||"main";return{name:s.repo.replace("/","-"),version:r,subdir:s.subdir,headers:t.auth?{Authorization:`Bearer ${t.auth}`}:{},url:`https://git.sr.ht/~${s.repo}/tree/${r}/item${s.subdir}`,tar:`https://git.sr.ht/~${s.repo}/archive/${r}.tar.gz`}},au={http:pr,https:pr,github:Er,gh:Er,gitlab:nu,bitbucket:uu,sourcehut:ou};async function _i(u,t,s){if(u.ref)return u.ref;if(t.offline!==!0)try{const r=await s();if(r)return r}catch(r){wi(`Failed to fetch ref for ${u.repo}`,r)}return"main"}const hu=/^([\w-.]+):/;function lu(u,t,s){t||="github";let r=u;const i=u.match(hu);i&&(t=i[1],t!=="http"&&t!=="https"&&(r=u.slice(i[0].length)));const a=s?.[t]||au[t];return{source:r,providerName:t,provider:a}}async function cu(u,t,s={}){const r=t+".json",i=JSON.parse(await Oe.readFile(r,"utf8").catch(()=>"{}")),e=(await He(u,{...s,method:"HEAD"}).catch(()=>{}))?.headers.get("etag");if(i.etag===e&&Se.existsSync(t))return;typeof e=="string"&&(i.etag=e);const o=await He(u,{headers:s.headers});if(o.status>=400)throw new mr(`Failed to download ${u}: ${o.status} ${o.statusText}`);if(o.body==null)throw new mr(`Failed to download ${u}: empty response body`);await Oe.mkdir(we.dirname(t),{recursive:!0});const h=Se.createWriteStream(t);await Ri(Sr)(o.body,h),await Oe.writeFile(r,JSON.stringify(i),"utf8")}const Du=/^(?<repo>[\w\-.]+\/[\w\-.]+)(?<subdir>[^#]+)?(?<ref>#[\w\-./@]+)?/;function rt(u){const t=u.match(Du)?.groups||{};return{repo:t.repo,subdir:t.subdir||"/",ref:t.ref?.slice(1)}}function wi(...u){process.env.DEBUG&&console.debug("[giget]",...u)}async function He(u,t={}){t.headers?.["sec-fetch-mode"]&&(t.mode=t.headers["sec-fetch-mode"]);const s=await fetch(u,t).catch(r=>{throw new Error(`Failed to fetch ${u}`,{cause:r})});if(t.validateStatus&&s.status>=400)throw new Error(`Failed to fetch ${u}: ${s.status} ${s.statusText}`);return s}function fu(){return process.env.XDG_CACHE_HOME?we.resolve(process.env.XDG_CACHE_HOME,"bluwy-giget"):we.resolve(Ar.homedir(),".cache/bluwy-giget")}async function du(u,t,s){s==="/"&&(s=void 0),s&&(s.startsWith("/")&&(s=s.slice(1)),s.endsWith("/")||(s+="/"));let r=!1;if(await Oe.mkdir(t,{recursive:!0}),await tu.extract({file:u,cwd:t,onentry(i){i.path=i.path.split("/").splice(1).join("/"),s&&(i.path.startsWith(s)?(i.path=i.path.slice(s.length-1),r=!0):i.path="")}}),s&&!r)throw await Oe.rm(t,{recursive:!0,force:!0}),new su(`Subdirectory not found in tar: ${s}`)}async function mu(u,t={}){const{source:s,providerName:r,provider:i}=lu(u,t.provider,t.providers);if(!i)throw new iu(`Unsupported provider: ${r}`);const a={...t.providerOptions,offline:t.offline},e=await Promise.resolve().then(()=>i(s,a)).catch(m=>{throw new Error(`The ${r} provider failed with errors`,{cause:m})});e.name=(e.name||"template").replace(/[^\da-z-]/gi,"-"),e.defaultDir=(e.defaultDir||e.name).replace(/[^\da-z-]/gi,"-");const o=we.resolve(fu(),r,e.name),h=we.resolve(o,(e.version||e.name)+".tar.gz");if((t.offline==="prefer"?!Se.existsSync(h):!t.offline)&&(await cu(e.tar,h,{headers:e.headers}).catch(m=>{if(!Se.existsSync(h))throw m;wi("Download error. Using cached version:",m)}),wi(`Downloaded ${e.tar} to ${h}`)),!Se.existsSync(h))throw new Error(`Tarball not found: ${h} (offline: ${t.offline})`);const E=we.resolve(t.cwd||"."),y=we.resolve(E,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 ru(`Destination ${y} already exists.`);return await du(h,y,e.subdir),{info:e,source:s,dir:y}}async function je({template:u,project:t}){await mu(`wrtnlabs/agentica.template.${u}`,{provider:"github",dir:t}),await _r(be(t,".github"),{force:!0,recursive:!0})}async function Ue({projectPath:u,dotEnvfileName:t,apiKeys:s}){if(!ot(u))throw new Error(`${u} directory does not exist.`);const r=be(u,t??".env"),i=(ot(r)?`
|
|
89
|
+
`:"")+s.map(({key:a,value:e})=>`${a}=${e}`).join(`
|
|
90
|
+
`);await wr(r,i)}function pu({packageManager:u,pkg:t}){switch(u){case"npm":return`npm install ${t??""}`;case"yarn":return t!=null?`yarn add ${t}`:"yarn";case"pnpm":return`pnpm install ${t??""}`;case"bun":return`bun install ${t??""}`;default:throw new Error(`Unsupported package manager: ${u}`)}}function Eu({packageManager:u,command:t}){switch(u){case"npm":return`npm run ${t}`;case"yarn":return`yarn ${t}`;case"pnpm":return`pnpm ${t}`;case"bun":return`bun ${t}`;default:throw new Error(`Unsupported package manager: ${u}`)}}function gu(){const u=ae.env.npm_config_user_agent;switch(!0){case u?.startsWith("npm"):return"npm";case u?.startsWith("yarn"):return"yarn";case u?.startsWith("pnpm"):return"pnpm";case u?.startsWith("bun"):return"bun";default:return"npm"}}const Cu=["nodejs","nestjs","react","react-native","standalone","nestjs+react","nodejs+react"];async function ze({packageManager:u,projectAbsolutePath:t,services:s}){const r=s.length>0?[...s.map(e=>$n(e))].join(" "):void 0,i=pu({packageManager:u,pkg:r}),a=rs();a.start("\u{1F4E6} Package installation in progress..."),await ps(i,{cwd:t}),a.stop("\u2705 Package installation completed")}async function vi({packageManager:u,projectAbsolutePath:t}){const s=Eu({packageManager:u,command:"prepare"}),r=rs();r.start("\u{1F4E6} Package installation in progress..."),await ps(s,{cwd:t}),r.stop("\u2705 Package installation completed")}async function Fu({template:u}){const t={template:u,services:[]};{const s=await Je({message:"Enter the project directory path:",placeholder:"./my-agentica-project",validate(i){if(i==="")return"Please enter a directory path";if(i[0]!==".")return"Please enter a relative path.";if(ot(i))return"Directory already exists"}});_e(s)&&ae.exit(0);const r=be(ae.cwd(),s);t.projectAbsolutePath=r}{const s=await ts({message:"Which package manager do you want to use?",initialValue:gu(),options:[{value:"npm",label:"npm"},{value:"pnpm",label:"pnpm"},{value:"yarn",label:`yarn (${pe.blueBright("berry is not supported")})`},{value:"bun",label:"bun"}]});_e(s)&&ae.exit(0),fe.info(`\u{1F4E6} Using ${s} as package manager`),t.packageManager=s}if(t.template==null){const s=await ts({message:"Which project type do you want to start?",options:[{value:"standalone",label:`Standalone ${pe.blueBright("Agent Server")}`},{value:"nodejs",label:`NodeJS ${pe.blueBright("Agent Server")}`},{value:"nestjs",label:`NestJS ${pe.blueBright("Agent Server")}`},{value:"react",label:`React ${pe.blueBright("Application")}`},{value:"react-native",label:`React Native ${pe.blueBright("Application")}`},{value:"nestjs+react",label:`NestJS + React ${pe.blueBright("Agent Server + Client Application")}`},{value:"nodejs+react",label:`NodeJS + React ${pe.blueBright("Agent Server + Client Application")}`}]});_e(s)&&ae.exit(0),t.template=s}if(t.template!=="standalone"){const s=await Je({message:"Server Port(if project is client app, this port mean ws server port):",initialValue:"3000",validate(r){if(Number.isNaN(Number.parseInt(r)))return"Port must be an integer"}});_e(s)&&ae.exit(0),t.port=Number(s)}if(t.template!=="react"){const s=await Ln(),r=s.sort((h,E)=>h.displayName.localeCompare(E.displayName)).map(({displayName:h,serviceName:E})=>({label:h,value:E})),i=await Cn({message:`Which connectors do you want to include? (Press ${pe.cyan("<space>")} to select, ${pe.cyan("<a>")} to select all, ${pe.cyan("<enter>")} to proceed)`,options:r,required:!1});_e(i)&&ae.exit(0),t.services=i;const a=Array.from(new Set(s.filter(h=>i.includes(h.serviceName)).flatMap(h=>h.envList))),e=await es({message:`Do you want to enter environment variables? (Number of environment variables to enter: ${a.length})
|
|
91
|
+
${pe.cyan("If you press <ctrl+c>, you can skip this step.")}`,initialValue:!1}),o=[];if(_e(e)||!e)a.forEach(h=>{o.push({key:h,value:""})}),is("Skipping environment variables input.");else for(let h=0;h<a.length;h++){const E=a[h],y=await Je({message:`${E}: `,defaultValue:""});if(_e(y)){const m=a.splice(h);m.forEach(C=>{o.push({key:C,value:""})}),is(`Skipping environment variables input: ${m.slice(0,3).join(", ")}... (count: ${m.length})`);break}o.push({key:E,value:y})}t.envList=o}{const s=await es({message:"Enter your OpenAI API key?",initialValue:!1});if(_e(s)&&ae.exit(0),s){const r=await Je({message:"Please enter your OPENAI API key:"});_e(r)&&ae.exit(0),t.openAIKey=r}else t.openAIKey=null}try{(()=>{const s=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(E=>typeof E=="string")&&(h.envList===void 0||Array.isArray(h.envList)&&h.envList.every(E=>typeof E=="object"&&E!==null&&r(E))),r=h=>typeof h.key=="string"&&typeof h.value=="string",i=(h,E,y=!0)=>(h.packageManager==="npm"||h.packageManager==="yarn"||h.packageManager==="pnpm"||h.packageManager==="bun"||re._assertGuard(y,{method:"typia.assertGuard",path:E+".packageManager",expected:'("bun" | "npm" | "pnpm" | "yarn")',value:h.packageManager},o))&&(typeof h.projectAbsolutePath=="string"||re._assertGuard(y,{method:"typia.assertGuard",path:E+".projectAbsolutePath",expected:"string",value:h.projectAbsolutePath},o))&&(h.template==="nodejs"||h.template==="nestjs"||h.template==="react"||h.template==="react-native"||h.template==="standalone"||h.template==="nestjs+react"||h.template==="nodejs+react"||re._assertGuard(y,{method:"typia.assertGuard",path:E+".template",expected:'("nestjs" | "nestjs+react" | "nodejs" | "nodejs+react" | "react" | "react-native" | "standalone")',value:h.template},o))&&(h.openAIKey===null||typeof h.openAIKey=="string"||re._assertGuard(y,{method:"typia.assertGuard",path:E+".openAIKey",expected:"(null | string)",value:h.openAIKey},o))&&(h.port===void 0||typeof h.port=="number"||re._assertGuard(y,{method:"typia.assertGuard",path:E+".port",expected:"(number | undefined)",value:h.port},o))&&((Array.isArray(h.services)||re._assertGuard(y,{method:"typia.assertGuard",path:E+".services",expected:"Array<string>",value:h.services},o))&&h.services.every((m,C)=>typeof m=="string"||re._assertGuard(y,{method:"typia.assertGuard",path:E+".services["+C+"]",expected:"string",value:m},o))||re._assertGuard(y,{method:"typia.assertGuard",path:E+".services",expected:"Array<string>",value:h.services},o))&&(h.envList===void 0||(Array.isArray(h.envList)||re._assertGuard(y,{method:"typia.assertGuard",path:E+".envList",expected:"(Array<__type> | undefined)",value:h.envList},o))&&h.envList.every((m,C)=>(typeof m=="object"&&m!==null||re._assertGuard(y,{method:"typia.assertGuard",path:E+".envList["+C+"]",expected:"__type.o1",value:m},o))&&a(m,E+".envList["+C+"]",y)||re._assertGuard(y,{method:"typia.assertGuard",path:E+".envList["+C+"]",expected:"__type.o1",value:m},o))||re._assertGuard(y,{method:"typia.assertGuard",path:E+".envList",expected:"(Array<__type> | undefined)",value:h.envList},o)),a=(h,E,y=!0)=>(typeof h.key=="string"||re._assertGuard(y,{method:"typia.assertGuard",path:E+".key",expected:"string",value:h.key},o))&&(typeof h.value=="string"||re._assertGuard(y,{method:"typia.assertGuard",path:E+".value",expected:"string",value:h.value},o)),e=h=>typeof h=="object"&&h!==null&&s(h);let o;return(h,E)=>{e(h)===!1&&(o=E,((y,m,C=!0)=>(typeof y=="object"&&y!==null||re._assertGuard(!0,{method:"typia.assertGuard",path:m+"",expected:"__type",value:y},o))&&i(y,m+"",!0)||re._assertGuard(!0,{method:"typia.assertGuard",path:m+"",expected:"__type",value:y},o))(h,"$input",!0))}})()(t)}catch(s){throw new Error(`\u274C ${s.toString()}`)}return t}async function yu({projectAbsolutePath:u,context:t}){await je({template:"standalone",project:u}),fe.success("\u2705 Template downloaded");const s=xt(t.services),r=Bt(t.services),i=be(u,"src/index.ts"),a=await at(i,"utf-8"),e=Tt({content:a,importCode:s,connectorCode:r}),o=await Ot(e);await ht(i,o),await Ue({projectPath:u,apiKeys:[{key:"OPENAI_API_KEY",value:t.openAIKey??""},...t.envList??[]]}),fe.success("\u2705 .env created"),await ze({packageManager:t.packageManager,projectAbsolutePath:u,services:t.services}),await vi({packageManager:t.packageManager,projectAbsolutePath:u})}async function gr({projectAbsolutePath:u,context:t}){await je({template:"nodejs",project:u}),fe.success("\u2705 Template downloaded");const s=xt(t.services),r=Bt(t.services),i=be(u,"src/index.ts"),a=await at(i,"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],
|
|
92
|
+
`)),e=Tt({content:a,importCode:s,connectorCode:r}),o=await Ot(e);await ht(i,o),await Ue({projectPath:u,apiKeys:[{key:"OPENAI_API_KEY",value:t.openAIKey??""},{key:"PORT",value:t.port?.toString()??"3000"},...t.envList??[]]}),fe.success("\u2705 .env created"),await ze({packageManager:t.packageManager,projectAbsolutePath:u,services:t.services}),await vi({packageManager:t.packageManager,projectAbsolutePath:u})}async function Cr({projectAbsolutePath:u,context:t}){await je({template:"nestjs",project:u}),fe.success("\u2705 Template downloaded");const s=xt(t.services),r=Bt(t.services),i=be(u,"src/controllers/chat/ChatController.ts"),a=await at(i,"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],
|
|
93
|
+
`)),e=Tt({content:a,importCode:s,connectorCode:r}),o=await Ot(e);await ht(i,o),await Ue({projectPath:u,apiKeys:[{key:"OPENAI_API_KEY",value:t.openAIKey??""},{key:"API_PORT",value:t.port?.toString()??"3000"},...t.envList??[]]}),fe.success("\u2705 .env created"),await ze({packageManager:t.packageManager,projectAbsolutePath:u,services:t.services}),await vi({packageManager:t.packageManager,projectAbsolutePath:u})}async function Ai({projectAbsolutePath:u,context:t}){await je({template:"react",project:u}),fe.success("\u2705 Template downloaded"),await Ue({projectPath:u,apiKeys:[{key:"OPENAI_API_KEY",value:t.openAIKey??""},{key:"VITE_AGENTICA_WS_URL",value:`ws://localhost:${t.port}/chat`}]}),fe.success("\u2705 .env created"),await ze({packageManager:t.packageManager,projectAbsolutePath:u,services:t.services})}async function bu({projectAbsolutePath:u,context:t}){await je({template:"react-native",project:u}),fe.success("\u2705 Template downloaded"),await Ue({projectPath:u,apiKeys:[{key:"OPENAI_API_KEY",value:t.openAIKey??""}]}),fe.success("\u2705 .env created"),await ze({packageManager:t.packageManager,projectAbsolutePath:u,services:t.services})}async function _u({template:u}){ss("Agentica Start Wizard");const t=await Fu({template:u}),{projectAbsolutePath:s}=t;switch(t.template){case"standalone":await yu({projectAbsolutePath:s,context:t});break;case"nodejs":await gr({projectAbsolutePath:s,context:t});break;case"nestjs":await Cr({projectAbsolutePath:s,context:t});break;case"react":await Ai({projectAbsolutePath:s,context:t});break;case"react-native":await bu({projectAbsolutePath:s,context:t});break;case"nestjs+react":await Cr({projectAbsolutePath:be(s,"server"),context:t}),await Ai({projectAbsolutePath:be(s,"client"),context:t});break;case"nodejs+react":await gr({projectAbsolutePath:be(s,"server"),context:t}),await Ai({projectAbsolutePath:be(s,"client"),context:t});break;default:throw t.template,new Error(`\u274C Template ${t.template} not supported`)}Fn(`
|
|
91
94
|
\u{1F389} Project ${s} created
|
|
92
|
-
\u26A0\uFE0F ${
|
|
93
|
-
`)}const
|
|
94
|
-
\u274C The value of ${de.redBright("--project")} is required`);return}if(!(t=>t===void 0||t==="nodejs"||t==="nestjs"||t==="react"||t==="react-native"||t==="standalone"||t==="nestjs+react"||t==="nodejs+react")(u.project)){le.error(`
|
|
95
|
-
\u274C The value of ${de.redBright("--project")} is invalid`);return}ts(`\u{1F680} ${de.blueBright("Agentica")} Setup Wizard`),await Fu({template:u.project})});function bu(){rt.parse(oe.argv)}export{rt as program,bu as run};
|
|
95
|
+
\u26A0\uFE0F ${pe.yellow("Note:")} Please implement constructor values for each controller generated in index.ts
|
|
96
|
+
`)}const wu="0.19.1",nt=new An;nt.version(wu),nt.command("start").description("Start a new project").addOption(new Sn("-p, --project <project>","The project type").choices(Cu)).action(async u=>{ss(`\u{1F680} ${pe.blueBright("Agentica")} Setup Wizard`),await _u({template:u.project})});function vu(){nt.parse(ae.argv)}export{nt as program,vu as run};
|