From 4e0d1f50b7f467df0001de5ab395f3141be7a01b Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Fri, 6 Dec 2024 17:10:37 +0000 Subject: [PATCH] =?UTF-8?q?build(release):=20=F0=9F=9A=80=20v9.0.1-next.1?= =?UTF-8?q?=20=F0=9F=A6=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## [9.0.1-next.1](https://github.com/readmeio/rdme/compare/v9.0.0...v9.0.1-next.1) (2024-12-06) ### Bug Fixes * repository URL fix ([2103a29](https://github.com/readmeio/rdme/commit/2103a294f8382ad60d7aec34c4b5d168ae9e06a4)) [skip ci] --- CHANGELOG.md | 7 +++++++ dist-gha/commands.js | 2 +- package-lock.json | 4 ++-- package.json | 2 +- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 14ccfa465..7cb037131 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## [9.0.1-next.1](https://github.com/readmeio/rdme/compare/v9.0.0...v9.0.1-next.1) (2024-12-06) + + +### Bug Fixes + +* repository URL fix ([2103a29](https://github.com/readmeio/rdme/commit/2103a294f8382ad60d7aec34c4b5d168ae9e06a4)) + # [9.0.0](https://github.com/readmeio/rdme/compare/v8.6.6...v9.0.0) (2024-12-06) diff --git a/dist-gha/commands.js b/dist-gha/commands.js index 5f3925a20..ea2577fad 100644 --- a/dist-gha/commands.js +++ b/dist-gha/commands.js @@ -66,7 +66,7 @@ o[i-4]=this.maskKey[0],o[i-3]=this.maskKey[1],o[i-2]=this.maskKey[2],o[i-1]=this * Copyright(c) 2014 Jonathan Ong * Copyright(c) 2015 Douglas Christopher Wilson * MIT Licensed - */function requireMimeTypes(){return hasRequiredMimeTypes||(hasRequiredMimeTypes=1,function(e){var t=requireMimeDb(),n=require$$0$8.extname,r=/^\s*([^;\s]*)(?:;|\s|$)/,i=/^text\//i;function o(e){if(!e||"string"!=typeof e)return!1;var n=r.exec(e),o=n&&t[n[1].toLowerCase()];return o&&o.charset?o.charset:!(!n||!i.test(n[1]))&&"UTF-8"}e.charset=o,e.charsets={lookup:o},e.contentType=function(t){if(!t||"string"!=typeof t)return!1;var n=-1===t.indexOf("/")?e.lookup(t):t;if(!n)return!1;if(-1===n.indexOf("charset")){var r=e.charset(n);r&&(n+="; charset="+r.toLowerCase())}return n},e.extension=function(t){if(!t||"string"!=typeof t)return!1;var n=r.exec(t),i=n&&e.extensions[n[1].toLowerCase()];if(!i||!i.length)return!1;return i[0]},e.extensions=Object.create(null),e.lookup=function(t){if(!t||"string"!=typeof t)return!1;var r=n("x."+t).toLowerCase().substr(1);if(!r)return!1;return e.types[r]||!1},e.types=Object.create(null),function(e,n){var r=["nginx","apache",void 0,"iana"];Object.keys(t).forEach((function(i){var o=t[i],s=o.extensions;if(s&&s.length){e[i]=s;for(var a=0;au||l===u&&"application/"===n[c].substr(0,12)))continue}n[c]=i}}}))}(e.extensions,e.types)}(mimeTypes)),mimeTypes}var mimeTypesExports=requireMimeTypes(),mime=getDefaultExportFromCjs(mimeTypesExports),undiciExports=requireUndici(),name$1="rdme",version$1="9.0.0",description$3="ReadMe's official CLI and GitHub Action.",license$1="MIT",author$1="ReadMe (https://readme.com)",engines$1={node:">=20.10.0"},bin$1={rdme:"bin/run.js"},files=["/bin/run*","/dist","/oclif.manifest.json"],keywords$1=["api","apidoc","apis","documentation","microservice","oai","oas","openapi","openapi document","openapi initiative","openapi spec","openapi specification","postman","readme","swagger"],repository$1={type:"git",url:"git+https://github.com/readmeio/rdme.git"},bugs$1={url:"https://github.com/readmeio/rdme/issues"},type$d="module",dependencies$3={"@actions/core":"^1.6.0","@oclif/core":"^4.0.29","@oclif/plugin-autocomplete":"^3.2.6","@oclif/plugin-help":"^6.2.15","@oclif/plugin-not-found":"^3.2.28","@oclif/plugin-warn-if-update-available":"^3.1.19",chalk:"^5.3.0","ci-info":"^4.0.0",configstore:"^7.0.0",debug:"^4.3.3","gray-matter":"^4.0.1",ignore:"^6.0.2","mime-types":"^2.1.35",oas:"^25.0.0","oas-normalize":"^11.1.2",open:"^10.0.2",ora:"^8.1.1","parse-link-header":"^2.0.0",pluralize:"^8.0.0",prompts:"^2.4.2",semver:"^7.5.3","simple-git":"^3.19.1","string-argv":"^0.3.2",table:"^6.8.1","tmp-promise":"^3.0.2",toposort:"^2.0.2",undici:"^5.28.4",validator:"^13.7.0"},devDependencies={"@commitlint/cli":"^19.0.3","@commitlint/config-conventional":"^19.0.3","@oclif/test":"^4.1.0","@readme/better-ajv-errors":"^1.5.0","@readme/eslint-config":"^14.0.0","@readme/oas-examples":"^5.10.0","@rollup/plugin-commonjs":"^28.0.0","@rollup/plugin-json":"^6.0.0","@rollup/plugin-node-resolve":"^15.2.1","@rollup/plugin-replace":"^6.0.1","@rollup/plugin-terser":"^0.4.4","@types/configstore":"^6.0.0","@types/debug":"^4.1.7","@types/js-yaml":"^4.0.5","@types/mime-types":"^2.1.1","@types/parse-link-header":"^2.0.0","@types/pluralize":"^0.0.33","@types/prompts":"^2.4.2","@types/semver":"^7.3.12","@types/toposort":"^2.0.7","@types/validator":"^13.7.6","@vitest/coverage-v8":"^2.0.5","@vitest/expect":"^2.0.5",ajv:"^8.11.0",alex:"^11.0.0",eslint:"^8.47.0",husky:"^9.0.10","js-yaml":"^4.1.0",knip:"^5.0.2",nock:"^14.0.0-beta.7",oclif:"^4.15.12","openapi-types":"^12.1.3",prettier:"^3.0.2",rollup:"^4.3.0",tsx:"^4.19.2","type-fest":"^4.3.1",typescript:"^5.1.6",vitest:"^2.0.5"},scripts$1={build:"tsc","build:docs":"oclif readme --multi --output-dir documentation/commands --no-aliases","build:gha":"npm run build && rollup --config","build:gha:prod":"npm run build:gha -- --environment PRODUCTION_BUILD",lint:"alex . && knip && npm run lint:ts && npm run prettier && npm run schemas:check","lint:ts":"eslint . --ext .js,.ts",prebuild:"rm -rf dist/ && rm -f src/package.json && ln package.json src/package.json",prepack:"npm run build",prepare:"husky",pretest:"npm run build",prettier:"prettier --check .","schemas:check":"./bin/json-schema-store.js","schemas:write":"./bin/json-schema-store.js --update",test:"vitest run --coverage",version:"npm run build:gha:prod && oclif manifest && npm run build:docs"},commitlint={extends:["@commitlint/config-conventional"],rules:{"body-max-line-length":[0,"always","Infinity"],"footer-max-line-length":[0,"always","Infinity"],"scope-case":[2,"never","upper-case"]}},oclif={bin:"rdme",dirname:"rdme",commands:{strategy:"explicit",target:"./dist/index.js",identifier:"COMMANDS"},topicSeparator:" ",helpClass:"./dist/lib/help",hooks:{prerun:{target:"./dist/index.js",identifier:"prerun"},createGHA:{target:"./dist/index.js",identifier:"createGHA"}},plugins:["@oclif/plugin-autocomplete","@oclif/plugin-help","@oclif/plugin-not-found","@oclif/plugin-warn-if-update-available"],topics:{categories:{description:"List or create categories in your ReadMe developer hub."},docs:{description:"Sync or prune Guides pages in your ReadMe developer hub."},openapi:{description:"Manage your API definition (e.g., syncing, validation, analysis, conversion, etc.). Supports OpenAPI, Swagger, and Postman collections, in either JSON or YAML formats."},versions:{description:"Manage your documentation versions."}}},prettier="@readme/eslint-config/prettier",pkg={name:name$1,version:version$1,description:description$3,license:license$1,author:author$1,engines:engines$1,bin:bin$1,files:files,keywords:keywords$1,repository:repository$1,bugs:bugs$1,type:type$d,dependencies:dependencies$3,devDependencies:devDependencies,scripts:scripts$1,commitlint:commitlint,oclif:oclif,prettier:prettier};class APIv1Error extends Error{code;constructor(e){let t;t="object"==typeof e&&"object"==typeof e?.error?e.error:e,super(t),this.name="APIv1Error","object"==typeof t?(this.code=t.error,this.message=t?.help?[t.message,"",t.help].join("\n"):t.message,this.name="APIv1Error"):(this.code=t,this.message=t)}}const config={host:"https://dash.readme.com",hub:"https://{project}.readme.io"};var prompts$3={},kleur,hasRequiredKleur,action$1,hasRequiredAction$1,strip$1,hasRequiredStrip$1,src$6,hasRequiredSrc$6,clear$1,hasRequiredClear$1,figures_1$1,hasRequiredFigures$1,style$1,hasRequiredStyle$1,lines$1,hasRequiredLines$1,wrap$1,hasRequiredWrap$1,entriesToDisplay$1,hasRequiredEntriesToDisplay$1,util$4,hasRequiredUtil$4,prompt$1,hasRequiredPrompt$1,text$2,hasRequiredText$2,select$1,hasRequiredSelect$1,toggle$1,hasRequiredToggle$1,datepart$1,hasRequiredDatepart$1,meridiem$1,hasRequiredMeridiem$1,day$1,hasRequiredDay$1,hours$1,hasRequiredHours$1,milliseconds$1,hasRequiredMilliseconds$1,minutes$1,hasRequiredMinutes$1,month$1,hasRequiredMonth$1,seconds$1,hasRequiredSeconds$1,year$1,hasRequiredYear$1,dateparts$1,hasRequiredDateparts$1,date$1,hasRequiredDate$1,number$1,hasRequiredNumber$1,multiselect$1,hasRequiredMultiselect$1,autocomplete$1,hasRequiredAutocomplete$1,autocompleteMultiselect$1,hasRequiredAutocompleteMultiselect$1,confirm$1,hasRequiredConfirm$1,elements$1,hasRequiredElements$1,hasRequiredPrompts$2,dist$6,hasRequiredDist$6;function requireKleur(){if(hasRequiredKleur)return kleur;hasRequiredKleur=1;const{FORCE_COLOR:e,NODE_DISABLE_COLORS:t,TERM:n}=process.env,r={enabled:!t&&"dumb"!==n&&"0"!==e,reset:o(0,0),bold:o(1,22),dim:o(2,22),italic:o(3,23),underline:o(4,24),inverse:o(7,27),hidden:o(8,28),strikethrough:o(9,29),black:o(30,39),red:o(31,39),green:o(32,39),yellow:o(33,39),blue:o(34,39),magenta:o(35,39),cyan:o(36,39),white:o(37,39),gray:o(90,39),grey:o(90,39),bgBlack:o(40,49),bgRed:o(41,49),bgGreen:o(42,49),bgYellow:o(43,49),bgBlue:o(44,49),bgMagenta:o(45,49),bgCyan:o(46,49),bgWhite:o(47,49)};function i(e,t){let n,r=0,i="",o="";for(;r{if(!e.meta||"escape"===e.name){if(e.ctrl){if("a"===e.name)return"first";if("c"===e.name)return"abort";if("d"===e.name)return"abort";if("e"===e.name)return"last";if("g"===e.name)return"reset"}if(t){if("j"===e.name)return"down";if("k"===e.name)return"up"}return"return"===e.name||"enter"===e.name?"submit":"backspace"===e.name?"delete":"delete"===e.name?"deleteForward":"abort"===e.name?"abort":"escape"===e.name?"exit":"tab"===e.name?"next":"pagedown"===e.name?"nextPage":"pageup"===e.name?"prevPage":"home"===e.name?"home":"end"===e.name?"end":"up"===e.name?"up":"down"===e.name?"down":"right"===e.name?"right":"left"===e.name&&"left"}})}function requireStrip$1(){return hasRequiredStrip$1||(hasRequiredStrip$1=1,strip$1=e=>{const t=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PRZcf-ntqry=><~]))"].join("|"),n=new RegExp(t,"g");return"string"==typeof e?e.replace(n,""):e}),strip$1}function requireSrc$6(){if(hasRequiredSrc$6)return src$6;hasRequiredSrc$6=1;const e="[",t={to:(t,n)=>n?`${e}${n+1};${t+1}H`:`${e}${t+1}G`,move(t,n){let r="";return t<0?r+=`${e}${-t}D`:t>0&&(r+=`${e}${t}C`),n<0?r+=`${e}${-n}A`:n>0&&(r+=`${e}${n}B`),r},up:(t=1)=>`${e}${t}A`,down:(t=1)=>`${e}${t}B`,forward:(t=1)=>`${e}${t}C`,backward:(t=1)=>`${e}${t}D`,nextLine:(t=1)=>`${e}E`.repeat(t),prevLine:(t=1)=>`${e}F`.repeat(t),left:`${e}G`,hide:`${e}?25l`,show:`${e}?25h`,save:"7",restore:"8"},n={up:(t=1)=>`${e}S`.repeat(t),down:(t=1)=>`${e}T`.repeat(t)},r={screen:`${e}2J`,up:(t=1)=>`${e}1J`.repeat(t),down:(t=1)=>`${e}J`.repeat(t),line:`${e}2K`,lineEnd:`${e}K`,lineStart:`${e}1K`,lines(e){let n="";for(let r=0;r=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,a=!0,c=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){c=!0,s=e},f:function(){try{a||null==r.return||r.return()}finally{if(c)throw s}}}}function t(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n[...n(e)].length;return clear$1=function(t,n){if(!n)return i.line+o.to(0);let r=0;var a,c=e(t.split(/\r?\n/));try{for(c.s();!(a=c.n()).done;){let e=a.value;r+=1+Math.floor(Math.max(s(e)-1,0)/n)}}catch(e){c.e(e)}finally{c.f()}return i.lines(r)},clear$1}function requireFigures$1(){if(hasRequiredFigures$1)return figures_1$1;hasRequiredFigures$1=1;const e={arrowUp:"↑",arrowDown:"↓",arrowLeft:"←",arrowRight:"→",radioOn:"◉",radioOff:"◯",tick:"✔",cross:"✖",ellipsis:"…",pointerSmall:"›",line:"─",pointer:"❯"},t={arrowUp:e.arrowUp,arrowDown:e.arrowDown,arrowLeft:e.arrowLeft,arrowRight:e.arrowRight,radioOn:"(*)",radioOff:"( )",tick:"√",cross:"×",ellipsis:"...",pointerSmall:"»",line:"─",pointer:">"},n="win32"===process.platform?t:e;return figures_1$1=n}function requireStyle$1(){if(hasRequiredStyle$1)return style$1;hasRequiredStyle$1=1;const e=requireKleur(),t=requireFigures$1(),n=Object.freeze({password:{scale:1,render:e=>"*".repeat(e.length)},emoji:{scale:2,render:e=>"😃".repeat(e.length)},invisible:{scale:0,render:e=>""},default:{scale:1,render:e=>`${e}`}}),r=Object.freeze({aborted:e.red(t.cross),done:e.green(t.tick),exited:e.yellow(t.cross),default:e.cyan("?")});return style$1={styles:n,render:e=>n[e]||n.default,symbols:r,symbol:(e,t,n)=>t?r.aborted:n?r.exited:e?r.done:r.default,delimiter:n=>e.gray(n?t.ellipsis:t.pointerSmall),item:(n,r)=>e.gray(n?r?t.pointerSmall:"+":t.line)},style$1}function requireLines$1(){if(hasRequiredLines$1)return lines$1;hasRequiredLines$1=1;const e=requireStrip$1();return lines$1=function(t,n){let r=String(e(t)||"").split(/\r?\n/);return n?r.map((e=>Math.ceil(e.length/n))).reduce(((e,t)=>e+t)):r.length},lines$1}function requireWrap$1(){return hasRequiredWrap$1||(hasRequiredWrap$1=1,wrap$1=(e,t={})=>{const n=Number.isSafeInteger(parseInt(t.margin))?new Array(parseInt(t.margin)).fill(" ").join(""):t.margin||"",r=t.width;return(e||"").split(/\r?\n/g).map((e=>e.split(/\s+/g).reduce(((e,t)=>(t.length+n.length>=r||e[e.length-1].length+t.length+1{n=n||t;let r=Math.min(t-n,e-Math.floor(n/2));return r<0&&(r=0),{startIndex:r,endIndex:Math.min(r+n,t)}})}function requireUtil$4(){return hasRequiredUtil$4?util$4:(hasRequiredUtil$4=1,util$4={action:requireAction$1(),clear:requireClear$1(),style:requireStyle$1(),strip:requireStrip$1(),figures:requireFigures$1(),lines:requireLines$1(),wrap:requireWrap$1(),entriesToDisplay:requireEntriesToDisplay$1()})}function requirePrompt$1(){if(hasRequiredPrompt$1)return prompt$1;hasRequiredPrompt$1=1;const e=require$$0$m,t=requireUtil$4().action,n=require$$0$c,r=requireSrc$6(),i=r.beep,o=r.cursor,s=requireKleur();return prompt$1=class extends n{constructor(n={}){super(),this.firstRender=!0,this.in=n.stdin||process.stdin,this.out=n.stdout||process.stdout,this.onRender=(n.onRender||(()=>{})).bind(this);const r=e.createInterface({input:this.in,escapeCodeTimeout:50});e.emitKeypressEvents(this.in,r),this.in.isTTY&&this.in.setRawMode(!0);const i=["SelectPrompt","MultiselectPrompt"].indexOf(this.constructor.name)>-1,s=(e,n)=>{let r=t(n,i);!1===r?this._&&this._(e,n):"function"==typeof this[r]?this[r](n):this.bell()};this.close=()=>{this.out.write(o.show),this.in.removeListener("keypress",s),this.in.isTTY&&this.in.setRawMode(!1),r.close(),this.emit(this.aborted?"abort":this.exited?"exit":"submit",this.value),this.closed=!0},this.in.on("keypress",s)}fire(){this.emit("state",{value:this.value,aborted:!!this.aborted,exited:!!this.exited})}bell(){this.out.write(i)}render(){this.onRender(s),this.firstRender&&(this.firstRender=!1)}},prompt$1}function requireText$2(){if(hasRequiredText$2)return text$2;function e(e,t,n,r,i,o,s){try{var a=e[o](s),c=a.value}catch(e){return void n(e)}a.done?t(c):Promise.resolve(c).then(r,i)}function t(t){return function(){var n=this,r=arguments;return new Promise((function(i,o){var s=t.apply(n,r);function a(t){e(s,i,o,a,c,"next",t)}function c(t){e(s,i,o,a,c,"throw",t)}a(void 0)}))}}hasRequiredText$2=1;const n=requireKleur(),r=requirePrompt$1(),i=requireSrc$6(),o=i.erase,s=i.cursor,a=requireUtil$4(),c=a.style,l=a.clear,u=a.lines,d=a.figures;return text$2=class extends r{constructor(e={}){super(e),this.transform=c.render(e.style),this.scale=this.transform.scale,this.msg=e.message,this.initial=e.initial||"",this.validator=e.validate||(()=>!0),this.value="",this.errorMsg=e.error||"Please Enter A Valid Value",this.cursor=Number(!!this.initial),this.cursorOffset=0,this.clear=l("",this.out.columns),this.render()}set value(e){!e&&this.initial?(this.placeholder=!0,this.rendered=n.gray(this.transform.render(this.initial))):(this.placeholder=!1,this.rendered=this.transform.render(e)),this._value=e,this.fire()}get value(){return this._value}reset(){this.value="",this.cursor=Number(!!this.initial),this.cursorOffset=0,this.fire(),this.render()}exit(){this.abort()}abort(){this.value=this.value||this.initial,this.done=this.aborted=!0,this.error=!1,this.red=!1,this.fire(),this.render(),this.out.write("\n"),this.close()}validate(){var e=this;return t((function*(){let t=yield e.validator(e.value);"string"==typeof t&&(e.errorMsg=t,t=!1),e.error=!t}))()}submit(){var e=this;return t((function*(){if(e.value=e.value||e.initial,e.cursorOffset=0,e.cursor=e.rendered.length,yield e.validate(),e.error)return e.red=!0,e.fire(),void e.render();e.done=!0,e.aborted=!1,e.fire(),e.render(),e.out.write("\n"),e.close()}))()}next(){if(!this.placeholder)return this.bell();this.value=this.initial,this.cursor=this.rendered.length,this.fire(),this.render()}moveCursor(e){this.placeholder||(this.cursor=this.cursor+e,this.cursorOffset+=e)}_(e,t){let n=this.value.slice(0,this.cursor),r=this.value.slice(this.cursor);this.value=`${n}${e}${r}`,this.red=!1,this.cursor=this.placeholder?0:n.length+1,this.render()}delete(){if(this.isCursorAtStart())return this.bell();let e=this.value.slice(0,this.cursor-1),t=this.value.slice(this.cursor);this.value=`${e}${t}`,this.red=!1,this.isCursorAtStart()?this.cursorOffset=0:(this.cursorOffset++,this.moveCursor(-1)),this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length||this.placeholder)return this.bell();let e=this.value.slice(0,this.cursor),t=this.value.slice(this.cursor+1);this.value=`${e}${t}`,this.red=!1,this.isCursorAtEnd()?this.cursorOffset=0:this.cursorOffset++,this.render()}first(){this.cursor=0,this.render()}last(){this.cursor=this.value.length,this.render()}left(){if(this.cursor<=0||this.placeholder)return this.bell();this.moveCursor(-1),this.render()}right(){if(this.cursor*this.scale>=this.rendered.length||this.placeholder)return this.bell();this.moveCursor(1),this.render()}isCursorAtStart(){return 0===this.cursor||this.placeholder&&1===this.cursor}isCursorAtEnd(){return this.cursor===this.rendered.length||this.placeholder&&this.cursor===this.rendered.length+1}render(){this.closed||(this.firstRender||(this.outputError&&this.out.write(s.down(u(this.outputError,this.out.columns)-1)+l(this.outputError,this.out.columns)),this.out.write(l(this.outputText,this.out.columns))),super.render(),this.outputError="",this.outputText=[c.symbol(this.done,this.aborted),n.bold(this.msg),c.delimiter(this.done),this.red?n.red(this.rendered):this.rendered].join(" "),this.error&&(this.outputError+=this.errorMsg.split("\n").reduce(((e,t,r)=>e+`\n${r?" ":d.pointerSmall} ${n.red().italic(t)}`),"")),this.out.write(o.line+s.to(0)+this.outputText+s.save+this.outputError+s.restore+s.move(this.cursorOffset,0)))}},text$2}function requireSelect$1(){if(hasRequiredSelect$1)return select$1;hasRequiredSelect$1=1;const e=requireKleur(),t=requirePrompt$1(),n=requireUtil$4(),r=n.style,i=n.clear,o=n.figures,s=n.wrap,a=n.entriesToDisplay,c=requireSrc$6().cursor;return select$1=class extends t{constructor(e={}){super(e),this.msg=e.message,this.hint=e.hint||"- Use arrow-keys. Return to submit.",this.warn=e.warn||"- This option is disabled",this.cursor=e.initial||0,this.choices=e.choices.map(((e,t)=>("string"==typeof e&&(e={title:e,value:t}),{title:e&&(e.title||e.value||e),value:e&&(void 0===e.value?t:e.value),description:e&&e.description,selected:e&&e.selected,disabled:e&&e.disabled}))),this.optionsPerPage=e.optionsPerPage||10,this.value=(this.choices[this.cursor]||{}).value,this.clear=i("",this.out.columns),this.render()}moveCursor(e){this.cursor=e,this.value=this.choices[e].value,this.fire()}reset(){this.moveCursor(0),this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write("\n"),this.close()}submit(){this.selection.disabled?this.bell():(this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write("\n"),this.close())}first(){this.moveCursor(0),this.render()}last(){this.moveCursor(this.choices.length-1),this.render()}up(){0===this.cursor?this.moveCursor(this.choices.length-1):this.moveCursor(this.cursor-1),this.render()}down(){this.cursor===this.choices.length-1?this.moveCursor(0):this.moveCursor(this.cursor+1),this.render()}next(){this.moveCursor((this.cursor+1)%this.choices.length),this.render()}_(e,t){if(" "===e)return this.submit()}get selection(){return this.choices[this.cursor]}render(){if(this.closed)return;this.firstRender?this.out.write(c.hide):this.out.write(i(this.outputText,this.out.columns)),super.render();let t=a(this.cursor,this.choices.length,this.optionsPerPage),n=t.startIndex,l=t.endIndex;if(this.outputText=[r.symbol(this.done,this.aborted),e.bold(this.msg),r.delimiter(!1),this.done?this.selection.title:this.selection.disabled?e.yellow(this.warn):e.gray(this.hint)].join(" "),!this.done){this.outputText+="\n";for(let t=n;t0?o.arrowUp:t===l-1&&l=this.out.columns||c.description.split(/\r?\n/).length>1)&&(a="\n"+s(c.description,{margin:3,width:this.out.columns})))),this.outputText+=`${i} ${r}${e.gray(a)}\n`}}this.out.write(this.outputText)}},select$1}function requireToggle$1(){if(hasRequiredToggle$1)return toggle$1;hasRequiredToggle$1=1;const e=requireKleur(),t=requirePrompt$1(),n=requireUtil$4(),r=n.style,i=n.clear,o=requireSrc$6(),s=o.cursor,a=o.erase;return toggle$1=class extends t{constructor(e={}){super(e),this.msg=e.message,this.value=!!e.initial,this.active=e.active||"on",this.inactive=e.inactive||"off",this.initialValue=this.value,this.render()}reset(){this.value=this.initialValue,this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write("\n"),this.close()}submit(){this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write("\n"),this.close()}deactivate(){if(!1===this.value)return this.bell();this.value=!1,this.render()}activate(){if(!0===this.value)return this.bell();this.value=!0,this.render()}delete(){this.deactivate()}left(){this.deactivate()}right(){this.activate()}down(){this.deactivate()}up(){this.activate()}next(){this.value=!this.value,this.fire(),this.render()}_(e,t){if(" "===e)this.value=!this.value;else if("1"===e)this.value=!0;else{if("0"!==e)return this.bell();this.value=!1}this.render()}render(){this.closed||(this.firstRender?this.out.write(s.hide):this.out.write(i(this.outputText,this.out.columns)),super.render(),this.outputText=[r.symbol(this.done,this.aborted),e.bold(this.msg),r.delimiter(this.done),this.value?this.inactive:e.cyan().underline(this.inactive),e.gray("/"),this.value?e.cyan().underline(this.active):this.active].join(" "),this.out.write(a.line+s.to(0)+this.outputText))}}}function requireDatepart$1(){if(hasRequiredDatepart$1)return datepart$1;hasRequiredDatepart$1=1;class e{constructor({token:e,date:t,parts:n,locales:r}){this.token=e,this.date=t||new Date,this.parts=n||[this],this.locales=r||{}}up(){}down(){}next(){const t=this.parts.indexOf(this);return this.parts.find(((n,r)=>r>t&&n instanceof e))}setTo(e){}prev(){let t=[].concat(this.parts).reverse();const n=t.indexOf(this);return t.find(((t,r)=>r>n&&t instanceof e))}toString(){return String(this.date)}}return datepart$1=e}function requireMeridiem$1(){if(hasRequiredMeridiem$1)return meridiem$1;hasRequiredMeridiem$1=1;const e=requireDatepart$1();return meridiem$1=class extends e{constructor(e={}){super(e)}up(){this.date.setHours((this.date.getHours()+12)%24)}down(){this.up()}toString(){let e=this.date.getHours()>12?"pm":"am";return/\A/.test(this.token)?e.toUpperCase():e}},meridiem$1}function requireDay$1(){if(hasRequiredDay$1)return day$1;hasRequiredDay$1=1;const e=requireDatepart$1();return day$1=class extends e{constructor(e={}){super(e)}up(){this.date.setDate(this.date.getDate()+1)}down(){this.date.setDate(this.date.getDate()-1)}setTo(e){this.date.setDate(parseInt(e.substr(-2)))}toString(){let e=this.date.getDate(),t=this.date.getDay();return"DD"===this.token?String(e).padStart(2,"0"):"Do"===this.token?e+(n=e,1==(n%=10)?"st":2===n?"nd":3===n?"rd":"th"):"d"===this.token?t+1:"ddd"===this.token?this.locales.weekdaysShort[t]:"dddd"===this.token?this.locales.weekdays[t]:e;var n}},day$1}function requireHours$1(){if(hasRequiredHours$1)return hours$1;hasRequiredHours$1=1;const e=requireDatepart$1();return hours$1=class extends e{constructor(e={}){super(e)}up(){this.date.setHours(this.date.getHours()+1)}down(){this.date.setHours(this.date.getHours()-1)}setTo(e){this.date.setHours(parseInt(e.substr(-2)))}toString(){let e=this.date.getHours();return/h/.test(this.token)&&(e=e%12||12),this.token.length>1?String(e).padStart(2,"0"):e}},hours$1}function requireMilliseconds$1(){if(hasRequiredMilliseconds$1)return milliseconds$1;hasRequiredMilliseconds$1=1;const e=requireDatepart$1();return milliseconds$1=class extends e{constructor(e={}){super(e)}up(){this.date.setMilliseconds(this.date.getMilliseconds()+1)}down(){this.date.setMilliseconds(this.date.getMilliseconds()-1)}setTo(e){this.date.setMilliseconds(parseInt(e.substr(-this.token.length)))}toString(){return String(this.date.getMilliseconds()).padStart(4,"0").substr(0,this.token.length)}}}function requireMinutes$1(){if(hasRequiredMinutes$1)return minutes$1;hasRequiredMinutes$1=1;const e=requireDatepart$1();return minutes$1=class extends e{constructor(e={}){super(e)}up(){this.date.setMinutes(this.date.getMinutes()+1)}down(){this.date.setMinutes(this.date.getMinutes()-1)}setTo(e){this.date.setMinutes(parseInt(e.substr(-2)))}toString(){let e=this.date.getMinutes();return this.token.length>1?String(e).padStart(2,"0"):e}}}function requireMonth$1(){if(hasRequiredMonth$1)return month$1;hasRequiredMonth$1=1;const e=requireDatepart$1();return month$1=class extends e{constructor(e={}){super(e)}up(){this.date.setMonth(this.date.getMonth()+1)}down(){this.date.setMonth(this.date.getMonth()-1)}setTo(e){e=parseInt(e.substr(-2))-1,this.date.setMonth(e<0?0:e)}toString(){let e=this.date.getMonth(),t=this.token.length;return 2===t?String(e+1).padStart(2,"0"):3===t?this.locales.monthsShort[e]:4===t?this.locales.months[e]:String(e+1)}},month$1}function requireSeconds$1(){if(hasRequiredSeconds$1)return seconds$1;hasRequiredSeconds$1=1;const e=requireDatepart$1();return seconds$1=class extends e{constructor(e={}){super(e)}up(){this.date.setSeconds(this.date.getSeconds()+1)}down(){this.date.setSeconds(this.date.getSeconds()-1)}setTo(e){this.date.setSeconds(parseInt(e.substr(-2)))}toString(){let e=this.date.getSeconds();return this.token.length>1?String(e).padStart(2,"0"):e}}}function requireYear$1(){if(hasRequiredYear$1)return year$1;hasRequiredYear$1=1;const e=requireDatepart$1();return year$1=class extends e{constructor(e={}){super(e)}up(){this.date.setFullYear(this.date.getFullYear()+1)}down(){this.date.setFullYear(this.date.getFullYear()-1)}setTo(e){this.date.setFullYear(e.substr(-4))}toString(){let e=String(this.date.getFullYear()).padStart(4,"0");return 2===this.token.length?e.substr(-2):e}},year$1}function requireDateparts$1(){return hasRequiredDateparts$1?dateparts$1:(hasRequiredDateparts$1=1,dateparts$1={DatePart:requireDatepart$1(),Meridiem:requireMeridiem$1(),Day:requireDay$1(),Hours:requireHours$1(),Milliseconds:requireMilliseconds$1(),Minutes:requireMinutes$1(),Month:requireMonth$1(),Seconds:requireSeconds$1(),Year:requireYear$1()})}function requireDate$1(){if(hasRequiredDate$1)return date$1;function e(e,t,n,r,i,o,s){try{var a=e[o](s),c=a.value}catch(e){return void n(e)}a.done?t(c):Promise.resolve(c).then(r,i)}function t(t){return function(){var n=this,r=arguments;return new Promise((function(i,o){var s=t.apply(n,r);function a(t){e(s,i,o,a,c,"next",t)}function c(t){e(s,i,o,a,c,"throw",t)}a(void 0)}))}}hasRequiredDate$1=1;const n=requireKleur(),r=requirePrompt$1(),i=requireUtil$4(),o=i.style,s=i.clear,a=i.figures,c=requireSrc$6(),l=c.erase,u=c.cursor,d=requireDateparts$1(),p=d.DatePart,f=d.Meridiem,_=d.Day,m=d.Hours,h=d.Milliseconds,g=d.Minutes,A=d.Month,y=d.Seconds,v=d.Year,b=/\\(.)|"((?:\\["\\]|[^"])+)"|(D[Do]?|d{3,4}|d)|(M{1,4})|(YY(?:YY)?)|([aA])|([Hh]{1,2})|(m{1,2})|(s{1,2})|(S{1,4})|./g,C={1:({token:e})=>e.replace(/\\(.)/g,"$1"),2:e=>new _(e),3:e=>new A(e),4:e=>new v(e),5:e=>new f(e),6:e=>new m(e),7:e=>new g(e),8:e=>new y(e),9:e=>new h(e)},E={months:"January,February,March,April,May,June,July,August,September,October,November,December".split(","),monthsShort:"Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec".split(","),weekdays:"Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday".split(","),weekdaysShort:"Sun,Mon,Tue,Wed,Thu,Fri,Sat".split(",")};return date$1=class extends r{constructor(e={}){super(e),this.msg=e.message,this.cursor=0,this.typed="",this.locales=Object.assign(E,e.locales),this._date=e.initial||new Date,this.errorMsg=e.error||"Please Enter A Valid Value",this.validator=e.validate||(()=>!0),this.mask=e.mask||"YYYY-MM-DD HH:mm:ss",this.clear=s("",this.out.columns),this.render()}get value(){return this.date}get date(){return this._date}set date(e){e&&this._date.setTime(e.getTime())}set mask(e){let t;for(this.parts=[];t=b.exec(e);){let e=t.shift(),n=t.findIndex((e=>null!=e));this.parts.push(n in C?C[n]({token:t[n]||e,date:this.date,parts:this.parts,locales:this.locales}):t[n]||e)}let n=this.parts.reduce(((e,t)=>("string"==typeof t&&"string"==typeof e[e.length-1]?e[e.length-1]+=t:e.push(t),e)),[]);this.parts.splice(0),this.parts.push(...n),this.reset()}moveCursor(e){this.typed="",this.cursor=e,this.fire()}reset(){this.moveCursor(this.parts.findIndex((e=>e instanceof p))),this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write("\n"),this.close()}validate(){var e=this;return t((function*(){let t=yield e.validator(e.value);"string"==typeof t&&(e.errorMsg=t,t=!1),e.error=!t}))()}submit(){var e=this;return t((function*(){if(yield e.validate(),e.error)return e.color="red",e.fire(),void e.render();e.done=!0,e.aborted=!1,e.fire(),e.render(),e.out.write("\n"),e.close()}))()}up(){this.typed="",this.parts[this.cursor].up(),this.render()}down(){this.typed="",this.parts[this.cursor].down(),this.render()}left(){let e=this.parts[this.cursor].prev();if(null==e)return this.bell();this.moveCursor(this.parts.indexOf(e)),this.render()}right(){let e=this.parts[this.cursor].next();if(null==e)return this.bell();this.moveCursor(this.parts.indexOf(e)),this.render()}next(){let e=this.parts[this.cursor].next();this.moveCursor(e?this.parts.indexOf(e):this.parts.findIndex((e=>e instanceof p))),this.render()}_(e){/\d/.test(e)&&(this.typed+=e,this.parts[this.cursor].setTo(this.typed),this.render())}render(){this.closed||(this.firstRender?this.out.write(u.hide):this.out.write(s(this.outputText,this.out.columns)),super.render(),this.outputText=[o.symbol(this.done,this.aborted),n.bold(this.msg),o.delimiter(!1),this.parts.reduce(((e,t,r)=>e.concat(r!==this.cursor||this.done?t:n.cyan().underline(t.toString()))),[]).join("")].join(" "),this.error&&(this.outputText+=this.errorMsg.split("\n").reduce(((e,t,r)=>e+`\n${r?" ":a.pointerSmall} ${n.red().italic(t)}`),"")),this.out.write(l.line+u.to(0)+this.outputText))}},date$1}function requireNumber$1(){if(hasRequiredNumber$1)return number$1;function e(e,t,n,r,i,o,s){try{var a=e[o](s),c=a.value}catch(e){return void n(e)}a.done?t(c):Promise.resolve(c).then(r,i)}function t(t){return function(){var n=this,r=arguments;return new Promise((function(i,o){var s=t.apply(n,r);function a(t){e(s,i,o,a,c,"next",t)}function c(t){e(s,i,o,a,c,"throw",t)}a(void 0)}))}}hasRequiredNumber$1=1;const n=requireKleur(),r=requirePrompt$1(),i=requireSrc$6(),o=i.cursor,s=i.erase,a=requireUtil$4(),c=a.style,l=a.figures,u=a.clear,d=a.lines,p=/[0-9]/,f=e=>void 0!==e,_=(e,t)=>{let n=Math.pow(10,t);return Math.round(e*n)/n};return number$1=class extends r{constructor(e={}){super(e),this.transform=c.render(e.style),this.msg=e.message,this.initial=f(e.initial)?e.initial:"",this.float=!!e.float,this.round=e.round||2,this.inc=e.increment||1,this.min=f(e.min)?e.min:-1/0,this.max=f(e.max)?e.max:1/0,this.errorMsg=e.error||"Please Enter A Valid Value",this.validator=e.validate||(()=>!0),this.color="cyan",this.value="",this.typed="",this.lastHit=0,this.render()}set value(e){e||0===e?(this.placeholder=!1,this.rendered=this.transform.render(`${_(e,this.round)}`),this._value=_(e,this.round)):(this.placeholder=!0,this.rendered=n.gray(this.transform.render(`${this.initial}`)),this._value=""),this.fire()}get value(){return this._value}parse(e){return this.float?parseFloat(e):parseInt(e)}valid(e){return"-"===e||"."===e&&this.float||p.test(e)}reset(){this.typed="",this.value="",this.fire(),this.render()}exit(){this.abort()}abort(){let e=this.value;this.value=""!==e?e:this.initial,this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write("\n"),this.close()}validate(){var e=this;return t((function*(){let t=yield e.validator(e.value);"string"==typeof t&&(e.errorMsg=t,t=!1),e.error=!t}))()}submit(){var e=this;return t((function*(){if(yield e.validate(),e.error)return e.color="red",e.fire(),void e.render();let t=e.value;e.value=""!==t?t:e.initial,e.done=!0,e.aborted=!1,e.error=!1,e.fire(),e.render(),e.out.write("\n"),e.close()}))()}up(){if(this.typed="",""===this.value&&(this.value=this.min-this.inc),this.value>=this.max)return this.bell();this.value+=this.inc,this.color="cyan",this.fire(),this.render()}down(){if(this.typed="",""===this.value&&(this.value=this.min+this.inc),this.value<=this.min)return this.bell();this.value-=this.inc,this.color="cyan",this.fire(),this.render()}delete(){let e=this.value.toString();if(0===e.length)return this.bell();this.value=this.parse(e=e.slice(0,-1))||"",""!==this.value&&this.value1e3&&(this.typed=""),this.typed+=e,this.lastHit=n,this.color="cyan","."===e)return this.fire();this.value=Math.min(this.parse(this.typed),this.max),this.value>this.max&&(this.value=this.max),this.valuee+`\n${r?" ":l.pointerSmall} ${n.red().italic(t)}`),"")),this.out.write(s.line+o.to(0)+this.outputText+o.save+this.outputError+o.restore))}},number$1}function requireMultiselect$1(){if(hasRequiredMultiselect$1)return multiselect$1;hasRequiredMultiselect$1=1;const e=requireKleur(),t=requireSrc$6().cursor,n=requirePrompt$1(),r=requireUtil$4(),i=r.clear,o=r.figures,s=r.style,a=r.wrap,c=r.entriesToDisplay;return multiselect$1=class extends n{constructor(e={}){super(e),this.msg=e.message,this.cursor=e.cursor||0,this.scrollIndex=e.cursor||0,this.hint=e.hint||"",this.warn=e.warn||"- This option is disabled -",this.minSelected=e.min,this.showMinError=!1,this.maxChoices=e.max,this.instructions=e.instructions,this.optionsPerPage=e.optionsPerPage||10,this.value=e.choices.map(((e,t)=>("string"==typeof e&&(e={title:e,value:t}),{title:e&&(e.title||e.value||e),description:e&&e.description,value:e&&(void 0===e.value?t:e.value),selected:e&&e.selected,disabled:e&&e.disabled}))),this.clear=i("",this.out.columns),e.overrideRender||this.render()}reset(){this.value.map((e=>!e.selected)),this.cursor=0,this.fire(),this.render()}selected(){return this.value.filter((e=>e.selected))}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write("\n"),this.close()}submit(){const e=this.value.filter((e=>e.selected));this.minSelected&&e.lengthe.selected)).length>=this.maxChoices)return this.bell();this.value[this.cursor].selected=!0,this.render()}handleSpaceToggle(){const e=this.value[this.cursor];if(e.selected)e.selected=!1,this.render();else{if(e.disabled||this.value.filter((e=>e.selected)).length>=this.maxChoices)return this.bell();e.selected=!0,this.render()}}toggleAll(){if(void 0!==this.maxChoices||this.value[this.cursor].disabled)return this.bell();const e=!this.value[this.cursor].selected;this.value.filter((e=>!e.disabled)).forEach((t=>t.selected=e)),this.render()}_(e,t){if(" "===e)this.handleSpaceToggle();else{if("a"!==e)return this.bell();this.toggleAll()}}renderInstructions(){return void 0===this.instructions||this.instructions?"string"==typeof this.instructions?this.instructions:`\nInstructions:\n ${o.arrowUp}/${o.arrowDown}: Highlight option\n ${o.arrowLeft}/${o.arrowRight}/[space]: Toggle selection\n`+(void 0===this.maxChoices?" a: Toggle all\n":"")+" enter/return: Complete answer":""}renderOption(t,n,r,i){const s=(n.selected?e.green(o.radioOn):o.radioOff)+" "+i+" ";let c,l;return n.disabled?c=t===r?e.gray().underline(n.title):e.strikethrough().gray(n.title):(c=t===r?e.cyan().underline(n.title):n.title,t===r&&n.description&&(l=` - ${n.description}`,(s.length+c.length+l.length>=this.out.columns||n.description.split(/\r?\n/).length>1)&&(l="\n"+a(n.description,{margin:s.length,width:this.out.columns})))),s+c+e.gray(l||"")}paginateOptions(t){if(0===t.length)return e.red("No matches for this query.");let n,r=c(this.cursor,t.length,this.optionsPerPage),i=r.startIndex,s=r.endIndex,a=[];for(let e=i;e0?o.arrowUp:e===s-1&&se.selected)).map((e=>e.title)).join(", ");const t=[e.gray(this.hint),this.renderInstructions()];return this.value[this.cursor].disabled&&t.push(e.yellow(this.warn)),t.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(t.hide),super.render();let n=[s.symbol(this.done,this.aborted),e.bold(this.msg),s.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(n+=e.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1),n+=this.renderOptions(this.value),this.out.write(this.clear+n),this.clear=i(n,this.out.columns)}},multiselect$1}function requireAutocomplete$1(){if(hasRequiredAutocomplete$1)return autocomplete$1;function e(e,t,n,r,i,o,s){try{var a=e[o](s),c=a.value}catch(e){return void n(e)}a.done?t(c):Promise.resolve(c).then(r,i)}hasRequiredAutocomplete$1=1;const t=requireKleur(),n=requirePrompt$1(),r=requireSrc$6(),i=r.erase,o=r.cursor,s=requireUtil$4(),a=s.style,c=s.clear,l=s.figures,u=s.wrap,d=s.entriesToDisplay,p=(e,t)=>e[t]&&(e[t].value||e[t].title||e[t]),f=(e,t)=>e[t]&&(e[t].title||e[t].value||e[t]);return autocomplete$1=class extends n{constructor(e={}){super(e),this.msg=e.message,this.suggest=e.suggest,this.choices=e.choices,this.initial="number"==typeof e.initial?e.initial:((e,t)=>{const n=e.findIndex((e=>e.value===t||e.title===t));return n>-1?n:void 0})(e.choices,e.initial),this.select=this.initial||e.cursor||0,this.i18n={noMatches:e.noMatches||"no matches found"},this.fallback=e.fallback||this.initial,this.clearFirst=e.clearFirst||!1,this.suggestions=[],this.input="",this.limit=e.limit||10,this.cursor=0,this.transform=a.render(e.style),this.scale=this.transform.scale,this.render=this.render.bind(this),this.complete=this.complete.bind(this),this.clear=c("",this.out.columns),this.complete(this.render),this.render()}set fallback(e){this._fb=Number.isSafeInteger(parseInt(e))?parseInt(e):e}get fallback(){let e;return"number"==typeof this._fb?e=this.choices[this._fb]:"string"==typeof this._fb&&(e={title:this._fb}),e||this._fb||{title:this.i18n.noMatches}}moveSelect(e){this.select=e,this.suggestions.length>0?this.value=p(this.suggestions,e):this.value=this.fallback.value,this.fire()}complete(t){var n,r=this;return(n=function*(){const e=r.completing=r.suggest(r.input,r.choices),n=yield e;if(r.completing!==e)return;r.suggestions=n.map(((e,t,n)=>({title:f(n,t),value:p(n,t),description:e.description}))),r.completing=!1;const i=Math.max(n.length-1,0);r.moveSelect(Math.min(i,r.select)),t&&t()},function(){var t=this,r=arguments;return new Promise((function(i,o){var s=n.apply(t,r);function a(t){e(s,i,o,a,c,"next",t)}function c(t){e(s,i,o,a,c,"throw",t)}a(void 0)}))})()}reset(){this.input="",this.complete((()=>{this.moveSelect(void 0!==this.initial?this.initial:0),this.render()})),this.render()}exit(){this.clearFirst&&this.input.length>0?this.reset():(this.done=this.exited=!0,this.aborted=!1,this.fire(),this.render(),this.out.write("\n"),this.close())}abort(){this.done=this.aborted=!0,this.exited=!1,this.fire(),this.render(),this.out.write("\n"),this.close()}submit(){this.done=!0,this.aborted=this.exited=!1,this.fire(),this.render(),this.out.write("\n"),this.close()}_(e,t){let n=this.input.slice(0,this.cursor),r=this.input.slice(this.cursor);this.input=`${n}${e}${r}`,this.cursor=n.length+1,this.complete(this.render),this.render()}delete(){if(0===this.cursor)return this.bell();let e=this.input.slice(0,this.cursor-1),t=this.input.slice(this.cursor);this.input=`${e}${t}`,this.complete(this.render),this.cursor=this.cursor-1,this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length)return this.bell();let e=this.input.slice(0,this.cursor),t=this.input.slice(this.cursor+1);this.input=`${e}${t}`,this.complete(this.render),this.render()}first(){this.moveSelect(0),this.render()}last(){this.moveSelect(this.suggestions.length-1),this.render()}up(){0===this.select?this.moveSelect(this.suggestions.length-1):this.moveSelect(this.select-1),this.render()}down(){this.select===this.suggestions.length-1?this.moveSelect(0):this.moveSelect(this.select+1),this.render()}next(){this.select===this.suggestions.length-1?this.moveSelect(0):this.moveSelect(this.select+1),this.render()}nextPage(){this.moveSelect(Math.min(this.select+this.limit,this.suggestions.length-1)),this.render()}prevPage(){this.moveSelect(Math.max(this.select-this.limit,0)),this.render()}left(){if(this.cursor<=0)return this.bell();this.cursor=this.cursor-1,this.render()}right(){if(this.cursor*this.scale>=this.rendered.length)return this.bell();this.cursor=this.cursor+1,this.render()}renderOption(e,n,r,i){let o,s=r?l.arrowUp:i?l.arrowDown:" ",a=n?t.cyan().underline(e.title):e.title;return s=(n?t.cyan(l.pointer)+" ":" ")+s,e.description&&(o=` - ${e.description}`,(s.length+a.length+o.length>=this.out.columns||e.description.split(/\r?\n/).length>1)&&(o="\n"+u(e.description,{margin:3,width:this.out.columns}))),s+" "+a+t.gray(o||"")}render(){if(this.closed)return;this.firstRender?this.out.write(o.hide):this.out.write(c(this.outputText,this.out.columns)),super.render();let e=d(this.select,this.choices.length,this.limit),n=e.startIndex,r=e.endIndex;if(this.outputText=[a.symbol(this.done,this.aborted,this.exited),t.bold(this.msg),a.delimiter(this.completing),this.done&&this.suggestions[this.select]?this.suggestions[this.select].title:this.rendered=this.transform.render(this.input)].join(" "),!this.done){const e=this.suggestions.slice(n,r).map(((e,t)=>this.renderOption(e,this.select===t+n,0===t&&n>0,t+n===r-1&&re.selected)).length>=this.maxChoices)return this.bell();this.filteredOptions[this.cursor].selected=!0,this.render()}delete(){this.inputValue.length&&(this.inputValue=this.inputValue.substr(0,this.inputValue.length-1),this.updateFilteredOptions())}updateFilteredOptions(){const e=this.filteredOptions[this.cursor];this.filteredOptions=this.value.filter((e=>!this.inputValue||(!("string"!=typeof e.title||!e.title.toLowerCase().includes(this.inputValue.toLowerCase()))||!("string"!=typeof e.value||!e.value.toLowerCase().includes(this.inputValue.toLowerCase())))));const t=this.filteredOptions.findIndex((t=>t===e));this.cursor=t<0?0:t,this.render()}handleSpaceToggle(){const e=this.filteredOptions[this.cursor];if(e.selected)e.selected=!1,this.render();else{if(e.disabled||this.value.filter((e=>e.selected)).length>=this.maxChoices)return this.bell();e.selected=!0,this.render()}}handleInputChange(e){this.inputValue=this.inputValue+e,this.updateFilteredOptions()}_(e,t){" "===e?this.handleSpaceToggle():this.handleInputChange(e)}renderInstructions(){return void 0===this.instructions||this.instructions?"string"==typeof this.instructions?this.instructions:`\nInstructions:\n ${s.arrowUp}/${s.arrowDown}: Highlight option\n ${s.arrowLeft}/${s.arrowRight}/[space]: Toggle selection\n [a,b,c]/delete: Filter choices\n enter/return: Complete answer\n`:""}renderCurrentInput(){return`\nFiltered results for: ${this.inputValue?this.inputValue:e.gray("Enter something to filter")}\n`}renderOption(t,n,r){let i;return i=n.disabled?t===r?e.gray().underline(n.title):e.strikethrough().gray(n.title):t===r?e.cyan().underline(n.title):n.title,(n.selected?e.green(s.radioOn):s.radioOff)+" "+i}renderDoneOrInstructions(){if(this.done)return this.value.filter((e=>e.selected)).map((e=>e.title)).join(", ");const t=[e.gray(this.hint),this.renderInstructions(),this.renderCurrentInput()];return this.filteredOptions.length&&this.filteredOptions[this.cursor].disabled&&t.push(e.yellow(this.warn)),t.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(t.hide),super.render();let n=[o.symbol(this.done,this.aborted),e.bold(this.msg),o.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(n+=e.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1),n+=this.renderOptions(this.filteredOptions),this.out.write(this.clear+n),this.clear=i(n,this.out.columns)}},autocompleteMultiselect$1}function requireConfirm$1(){if(hasRequiredConfirm$1)return confirm$1;hasRequiredConfirm$1=1;const e=requireKleur(),t=requirePrompt$1(),n=requireUtil$4(),r=n.style,i=n.clear,o=requireSrc$6(),s=o.erase,a=o.cursor;return confirm$1=class extends t{constructor(e={}){super(e),this.msg=e.message,this.value=e.initial,this.initialValue=!!e.initial,this.yesMsg=e.yes||"yes",this.yesOption=e.yesOption||"(Y/n)",this.noMsg=e.no||"no",this.noOption=e.noOption||"(y/N)",this.render()}reset(){this.value=this.initialValue,this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write("\n"),this.close()}submit(){this.value=this.value||!1,this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write("\n"),this.close()}_(e,t){return"y"===e.toLowerCase()?(this.value=!0,this.submit()):"n"===e.toLowerCase()?(this.value=!1,this.submit()):this.bell()}render(){this.closed||(this.firstRender?this.out.write(a.hide):this.out.write(i(this.outputText,this.out.columns)),super.render(),this.outputText=[r.symbol(this.done,this.aborted),e.bold(this.msg),r.delimiter(this.done),this.done?this.value?this.yesMsg:this.noMsg:e.gray(this.initialValue?this.yesOption:this.noOption)].join(" "),this.out.write(s.line+a.to(0)+this.outputText))}}}function requireElements$1(){return hasRequiredElements$1?elements$1:(hasRequiredElements$1=1,elements$1={TextPrompt:requireText$2(),SelectPrompt:requireSelect$1(),TogglePrompt:requireToggle$1(),DatePrompt:requireDate$1(),NumberPrompt:requireNumber$1(),MultiselectPrompt:requireMultiselect$1(),AutocompletePrompt:requireAutocomplete$1(),AutocompleteMultiselectPrompt:requireAutocompleteMultiselect$1(),ConfirmPrompt:requireConfirm$1()})}function requirePrompts$2(){return hasRequiredPrompts$2||(hasRequiredPrompts$2=1,function(){const e=prompts$3,t=requireElements$1(),n=e=>e;function r(e,r,i={}){return new Promise(((o,s)=>{const a=new t[e](r),c=i.onAbort||n,l=i.onSubmit||n,u=i.onExit||n;a.on("state",r.onState||n),a.on("submit",(e=>o(l(e)))),a.on("exit",(e=>o(u(e)))),a.on("abort",(e=>s(c(e))))}))}e.text=e=>r("TextPrompt",e),e.password=t=>(t.style="password",e.text(t)),e.invisible=t=>(t.style="invisible",e.text(t)),e.number=e=>r("NumberPrompt",e),e.date=e=>r("DatePrompt",e),e.confirm=e=>r("ConfirmPrompt",e),e.list=e=>{const t=e.separator||",";return r("TextPrompt",e,{onSubmit:e=>e.split(t).map((e=>e.trim()))})},e.toggle=e=>r("TogglePrompt",e),e.select=e=>r("SelectPrompt",e),e.multiselect=e=>{e.choices=[].concat(e.choices||[]);const t=e=>e.filter((e=>e.selected)).map((e=>e.value));return r("MultiselectPrompt",e,{onAbort:t,onSubmit:t})},e.autocompleteMultiselect=e=>{e.choices=[].concat(e.choices||[]);const t=e=>e.filter((e=>e.selected)).map((e=>e.value));return r("AutocompleteMultiselectPrompt",e,{onAbort:t,onSubmit:t})};const i=(e,t)=>Promise.resolve(t.filter((t=>t.title.slice(0,e.length).toLowerCase()===e.toLowerCase())));e.autocomplete=e=>(e.suggest=e.suggest||i,e.choices=[].concat(e.choices||[]),r("AutocompletePrompt",e))}()),prompts$3}function requireDist$6(){if(hasRequiredDist$6)return dist$6;function e(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function t(t){for(var r=1;r=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,a=!0,c=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){c=!0,s=e},f:function(){try{a||null==n.return||n.return()}finally{if(c)throw s}}}}function i(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n{};function u(){return d.apply(this,arguments)}function d(){return d=s((function*(e=[],{onSubmit:n=l,onCancel:i=l}={}){const o={},d=u._override||{};let f,_,m,h,g,A;e=[].concat(e);const y=function(){var e=s((function*(e,t,n=!1){if(n||!e.validate||!0===e.validate(t))return e.format?yield e.format(t,o):t}));return function(t,n){return e.apply(this,arguments)}}();var v,b=r(e);try{for(b.s();!(v=b.n()).done;){_=v.value;var C=_;if(h=C.name,g=C.type,"function"==typeof g&&(g=yield g(f,t({},o),_),_.type=g),g){for(let e in _){if(c.includes(e))continue;let n=_[e];_[e]="function"==typeof n?yield n(f,t({},o),A):n}if(A=_,"string"!=typeof _.message)throw new Error("prompt message is required");var E=_;if(h=E.name,g=E.type,void 0===a[g])throw new Error(`prompt type (${g}) is not defined`);if(void 0===d[_.name]||(f=yield y(_,d[_.name]),void 0===f)){try{f=u._injected?p(u._injected,_.initial):yield a[g](_),o[h]=f=yield y(_,f,!0),m=yield n(_,f,o)}catch(e){m=!(yield i(_,o))}if(m)return o}else o[h]=f}}}catch(e){b.e(e)}finally{b.f()}return o})),d.apply(this,arguments)}function p(e,t){const n=e.shift();if(n instanceof Error)throw n;return void 0===n?t:n}return dist$6=Object.assign(u,{prompt:u,prompts:a,inject:function(e){u._injected=(u._injected||[]).concat(e)},override:function(e){u._override=Object.assign({},e)}})}var prompts$2={},action,hasRequiredAction,strip,hasRequiredStrip,clear,hasRequiredClear,figures_1,hasRequiredFigures,style,hasRequiredStyle,lines,hasRequiredLines,wrap,hasRequiredWrap,entriesToDisplay,hasRequiredEntriesToDisplay,util$3,hasRequiredUtil$3,prompt,hasRequiredPrompt,text$1,hasRequiredText$1,select,hasRequiredSelect,toggle,hasRequiredToggle,datepart,hasRequiredDatepart,meridiem,hasRequiredMeridiem,day,hasRequiredDay,hours,hasRequiredHours,milliseconds,hasRequiredMilliseconds,minutes,hasRequiredMinutes,month,hasRequiredMonth,seconds,hasRequiredSeconds,year,hasRequiredYear,dateparts,hasRequiredDateparts,date,hasRequiredDate,number,hasRequiredNumber,multiselect,hasRequiredMultiselect,autocomplete,hasRequiredAutocomplete,autocompleteMultiselect,hasRequiredAutocompleteMultiselect,confirm,hasRequiredConfirm,elements,hasRequiredElements,hasRequiredPrompts$1,lib$f,hasRequiredLib$e,prompts$1,hasRequiredPrompts;function requireAction(){return hasRequiredAction?action:(hasRequiredAction=1,action=(e,t)=>{if(!e.meta||"escape"===e.name){if(e.ctrl){if("a"===e.name)return"first";if("c"===e.name)return"abort";if("d"===e.name)return"abort";if("e"===e.name)return"last";if("g"===e.name)return"reset"}if(t){if("j"===e.name)return"down";if("k"===e.name)return"up"}return"return"===e.name||"enter"===e.name?"submit":"backspace"===e.name?"delete":"delete"===e.name?"deleteForward":"abort"===e.name?"abort":"escape"===e.name?"exit":"tab"===e.name?"next":"pagedown"===e.name?"nextPage":"pageup"===e.name?"prevPage":"home"===e.name?"home":"end"===e.name?"end":"up"===e.name?"up":"down"===e.name?"down":"right"===e.name?"right":"left"===e.name&&"left"}})}function requireStrip(){return hasRequiredStrip||(hasRequiredStrip=1,strip=e=>{const t=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PRZcf-ntqry=><~]))"].join("|"),n=new RegExp(t,"g");return"string"==typeof e?e.replace(n,""):e}),strip}function requireClear(){if(hasRequiredClear)return clear;hasRequiredClear=1;const e=requireStrip(),{erase:t,cursor:n}=requireSrc$6(),r=t=>[...e(t)].length;return clear=function(e,i){if(!i)return t.line+n.to(0);let o=0;const s=e.split(/\r?\n/);for(let e of s)o+=1+Math.floor(Math.max(r(e)-1,0)/i);return t.lines(o)},clear}function requireFigures(){if(hasRequiredFigures)return figures_1;hasRequiredFigures=1;const e={arrowUp:"↑",arrowDown:"↓",arrowLeft:"←",arrowRight:"→",radioOn:"◉",radioOff:"◯",tick:"✔",cross:"✖",ellipsis:"…",pointerSmall:"›",line:"─",pointer:"❯"},t={arrowUp:e.arrowUp,arrowDown:e.arrowDown,arrowLeft:e.arrowLeft,arrowRight:e.arrowRight,radioOn:"(*)",radioOff:"( )",tick:"√",cross:"×",ellipsis:"...",pointerSmall:"»",line:"─",pointer:">"},n="win32"===process.platform?t:e;return figures_1=n}function requireStyle(){if(hasRequiredStyle)return style;hasRequiredStyle=1;const e=requireKleur(),t=requireFigures(),n=Object.freeze({password:{scale:1,render:e=>"*".repeat(e.length)},emoji:{scale:2,render:e=>"😃".repeat(e.length)},invisible:{scale:0,render:e=>""},default:{scale:1,render:e=>`${e}`}}),r=Object.freeze({aborted:e.red(t.cross),done:e.green(t.tick),exited:e.yellow(t.cross),default:e.cyan("?")});return style={styles:n,render:e=>n[e]||n.default,symbols:r,symbol:(e,t,n)=>t?r.aborted:n?r.exited:e?r.done:r.default,delimiter:n=>e.gray(n?t.ellipsis:t.pointerSmall),item:(n,r)=>e.gray(n?r?t.pointerSmall:"+":t.line)},style}function requireLines(){if(hasRequiredLines)return lines;hasRequiredLines=1;const e=requireStrip();return lines=function(t,n){let r=String(e(t)||"").split(/\r?\n/);return n?r.map((e=>Math.ceil(e.length/n))).reduce(((e,t)=>e+t)):r.length}}function requireWrap(){return hasRequiredWrap||(hasRequiredWrap=1,wrap=(e,t={})=>{const n=Number.isSafeInteger(parseInt(t.margin))?new Array(parseInt(t.margin)).fill(" ").join(""):t.margin||"",r=t.width;return(e||"").split(/\r?\n/g).map((e=>e.split(/\s+/g).reduce(((e,t)=>(t.length+n.length>=r||e[e.length-1].length+t.length+1{n=n||t;let r=Math.min(t-n,e-Math.floor(n/2));return r<0&&(r=0),{startIndex:r,endIndex:Math.min(r+n,t)}})}function requireUtil$3(){return hasRequiredUtil$3?util$3:(hasRequiredUtil$3=1,util$3={action:requireAction(),clear:requireClear(),style:requireStyle(),strip:requireStrip(),figures:requireFigures(),lines:requireLines(),wrap:requireWrap(),entriesToDisplay:requireEntriesToDisplay()})}function requirePrompt(){if(hasRequiredPrompt)return prompt;hasRequiredPrompt=1;const e=require$$0$m,{action:t}=requireUtil$3(),n=require$$0$c,{beep:r,cursor:i}=requireSrc$6(),o=requireKleur();return prompt=class extends n{constructor(n={}){super(),this.firstRender=!0,this.in=n.stdin||process.stdin,this.out=n.stdout||process.stdout,this.onRender=(n.onRender||(()=>{})).bind(this);const r=e.createInterface({input:this.in,escapeCodeTimeout:50});e.emitKeypressEvents(this.in,r),this.in.isTTY&&this.in.setRawMode(!0);const o=["SelectPrompt","MultiselectPrompt"].indexOf(this.constructor.name)>-1,s=(e,n)=>{let r=t(n,o);!1===r?this._&&this._(e,n):"function"==typeof this[r]?this[r](n):this.bell()};this.close=()=>{this.out.write(i.show),this.in.removeListener("keypress",s),this.in.isTTY&&this.in.setRawMode(!1),r.close(),this.emit(this.aborted?"abort":this.exited?"exit":"submit",this.value),this.closed=!0},this.in.on("keypress",s)}fire(){this.emit("state",{value:this.value,aborted:!!this.aborted,exited:!!this.exited})}bell(){this.out.write(r)}render(){this.onRender(o),this.firstRender&&(this.firstRender=!1)}},prompt}function requireText$1(){if(hasRequiredText$1)return text$1;hasRequiredText$1=1;const e=requireKleur(),t=requirePrompt(),{erase:n,cursor:r}=requireSrc$6(),{style:i,clear:o,lines:s,figures:a}=requireUtil$3();return text$1=class extends t{constructor(e={}){super(e),this.transform=i.render(e.style),this.scale=this.transform.scale,this.msg=e.message,this.initial=e.initial||"",this.validator=e.validate||(()=>!0),this.value="",this.errorMsg=e.error||"Please Enter A Valid Value",this.cursor=Number(!!this.initial),this.cursorOffset=0,this.clear=o("",this.out.columns),this.render()}set value(t){!t&&this.initial?(this.placeholder=!0,this.rendered=e.gray(this.transform.render(this.initial))):(this.placeholder=!1,this.rendered=this.transform.render(t)),this._value=t,this.fire()}get value(){return this._value}reset(){this.value="",this.cursor=Number(!!this.initial),this.cursorOffset=0,this.fire(),this.render()}exit(){this.abort()}abort(){this.value=this.value||this.initial,this.done=this.aborted=!0,this.error=!1,this.red=!1,this.fire(),this.render(),this.out.write("\n"),this.close()}async validate(){let e=await this.validator(this.value);"string"==typeof e&&(this.errorMsg=e,e=!1),this.error=!e}async submit(){if(this.value=this.value||this.initial,this.cursorOffset=0,this.cursor=this.rendered.length,await this.validate(),this.error)return this.red=!0,this.fire(),void this.render();this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write("\n"),this.close()}next(){if(!this.placeholder)return this.bell();this.value=this.initial,this.cursor=this.rendered.length,this.fire(),this.render()}moveCursor(e){this.placeholder||(this.cursor=this.cursor+e,this.cursorOffset+=e)}_(e,t){let n=this.value.slice(0,this.cursor),r=this.value.slice(this.cursor);this.value=`${n}${e}${r}`,this.red=!1,this.cursor=this.placeholder?0:n.length+1,this.render()}delete(){if(this.isCursorAtStart())return this.bell();let e=this.value.slice(0,this.cursor-1),t=this.value.slice(this.cursor);this.value=`${e}${t}`,this.red=!1,this.isCursorAtStart()?this.cursorOffset=0:(this.cursorOffset++,this.moveCursor(-1)),this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length||this.placeholder)return this.bell();let e=this.value.slice(0,this.cursor),t=this.value.slice(this.cursor+1);this.value=`${e}${t}`,this.red=!1,this.isCursorAtEnd()?this.cursorOffset=0:this.cursorOffset++,this.render()}first(){this.cursor=0,this.render()}last(){this.cursor=this.value.length,this.render()}left(){if(this.cursor<=0||this.placeholder)return this.bell();this.moveCursor(-1),this.render()}right(){if(this.cursor*this.scale>=this.rendered.length||this.placeholder)return this.bell();this.moveCursor(1),this.render()}isCursorAtStart(){return 0===this.cursor||this.placeholder&&1===this.cursor}isCursorAtEnd(){return this.cursor===this.rendered.length||this.placeholder&&this.cursor===this.rendered.length+1}render(){this.closed||(this.firstRender||(this.outputError&&this.out.write(r.down(s(this.outputError,this.out.columns)-1)+o(this.outputError,this.out.columns)),this.out.write(o(this.outputText,this.out.columns))),super.render(),this.outputError="",this.outputText=[i.symbol(this.done,this.aborted),e.bold(this.msg),i.delimiter(this.done),this.red?e.red(this.rendered):this.rendered].join(" "),this.error&&(this.outputError+=this.errorMsg.split("\n").reduce(((t,n,r)=>t+`\n${r?" ":a.pointerSmall} ${e.red().italic(n)}`),"")),this.out.write(n.line+r.to(0)+this.outputText+r.save+this.outputError+r.restore+r.move(this.cursorOffset,0)))}},text$1}function requireSelect(){if(hasRequiredSelect)return select;hasRequiredSelect=1;const e=requireKleur(),t=requirePrompt(),{style:n,clear:r,figures:i,wrap:o,entriesToDisplay:s}=requireUtil$3(),{cursor:a}=requireSrc$6();return select=class extends t{constructor(e={}){super(e),this.msg=e.message,this.hint=e.hint||"- Use arrow-keys. Return to submit.",this.warn=e.warn||"- This option is disabled",this.cursor=e.initial||0,this.choices=e.choices.map(((e,t)=>("string"==typeof e&&(e={title:e,value:t}),{title:e&&(e.title||e.value||e),value:e&&(void 0===e.value?t:e.value),description:e&&e.description,selected:e&&e.selected,disabled:e&&e.disabled}))),this.optionsPerPage=e.optionsPerPage||10,this.value=(this.choices[this.cursor]||{}).value,this.clear=r("",this.out.columns),this.render()}moveCursor(e){this.cursor=e,this.value=this.choices[e].value,this.fire()}reset(){this.moveCursor(0),this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write("\n"),this.close()}submit(){this.selection.disabled?this.bell():(this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write("\n"),this.close())}first(){this.moveCursor(0),this.render()}last(){this.moveCursor(this.choices.length-1),this.render()}up(){0===this.cursor?this.moveCursor(this.choices.length-1):this.moveCursor(this.cursor-1),this.render()}down(){this.cursor===this.choices.length-1?this.moveCursor(0):this.moveCursor(this.cursor+1),this.render()}next(){this.moveCursor((this.cursor+1)%this.choices.length),this.render()}_(e,t){if(" "===e)return this.submit()}get selection(){return this.choices[this.cursor]}render(){if(this.closed)return;this.firstRender?this.out.write(a.hide):this.out.write(r(this.outputText,this.out.columns)),super.render();let{startIndex:t,endIndex:c}=s(this.cursor,this.choices.length,this.optionsPerPage);if(this.outputText=[n.symbol(this.done,this.aborted),e.bold(this.msg),n.delimiter(!1),this.done?this.selection.title:this.selection.disabled?e.yellow(this.warn):e.gray(this.hint)].join(" "),!this.done){this.outputText+="\n";for(let n=t;n0?i.arrowUp:n===c-1&&c=this.out.columns||l.description.split(/\r?\n/).length>1)&&(a="\n"+o(l.description,{margin:3,width:this.out.columns})))),this.outputText+=`${s} ${r}${e.gray(a)}\n`}}this.out.write(this.outputText)}},select}function requireToggle(){if(hasRequiredToggle)return toggle;hasRequiredToggle=1;const e=requireKleur(),t=requirePrompt(),{style:n,clear:r}=requireUtil$3(),{cursor:i,erase:o}=requireSrc$6();return toggle=class extends t{constructor(e={}){super(e),this.msg=e.message,this.value=!!e.initial,this.active=e.active||"on",this.inactive=e.inactive||"off",this.initialValue=this.value,this.render()}reset(){this.value=this.initialValue,this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write("\n"),this.close()}submit(){this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write("\n"),this.close()}deactivate(){if(!1===this.value)return this.bell();this.value=!1,this.render()}activate(){if(!0===this.value)return this.bell();this.value=!0,this.render()}delete(){this.deactivate()}left(){this.deactivate()}right(){this.activate()}down(){this.deactivate()}up(){this.activate()}next(){this.value=!this.value,this.fire(),this.render()}_(e,t){if(" "===e)this.value=!this.value;else if("1"===e)this.value=!0;else{if("0"!==e)return this.bell();this.value=!1}this.render()}render(){this.closed||(this.firstRender?this.out.write(i.hide):this.out.write(r(this.outputText,this.out.columns)),super.render(),this.outputText=[n.symbol(this.done,this.aborted),e.bold(this.msg),n.delimiter(this.done),this.value?this.inactive:e.cyan().underline(this.inactive),e.gray("/"),this.value?e.cyan().underline(this.active):this.active].join(" "),this.out.write(o.line+i.to(0)+this.outputText))}}}function requireDatepart(){if(hasRequiredDatepart)return datepart;hasRequiredDatepart=1;class e{constructor({token:e,date:t,parts:n,locales:r}){this.token=e,this.date=t||new Date,this.parts=n||[this],this.locales=r||{}}up(){}down(){}next(){const t=this.parts.indexOf(this);return this.parts.find(((n,r)=>r>t&&n instanceof e))}setTo(e){}prev(){let t=[].concat(this.parts).reverse();const n=t.indexOf(this);return t.find(((t,r)=>r>n&&t instanceof e))}toString(){return String(this.date)}}return datepart=e}function requireMeridiem(){if(hasRequiredMeridiem)return meridiem;hasRequiredMeridiem=1;const e=requireDatepart();return meridiem=class extends e{constructor(e={}){super(e)}up(){this.date.setHours((this.date.getHours()+12)%24)}down(){this.up()}toString(){let e=this.date.getHours()>12?"pm":"am";return/\A/.test(this.token)?e.toUpperCase():e}}}function requireDay(){if(hasRequiredDay)return day;hasRequiredDay=1;const e=requireDatepart();return day=class extends e{constructor(e={}){super(e)}up(){this.date.setDate(this.date.getDate()+1)}down(){this.date.setDate(this.date.getDate()-1)}setTo(e){this.date.setDate(parseInt(e.substr(-2)))}toString(){let e=this.date.getDate(),t=this.date.getDay();return"DD"===this.token?String(e).padStart(2,"0"):"Do"===this.token?e+(n=e,1==(n%=10)?"st":2===n?"nd":3===n?"rd":"th"):"d"===this.token?t+1:"ddd"===this.token?this.locales.weekdaysShort[t]:"dddd"===this.token?this.locales.weekdays[t]:e;var n}},day}function requireHours(){if(hasRequiredHours)return hours;hasRequiredHours=1;const e=requireDatepart();return hours=class extends e{constructor(e={}){super(e)}up(){this.date.setHours(this.date.getHours()+1)}down(){this.date.setHours(this.date.getHours()-1)}setTo(e){this.date.setHours(parseInt(e.substr(-2)))}toString(){let e=this.date.getHours();return/h/.test(this.token)&&(e=e%12||12),this.token.length>1?String(e).padStart(2,"0"):e}}}function requireMilliseconds(){if(hasRequiredMilliseconds)return milliseconds;hasRequiredMilliseconds=1;const e=requireDatepart();return milliseconds=class extends e{constructor(e={}){super(e)}up(){this.date.setMilliseconds(this.date.getMilliseconds()+1)}down(){this.date.setMilliseconds(this.date.getMilliseconds()-1)}setTo(e){this.date.setMilliseconds(parseInt(e.substr(-this.token.length)))}toString(){return String(this.date.getMilliseconds()).padStart(4,"0").substr(0,this.token.length)}}}function requireMinutes(){if(hasRequiredMinutes)return minutes;hasRequiredMinutes=1;const e=requireDatepart();return minutes=class extends e{constructor(e={}){super(e)}up(){this.date.setMinutes(this.date.getMinutes()+1)}down(){this.date.setMinutes(this.date.getMinutes()-1)}setTo(e){this.date.setMinutes(parseInt(e.substr(-2)))}toString(){let e=this.date.getMinutes();return this.token.length>1?String(e).padStart(2,"0"):e}}}function requireMonth(){if(hasRequiredMonth)return month;hasRequiredMonth=1;const e=requireDatepart();return month=class extends e{constructor(e={}){super(e)}up(){this.date.setMonth(this.date.getMonth()+1)}down(){this.date.setMonth(this.date.getMonth()-1)}setTo(e){e=parseInt(e.substr(-2))-1,this.date.setMonth(e<0?0:e)}toString(){let e=this.date.getMonth(),t=this.token.length;return 2===t?String(e+1).padStart(2,"0"):3===t?this.locales.monthsShort[e]:4===t?this.locales.months[e]:String(e+1)}}}function requireSeconds(){if(hasRequiredSeconds)return seconds;hasRequiredSeconds=1;const e=requireDatepart();return seconds=class extends e{constructor(e={}){super(e)}up(){this.date.setSeconds(this.date.getSeconds()+1)}down(){this.date.setSeconds(this.date.getSeconds()-1)}setTo(e){this.date.setSeconds(parseInt(e.substr(-2)))}toString(){let e=this.date.getSeconds();return this.token.length>1?String(e).padStart(2,"0"):e}}}function requireYear(){if(hasRequiredYear)return year;hasRequiredYear=1;const e=requireDatepart();return year=class extends e{constructor(e={}){super(e)}up(){this.date.setFullYear(this.date.getFullYear()+1)}down(){this.date.setFullYear(this.date.getFullYear()-1)}setTo(e){this.date.setFullYear(e.substr(-4))}toString(){let e=String(this.date.getFullYear()).padStart(4,"0");return 2===this.token.length?e.substr(-2):e}}}function requireDateparts(){return hasRequiredDateparts?dateparts:(hasRequiredDateparts=1,dateparts={DatePart:requireDatepart(),Meridiem:requireMeridiem(),Day:requireDay(),Hours:requireHours(),Milliseconds:requireMilliseconds(),Minutes:requireMinutes(),Month:requireMonth(),Seconds:requireSeconds(),Year:requireYear()})}function requireDate(){if(hasRequiredDate)return date;hasRequiredDate=1;const e=requireKleur(),t=requirePrompt(),{style:n,clear:r,figures:i}=requireUtil$3(),{erase:o,cursor:s}=requireSrc$6(),{DatePart:a,Meridiem:c,Day:l,Hours:u,Milliseconds:d,Minutes:p,Month:f,Seconds:_,Year:m}=requireDateparts(),h=/\\(.)|"((?:\\["\\]|[^"])+)"|(D[Do]?|d{3,4}|d)|(M{1,4})|(YY(?:YY)?)|([aA])|([Hh]{1,2})|(m{1,2})|(s{1,2})|(S{1,4})|./g,g={1:({token:e})=>e.replace(/\\(.)/g,"$1"),2:e=>new l(e),3:e=>new f(e),4:e=>new m(e),5:e=>new c(e),6:e=>new u(e),7:e=>new p(e),8:e=>new _(e),9:e=>new d(e)},A={months:"January,February,March,April,May,June,July,August,September,October,November,December".split(","),monthsShort:"Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec".split(","),weekdays:"Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday".split(","),weekdaysShort:"Sun,Mon,Tue,Wed,Thu,Fri,Sat".split(",")};return date=class extends t{constructor(e={}){super(e),this.msg=e.message,this.cursor=0,this.typed="",this.locales=Object.assign(A,e.locales),this._date=e.initial||new Date,this.errorMsg=e.error||"Please Enter A Valid Value",this.validator=e.validate||(()=>!0),this.mask=e.mask||"YYYY-MM-DD HH:mm:ss",this.clear=r("",this.out.columns),this.render()}get value(){return this.date}get date(){return this._date}set date(e){e&&this._date.setTime(e.getTime())}set mask(e){let t;for(this.parts=[];t=h.exec(e);){let e=t.shift(),n=t.findIndex((e=>null!=e));this.parts.push(n in g?g[n]({token:t[n]||e,date:this.date,parts:this.parts,locales:this.locales}):t[n]||e)}let n=this.parts.reduce(((e,t)=>("string"==typeof t&&"string"==typeof e[e.length-1]?e[e.length-1]+=t:e.push(t),e)),[]);this.parts.splice(0),this.parts.push(...n),this.reset()}moveCursor(e){this.typed="",this.cursor=e,this.fire()}reset(){this.moveCursor(this.parts.findIndex((e=>e instanceof a))),this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write("\n"),this.close()}async validate(){let e=await this.validator(this.value);"string"==typeof e&&(this.errorMsg=e,e=!1),this.error=!e}async submit(){if(await this.validate(),this.error)return this.color="red",this.fire(),void this.render();this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write("\n"),this.close()}up(){this.typed="",this.parts[this.cursor].up(),this.render()}down(){this.typed="",this.parts[this.cursor].down(),this.render()}left(){let e=this.parts[this.cursor].prev();if(null==e)return this.bell();this.moveCursor(this.parts.indexOf(e)),this.render()}right(){let e=this.parts[this.cursor].next();if(null==e)return this.bell();this.moveCursor(this.parts.indexOf(e)),this.render()}next(){let e=this.parts[this.cursor].next();this.moveCursor(e?this.parts.indexOf(e):this.parts.findIndex((e=>e instanceof a))),this.render()}_(e){/\d/.test(e)&&(this.typed+=e,this.parts[this.cursor].setTo(this.typed),this.render())}render(){this.closed||(this.firstRender?this.out.write(s.hide):this.out.write(r(this.outputText,this.out.columns)),super.render(),this.outputText=[n.symbol(this.done,this.aborted),e.bold(this.msg),n.delimiter(!1),this.parts.reduce(((t,n,r)=>t.concat(r!==this.cursor||this.done?n:e.cyan().underline(n.toString()))),[]).join("")].join(" "),this.error&&(this.outputText+=this.errorMsg.split("\n").reduce(((t,n,r)=>t+`\n${r?" ":i.pointerSmall} ${e.red().italic(n)}`),"")),this.out.write(o.line+s.to(0)+this.outputText))}},date}function requireNumber(){if(hasRequiredNumber)return number;hasRequiredNumber=1;const e=requireKleur(),t=requirePrompt(),{cursor:n,erase:r}=requireSrc$6(),{style:i,figures:o,clear:s,lines:a}=requireUtil$3(),c=/[0-9]/,l=e=>void 0!==e,u=(e,t)=>{let n=Math.pow(10,t);return Math.round(e*n)/n};return number=class extends t{constructor(e={}){super(e),this.transform=i.render(e.style),this.msg=e.message,this.initial=l(e.initial)?e.initial:"",this.float=!!e.float,this.round=e.round||2,this.inc=e.increment||1,this.min=l(e.min)?e.min:-1/0,this.max=l(e.max)?e.max:1/0,this.errorMsg=e.error||"Please Enter A Valid Value",this.validator=e.validate||(()=>!0),this.color="cyan",this.value="",this.typed="",this.lastHit=0,this.render()}set value(t){t||0===t?(this.placeholder=!1,this.rendered=this.transform.render(`${u(t,this.round)}`),this._value=u(t,this.round)):(this.placeholder=!0,this.rendered=e.gray(this.transform.render(`${this.initial}`)),this._value=""),this.fire()}get value(){return this._value}parse(e){return this.float?parseFloat(e):parseInt(e)}valid(e){return"-"===e||"."===e&&this.float||c.test(e)}reset(){this.typed="",this.value="",this.fire(),this.render()}exit(){this.abort()}abort(){let e=this.value;this.value=""!==e?e:this.initial,this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write("\n"),this.close()}async validate(){let e=await this.validator(this.value);"string"==typeof e&&(this.errorMsg=e,e=!1),this.error=!e}async submit(){if(await this.validate(),this.error)return this.color="red",this.fire(),void this.render();let e=this.value;this.value=""!==e?e:this.initial,this.done=!0,this.aborted=!1,this.error=!1,this.fire(),this.render(),this.out.write("\n"),this.close()}up(){if(this.typed="",""===this.value&&(this.value=this.min-this.inc),this.value>=this.max)return this.bell();this.value+=this.inc,this.color="cyan",this.fire(),this.render()}down(){if(this.typed="",""===this.value&&(this.value=this.min+this.inc),this.value<=this.min)return this.bell();this.value-=this.inc,this.color="cyan",this.fire(),this.render()}delete(){let e=this.value.toString();if(0===e.length)return this.bell();this.value=this.parse(e=e.slice(0,-1))||"",""!==this.value&&this.value1e3&&(this.typed=""),this.typed+=e,this.lastHit=n,this.color="cyan","."===e)return this.fire();this.value=Math.min(this.parse(this.typed),this.max),this.value>this.max&&(this.value=this.max),this.valuet+`\n${r?" ":o.pointerSmall} ${e.red().italic(n)}`),"")),this.out.write(r.line+n.to(0)+this.outputText+n.save+this.outputError+n.restore))}},number}function requireMultiselect(){if(hasRequiredMultiselect)return multiselect;hasRequiredMultiselect=1;const e=requireKleur(),{cursor:t}=requireSrc$6(),n=requirePrompt(),{clear:r,figures:i,style:o,wrap:s,entriesToDisplay:a}=requireUtil$3();return multiselect=class extends n{constructor(e={}){super(e),this.msg=e.message,this.cursor=e.cursor||0,this.scrollIndex=e.cursor||0,this.hint=e.hint||"",this.warn=e.warn||"- This option is disabled -",this.minSelected=e.min,this.showMinError=!1,this.maxChoices=e.max,this.instructions=e.instructions,this.optionsPerPage=e.optionsPerPage||10,this.value=e.choices.map(((e,t)=>("string"==typeof e&&(e={title:e,value:t}),{title:e&&(e.title||e.value||e),description:e&&e.description,value:e&&(void 0===e.value?t:e.value),selected:e&&e.selected,disabled:e&&e.disabled}))),this.clear=r("",this.out.columns),e.overrideRender||this.render()}reset(){this.value.map((e=>!e.selected)),this.cursor=0,this.fire(),this.render()}selected(){return this.value.filter((e=>e.selected))}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write("\n"),this.close()}submit(){const e=this.value.filter((e=>e.selected));this.minSelected&&e.lengthe.selected)).length>=this.maxChoices)return this.bell();this.value[this.cursor].selected=!0,this.render()}handleSpaceToggle(){const e=this.value[this.cursor];if(e.selected)e.selected=!1,this.render();else{if(e.disabled||this.value.filter((e=>e.selected)).length>=this.maxChoices)return this.bell();e.selected=!0,this.render()}}toggleAll(){if(void 0!==this.maxChoices||this.value[this.cursor].disabled)return this.bell();const e=!this.value[this.cursor].selected;this.value.filter((e=>!e.disabled)).forEach((t=>t.selected=e)),this.render()}_(e,t){if(" "===e)this.handleSpaceToggle();else{if("a"!==e)return this.bell();this.toggleAll()}}renderInstructions(){return void 0===this.instructions||this.instructions?"string"==typeof this.instructions?this.instructions:`\nInstructions:\n ${i.arrowUp}/${i.arrowDown}: Highlight option\n ${i.arrowLeft}/${i.arrowRight}/[space]: Toggle selection\n`+(void 0===this.maxChoices?" a: Toggle all\n":"")+" enter/return: Complete answer":""}renderOption(t,n,r,o){const a=(n.selected?e.green(i.radioOn):i.radioOff)+" "+o+" ";let c,l;return n.disabled?c=t===r?e.gray().underline(n.title):e.strikethrough().gray(n.title):(c=t===r?e.cyan().underline(n.title):n.title,t===r&&n.description&&(l=` - ${n.description}`,(a.length+c.length+l.length>=this.out.columns||n.description.split(/\r?\n/).length>1)&&(l="\n"+s(n.description,{margin:a.length,width:this.out.columns})))),a+c+e.gray(l||"")}paginateOptions(t){if(0===t.length)return e.red("No matches for this query.");let n,{startIndex:r,endIndex:o}=a(this.cursor,t.length,this.optionsPerPage),s=[];for(let e=r;e0?i.arrowUp:e===o-1&&oe.selected)).map((e=>e.title)).join(", ");const t=[e.gray(this.hint),this.renderInstructions()];return this.value[this.cursor].disabled&&t.push(e.yellow(this.warn)),t.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(t.hide),super.render();let n=[o.symbol(this.done,this.aborted),e.bold(this.msg),o.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(n+=e.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1),n+=this.renderOptions(this.value),this.out.write(this.clear+n),this.clear=r(n,this.out.columns)}},multiselect}function requireAutocomplete(){if(hasRequiredAutocomplete)return autocomplete;hasRequiredAutocomplete=1;const e=requireKleur(),t=requirePrompt(),{erase:n,cursor:r}=requireSrc$6(),{style:i,clear:o,figures:s,wrap:a,entriesToDisplay:c}=requireUtil$3(),l=(e,t)=>e[t]&&(e[t].value||e[t].title||e[t]),u=(e,t)=>e[t]&&(e[t].title||e[t].value||e[t]);return autocomplete=class extends t{constructor(e={}){super(e),this.msg=e.message,this.suggest=e.suggest,this.choices=e.choices,this.initial="number"==typeof e.initial?e.initial:((e,t)=>{const n=e.findIndex((e=>e.value===t||e.title===t));return n>-1?n:void 0})(e.choices,e.initial),this.select=this.initial||e.cursor||0,this.i18n={noMatches:e.noMatches||"no matches found"},this.fallback=e.fallback||this.initial,this.clearFirst=e.clearFirst||!1,this.suggestions=[],this.input="",this.limit=e.limit||10,this.cursor=0,this.transform=i.render(e.style),this.scale=this.transform.scale,this.render=this.render.bind(this),this.complete=this.complete.bind(this),this.clear=o("",this.out.columns),this.complete(this.render),this.render()}set fallback(e){this._fb=Number.isSafeInteger(parseInt(e))?parseInt(e):e}get fallback(){let e;return"number"==typeof this._fb?e=this.choices[this._fb]:"string"==typeof this._fb&&(e={title:this._fb}),e||this._fb||{title:this.i18n.noMatches}}moveSelect(e){this.select=e,this.suggestions.length>0?this.value=l(this.suggestions,e):this.value=this.fallback.value,this.fire()}async complete(e){const t=this.completing=this.suggest(this.input,this.choices),n=await t;if(this.completing!==t)return;this.suggestions=n.map(((e,t,n)=>({title:u(n,t),value:l(n,t),description:e.description}))),this.completing=!1;const r=Math.max(n.length-1,0);this.moveSelect(Math.min(r,this.select)),e&&e()}reset(){this.input="",this.complete((()=>{this.moveSelect(void 0!==this.initial?this.initial:0),this.render()})),this.render()}exit(){this.clearFirst&&this.input.length>0?this.reset():(this.done=this.exited=!0,this.aborted=!1,this.fire(),this.render(),this.out.write("\n"),this.close())}abort(){this.done=this.aborted=!0,this.exited=!1,this.fire(),this.render(),this.out.write("\n"),this.close()}submit(){this.done=!0,this.aborted=this.exited=!1,this.fire(),this.render(),this.out.write("\n"),this.close()}_(e,t){let n=this.input.slice(0,this.cursor),r=this.input.slice(this.cursor);this.input=`${n}${e}${r}`,this.cursor=n.length+1,this.complete(this.render),this.render()}delete(){if(0===this.cursor)return this.bell();let e=this.input.slice(0,this.cursor-1),t=this.input.slice(this.cursor);this.input=`${e}${t}`,this.complete(this.render),this.cursor=this.cursor-1,this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length)return this.bell();let e=this.input.slice(0,this.cursor),t=this.input.slice(this.cursor+1);this.input=`${e}${t}`,this.complete(this.render),this.render()}first(){this.moveSelect(0),this.render()}last(){this.moveSelect(this.suggestions.length-1),this.render()}up(){0===this.select?this.moveSelect(this.suggestions.length-1):this.moveSelect(this.select-1),this.render()}down(){this.select===this.suggestions.length-1?this.moveSelect(0):this.moveSelect(this.select+1),this.render()}next(){this.select===this.suggestions.length-1?this.moveSelect(0):this.moveSelect(this.select+1),this.render()}nextPage(){this.moveSelect(Math.min(this.select+this.limit,this.suggestions.length-1)),this.render()}prevPage(){this.moveSelect(Math.max(this.select-this.limit,0)),this.render()}left(){if(this.cursor<=0)return this.bell();this.cursor=this.cursor-1,this.render()}right(){if(this.cursor*this.scale>=this.rendered.length)return this.bell();this.cursor=this.cursor+1,this.render()}renderOption(t,n,r,i){let o,c=r?s.arrowUp:i?s.arrowDown:" ",l=n?e.cyan().underline(t.title):t.title;return c=(n?e.cyan(s.pointer)+" ":" ")+c,t.description&&(o=` - ${t.description}`,(c.length+l.length+o.length>=this.out.columns||t.description.split(/\r?\n/).length>1)&&(o="\n"+a(t.description,{margin:3,width:this.out.columns}))),c+" "+l+e.gray(o||"")}render(){if(this.closed)return;this.firstRender?this.out.write(r.hide):this.out.write(o(this.outputText,this.out.columns)),super.render();let{startIndex:t,endIndex:s}=c(this.select,this.choices.length,this.limit);if(this.outputText=[i.symbol(this.done,this.aborted,this.exited),e.bold(this.msg),i.delimiter(this.completing),this.done&&this.suggestions[this.select]?this.suggestions[this.select].title:this.rendered=this.transform.render(this.input)].join(" "),!this.done){const n=this.suggestions.slice(t,s).map(((e,n)=>this.renderOption(e,this.select===n+t,0===n&&t>0,n+t===s-1&&se.selected)).length>=this.maxChoices)return this.bell();this.filteredOptions[this.cursor].selected=!0,this.render()}delete(){this.inputValue.length&&(this.inputValue=this.inputValue.substr(0,this.inputValue.length-1),this.updateFilteredOptions())}updateFilteredOptions(){const e=this.filteredOptions[this.cursor];this.filteredOptions=this.value.filter((e=>!this.inputValue||(!("string"!=typeof e.title||!e.title.toLowerCase().includes(this.inputValue.toLowerCase()))||!("string"!=typeof e.value||!e.value.toLowerCase().includes(this.inputValue.toLowerCase())))));const t=this.filteredOptions.findIndex((t=>t===e));this.cursor=t<0?0:t,this.render()}handleSpaceToggle(){const e=this.filteredOptions[this.cursor];if(e.selected)e.selected=!1,this.render();else{if(e.disabled||this.value.filter((e=>e.selected)).length>=this.maxChoices)return this.bell();e.selected=!0,this.render()}}handleInputChange(e){this.inputValue=this.inputValue+e,this.updateFilteredOptions()}_(e,t){" "===e?this.handleSpaceToggle():this.handleInputChange(e)}renderInstructions(){return void 0===this.instructions||this.instructions?"string"==typeof this.instructions?this.instructions:`\nInstructions:\n ${o.arrowUp}/${o.arrowDown}: Highlight option\n ${o.arrowLeft}/${o.arrowRight}/[space]: Toggle selection\n [a,b,c]/delete: Filter choices\n enter/return: Complete answer\n`:""}renderCurrentInput(){return`\nFiltered results for: ${this.inputValue?this.inputValue:e.gray("Enter something to filter")}\n`}renderOption(t,n,r){let i;return i=n.disabled?t===r?e.gray().underline(n.title):e.strikethrough().gray(n.title):t===r?e.cyan().underline(n.title):n.title,(n.selected?e.green(o.radioOn):o.radioOff)+" "+i}renderDoneOrInstructions(){if(this.done)return this.value.filter((e=>e.selected)).map((e=>e.title)).join(", ");const t=[e.gray(this.hint),this.renderInstructions(),this.renderCurrentInput()];return this.filteredOptions.length&&this.filteredOptions[this.cursor].disabled&&t.push(e.yellow(this.warn)),t.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(t.hide),super.render();let n=[i.symbol(this.done,this.aborted),e.bold(this.msg),i.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(n+=e.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1),n+=this.renderOptions(this.filteredOptions),this.out.write(this.clear+n),this.clear=r(n,this.out.columns)}},autocompleteMultiselect}function requireConfirm(){if(hasRequiredConfirm)return confirm;hasRequiredConfirm=1;const e=requireKleur(),t=requirePrompt(),{style:n,clear:r}=requireUtil$3(),{erase:i,cursor:o}=requireSrc$6();return confirm=class extends t{constructor(e={}){super(e),this.msg=e.message,this.value=e.initial,this.initialValue=!!e.initial,this.yesMsg=e.yes||"yes",this.yesOption=e.yesOption||"(Y/n)",this.noMsg=e.no||"no",this.noOption=e.noOption||"(y/N)",this.render()}reset(){this.value=this.initialValue,this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write("\n"),this.close()}submit(){this.value=this.value||!1,this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write("\n"),this.close()}_(e,t){return"y"===e.toLowerCase()?(this.value=!0,this.submit()):"n"===e.toLowerCase()?(this.value=!1,this.submit()):this.bell()}render(){this.closed||(this.firstRender?this.out.write(o.hide):this.out.write(r(this.outputText,this.out.columns)),super.render(),this.outputText=[n.symbol(this.done,this.aborted),e.bold(this.msg),n.delimiter(this.done),this.done?this.value?this.yesMsg:this.noMsg:e.gray(this.initialValue?this.yesOption:this.noOption)].join(" "),this.out.write(i.line+o.to(0)+this.outputText))}}}function requireElements(){return hasRequiredElements?elements:(hasRequiredElements=1,elements={TextPrompt:requireText$1(),SelectPrompt:requireSelect(),TogglePrompt:requireToggle(),DatePrompt:requireDate(),NumberPrompt:requireNumber(),MultiselectPrompt:requireMultiselect(),AutocompletePrompt:requireAutocomplete(),AutocompleteMultiselectPrompt:requireAutocompleteMultiselect(),ConfirmPrompt:requireConfirm()})}function requirePrompts$1(){return hasRequiredPrompts$1||(hasRequiredPrompts$1=1,function(){const e=prompts$2,t=requireElements(),n=e=>e;function r(e,r,i={}){return new Promise(((o,s)=>{const a=new t[e](r),c=i.onAbort||n,l=i.onSubmit||n,u=i.onExit||n;a.on("state",r.onState||n),a.on("submit",(e=>o(l(e)))),a.on("exit",(e=>o(u(e)))),a.on("abort",(e=>s(c(e))))}))}e.text=e=>r("TextPrompt",e),e.password=t=>(t.style="password",e.text(t)),e.invisible=t=>(t.style="invisible",e.text(t)),e.number=e=>r("NumberPrompt",e),e.date=e=>r("DatePrompt",e),e.confirm=e=>r("ConfirmPrompt",e),e.list=e=>{const t=e.separator||",";return r("TextPrompt",e,{onSubmit:e=>e.split(t).map((e=>e.trim()))})},e.toggle=e=>r("TogglePrompt",e),e.select=e=>r("SelectPrompt",e),e.multiselect=e=>{e.choices=[].concat(e.choices||[]);const t=e=>e.filter((e=>e.selected)).map((e=>e.value));return r("MultiselectPrompt",e,{onAbort:t,onSubmit:t})},e.autocompleteMultiselect=e=>{e.choices=[].concat(e.choices||[]);const t=e=>e.filter((e=>e.selected)).map((e=>e.value));return r("AutocompleteMultiselectPrompt",e,{onAbort:t,onSubmit:t})};const i=(e,t)=>Promise.resolve(t.filter((t=>t.title.slice(0,e.length).toLowerCase()===e.toLowerCase())));e.autocomplete=e=>(e.suggest=e.suggest||i,e.choices=[].concat(e.choices||[]),r("AutocompletePrompt",e))}()),prompts$2}function requireLib$e(){if(hasRequiredLib$e)return lib$f;hasRequiredLib$e=1;const e=requirePrompts$1(),t=["suggest","format","onState","validate","onRender","type"],n=()=>{};async function r(o=[],{onSubmit:s=n,onCancel:a=n}={}){const c={},l=r._override||{};let u,d,p,f,_,m;o=[].concat(o);const h=async(e,t,n=!1)=>{if(n||!e.validate||!0===e.validate(t))return e.format?await e.format(t,c):t};for(d of o)if(({name:f,type:_}=d),"function"==typeof _&&(_=await _(u,{...c},d),d.type=_),_){for(let e in d){if(t.includes(e))continue;let n=d[e];d[e]="function"==typeof n?await n(u,{...c},m):n}if(m=d,"string"!=typeof d.message)throw new Error("prompt message is required");if(({name:f,type:_}=d),void 0===e[_])throw new Error(`prompt type (${_}) is not defined`);if(void 0===l[d.name]||(u=await h(d,l[d.name]),void 0===u)){try{u=r._injected?i(r._injected,d.initial):await e[_](d),c[f]=u=await h(d,u,!0),p=await s(d,u,c)}catch(e){p=!await a(d,c)}if(p)return c}else c[f]=u}return c}function i(e,t){const n=e.shift();if(n instanceof Error)throw n;return void 0===n?t:n}return lib$f=Object.assign(r,{prompt:r,prompts:e,inject:function(e){r._injected=(r._injected||[]).concat(e)},override:function(e){r._override=Object.assign({},e)}})}function requirePrompts(){if(hasRequiredPrompts)return prompts$1;return hasRequiredPrompts=1,prompts$1=function(e){e=(Array.isArray(e)?e:e.split(".")).map(Number);let t=0,n=process.versions.node.split(".").map(Number);for(;te[t])return!1;if(e[t]>n[t])return!0}return!1}("8.6.0")?requireDist$6():requireLib$e(),prompts$1}var promptsExports=requirePrompts(),prompts=getDefaultExportFromCjs(promptsExports),dist$5={},src$5={},hasRequiredSrc$5,hasRequiredDist$5;function requireSrc$5(){return hasRequiredSrc$5||(hasRequiredSrc$5=1,function(e){var t=src$5&&src$5.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0});const n=require$$0$7,r=t(requireSrc$8()).default("@kwsites/file-exists");e.exists=function(t,i=e.READABLE){return function(e,t,i){r("checking %s",e);try{const o=n.statSync(e);return o.isFile()&&t?(r("[OK] path represents a file"),!0):o.isDirectory()&&i?(r("[OK] path represents a directory"),!0):(r("[FAIL] path represents something other than a file or directory"),!1)}catch(e){if("ENOENT"===e.code)return r("[FAIL] path is not accessible: %o",e),!1;throw r("[FATAL] %o",e),e}}(t,(i&e.FILE)>0,(i&e.FOLDER)>0)},e.FILE=1,e.FOLDER=2,e.READABLE=e.FILE+e.FOLDER}(src$5)),src$5}function requireDist$5(){return hasRequiredDist$5||(hasRequiredDist$5=1,e=dist$5,Object.defineProperty(e,"__esModule",{value:!0}),function(t){for(var n in t)e.hasOwnProperty(n)||(e[n]=t[n])}(requireSrc$5())),dist$5;var e}var distExports$2=requireDist$5(),dist$4={},hasRequiredDist$4;function requireDist$4(){if(hasRequiredDist$4)return dist$4;function e(){let e,t,n="pending";return{promise:new Promise(((n,r)=>{e=n,t=r})),done(t){"pending"===n&&(n="resolved",e(t))},fail(e){"pending"===n&&(n="rejected",t(e))},get fulfilled(){return"pending"!==n},get status(){return n}}}return hasRequiredDist$4=1,Object.defineProperty(dist$4,"__esModule",{value:!0}),dist$4.createDeferred=dist$4.deferred=void 0,dist$4.deferred=e,dist$4.createDeferred=e,dist$4.default=e,dist$4}var distExports$1=requireDist$4(),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropNames=Object.getOwnPropertyNames,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,t,n)=>t in e?__defProp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,__spreadValues=(e,t)=>{for(var n in t||(t={}))__hasOwnProp.call(t,n)&&__defNormalProp(e,n,t[n]);if(__getOwnPropSymbols)for(var n of __getOwnPropSymbols(t))__propIsEnum.call(t,n)&&__defNormalProp(e,n,t[n]);return e},__spreadProps=(e,t)=>__defProps(e,__getOwnPropDescs(t)),__esm=(e,t)=>function(){return e&&(t=(0,e[__getOwnPropNames(e)[0]])(e=0)),t},__commonJS=(e,t)=>function(){return t||(0,e[__getOwnPropNames(e)[0]])((t={exports:{}}).exports,t),t.exports},__export=(e,t)=>{for(var n in t)__defProp(e,n,{get:t[n],enumerable:!0})},__copyProps=(e,t,n,r)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let i of __getOwnPropNames(t))__hasOwnProp.call(e,i)||i===n||__defProp(e,i,{get:()=>t[i],enumerable:!(r=__getOwnPropDesc(t,i))||r.enumerable});return e},__toCommonJS=e=>__copyProps(__defProp({},"__esModule",{value:!0}),e),__async=(e,t,n)=>new Promise(((r,i)=>{var o=e=>{try{a(n.next(e))}catch(e){i(e)}},s=e=>{try{a(n.throw(e))}catch(e){i(e)}},a=e=>e.done?r(e.value):Promise.resolve(e.value).then(o,s);a((n=n.apply(e,t)).next())})),cache;function pathspec(...e){const t=new String(e);return cache.set(t,e),t}function isPathSpec(e){return e instanceof String&&cache.has(e)}function toPaths(e){return cache.get(e)||[]}var init_pathspec=__esm({"src/lib/args/pathspec.ts"(){cache=new WeakMap}}),GitError,init_git_error=__esm({"src/lib/errors/git-error.ts"(){GitError=class extends Error{constructor(e,t){super(t),this.task=e,Object.setPrototypeOf(this,new.target.prototype)}}}}),GitResponseError,init_git_response_error=__esm({"src/lib/errors/git-response-error.ts"(){init_git_error(),GitResponseError=class extends GitError{constructor(e,t){super(void 0,t||String(e)),this.git=e}}}}),TaskConfigurationError,init_task_configuration_error=__esm({"src/lib/errors/task-configuration-error.ts"(){init_git_error(),TaskConfigurationError=class extends GitError{constructor(e){super(void 0,e)}}}}),NULL,NOOP$1,objectToString;function asFunction(e){return"function"==typeof e?e:NOOP$1}function isUserFunction(e){return"function"==typeof e&&e!==NOOP$1}function splitOn(e,t){const n=e.indexOf(t);return n<=0?[e,""]:[e.substr(0,n),e.substr(n+1)]}function first(e,t=0){return isArrayLike(e)&&e.length>t?e[t]:void 0}function last(e,t=0){if(isArrayLike(e)&&e.length>t)return e[e.length-1-t]}function isArrayLike(e){return!(!e||"number"!=typeof e.length)}function toLinesWithContent(e="",t=!0,n="\n"){return e.split(n).reduce(((e,n)=>{const r=t?n.trim():n;return r&&e.push(r),e}),[])}function forEachLineWithContent(e,t){return toLinesWithContent(e,!0).map((e=>t(e)))}function folderExists(e){return distExports$2.exists(e,distExports$2.FOLDER)}function append(e,t){return Array.isArray(e)?e.includes(t)||e.push(t):e.add(t),t}function including(e,t){return Array.isArray(e)&&!e.includes(t)&&e.push(t),e}function remove(e,t){if(Array.isArray(e)){const n=e.indexOf(t);n>=0&&e.splice(n,1)}else e.delete(t);return t}function asArray(e){return Array.isArray(e)?e:[e]}function asCamelCase(e){return e.replace(/[\s-]+(.)/g,((e,t)=>t.toUpperCase()))}function asStringArray(e){return asArray(e).map(String)}function asNumber(e,t=0){if(null==e)return t;const n=parseInt(e,10);return isNaN(n)?t:n}function prefixedArray(e,t){const n=[];for(let r=0,i=e.length;rt in e?{[t]:e[t]}:{})))}function delay(e=0){return new Promise((t=>setTimeout(t,e)))}function orVoid(e){if(!1!==e)return e}var init_util=__esm({"src/lib/utils/util.ts"(){NULL="\0",NOOP$1=()=>{},objectToString=Object.prototype.toString.call.bind(Object.prototype.toString)}}),filterArray,filterString,filterStringArray,filterStringOrStringArray,filterHasLength;function filterType(e,t,n){return t(e)?e:arguments.length>2?n:void 0}function filterPrimitives(e,t){const n=isPathSpec(e)?"string":typeof e;return/number|string|boolean/.test(n)&&(!t||!t.includes(n))}function filterPlainObject(e){return!!e&&"[object Object]"===objectToString(e)}function filterFunction(e){return"function"==typeof e}var init_argument_filters=__esm({"src/lib/utils/argument-filters.ts"(){init_util(),init_pathspec(),filterArray=e=>Array.isArray(e),filterString=e=>"string"==typeof e,filterStringArray=e=>Array.isArray(e)&&e.every(filterString),filterStringOrStringArray=e=>filterString(e)||Array.isArray(e)&&e.every(filterString),filterHasLength=e=>null!=e&&!"number|boolean|function".includes(typeof e)&&(Array.isArray(e)||"string"==typeof e||"number"==typeof e.length)}}),ExitCodes,init_exit_codes=__esm({"src/lib/utils/exit-codes.ts"(){ExitCodes=(e=>(e[e.SUCCESS=0]="SUCCESS",e[e.ERROR=1]="ERROR",e[e.NOT_FOUND=-2]="NOT_FOUND",e[e.UNCLEAN=128]="UNCLEAN",e))(ExitCodes||{})}}),GitOutputStreams,init_git_output_streams=__esm({"src/lib/utils/git-output-streams.ts"(){GitOutputStreams=class{constructor(e,t){this.stdOut=e,this.stdErr=t}asStrings(){return new GitOutputStreams(this.stdOut.toString("utf8"),this.stdErr.toString("utf8"))}}}}),LineParser,RemoteLineParser,init_line_parser=__esm({"src/lib/utils/line-parser.ts"(){LineParser=class{constructor(e,t){this.matches=[],this.parse=(e,t)=>(this.resetMatches(),!!this._regExp.every(((t,n)=>this.addMatch(t,n,e(n))))&&!1!==this.useMatches(t,this.prepareMatches())),this._regExp=Array.isArray(e)?e:[e],t&&(this.useMatches=t)}useMatches(e,t){throw new Error("LineParser:useMatches not implemented")}resetMatches(){this.matches.length=0}prepareMatches(){return this.matches}addMatch(e,t,n){const r=n&&e.exec(n);return r&&this.pushMatch(t,r),!!r}pushMatch(e,t){this.matches.push(...t.slice(1))}},RemoteLineParser=class extends LineParser{addMatch(e,t,n){return/^remote:\s/.test(String(n))&&super.addMatch(e,t,n)}pushMatch(e,t){(e>0||t.length>1)&&super.pushMatch(e,t)}}}}),defaultOptions;function createInstanceConfig(...e){const t=process.cwd(),n=Object.assign(__spreadValues({baseDir:t},defaultOptions),...e.filter((e=>"object"==typeof e&&e)));return n.baseDir=n.baseDir||t,n.trimmed=!0===n.trimmed,n}var init_simple_git_options=__esm({"src/lib/utils/simple-git-options.ts"(){defaultOptions={binary:"git",maxConcurrentProcesses:5,config:[],trimmed:!1}}});function appendTaskOptions(e,t=[]){return filterPlainObject(e)?Object.keys(e).reduce(((t,n)=>{const r=e[n];return isPathSpec(r)?t.push(r):filterPrimitives(r,["boolean"])?t.push(n+"="+r):t.push(n),t}),t):t}function getTrailingOptions(e,t=0,n=!1){const r=[];for(let n=0,i=t<0?e.length:t;n{for(let i=toLinesWithContent(n,r),o=0,s=i.length;o{if(!(o+e>=s))return i[o+e]};t.some((({parse:t})=>t(n,e)))}})),e}var init_task_parser=__esm({"src/lib/utils/task-parser.ts"(){init_util()}}),utils_exports={};__export(utils_exports,{ExitCodes:()=>ExitCodes,GitOutputStreams:()=>GitOutputStreams,LineParser:()=>LineParser,NOOP:()=>NOOP$1,NULL:()=>NULL,RemoteLineParser:()=>RemoteLineParser,append:()=>append,appendTaskOptions:()=>appendTaskOptions,asArray:()=>asArray,asCamelCase:()=>asCamelCase,asFunction:()=>asFunction,asNumber:()=>asNumber,asStringArray:()=>asStringArray,bufferToString:()=>bufferToString,callTaskParser:()=>callTaskParser,createInstanceConfig:()=>createInstanceConfig,delay:()=>delay,filterArray:()=>filterArray,filterFunction:()=>filterFunction,filterHasLength:()=>filterHasLength,filterPlainObject:()=>filterPlainObject,filterPrimitives:()=>filterPrimitives,filterString:()=>filterString,filterStringArray:()=>filterStringArray,filterStringOrStringArray:()=>filterStringOrStringArray,filterType:()=>filterType,first:()=>first,folderExists:()=>folderExists,forEachLineWithContent:()=>forEachLineWithContent,getTrailingOptions:()=>getTrailingOptions,including:()=>including,isUserFunction:()=>isUserFunction,last:()=>last,objectToString:()=>objectToString,orVoid:()=>orVoid,parseStringResponse:()=>parseStringResponse,pick:()=>pick,prefixedArray:()=>prefixedArray,remove:()=>remove,splitOn:()=>splitOn,toLinesWithContent:()=>toLinesWithContent,trailingFunctionArgument:()=>trailingFunctionArgument,trailingOptionsArgument:()=>trailingOptionsArgument});var init_utils=__esm({"src/lib/utils/index.ts"(){init_argument_filters(),init_exit_codes(),init_git_output_streams(),init_line_parser(),init_simple_git_options(),init_task_options(),init_task_parser(),init_util()}}),check_is_repo_exports={},CheckRepoActions,onError,parser;function checkIsRepoTask(e){switch(e){case"bare":return checkIsBareRepoTask();case"root":return checkIsRepoRootTask()}return{commands:["rev-parse","--is-inside-work-tree"],format:"utf-8",onError:onError,parser:parser}}function checkIsRepoRootTask(){return{commands:["rev-parse","--git-dir"],format:"utf-8",onError:onError,parser:e=>/^\.(git)?$/.test(e.trim())}}function checkIsBareRepoTask(){return{commands:["rev-parse","--is-bare-repository"],format:"utf-8",onError:onError,parser:parser}}function isNotRepoMessage(e){return/(Not a git repository|Kein Git-Repository)/i.test(String(e))}__export(check_is_repo_exports,{CheckRepoActions:()=>CheckRepoActions,checkIsBareRepoTask:()=>checkIsBareRepoTask,checkIsRepoRootTask:()=>checkIsRepoRootTask,checkIsRepoTask:()=>checkIsRepoTask});var init_check_is_repo=__esm({"src/lib/tasks/check-is-repo.ts"(){init_utils(),CheckRepoActions=(e=>(e.BARE="bare",e.IN_TREE="tree",e.IS_REPO_ROOT="root",e))(CheckRepoActions||{}),onError=({exitCode:e},t,n,r)=>{if(128===e&&isNotRepoMessage(t))return n(Buffer.from("false"));r(t)},parser=e=>"true"===e.trim()}}),CleanResponse,removalRegexp,dryRunRemovalRegexp,isFolderRegexp;function cleanSummaryParser(e,t){const n=new CleanResponse(e),r=e?dryRunRemovalRegexp:removalRegexp;return toLinesWithContent(t).forEach((e=>{const t=e.replace(r,"");n.paths.push(t),(isFolderRegexp.test(t)?n.folders:n.files).push(t)})),n}var init_CleanSummary=__esm({"src/lib/responses/CleanSummary.ts"(){init_utils(),CleanResponse=class{constructor(e){this.dryRun=e,this.paths=[],this.files=[],this.folders=[]}},removalRegexp=/^[a-z]+\s*/i,dryRunRemovalRegexp=/^[a-z]+\s+[a-z]+\s*/i,isFolderRegexp=/\/$/}}),task_exports={},EMPTY_COMMANDS;function adhocExecTask(e){return{commands:EMPTY_COMMANDS,format:"empty",parser:e}}function configurationErrorTask(e){return{commands:EMPTY_COMMANDS,format:"empty",parser(){throw"string"==typeof e?new TaskConfigurationError(e):e}}}function straightThroughStringTask(e,t=!1){return{commands:e,format:"utf-8",parser:e=>t?String(e).trim():e}}function straightThroughBufferTask(e){return{commands:e,format:"buffer",parser:e=>e}}function isBufferTask(e){return"buffer"===e.format}function isEmptyTask(e){return"empty"===e.format||!e.commands.length}__export(task_exports,{EMPTY_COMMANDS:()=>EMPTY_COMMANDS,adhocExecTask:()=>adhocExecTask,configurationErrorTask:()=>configurationErrorTask,isBufferTask:()=>isBufferTask,isEmptyTask:()=>isEmptyTask,straightThroughBufferTask:()=>straightThroughBufferTask,straightThroughStringTask:()=>straightThroughStringTask});var init_task=__esm({"src/lib/tasks/task.ts"(){init_task_configuration_error(),EMPTY_COMMANDS=[]}}),clean_exports={},CONFIG_ERROR_INTERACTIVE_MODE,CONFIG_ERROR_MODE_REQUIRED,CONFIG_ERROR_UNKNOWN_OPTION,CleanOptions,CleanOptionValues;function cleanWithOptionsTask(e,t){const{cleanMode:n,options:r,valid:i}=getCleanOptions(e);return n?i.options?(r.push(...t),r.some(isInteractiveMode)?configurationErrorTask(CONFIG_ERROR_INTERACTIVE_MODE):cleanTask(n,r)):configurationErrorTask(CONFIG_ERROR_UNKNOWN_OPTION+JSON.stringify(e)):configurationErrorTask(CONFIG_ERROR_MODE_REQUIRED)}function cleanTask(e,t){return{commands:["clean",`-${e}`,...t],format:"utf-8",parser:t=>cleanSummaryParser("n"===e,t)}}function isCleanOptionsArray(e){return Array.isArray(e)&&e.every((e=>CleanOptionValues.has(e)))}function getCleanOptions(e){let t,n=[],r={cleanMode:!1,options:!0};return e.replace(/[^a-z]i/g,"").split("").forEach((e=>{isCleanMode(e)?(t=e,r.cleanMode=!0):r.options=r.options&&isKnownOption(n[n.length]=`-${e}`)})),{cleanMode:t,options:n,valid:r}}function isCleanMode(e){return"f"===e||"n"===e}function isKnownOption(e){return/^-[a-z]$/i.test(e)&&CleanOptionValues.has(e.charAt(1))}function isInteractiveMode(e){return/^-[^\-]/.test(e)?e.indexOf("i")>0:"--interactive"===e}__export(clean_exports,{CONFIG_ERROR_INTERACTIVE_MODE:()=>CONFIG_ERROR_INTERACTIVE_MODE,CONFIG_ERROR_MODE_REQUIRED:()=>CONFIG_ERROR_MODE_REQUIRED,CONFIG_ERROR_UNKNOWN_OPTION:()=>CONFIG_ERROR_UNKNOWN_OPTION,CleanOptions:()=>CleanOptions,cleanTask:()=>cleanTask,cleanWithOptionsTask:()=>cleanWithOptionsTask,isCleanOptionsArray:()=>isCleanOptionsArray});var init_clean=__esm({"src/lib/tasks/clean.ts"(){init_CleanSummary(),init_utils(),init_task(),CONFIG_ERROR_INTERACTIVE_MODE="Git clean interactive mode is not supported",CONFIG_ERROR_MODE_REQUIRED='Git clean mode parameter ("n" or "f") is required',CONFIG_ERROR_UNKNOWN_OPTION="Git clean unknown option found in: ",CleanOptions=(e=>(e.DRY_RUN="n",e.FORCE="f",e.IGNORED_INCLUDED="x",e.IGNORED_ONLY="X",e.EXCLUDING="e",e.QUIET="q",e.RECURSIVE="d",e))(CleanOptions||{}),CleanOptionValues=new Set(["i",...asStringArray(Object.values(CleanOptions))])}}),ConfigList;function configListParser(e){const t=new ConfigList;for(const n of configParser(e))t.addValue(n.file,String(n.key),n.value);return t}function configGetParser(e,t){let n=null;const r=[],i=new Map;for(const o of configParser(e,t))o.key===t&&(r.push(n=o.value),i.has(o.file)||i.set(o.file,[]),i.get(o.file).push(n));return{key:t,paths:Array.from(i.keys()),scopes:i,value:n,values:r}}function configFilePath(e){return e.replace(/^(file):/,"")}function*configParser(e,t=null){const n=e.split("\0");for(let e=0,r=n.length-1;eObject.assign(e,this.values[t])),{})),this._all}addFile(e){if(!(e in this.values)){const t=last(this.files);this.values[e]=t?Object.create(this.values[t]):{},this.files.push(e)}return this.values[e]}addValue(e,t,n){const r=this.addFile(e);r.hasOwnProperty(t)?Array.isArray(r[t])?r[t].push(n):r[t]=[r[t],n]:r[t]=n,this._all=void 0}}}}),GitConfigScope;function asConfigScope(e,t){return"string"==typeof e&&GitConfigScope.hasOwnProperty(e)?e:t}function addConfigTask(e,t,n,r){const i=["config",`--${r}`];return n&&i.push("--add"),i.push(e,t),{commands:i,format:"utf-8",parser:e=>e}}function getConfigTask(e,t){const n=["config","--null","--show-origin","--get-all",e];return t&&n.splice(1,0,`--${t}`),{commands:n,format:"utf-8",parser:t=>configGetParser(t,e)}}function listConfigTask(e){const t=["config","--list","--show-origin","--null"];return e&&t.push(`--${e}`),{commands:t,format:"utf-8",parser:e=>configListParser(e)}}function config_default(){return{addConfig(e,t,...n){return this._runTask(addConfigTask(e,t,!0===n[0],asConfigScope(n[1],"local")),trailingFunctionArgument(arguments))},getConfig(e,t){return this._runTask(getConfigTask(e,asConfigScope(t,void 0)),trailingFunctionArgument(arguments))},listConfig(...e){return this._runTask(listConfigTask(asConfigScope(e[0],void 0)),trailingFunctionArgument(arguments))}}}var init_config=__esm({"src/lib/tasks/config.ts"(){init_ConfigList(),init_utils(),GitConfigScope=(e=>(e.system="system",e.global="global",e.local="local",e.worktree="worktree",e))(GitConfigScope||{})}}),DiffNameStatus,diffNameStatus;function isDiffNameStatus(e){return diffNameStatus.has(e)}var init_diff_name_status=__esm({"src/lib/tasks/diff-name-status.ts"(){DiffNameStatus=(e=>(e.ADDED="A",e.COPIED="C",e.DELETED="D",e.MODIFIED="M",e.RENAMED="R",e.CHANGED="T",e.UNMERGED="U",e.UNKNOWN="X",e.BROKEN="B",e))(DiffNameStatus||{}),diffNameStatus=new Set(Object.values(DiffNameStatus))}}),disallowedOptions,Query,_a,GrepQuery;function grepQueryBuilder(...e){return(new GrepQuery).param(...e)}function parseGrep(e){const t=new Set,n={};return forEachLineWithContent(e,(e=>{const[r,i,o]=e.split(NULL);t.add(r),(n[r]=n[r]||[]).push({line:asNumber(i),path:r,preview:o})})),{paths:t,results:n}}function grep_default(){return{grep(e){const t=trailingFunctionArgument(arguments),n=getTrailingOptions(arguments);for(const e of disallowedOptions)if(n.includes(e))return this._runTask(configurationErrorTask(`git.grep: use of "${e}" is not supported.`),t);"string"==typeof e&&(e=grepQueryBuilder().param(e));const r=["grep","--null","-n","--full-name",...n,...e];return this._runTask({commands:r,format:"utf-8",parser:e=>parseGrep(e)},t)}}}var init_grep=__esm({"src/lib/tasks/grep.ts"(){init_utils(),init_task(),disallowedOptions=["-h"],Query=Symbol("grepQuery"),GrepQuery=class{constructor(){this[_a]=[]}*[(_a=Query,Symbol.iterator)](){for(const e of this[Query])yield e}and(...e){return e.length&&this[Query].push("--and","(",...prefixedArray(e,"-e"),")"),this}param(...e){return this[Query].push(...prefixedArray(e,"-e")),this}}}}),reset_exports={},ResetMode,ResetModes;function resetTask(e,t){const n=["reset"];return isValidResetMode(e)&&n.push(`--${e}`),n.push(...t),straightThroughStringTask(n)}function getResetMode(e){if(isValidResetMode(e))return e;switch(typeof e){case"string":case"undefined":return"soft"}}function isValidResetMode(e){return ResetModes.includes(e)}__export(reset_exports,{ResetMode:()=>ResetMode,getResetMode:()=>getResetMode,resetTask:()=>resetTask});var init_reset=__esm({"src/lib/tasks/reset.ts"(){init_task(),ResetMode=(e=>(e.MIXED="mixed",e.SOFT="soft",e.HARD="hard",e.MERGE="merge",e.KEEP="keep",e))(ResetMode||{}),ResetModes=Array.from(Object.values(ResetMode))}});function createLog(){return debugModule("simple-git")}function prefixedLogger(e,t,n){return t&&String(t).replace(/\s*/,"")?(r,...i)=>{e(`%s ${r}`,t,...i),n&&n(r,...i)}:n?(t,...r)=>{e(t,...r),n(t,...r)}:e}function childLoggerName(e,t,{namespace:n}){if("string"==typeof e)return e;const r=t&&t.namespace||"";return r.startsWith(n)?r.substr(n.length+1):r||n}function createLogger(e,t,n,r=createLog()){const i=e&&`[${e}]`||"",o=[],s="string"==typeof t?r.extend(t):t,a=childLoggerName(filterType(t,filterString),s,r);return function t(n){const o=n&&`[${n}]`||"",a=s&&prefixedLogger(s,o)||NOOP$1,l=prefixedLogger(r,`${i} ${o}`,a);return Object.assign(s?a:l,{label:e,sibling:c,info:l,step:t})}(n);function c(t,n){return append(o,createLogger(e,a.replace(/^[^:]+/,t),n,r))}}var init_git_logger=__esm({"src/lib/git-logger.ts"(){init_utils(),debugModule.formatters.L=e=>String(filterHasLength(e)?e.length:"-"),debugModule.formatters.B=e=>Buffer.isBuffer(e)?e.toString("utf8"):objectToString(e)}}),_TasksPendingQueue,TasksPendingQueue,init_tasks_pending_queue=__esm({"src/lib/runners/tasks-pending-queue.ts"(){init_git_error(),init_git_logger(),_TasksPendingQueue=class{constructor(e="GitExecutor"){this.logLabel=e,this._queue=new Map}withProgress(e){return this._queue.get(e)}createProgress(e){const t=_TasksPendingQueue.getName(e.commands[0]);return{task:e,logger:createLogger(this.logLabel,t),name:t}}push(e){const t=this.createProgress(e);return t.logger("Adding task to the queue, commands = %o",e.commands),this._queue.set(e,t),t}fatal(e){for(const[t,{logger:n}]of Array.from(this._queue.entries()))t===e.task?(n.info("Failed %o",e),n("Fatal exception, any as-yet un-started tasks run through this executor will not be attempted")):n.info("A fatal exception occurred in a previous task, the queue has been purged: %o",e.message),this.complete(t);if(0!==this._queue.size)throw new Error(`Queue size should be zero after fatal: ${this._queue.size}`)}complete(e){this.withProgress(e)&&this._queue.delete(e)}attempt(e){const t=this.withProgress(e);if(!t)throw new GitError(void 0,"TasksPendingQueue: attempt called for an unknown task");return t.logger("Starting task"),t}static getName(e="empty"){return`task:${e}:${++_TasksPendingQueue.counter}`}},(TasksPendingQueue=_TasksPendingQueue).counter=0}}),GitExecutorChain;function pluginContext(e,t){return{method:first(e.commands)||"",commands:t}}function onErrorReceived(e,t){return n=>{t("[ERROR] child process exception %o",n),e.push(Buffer.from(String(n.stack),"ascii"))}}function onDataReceived(e,t,n,r){return i=>{n("%s received %L bytes",t,i),r("%B",i),e.push(i)}}var init_git_executor_chain=__esm({"src/lib/runners/git-executor-chain.ts"(){init_git_error(),init_task(),init_utils(),init_tasks_pending_queue(),GitExecutorChain=class{constructor(e,t,n){this._executor=e,this._scheduler=t,this._plugins=n,this._chain=Promise.resolve(),this._queue=new TasksPendingQueue}get cwd(){return this._cwd||this._executor.cwd}set cwd(e){this._cwd=e}get env(){return this._executor.env}get outputHandler(){return this._executor.outputHandler}chain(){return this}push(e){return this._queue.push(e),this._chain=this._chain.then((()=>this.attemptTask(e)))}attemptTask(e){return __async(this,null,(function*(){const t=yield this._scheduler.next(),n=()=>this._queue.complete(e);try{const{logger:t}=this._queue.attempt(e);return yield isEmptyTask(e)?this.attemptEmptyTask(e,t):this.attemptRemoteTask(e,t)}catch(t){throw this.onFatalException(e,t)}finally{n(),t()}}))}onFatalException(e,t){const n=t instanceof GitError?Object.assign(t,{task:e}):new GitError(e,t&&String(t));return this._chain=Promise.resolve(),this._queue.fatal(n),n}attemptRemoteTask(e,t){return __async(this,null,(function*(){const n=this._plugins.exec("spawn.binary","",pluginContext(e,e.commands)),r=this._plugins.exec("spawn.args",[...e.commands],pluginContext(e,e.commands)),i=yield this.gitResponse(e,n,r,this.outputHandler,t.step("SPAWN")),o=yield this.handleTaskData(e,r,i,t.step("HANDLE"));return t("passing response to task's parser as a %s",e.format),isBufferTask(e)?callTaskParser(e.parser,o):callTaskParser(e.parser,o.asStrings())}))}attemptEmptyTask(e,t){return __async(this,null,(function*(){return t("empty task bypassing child process to call to task's parser"),e.parser(this)}))}handleTaskData(e,t,n,r){const{exitCode:i,rejection:o,stdOut:s,stdErr:a}=n;return new Promise(((c,l)=>{r("Preparing to handle process response exitCode=%d stdOut=",i);const{error:u}=this._plugins.exec("task.error",{error:o},__spreadValues(__spreadValues({},pluginContext(e,t)),n));return u&&e.onError?(r.info("exitCode=%s handling with custom error handler"),e.onError(n,u,(e=>{r.info("custom error handler treated as success"),r("custom error returned a %s",objectToString(e)),c(new GitOutputStreams(Array.isArray(e)?Buffer.concat(e):e,Buffer.concat(a)))}),l)):u?(r.info("handling as error: exitCode=%s stdErr=%s rejection=%o",i,a.length,o),l(u)):(r.info("retrieving task output complete"),void c(new GitOutputStreams(Buffer.concat(s),Buffer.concat(a))))}))}gitResponse(e,t,n,r,i){return __async(this,null,(function*(){const o=i.sibling("output"),s=this._plugins.exec("spawn.options",{cwd:this.cwd,env:this.env,windowsHide:!0},pluginContext(e,e.commands));return new Promise((a=>{const c=[],l=[];i.info("%s %o",t,n),i("%O",s);let u=this._beforeSpawn(e,n);if(u)return a({stdOut:c,stdErr:l,exitCode:9901,rejection:u});this._plugins.exec("spawn.before",void 0,__spreadProps(__spreadValues({},pluginContext(e,n)),{kill(e){u=e||u}}));const d=spawn(t,n,s);d.stdout.on("data",onDataReceived(c,"stdOut",i,o.step("stdOut"))),d.stderr.on("data",onDataReceived(l,"stdErr",i,o.step("stdErr"))),d.on("error",onErrorReceived(l,i)),r&&(i("Passing child process stdOut/stdErr to custom outputHandler"),r(t,d.stdout,d.stderr,[...n])),this._plugins.exec("spawn.after",void 0,__spreadProps(__spreadValues({},pluginContext(e,n)),{spawned:d,close(e,t){a({stdOut:c,stdErr:l,exitCode:e,rejection:u||t})},kill(e){d.killed||(u=e,d.kill("SIGINT"))}}))}))}))}_beforeSpawn(e,t){let n;return this._plugins.exec("spawn.before",void 0,__spreadProps(__spreadValues({},pluginContext(e,t)),{kill(e){n=e||n}})),n}}}}),git_executor_exports={},GitExecutor;__export(git_executor_exports,{GitExecutor:()=>GitExecutor});var init_git_executor=__esm({"src/lib/runners/git-executor.ts"(){init_git_executor_chain(),GitExecutor=class{constructor(e,t,n){this.cwd=e,this._scheduler=t,this._plugins=n,this._chain=new GitExecutorChain(this,this._scheduler,this._plugins)}chain(){return new GitExecutorChain(this,this._scheduler,this._plugins)}push(e){return this._chain.push(e)}}}});function taskCallback(e,t,n=NOOP$1){t.then((e=>{n(null,e)}),(t=>{(null==t?void 0:t.task)===e&&n(t instanceof GitResponseError?addDeprecationNoticeToError(t):t,void 0)}))}function addDeprecationNoticeToError(e){let t=e=>{console.warn(`simple-git deprecation notice: accessing GitResponseError.${e} should be GitResponseError.git.${e}, this will no longer be available in version 3`),t=NOOP$1};return Object.create(e,Object.getOwnPropertyNames(e.git).reduce((function(n,r){if(r in e)return n;return n[r]={enumerable:!1,configurable:!1,get:()=>(t(r),e.git[r])},n}),{}))}var init_task_callback=__esm({"src/lib/task-callback.ts"(){init_git_response_error(),init_utils()}});function changeWorkingDirectoryTask(e,t){return adhocExecTask((n=>{if(!folderExists(e))throw new Error(`Git.cwd: cannot change to non-directory "${e}"`);return(t||n).cwd=e}))}var init_change_working_directory=__esm({"src/lib/tasks/change-working-directory.ts"(){init_utils(),init_task()}});function checkoutTask(e){const t=["checkout",...e];return"-b"===t[1]&&t.includes("-B")&&(t[1]=remove(t,"-B")),straightThroughStringTask(t)}function checkout_default(){return{checkout(){return this._runTask(checkoutTask(getTrailingOptions(arguments,1)),trailingFunctionArgument(arguments))},checkoutBranch(e,t){return this._runTask(checkoutTask(["-b",e,t,...getTrailingOptions(arguments)]),trailingFunctionArgument(arguments))},checkoutLocalBranch(e){return this._runTask(checkoutTask(["-b",e,...getTrailingOptions(arguments)]),trailingFunctionArgument(arguments))}}}var init_checkout=__esm({"src/lib/tasks/checkout.ts"(){init_utils(),init_task()}}),parser2;function countObjectsResponse(){return{count:0,garbage:0,inPack:0,packs:0,prunePackable:0,size:0,sizeGarbage:0,sizePack:0}}function count_objects_default(){return{countObjects(){return this._runTask({commands:["count-objects","--verbose"],format:"utf-8",parser:e=>parseStringResponse(countObjectsResponse(),[parser2],e)})}}}var init_count_objects=__esm({"src/lib/tasks/count-objects.ts"(){init_utils(),parser2=new LineParser(/([a-z-]+): (\d+)$/,((e,[t,n])=>{const r=asCamelCase(t);e.hasOwnProperty(r)&&(e[r]=asNumber(n))}))}}),parsers;function parseCommitResult(e){return parseStringResponse({author:null,branch:"",commit:"",root:!1,summary:{changes:0,insertions:0,deletions:0}},parsers,e)}var init_parse_commit=__esm({"src/lib/parsers/parse-commit.ts"(){init_utils(),parsers=[new LineParser(/^\[([^\s]+)( \([^)]+\))? ([^\]]+)/,((e,[t,n,r])=>{e.branch=t,e.commit=r,e.root=!!n})),new LineParser(/\s*Author:\s(.+)/i,((e,[t])=>{const n=t.split("<"),r=n.pop();r&&r.includes("@")&&(e.author={email:r.substr(0,r.length-1),name:n.join("<").trim()})})),new LineParser(/(\d+)[^,]*(?:,\s*(\d+)[^,]*)(?:,\s*(\d+))/g,((e,[t,n,r])=>{e.summary.changes=parseInt(t,10)||0,e.summary.insertions=parseInt(n,10)||0,e.summary.deletions=parseInt(r,10)||0})),new LineParser(/^(\d+)[^,]*(?:,\s*(\d+)[^(]+\(([+-]))?/,((e,[t,n,r])=>{e.summary.changes=parseInt(t,10)||0;const i=parseInt(n,10)||0;"-"===r?e.summary.deletions=i:"+"===r&&(e.summary.insertions=i)}))]}});function commitTask(e,t,n){return{commands:["-c","core.abbrev=40","commit",...prefixedArray(e,"-m"),...t,...n],format:"utf-8",parser:parseCommitResult}}function commit_default(){return{commit(e,...t){const n=trailingFunctionArgument(arguments),r=function(e){return!filterStringOrStringArray(e)&&configurationErrorTask("git.commit: requires the commit message to be supplied as a string/string[]")}(e)||commitTask(asArray(e),asArray(filterType(t[0],filterStringOrStringArray,[])),[...filterType(t[1],filterArray,[]),...getTrailingOptions(arguments,0,!0)]);return this._runTask(r,n)}}}var init_commit=__esm({"src/lib/tasks/commit.ts"(){init_parse_commit(),init_utils(),init_task()}});function first_commit_default(){return{firstCommit(){return this._runTask(straightThroughStringTask(["rev-list","--max-parents=0","HEAD"],!0),trailingFunctionArgument(arguments))}}}var init_first_commit=__esm({"src/lib/tasks/first-commit.ts"(){init_utils(),init_task()}});function hashObjectTask(e,t){const n=["hash-object",e];return t&&n.push("-w"),straightThroughStringTask(n,!0)}var init_hash_object=__esm({"src/lib/tasks/hash-object.ts"(){init_task()}}),InitSummary,initResponseRegex,reInitResponseRegex;function parseInit(e,t,n){const r=String(n).trim();let i;if(i=initResponseRegex.exec(r))return new InitSummary(e,t,!1,i[1]);if(i=reInitResponseRegex.exec(r))return new InitSummary(e,t,!0,i[1]);let o="";const s=r.split(" ");for(;s.length;){if("in"===s.shift()){o=s.join(" ");break}}return new InitSummary(e,t,/^re/i.test(r),o)}var init_InitSummary=__esm({"src/lib/responses/InitSummary.ts"(){InitSummary=class{constructor(e,t,n,r){this.bare=e,this.path=t,this.existing=n,this.gitDir=r}},initResponseRegex=/^Init.+ repository in (.+)$/,reInitResponseRegex=/^Rein.+ in (.+)$/}}),bareCommand;function hasBareCommand(e){return e.includes(bareCommand)}function initTask(e=!1,t,n){const r=["init",...n];return e&&!hasBareCommand(r)&&r.splice(1,0,bareCommand),{commands:r,format:"utf-8",parser:e=>parseInit(r.includes("--bare"),t,e)}}var init_init=__esm({"src/lib/tasks/init.ts"(){init_InitSummary(),bareCommand="--bare"}}),logFormatRegex;function logFormatFromCommand(e){for(let t=0;tparseStringResponse(new DiffSummary,t,e,!1)}var init_parse_diff_summary=__esm({"src/lib/parsers/parse-diff-summary.ts"(){init_log_format(),init_DiffSummary(),init_diff_name_status(),init_utils(),statParser=[new LineParser(/^(.+)\s+\|\s+(\d+)(\s+[+\-]+)?$/,((e,[t,n,r=""])=>{e.files.push({file:t.trim(),changes:asNumber(n),insertions:r.replace(/[^+]/g,"").length,deletions:r.replace(/[^-]/g,"").length,binary:!1})})),new LineParser(/^(.+) \|\s+Bin ([0-9.]+) -> ([0-9.]+) ([a-z]+)/,((e,[t,n,r])=>{e.files.push({file:t.trim(),before:asNumber(n),after:asNumber(r),binary:!0})})),new LineParser(/(\d+) files? changed\s*((?:, \d+ [^,]+){0,2})/,((e,[t,n])=>{const r=/(\d+) i/.exec(n),i=/(\d+) d/.exec(n);e.changed=asNumber(t),e.insertions=asNumber(null==r?void 0:r[1]),e.deletions=asNumber(null==i?void 0:i[1])}))],numStatParser=[new LineParser(/(\d+)\t(\d+)\t(.+)$/,((e,[t,n,r])=>{const i=asNumber(t),o=asNumber(n);e.changed++,e.insertions+=i,e.deletions+=o,e.files.push({file:r,changes:i+o,insertions:i,deletions:o,binary:!1})})),new LineParser(/-\t-\t(.+)$/,((e,[t])=>{e.changed++,e.files.push({file:t,after:0,before:0,binary:!0})}))],nameOnlyParser=[new LineParser(/(.+)$/,((e,[t])=>{e.changed++,e.files.push({file:t,changes:0,insertions:0,deletions:0,binary:!1})}))],nameStatusParser=[new LineParser(/([ACDMRTUXB])([0-9]{0,3})\t(.[^\t]*)(\t(.[^\t]*))?$/,((e,[t,n,r,i,o])=>{e.changed++,e.files.push({file:null!=o?o:r,changes:0,insertions:0,deletions:0,binary:!1,status:orVoid(isDiffNameStatus(t)&&t),from:orVoid(!!o&&r!==o&&r),similarity:asNumber(n)})}))],diffSummaryParsers={"":statParser,"--stat":statParser,"--numstat":numStatParser,"--name-status":nameStatusParser,"--name-only":nameOnlyParser}}}),START_BOUNDARY,COMMIT_BOUNDARY,SPLITTER,defaultFieldNames;function lineBuilder(e,t){return t.reduce(((t,n,r)=>(t[n]=e[r]||"",t)),Object.create({diff:null}))}function createListLogSummaryParser(e=SPLITTER,t=defaultFieldNames,n=""){const r=getDiffParser(n);return function(n){const i=toLinesWithContent(n.trim(),!1,START_BOUNDARY).map((function(n){const i=n.split(COMMIT_BOUNDARY),o=lineBuilder(i[0].split(e),t);return i.length>1&&i[1].trim()&&(o.diff=r(i[1])),o}));return{all:i,latest:i.length&&i[0]||null,total:i.length}}}var init_parse_list_log_summary=__esm({"src/lib/parsers/parse-list-log-summary.ts"(){init_utils(),init_parse_diff_summary(),init_log_format(),START_BOUNDARY="òòòòòò ",COMMIT_BOUNDARY=" òò",SPLITTER=" ò ",defaultFieldNames=["hash","date","message","refs","author_name","author_email"]}}),diff_exports={};function diffSummaryTask(e){let t=logFormatFromCommand(e);const n=["diff"];return""===t&&(t="--stat",n.push("--stat=4096")),n.push(...e),validateLogFormatConfig(n)||{commands:n,format:"utf-8",parser:getDiffParser(t)}}function validateLogFormatConfig(e){const t=e.filter(isLogFormat);return t.length>1?configurationErrorTask(`Summary flags are mutually exclusive - pick one of ${t.join(",")}`):t.length&&e.includes("-z")?configurationErrorTask(`Summary flag ${t} parsing is not compatible with null termination option '-z'`):void 0}__export(diff_exports,{diffSummaryTask:()=>diffSummaryTask,validateLogFormatConfig:()=>validateLogFormatConfig});var init_diff=__esm({"src/lib/tasks/diff.ts"(){init_log_format(),init_parse_diff_summary(),init_task()}}),excludeOptions;function prettyFormat(e,t){const n=[],r=[];return Object.keys(e).forEach((t=>{n.push(t),r.push(String(e[t]))})),[n,r.join(t)]}function userOptions(e){return Object.keys(e).reduce(((t,n)=>(n in excludeOptions||(t[n]=e[n]),t)),{})}function parseLogOptions(e={},t=[]){const n=filterType(e.splitter,filterString,SPLITTER),r=!filterPrimitives(e.format)&&e.format?e.format:{hash:"%H",date:!1===e.strictDate?"%ai":"%aI",message:"%s",refs:"%D",body:e.multiLine?"%B":"%b",author_name:!1!==e.mailMap?"%aN":"%an",author_email:!1!==e.mailMap?"%aE":"%ae"},[i,o]=prettyFormat(r,n),s=[],a=[`--pretty=format:${START_BOUNDARY}${o}${COMMIT_BOUNDARY}`,...t],c=e.n||e["max-count"]||e.maxCount;if(c&&a.push(`--max-count=${c}`),e.from||e.to){const t=!1!==e.symmetric?"...":"..";s.push(`${e.from||""}${t}${e.to||""}`)}return filterString(e.file)&&a.push("--follow",pathspec(e.file)),appendTaskOptions(userOptions(e),a),{fields:i,splitter:n,commands:[...a,...s]}}function logTask(e,t,n){const r=createListLogSummaryParser(e,t,logFormatFromCommand(n));return{commands:["log",...n],format:"utf-8",parser:r}}function log_default(){return{log(...e){const t=trailingFunctionArgument(arguments),n=parseLogOptions(trailingOptionsArgument(arguments),filterType(arguments[0],filterArray)),r=function(e,t){return filterString(e)&&filterString(t)&&configurationErrorTask("git.log(string, string) should be replaced with git.log({ from: string, to: string })")}(...e)||validateLogFormatConfig(n.commands)||function(e){return logTask(e.splitter,e.fields,e.commands)}(n);return this._runTask(r,t)}}}var init_log=__esm({"src/lib/tasks/log.ts"(){init_log_format(),init_pathspec(),init_parse_list_log_summary(),init_utils(),init_task(),init_diff(),excludeOptions=(e=>(e[e["--pretty"]=0]="--pretty",e[e["max-count"]=1]="max-count",e[e.maxCount=2]="maxCount",e[e.n=3]="n",e[e.file=4]="file",e[e.format=5]="format",e[e.from=6]="from",e[e.to=7]="to",e[e.splitter=8]="splitter",e[e.symmetric=9]="symmetric",e[e.mailMap=10]="mailMap",e[e.multiLine=11]="multiLine",e[e.strictDate=12]="strictDate",e))(excludeOptions||{})}}),MergeSummaryConflict,MergeSummaryDetail,init_MergeSummary=__esm({"src/lib/responses/MergeSummary.ts"(){MergeSummaryConflict=class{constructor(e,t=null,n){this.reason=e,this.file=t,this.meta=n}toString(){return`${this.file}:${this.reason}`}},MergeSummaryDetail=class{constructor(){this.conflicts=[],this.merges=[],this.result="success"}get failed(){return this.conflicts.length>0}get reason(){return this.result}toString(){return this.conflicts.length?`CONFLICTS: ${this.conflicts.join(", ")}`:"OK"}}}}),PullSummary,PullFailedSummary,init_PullSummary=__esm({"src/lib/responses/PullSummary.ts"(){PullSummary=class{constructor(){this.remoteMessages={all:[]},this.created=[],this.deleted=[],this.files=[],this.deletions={},this.insertions={},this.summary={changes:0,deletions:0,insertions:0}}},PullFailedSummary=class{constructor(){this.remote="",this.hash={local:"",remote:""},this.branch={local:"",remote:""},this.message=""}toString(){return this.message}}}}),remoteMessagesObjectParsers;function objectEnumerationResult(e){return e.objects=e.objects||{compressing:0,counting:0,enumerating:0,packReused:0,reused:{count:0,delta:0},total:{count:0,delta:0}}}function asObjectCount(e){const t=/^\s*(\d+)/.exec(e),n=/delta (\d+)/i.exec(e);return{count:asNumber(t&&t[1]||"0"),delta:asNumber(n&&n[1]||"0")}}var init_parse_remote_objects=__esm({"src/lib/parsers/parse-remote-objects.ts"(){init_utils(),remoteMessagesObjectParsers=[new RemoteLineParser(/^remote:\s*(enumerating|counting|compressing) objects: (\d+),/i,((e,[t,n])=>{const r=t.toLowerCase(),i=objectEnumerationResult(e.remoteMessages);Object.assign(i,{[r]:asNumber(n)})})),new RemoteLineParser(/^remote:\s*(enumerating|counting|compressing) objects: \d+% \(\d+\/(\d+)\),/i,((e,[t,n])=>{const r=t.toLowerCase(),i=objectEnumerationResult(e.remoteMessages);Object.assign(i,{[r]:asNumber(n)})})),new RemoteLineParser(/total ([^,]+), reused ([^,]+), pack-reused (\d+)/i,((e,[t,n,r])=>{const i=objectEnumerationResult(e.remoteMessages);i.total=asObjectCount(t),i.reused=asObjectCount(n),i.packReused=asNumber(r)}))]}}),parsers2,RemoteMessageSummary;function parseRemoteMessages(e,t){return parseStringResponse({remoteMessages:new RemoteMessageSummary},parsers2,t)}var init_parse_remote_messages=__esm({"src/lib/parsers/parse-remote-messages.ts"(){init_utils(),init_parse_remote_objects(),parsers2=[new RemoteLineParser(/^remote:\s*(.+)$/,((e,[t])=>(e.remoteMessages.all.push(t.trim()),!1))),...remoteMessagesObjectParsers,new RemoteLineParser([/create a (?:pull|merge) request/i,/\s(https?:\/\/\S+)$/],((e,[t])=>{e.remoteMessages.pullRequestUrl=t})),new RemoteLineParser([/found (\d+) vulnerabilities.+\(([^)]+)\)/i,/\s(https?:\/\/\S+)$/],((e,[t,n,r])=>{e.remoteMessages.vulnerabilities={count:asNumber(t),summary:n,url:r}}))],RemoteMessageSummary=class{constructor(){this.all=[]}}}}),FILE_UPDATE_REGEX,SUMMARY_REGEX,ACTION_REGEX,parsers3,errorParsers,parsePullDetail,parsePullResult;function parsePullErrorResult(e,t){const n=parseStringResponse(new PullFailedSummary,errorParsers,[e,t]);return n.message&&n}var init_parse_pull=__esm({"src/lib/parsers/parse-pull.ts"(){init_PullSummary(),init_utils(),init_parse_remote_messages(),SUMMARY_REGEX=/(\d+)\D+((\d+)\D+\(\+\))?(\D+(\d+)\D+\(-\))?/,ACTION_REGEX=/^(create|delete) mode \d+ (.+)/,parsers3=[new LineParser(FILE_UPDATE_REGEX=/^\s*(.+?)\s+\|\s+\d+\s*(\+*)(-*)/,((e,[t,n,r])=>{e.files.push(t),n&&(e.insertions[t]=n.length),r&&(e.deletions[t]=r.length)})),new LineParser(SUMMARY_REGEX,((e,[t,,n,,r])=>(void 0!==n||void 0!==r)&&(e.summary.changes=+t||0,e.summary.insertions=+n||0,e.summary.deletions=+r||0,!0))),new LineParser(ACTION_REGEX,((e,[t,n])=>{append(e.files,n),append("create"===t?e.created:e.deleted,n)}))],errorParsers=[new LineParser(/^from\s(.+)$/i,((e,[t])=>{e.remote=t})),new LineParser(/^fatal:\s(.+)$/,((e,[t])=>{e.message=t})),new LineParser(/([a-z0-9]+)\.\.([a-z0-9]+)\s+(\S+)\s+->\s+(\S+)$/,((e,[t,n,r,i])=>{e.branch.local=r,e.hash.local=t,e.branch.remote=i,e.hash.remote=n}))],parsePullDetail=(e,t)=>parseStringResponse(new PullSummary,parsers3,[e,t]),parsePullResult=(e,t)=>Object.assign(new PullSummary,parsePullDetail(e,t),parseRemoteMessages(e,t))}}),parsers4,parseMergeResult,parseMergeDetail,init_parse_merge=__esm({"src/lib/parsers/parse-merge.ts"(){init_MergeSummary(),init_utils(),init_parse_pull(),parsers4=[new LineParser(/^Auto-merging\s+(.+)$/,((e,[t])=>{e.merges.push(t)})),new LineParser(/^CONFLICT\s+\((.+)\): Merge conflict in (.+)$/,((e,[t,n])=>{e.conflicts.push(new MergeSummaryConflict(t,n))})),new LineParser(/^CONFLICT\s+\((.+\/delete)\): (.+) deleted in (.+) and/,((e,[t,n,r])=>{e.conflicts.push(new MergeSummaryConflict(t,n,{deleteRef:r}))})),new LineParser(/^CONFLICT\s+\((.+)\):/,((e,[t])=>{e.conflicts.push(new MergeSummaryConflict(t,null))})),new LineParser(/^Automatic merge failed;\s+(.+)$/,((e,[t])=>{e.result=t}))],parseMergeResult=(e,t)=>Object.assign(parseMergeDetail(e,t),parsePullResult(e,t)),parseMergeDetail=e=>parseStringResponse(new MergeSummaryDetail,parsers4,e)}});function mergeTask(e){return e.length?{commands:["merge",...e],format:"utf-8",parser(e,t){const n=parseMergeResult(e,t);if(n.failed)throw new GitResponseError(n);return n}}:configurationErrorTask("Git.merge requires at least one option")}var init_merge=__esm({"src/lib/tasks/merge.ts"(){init_git_response_error(),init_parse_merge(),init_task()}}),parsers5,parsePushResult,parsePushDetail;function pushResultPushedItem(e,t,n){const r=n.includes("deleted"),i=n.includes("tag")||/^refs\/tags/.test(e),o=!n.includes("new");return{deleted:r,tag:i,branch:!i,new:!o,alreadyUpdated:o,local:e,remote:t}}var init_parse_push=__esm({"src/lib/parsers/parse-push.ts"(){init_utils(),init_parse_remote_messages(),parsers5=[new LineParser(/^Pushing to (.+)$/,((e,[t])=>{e.repo=t})),new LineParser(/^updating local tracking ref '(.+)'/,((e,[t])=>{e.ref=__spreadProps(__spreadValues({},e.ref||{}),{local:t})})),new LineParser(/^[=*-]\s+([^:]+):(\S+)\s+\[(.+)]$/,((e,[t,n,r])=>{e.pushed.push(pushResultPushedItem(t,n,r))})),new LineParser(/^Branch '([^']+)' set up to track remote branch '([^']+)' from '([^']+)'/,((e,[t,n,r])=>{e.branch=__spreadProps(__spreadValues({},e.branch||{}),{local:t,remote:n,remoteName:r})})),new LineParser(/^([^:]+):(\S+)\s+([a-z0-9]+)\.\.([a-z0-9]+)$/,((e,[t,n,r,i])=>{e.update={head:{local:t,remote:n},hash:{from:r,to:i}}}))],parsePushResult=(e,t)=>{const n=parsePushDetail(e,t),r=parseRemoteMessages(e,t);return __spreadValues(__spreadValues({},n),r)},parsePushDetail=(e,t)=>parseStringResponse({pushed:[]},parsers5,[e,t])}}),push_exports={};function pushTagsTask(e={},t){return append(t,"--tags"),pushTask(e,t)}function pushTask(e={},t){const n=["push",...t];return e.branch&&n.splice(1,0,e.branch),e.remote&&n.splice(1,0,e.remote),remove(n,"-v"),append(n,"--verbose"),append(n,"--porcelain"),{commands:n,format:"utf-8",parser:parsePushResult}}__export(push_exports,{pushTagsTask:()=>pushTagsTask,pushTask:()=>pushTask});var init_push=__esm({"src/lib/tasks/push.ts"(){init_parse_push(),init_utils()}});function show_default(){return{showBuffer(){const e=["show",...getTrailingOptions(arguments,1)];return e.includes("--binary")||e.splice(1,0,"--binary"),this._runTask(straightThroughBufferTask(e),trailingFunctionArgument(arguments))},show(){const e=["show",...getTrailingOptions(arguments,1)];return this._runTask(straightThroughStringTask(e),trailingFunctionArgument(arguments))}}}var init_show=__esm({"src/lib/tasks/show.ts"(){init_utils(),init_task()}}),fromPathRegex,FileStatusSummary,init_FileStatusSummary=__esm({"src/lib/responses/FileStatusSummary.ts"(){fromPathRegex=/^(.+)\0(.+)$/,FileStatusSummary=class{constructor(e,t,n){if(this.path=e,this.index=t,this.working_dir=n,"R"===t||"R"===n){const t=fromPathRegex.exec(e)||[null,e,e];this.from=t[2]||"",this.path=t[1]||""}}}}}),StatusSummary,parsers6,parseStatusSummary;function renamedFile(e){const[t,n]=e.split(NULL);return{from:n||t,to:t}}function parser3(e,t,n){return[`${e}${t}`,n]}function conflicts(e,...t){return t.map((t=>parser3(e,t,((e,t)=>append(e.conflicted,t)))))}function splitLine(e,t){const n=t.trim();switch(" "){case n.charAt(2):return r(n.charAt(0),n.charAt(1),n.substr(3));case n.charAt(1):return r(" ",n.charAt(0),n.substr(2));default:return}function r(t,n,r){const i=`${t}${n}`,o=parsers6.get(i);o&&o(e,r),"##"!==i&&"!!"!==i&&e.files.push(new FileStatusSummary(r,t,n))}}var init_StatusSummary=__esm({"src/lib/responses/StatusSummary.ts"(){init_utils(),init_FileStatusSummary(),StatusSummary=class{constructor(){this.not_added=[],this.conflicted=[],this.created=[],this.deleted=[],this.ignored=void 0,this.modified=[],this.renamed=[],this.files=[],this.staged=[],this.ahead=0,this.behind=0,this.current=null,this.tracking=null,this.detached=!1,this.isClean=()=>!this.files.length}},parsers6=new Map([parser3(" ","A",((e,t)=>append(e.created,t))),parser3(" ","D",((e,t)=>append(e.deleted,t))),parser3(" ","M",((e,t)=>append(e.modified,t))),parser3("A"," ",((e,t)=>append(e.created,t)&&append(e.staged,t))),parser3("A","M",((e,t)=>append(e.created,t)&&append(e.staged,t)&&append(e.modified,t))),parser3("D"," ",((e,t)=>append(e.deleted,t)&&append(e.staged,t))),parser3("M"," ",((e,t)=>append(e.modified,t)&&append(e.staged,t))),parser3("M","M",((e,t)=>append(e.modified,t)&&append(e.staged,t))),parser3("R"," ",((e,t)=>{append(e.renamed,renamedFile(t))})),parser3("R","M",((e,t)=>{const n=renamedFile(t);append(e.renamed,n),append(e.modified,n.to)})),parser3("!","!",((e,t)=>{append(e.ignored=e.ignored||[],t)})),parser3("?","?",((e,t)=>append(e.not_added,t))),...conflicts("A","A","U"),...conflicts("D","D","U"),...conflicts("U","A","D","U"),["##",(e,t)=>{let n;n=/ahead (\d+)/.exec(t),e.ahead=n&&+n[1]||0,n=/behind (\d+)/.exec(t),e.behind=n&&+n[1]||0,n=/^(.+?(?=(?:\.{3}|\s|$)))/.exec(t),e.current=n&&n[1],n=/\.{3}(\S*)/.exec(t),e.tracking=n&&n[1],n=/\son\s([\S]+)$/.exec(t),e.current=n&&n[1]||e.current,e.detached=/\(no branch\)/.test(t)}]]),parseStatusSummary=function(e){const t=e.split(NULL),n=new StatusSummary;for(let e=0,r=t.length;e!ignoredOptions.includes(e)))],parser:e=>parseStatusSummary(e)}}var init_status=__esm({"src/lib/tasks/status.ts"(){init_StatusSummary(),ignoredOptions=["--null","-z"]}}),NOT_INSTALLED,parsers7;function versionResponse(e=0,t=0,n=0,r="",i=!0){return Object.defineProperty({major:e,minor:t,patch:n,agent:r,installed:i},"toString",{value(){return`${this.major}.${this.minor}.${this.patch}`},configurable:!1,enumerable:!1})}function notInstalledResponse(){return versionResponse(0,0,0,"",!1)}function version_default(){return{version(){return this._runTask({commands:["--version"],format:"utf-8",parser:versionParser,onError(e,t,n,r){if(-2===e.exitCode)return n(Buffer.from(NOT_INSTALLED));r(t)}})}}}function versionParser(e){return e===NOT_INSTALLED?notInstalledResponse():parseStringResponse(versionResponse(0,0,0,e),parsers7,e)}var init_version=__esm({"src/lib/tasks/version.ts"(){init_utils(),NOT_INSTALLED="installed=false",parsers7=[new LineParser(/version (\d+)\.(\d+)\.(\d+)(?:\s*\((.+)\))?/,((e,[t,n,r,i=""])=>{Object.assign(e,versionResponse(asNumber(t),asNumber(n),asNumber(r),i))})),new LineParser(/version (\d+)\.(\d+)\.(\D+)(.+)?$/,((e,[t,n,r,i=""])=>{Object.assign(e,versionResponse(asNumber(t),asNumber(n),r,i))}))]}}),simple_git_api_exports={},SimpleGitApi;__export(simple_git_api_exports,{SimpleGitApi:()=>SimpleGitApi});var init_simple_git_api=__esm({"src/lib/simple-git-api.ts"(){init_task_callback(),init_change_working_directory(),init_checkout(),init_count_objects(),init_commit(),init_config(),init_first_commit(),init_grep(),init_hash_object(),init_init(),init_log(),init_merge(),init_push(),init_show(),init_status(),init_task(),init_version(),init_utils(),SimpleGitApi=class{constructor(e){this._executor=e}_runTask(e,t){const n=this._executor.chain(),r=n.push(e);return t&&taskCallback(e,r,t),Object.create(this,{then:{value:r.then.bind(r)},catch:{value:r.catch.bind(r)},_executor:{value:n}})}add(e){return this._runTask(straightThroughStringTask(["add",...asArray(e)]),trailingFunctionArgument(arguments))}cwd(e){const t=trailingFunctionArgument(arguments);return"string"==typeof e?this._runTask(changeWorkingDirectoryTask(e,this._executor),t):"string"==typeof(null==e?void 0:e.path)?this._runTask(changeWorkingDirectoryTask(e.path,e.root&&this._executor||void 0),t):this._runTask(configurationErrorTask("Git.cwd: workingDirectory must be supplied as a string"),t)}hashObject(e,t){return this._runTask(hashObjectTask(e,!0===t),trailingFunctionArgument(arguments))}init(e){return this._runTask(initTask(!0===e,this._executor.cwd,getTrailingOptions(arguments)),trailingFunctionArgument(arguments))}merge(){return this._runTask(mergeTask(getTrailingOptions(arguments)),trailingFunctionArgument(arguments))}mergeFromTo(e,t){return filterString(e)&&filterString(t)?this._runTask(mergeTask([e,t,...getTrailingOptions(arguments)]),trailingFunctionArgument(arguments,!1)):this._runTask(configurationErrorTask("Git.mergeFromTo requires that the 'remote' and 'branch' arguments are supplied as strings"))}outputHandler(e){return this._executor.outputHandler=e,this}push(){const e=pushTask({remote:filterType(arguments[0],filterString),branch:filterType(arguments[1],filterString)},getTrailingOptions(arguments));return this._runTask(e,trailingFunctionArgument(arguments))}stash(){return this._runTask(straightThroughStringTask(["stash",...getTrailingOptions(arguments)]),trailingFunctionArgument(arguments))}status(){return this._runTask(statusTask(getTrailingOptions(arguments)),trailingFunctionArgument(arguments))}},Object.assign(SimpleGitApi.prototype,checkout_default(),commit_default(),config_default(),count_objects_default(),first_commit_default(),grep_default(),log_default(),show_default(),version_default())}}),scheduler_exports={},createScheduledTask,Scheduler;__export(scheduler_exports,{Scheduler:()=>Scheduler});var init_scheduler=__esm({"src/lib/runners/scheduler.ts"(){init_utils(),init_git_logger(),createScheduledTask=(()=>{let e=0;return()=>{e++;const{promise:t,done:n}=distExports$1.createDeferred();return{promise:t,done:n,id:e}}})(),Scheduler=class{constructor(e=2){this.concurrency=e,this.logger=createLogger("","scheduler"),this.pending=[],this.running=[],this.logger("Constructed, concurrency=%s",e)}schedule(){if(!this.pending.length||this.running.length>=this.concurrency)return void this.logger("Schedule attempt ignored, pending=%s running=%s concurrency=%s",this.pending.length,this.running.length,this.concurrency);const e=append(this.running,this.pending.shift());this.logger("Attempting id=%s",e.id),e.done((()=>{this.logger("Completing id=",e.id),remove(this.running,e),this.schedule()}))}next(){const{promise:e,id:t}=append(this.pending,createScheduledTask());return this.logger("Scheduling id=%s",t),this.schedule(),e}}}}),apply_patch_exports={};function applyPatchTask(e,t){return straightThroughStringTask(["apply",...t,...e])}__export(apply_patch_exports,{applyPatchTask:()=>applyPatchTask});var init_apply_patch=__esm({"src/lib/tasks/apply-patch.ts"(){init_task()}}),BranchDeletionBatch;function branchDeletionSuccess(e,t){return{branch:e,hash:t,success:!0}}function branchDeletionFailure(e){return{branch:e,hash:null,success:!1}}var init_BranchDeleteSummary=__esm({"src/lib/responses/BranchDeleteSummary.ts"(){BranchDeletionBatch=class{constructor(){this.all=[],this.branches={},this.errors=[]}get success(){return!this.errors.length}}}}),deleteSuccessRegex,deleteErrorRegex,parsers8,parseBranchDeletions;function hasBranchDeletionError(e,t){return 1===t&&deleteErrorRegex.test(e)}var init_parse_branch_delete=__esm({"src/lib/parsers/parse-branch-delete.ts"(){init_BranchDeleteSummary(),init_utils(),deleteErrorRegex=/^error[^']+'([^']+)'/m,parsers8=[new LineParser(deleteSuccessRegex=/(\S+)\s+\(\S+\s([^)]+)\)/,((e,[t,n])=>{const r=branchDeletionSuccess(t,n);e.all.push(r),e.branches[t]=r})),new LineParser(deleteErrorRegex,((e,[t])=>{const n=branchDeletionFailure(t);e.errors.push(n),e.all.push(n),e.branches[t]=n}))],parseBranchDeletions=(e,t)=>parseStringResponse(new BranchDeletionBatch,parsers8,[e,t])}}),BranchSummaryResult,init_BranchSummary=__esm({"src/lib/responses/BranchSummary.ts"(){BranchSummaryResult=class{constructor(){this.all=[],this.branches={},this.current="",this.detached=!1}push(e,t,n,r,i){"*"===e&&(this.detached=t,this.current=n),this.all.push(n),this.branches[n]={current:"*"===e,linkedWorkTree:"+"===e,name:n,commit:r,label:i}}}}}),parsers9;function branchStatus(e){return e?e.charAt(0):""}function parseBranchSummary(e){return parseStringResponse(new BranchSummaryResult,parsers9,e)}var init_parse_branch=__esm({"src/lib/parsers/parse-branch.ts"(){init_BranchSummary(),init_utils(),parsers9=[new LineParser(/^([*+]\s)?\((?:HEAD )?detached (?:from|at) (\S+)\)\s+([a-z0-9]+)\s(.*)$/,((e,[t,n,r,i])=>{e.push(branchStatus(t),!0,n,r,i)})),new LineParser(new RegExp("^([*+]\\s)?(\\S+)\\s+([a-z0-9]+)\\s?(.*)$","s"),((e,[t,n,r,i])=>{e.push(branchStatus(t),!1,n,r,i)}))]}}),branch_exports={};function containsDeleteBranchCommand(e){const t=["-d","-D","--delete"];return e.some((e=>t.includes(e)))}function branchTask(e){const t=containsDeleteBranchCommand(e),n=["branch",...e];return 1===n.length&&n.push("-a"),n.includes("-v")||n.splice(1,0,"-v"),{format:"utf-8",commands:n,parser:(e,n)=>t?parseBranchDeletions(e,n).all[0]:parseBranchSummary(e)}}function branchLocalTask(){return{format:"utf-8",commands:["branch","-v"],parser:parseBranchSummary}}function deleteBranchesTask(e,t=!1){return{format:"utf-8",commands:["branch","-v",t?"-D":"-d",...e],parser:(e,t)=>parseBranchDeletions(e,t),onError({exitCode:e,stdOut:t},n,r,i){if(!hasBranchDeletionError(String(n),e))return i(n);r(t)}}}function deleteBranchTask(e,t=!1){const n={format:"utf-8",commands:["branch","-v",t?"-D":"-d",e],parser:(t,n)=>parseBranchDeletions(t,n).branches[e],onError({exitCode:e,stdErr:t,stdOut:r},i,o,s){if(!hasBranchDeletionError(String(i),e))return s(i);throw new GitResponseError(n.parser(bufferToString(r),bufferToString(t)),String(i))}};return n}__export(branch_exports,{branchLocalTask:()=>branchLocalTask,branchTask:()=>branchTask,containsDeleteBranchCommand:()=>containsDeleteBranchCommand,deleteBranchTask:()=>deleteBranchTask,deleteBranchesTask:()=>deleteBranchesTask});var init_branch=__esm({"src/lib/tasks/branch.ts"(){init_git_response_error(),init_parse_branch_delete(),init_parse_branch(),init_utils()}}),parseCheckIgnore,init_CheckIgnore=__esm({"src/lib/responses/CheckIgnore.ts"(){parseCheckIgnore=e=>e.split(/\n/g).map((e=>e.trim())).filter((e=>!!e))}}),check_ignore_exports={};function checkIgnoreTask(e){return{commands:["check-ignore",...e],format:"utf-8",parser:parseCheckIgnore}}__export(check_ignore_exports,{checkIgnoreTask:()=>checkIgnoreTask});var init_check_ignore=__esm({"src/lib/tasks/check-ignore.ts"(){init_CheckIgnore()}}),clone_exports={};function disallowedCommand(e){return/^--upload-pack(=|$)/.test(e)}function cloneTask(e,t,n){const r=["clone",...n];filterString(e)&&r.push(e),filterString(t)&&r.push(t);return r.find(disallowedCommand)?configurationErrorTask("git.fetch: potential exploit argument blocked."):straightThroughStringTask(r)}function cloneMirrorTask(e,t,n){return append(n,"--mirror"),cloneTask(e,t,n)}__export(clone_exports,{cloneMirrorTask:()=>cloneMirrorTask,cloneTask:()=>cloneTask});var init_clone=__esm({"src/lib/tasks/clone.ts"(){init_task(),init_utils()}}),parsers10;function parseFetchResult(e,t){return parseStringResponse({raw:e,remote:null,branches:[],tags:[],updated:[],deleted:[]},parsers10,[e,t])}var init_parse_fetch=__esm({"src/lib/parsers/parse-fetch.ts"(){init_utils(),parsers10=[new LineParser(/From (.+)$/,((e,[t])=>{e.remote=t})),new LineParser(/\* \[new branch]\s+(\S+)\s*-> (.+)$/,((e,[t,n])=>{e.branches.push({name:t,tracking:n})})),new LineParser(/\* \[new tag]\s+(\S+)\s*-> (.+)$/,((e,[t,n])=>{e.tags.push({name:t,tracking:n})})),new LineParser(/- \[deleted]\s+\S+\s*-> (.+)$/,((e,[t])=>{e.deleted.push({tracking:t})})),new LineParser(/\s*([^.]+)\.\.(\S+)\s+(\S+)\s*-> (.+)$/,((e,[t,n,r,i])=>{e.updated.push({name:r,tracking:i,to:n,from:t})}))]}}),fetch_exports={};function disallowedCommand2(e){return/^--upload-pack(=|$)/.test(e)}function fetchTask(e,t,n){const r=["fetch",...n];e&&t&&r.push(e,t);return r.find(disallowedCommand2)?configurationErrorTask("git.fetch: potential exploit argument blocked."):{commands:r,format:"utf-8",parser:parseFetchResult}}__export(fetch_exports,{fetchTask:()=>fetchTask});var init_fetch=__esm({"src/lib/tasks/fetch.ts"(){init_parse_fetch(),init_task()}}),parsers11;function parseMoveResult(e){return parseStringResponse({moves:[]},parsers11,e)}var init_parse_move=__esm({"src/lib/parsers/parse-move.ts"(){init_utils(),parsers11=[new LineParser(/^Renaming (.+) to (.+)$/,((e,[t,n])=>{e.moves.push({from:t,to:n})}))]}}),move_exports={};function moveTask(e,t){return{commands:["mv","-v",...asArray(e),t],format:"utf-8",parser:parseMoveResult}}__export(move_exports,{moveTask:()=>moveTask});var init_move=__esm({"src/lib/tasks/move.ts"(){init_parse_move(),init_utils()}}),pull_exports={};function pullTask(e,t,n){const r=["pull",...n];return e&&t&&r.splice(1,0,e,t),{commands:r,format:"utf-8",parser:(e,t)=>parsePullResult(e,t),onError(e,t,n,r){const i=parsePullErrorResult(bufferToString(e.stdOut),bufferToString(e.stdErr));if(i)return r(new GitResponseError(i));r(t)}}}__export(pull_exports,{pullTask:()=>pullTask});var init_pull=__esm({"src/lib/tasks/pull.ts"(){init_git_response_error(),init_parse_pull(),init_utils()}});function parseGetRemotes(e){const t={};return forEach$1(e,(([e])=>t[e]={name:e})),Object.values(t)}function parseGetRemotesVerbose(e){const t={};return forEach$1(e,(([e,n,r])=>{t.hasOwnProperty(e)||(t[e]={name:e,refs:{fetch:"",push:""}}),r&&n&&(t[e].refs[r.replace(/[^a-z]/g,"")]=n)})),Object.values(t)}function forEach$1(e,t){forEachLineWithContent(e,(e=>t(e.split(/\s+/))))}var init_GetRemoteSummary=__esm({"src/lib/responses/GetRemoteSummary.ts"(){init_utils()}}),remote_exports={};function addRemoteTask(e,t,n){return straightThroughStringTask(["remote","add",...n,e,t])}function getRemotesTask(e){const t=["remote"];return e&&t.push("-v"),{commands:t,format:"utf-8",parser:e?parseGetRemotesVerbose:parseGetRemotes}}function listRemotesTask(e){const t=[...e];return"ls-remote"!==t[0]&&t.unshift("ls-remote"),straightThroughStringTask(t)}function remoteTask(e){const t=[...e];return"remote"!==t[0]&&t.unshift("remote"),straightThroughStringTask(t)}function removeRemoteTask(e){return straightThroughStringTask(["remote","remove",e])}__export(remote_exports,{addRemoteTask:()=>addRemoteTask,getRemotesTask:()=>getRemotesTask,listRemotesTask:()=>listRemotesTask,remoteTask:()=>remoteTask,removeRemoteTask:()=>removeRemoteTask});var init_remote=__esm({"src/lib/tasks/remote.ts"(){init_GetRemoteSummary(),init_task()}}),stash_list_exports={};function stashListTask(e={},t){const n=parseLogOptions(e),r=["stash","list",...n.commands,...t],i=createListLogSummaryParser(n.splitter,n.fields,logFormatFromCommand(r));return validateLogFormatConfig(r)||{commands:r,format:"utf-8",parser:i}}__export(stash_list_exports,{stashListTask:()=>stashListTask});var init_stash_list=__esm({"src/lib/tasks/stash-list.ts"(){init_log_format(),init_parse_list_log_summary(),init_diff(),init_log()}}),sub_module_exports={};function addSubModuleTask(e,t){return subModuleTask(["add",e,t])}function initSubModuleTask(e){return subModuleTask(["init",...e])}function subModuleTask(e){const t=[...e];return"submodule"!==t[0]&&t.unshift("submodule"),straightThroughStringTask(t)}function updateSubModuleTask(e){return subModuleTask(["update",...e])}__export(sub_module_exports,{addSubModuleTask:()=>addSubModuleTask,initSubModuleTask:()=>initSubModuleTask,subModuleTask:()=>subModuleTask,updateSubModuleTask:()=>updateSubModuleTask});var init_sub_module=__esm({"src/lib/tasks/sub-module.ts"(){init_task()}}),TagList,parseTagList;function singleSorted(e,t){const n=isNaN(e);return n!==isNaN(t)?n?1:-1:n?sorted(e,t):0}function sorted(e,t){return e===t?0:e>t?1:-1}function trimmed(e){return e.trim()}function toNumber(e){return"string"==typeof e&&parseInt(e.replace(/^\D+/g,""),10)||0}var init_TagList=__esm({"src/lib/responses/TagList.ts"(){TagList=class{constructor(e,t){this.all=e,this.latest=t}},parseTagList=function(e,t=!1){const n=e.split("\n").map(trimmed).filter(Boolean);t||n.sort((function(e,t){const n=e.split("."),r=t.split(".");if(1===n.length||1===r.length)return singleSorted(toNumber(n[0]),toNumber(r[0]));for(let e=0,t=Math.max(n.length,r.length);ee.indexOf(".")>=0));return new TagList(n,r)}}}),tag_exports={};function tagListTask(e=[]){const t=e.some((e=>/^--sort=/.test(e)));return{format:"utf-8",commands:["tag","-l",...e],parser:e=>parseTagList(e,t)}}function addTagTask(e){return{format:"utf-8",commands:["tag",e],parser:()=>({name:e})}}function addAnnotatedTagTask(e,t){return{format:"utf-8",commands:["tag","-a","-m",t,e],parser:()=>({name:e})}}__export(tag_exports,{addAnnotatedTagTask:()=>addAnnotatedTagTask,addTagTask:()=>addTagTask,tagListTask:()=>tagListTask});var init_tag=__esm({"src/lib/tasks/tag.ts"(){init_TagList()}}),require_git=__commonJS({"src/git.js"(e,t){var{GitExecutor:n}=(init_git_executor(),__toCommonJS(git_executor_exports)),{SimpleGitApi:r}=(init_simple_git_api(),__toCommonJS(simple_git_api_exports)),{Scheduler:i}=(init_scheduler(),__toCommonJS(scheduler_exports)),{configurationErrorTask:o}=(init_task(),__toCommonJS(task_exports)),{asArray:s,filterArray:a,filterPrimitives:c,filterString:l,filterStringOrStringArray:u,filterType:d,getTrailingOptions:p,trailingFunctionArgument:f,trailingOptionsArgument:_}=(init_utils(),__toCommonJS(utils_exports)),{applyPatchTask:m}=(init_apply_patch(),__toCommonJS(apply_patch_exports)),{branchTask:h,branchLocalTask:g,deleteBranchesTask:A,deleteBranchTask:y}=(init_branch(),__toCommonJS(branch_exports)),{checkIgnoreTask:v}=(init_check_ignore(),__toCommonJS(check_ignore_exports)),{checkIsRepoTask:b}=(init_check_is_repo(),__toCommonJS(check_is_repo_exports)),{cloneTask:C,cloneMirrorTask:E}=(init_clone(),__toCommonJS(clone_exports)),{cleanWithOptionsTask:x,isCleanOptionsArray:S}=(init_clean(),__toCommonJS(clean_exports)),{diffSummaryTask:k}=(init_diff(),__toCommonJS(diff_exports)),{fetchTask:D}=(init_fetch(),__toCommonJS(fetch_exports)),{moveTask:w}=(init_move(),__toCommonJS(move_exports)),{pullTask:I}=(init_pull(),__toCommonJS(pull_exports)),{pushTagsTask:T}=(init_push(),__toCommonJS(push_exports)),{addRemoteTask:F,getRemotesTask:R,listRemotesTask:P,remoteTask:N,removeRemoteTask:B}=(init_remote(),__toCommonJS(remote_exports)),{getResetMode:O,resetTask:q}=(init_reset(),__toCommonJS(reset_exports)),{stashListTask:$}=(init_stash_list(),__toCommonJS(stash_list_exports)),{addSubModuleTask:Q,initSubModuleTask:L,subModuleTask:M,updateSubModuleTask:j}=(init_sub_module(),__toCommonJS(sub_module_exports)),{addAnnotatedTagTask:U,addTagTask:J,tagListTask:V}=(init_tag(),__toCommonJS(tag_exports)),{straightThroughBufferTask:H,straightThroughStringTask:G}=(init_task(),__toCommonJS(task_exports));function W(e,t){this._plugins=t,this._executor=new n(e.baseDir,new i(e.maxConcurrentProcesses),t),this._trimmed=e.trimmed}function z(e,t,n,r){return"string"!=typeof n?o(`git.${e}() requires a string 'repoPath'`):t(n,d(r,l),p(arguments))}(W.prototype=Object.create(r.prototype)).constructor=W,W.prototype.customBinary=function(e){return this._plugins.reconfigure("binary",e),this},W.prototype.env=function(e,t){return 1===arguments.length&&"object"==typeof e?this._executor.env=e:(this._executor.env=this._executor.env||{})[e]=t,this},W.prototype.stashList=function(e){return this._runTask($(_(arguments)||{},a(e)&&e||[]),f(arguments))},W.prototype.clone=function(){return this._runTask(z("clone",C,...arguments),f(arguments))},W.prototype.mirror=function(){return this._runTask(z("mirror",E,...arguments),f(arguments))},W.prototype.mv=function(e,t){return this._runTask(w(e,t),f(arguments))},W.prototype.checkoutLatestTag=function(e){var t=this;return this.pull((function(){t.tags((function(n,r){t.checkout(r.latest,e)}))}))},W.prototype.pull=function(e,t,n,r){return this._runTask(I(d(e,l),d(t,l),p(arguments)),f(arguments))},W.prototype.fetch=function(e,t){return this._runTask(D(d(e,l),d(t,l),p(arguments)),f(arguments))},W.prototype.silent=function(e){return console.warn("simple-git deprecation notice: git.silent: logging should be configured using the `debug` library / `DEBUG` environment variable, this will be an error in version 3"),this},W.prototype.tags=function(e,t){return this._runTask(V(p(arguments)),f(arguments))},W.prototype.rebase=function(){return this._runTask(G(["rebase",...p(arguments)]),f(arguments))},W.prototype.reset=function(e){return this._runTask(q(O(e),p(arguments)),f(arguments))},W.prototype.revert=function(e){const t=f(arguments);return"string"!=typeof e?this._runTask(o("Commit must be a string"),t):this._runTask(G(["revert",...p(arguments,0,!0),e]),t)},W.prototype.addTag=function(e){const t="string"==typeof e?J(e):o("Git.addTag requires a tag name");return this._runTask(t,f(arguments))},W.prototype.addAnnotatedTag=function(e,t){return this._runTask(U(e,t),f(arguments))},W.prototype.deleteLocalBranch=function(e,t,n){return this._runTask(y(e,"boolean"==typeof t&&t),f(arguments))},W.prototype.deleteLocalBranches=function(e,t,n){return this._runTask(A(e,"boolean"==typeof t&&t),f(arguments))},W.prototype.branch=function(e,t){return this._runTask(h(p(arguments)),f(arguments))},W.prototype.branchLocal=function(e){return this._runTask(g(),f(arguments))},W.prototype.raw=function(e){const t=!Array.isArray(e),n=[].slice.call(t?arguments:e,0);for(let e=0;ee.removeEventListener("abort",r)))}};return[{type:"spawn.before",action(t,n){e.aborted&&n.kill(new GitPluginError(void 0,"abort","Abort already signaled"))}},t]}function isConfigSwitch(e){return"string"==typeof e&&"-c"===e.trim().toLowerCase()}function preventProtocolOverride(e,t){if(isConfigSwitch(e)&&/^\s*protocol(.[a-z]+)?.allow/.test(t))throw new GitPluginError(void 0,"unsafe","Configuring protocol.allow is not permitted without enabling allowUnsafeExtProtocol")}function preventUploadPack(e,t){if(/^\s*--(upload|receive)-pack/.test(e))throw new GitPluginError(void 0,"unsafe","Use of --upload-pack or --receive-pack is not permitted without enabling allowUnsafePack");if("clone"===t&&/^\s*-u\b/.test(e))throw new GitPluginError(void 0,"unsafe","Use of clone with option -u is not permitted without enabling allowUnsafePack");if("push"===t&&/^\s*--exec\b/.test(e))throw new GitPluginError(void 0,"unsafe","Use of push with option --exec is not permitted without enabling allowUnsafePack")}function blockUnsafeOperationsPlugin({allowUnsafeProtocolOverride:e=!1,allowUnsafePack:t=!1}={}){return{type:"spawn.args",action:(n,r)=>(n.forEach(((i,o)=>{const s=o[...t,...e]}}init_git_response_error(),init_task_configuration_error(),init_check_is_repo(),init_clean(),init_config(),init_diff_name_status(),init_grep(),init_reset(),init_utils(),init_utils();var never=distExports$1.deferred().promise;function completionDetectionPlugin({onClose:e=!0,onExit:t=50}={}){function n(e,t,n){!1!==e&&(!0===e?t.promise:t.promise.then((()=>delay(e)))).then(n.done)}return{type:"spawn.after",action(r,i){return __async(this,arguments,(function*(r,{spawned:i,close:o}){var s,a;const c=function(){let r=-1;const i={close:distExports$1.deferred(),closeTimeout:distExports$1.deferred(),exit:distExports$1.deferred(),exitTimeout:distExports$1.deferred()},o=Promise.race([!1===e?never:i.closeTimeout.promise,!1===t?never:i.exitTimeout.promise]);return n(e,i.close,i.closeTimeout),n(t,i.exit,i.exitTimeout),{close(e){r=e,i.close.done()},exit(e){r=e,i.exit.done()},get exitCode(){return r},result:o}}();let l=!0,u=()=>{l=!1};null==(s=i.stdout)||s.on("data",u),null==(a=i.stderr)||a.on("data",u),i.on("error",u),i.on("close",(e=>c.close(e))),i.on("exit",(e=>c.exit(e)));try{yield c.result,l&&(yield delay(50)),o(c.exitCode)}catch(e){o(c.exitCode,e)}}))}}}init_utils();var WRONG_NUMBER_ERR="Invalid value supplied for custom binary, requires a single string or an array containing either one or two strings",WRONG_CHARS_ERR="Invalid value supplied for custom binary, restricted characters must be removed or supply the unsafe.allowUnsafeCustomBinary option";function isBadArgument(e){return!e||!/^([a-z]:)?([a-z0-9/.\\_-]+)$/i.test(e)}function toBinaryConfig(e,t){if(e.length<1||e.length>2)throw new GitPluginError(void 0,"binary",WRONG_NUMBER_ERR);if(e.some(isBadArgument)){if(!t)throw new GitPluginError(void 0,"binary",WRONG_CHARS_ERR);console.warn(WRONG_CHARS_ERR)}const[n,r]=e;return{binary:n,prefix:r}}function customBinaryPlugin(e,t=["git"],n=!1){let r=toBinaryConfig(asArray(t),n);e.on("binary",(e=>{r=toBinaryConfig(asArray(e),n)})),e.append("spawn.binary",(()=>r.binary)),e.append("spawn.args",(e=>r.prefix?[r.prefix,...e]:e))}function isTaskError(e){return!(!e.exitCode||!e.stdErr.length)}function getErrorMessage(e){return Buffer.concat([...e.stdOut,...e.stdErr])}function errorDetectionHandler(e=!1,t=isTaskError,n=getErrorMessage){return(r,i)=>!e&&r||!t(i)?r:n(i)}function errorDetectionPlugin(e){return{type:"task.error",action(t,n){const r=e(t.error,{stdErr:n.stdErr,stdOut:n.stdOut,exitCode:n.exitCode});return Buffer.isBuffer(r)?{error:new GitError(void 0,r.toString("utf-8"))}:{error:r}}}}init_git_error(),init_utils();var PluginStore=class{constructor(){this.plugins=new Set,this.events=new EventEmitter}on(e,t){this.events.on(e,t)}reconfigure(e,t){this.events.emit(e,t)}append(e,t){const n=append(this.plugins,{type:e,action:t});return()=>this.plugins.delete(n)}add(e){const t=[];return asArray(e).forEach((e=>e&&this.plugins.add(append(t,e)))),()=>{t.forEach((e=>this.plugins.delete(e)))}}exec(e,t,n){let r=t;const i=Object.freeze(Object.create(n));for(const t of this.plugins)t.type===e&&(r=t.action(r,i));return r}};function progressMonitorPlugin(e){const t="--progress",n=["checkout","clone","fetch","pull","push"],r={type:"spawn.args",action:(e,r)=>n.includes(r.method)?including(e,t):e};return[r,{type:"spawn.after",action(n,r){var i;r.commands.includes(t)&&(null==(i=r.spawned.stderr)||i.on("data",(t=>{const n=/^([\s\S]+?):\s*(\d+)% \((\d+)\/(\d+)\)/.exec(t.toString("utf8"));n&&e({method:r.method,stage:progressEventStage(n[1]),progress:asNumber(n[2]),processed:asNumber(n[3]),total:asNumber(n[4])})})))}}]}function progressEventStage(e){return String(e.toLowerCase().split(" ",1))||"unknown"}function spawnOptionsPlugin(e){const t=pick(e,["uid","gid"]);return{type:"spawn.options",action:e=>__spreadValues(__spreadValues({},t),e)}}function timeoutPlugin({block:e,stdErr:t=!0,stdOut:n=!0}){if(e>0)return{type:"spawn.after",action(r,i){var o,s;let a;function c(){a&&clearTimeout(a),a=setTimeout(u,e)}function l(){var e,t;null==(e=i.spawned.stdout)||e.off("data",c),null==(t=i.spawned.stderr)||t.off("data",c),i.spawned.off("exit",l),i.spawned.off("close",l),a&&clearTimeout(a)}function u(){l(),i.kill(new GitPluginError(void 0,"timeout","block timeout reached"))}n&&(null==(o=i.spawned.stdout)||o.on("data",c)),t&&(null==(s=i.spawned.stderr)||s.on("data",c)),i.spawned.on("exit",l),i.spawned.on("close",l),c()}}}function suffixPathsPlugin(){return{type:"spawn.args",action(e){const t=[];let n;function r(e){(n=n||[]).push(...e)}for(let n=0;nisPathSpec(e)&&toPaths(e)||e)));break}t.push(i)}}return n?[...t,"--",...n.map(String)]:t}}}init_utils(),init_utils(),init_pathspec(),init_utils();var Git=require_git();function gitInstanceFactory(e,t){var n;const r=new PluginStore,i=createInstanceConfig(e&&("string"==typeof e?{baseDir:e}:e)||{},t);if(!folderExists(i.baseDir))throw new GitConstructError(i,"Cannot use simple-git on a directory that does not exist");return Array.isArray(i.config)&&r.add(commandConfigPrefixingPlugin(i.config)),r.add(blockUnsafeOperationsPlugin(i.unsafe)),r.add(suffixPathsPlugin()),r.add(completionDetectionPlugin(i.completion)),i.abort&&r.add(abortPlugin(i.abort)),i.progress&&r.add(progressMonitorPlugin(i.progress)),i.timeout&&r.add(timeoutPlugin(i.timeout)),i.spawnOptions&&r.add(spawnOptionsPlugin(i.spawnOptions)),r.add(errorDetectionPlugin(errorDetectionHandler(!0))),i.errors&&r.add(errorDetectionPlugin(i.errors)),customBinaryPlugin(r,i.binary,null==(n=i.unsafe)?void 0:n.allowUnsafeCustomBinary),new Git(i,r)}init_git_response_error();var simpleGit=gitInstanceFactory,polyfills,hasRequiredPolyfills,legacyStreams,hasRequiredLegacyStreams,clone_1$1,hasRequiredClone$1,gracefulFs,hasRequiredGracefulFs;function requirePolyfills(){if(hasRequiredPolyfills)return polyfills;hasRequiredPolyfills=1;var e=require$$0$n,t=process.cwd,n=null,r=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){return n||(n=t.call(process)),n};try{process.cwd()}catch(e){}if("function"==typeof process.chdir){var i=process.chdir;process.chdir=function(e){n=null,i.call(process,e)},Object.setPrototypeOf&&Object.setPrototypeOf(process.chdir,i)}return polyfills=function(t){e.hasOwnProperty("O_SYMLINK")&&process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)&&function(t){t.lchmod=function(n,r,i){t.open(n,e.O_WRONLY|e.O_SYMLINK,r,(function(e,n){e?i&&i(e):t.fchmod(n,r,(function(e){t.close(n,(function(t){i&&i(e||t)}))}))}))},t.lchmodSync=function(n,r){var i,o=t.openSync(n,e.O_WRONLY|e.O_SYMLINK,r),s=!0;try{i=t.fchmodSync(o,r),s=!1}finally{if(s)try{t.closeSync(o)}catch(e){}else t.closeSync(o)}return i}}(t);t.lutimes||function(t){e.hasOwnProperty("O_SYMLINK")&&t.futimes?(t.lutimes=function(n,r,i,o){t.open(n,e.O_SYMLINK,(function(e,n){e?o&&o(e):t.futimes(n,r,i,(function(e){t.close(n,(function(t){o&&o(e||t)}))}))}))},t.lutimesSync=function(n,r,i){var o,s=t.openSync(n,e.O_SYMLINK),a=!0;try{o=t.futimesSync(s,r,i),a=!1}finally{if(a)try{t.closeSync(s)}catch(e){}else t.closeSync(s)}return o}):t.futimes&&(t.lutimes=function(e,t,n,r){r&&process.nextTick(r)},t.lutimesSync=function(){})}(t);t.chown=o(t.chown),t.fchown=o(t.fchown),t.lchown=o(t.lchown),t.chmod=n(t.chmod),t.fchmod=n(t.fchmod),t.lchmod=n(t.lchmod),t.chownSync=s(t.chownSync),t.fchownSync=s(t.fchownSync),t.lchownSync=s(t.lchownSync),t.chmodSync=i(t.chmodSync),t.fchmodSync=i(t.fchmodSync),t.lchmodSync=i(t.lchmodSync),t.stat=a(t.stat),t.fstat=a(t.fstat),t.lstat=a(t.lstat),t.statSync=c(t.statSync),t.fstatSync=c(t.fstatSync),t.lstatSync=c(t.lstatSync),t.chmod&&!t.lchmod&&(t.lchmod=function(e,t,n){n&&process.nextTick(n)},t.lchmodSync=function(){});t.chown&&!t.lchown&&(t.lchown=function(e,t,n,r){r&&process.nextTick(r)},t.lchownSync=function(){});"win32"===r&&(t.rename="function"!=typeof t.rename?t.rename:function(e){function n(n,r,i){var o=Date.now(),s=0;e(n,r,(function a(c){if(c&&("EACCES"===c.code||"EPERM"===c.code||"EBUSY"===c.code)&&Date.now()-o<6e4)return setTimeout((function(){t.stat(r,(function(t,o){t&&"ENOENT"===t.code?e(n,r,a):i(c)}))}),s),void(s<100&&(s+=10));i&&i(c)}))}return Object.setPrototypeOf&&Object.setPrototypeOf(n,e),n}(t.rename));function n(e){return e?function(n,r,i){return e.call(t,n,r,(function(e){l(e)&&(e=null),i&&i.apply(this,arguments)}))}:e}function i(e){return e?function(n,r){try{return e.call(t,n,r)}catch(e){if(!l(e))throw e}}:e}function o(e){return e?function(n,r,i,o){return e.call(t,n,r,i,(function(e){l(e)&&(e=null),o&&o.apply(this,arguments)}))}:e}function s(e){return e?function(n,r,i){try{return e.call(t,n,r,i)}catch(e){if(!l(e))throw e}}:e}function a(e){return e?function(n,r,i){function o(e,t){t&&(t.uid<0&&(t.uid+=4294967296),t.gid<0&&(t.gid+=4294967296)),i&&i.apply(this,arguments)}return"function"==typeof r&&(i=r,r=null),r?e.call(t,n,r,o):e.call(t,n,o)}:e}function c(e){return e?function(n,r){var i=r?e.call(t,n,r):e.call(t,n);return i&&(i.uid<0&&(i.uid+=4294967296),i.gid<0&&(i.gid+=4294967296)),i}:e}function l(e){return!e||("ENOSYS"===e.code||!(process.getuid&&0===process.getuid()||"EINVAL"!==e.code&&"EPERM"!==e.code))}t.read="function"!=typeof t.read?t.read:function(e){function n(n,r,i,o,s,a){var c;if(a&&"function"==typeof a){var l=0;c=function(u,d,p){if(u&&"EAGAIN"===u.code&&l<10)return l++,e.call(t,n,r,i,o,s,c);a.apply(this,arguments)}}return e.call(t,n,r,i,o,s,c)}return Object.setPrototypeOf&&Object.setPrototypeOf(n,e),n}(t.read),t.readSync="function"!=typeof t.readSync?t.readSync:(u=t.readSync,function(e,n,r,i,o){for(var s=0;;)try{return u.call(t,e,n,r,i,o)}catch(e){if("EAGAIN"===e.code&&s<10){s++;continue}throw e}});var u},polyfills}function requireLegacyStreams(){if(hasRequiredLegacyStreams)return legacyStreams;hasRequiredLegacyStreams=1;var e=require$$0$b.Stream;return legacyStreams=function(t){return{ReadStream:function n(r,i){if(!(this instanceof n))return new n(r,i);e.call(this);var o=this;this.path=r,this.fd=null,this.readable=!0,this.paused=!1,this.flags="r",this.mode=438,this.bufferSize=65536,i=i||{};for(var s=Object.keys(i),a=0,c=s.length;athis.end)throw new Error("start must be <= end");this.pos=this.start}if(null!==this.fd)return void process.nextTick((function(){o._read()}));t.open(this.path,this.flags,this.mode,(function(e,t){if(e)return o.emit("error",e),void(o.readable=!1);o.fd=t,o.emit("open",t),o._read()}))},WriteStream:function n(r,i){if(!(this instanceof n))return new n(r,i);e.call(this),this.path=r,this.fd=null,this.writable=!0,this.flags="w",this.encoding="binary",this.mode=438,this.bytesWritten=0,i=i||{};for(var o=Object.keys(i),s=0,a=o.length;s= zero");this.pos=this.start}this.busy=!1,this._queue=[],null===this.fd&&(this._open=t.open,this._queue.push([this._open,this.path,this.flags,this.mode,void 0]),this.flush())}}},legacyStreams}function requireClone$1(){if(hasRequiredClone$1)return clone_1$1;hasRequiredClone$1=1,clone_1$1=function(t){if(null===t||"object"!=typeof t)return t;if(t instanceof Object)var n={__proto__:e(t)};else n=Object.create(null);return Object.getOwnPropertyNames(t).forEach((function(e){Object.defineProperty(n,e,Object.getOwnPropertyDescriptor(t,e))})),n};var e=Object.getPrototypeOf||function(e){return e.__proto__};return clone_1$1}function requireGracefulFs(){if(hasRequiredGracefulFs)return gracefulFs;hasRequiredGracefulFs=1;var e,t,n=require$$0$7,r=requirePolyfills(),i=requireLegacyStreams(),o=requireClone$1(),s=require$$0__default;function a(t,n){Object.defineProperty(t,e,{get:function(){return n}})}"function"==typeof Symbol&&"function"==typeof Symbol.for?(e=Symbol.for("graceful-fs.queue"),t=Symbol.for("graceful-fs.previous")):(e="___graceful-fs.queue",t="___graceful-fs.previous");var c,l=function(){};if(s.debuglog?l=s.debuglog("gfs4"):/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&(l=function(){var e=s.format.apply(s,arguments);e="GFS4: "+e.split(/\n/).join("\nGFS4: "),console.error(e)}),!n[e]){var u=commonjsGlobal[e]||[];a(n,u),n.close=function(e){function r(t,r){return e.call(n,t,(function(e){e||f(),"function"==typeof r&&r.apply(this,arguments)}))}return Object.defineProperty(r,t,{value:e}),r}(n.close),n.closeSync=function(e){function r(t){e.apply(n,arguments),f()}return Object.defineProperty(r,t,{value:e}),r}(n.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&process.on("exit",(function(){l(n[e]),require$$0$f.equal(n[e].length,0)}))}function d(e){r(e),e.gracefulify=d,e.createReadStream=function(t,n){return new e.ReadStream(t,n)},e.createWriteStream=function(t,n){return new e.WriteStream(t,n)};var t=e.readFile;e.readFile=function(e,n,r){"function"==typeof n&&(r=n,n=null);return function e(n,r,i,o){return t(n,r,(function(t){!t||"EMFILE"!==t.code&&"ENFILE"!==t.code?"function"==typeof i&&i.apply(this,arguments):p([e,[n,r,i],t,o||Date.now(),Date.now()])}))}(e,n,r)};var n=e.writeFile;e.writeFile=function(e,t,r,i){"function"==typeof r&&(i=r,r=null);return function e(t,r,i,o,s){return n(t,r,i,(function(n){!n||"EMFILE"!==n.code&&"ENFILE"!==n.code?"function"==typeof o&&o.apply(this,arguments):p([e,[t,r,i,o],n,s||Date.now(),Date.now()])}))}(e,t,r,i)};var o=e.appendFile;o&&(e.appendFile=function(e,t,n,r){"function"==typeof n&&(r=n,n=null);return function e(t,n,r,i,s){return o(t,n,r,(function(o){!o||"EMFILE"!==o.code&&"ENFILE"!==o.code?"function"==typeof i&&i.apply(this,arguments):p([e,[t,n,r,i],o,s||Date.now(),Date.now()])}))}(e,t,n,r)});var s=e.copyFile;s&&(e.copyFile=function(e,t,n,r){"function"==typeof n&&(r=n,n=0);return function e(t,n,r,i,o){return s(t,n,r,(function(s){!s||"EMFILE"!==s.code&&"ENFILE"!==s.code?"function"==typeof i&&i.apply(this,arguments):p([e,[t,n,r,i],s,o||Date.now(),Date.now()])}))}(e,t,n,r)});var a=e.readdir;e.readdir=function(e,t,n){"function"==typeof t&&(n=t,t=null);var r=c.test(process.version)?function(e,t,n,r){return a(e,i(e,t,n,r))}:function(e,t,n,r){return a(e,t,i(e,t,n,r))};return r(e,t,n);function i(e,t,n,i){return function(o,s){!o||"EMFILE"!==o.code&&"ENFILE"!==o.code?(s&&s.sort&&s.sort(),"function"==typeof n&&n.call(this,o,s)):p([r,[e,t,n],o,i||Date.now(),Date.now()])}}};var c=/^v[0-5]\./;if("v0.8"===process.version.substr(0,4)){var l=i(e);h=l.ReadStream,g=l.WriteStream}var u=e.ReadStream;u&&(h.prototype=Object.create(u.prototype),h.prototype.open=function(){var e=this;y(e.path,e.flags,e.mode,(function(t,n){t?(e.autoClose&&e.destroy(),e.emit("error",t)):(e.fd=n,e.emit("open",n),e.read())}))});var f=e.WriteStream;f&&(g.prototype=Object.create(f.prototype),g.prototype.open=function(){var e=this;y(e.path,e.flags,e.mode,(function(t,n){t?(e.destroy(),e.emit("error",t)):(e.fd=n,e.emit("open",n))}))}),Object.defineProperty(e,"ReadStream",{get:function(){return h},set:function(e){h=e},enumerable:!0,configurable:!0}),Object.defineProperty(e,"WriteStream",{get:function(){return g},set:function(e){g=e},enumerable:!0,configurable:!0});var _=h;Object.defineProperty(e,"FileReadStream",{get:function(){return _},set:function(e){_=e},enumerable:!0,configurable:!0});var m=g;function h(e,t){return this instanceof h?(u.apply(this,arguments),this):h.apply(Object.create(h.prototype),arguments)}function g(e,t){return this instanceof g?(f.apply(this,arguments),this):g.apply(Object.create(g.prototype),arguments)}Object.defineProperty(e,"FileWriteStream",{get:function(){return m},set:function(e){m=e},enumerable:!0,configurable:!0});var A=e.open;function y(e,t,n,r){return"function"==typeof n&&(r=n,n=null),function e(t,n,r,i,o){return A(t,n,r,(function(s,a){!s||"EMFILE"!==s.code&&"ENFILE"!==s.code?"function"==typeof i&&i.apply(this,arguments):p([e,[t,n,r,i],s,o||Date.now(),Date.now()])}))}(e,t,n,r)}return e.open=y,e}function p(t){l("ENQUEUE",t[0].name,t[1]),n[e].push(t),_()}function f(){for(var t=Date.now(),r=0;r2&&(n[e][r][3]=t,n[e][r][4]=t);_()}function _(){if(clearTimeout(c),c=void 0,0!==n[e].length){var t=n[e].shift(),r=t[0],i=t[1],o=t[2],s=t[3],a=t[4];if(void 0===s)l("RETRY",r.name,i),r.apply(null,i);else if(Date.now()-s>=6e4){l("TIMEOUT",r.name,i);var u=i.pop();"function"==typeof u&&u.call(null,o)}else{var d=Date.now()-a,p=Math.max(a-s,1);d>=Math.min(1.2*p,100)?(l("RETRY",r.name,i),r.apply(null,i.concat([s]))):n[e].push(t)}void 0===c&&(c=setTimeout(_,0))}}return commonjsGlobal[e]||a(commonjsGlobal,n[e]),gracefulFs=d(o(n)),process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!n.__patched&&(gracefulFs=d(n),n.__patched=!0),gracefulFs}var gracefulFsExports=requireGracefulFs(),fs=getDefaultExportFromCjs(gracefulFsExports);const homeDirectory=require$$0$9.homedir(),{env:env}=process,xdgData=env.XDG_DATA_HOME||(homeDirectory?require$$0$8.join(homeDirectory,".local","share"):void 0),xdgConfig=env.XDG_CONFIG_HOME||(homeDirectory?require$$0$8.join(homeDirectory,".config"):void 0);env.XDG_STATE_HOME||homeDirectory&&require$$0$8.join(homeDirectory,".local","state"),env.XDG_CACHE_HOME||homeDirectory&&require$$0$8.join(homeDirectory,".cache"),env.XDG_RUNTIME_DIR;const xdgDataDirectories=(env.XDG_DATA_DIRS||"/usr/local/share/:/usr/share/").split(":");xdgData&&xdgDataDirectories.unshift(xdgData);const xdgConfigDirectories=(env.XDG_CONFIG_DIRS||"/etc/xdg").split(":");xdgConfig&&xdgConfigDirectories.unshift(xdgConfig);const attemptifyAsync=(e,t)=>function(...n){return e.apply(void 0,n).catch(t)},attemptifySync=(e,t)=>function(...n){try{return e.apply(void 0,n)}catch(e){return t(e)}},IS_USER_ROOT=!!process$2.getuid&&!process$2.getuid(),LIMIT_FILES_DESCRIPTORS=1e4,NOOP=()=>{},Handlers={isChangeErrorOk:e=>{if(!Handlers.isNodeError(e))return!1;const{code:t}=e;return"ENOSYS"===t||!(IS_USER_ROOT||"EINVAL"!==t&&"EPERM"!==t)},isNodeError:e=>e instanceof Error,isRetriableError:e=>{if(!Handlers.isNodeError(e))return!1;const{code:t}=e;return"EMFILE"===t||"ENFILE"===t||"EAGAIN"===t||"EBUSY"===t||"EACCESS"===t||"EACCES"===t||"EACCS"===t||"EPERM"===t},onChangeError:e=>{if(!Handlers.isNodeError(e))throw e;if(!Handlers.isChangeErrorOk(e))throw e}};class RetryfyQueue{constructor(){this.interval=25,this.intervalId=void 0,this.limit=LIMIT_FILES_DESCRIPTORS,this.queueActive=new Set,this.queueWaiting=new Set,this.init=()=>{this.intervalId||(this.intervalId=setInterval(this.tick,this.interval))},this.reset=()=>{this.intervalId&&(clearInterval(this.intervalId),delete this.intervalId)},this.add=e=>{this.queueWaiting.add(e),this.queueActive.size{this.queueWaiting.delete(e),this.queueActive.delete(e)},this.schedule=()=>new Promise((e=>{const t=()=>this.remove(n),n=()=>e(t);this.add(n)})),this.tick=()=>{if(!(this.queueActive.size>=this.limit)){if(!this.queueWaiting.size)return this.reset();for(const e of this.queueWaiting){if(this.queueActive.size>=this.limit)break;this.queueWaiting.delete(e),this.queueActive.add(e),e()}}}}}var RetryfyQueue$1=new RetryfyQueue;const retryifyAsync=(e,t)=>function(n){return function r(...i){return RetryfyQueue$1.schedule().then((o=>e.apply(void 0,i).then((e=>(o(),e)),(e=>{if(o(),Date.now()>=n)throw e;if(t(e)){const e=Math.round(100*Math.random()),t=new Promise((t=>setTimeout(t,e)));return t.then((()=>r.apply(void 0,i)))}throw e}))))}},retryifySync=(e,t)=>function(n){return function r(...i){try{return e.apply(void 0,i)}catch(e){if(Date.now()>n)throw e;if(t(e))return r.apply(void 0,i);throw e}}},FS={attempt:{chmod:attemptifyAsync(promisify(fs$6.chmod),Handlers.onChangeError),chown:attemptifyAsync(promisify(fs$6.chown),Handlers.onChangeError),close:attemptifyAsync(promisify(fs$6.close),NOOP),fsync:attemptifyAsync(promisify(fs$6.fsync),NOOP),mkdir:attemptifyAsync(promisify(fs$6.mkdir),NOOP),realpath:attemptifyAsync(promisify(fs$6.realpath),NOOP),stat:attemptifyAsync(promisify(fs$6.stat),NOOP),unlink:attemptifyAsync(promisify(fs$6.unlink),NOOP),chmodSync:attemptifySync(fs$6.chmodSync,Handlers.onChangeError),chownSync:attemptifySync(fs$6.chownSync,Handlers.onChangeError),closeSync:attemptifySync(fs$6.closeSync,NOOP),existsSync:attemptifySync(fs$6.existsSync,NOOP),fsyncSync:attemptifySync(fs$6.fsync,NOOP),mkdirSync:attemptifySync(fs$6.mkdirSync,NOOP),realpathSync:attemptifySync(fs$6.realpathSync,NOOP),statSync:attemptifySync(fs$6.statSync,NOOP),unlinkSync:attemptifySync(fs$6.unlinkSync,NOOP)},retry:{close:retryifyAsync(promisify(fs$6.close),Handlers.isRetriableError),fsync:retryifyAsync(promisify(fs$6.fsync),Handlers.isRetriableError),open:retryifyAsync(promisify(fs$6.open),Handlers.isRetriableError),readFile:retryifyAsync(promisify(fs$6.readFile),Handlers.isRetriableError),rename:retryifyAsync(promisify(fs$6.rename),Handlers.isRetriableError),stat:retryifyAsync(promisify(fs$6.stat),Handlers.isRetriableError),write:retryifyAsync(promisify(fs$6.write),Handlers.isRetriableError),writeFile:retryifyAsync(promisify(fs$6.writeFile),Handlers.isRetriableError),closeSync:retryifySync(fs$6.closeSync,Handlers.isRetriableError),fsyncSync:retryifySync(fs$6.fsyncSync,Handlers.isRetriableError),openSync:retryifySync(fs$6.openSync,Handlers.isRetriableError),readFileSync:retryifySync(fs$6.readFileSync,Handlers.isRetriableError),renameSync:retryifySync(fs$6.renameSync,Handlers.isRetriableError),statSync:retryifySync(fs$6.statSync,Handlers.isRetriableError),writeSync:retryifySync(fs$6.writeSync,Handlers.isRetriableError),writeFileSync:retryifySync(fs$6.writeFileSync,Handlers.isRetriableError)}},DEFAULT_ENCODING="utf8",DEFAULT_FILE_MODE=438,DEFAULT_FOLDER_MODE=511,DEFAULT_WRITE_OPTIONS={},DEFAULT_USER_UID=os$1.userInfo().uid,DEFAULT_USER_GID=os$1.userInfo().gid,DEFAULT_TIMEOUT_SYNC=1e3,IS_POSIX=!!process$2.getuid;process$2.getuid&&process$2.getuid();const LIMIT_BASENAME_LENGTH=128,isException=e=>e instanceof Error&&"code"in e,isString$1=e=>"string"==typeof e,isUndefined=e=>void 0===e,IS_LINUX="linux"===process$2.platform,IS_WINDOWS="win32"===process$2.platform,Signals=["SIGABRT","SIGALRM","SIGHUP","SIGINT","SIGTERM"];IS_WINDOWS||Signals.push("SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT"),IS_LINUX&&Signals.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT","SIGUNUSED");class Interceptor{constructor(){this.callbacks=new Set,this.exited=!1,this.exit=e=>{if(!this.exited){this.exited=!0;for(const e of this.callbacks)e();e&&(IS_WINDOWS&&"SIGINT"!==e&&"SIGTERM"!==e&&"SIGKILL"!==e?process$2.kill(process$2.pid,"SIGTERM"):process$2.kill(process$2.pid,e))}},this.hook=()=>{process$2.once("exit",(()=>this.exit()));for(const e of Signals)try{process$2.once(e,(()=>this.exit(e)))}catch{}},this.register=e=>(this.callbacks.add(e),()=>{this.callbacks.delete(e)}),this.hook()}}var Interceptor$1=new Interceptor;const whenExit=Interceptor$1.register,Temp={store:{},create:e=>{const t=`000000${Math.floor(16777215*Math.random()).toString(16)}`.slice(-6);return`${e}${`.tmp-${Date.now().toString().slice(-10)}${t}`}`},get:(e,t,n=!0)=>{const r=Temp.truncate(t(e));if(r in Temp.store)return Temp.get(e,t,n);Temp.store[r]=n;return[r,()=>delete Temp.store[r]]},purge:e=>{Temp.store[e]&&(delete Temp.store[e],FS.attempt.unlink(e))},purgeSync:e=>{Temp.store[e]&&(delete Temp.store[e],FS.attempt.unlinkSync(e))},purgeSyncAll:()=>{for(const e in Temp.store)Temp.purgeSync(e)},truncate:e=>{const t=path$1.basename(e);if(t.length<=LIMIT_BASENAME_LENGTH)return e;const n=/^(\.?)(.*?)((?:\.[^.]+)?(?:\.tmp-\d{10}[a-f0-9]{6})?)$/.exec(t);if(!n)return e;const r=t.length-LIMIT_BASENAME_LENGTH;return`${e.slice(0,-t.length)}${n[1]}${n[2].slice(0,-r)}${n[3]}`}};function writeFileSync(e,t,n=DEFAULT_WRITE_OPTIONS){if(isString$1(n))return writeFileSync(e,t,{encoding:n});const r=Date.now()+((n.timeout??DEFAULT_TIMEOUT_SYNC)||-1);let i=null,o=null,s=null;try{const a=FS.attempt.realpathSync(e),c=!!a;e=a||e,[o,i]=Temp.get(e,n.tmpCreate||Temp.create,!(!1===n.tmpPurge));const l=IS_POSIX&&isUndefined(n.chown),u=isUndefined(n.mode);if(c&&(l||u)){const t=FS.attempt.statSync(e);t&&(n={...n},l&&(n.chown={uid:t.uid,gid:t.gid}),u&&(n.mode=t.mode))}if(!c){const t=path$1.dirname(e);FS.attempt.mkdirSync(t,{mode:DEFAULT_FOLDER_MODE,recursive:!0})}s=FS.retry.openSync(r)(o,"w",n.mode||DEFAULT_FILE_MODE),n.tmpCreated&&n.tmpCreated(o),isString$1(t)?FS.retry.writeSync(r)(s,t,0,n.encoding||DEFAULT_ENCODING):isUndefined(t)||FS.retry.writeSync(r)(s,t,0,t.length,0),!1!==n.fsync&&(!1!==n.fsyncWait?FS.retry.fsyncSync(r)(s):FS.attempt.fsync(s)),FS.retry.closeSync(r)(s),s=null,!n.chown||n.chown.uid===DEFAULT_USER_UID&&n.chown.gid===DEFAULT_USER_GID||FS.attempt.chownSync(o,n.chown.uid,n.chown.gid),n.mode&&n.mode!==DEFAULT_FILE_MODE&&FS.attempt.chmodSync(o,n.mode);try{FS.retry.renameSync(r)(o,e)}catch(t){if(!isException(t))throw t;if("ENAMETOOLONG"!==t.code)throw t;FS.retry.renameSync(r)(o,Temp.truncate(e))}i(),o=null}finally{s&&FS.attempt.closeSync(s),o&&Temp.purge(o)}}whenExit(Temp.purgeSyncAll);const isObject$4=e=>{const t=typeof e;return null!==e&&("object"===t||"function"===t)},disallowedKeys=new Set(["__proto__","prototype","constructor"]),digits=new Set("0123456789");function getPathSegments(e){const t=[];let n="",r="start",i=!1;for(const o of e)switch(o){case"\\":if("index"===r)throw new Error("Invalid character in an index");if("indexEnd"===r)throw new Error("Invalid character after an index");i&&(n+=o),r="property",i=!i;break;case".":if("index"===r)throw new Error("Invalid character in an index");if("indexEnd"===r){r="property";break}if(i){i=!1,n+=o;break}if(disallowedKeys.has(n))return[];t.push(n),n="",r="property";break;case"[":if("index"===r)throw new Error("Invalid character in an index");if("indexEnd"===r){r="index";break}if(i){i=!1,n+=o;break}if("property"===r){if(disallowedKeys.has(n))return[];t.push(n),n=""}r="index";break;case"]":if("index"===r){t.push(Number.parseInt(n,10)),n="",r="indexEnd";break}if("indexEnd"===r)throw new Error("Invalid character after an index");default:if("index"===r&&!digits.has(o))throw new Error("Invalid character in an index");if("indexEnd"===r)throw new Error("Invalid character after an index");"start"===r&&(r="property"),i&&(i=!1,n+="\\"),n+=o}switch(i&&(n+="\\"),r){case"property":if(disallowedKeys.has(n))return[];t.push(n);break;case"index":throw new Error("Index was not closed");case"start":t.push("")}return t}function isStringIndex(e,t){if("number"!=typeof t&&Array.isArray(e)){const n=Number.parseInt(t,10);return Number.isInteger(n)&&e[n]===e[t]}return!1}function assertNotStringIndex(e,t){if(isStringIndex(e,t))throw new Error("Cannot use string index")}function getProperty(e,t,n){if(!isObject$4(e)||"string"!=typeof t)return void 0===n?e:n;const r=getPathSegments(t);if(0===r.length)return n;for(let t=0;te.json())).then((t=>t["dist-tags"][e])).catch((e=>(error(`error fetching version from npm registry: ${e.message}`),pkg.version))):this?.config?.version||pkg.version}async function getMajorPkgVersion(e){return semver.major(await getPkgVersion.call(this,e))}async function promptTerminal(e,t){function n(){isCI()&&(process.stdout.write("\n"),process.stdout.write("Yikes! Looks like we were about to prompt you for something in a CI environment. Are you missing an argument?"),process.stdout.write("\n\n"),process.stdout.write("Try running `rdme --help` or get in touch at support@readme.io."),process.stdout.write("\n\n"),process.exit(1))}return Array.isArray(e)?e=e.map((e=>({onRender:n,...e}))):e.onRender=n,prompts(e,{onCancel:()=>{process.stdout.write("\n"),process.stdout.write("Thanks for using rdme! See you soon ✌️"),process.stdout.write("\n\n"),process.exit(1)},...t})}const cleanFileName=e=>e.replace(/[^a-z0-9]/gi,"-");function validateFilePath(e,t=e=>e){if(e.length){const n=t(e);return!fs$6.existsSync(n)||"Specified output path already exists."}return"An output path must be supplied."}function validateSubdomain(e){return/^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*$/.test(e)||"Project subdomain must contain only letters, numbers and dashes."}const yamlBase="# This GitHub Actions workflow was auto-generated by the `rdme` cli on {{timestamp}}\n# You can view our full documentation here: https://docs.readme.com/docs/rdme\nname: ReadMe GitHub Action 🦉\n\non:\n push:\n branches:\n # This workflow will run every time you push code to the following branch: `{{branch}}`\n # Check out GitHub's docs for more info on configuring this:\n # https://docs.github.com/actions/using-workflows/events-that-trigger-workflows\n - {{branch}}\n\njobs:\n rdme-{{cleanCommand}}:\n runs-on: ubuntu-latest\n steps:\n - name: Check out repo 📚\n uses: actions/checkout@v4\n\n - name: Run `{{command}}` command 🚀\n uses: readmeio/rdme@{{rdmeVersion}}\n with:\n rdme: {{commandString}}\n",getConfigStoreKey=e=>`createGHA.${e}`,GITHUB_WORKFLOW_DIR=".github/workflows",GITHUB_SECRET_NAME="README_API_KEY",git=simpleGit(),getGHAFileName=e=>path$1.join(GITHUB_WORKFLOW_DIR,`${cleanFileName(e).toLowerCase()}.yml`);function getKey$1(e,t){return!!Object.keys(e).some((e=>"key"===e))&&`••••••••••••${t.key?.slice(-5)||""}`}function constructCommandString(e,t,n,r){return`${e} ${Object.keys(t).map((e=>r[e])).filter(Boolean).join(" ")} ${Object.keys(n).map((e=>{const t=r[e];return"key"===e?`--key=\${{ secrets.${GITHUB_SECRET_NAME} }}`:"github"!==e&&("boolean"===n[e].type&&t?`--${e}`:!!t&&`--${e}=${t}`)})).filter(Boolean).join(" ")}`.trim()}async function getGitData(){const e=/^ {2}HEAD branch: /g,t=/^ {2}HEAD branch:.*/gm,n=await git.checkIsRepo().catch((e=>(this.debug(`[getGitData] error running git repo check: ${e.message}`),!1)));let r,i;this.debug(`[getGitData] isRepo result: ${n}`);const o=await git.remote([]).catch((e=>(this.debug(`[getGitData] error grabbing git remotes: ${e.message}`),"")));if(this.debug(`[getGitData] rawRemotes result: ${o}`),o){const n=o.split("\n")[0];this.debug(`[getGitData] remote result: ${n}`);const s=await git.remote(["show",n]).catch((e=>(this.debug(`[getGitData] error accessing remote: ${e.message}`),"")));this.debug(`[getGitData] rawRemote result: ${s}`);const a=t.exec(s)?.[0];this.debug(`[getGitData] rawHead result: ${a}`),a&&(i=a.replace(e,""));const c=await git.remote(["-v"]);this.debug(`[getGitData] remotesList result: ${c}`),r=/github/.test(c)}this.debug(`[getGitData] containsGitHubRemote result: ${r}`),this.debug(`[getGitData] defaultBranch result: ${i}`);const s=await git.revparse(["--show-toplevel"]).catch((e=>(this.debug(`[getGitData] error grabbing git root: ${e.message}`),"")));return this.debug(`[getGitData] repoRoot result: ${s}`),{containsGitHubRemote:r,defaultBranch:i,isRepo:n,repoRoot:s}}async function createGHA(e,t,n){const{args:r,flags:i,id:o}=t;if(!o)throw new Error("unable to determine command ID yikes");if(this.debug(`running GHA onboarding for ${o} command`),this.debug(`opts used in createGHA: ${JSON.stringify(n)}`),!n.github&&(isCI()||isNpmScript()||isTest()&&!process.env.TEST_RDME_CREATEGHA))return this.debug("not running GHA onboarding workflow in CI, npm script, or default test env, exiting 👋"),e;const{containsGitHubRemote:s,defaultBranch:a,isRepo:c,repoRoot:l}=await getGitData.call(this),u=configstore.get(getConfigStoreKey(l));this.debug(`repo value in config: ${u}`);const d=await getMajorPkgVersion.call(this);if(this.debug(`major pkg version: ${d}`),!n.github&&(!c||u===d||c&&!s))return this.debug("not running GHA onboarding workflow, exiting"),e;e&&info(e,{includeEmojiPrefix:!1}),n.github?info(chalk.bold("\n🚀 Let's get you set up with GitHub Actions! 🚀\n"),{includeEmojiPrefix:!1}):info(["",chalk.bold("🐙 Looks like you're running this command in a GitHub Repository! 🐙"),"",`🚀 With a few quick clicks, you can run this \`${o}\` command via GitHub Actions (${chalk.underline("https://github.com/features/actions")})`,"",`✨ This means it will run ${chalk.italic("automagically")} with every push to a branch of your choice!`,""].join("\n"),{includeEmojiPrefix:!1});const p=process.cwd();l&&l!==p&&(process.chdir(l),this.debug(`switching working directory from ${p} to ${process.cwd()}`)),prompts.override({shouldCreateGHA:n.github});const{branch:f,filePath:_,shouldCreateGHA:m}=await promptTerminal([{message:"Would you like to add a GitHub Actions workflow?",name:"shouldCreateGHA",type:"confirm",initial:!0},{message:"What GitHub branch should this workflow run on?",name:"branch",type:"text",initial:a||"main"},{message:"What would you like to name the GitHub Actions workflow file?",name:"filePath",type:"text",initial:cleanFileName(`rdme-${o}`),format:e=>getGHAFileName(e),validate:e=>validateFilePath(e,getGHAFileName)}],{onSubmit:(e,t,n)=>!n.shouldCreateGHA});if(!m)throw configstore.set(getConfigStoreKey(l),d),new Error("GitHub Actions workflow creation cancelled. If you ever change your mind, you can run this command again with the `--github` flag.");const h={branch:f,cleanCommand:cleanFileName(o),command:o,commandString:constructCommandString(o,r,i,n),rdmeVersion:`v${d}`,timestamp:(new Date).toISOString()};this.debug(`data for resolver: ${JSON.stringify(h)}`);let g=yamlBase;Object.keys(h).forEach((e=>{g=g.replace(new RegExp(`{{${e}}}`,"g"),h[e])})),fs$6.existsSync(GITHUB_WORKFLOW_DIR)||(this.debug("GHA workflow directory does not exist, creating"),fs$6.mkdirSync(GITHUB_WORKFLOW_DIR,{recursive:!0})),fs$6.writeFileSync(_,g);const A=[chalk.green("\nYour GitHub Actions workflow file has been created! ✨\n")],y=getKey$1(i,n);return y?A.push(chalk.bold("Almost done! Just a couple more steps:"),`1. Push your newly created file (${chalk.underline(_)}) to GitHub 🚀`,`2. Create a GitHub secret called ${chalk.bold(GITHUB_SECRET_NAME)} and populate the value with your ReadMe API key (${y}) 🔑`,"",`🔐 Check out GitHub's docs for more info on creating encrypted secrets (${chalk.underline("https://docs.github.com/actions/security-guides/encrypted-secrets#creating-encrypted-secrets-for-a-repository")})`):A.push(`${chalk.bold("Almost done!")} Push your newly created file (${chalk.underline(_)}) to GitHub and you're all set 🚀`),A.push("",`🦉 If you have any more questions, feel free to drop us a line! ${chalk.underline("support@readme.io")}`,""),Promise.resolve(A.join("\n"))}const SUCCESS_NO_CONTENT=204;function getProxy(){return process.env.HTTPS_PROXY||process.env.https_proxy}function stripQuotes(e){return e?e.replace(/(^"|[",]*$)/g,""):""}function parseWarningHeader(e){try{let t;return e.split(/([0-9]{3} [a-z0-9.@\-/]*) /g).reduce(((e,n)=>{const r=(n=n.trim()).match(/^([0-9]{3}) (.*)/);if(r)t={code:r[1],agent:r[2],message:""};else if(n){const r=n.split(/" "/);r&&(t.message=stripQuotes(r[0]),t.date=stripQuotes(r[1]),e.push(t))}return e}),[])}catch(t){return debug(`error parsing warning header: ${t.message}`),[{code:"199",agent:"-",message:e}]}}function getUserAgent(){return`rdme${isGHA()?"-github":""}/${pkg.version}`}async function normalizeFilePath(e){if("path"===e.fileType){const t=await git.revparse(["--show-toplevel"]).catch((e=>(debug(`[fetch] error grabbing git root: ${e.message}`),"")));return path$1.relative(t,e.filePath)}return e.filePath}function sanitizeHeaders(e){const t=Array.from(e.entries()).reduce(((e,t)=>(e[t[0]]="authorization"===t[0].toLowerCase()?"redacted":t[1],e)),{});return JSON.stringify(t)}async function readmeAPIv1Fetch(e,t={headers:new Headers},n={filePath:"",fileType:!1}){let r="cli",i=t.headers;if(t.headers instanceof Headers||(i=new Headers(t.headers)),i.set("User-Agent",getUserAgent()),isGHA()){r="cli-gh",process.env.GITHUB_REPOSITORY&&i.set("x-github-repository",process.env.GITHUB_REPOSITORY),process.env.GITHUB_RUN_ATTEMPT&&i.set("x-github-run-attempt",process.env.GITHUB_RUN_ATTEMPT),process.env.GITHUB_RUN_ID&&i.set("x-github-run-id",process.env.GITHUB_RUN_ID),process.env.GITHUB_RUN_NUMBER&&i.set("x-github-run-number",process.env.GITHUB_RUN_NUMBER),process.env.GITHUB_SHA&&i.set("x-github-sha",process.env.GITHUB_SHA);const e=await normalizeFilePath(n);if(e)try{const t=new URL(`${process.env.GITHUB_SERVER_URL}/${process.env.GITHUB_REPOSITORY}/blob/${process.env.GITHUB_SHA}/${e}`).href;i.set("x-readme-source-url",t)}catch(e){debug(`error constructing github source url: ${e.message}`)}}isCI()&&i.set("x-rdme-ci",ciName()),i.set("x-readme-source",r),n.filePath&&"url"===n.fileType&&i.set("x-readme-source-url",n.filePath);const o=`${config.host}${e}`,s=getProxy();return debug(`making ${(t.method||"get").toUpperCase()} request to ${o} ${s?`with proxy ${s} and `:""}with headers: ${sanitizeHeaders(i)}`),fetch(o,{...t,headers:i,dispatcher:s?new undiciExports.ProxyAgent(s):void 0}).then((e=>{const t=e.headers.get("Warning");if(t){debug(`received warning header: ${t}`);parseWarningHeader(t).forEach((e=>{warn(e.message,"ReadMe API Warning:")}))}return e})).catch((e=>{throw debug(`error making fetch request: ${e}`),e}))}async function handleAPIv1Res(e,t=!0){const n=e.headers.get("content-type")||"";if("json"===mime.extension(n)){const n=await e.json();return debug(`received status code ${e.status} from ${e.url} with JSON response: ${JSON.stringify(n)}`),n.error&&t?Promise.reject(new APIv1Error(n)):n}if(e.status===SUCCESS_NO_CONTENT)return debug(`received status code ${e.status} from ${e.url} with no content`),{};const r=await e.text();return debug(`received status code ${e.status} from ${e.url} with non-JSON response: ${r}`),Promise.reject(r)}function cleanAPIv1Headers(e,t,n=new Headers){const r=Buffer.from(`${e}:`).toString("base64"),i=new Headers({Authorization:`Basic ${r}`});t&&i.set("x-readme-version",t);for(const e of n.entries())"null"!==e[1]&&"undefined"!==e[1]&&e[1].length>0&&i.set(e[0],e[1]);return i}async function getCategories(e,t){const{firstPage:n,totalCount:r}=await async function(){let n=0;return readmeAPIv1Fetch("/api/v1/categories?perPage=20&page=1",{method:"get",headers:cleanAPIv1Headers(e,t,new Headers({Accept:"application/json"}))}).then((e=>(n=Math.ceil(parseInt(e.headers.get("x-total-count")||"0",10)/20),handleAPIv1Res(e)))).then((e=>({firstPage:e,totalCount:n})))}();return n.concat(...await Promise.all([...new Array(r+1).keys()].slice(2).map((async n=>readmeAPIv1Fetch(`/api/v1/categories?perPage=20&page=${n}`,{method:"get",headers:cleanAPIv1Headers(e,t,new Headers({Accept:"application/json"}))}).then(handleAPIv1Res)))))}async function getProjectVersion(e,t,n=!1){try{if(e)return await readmeAPIv1Fetch(`/api/v1/version/${e}`,{method:"get",headers:cleanAPIv1Headers(t)}).then(handleAPIv1Res).then((e=>e.version));if(isCI())return void warn("No `--version` parameter detected in current CI environment. Defaulting to main version.");const r=await readmeAPIv1Fetch("/api/v1/version",{method:"get",headers:cleanAPIv1Headers(t)}).then(handleAPIv1Res);if(1===r.length)return r[0].version;if(n){const e=r.find((e=>!0===e.is_stable));if(!e)throw new Error("Unexpected version response from the ReadMe API. Get in touch with us at support@readme.io!");return e.version}const{versionSelection:i}=await promptTerminal({type:"select",name:"versionSelection",message:"Select your desired version",choices:r.map((e=>({title:e.version,value:e.version})))});return i}catch(e){return Promise.reject(new APIv1Error(e))}}class CategoriesCreateCommand extends BaseCommand{static id="categories create";static state="deprecated";static deprecationOptions={message:`\`rdme ${this.id}\` is deprecated and will be removed in v10. For more information, please visit our migration guide: https://github.com/readmeio/rdme/tree/v9/documentation/migration-guide.md`};static description="Create a category with the specified title and guide in your ReadMe project.";static args={title:libExports$3.Args.string({description:"Title of the category",required:!0})};static flags={categoryType:libExports$3.Flags.option({description:"Category type",options:["guide","reference"],required:!0})(),key:keyFlag,preventDuplicates:libExports$3.Flags.boolean({description:"Prevents the creation of a new category if there is an existing category with a matching `categoryType` and `title`"}),version:versionFlag};static examples=[{description:"Create a new category for your project version:",command:"<%= config.bin %> <%= command.id %> --categoryType={guide|reference} --version={project-version}"},{description:"If you want to prevent the creation of a duplicate category with a matching `title` and `categoryType`, supply the `--preventDuplicates` flag:",command:"<%= config.bin %> <%= command.id %> <title> --categoryType={guide|reference} --version={project-version} --preventDuplicates"}];async run(){const{title:e}=this.args,{categoryType:t,key:n,version:r,preventDuplicates:i}=this.flags,o=await getProjectVersion(r,n);if(this.debug(`selectedVersion: ${o}`),i){const r=(await getCategories(n,o)).find((n=>n.title.trim().toLowerCase()===e.trim().toLowerCase()&&n.type===t));if(void 0!==r)return Promise.reject(new Error(`The '${r.title}' category with a type of '${r.type}' already exists with an id of '${r.id}'. A new category was not created.`))}const s=await readmeAPIv1Fetch("/api/v1/categories",{method:"post",headers:cleanAPIv1Headers(n,o,new Headers({"Content-Type":"application/json"})),body:JSON.stringify({title:e,type:t})}).then(handleAPIv1Res).then((e=>`🌱 successfully created '${e.title}' with a type of '${e.type}' and an id of '${e.id}'`));return Promise.resolve(chalk.green(s))}}class CategoriesCommand extends BaseCommand{static id="categories";static state="deprecated";static deprecationOptions={message:`\`rdme ${this.id}\` is deprecated and will be removed in v10. For more information, please visit our migration guide: https://github.com/readmeio/rdme/tree/v9/documentation/migration-guide.md`};static description="Get all categories in your ReadMe project.";static flags={key:keyFlag,version:versionFlag};static examples=[{description:"Get all categories associated to your project version:",command:"<%= config.bin %> <%= command.id %> --version={project-version}"}];async run(){const{key:e,version:t}=this.flags,n=await getProjectVersion(t,e);this.debug(`selectedVersion: ${n}`);const r=await getCategories(e,n);return Promise.resolve(JSON.stringify(r,null,2))}}var toposort$1={exports:{}},hasRequiredToposort;function requireToposort(){if(hasRequiredToposort)return toposort$1.exports;function e(e,t){var n=e.length,r=new Array(n),i={},o=n,s=function(e){for(var t=new Map,n=0,r=e.length;n<r;n++){var i=e[n];t.has(i[0])||t.set(i[0],new Set),t.has(i[1])||t.set(i[1],new Set),t.get(i[0]).add(i[1])}return t}(t),a=function(e){for(var t=new Map,n=0,r=e.length;n<r;n++)t.set(e[n],n);return t}(e);for(t.forEach((function(e){if(!a.has(e[0])||!a.has(e[1]))throw new Error("Unknown node. There is an unknown node in the supplied edges.")}));o--;)i[o]||c(e[o],o,new Set);return r;function c(e,t,o){if(o.has(e)){var l;try{l=", node was:"+JSON.stringify(e)}catch(e){l=""}throw new Error("Cyclic dependency"+l)}if(!a.has(e))throw new Error("Found unknown node. Make sure to provided all involved nodes. Unknown node: "+JSON.stringify(e));if(!i[t]){i[t]=!0;var u=s.get(e)||new Set;if(t=(u=Array.from(u)).length){o.add(e);do{var d=u[--t];c(d,a.get(d),o)}while(t);o.delete(e)}r[--n]=e}}}return hasRequiredToposort=1,toposort$1.exports=function(t){return e(function(e){for(var t=new Set,n=0,r=e.length;n<r;n++){var i=e[n];t.add(i[0]),t.add(i[1])}return Array.from(t)}(t),t)},toposort$1.exports.array=e,toposort$1.exports}var toposortExports=requireToposort(),toposort=getDefaultExportFromCjs(toposortExports),ignore$1,hasRequiredIgnore;function requireIgnore(){if(hasRequiredIgnore)return ignore$1;function e(e){return Array.isArray(e)?e:[e]}hasRequiredIgnore=1;const t=/^\s+$/,n=/(?:[^\\]|^)\\$/,r=/^\\!/,i=/^\\#/,o=/\r?\n/g,s=/^\.*\/|^\.+$/;let a="node-ignore";"undefined"!=typeof Symbol&&(a=Symbol.for("node-ignore"));const c=a,l=/([0-z])-([0-z])/g,u=()=>!1,d=[[/^\uFEFF/,()=>""],[/((?:\\\\)*?)(\\?\s+)$/,(e,t,n)=>t+(0===n.indexOf("\\")?" ":"")],[/(\\+?)\s/g,(e,t)=>{const{length:n}=t;return t.slice(0,n-n%2)+" "}],[/[\\$.|*+(){^]/g,e=>`\\${e}`],[/(?!\\)\?/g,()=>"[^/]"],[/^\//,()=>"^"],[/\//g,()=>"\\/"],[/^\^*\\\*\\\*\\\//,()=>"^(?:.*\\/)?"],[/^(?=[^^])/,function(){return/\/(?!$)/.test(this)?"^":"(?:^|\\/)"}],[/\\\/\\\*\\\*(?=\\\/|$)/g,(e,t,n)=>t+6<n.length?"(?:\\/[^\\/]+)*":"\\/.+"],[/(^|[^\\]+)(\\\*)+(?=.+)/g,(e,t,n)=>t+n.replace(/\\\*/g,"[^\\/]*")],[/\\\\\\(?=[$.|*+(){^])/g,()=>"\\"],[/\\\\/g,()=>"\\"],[/(\\)?\[([^\]/]*?)(\\*)($|\])/g,(e,t,n,r,i)=>"\\"===t?`\\[${n}${(e=>{const{length:t}=e;return e.slice(0,t-t%2)})(r)}${i}`:"]"===i&&r.length%2==0?`[${(e=>e.replace(l,((e,t,n)=>t.charCodeAt(0)<=n.charCodeAt(0)?e:"")))(n)}${r}]`:"[]"],[/(?:[^*])$/,e=>/\/$/.test(e)?`${e}$`:`${e}(?=$|\\/$)`],[/(\^|\\\/)?\\\*$/,(e,t)=>`${t?`${t}[^/]+`:"[^/]*"}(?=$|\\/$)`]],p=Object.create(null),f=e=>"string"==typeof e;class _{constructor(e,t,n,r){this.origin=e,this.pattern=t,this.negative=n,this.regex=r}}const m=(e,t)=>{const n=e;let o=!1;0===e.indexOf("!")&&(o=!0,e=e.substr(1));const s=((e,t)=>{let n=p[e];return n||(n=d.reduce(((t,[n,r])=>t.replace(n,r.bind(e))),e),p[e]=n),t?new RegExp(n,"i"):new RegExp(n)})(e=e.replace(r,"!").replace(i,"#"),t);return new _(n,e,o,s)},h=(e,t)=>{throw new t(e)},g=(e,t,n)=>{if(!f(e))return n(`path must be a string, but got \`${t}\``,TypeError);if(!e)return n("path must not be empty",TypeError);if(g.isNotRelative(e)){return n(`path should be a ${"`path.relative()`d"} string, but got "${t}"`,RangeError)}return!0},A=e=>s.test(e);g.isNotRelative=A,g.convert=e=>e;class y{constructor({ignorecase:e=!0,ignoreCase:t=e,allowRelativePaths:n=!1}={}){var r,i,o;r=this,i=c,o=!0,Object.defineProperty(r,i,{value:o}),this._rules=[],this._ignoreCase=t,this._allowRelativePaths=n,this._initCache()}_initCache(){this._ignoreCache=Object.create(null),this._testCache=Object.create(null)}_addPattern(e){if(e&&e[c])return this._rules=this._rules.concat(e._rules),void(this._added=!0);if((e=>e&&f(e)&&!t.test(e)&&!n.test(e)&&0!==e.indexOf("#"))(e)){const t=m(e,this._ignoreCase);this._added=!0,this._rules.push(t)}}add(t){return this._added=!1,e(f(t)?(e=>e.split(o))(t):t).forEach(this._addPattern,this),this._added&&this._initCache(),this}addPattern(e){return this.add(e)}_testOne(e,t){let n=!1,r=!1;return this._rules.forEach((i=>{const{negative:o}=i;if(r===o&&n!==r||o&&!n&&!r&&!t)return;i.regex.test(e)&&(n=!o,r=o)})),{ignored:n,unignored:r}}_test(e,t,n,r){const i=e&&g.convert(e);return g(i,e,this._allowRelativePaths?u:h),this._t(i,t,n,r)}_t(e,t,n,r){if(e in t)return t[e];if(r||(r=e.split("/")),r.pop(),!r.length)return t[e]=this._testOne(e,n);const i=this._t(r.join("/")+"/",t,n,r);return t[e]=i.ignored?i:this._testOne(e,n)}ignores(e){return this._test(e,this._ignoreCache,!1).ignored}createFilter(){return e=>!this.ignores(e)}filter(t){return e(t).filter(this.createFilter())}test(e){return this._test(e,this._testCache,!0)}}const v=e=>new y(e);if(v.isPathValid=e=>g(e&&g.convert(e),e,u),v.default=v,ignore$1=v,"undefined"!=typeof process&&(process.env&&process.env.IGNORE_TEST_WIN32||"win32"===process.platform)){const e=e=>/^\\\\\?\\/.test(e)||/["<>|\u0000-\u001F]+/u.test(e)?e:e.replace(/\\/g,"/");g.convert=e;const t=/^[a-z]:\//i;g.isNotRelative=e=>t.test(e)||A(e)}return ignore$1}var ignoreExports=requireIgnore(),ignore=getDefaultExportFromCjs(ignoreExports),kindOf,hasRequiredKindOf,isExtendable,hasRequiredIsExtendable,extendShallow,hasRequiredExtendShallow,sectionMatter,hasRequiredSectionMatter;function readdirRecursive(e,t=!1){let n;debug(`current readdirRecursive folder: ${e}`),t&&(n=ignore.default().add(path$1.join(e,".git/")),fs$6.existsSync(path$1.join(e,".gitignore"))&&(debug(".gitignore file found, adding to ignore filter"),n.add(fs$6.readFileSync(path$1.join(e,".gitignore")).toString())));const r=fs$6.readdirSync(e,{withFileTypes:!0}).filter((r=>{if(!t)return!0;let i=path$1.join(e,r.name);return r.isDirectory()&&(i=`${i}/`),!n.ignores(i)})),i=r.filter((e=>e.isFile())).map((t=>path$1.join(e,t.name))),o=r.filter((e=>e.isDirectory()));return[...i,...[].concat(...o.map((n=>readdirRecursive(path$1.join(e,n.name),t))))]}function requireKindOf(){if(hasRequiredKindOf)return kindOf;hasRequiredKindOf=1;var e=Object.prototype.toString;function t(e){return"function"==typeof e.constructor?e.constructor.name:null}return kindOf=function(n){if(void 0===n)return"undefined";if(null===n)return"null";var r=typeof n;if("boolean"===r)return"boolean";if("string"===r)return"string";if("number"===r)return"number";if("symbol"===r)return"symbol";if("function"===r)return function(e){return"GeneratorFunction"===t(e)}(n)?"generatorfunction":"function";if(function(e){return Array.isArray?Array.isArray(e):e instanceof Array}(n))return"array";if(function(e){if(e.constructor&&"function"==typeof e.constructor.isBuffer)return e.constructor.isBuffer(e);return!1}(n))return"buffer";if(function(e){try{if("number"==typeof e.length&&"function"==typeof e.callee)return!0}catch(e){if(-1!==e.message.indexOf("callee"))return!0}return!1}(n))return"arguments";if(function(e){return e instanceof Date||"function"==typeof e.toDateString&&"function"==typeof e.getDate&&"function"==typeof e.setDate}(n))return"date";if(function(e){return e instanceof Error||"string"==typeof e.message&&e.constructor&&"number"==typeof e.constructor.stackTraceLimit}(n))return"error";if(function(e){return e instanceof RegExp||"string"==typeof e.flags&&"boolean"==typeof e.ignoreCase&&"boolean"==typeof e.multiline&&"boolean"==typeof e.global}(n))return"regexp";switch(t(n)){case"Symbol":return"symbol";case"Promise":return"promise";case"WeakMap":return"weakmap";case"WeakSet":return"weakset";case"Map":return"map";case"Set":return"set";case"Int8Array":return"int8array";case"Uint8Array":return"uint8array";case"Uint8ClampedArray":return"uint8clampedarray";case"Int16Array":return"int16array";case"Uint16Array":return"uint16array";case"Int32Array":return"int32array";case"Uint32Array":return"uint32array";case"Float32Array":return"float32array";case"Float64Array":return"float64array"}if(function(e){return"function"==typeof e.throw&&"function"==typeof e.return&&"function"==typeof e.next}(n))return"generator";switch(r=e.call(n)){case"[object Object]":return"object";case"[object Map Iterator]":return"mapiterator";case"[object Set Iterator]":return"setiterator";case"[object String Iterator]":return"stringiterator";case"[object Array Iterator]":return"arrayiterator"}return r.slice(8,-1).toLowerCase().replace(/\s/g,"")},kindOf} + */function requireMimeTypes(){return hasRequiredMimeTypes||(hasRequiredMimeTypes=1,function(e){var t=requireMimeDb(),n=require$$0$8.extname,r=/^\s*([^;\s]*)(?:;|\s|$)/,i=/^text\//i;function o(e){if(!e||"string"!=typeof e)return!1;var n=r.exec(e),o=n&&t[n[1].toLowerCase()];return o&&o.charset?o.charset:!(!n||!i.test(n[1]))&&"UTF-8"}e.charset=o,e.charsets={lookup:o},e.contentType=function(t){if(!t||"string"!=typeof t)return!1;var n=-1===t.indexOf("/")?e.lookup(t):t;if(!n)return!1;if(-1===n.indexOf("charset")){var r=e.charset(n);r&&(n+="; charset="+r.toLowerCase())}return n},e.extension=function(t){if(!t||"string"!=typeof t)return!1;var n=r.exec(t),i=n&&e.extensions[n[1].toLowerCase()];if(!i||!i.length)return!1;return i[0]},e.extensions=Object.create(null),e.lookup=function(t){if(!t||"string"!=typeof t)return!1;var r=n("x."+t).toLowerCase().substr(1);if(!r)return!1;return e.types[r]||!1},e.types=Object.create(null),function(e,n){var r=["nginx","apache",void 0,"iana"];Object.keys(t).forEach((function(i){var o=t[i],s=o.extensions;if(s&&s.length){e[i]=s;for(var a=0;a<s.length;a++){var c=s[a];if(n[c]){var l=r.indexOf(t[n[c]].source),u=r.indexOf(o.source);if("application/octet-stream"!==n[c]&&(l>u||l===u&&"application/"===n[c].substr(0,12)))continue}n[c]=i}}}))}(e.extensions,e.types)}(mimeTypes)),mimeTypes}var mimeTypesExports=requireMimeTypes(),mime=getDefaultExportFromCjs(mimeTypesExports),undiciExports=requireUndici(),name$1="rdme",version$1="9.0.1-next.1",description$3="ReadMe's official CLI and GitHub Action.",license$1="MIT",author$1="ReadMe <support@readme.io> (https://readme.com)",engines$1={node:">=20.10.0"},bin$1={rdme:"bin/run.js"},files=["/bin/run*","/dist","/oclif.manifest.json"],keywords$1=["api","apidoc","apis","documentation","microservice","oai","oas","openapi","openapi document","openapi initiative","openapi spec","openapi specification","postman","readme","swagger"],repository$1={type:"git",url:"https://github.com/readmeio/rdme.git"},bugs$1={url:"https://github.com/readmeio/rdme/issues"},type$d="module",dependencies$3={"@actions/core":"^1.6.0","@oclif/core":"^4.0.29","@oclif/plugin-autocomplete":"^3.2.6","@oclif/plugin-help":"^6.2.15","@oclif/plugin-not-found":"^3.2.28","@oclif/plugin-warn-if-update-available":"^3.1.19",chalk:"^5.3.0","ci-info":"^4.0.0",configstore:"^7.0.0",debug:"^4.3.3","gray-matter":"^4.0.1",ignore:"^6.0.2","mime-types":"^2.1.35",oas:"^25.0.0","oas-normalize":"^11.1.2",open:"^10.0.2",ora:"^8.1.1","parse-link-header":"^2.0.0",pluralize:"^8.0.0",prompts:"^2.4.2",semver:"^7.5.3","simple-git":"^3.19.1","string-argv":"^0.3.2",table:"^6.8.1","tmp-promise":"^3.0.2",toposort:"^2.0.2",undici:"^5.28.4",validator:"^13.7.0"},devDependencies={"@commitlint/cli":"^19.0.3","@commitlint/config-conventional":"^19.0.3","@oclif/test":"^4.1.0","@readme/better-ajv-errors":"^1.5.0","@readme/eslint-config":"^14.0.0","@readme/oas-examples":"^5.10.0","@rollup/plugin-commonjs":"^28.0.0","@rollup/plugin-json":"^6.0.0","@rollup/plugin-node-resolve":"^15.2.1","@rollup/plugin-replace":"^6.0.1","@rollup/plugin-terser":"^0.4.4","@types/configstore":"^6.0.0","@types/debug":"^4.1.7","@types/js-yaml":"^4.0.5","@types/mime-types":"^2.1.1","@types/parse-link-header":"^2.0.0","@types/pluralize":"^0.0.33","@types/prompts":"^2.4.2","@types/semver":"^7.3.12","@types/toposort":"^2.0.7","@types/validator":"^13.7.6","@vitest/coverage-v8":"^2.0.5","@vitest/expect":"^2.0.5",ajv:"^8.11.0",alex:"^11.0.0",eslint:"^8.47.0",husky:"^9.0.10","js-yaml":"^4.1.0",knip:"^5.0.2",nock:"^14.0.0-beta.7",oclif:"^4.15.12","openapi-types":"^12.1.3",prettier:"^3.0.2",rollup:"^4.3.0",tsx:"^4.19.2","type-fest":"^4.3.1",typescript:"^5.1.6",vitest:"^2.0.5"},scripts$1={build:"tsc","build:docs":"oclif readme --multi --output-dir documentation/commands --no-aliases","build:gha":"npm run build && rollup --config","build:gha:prod":"npm run build:gha -- --environment PRODUCTION_BUILD",lint:"alex . && knip && npm run lint:ts && npm run prettier && npm run schemas:check","lint:ts":"eslint . --ext .js,.ts",prebuild:"rm -rf dist/ && rm -f src/package.json && ln package.json src/package.json",prepack:"npm run build",prepare:"husky",pretest:"npm run build",prettier:"prettier --check .","schemas:check":"./bin/json-schema-store.js","schemas:write":"./bin/json-schema-store.js --update",test:"vitest run --coverage",version:"npm run build:gha:prod && oclif manifest && npm run build:docs"},commitlint={extends:["@commitlint/config-conventional"],rules:{"body-max-line-length":[0,"always","Infinity"],"footer-max-line-length":[0,"always","Infinity"],"scope-case":[2,"never","upper-case"]}},oclif={bin:"rdme",dirname:"rdme",commands:{strategy:"explicit",target:"./dist/index.js",identifier:"COMMANDS"},topicSeparator:" ",helpClass:"./dist/lib/help",hooks:{prerun:{target:"./dist/index.js",identifier:"prerun"},createGHA:{target:"./dist/index.js",identifier:"createGHA"}},plugins:["@oclif/plugin-autocomplete","@oclif/plugin-help","@oclif/plugin-not-found","@oclif/plugin-warn-if-update-available"],topics:{categories:{description:"List or create categories in your ReadMe developer hub."},docs:{description:"Sync or prune Guides pages in your ReadMe developer hub."},openapi:{description:"Manage your API definition (e.g., syncing, validation, analysis, conversion, etc.). Supports OpenAPI, Swagger, and Postman collections, in either JSON or YAML formats."},versions:{description:"Manage your documentation versions."}}},prettier="@readme/eslint-config/prettier",pkg={name:name$1,version:version$1,description:description$3,license:license$1,author:author$1,engines:engines$1,bin:bin$1,files:files,keywords:keywords$1,repository:repository$1,bugs:bugs$1,type:type$d,dependencies:dependencies$3,devDependencies:devDependencies,scripts:scripts$1,commitlint:commitlint,oclif:oclif,prettier:prettier};class APIv1Error extends Error{code;constructor(e){let t;t="object"==typeof e&&"object"==typeof e?.error?e.error:e,super(t),this.name="APIv1Error","object"==typeof t?(this.code=t.error,this.message=t?.help?[t.message,"",t.help].join("\n"):t.message,this.name="APIv1Error"):(this.code=t,this.message=t)}}const config={host:"https://dash.readme.com",hub:"https://{project}.readme.io"};var prompts$3={},kleur,hasRequiredKleur,action$1,hasRequiredAction$1,strip$1,hasRequiredStrip$1,src$6,hasRequiredSrc$6,clear$1,hasRequiredClear$1,figures_1$1,hasRequiredFigures$1,style$1,hasRequiredStyle$1,lines$1,hasRequiredLines$1,wrap$1,hasRequiredWrap$1,entriesToDisplay$1,hasRequiredEntriesToDisplay$1,util$4,hasRequiredUtil$4,prompt$1,hasRequiredPrompt$1,text$2,hasRequiredText$2,select$1,hasRequiredSelect$1,toggle$1,hasRequiredToggle$1,datepart$1,hasRequiredDatepart$1,meridiem$1,hasRequiredMeridiem$1,day$1,hasRequiredDay$1,hours$1,hasRequiredHours$1,milliseconds$1,hasRequiredMilliseconds$1,minutes$1,hasRequiredMinutes$1,month$1,hasRequiredMonth$1,seconds$1,hasRequiredSeconds$1,year$1,hasRequiredYear$1,dateparts$1,hasRequiredDateparts$1,date$1,hasRequiredDate$1,number$1,hasRequiredNumber$1,multiselect$1,hasRequiredMultiselect$1,autocomplete$1,hasRequiredAutocomplete$1,autocompleteMultiselect$1,hasRequiredAutocompleteMultiselect$1,confirm$1,hasRequiredConfirm$1,elements$1,hasRequiredElements$1,hasRequiredPrompts$2,dist$6,hasRequiredDist$6;function requireKleur(){if(hasRequiredKleur)return kleur;hasRequiredKleur=1;const{FORCE_COLOR:e,NODE_DISABLE_COLORS:t,TERM:n}=process.env,r={enabled:!t&&"dumb"!==n&&"0"!==e,reset:o(0,0),bold:o(1,22),dim:o(2,22),italic:o(3,23),underline:o(4,24),inverse:o(7,27),hidden:o(8,28),strikethrough:o(9,29),black:o(30,39),red:o(31,39),green:o(32,39),yellow:o(33,39),blue:o(34,39),magenta:o(35,39),cyan:o(36,39),white:o(37,39),gray:o(90,39),grey:o(90,39),bgBlack:o(40,49),bgRed:o(41,49),bgGreen:o(42,49),bgYellow:o(43,49),bgBlue:o(44,49),bgMagenta:o(45,49),bgCyan:o(46,49),bgWhite:o(47,49)};function i(e,t){let n,r=0,i="",o="";for(;r<e.length;r++)n=e[r],i+=n.open,o+=n.close,t.includes(n.close)&&(t=t.replace(n.rgx,n.close+n.open));return i+t+o}function o(e,t){let n={open:`[${e}m`,close:`[${t}m`,rgx:new RegExp(`\\x1b\\[${t}m`,"g")};return function(t){return void 0!==this&&void 0!==this.has?(this.has.includes(e)||(this.has.push(e),this.keys.push(n)),void 0===t?this:r.enabled?i(this.keys,t+""):t+""):void 0===t?function(e,t){let n={has:e,keys:t};return n.reset=r.reset.bind(n),n.bold=r.bold.bind(n),n.dim=r.dim.bind(n),n.italic=r.italic.bind(n),n.underline=r.underline.bind(n),n.inverse=r.inverse.bind(n),n.hidden=r.hidden.bind(n),n.strikethrough=r.strikethrough.bind(n),n.black=r.black.bind(n),n.red=r.red.bind(n),n.green=r.green.bind(n),n.yellow=r.yellow.bind(n),n.blue=r.blue.bind(n),n.magenta=r.magenta.bind(n),n.cyan=r.cyan.bind(n),n.white=r.white.bind(n),n.gray=r.gray.bind(n),n.grey=r.grey.bind(n),n.bgBlack=r.bgBlack.bind(n),n.bgRed=r.bgRed.bind(n),n.bgGreen=r.bgGreen.bind(n),n.bgYellow=r.bgYellow.bind(n),n.bgBlue=r.bgBlue.bind(n),n.bgMagenta=r.bgMagenta.bind(n),n.bgCyan=r.bgCyan.bind(n),n.bgWhite=r.bgWhite.bind(n),n}([e],[n]):r.enabled?i([n],t+""):t+""}}return kleur=r}function requireAction$1(){return hasRequiredAction$1?action$1:(hasRequiredAction$1=1,action$1=(e,t)=>{if(!e.meta||"escape"===e.name){if(e.ctrl){if("a"===e.name)return"first";if("c"===e.name)return"abort";if("d"===e.name)return"abort";if("e"===e.name)return"last";if("g"===e.name)return"reset"}if(t){if("j"===e.name)return"down";if("k"===e.name)return"up"}return"return"===e.name||"enter"===e.name?"submit":"backspace"===e.name?"delete":"delete"===e.name?"deleteForward":"abort"===e.name?"abort":"escape"===e.name?"exit":"tab"===e.name?"next":"pagedown"===e.name?"nextPage":"pageup"===e.name?"prevPage":"home"===e.name?"home":"end"===e.name?"end":"up"===e.name?"up":"down"===e.name?"down":"right"===e.name?"right":"left"===e.name&&"left"}})}function requireStrip$1(){return hasRequiredStrip$1||(hasRequiredStrip$1=1,strip$1=e=>{const t=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PRZcf-ntqry=><~]))"].join("|"),n=new RegExp(t,"g");return"string"==typeof e?e.replace(n,""):e}),strip$1}function requireSrc$6(){if(hasRequiredSrc$6)return src$6;hasRequiredSrc$6=1;const e="[",t={to:(t,n)=>n?`${e}${n+1};${t+1}H`:`${e}${t+1}G`,move(t,n){let r="";return t<0?r+=`${e}${-t}D`:t>0&&(r+=`${e}${t}C`),n<0?r+=`${e}${-n}A`:n>0&&(r+=`${e}${n}B`),r},up:(t=1)=>`${e}${t}A`,down:(t=1)=>`${e}${t}B`,forward:(t=1)=>`${e}${t}C`,backward:(t=1)=>`${e}${t}D`,nextLine:(t=1)=>`${e}E`.repeat(t),prevLine:(t=1)=>`${e}F`.repeat(t),left:`${e}G`,hide:`${e}?25l`,show:`${e}?25h`,save:"7",restore:"8"},n={up:(t=1)=>`${e}S`.repeat(t),down:(t=1)=>`${e}T`.repeat(t)},r={screen:`${e}2J`,up:(t=1)=>`${e}1J`.repeat(t),down:(t=1)=>`${e}J`.repeat(t),line:`${e}2K`,lineEnd:`${e}K`,lineStart:`${e}1K`,lines(e){let n="";for(let r=0;r<e;r++)n+=this.line+(r<e-1?t.up():"");return e&&(n+=t.left),n}};return src$6={cursor:t,scroll:n,erase:r,beep:""}}function requireClear$1(){if(hasRequiredClear$1)return clear$1;function e(e,n){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,n){if(!e)return;if("string"==typeof e)return t(e,n);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return t(e,n)}(e))||n){r&&(e=r);var i=0,o=function(){};return{s:o,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,a=!0,c=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){c=!0,s=e},f:function(){try{a||null==r.return||r.return()}finally{if(c)throw s}}}}function t(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}hasRequiredClear$1=1;const n=requireStrip$1(),r=requireSrc$6(),i=r.erase,o=r.cursor,s=e=>[...n(e)].length;return clear$1=function(t,n){if(!n)return i.line+o.to(0);let r=0;var a,c=e(t.split(/\r?\n/));try{for(c.s();!(a=c.n()).done;){let e=a.value;r+=1+Math.floor(Math.max(s(e)-1,0)/n)}}catch(e){c.e(e)}finally{c.f()}return i.lines(r)},clear$1}function requireFigures$1(){if(hasRequiredFigures$1)return figures_1$1;hasRequiredFigures$1=1;const e={arrowUp:"↑",arrowDown:"↓",arrowLeft:"←",arrowRight:"→",radioOn:"◉",radioOff:"◯",tick:"✔",cross:"✖",ellipsis:"…",pointerSmall:"›",line:"─",pointer:"❯"},t={arrowUp:e.arrowUp,arrowDown:e.arrowDown,arrowLeft:e.arrowLeft,arrowRight:e.arrowRight,radioOn:"(*)",radioOff:"( )",tick:"√",cross:"×",ellipsis:"...",pointerSmall:"»",line:"─",pointer:">"},n="win32"===process.platform?t:e;return figures_1$1=n}function requireStyle$1(){if(hasRequiredStyle$1)return style$1;hasRequiredStyle$1=1;const e=requireKleur(),t=requireFigures$1(),n=Object.freeze({password:{scale:1,render:e=>"*".repeat(e.length)},emoji:{scale:2,render:e=>"😃".repeat(e.length)},invisible:{scale:0,render:e=>""},default:{scale:1,render:e=>`${e}`}}),r=Object.freeze({aborted:e.red(t.cross),done:e.green(t.tick),exited:e.yellow(t.cross),default:e.cyan("?")});return style$1={styles:n,render:e=>n[e]||n.default,symbols:r,symbol:(e,t,n)=>t?r.aborted:n?r.exited:e?r.done:r.default,delimiter:n=>e.gray(n?t.ellipsis:t.pointerSmall),item:(n,r)=>e.gray(n?r?t.pointerSmall:"+":t.line)},style$1}function requireLines$1(){if(hasRequiredLines$1)return lines$1;hasRequiredLines$1=1;const e=requireStrip$1();return lines$1=function(t,n){let r=String(e(t)||"").split(/\r?\n/);return n?r.map((e=>Math.ceil(e.length/n))).reduce(((e,t)=>e+t)):r.length},lines$1}function requireWrap$1(){return hasRequiredWrap$1||(hasRequiredWrap$1=1,wrap$1=(e,t={})=>{const n=Number.isSafeInteger(parseInt(t.margin))?new Array(parseInt(t.margin)).fill(" ").join(""):t.margin||"",r=t.width;return(e||"").split(/\r?\n/g).map((e=>e.split(/\s+/g).reduce(((e,t)=>(t.length+n.length>=r||e[e.length-1].length+t.length+1<r?e[e.length-1]+=` ${t}`:e.push(`${n}${t}`),e)),[n]).join("\n"))).join("\n")}),wrap$1}function requireEntriesToDisplay$1(){return hasRequiredEntriesToDisplay$1?entriesToDisplay$1:(hasRequiredEntriesToDisplay$1=1,entriesToDisplay$1=(e,t,n)=>{n=n||t;let r=Math.min(t-n,e-Math.floor(n/2));return r<0&&(r=0),{startIndex:r,endIndex:Math.min(r+n,t)}})}function requireUtil$4(){return hasRequiredUtil$4?util$4:(hasRequiredUtil$4=1,util$4={action:requireAction$1(),clear:requireClear$1(),style:requireStyle$1(),strip:requireStrip$1(),figures:requireFigures$1(),lines:requireLines$1(),wrap:requireWrap$1(),entriesToDisplay:requireEntriesToDisplay$1()})}function requirePrompt$1(){if(hasRequiredPrompt$1)return prompt$1;hasRequiredPrompt$1=1;const e=require$$0$m,t=requireUtil$4().action,n=require$$0$c,r=requireSrc$6(),i=r.beep,o=r.cursor,s=requireKleur();return prompt$1=class extends n{constructor(n={}){super(),this.firstRender=!0,this.in=n.stdin||process.stdin,this.out=n.stdout||process.stdout,this.onRender=(n.onRender||(()=>{})).bind(this);const r=e.createInterface({input:this.in,escapeCodeTimeout:50});e.emitKeypressEvents(this.in,r),this.in.isTTY&&this.in.setRawMode(!0);const i=["SelectPrompt","MultiselectPrompt"].indexOf(this.constructor.name)>-1,s=(e,n)=>{let r=t(n,i);!1===r?this._&&this._(e,n):"function"==typeof this[r]?this[r](n):this.bell()};this.close=()=>{this.out.write(o.show),this.in.removeListener("keypress",s),this.in.isTTY&&this.in.setRawMode(!1),r.close(),this.emit(this.aborted?"abort":this.exited?"exit":"submit",this.value),this.closed=!0},this.in.on("keypress",s)}fire(){this.emit("state",{value:this.value,aborted:!!this.aborted,exited:!!this.exited})}bell(){this.out.write(i)}render(){this.onRender(s),this.firstRender&&(this.firstRender=!1)}},prompt$1}function requireText$2(){if(hasRequiredText$2)return text$2;function e(e,t,n,r,i,o,s){try{var a=e[o](s),c=a.value}catch(e){return void n(e)}a.done?t(c):Promise.resolve(c).then(r,i)}function t(t){return function(){var n=this,r=arguments;return new Promise((function(i,o){var s=t.apply(n,r);function a(t){e(s,i,o,a,c,"next",t)}function c(t){e(s,i,o,a,c,"throw",t)}a(void 0)}))}}hasRequiredText$2=1;const n=requireKleur(),r=requirePrompt$1(),i=requireSrc$6(),o=i.erase,s=i.cursor,a=requireUtil$4(),c=a.style,l=a.clear,u=a.lines,d=a.figures;return text$2=class extends r{constructor(e={}){super(e),this.transform=c.render(e.style),this.scale=this.transform.scale,this.msg=e.message,this.initial=e.initial||"",this.validator=e.validate||(()=>!0),this.value="",this.errorMsg=e.error||"Please Enter A Valid Value",this.cursor=Number(!!this.initial),this.cursorOffset=0,this.clear=l("",this.out.columns),this.render()}set value(e){!e&&this.initial?(this.placeholder=!0,this.rendered=n.gray(this.transform.render(this.initial))):(this.placeholder=!1,this.rendered=this.transform.render(e)),this._value=e,this.fire()}get value(){return this._value}reset(){this.value="",this.cursor=Number(!!this.initial),this.cursorOffset=0,this.fire(),this.render()}exit(){this.abort()}abort(){this.value=this.value||this.initial,this.done=this.aborted=!0,this.error=!1,this.red=!1,this.fire(),this.render(),this.out.write("\n"),this.close()}validate(){var e=this;return t((function*(){let t=yield e.validator(e.value);"string"==typeof t&&(e.errorMsg=t,t=!1),e.error=!t}))()}submit(){var e=this;return t((function*(){if(e.value=e.value||e.initial,e.cursorOffset=0,e.cursor=e.rendered.length,yield e.validate(),e.error)return e.red=!0,e.fire(),void e.render();e.done=!0,e.aborted=!1,e.fire(),e.render(),e.out.write("\n"),e.close()}))()}next(){if(!this.placeholder)return this.bell();this.value=this.initial,this.cursor=this.rendered.length,this.fire(),this.render()}moveCursor(e){this.placeholder||(this.cursor=this.cursor+e,this.cursorOffset+=e)}_(e,t){let n=this.value.slice(0,this.cursor),r=this.value.slice(this.cursor);this.value=`${n}${e}${r}`,this.red=!1,this.cursor=this.placeholder?0:n.length+1,this.render()}delete(){if(this.isCursorAtStart())return this.bell();let e=this.value.slice(0,this.cursor-1),t=this.value.slice(this.cursor);this.value=`${e}${t}`,this.red=!1,this.isCursorAtStart()?this.cursorOffset=0:(this.cursorOffset++,this.moveCursor(-1)),this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length||this.placeholder)return this.bell();let e=this.value.slice(0,this.cursor),t=this.value.slice(this.cursor+1);this.value=`${e}${t}`,this.red=!1,this.isCursorAtEnd()?this.cursorOffset=0:this.cursorOffset++,this.render()}first(){this.cursor=0,this.render()}last(){this.cursor=this.value.length,this.render()}left(){if(this.cursor<=0||this.placeholder)return this.bell();this.moveCursor(-1),this.render()}right(){if(this.cursor*this.scale>=this.rendered.length||this.placeholder)return this.bell();this.moveCursor(1),this.render()}isCursorAtStart(){return 0===this.cursor||this.placeholder&&1===this.cursor}isCursorAtEnd(){return this.cursor===this.rendered.length||this.placeholder&&this.cursor===this.rendered.length+1}render(){this.closed||(this.firstRender||(this.outputError&&this.out.write(s.down(u(this.outputError,this.out.columns)-1)+l(this.outputError,this.out.columns)),this.out.write(l(this.outputText,this.out.columns))),super.render(),this.outputError="",this.outputText=[c.symbol(this.done,this.aborted),n.bold(this.msg),c.delimiter(this.done),this.red?n.red(this.rendered):this.rendered].join(" "),this.error&&(this.outputError+=this.errorMsg.split("\n").reduce(((e,t,r)=>e+`\n${r?" ":d.pointerSmall} ${n.red().italic(t)}`),"")),this.out.write(o.line+s.to(0)+this.outputText+s.save+this.outputError+s.restore+s.move(this.cursorOffset,0)))}},text$2}function requireSelect$1(){if(hasRequiredSelect$1)return select$1;hasRequiredSelect$1=1;const e=requireKleur(),t=requirePrompt$1(),n=requireUtil$4(),r=n.style,i=n.clear,o=n.figures,s=n.wrap,a=n.entriesToDisplay,c=requireSrc$6().cursor;return select$1=class extends t{constructor(e={}){super(e),this.msg=e.message,this.hint=e.hint||"- Use arrow-keys. Return to submit.",this.warn=e.warn||"- This option is disabled",this.cursor=e.initial||0,this.choices=e.choices.map(((e,t)=>("string"==typeof e&&(e={title:e,value:t}),{title:e&&(e.title||e.value||e),value:e&&(void 0===e.value?t:e.value),description:e&&e.description,selected:e&&e.selected,disabled:e&&e.disabled}))),this.optionsPerPage=e.optionsPerPage||10,this.value=(this.choices[this.cursor]||{}).value,this.clear=i("",this.out.columns),this.render()}moveCursor(e){this.cursor=e,this.value=this.choices[e].value,this.fire()}reset(){this.moveCursor(0),this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write("\n"),this.close()}submit(){this.selection.disabled?this.bell():(this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write("\n"),this.close())}first(){this.moveCursor(0),this.render()}last(){this.moveCursor(this.choices.length-1),this.render()}up(){0===this.cursor?this.moveCursor(this.choices.length-1):this.moveCursor(this.cursor-1),this.render()}down(){this.cursor===this.choices.length-1?this.moveCursor(0):this.moveCursor(this.cursor+1),this.render()}next(){this.moveCursor((this.cursor+1)%this.choices.length),this.render()}_(e,t){if(" "===e)return this.submit()}get selection(){return this.choices[this.cursor]}render(){if(this.closed)return;this.firstRender?this.out.write(c.hide):this.out.write(i(this.outputText,this.out.columns)),super.render();let t=a(this.cursor,this.choices.length,this.optionsPerPage),n=t.startIndex,l=t.endIndex;if(this.outputText=[r.symbol(this.done,this.aborted),e.bold(this.msg),r.delimiter(!1),this.done?this.selection.title:this.selection.disabled?e.yellow(this.warn):e.gray(this.hint)].join(" "),!this.done){this.outputText+="\n";for(let t=n;t<l;t++){let r,i,a="",c=this.choices[t];i=t===n&&n>0?o.arrowUp:t===l-1&&l<this.choices.length?o.arrowDown:" ",c.disabled?(r=this.cursor===t?e.gray().underline(c.title):e.strikethrough().gray(c.title),i=(this.cursor===t?e.bold().gray(o.pointer)+" ":" ")+i):(r=this.cursor===t?e.cyan().underline(c.title):c.title,i=(this.cursor===t?e.cyan(o.pointer)+" ":" ")+i,c.description&&this.cursor===t&&(a=` - ${c.description}`,(i.length+r.length+a.length>=this.out.columns||c.description.split(/\r?\n/).length>1)&&(a="\n"+s(c.description,{margin:3,width:this.out.columns})))),this.outputText+=`${i} ${r}${e.gray(a)}\n`}}this.out.write(this.outputText)}},select$1}function requireToggle$1(){if(hasRequiredToggle$1)return toggle$1;hasRequiredToggle$1=1;const e=requireKleur(),t=requirePrompt$1(),n=requireUtil$4(),r=n.style,i=n.clear,o=requireSrc$6(),s=o.cursor,a=o.erase;return toggle$1=class extends t{constructor(e={}){super(e),this.msg=e.message,this.value=!!e.initial,this.active=e.active||"on",this.inactive=e.inactive||"off",this.initialValue=this.value,this.render()}reset(){this.value=this.initialValue,this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write("\n"),this.close()}submit(){this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write("\n"),this.close()}deactivate(){if(!1===this.value)return this.bell();this.value=!1,this.render()}activate(){if(!0===this.value)return this.bell();this.value=!0,this.render()}delete(){this.deactivate()}left(){this.deactivate()}right(){this.activate()}down(){this.deactivate()}up(){this.activate()}next(){this.value=!this.value,this.fire(),this.render()}_(e,t){if(" "===e)this.value=!this.value;else if("1"===e)this.value=!0;else{if("0"!==e)return this.bell();this.value=!1}this.render()}render(){this.closed||(this.firstRender?this.out.write(s.hide):this.out.write(i(this.outputText,this.out.columns)),super.render(),this.outputText=[r.symbol(this.done,this.aborted),e.bold(this.msg),r.delimiter(this.done),this.value?this.inactive:e.cyan().underline(this.inactive),e.gray("/"),this.value?e.cyan().underline(this.active):this.active].join(" "),this.out.write(a.line+s.to(0)+this.outputText))}}}function requireDatepart$1(){if(hasRequiredDatepart$1)return datepart$1;hasRequiredDatepart$1=1;class e{constructor({token:e,date:t,parts:n,locales:r}){this.token=e,this.date=t||new Date,this.parts=n||[this],this.locales=r||{}}up(){}down(){}next(){const t=this.parts.indexOf(this);return this.parts.find(((n,r)=>r>t&&n instanceof e))}setTo(e){}prev(){let t=[].concat(this.parts).reverse();const n=t.indexOf(this);return t.find(((t,r)=>r>n&&t instanceof e))}toString(){return String(this.date)}}return datepart$1=e}function requireMeridiem$1(){if(hasRequiredMeridiem$1)return meridiem$1;hasRequiredMeridiem$1=1;const e=requireDatepart$1();return meridiem$1=class extends e{constructor(e={}){super(e)}up(){this.date.setHours((this.date.getHours()+12)%24)}down(){this.up()}toString(){let e=this.date.getHours()>12?"pm":"am";return/\A/.test(this.token)?e.toUpperCase():e}},meridiem$1}function requireDay$1(){if(hasRequiredDay$1)return day$1;hasRequiredDay$1=1;const e=requireDatepart$1();return day$1=class extends e{constructor(e={}){super(e)}up(){this.date.setDate(this.date.getDate()+1)}down(){this.date.setDate(this.date.getDate()-1)}setTo(e){this.date.setDate(parseInt(e.substr(-2)))}toString(){let e=this.date.getDate(),t=this.date.getDay();return"DD"===this.token?String(e).padStart(2,"0"):"Do"===this.token?e+(n=e,1==(n%=10)?"st":2===n?"nd":3===n?"rd":"th"):"d"===this.token?t+1:"ddd"===this.token?this.locales.weekdaysShort[t]:"dddd"===this.token?this.locales.weekdays[t]:e;var n}},day$1}function requireHours$1(){if(hasRequiredHours$1)return hours$1;hasRequiredHours$1=1;const e=requireDatepart$1();return hours$1=class extends e{constructor(e={}){super(e)}up(){this.date.setHours(this.date.getHours()+1)}down(){this.date.setHours(this.date.getHours()-1)}setTo(e){this.date.setHours(parseInt(e.substr(-2)))}toString(){let e=this.date.getHours();return/h/.test(this.token)&&(e=e%12||12),this.token.length>1?String(e).padStart(2,"0"):e}},hours$1}function requireMilliseconds$1(){if(hasRequiredMilliseconds$1)return milliseconds$1;hasRequiredMilliseconds$1=1;const e=requireDatepart$1();return milliseconds$1=class extends e{constructor(e={}){super(e)}up(){this.date.setMilliseconds(this.date.getMilliseconds()+1)}down(){this.date.setMilliseconds(this.date.getMilliseconds()-1)}setTo(e){this.date.setMilliseconds(parseInt(e.substr(-this.token.length)))}toString(){return String(this.date.getMilliseconds()).padStart(4,"0").substr(0,this.token.length)}}}function requireMinutes$1(){if(hasRequiredMinutes$1)return minutes$1;hasRequiredMinutes$1=1;const e=requireDatepart$1();return minutes$1=class extends e{constructor(e={}){super(e)}up(){this.date.setMinutes(this.date.getMinutes()+1)}down(){this.date.setMinutes(this.date.getMinutes()-1)}setTo(e){this.date.setMinutes(parseInt(e.substr(-2)))}toString(){let e=this.date.getMinutes();return this.token.length>1?String(e).padStart(2,"0"):e}}}function requireMonth$1(){if(hasRequiredMonth$1)return month$1;hasRequiredMonth$1=1;const e=requireDatepart$1();return month$1=class extends e{constructor(e={}){super(e)}up(){this.date.setMonth(this.date.getMonth()+1)}down(){this.date.setMonth(this.date.getMonth()-1)}setTo(e){e=parseInt(e.substr(-2))-1,this.date.setMonth(e<0?0:e)}toString(){let e=this.date.getMonth(),t=this.token.length;return 2===t?String(e+1).padStart(2,"0"):3===t?this.locales.monthsShort[e]:4===t?this.locales.months[e]:String(e+1)}},month$1}function requireSeconds$1(){if(hasRequiredSeconds$1)return seconds$1;hasRequiredSeconds$1=1;const e=requireDatepart$1();return seconds$1=class extends e{constructor(e={}){super(e)}up(){this.date.setSeconds(this.date.getSeconds()+1)}down(){this.date.setSeconds(this.date.getSeconds()-1)}setTo(e){this.date.setSeconds(parseInt(e.substr(-2)))}toString(){let e=this.date.getSeconds();return this.token.length>1?String(e).padStart(2,"0"):e}}}function requireYear$1(){if(hasRequiredYear$1)return year$1;hasRequiredYear$1=1;const e=requireDatepart$1();return year$1=class extends e{constructor(e={}){super(e)}up(){this.date.setFullYear(this.date.getFullYear()+1)}down(){this.date.setFullYear(this.date.getFullYear()-1)}setTo(e){this.date.setFullYear(e.substr(-4))}toString(){let e=String(this.date.getFullYear()).padStart(4,"0");return 2===this.token.length?e.substr(-2):e}},year$1}function requireDateparts$1(){return hasRequiredDateparts$1?dateparts$1:(hasRequiredDateparts$1=1,dateparts$1={DatePart:requireDatepart$1(),Meridiem:requireMeridiem$1(),Day:requireDay$1(),Hours:requireHours$1(),Milliseconds:requireMilliseconds$1(),Minutes:requireMinutes$1(),Month:requireMonth$1(),Seconds:requireSeconds$1(),Year:requireYear$1()})}function requireDate$1(){if(hasRequiredDate$1)return date$1;function e(e,t,n,r,i,o,s){try{var a=e[o](s),c=a.value}catch(e){return void n(e)}a.done?t(c):Promise.resolve(c).then(r,i)}function t(t){return function(){var n=this,r=arguments;return new Promise((function(i,o){var s=t.apply(n,r);function a(t){e(s,i,o,a,c,"next",t)}function c(t){e(s,i,o,a,c,"throw",t)}a(void 0)}))}}hasRequiredDate$1=1;const n=requireKleur(),r=requirePrompt$1(),i=requireUtil$4(),o=i.style,s=i.clear,a=i.figures,c=requireSrc$6(),l=c.erase,u=c.cursor,d=requireDateparts$1(),p=d.DatePart,f=d.Meridiem,_=d.Day,m=d.Hours,h=d.Milliseconds,g=d.Minutes,A=d.Month,y=d.Seconds,v=d.Year,b=/\\(.)|"((?:\\["\\]|[^"])+)"|(D[Do]?|d{3,4}|d)|(M{1,4})|(YY(?:YY)?)|([aA])|([Hh]{1,2})|(m{1,2})|(s{1,2})|(S{1,4})|./g,C={1:({token:e})=>e.replace(/\\(.)/g,"$1"),2:e=>new _(e),3:e=>new A(e),4:e=>new v(e),5:e=>new f(e),6:e=>new m(e),7:e=>new g(e),8:e=>new y(e),9:e=>new h(e)},E={months:"January,February,March,April,May,June,July,August,September,October,November,December".split(","),monthsShort:"Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec".split(","),weekdays:"Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday".split(","),weekdaysShort:"Sun,Mon,Tue,Wed,Thu,Fri,Sat".split(",")};return date$1=class extends r{constructor(e={}){super(e),this.msg=e.message,this.cursor=0,this.typed="",this.locales=Object.assign(E,e.locales),this._date=e.initial||new Date,this.errorMsg=e.error||"Please Enter A Valid Value",this.validator=e.validate||(()=>!0),this.mask=e.mask||"YYYY-MM-DD HH:mm:ss",this.clear=s("",this.out.columns),this.render()}get value(){return this.date}get date(){return this._date}set date(e){e&&this._date.setTime(e.getTime())}set mask(e){let t;for(this.parts=[];t=b.exec(e);){let e=t.shift(),n=t.findIndex((e=>null!=e));this.parts.push(n in C?C[n]({token:t[n]||e,date:this.date,parts:this.parts,locales:this.locales}):t[n]||e)}let n=this.parts.reduce(((e,t)=>("string"==typeof t&&"string"==typeof e[e.length-1]?e[e.length-1]+=t:e.push(t),e)),[]);this.parts.splice(0),this.parts.push(...n),this.reset()}moveCursor(e){this.typed="",this.cursor=e,this.fire()}reset(){this.moveCursor(this.parts.findIndex((e=>e instanceof p))),this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write("\n"),this.close()}validate(){var e=this;return t((function*(){let t=yield e.validator(e.value);"string"==typeof t&&(e.errorMsg=t,t=!1),e.error=!t}))()}submit(){var e=this;return t((function*(){if(yield e.validate(),e.error)return e.color="red",e.fire(),void e.render();e.done=!0,e.aborted=!1,e.fire(),e.render(),e.out.write("\n"),e.close()}))()}up(){this.typed="",this.parts[this.cursor].up(),this.render()}down(){this.typed="",this.parts[this.cursor].down(),this.render()}left(){let e=this.parts[this.cursor].prev();if(null==e)return this.bell();this.moveCursor(this.parts.indexOf(e)),this.render()}right(){let e=this.parts[this.cursor].next();if(null==e)return this.bell();this.moveCursor(this.parts.indexOf(e)),this.render()}next(){let e=this.parts[this.cursor].next();this.moveCursor(e?this.parts.indexOf(e):this.parts.findIndex((e=>e instanceof p))),this.render()}_(e){/\d/.test(e)&&(this.typed+=e,this.parts[this.cursor].setTo(this.typed),this.render())}render(){this.closed||(this.firstRender?this.out.write(u.hide):this.out.write(s(this.outputText,this.out.columns)),super.render(),this.outputText=[o.symbol(this.done,this.aborted),n.bold(this.msg),o.delimiter(!1),this.parts.reduce(((e,t,r)=>e.concat(r!==this.cursor||this.done?t:n.cyan().underline(t.toString()))),[]).join("")].join(" "),this.error&&(this.outputText+=this.errorMsg.split("\n").reduce(((e,t,r)=>e+`\n${r?" ":a.pointerSmall} ${n.red().italic(t)}`),"")),this.out.write(l.line+u.to(0)+this.outputText))}},date$1}function requireNumber$1(){if(hasRequiredNumber$1)return number$1;function e(e,t,n,r,i,o,s){try{var a=e[o](s),c=a.value}catch(e){return void n(e)}a.done?t(c):Promise.resolve(c).then(r,i)}function t(t){return function(){var n=this,r=arguments;return new Promise((function(i,o){var s=t.apply(n,r);function a(t){e(s,i,o,a,c,"next",t)}function c(t){e(s,i,o,a,c,"throw",t)}a(void 0)}))}}hasRequiredNumber$1=1;const n=requireKleur(),r=requirePrompt$1(),i=requireSrc$6(),o=i.cursor,s=i.erase,a=requireUtil$4(),c=a.style,l=a.figures,u=a.clear,d=a.lines,p=/[0-9]/,f=e=>void 0!==e,_=(e,t)=>{let n=Math.pow(10,t);return Math.round(e*n)/n};return number$1=class extends r{constructor(e={}){super(e),this.transform=c.render(e.style),this.msg=e.message,this.initial=f(e.initial)?e.initial:"",this.float=!!e.float,this.round=e.round||2,this.inc=e.increment||1,this.min=f(e.min)?e.min:-1/0,this.max=f(e.max)?e.max:1/0,this.errorMsg=e.error||"Please Enter A Valid Value",this.validator=e.validate||(()=>!0),this.color="cyan",this.value="",this.typed="",this.lastHit=0,this.render()}set value(e){e||0===e?(this.placeholder=!1,this.rendered=this.transform.render(`${_(e,this.round)}`),this._value=_(e,this.round)):(this.placeholder=!0,this.rendered=n.gray(this.transform.render(`${this.initial}`)),this._value=""),this.fire()}get value(){return this._value}parse(e){return this.float?parseFloat(e):parseInt(e)}valid(e){return"-"===e||"."===e&&this.float||p.test(e)}reset(){this.typed="",this.value="",this.fire(),this.render()}exit(){this.abort()}abort(){let e=this.value;this.value=""!==e?e:this.initial,this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write("\n"),this.close()}validate(){var e=this;return t((function*(){let t=yield e.validator(e.value);"string"==typeof t&&(e.errorMsg=t,t=!1),e.error=!t}))()}submit(){var e=this;return t((function*(){if(yield e.validate(),e.error)return e.color="red",e.fire(),void e.render();let t=e.value;e.value=""!==t?t:e.initial,e.done=!0,e.aborted=!1,e.error=!1,e.fire(),e.render(),e.out.write("\n"),e.close()}))()}up(){if(this.typed="",""===this.value&&(this.value=this.min-this.inc),this.value>=this.max)return this.bell();this.value+=this.inc,this.color="cyan",this.fire(),this.render()}down(){if(this.typed="",""===this.value&&(this.value=this.min+this.inc),this.value<=this.min)return this.bell();this.value-=this.inc,this.color="cyan",this.fire(),this.render()}delete(){let e=this.value.toString();if(0===e.length)return this.bell();this.value=this.parse(e=e.slice(0,-1))||"",""!==this.value&&this.value<this.min&&(this.value=this.min),this.color="cyan",this.fire(),this.render()}next(){this.value=this.initial,this.fire(),this.render()}_(e,t){if(!this.valid(e))return this.bell();const n=Date.now();if(n-this.lastHit>1e3&&(this.typed=""),this.typed+=e,this.lastHit=n,this.color="cyan","."===e)return this.fire();this.value=Math.min(this.parse(this.typed),this.max),this.value>this.max&&(this.value=this.max),this.value<this.min&&(this.value=this.min),this.fire(),this.render()}render(){this.closed||(this.firstRender||(this.outputError&&this.out.write(o.down(d(this.outputError,this.out.columns)-1)+u(this.outputError,this.out.columns)),this.out.write(u(this.outputText,this.out.columns))),super.render(),this.outputError="",this.outputText=[c.symbol(this.done,this.aborted),n.bold(this.msg),c.delimiter(this.done),this.done&&(this.done||this.placeholder)?this.rendered:n[this.color]().underline(this.rendered)].join(" "),this.error&&(this.outputError+=this.errorMsg.split("\n").reduce(((e,t,r)=>e+`\n${r?" ":l.pointerSmall} ${n.red().italic(t)}`),"")),this.out.write(s.line+o.to(0)+this.outputText+o.save+this.outputError+o.restore))}},number$1}function requireMultiselect$1(){if(hasRequiredMultiselect$1)return multiselect$1;hasRequiredMultiselect$1=1;const e=requireKleur(),t=requireSrc$6().cursor,n=requirePrompt$1(),r=requireUtil$4(),i=r.clear,o=r.figures,s=r.style,a=r.wrap,c=r.entriesToDisplay;return multiselect$1=class extends n{constructor(e={}){super(e),this.msg=e.message,this.cursor=e.cursor||0,this.scrollIndex=e.cursor||0,this.hint=e.hint||"",this.warn=e.warn||"- This option is disabled -",this.minSelected=e.min,this.showMinError=!1,this.maxChoices=e.max,this.instructions=e.instructions,this.optionsPerPage=e.optionsPerPage||10,this.value=e.choices.map(((e,t)=>("string"==typeof e&&(e={title:e,value:t}),{title:e&&(e.title||e.value||e),description:e&&e.description,value:e&&(void 0===e.value?t:e.value),selected:e&&e.selected,disabled:e&&e.disabled}))),this.clear=i("",this.out.columns),e.overrideRender||this.render()}reset(){this.value.map((e=>!e.selected)),this.cursor=0,this.fire(),this.render()}selected(){return this.value.filter((e=>e.selected))}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write("\n"),this.close()}submit(){const e=this.value.filter((e=>e.selected));this.minSelected&&e.length<this.minSelected?(this.showMinError=!0,this.render()):(this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write("\n"),this.close())}first(){this.cursor=0,this.render()}last(){this.cursor=this.value.length-1,this.render()}next(){this.cursor=(this.cursor+1)%this.value.length,this.render()}up(){0===this.cursor?this.cursor=this.value.length-1:this.cursor--,this.render()}down(){this.cursor===this.value.length-1?this.cursor=0:this.cursor++,this.render()}left(){this.value[this.cursor].selected=!1,this.render()}right(){if(this.value.filter((e=>e.selected)).length>=this.maxChoices)return this.bell();this.value[this.cursor].selected=!0,this.render()}handleSpaceToggle(){const e=this.value[this.cursor];if(e.selected)e.selected=!1,this.render();else{if(e.disabled||this.value.filter((e=>e.selected)).length>=this.maxChoices)return this.bell();e.selected=!0,this.render()}}toggleAll(){if(void 0!==this.maxChoices||this.value[this.cursor].disabled)return this.bell();const e=!this.value[this.cursor].selected;this.value.filter((e=>!e.disabled)).forEach((t=>t.selected=e)),this.render()}_(e,t){if(" "===e)this.handleSpaceToggle();else{if("a"!==e)return this.bell();this.toggleAll()}}renderInstructions(){return void 0===this.instructions||this.instructions?"string"==typeof this.instructions?this.instructions:`\nInstructions:\n ${o.arrowUp}/${o.arrowDown}: Highlight option\n ${o.arrowLeft}/${o.arrowRight}/[space]: Toggle selection\n`+(void 0===this.maxChoices?" a: Toggle all\n":"")+" enter/return: Complete answer":""}renderOption(t,n,r,i){const s=(n.selected?e.green(o.radioOn):o.radioOff)+" "+i+" ";let c,l;return n.disabled?c=t===r?e.gray().underline(n.title):e.strikethrough().gray(n.title):(c=t===r?e.cyan().underline(n.title):n.title,t===r&&n.description&&(l=` - ${n.description}`,(s.length+c.length+l.length>=this.out.columns||n.description.split(/\r?\n/).length>1)&&(l="\n"+a(n.description,{margin:s.length,width:this.out.columns})))),s+c+e.gray(l||"")}paginateOptions(t){if(0===t.length)return e.red("No matches for this query.");let n,r=c(this.cursor,t.length,this.optionsPerPage),i=r.startIndex,s=r.endIndex,a=[];for(let e=i;e<s;e++)n=e===i&&i>0?o.arrowUp:e===s-1&&s<t.length?o.arrowDown:" ",a.push(this.renderOption(this.cursor,t[e],e,n));return"\n"+a.join("\n")}renderOptions(e){return this.done?"":this.paginateOptions(e)}renderDoneOrInstructions(){if(this.done)return this.value.filter((e=>e.selected)).map((e=>e.title)).join(", ");const t=[e.gray(this.hint),this.renderInstructions()];return this.value[this.cursor].disabled&&t.push(e.yellow(this.warn)),t.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(t.hide),super.render();let n=[s.symbol(this.done,this.aborted),e.bold(this.msg),s.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(n+=e.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1),n+=this.renderOptions(this.value),this.out.write(this.clear+n),this.clear=i(n,this.out.columns)}},multiselect$1}function requireAutocomplete$1(){if(hasRequiredAutocomplete$1)return autocomplete$1;function e(e,t,n,r,i,o,s){try{var a=e[o](s),c=a.value}catch(e){return void n(e)}a.done?t(c):Promise.resolve(c).then(r,i)}hasRequiredAutocomplete$1=1;const t=requireKleur(),n=requirePrompt$1(),r=requireSrc$6(),i=r.erase,o=r.cursor,s=requireUtil$4(),a=s.style,c=s.clear,l=s.figures,u=s.wrap,d=s.entriesToDisplay,p=(e,t)=>e[t]&&(e[t].value||e[t].title||e[t]),f=(e,t)=>e[t]&&(e[t].title||e[t].value||e[t]);return autocomplete$1=class extends n{constructor(e={}){super(e),this.msg=e.message,this.suggest=e.suggest,this.choices=e.choices,this.initial="number"==typeof e.initial?e.initial:((e,t)=>{const n=e.findIndex((e=>e.value===t||e.title===t));return n>-1?n:void 0})(e.choices,e.initial),this.select=this.initial||e.cursor||0,this.i18n={noMatches:e.noMatches||"no matches found"},this.fallback=e.fallback||this.initial,this.clearFirst=e.clearFirst||!1,this.suggestions=[],this.input="",this.limit=e.limit||10,this.cursor=0,this.transform=a.render(e.style),this.scale=this.transform.scale,this.render=this.render.bind(this),this.complete=this.complete.bind(this),this.clear=c("",this.out.columns),this.complete(this.render),this.render()}set fallback(e){this._fb=Number.isSafeInteger(parseInt(e))?parseInt(e):e}get fallback(){let e;return"number"==typeof this._fb?e=this.choices[this._fb]:"string"==typeof this._fb&&(e={title:this._fb}),e||this._fb||{title:this.i18n.noMatches}}moveSelect(e){this.select=e,this.suggestions.length>0?this.value=p(this.suggestions,e):this.value=this.fallback.value,this.fire()}complete(t){var n,r=this;return(n=function*(){const e=r.completing=r.suggest(r.input,r.choices),n=yield e;if(r.completing!==e)return;r.suggestions=n.map(((e,t,n)=>({title:f(n,t),value:p(n,t),description:e.description}))),r.completing=!1;const i=Math.max(n.length-1,0);r.moveSelect(Math.min(i,r.select)),t&&t()},function(){var t=this,r=arguments;return new Promise((function(i,o){var s=n.apply(t,r);function a(t){e(s,i,o,a,c,"next",t)}function c(t){e(s,i,o,a,c,"throw",t)}a(void 0)}))})()}reset(){this.input="",this.complete((()=>{this.moveSelect(void 0!==this.initial?this.initial:0),this.render()})),this.render()}exit(){this.clearFirst&&this.input.length>0?this.reset():(this.done=this.exited=!0,this.aborted=!1,this.fire(),this.render(),this.out.write("\n"),this.close())}abort(){this.done=this.aborted=!0,this.exited=!1,this.fire(),this.render(),this.out.write("\n"),this.close()}submit(){this.done=!0,this.aborted=this.exited=!1,this.fire(),this.render(),this.out.write("\n"),this.close()}_(e,t){let n=this.input.slice(0,this.cursor),r=this.input.slice(this.cursor);this.input=`${n}${e}${r}`,this.cursor=n.length+1,this.complete(this.render),this.render()}delete(){if(0===this.cursor)return this.bell();let e=this.input.slice(0,this.cursor-1),t=this.input.slice(this.cursor);this.input=`${e}${t}`,this.complete(this.render),this.cursor=this.cursor-1,this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length)return this.bell();let e=this.input.slice(0,this.cursor),t=this.input.slice(this.cursor+1);this.input=`${e}${t}`,this.complete(this.render),this.render()}first(){this.moveSelect(0),this.render()}last(){this.moveSelect(this.suggestions.length-1),this.render()}up(){0===this.select?this.moveSelect(this.suggestions.length-1):this.moveSelect(this.select-1),this.render()}down(){this.select===this.suggestions.length-1?this.moveSelect(0):this.moveSelect(this.select+1),this.render()}next(){this.select===this.suggestions.length-1?this.moveSelect(0):this.moveSelect(this.select+1),this.render()}nextPage(){this.moveSelect(Math.min(this.select+this.limit,this.suggestions.length-1)),this.render()}prevPage(){this.moveSelect(Math.max(this.select-this.limit,0)),this.render()}left(){if(this.cursor<=0)return this.bell();this.cursor=this.cursor-1,this.render()}right(){if(this.cursor*this.scale>=this.rendered.length)return this.bell();this.cursor=this.cursor+1,this.render()}renderOption(e,n,r,i){let o,s=r?l.arrowUp:i?l.arrowDown:" ",a=n?t.cyan().underline(e.title):e.title;return s=(n?t.cyan(l.pointer)+" ":" ")+s,e.description&&(o=` - ${e.description}`,(s.length+a.length+o.length>=this.out.columns||e.description.split(/\r?\n/).length>1)&&(o="\n"+u(e.description,{margin:3,width:this.out.columns}))),s+" "+a+t.gray(o||"")}render(){if(this.closed)return;this.firstRender?this.out.write(o.hide):this.out.write(c(this.outputText,this.out.columns)),super.render();let e=d(this.select,this.choices.length,this.limit),n=e.startIndex,r=e.endIndex;if(this.outputText=[a.symbol(this.done,this.aborted,this.exited),t.bold(this.msg),a.delimiter(this.completing),this.done&&this.suggestions[this.select]?this.suggestions[this.select].title:this.rendered=this.transform.render(this.input)].join(" "),!this.done){const e=this.suggestions.slice(n,r).map(((e,t)=>this.renderOption(e,this.select===t+n,0===t&&n>0,t+n===r-1&&r<this.choices.length))).join("\n");this.outputText+="\n"+(e||t.gray(this.fallback.title))}this.out.write(i.line+o.to(0)+this.outputText)}},autocomplete$1}function requireAutocompleteMultiselect$1(){if(hasRequiredAutocompleteMultiselect$1)return autocompleteMultiselect$1;hasRequiredAutocompleteMultiselect$1=1;const e=requireKleur(),t=requireSrc$6().cursor,n=requireMultiselect$1(),r=requireUtil$4(),i=r.clear,o=r.style,s=r.figures;return autocompleteMultiselect$1=class extends n{constructor(e={}){e.overrideRender=!0,super(e),this.inputValue="",this.clear=i("",this.out.columns),this.filteredOptions=this.value,this.render()}last(){this.cursor=this.filteredOptions.length-1,this.render()}next(){this.cursor=(this.cursor+1)%this.filteredOptions.length,this.render()}up(){0===this.cursor?this.cursor=this.filteredOptions.length-1:this.cursor--,this.render()}down(){this.cursor===this.filteredOptions.length-1?this.cursor=0:this.cursor++,this.render()}left(){this.filteredOptions[this.cursor].selected=!1,this.render()}right(){if(this.value.filter((e=>e.selected)).length>=this.maxChoices)return this.bell();this.filteredOptions[this.cursor].selected=!0,this.render()}delete(){this.inputValue.length&&(this.inputValue=this.inputValue.substr(0,this.inputValue.length-1),this.updateFilteredOptions())}updateFilteredOptions(){const e=this.filteredOptions[this.cursor];this.filteredOptions=this.value.filter((e=>!this.inputValue||(!("string"!=typeof e.title||!e.title.toLowerCase().includes(this.inputValue.toLowerCase()))||!("string"!=typeof e.value||!e.value.toLowerCase().includes(this.inputValue.toLowerCase())))));const t=this.filteredOptions.findIndex((t=>t===e));this.cursor=t<0?0:t,this.render()}handleSpaceToggle(){const e=this.filteredOptions[this.cursor];if(e.selected)e.selected=!1,this.render();else{if(e.disabled||this.value.filter((e=>e.selected)).length>=this.maxChoices)return this.bell();e.selected=!0,this.render()}}handleInputChange(e){this.inputValue=this.inputValue+e,this.updateFilteredOptions()}_(e,t){" "===e?this.handleSpaceToggle():this.handleInputChange(e)}renderInstructions(){return void 0===this.instructions||this.instructions?"string"==typeof this.instructions?this.instructions:`\nInstructions:\n ${s.arrowUp}/${s.arrowDown}: Highlight option\n ${s.arrowLeft}/${s.arrowRight}/[space]: Toggle selection\n [a,b,c]/delete: Filter choices\n enter/return: Complete answer\n`:""}renderCurrentInput(){return`\nFiltered results for: ${this.inputValue?this.inputValue:e.gray("Enter something to filter")}\n`}renderOption(t,n,r){let i;return i=n.disabled?t===r?e.gray().underline(n.title):e.strikethrough().gray(n.title):t===r?e.cyan().underline(n.title):n.title,(n.selected?e.green(s.radioOn):s.radioOff)+" "+i}renderDoneOrInstructions(){if(this.done)return this.value.filter((e=>e.selected)).map((e=>e.title)).join(", ");const t=[e.gray(this.hint),this.renderInstructions(),this.renderCurrentInput()];return this.filteredOptions.length&&this.filteredOptions[this.cursor].disabled&&t.push(e.yellow(this.warn)),t.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(t.hide),super.render();let n=[o.symbol(this.done,this.aborted),e.bold(this.msg),o.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(n+=e.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1),n+=this.renderOptions(this.filteredOptions),this.out.write(this.clear+n),this.clear=i(n,this.out.columns)}},autocompleteMultiselect$1}function requireConfirm$1(){if(hasRequiredConfirm$1)return confirm$1;hasRequiredConfirm$1=1;const e=requireKleur(),t=requirePrompt$1(),n=requireUtil$4(),r=n.style,i=n.clear,o=requireSrc$6(),s=o.erase,a=o.cursor;return confirm$1=class extends t{constructor(e={}){super(e),this.msg=e.message,this.value=e.initial,this.initialValue=!!e.initial,this.yesMsg=e.yes||"yes",this.yesOption=e.yesOption||"(Y/n)",this.noMsg=e.no||"no",this.noOption=e.noOption||"(y/N)",this.render()}reset(){this.value=this.initialValue,this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write("\n"),this.close()}submit(){this.value=this.value||!1,this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write("\n"),this.close()}_(e,t){return"y"===e.toLowerCase()?(this.value=!0,this.submit()):"n"===e.toLowerCase()?(this.value=!1,this.submit()):this.bell()}render(){this.closed||(this.firstRender?this.out.write(a.hide):this.out.write(i(this.outputText,this.out.columns)),super.render(),this.outputText=[r.symbol(this.done,this.aborted),e.bold(this.msg),r.delimiter(this.done),this.done?this.value?this.yesMsg:this.noMsg:e.gray(this.initialValue?this.yesOption:this.noOption)].join(" "),this.out.write(s.line+a.to(0)+this.outputText))}}}function requireElements$1(){return hasRequiredElements$1?elements$1:(hasRequiredElements$1=1,elements$1={TextPrompt:requireText$2(),SelectPrompt:requireSelect$1(),TogglePrompt:requireToggle$1(),DatePrompt:requireDate$1(),NumberPrompt:requireNumber$1(),MultiselectPrompt:requireMultiselect$1(),AutocompletePrompt:requireAutocomplete$1(),AutocompleteMultiselectPrompt:requireAutocompleteMultiselect$1(),ConfirmPrompt:requireConfirm$1()})}function requirePrompts$2(){return hasRequiredPrompts$2||(hasRequiredPrompts$2=1,function(){const e=prompts$3,t=requireElements$1(),n=e=>e;function r(e,r,i={}){return new Promise(((o,s)=>{const a=new t[e](r),c=i.onAbort||n,l=i.onSubmit||n,u=i.onExit||n;a.on("state",r.onState||n),a.on("submit",(e=>o(l(e)))),a.on("exit",(e=>o(u(e)))),a.on("abort",(e=>s(c(e))))}))}e.text=e=>r("TextPrompt",e),e.password=t=>(t.style="password",e.text(t)),e.invisible=t=>(t.style="invisible",e.text(t)),e.number=e=>r("NumberPrompt",e),e.date=e=>r("DatePrompt",e),e.confirm=e=>r("ConfirmPrompt",e),e.list=e=>{const t=e.separator||",";return r("TextPrompt",e,{onSubmit:e=>e.split(t).map((e=>e.trim()))})},e.toggle=e=>r("TogglePrompt",e),e.select=e=>r("SelectPrompt",e),e.multiselect=e=>{e.choices=[].concat(e.choices||[]);const t=e=>e.filter((e=>e.selected)).map((e=>e.value));return r("MultiselectPrompt",e,{onAbort:t,onSubmit:t})},e.autocompleteMultiselect=e=>{e.choices=[].concat(e.choices||[]);const t=e=>e.filter((e=>e.selected)).map((e=>e.value));return r("AutocompleteMultiselectPrompt",e,{onAbort:t,onSubmit:t})};const i=(e,t)=>Promise.resolve(t.filter((t=>t.title.slice(0,e.length).toLowerCase()===e.toLowerCase())));e.autocomplete=e=>(e.suggest=e.suggest||i,e.choices=[].concat(e.choices||[]),r("AutocompletePrompt",e))}()),prompts$3}function requireDist$6(){if(hasRequiredDist$6)return dist$6;function e(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function t(t){for(var r=1;r<arguments.length;r++){var i=null!=arguments[r]?arguments[r]:{};r%2?e(Object(i),!0).forEach((function(e){n(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):e(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}function n(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return i(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return i(e,t)}(e))||t){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,a=!0,c=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){c=!0,s=e},f:function(){try{a||null==n.return||n.return()}finally{if(c)throw s}}}}function i(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function o(e,t,n,r,i,o,s){try{var a=e[o](s),c=a.value}catch(e){return void n(e)}a.done?t(c):Promise.resolve(c).then(r,i)}function s(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var s=e.apply(t,n);function a(e){o(s,r,i,a,c,"next",e)}function c(e){o(s,r,i,a,c,"throw",e)}a(void 0)}))}}hasRequiredDist$6=1;const a=requirePrompts$2(),c=["suggest","format","onState","validate","onRender","type"],l=()=>{};function u(){return d.apply(this,arguments)}function d(){return d=s((function*(e=[],{onSubmit:n=l,onCancel:i=l}={}){const o={},d=u._override||{};let f,_,m,h,g,A;e=[].concat(e);const y=function(){var e=s((function*(e,t,n=!1){if(n||!e.validate||!0===e.validate(t))return e.format?yield e.format(t,o):t}));return function(t,n){return e.apply(this,arguments)}}();var v,b=r(e);try{for(b.s();!(v=b.n()).done;){_=v.value;var C=_;if(h=C.name,g=C.type,"function"==typeof g&&(g=yield g(f,t({},o),_),_.type=g),g){for(let e in _){if(c.includes(e))continue;let n=_[e];_[e]="function"==typeof n?yield n(f,t({},o),A):n}if(A=_,"string"!=typeof _.message)throw new Error("prompt message is required");var E=_;if(h=E.name,g=E.type,void 0===a[g])throw new Error(`prompt type (${g}) is not defined`);if(void 0===d[_.name]||(f=yield y(_,d[_.name]),void 0===f)){try{f=u._injected?p(u._injected,_.initial):yield a[g](_),o[h]=f=yield y(_,f,!0),m=yield n(_,f,o)}catch(e){m=!(yield i(_,o))}if(m)return o}else o[h]=f}}}catch(e){b.e(e)}finally{b.f()}return o})),d.apply(this,arguments)}function p(e,t){const n=e.shift();if(n instanceof Error)throw n;return void 0===n?t:n}return dist$6=Object.assign(u,{prompt:u,prompts:a,inject:function(e){u._injected=(u._injected||[]).concat(e)},override:function(e){u._override=Object.assign({},e)}})}var prompts$2={},action,hasRequiredAction,strip,hasRequiredStrip,clear,hasRequiredClear,figures_1,hasRequiredFigures,style,hasRequiredStyle,lines,hasRequiredLines,wrap,hasRequiredWrap,entriesToDisplay,hasRequiredEntriesToDisplay,util$3,hasRequiredUtil$3,prompt,hasRequiredPrompt,text$1,hasRequiredText$1,select,hasRequiredSelect,toggle,hasRequiredToggle,datepart,hasRequiredDatepart,meridiem,hasRequiredMeridiem,day,hasRequiredDay,hours,hasRequiredHours,milliseconds,hasRequiredMilliseconds,minutes,hasRequiredMinutes,month,hasRequiredMonth,seconds,hasRequiredSeconds,year,hasRequiredYear,dateparts,hasRequiredDateparts,date,hasRequiredDate,number,hasRequiredNumber,multiselect,hasRequiredMultiselect,autocomplete,hasRequiredAutocomplete,autocompleteMultiselect,hasRequiredAutocompleteMultiselect,confirm,hasRequiredConfirm,elements,hasRequiredElements,hasRequiredPrompts$1,lib$f,hasRequiredLib$e,prompts$1,hasRequiredPrompts;function requireAction(){return hasRequiredAction?action:(hasRequiredAction=1,action=(e,t)=>{if(!e.meta||"escape"===e.name){if(e.ctrl){if("a"===e.name)return"first";if("c"===e.name)return"abort";if("d"===e.name)return"abort";if("e"===e.name)return"last";if("g"===e.name)return"reset"}if(t){if("j"===e.name)return"down";if("k"===e.name)return"up"}return"return"===e.name||"enter"===e.name?"submit":"backspace"===e.name?"delete":"delete"===e.name?"deleteForward":"abort"===e.name?"abort":"escape"===e.name?"exit":"tab"===e.name?"next":"pagedown"===e.name?"nextPage":"pageup"===e.name?"prevPage":"home"===e.name?"home":"end"===e.name?"end":"up"===e.name?"up":"down"===e.name?"down":"right"===e.name?"right":"left"===e.name&&"left"}})}function requireStrip(){return hasRequiredStrip||(hasRequiredStrip=1,strip=e=>{const t=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PRZcf-ntqry=><~]))"].join("|"),n=new RegExp(t,"g");return"string"==typeof e?e.replace(n,""):e}),strip}function requireClear(){if(hasRequiredClear)return clear;hasRequiredClear=1;const e=requireStrip(),{erase:t,cursor:n}=requireSrc$6(),r=t=>[...e(t)].length;return clear=function(e,i){if(!i)return t.line+n.to(0);let o=0;const s=e.split(/\r?\n/);for(let e of s)o+=1+Math.floor(Math.max(r(e)-1,0)/i);return t.lines(o)},clear}function requireFigures(){if(hasRequiredFigures)return figures_1;hasRequiredFigures=1;const e={arrowUp:"↑",arrowDown:"↓",arrowLeft:"←",arrowRight:"→",radioOn:"◉",radioOff:"◯",tick:"✔",cross:"✖",ellipsis:"…",pointerSmall:"›",line:"─",pointer:"❯"},t={arrowUp:e.arrowUp,arrowDown:e.arrowDown,arrowLeft:e.arrowLeft,arrowRight:e.arrowRight,radioOn:"(*)",radioOff:"( )",tick:"√",cross:"×",ellipsis:"...",pointerSmall:"»",line:"─",pointer:">"},n="win32"===process.platform?t:e;return figures_1=n}function requireStyle(){if(hasRequiredStyle)return style;hasRequiredStyle=1;const e=requireKleur(),t=requireFigures(),n=Object.freeze({password:{scale:1,render:e=>"*".repeat(e.length)},emoji:{scale:2,render:e=>"😃".repeat(e.length)},invisible:{scale:0,render:e=>""},default:{scale:1,render:e=>`${e}`}}),r=Object.freeze({aborted:e.red(t.cross),done:e.green(t.tick),exited:e.yellow(t.cross),default:e.cyan("?")});return style={styles:n,render:e=>n[e]||n.default,symbols:r,symbol:(e,t,n)=>t?r.aborted:n?r.exited:e?r.done:r.default,delimiter:n=>e.gray(n?t.ellipsis:t.pointerSmall),item:(n,r)=>e.gray(n?r?t.pointerSmall:"+":t.line)},style}function requireLines(){if(hasRequiredLines)return lines;hasRequiredLines=1;const e=requireStrip();return lines=function(t,n){let r=String(e(t)||"").split(/\r?\n/);return n?r.map((e=>Math.ceil(e.length/n))).reduce(((e,t)=>e+t)):r.length}}function requireWrap(){return hasRequiredWrap||(hasRequiredWrap=1,wrap=(e,t={})=>{const n=Number.isSafeInteger(parseInt(t.margin))?new Array(parseInt(t.margin)).fill(" ").join(""):t.margin||"",r=t.width;return(e||"").split(/\r?\n/g).map((e=>e.split(/\s+/g).reduce(((e,t)=>(t.length+n.length>=r||e[e.length-1].length+t.length+1<r?e[e.length-1]+=` ${t}`:e.push(`${n}${t}`),e)),[n]).join("\n"))).join("\n")}),wrap}function requireEntriesToDisplay(){return hasRequiredEntriesToDisplay?entriesToDisplay:(hasRequiredEntriesToDisplay=1,entriesToDisplay=(e,t,n)=>{n=n||t;let r=Math.min(t-n,e-Math.floor(n/2));return r<0&&(r=0),{startIndex:r,endIndex:Math.min(r+n,t)}})}function requireUtil$3(){return hasRequiredUtil$3?util$3:(hasRequiredUtil$3=1,util$3={action:requireAction(),clear:requireClear(),style:requireStyle(),strip:requireStrip(),figures:requireFigures(),lines:requireLines(),wrap:requireWrap(),entriesToDisplay:requireEntriesToDisplay()})}function requirePrompt(){if(hasRequiredPrompt)return prompt;hasRequiredPrompt=1;const e=require$$0$m,{action:t}=requireUtil$3(),n=require$$0$c,{beep:r,cursor:i}=requireSrc$6(),o=requireKleur();return prompt=class extends n{constructor(n={}){super(),this.firstRender=!0,this.in=n.stdin||process.stdin,this.out=n.stdout||process.stdout,this.onRender=(n.onRender||(()=>{})).bind(this);const r=e.createInterface({input:this.in,escapeCodeTimeout:50});e.emitKeypressEvents(this.in,r),this.in.isTTY&&this.in.setRawMode(!0);const o=["SelectPrompt","MultiselectPrompt"].indexOf(this.constructor.name)>-1,s=(e,n)=>{let r=t(n,o);!1===r?this._&&this._(e,n):"function"==typeof this[r]?this[r](n):this.bell()};this.close=()=>{this.out.write(i.show),this.in.removeListener("keypress",s),this.in.isTTY&&this.in.setRawMode(!1),r.close(),this.emit(this.aborted?"abort":this.exited?"exit":"submit",this.value),this.closed=!0},this.in.on("keypress",s)}fire(){this.emit("state",{value:this.value,aborted:!!this.aborted,exited:!!this.exited})}bell(){this.out.write(r)}render(){this.onRender(o),this.firstRender&&(this.firstRender=!1)}},prompt}function requireText$1(){if(hasRequiredText$1)return text$1;hasRequiredText$1=1;const e=requireKleur(),t=requirePrompt(),{erase:n,cursor:r}=requireSrc$6(),{style:i,clear:o,lines:s,figures:a}=requireUtil$3();return text$1=class extends t{constructor(e={}){super(e),this.transform=i.render(e.style),this.scale=this.transform.scale,this.msg=e.message,this.initial=e.initial||"",this.validator=e.validate||(()=>!0),this.value="",this.errorMsg=e.error||"Please Enter A Valid Value",this.cursor=Number(!!this.initial),this.cursorOffset=0,this.clear=o("",this.out.columns),this.render()}set value(t){!t&&this.initial?(this.placeholder=!0,this.rendered=e.gray(this.transform.render(this.initial))):(this.placeholder=!1,this.rendered=this.transform.render(t)),this._value=t,this.fire()}get value(){return this._value}reset(){this.value="",this.cursor=Number(!!this.initial),this.cursorOffset=0,this.fire(),this.render()}exit(){this.abort()}abort(){this.value=this.value||this.initial,this.done=this.aborted=!0,this.error=!1,this.red=!1,this.fire(),this.render(),this.out.write("\n"),this.close()}async validate(){let e=await this.validator(this.value);"string"==typeof e&&(this.errorMsg=e,e=!1),this.error=!e}async submit(){if(this.value=this.value||this.initial,this.cursorOffset=0,this.cursor=this.rendered.length,await this.validate(),this.error)return this.red=!0,this.fire(),void this.render();this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write("\n"),this.close()}next(){if(!this.placeholder)return this.bell();this.value=this.initial,this.cursor=this.rendered.length,this.fire(),this.render()}moveCursor(e){this.placeholder||(this.cursor=this.cursor+e,this.cursorOffset+=e)}_(e,t){let n=this.value.slice(0,this.cursor),r=this.value.slice(this.cursor);this.value=`${n}${e}${r}`,this.red=!1,this.cursor=this.placeholder?0:n.length+1,this.render()}delete(){if(this.isCursorAtStart())return this.bell();let e=this.value.slice(0,this.cursor-1),t=this.value.slice(this.cursor);this.value=`${e}${t}`,this.red=!1,this.isCursorAtStart()?this.cursorOffset=0:(this.cursorOffset++,this.moveCursor(-1)),this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length||this.placeholder)return this.bell();let e=this.value.slice(0,this.cursor),t=this.value.slice(this.cursor+1);this.value=`${e}${t}`,this.red=!1,this.isCursorAtEnd()?this.cursorOffset=0:this.cursorOffset++,this.render()}first(){this.cursor=0,this.render()}last(){this.cursor=this.value.length,this.render()}left(){if(this.cursor<=0||this.placeholder)return this.bell();this.moveCursor(-1),this.render()}right(){if(this.cursor*this.scale>=this.rendered.length||this.placeholder)return this.bell();this.moveCursor(1),this.render()}isCursorAtStart(){return 0===this.cursor||this.placeholder&&1===this.cursor}isCursorAtEnd(){return this.cursor===this.rendered.length||this.placeholder&&this.cursor===this.rendered.length+1}render(){this.closed||(this.firstRender||(this.outputError&&this.out.write(r.down(s(this.outputError,this.out.columns)-1)+o(this.outputError,this.out.columns)),this.out.write(o(this.outputText,this.out.columns))),super.render(),this.outputError="",this.outputText=[i.symbol(this.done,this.aborted),e.bold(this.msg),i.delimiter(this.done),this.red?e.red(this.rendered):this.rendered].join(" "),this.error&&(this.outputError+=this.errorMsg.split("\n").reduce(((t,n,r)=>t+`\n${r?" ":a.pointerSmall} ${e.red().italic(n)}`),"")),this.out.write(n.line+r.to(0)+this.outputText+r.save+this.outputError+r.restore+r.move(this.cursorOffset,0)))}},text$1}function requireSelect(){if(hasRequiredSelect)return select;hasRequiredSelect=1;const e=requireKleur(),t=requirePrompt(),{style:n,clear:r,figures:i,wrap:o,entriesToDisplay:s}=requireUtil$3(),{cursor:a}=requireSrc$6();return select=class extends t{constructor(e={}){super(e),this.msg=e.message,this.hint=e.hint||"- Use arrow-keys. Return to submit.",this.warn=e.warn||"- This option is disabled",this.cursor=e.initial||0,this.choices=e.choices.map(((e,t)=>("string"==typeof e&&(e={title:e,value:t}),{title:e&&(e.title||e.value||e),value:e&&(void 0===e.value?t:e.value),description:e&&e.description,selected:e&&e.selected,disabled:e&&e.disabled}))),this.optionsPerPage=e.optionsPerPage||10,this.value=(this.choices[this.cursor]||{}).value,this.clear=r("",this.out.columns),this.render()}moveCursor(e){this.cursor=e,this.value=this.choices[e].value,this.fire()}reset(){this.moveCursor(0),this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write("\n"),this.close()}submit(){this.selection.disabled?this.bell():(this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write("\n"),this.close())}first(){this.moveCursor(0),this.render()}last(){this.moveCursor(this.choices.length-1),this.render()}up(){0===this.cursor?this.moveCursor(this.choices.length-1):this.moveCursor(this.cursor-1),this.render()}down(){this.cursor===this.choices.length-1?this.moveCursor(0):this.moveCursor(this.cursor+1),this.render()}next(){this.moveCursor((this.cursor+1)%this.choices.length),this.render()}_(e,t){if(" "===e)return this.submit()}get selection(){return this.choices[this.cursor]}render(){if(this.closed)return;this.firstRender?this.out.write(a.hide):this.out.write(r(this.outputText,this.out.columns)),super.render();let{startIndex:t,endIndex:c}=s(this.cursor,this.choices.length,this.optionsPerPage);if(this.outputText=[n.symbol(this.done,this.aborted),e.bold(this.msg),n.delimiter(!1),this.done?this.selection.title:this.selection.disabled?e.yellow(this.warn):e.gray(this.hint)].join(" "),!this.done){this.outputText+="\n";for(let n=t;n<c;n++){let r,s,a="",l=this.choices[n];s=n===t&&t>0?i.arrowUp:n===c-1&&c<this.choices.length?i.arrowDown:" ",l.disabled?(r=this.cursor===n?e.gray().underline(l.title):e.strikethrough().gray(l.title),s=(this.cursor===n?e.bold().gray(i.pointer)+" ":" ")+s):(r=this.cursor===n?e.cyan().underline(l.title):l.title,s=(this.cursor===n?e.cyan(i.pointer)+" ":" ")+s,l.description&&this.cursor===n&&(a=` - ${l.description}`,(s.length+r.length+a.length>=this.out.columns||l.description.split(/\r?\n/).length>1)&&(a="\n"+o(l.description,{margin:3,width:this.out.columns})))),this.outputText+=`${s} ${r}${e.gray(a)}\n`}}this.out.write(this.outputText)}},select}function requireToggle(){if(hasRequiredToggle)return toggle;hasRequiredToggle=1;const e=requireKleur(),t=requirePrompt(),{style:n,clear:r}=requireUtil$3(),{cursor:i,erase:o}=requireSrc$6();return toggle=class extends t{constructor(e={}){super(e),this.msg=e.message,this.value=!!e.initial,this.active=e.active||"on",this.inactive=e.inactive||"off",this.initialValue=this.value,this.render()}reset(){this.value=this.initialValue,this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write("\n"),this.close()}submit(){this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write("\n"),this.close()}deactivate(){if(!1===this.value)return this.bell();this.value=!1,this.render()}activate(){if(!0===this.value)return this.bell();this.value=!0,this.render()}delete(){this.deactivate()}left(){this.deactivate()}right(){this.activate()}down(){this.deactivate()}up(){this.activate()}next(){this.value=!this.value,this.fire(),this.render()}_(e,t){if(" "===e)this.value=!this.value;else if("1"===e)this.value=!0;else{if("0"!==e)return this.bell();this.value=!1}this.render()}render(){this.closed||(this.firstRender?this.out.write(i.hide):this.out.write(r(this.outputText,this.out.columns)),super.render(),this.outputText=[n.symbol(this.done,this.aborted),e.bold(this.msg),n.delimiter(this.done),this.value?this.inactive:e.cyan().underline(this.inactive),e.gray("/"),this.value?e.cyan().underline(this.active):this.active].join(" "),this.out.write(o.line+i.to(0)+this.outputText))}}}function requireDatepart(){if(hasRequiredDatepart)return datepart;hasRequiredDatepart=1;class e{constructor({token:e,date:t,parts:n,locales:r}){this.token=e,this.date=t||new Date,this.parts=n||[this],this.locales=r||{}}up(){}down(){}next(){const t=this.parts.indexOf(this);return this.parts.find(((n,r)=>r>t&&n instanceof e))}setTo(e){}prev(){let t=[].concat(this.parts).reverse();const n=t.indexOf(this);return t.find(((t,r)=>r>n&&t instanceof e))}toString(){return String(this.date)}}return datepart=e}function requireMeridiem(){if(hasRequiredMeridiem)return meridiem;hasRequiredMeridiem=1;const e=requireDatepart();return meridiem=class extends e{constructor(e={}){super(e)}up(){this.date.setHours((this.date.getHours()+12)%24)}down(){this.up()}toString(){let e=this.date.getHours()>12?"pm":"am";return/\A/.test(this.token)?e.toUpperCase():e}}}function requireDay(){if(hasRequiredDay)return day;hasRequiredDay=1;const e=requireDatepart();return day=class extends e{constructor(e={}){super(e)}up(){this.date.setDate(this.date.getDate()+1)}down(){this.date.setDate(this.date.getDate()-1)}setTo(e){this.date.setDate(parseInt(e.substr(-2)))}toString(){let e=this.date.getDate(),t=this.date.getDay();return"DD"===this.token?String(e).padStart(2,"0"):"Do"===this.token?e+(n=e,1==(n%=10)?"st":2===n?"nd":3===n?"rd":"th"):"d"===this.token?t+1:"ddd"===this.token?this.locales.weekdaysShort[t]:"dddd"===this.token?this.locales.weekdays[t]:e;var n}},day}function requireHours(){if(hasRequiredHours)return hours;hasRequiredHours=1;const e=requireDatepart();return hours=class extends e{constructor(e={}){super(e)}up(){this.date.setHours(this.date.getHours()+1)}down(){this.date.setHours(this.date.getHours()-1)}setTo(e){this.date.setHours(parseInt(e.substr(-2)))}toString(){let e=this.date.getHours();return/h/.test(this.token)&&(e=e%12||12),this.token.length>1?String(e).padStart(2,"0"):e}}}function requireMilliseconds(){if(hasRequiredMilliseconds)return milliseconds;hasRequiredMilliseconds=1;const e=requireDatepart();return milliseconds=class extends e{constructor(e={}){super(e)}up(){this.date.setMilliseconds(this.date.getMilliseconds()+1)}down(){this.date.setMilliseconds(this.date.getMilliseconds()-1)}setTo(e){this.date.setMilliseconds(parseInt(e.substr(-this.token.length)))}toString(){return String(this.date.getMilliseconds()).padStart(4,"0").substr(0,this.token.length)}}}function requireMinutes(){if(hasRequiredMinutes)return minutes;hasRequiredMinutes=1;const e=requireDatepart();return minutes=class extends e{constructor(e={}){super(e)}up(){this.date.setMinutes(this.date.getMinutes()+1)}down(){this.date.setMinutes(this.date.getMinutes()-1)}setTo(e){this.date.setMinutes(parseInt(e.substr(-2)))}toString(){let e=this.date.getMinutes();return this.token.length>1?String(e).padStart(2,"0"):e}}}function requireMonth(){if(hasRequiredMonth)return month;hasRequiredMonth=1;const e=requireDatepart();return month=class extends e{constructor(e={}){super(e)}up(){this.date.setMonth(this.date.getMonth()+1)}down(){this.date.setMonth(this.date.getMonth()-1)}setTo(e){e=parseInt(e.substr(-2))-1,this.date.setMonth(e<0?0:e)}toString(){let e=this.date.getMonth(),t=this.token.length;return 2===t?String(e+1).padStart(2,"0"):3===t?this.locales.monthsShort[e]:4===t?this.locales.months[e]:String(e+1)}}}function requireSeconds(){if(hasRequiredSeconds)return seconds;hasRequiredSeconds=1;const e=requireDatepart();return seconds=class extends e{constructor(e={}){super(e)}up(){this.date.setSeconds(this.date.getSeconds()+1)}down(){this.date.setSeconds(this.date.getSeconds()-1)}setTo(e){this.date.setSeconds(parseInt(e.substr(-2)))}toString(){let e=this.date.getSeconds();return this.token.length>1?String(e).padStart(2,"0"):e}}}function requireYear(){if(hasRequiredYear)return year;hasRequiredYear=1;const e=requireDatepart();return year=class extends e{constructor(e={}){super(e)}up(){this.date.setFullYear(this.date.getFullYear()+1)}down(){this.date.setFullYear(this.date.getFullYear()-1)}setTo(e){this.date.setFullYear(e.substr(-4))}toString(){let e=String(this.date.getFullYear()).padStart(4,"0");return 2===this.token.length?e.substr(-2):e}}}function requireDateparts(){return hasRequiredDateparts?dateparts:(hasRequiredDateparts=1,dateparts={DatePart:requireDatepart(),Meridiem:requireMeridiem(),Day:requireDay(),Hours:requireHours(),Milliseconds:requireMilliseconds(),Minutes:requireMinutes(),Month:requireMonth(),Seconds:requireSeconds(),Year:requireYear()})}function requireDate(){if(hasRequiredDate)return date;hasRequiredDate=1;const e=requireKleur(),t=requirePrompt(),{style:n,clear:r,figures:i}=requireUtil$3(),{erase:o,cursor:s}=requireSrc$6(),{DatePart:a,Meridiem:c,Day:l,Hours:u,Milliseconds:d,Minutes:p,Month:f,Seconds:_,Year:m}=requireDateparts(),h=/\\(.)|"((?:\\["\\]|[^"])+)"|(D[Do]?|d{3,4}|d)|(M{1,4})|(YY(?:YY)?)|([aA])|([Hh]{1,2})|(m{1,2})|(s{1,2})|(S{1,4})|./g,g={1:({token:e})=>e.replace(/\\(.)/g,"$1"),2:e=>new l(e),3:e=>new f(e),4:e=>new m(e),5:e=>new c(e),6:e=>new u(e),7:e=>new p(e),8:e=>new _(e),9:e=>new d(e)},A={months:"January,February,March,April,May,June,July,August,September,October,November,December".split(","),monthsShort:"Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec".split(","),weekdays:"Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday".split(","),weekdaysShort:"Sun,Mon,Tue,Wed,Thu,Fri,Sat".split(",")};return date=class extends t{constructor(e={}){super(e),this.msg=e.message,this.cursor=0,this.typed="",this.locales=Object.assign(A,e.locales),this._date=e.initial||new Date,this.errorMsg=e.error||"Please Enter A Valid Value",this.validator=e.validate||(()=>!0),this.mask=e.mask||"YYYY-MM-DD HH:mm:ss",this.clear=r("",this.out.columns),this.render()}get value(){return this.date}get date(){return this._date}set date(e){e&&this._date.setTime(e.getTime())}set mask(e){let t;for(this.parts=[];t=h.exec(e);){let e=t.shift(),n=t.findIndex((e=>null!=e));this.parts.push(n in g?g[n]({token:t[n]||e,date:this.date,parts:this.parts,locales:this.locales}):t[n]||e)}let n=this.parts.reduce(((e,t)=>("string"==typeof t&&"string"==typeof e[e.length-1]?e[e.length-1]+=t:e.push(t),e)),[]);this.parts.splice(0),this.parts.push(...n),this.reset()}moveCursor(e){this.typed="",this.cursor=e,this.fire()}reset(){this.moveCursor(this.parts.findIndex((e=>e instanceof a))),this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write("\n"),this.close()}async validate(){let e=await this.validator(this.value);"string"==typeof e&&(this.errorMsg=e,e=!1),this.error=!e}async submit(){if(await this.validate(),this.error)return this.color="red",this.fire(),void this.render();this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write("\n"),this.close()}up(){this.typed="",this.parts[this.cursor].up(),this.render()}down(){this.typed="",this.parts[this.cursor].down(),this.render()}left(){let e=this.parts[this.cursor].prev();if(null==e)return this.bell();this.moveCursor(this.parts.indexOf(e)),this.render()}right(){let e=this.parts[this.cursor].next();if(null==e)return this.bell();this.moveCursor(this.parts.indexOf(e)),this.render()}next(){let e=this.parts[this.cursor].next();this.moveCursor(e?this.parts.indexOf(e):this.parts.findIndex((e=>e instanceof a))),this.render()}_(e){/\d/.test(e)&&(this.typed+=e,this.parts[this.cursor].setTo(this.typed),this.render())}render(){this.closed||(this.firstRender?this.out.write(s.hide):this.out.write(r(this.outputText,this.out.columns)),super.render(),this.outputText=[n.symbol(this.done,this.aborted),e.bold(this.msg),n.delimiter(!1),this.parts.reduce(((t,n,r)=>t.concat(r!==this.cursor||this.done?n:e.cyan().underline(n.toString()))),[]).join("")].join(" "),this.error&&(this.outputText+=this.errorMsg.split("\n").reduce(((t,n,r)=>t+`\n${r?" ":i.pointerSmall} ${e.red().italic(n)}`),"")),this.out.write(o.line+s.to(0)+this.outputText))}},date}function requireNumber(){if(hasRequiredNumber)return number;hasRequiredNumber=1;const e=requireKleur(),t=requirePrompt(),{cursor:n,erase:r}=requireSrc$6(),{style:i,figures:o,clear:s,lines:a}=requireUtil$3(),c=/[0-9]/,l=e=>void 0!==e,u=(e,t)=>{let n=Math.pow(10,t);return Math.round(e*n)/n};return number=class extends t{constructor(e={}){super(e),this.transform=i.render(e.style),this.msg=e.message,this.initial=l(e.initial)?e.initial:"",this.float=!!e.float,this.round=e.round||2,this.inc=e.increment||1,this.min=l(e.min)?e.min:-1/0,this.max=l(e.max)?e.max:1/0,this.errorMsg=e.error||"Please Enter A Valid Value",this.validator=e.validate||(()=>!0),this.color="cyan",this.value="",this.typed="",this.lastHit=0,this.render()}set value(t){t||0===t?(this.placeholder=!1,this.rendered=this.transform.render(`${u(t,this.round)}`),this._value=u(t,this.round)):(this.placeholder=!0,this.rendered=e.gray(this.transform.render(`${this.initial}`)),this._value=""),this.fire()}get value(){return this._value}parse(e){return this.float?parseFloat(e):parseInt(e)}valid(e){return"-"===e||"."===e&&this.float||c.test(e)}reset(){this.typed="",this.value="",this.fire(),this.render()}exit(){this.abort()}abort(){let e=this.value;this.value=""!==e?e:this.initial,this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write("\n"),this.close()}async validate(){let e=await this.validator(this.value);"string"==typeof e&&(this.errorMsg=e,e=!1),this.error=!e}async submit(){if(await this.validate(),this.error)return this.color="red",this.fire(),void this.render();let e=this.value;this.value=""!==e?e:this.initial,this.done=!0,this.aborted=!1,this.error=!1,this.fire(),this.render(),this.out.write("\n"),this.close()}up(){if(this.typed="",""===this.value&&(this.value=this.min-this.inc),this.value>=this.max)return this.bell();this.value+=this.inc,this.color="cyan",this.fire(),this.render()}down(){if(this.typed="",""===this.value&&(this.value=this.min+this.inc),this.value<=this.min)return this.bell();this.value-=this.inc,this.color="cyan",this.fire(),this.render()}delete(){let e=this.value.toString();if(0===e.length)return this.bell();this.value=this.parse(e=e.slice(0,-1))||"",""!==this.value&&this.value<this.min&&(this.value=this.min),this.color="cyan",this.fire(),this.render()}next(){this.value=this.initial,this.fire(),this.render()}_(e,t){if(!this.valid(e))return this.bell();const n=Date.now();if(n-this.lastHit>1e3&&(this.typed=""),this.typed+=e,this.lastHit=n,this.color="cyan","."===e)return this.fire();this.value=Math.min(this.parse(this.typed),this.max),this.value>this.max&&(this.value=this.max),this.value<this.min&&(this.value=this.min),this.fire(),this.render()}render(){this.closed||(this.firstRender||(this.outputError&&this.out.write(n.down(a(this.outputError,this.out.columns)-1)+s(this.outputError,this.out.columns)),this.out.write(s(this.outputText,this.out.columns))),super.render(),this.outputError="",this.outputText=[i.symbol(this.done,this.aborted),e.bold(this.msg),i.delimiter(this.done),this.done&&(this.done||this.placeholder)?this.rendered:e[this.color]().underline(this.rendered)].join(" "),this.error&&(this.outputError+=this.errorMsg.split("\n").reduce(((t,n,r)=>t+`\n${r?" ":o.pointerSmall} ${e.red().italic(n)}`),"")),this.out.write(r.line+n.to(0)+this.outputText+n.save+this.outputError+n.restore))}},number}function requireMultiselect(){if(hasRequiredMultiselect)return multiselect;hasRequiredMultiselect=1;const e=requireKleur(),{cursor:t}=requireSrc$6(),n=requirePrompt(),{clear:r,figures:i,style:o,wrap:s,entriesToDisplay:a}=requireUtil$3();return multiselect=class extends n{constructor(e={}){super(e),this.msg=e.message,this.cursor=e.cursor||0,this.scrollIndex=e.cursor||0,this.hint=e.hint||"",this.warn=e.warn||"- This option is disabled -",this.minSelected=e.min,this.showMinError=!1,this.maxChoices=e.max,this.instructions=e.instructions,this.optionsPerPage=e.optionsPerPage||10,this.value=e.choices.map(((e,t)=>("string"==typeof e&&(e={title:e,value:t}),{title:e&&(e.title||e.value||e),description:e&&e.description,value:e&&(void 0===e.value?t:e.value),selected:e&&e.selected,disabled:e&&e.disabled}))),this.clear=r("",this.out.columns),e.overrideRender||this.render()}reset(){this.value.map((e=>!e.selected)),this.cursor=0,this.fire(),this.render()}selected(){return this.value.filter((e=>e.selected))}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write("\n"),this.close()}submit(){const e=this.value.filter((e=>e.selected));this.minSelected&&e.length<this.minSelected?(this.showMinError=!0,this.render()):(this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write("\n"),this.close())}first(){this.cursor=0,this.render()}last(){this.cursor=this.value.length-1,this.render()}next(){this.cursor=(this.cursor+1)%this.value.length,this.render()}up(){0===this.cursor?this.cursor=this.value.length-1:this.cursor--,this.render()}down(){this.cursor===this.value.length-1?this.cursor=0:this.cursor++,this.render()}left(){this.value[this.cursor].selected=!1,this.render()}right(){if(this.value.filter((e=>e.selected)).length>=this.maxChoices)return this.bell();this.value[this.cursor].selected=!0,this.render()}handleSpaceToggle(){const e=this.value[this.cursor];if(e.selected)e.selected=!1,this.render();else{if(e.disabled||this.value.filter((e=>e.selected)).length>=this.maxChoices)return this.bell();e.selected=!0,this.render()}}toggleAll(){if(void 0!==this.maxChoices||this.value[this.cursor].disabled)return this.bell();const e=!this.value[this.cursor].selected;this.value.filter((e=>!e.disabled)).forEach((t=>t.selected=e)),this.render()}_(e,t){if(" "===e)this.handleSpaceToggle();else{if("a"!==e)return this.bell();this.toggleAll()}}renderInstructions(){return void 0===this.instructions||this.instructions?"string"==typeof this.instructions?this.instructions:`\nInstructions:\n ${i.arrowUp}/${i.arrowDown}: Highlight option\n ${i.arrowLeft}/${i.arrowRight}/[space]: Toggle selection\n`+(void 0===this.maxChoices?" a: Toggle all\n":"")+" enter/return: Complete answer":""}renderOption(t,n,r,o){const a=(n.selected?e.green(i.radioOn):i.radioOff)+" "+o+" ";let c,l;return n.disabled?c=t===r?e.gray().underline(n.title):e.strikethrough().gray(n.title):(c=t===r?e.cyan().underline(n.title):n.title,t===r&&n.description&&(l=` - ${n.description}`,(a.length+c.length+l.length>=this.out.columns||n.description.split(/\r?\n/).length>1)&&(l="\n"+s(n.description,{margin:a.length,width:this.out.columns})))),a+c+e.gray(l||"")}paginateOptions(t){if(0===t.length)return e.red("No matches for this query.");let n,{startIndex:r,endIndex:o}=a(this.cursor,t.length,this.optionsPerPage),s=[];for(let e=r;e<o;e++)n=e===r&&r>0?i.arrowUp:e===o-1&&o<t.length?i.arrowDown:" ",s.push(this.renderOption(this.cursor,t[e],e,n));return"\n"+s.join("\n")}renderOptions(e){return this.done?"":this.paginateOptions(e)}renderDoneOrInstructions(){if(this.done)return this.value.filter((e=>e.selected)).map((e=>e.title)).join(", ");const t=[e.gray(this.hint),this.renderInstructions()];return this.value[this.cursor].disabled&&t.push(e.yellow(this.warn)),t.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(t.hide),super.render();let n=[o.symbol(this.done,this.aborted),e.bold(this.msg),o.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(n+=e.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1),n+=this.renderOptions(this.value),this.out.write(this.clear+n),this.clear=r(n,this.out.columns)}},multiselect}function requireAutocomplete(){if(hasRequiredAutocomplete)return autocomplete;hasRequiredAutocomplete=1;const e=requireKleur(),t=requirePrompt(),{erase:n,cursor:r}=requireSrc$6(),{style:i,clear:o,figures:s,wrap:a,entriesToDisplay:c}=requireUtil$3(),l=(e,t)=>e[t]&&(e[t].value||e[t].title||e[t]),u=(e,t)=>e[t]&&(e[t].title||e[t].value||e[t]);return autocomplete=class extends t{constructor(e={}){super(e),this.msg=e.message,this.suggest=e.suggest,this.choices=e.choices,this.initial="number"==typeof e.initial?e.initial:((e,t)=>{const n=e.findIndex((e=>e.value===t||e.title===t));return n>-1?n:void 0})(e.choices,e.initial),this.select=this.initial||e.cursor||0,this.i18n={noMatches:e.noMatches||"no matches found"},this.fallback=e.fallback||this.initial,this.clearFirst=e.clearFirst||!1,this.suggestions=[],this.input="",this.limit=e.limit||10,this.cursor=0,this.transform=i.render(e.style),this.scale=this.transform.scale,this.render=this.render.bind(this),this.complete=this.complete.bind(this),this.clear=o("",this.out.columns),this.complete(this.render),this.render()}set fallback(e){this._fb=Number.isSafeInteger(parseInt(e))?parseInt(e):e}get fallback(){let e;return"number"==typeof this._fb?e=this.choices[this._fb]:"string"==typeof this._fb&&(e={title:this._fb}),e||this._fb||{title:this.i18n.noMatches}}moveSelect(e){this.select=e,this.suggestions.length>0?this.value=l(this.suggestions,e):this.value=this.fallback.value,this.fire()}async complete(e){const t=this.completing=this.suggest(this.input,this.choices),n=await t;if(this.completing!==t)return;this.suggestions=n.map(((e,t,n)=>({title:u(n,t),value:l(n,t),description:e.description}))),this.completing=!1;const r=Math.max(n.length-1,0);this.moveSelect(Math.min(r,this.select)),e&&e()}reset(){this.input="",this.complete((()=>{this.moveSelect(void 0!==this.initial?this.initial:0),this.render()})),this.render()}exit(){this.clearFirst&&this.input.length>0?this.reset():(this.done=this.exited=!0,this.aborted=!1,this.fire(),this.render(),this.out.write("\n"),this.close())}abort(){this.done=this.aborted=!0,this.exited=!1,this.fire(),this.render(),this.out.write("\n"),this.close()}submit(){this.done=!0,this.aborted=this.exited=!1,this.fire(),this.render(),this.out.write("\n"),this.close()}_(e,t){let n=this.input.slice(0,this.cursor),r=this.input.slice(this.cursor);this.input=`${n}${e}${r}`,this.cursor=n.length+1,this.complete(this.render),this.render()}delete(){if(0===this.cursor)return this.bell();let e=this.input.slice(0,this.cursor-1),t=this.input.slice(this.cursor);this.input=`${e}${t}`,this.complete(this.render),this.cursor=this.cursor-1,this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length)return this.bell();let e=this.input.slice(0,this.cursor),t=this.input.slice(this.cursor+1);this.input=`${e}${t}`,this.complete(this.render),this.render()}first(){this.moveSelect(0),this.render()}last(){this.moveSelect(this.suggestions.length-1),this.render()}up(){0===this.select?this.moveSelect(this.suggestions.length-1):this.moveSelect(this.select-1),this.render()}down(){this.select===this.suggestions.length-1?this.moveSelect(0):this.moveSelect(this.select+1),this.render()}next(){this.select===this.suggestions.length-1?this.moveSelect(0):this.moveSelect(this.select+1),this.render()}nextPage(){this.moveSelect(Math.min(this.select+this.limit,this.suggestions.length-1)),this.render()}prevPage(){this.moveSelect(Math.max(this.select-this.limit,0)),this.render()}left(){if(this.cursor<=0)return this.bell();this.cursor=this.cursor-1,this.render()}right(){if(this.cursor*this.scale>=this.rendered.length)return this.bell();this.cursor=this.cursor+1,this.render()}renderOption(t,n,r,i){let o,c=r?s.arrowUp:i?s.arrowDown:" ",l=n?e.cyan().underline(t.title):t.title;return c=(n?e.cyan(s.pointer)+" ":" ")+c,t.description&&(o=` - ${t.description}`,(c.length+l.length+o.length>=this.out.columns||t.description.split(/\r?\n/).length>1)&&(o="\n"+a(t.description,{margin:3,width:this.out.columns}))),c+" "+l+e.gray(o||"")}render(){if(this.closed)return;this.firstRender?this.out.write(r.hide):this.out.write(o(this.outputText,this.out.columns)),super.render();let{startIndex:t,endIndex:s}=c(this.select,this.choices.length,this.limit);if(this.outputText=[i.symbol(this.done,this.aborted,this.exited),e.bold(this.msg),i.delimiter(this.completing),this.done&&this.suggestions[this.select]?this.suggestions[this.select].title:this.rendered=this.transform.render(this.input)].join(" "),!this.done){const n=this.suggestions.slice(t,s).map(((e,n)=>this.renderOption(e,this.select===n+t,0===n&&t>0,n+t===s-1&&s<this.choices.length))).join("\n");this.outputText+="\n"+(n||e.gray(this.fallback.title))}this.out.write(n.line+r.to(0)+this.outputText)}},autocomplete}function requireAutocompleteMultiselect(){if(hasRequiredAutocompleteMultiselect)return autocompleteMultiselect;hasRequiredAutocompleteMultiselect=1;const e=requireKleur(),{cursor:t}=requireSrc$6(),n=requireMultiselect(),{clear:r,style:i,figures:o}=requireUtil$3();return autocompleteMultiselect=class extends n{constructor(e={}){e.overrideRender=!0,super(e),this.inputValue="",this.clear=r("",this.out.columns),this.filteredOptions=this.value,this.render()}last(){this.cursor=this.filteredOptions.length-1,this.render()}next(){this.cursor=(this.cursor+1)%this.filteredOptions.length,this.render()}up(){0===this.cursor?this.cursor=this.filteredOptions.length-1:this.cursor--,this.render()}down(){this.cursor===this.filteredOptions.length-1?this.cursor=0:this.cursor++,this.render()}left(){this.filteredOptions[this.cursor].selected=!1,this.render()}right(){if(this.value.filter((e=>e.selected)).length>=this.maxChoices)return this.bell();this.filteredOptions[this.cursor].selected=!0,this.render()}delete(){this.inputValue.length&&(this.inputValue=this.inputValue.substr(0,this.inputValue.length-1),this.updateFilteredOptions())}updateFilteredOptions(){const e=this.filteredOptions[this.cursor];this.filteredOptions=this.value.filter((e=>!this.inputValue||(!("string"!=typeof e.title||!e.title.toLowerCase().includes(this.inputValue.toLowerCase()))||!("string"!=typeof e.value||!e.value.toLowerCase().includes(this.inputValue.toLowerCase())))));const t=this.filteredOptions.findIndex((t=>t===e));this.cursor=t<0?0:t,this.render()}handleSpaceToggle(){const e=this.filteredOptions[this.cursor];if(e.selected)e.selected=!1,this.render();else{if(e.disabled||this.value.filter((e=>e.selected)).length>=this.maxChoices)return this.bell();e.selected=!0,this.render()}}handleInputChange(e){this.inputValue=this.inputValue+e,this.updateFilteredOptions()}_(e,t){" "===e?this.handleSpaceToggle():this.handleInputChange(e)}renderInstructions(){return void 0===this.instructions||this.instructions?"string"==typeof this.instructions?this.instructions:`\nInstructions:\n ${o.arrowUp}/${o.arrowDown}: Highlight option\n ${o.arrowLeft}/${o.arrowRight}/[space]: Toggle selection\n [a,b,c]/delete: Filter choices\n enter/return: Complete answer\n`:""}renderCurrentInput(){return`\nFiltered results for: ${this.inputValue?this.inputValue:e.gray("Enter something to filter")}\n`}renderOption(t,n,r){let i;return i=n.disabled?t===r?e.gray().underline(n.title):e.strikethrough().gray(n.title):t===r?e.cyan().underline(n.title):n.title,(n.selected?e.green(o.radioOn):o.radioOff)+" "+i}renderDoneOrInstructions(){if(this.done)return this.value.filter((e=>e.selected)).map((e=>e.title)).join(", ");const t=[e.gray(this.hint),this.renderInstructions(),this.renderCurrentInput()];return this.filteredOptions.length&&this.filteredOptions[this.cursor].disabled&&t.push(e.yellow(this.warn)),t.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(t.hide),super.render();let n=[i.symbol(this.done,this.aborted),e.bold(this.msg),i.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(n+=e.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1),n+=this.renderOptions(this.filteredOptions),this.out.write(this.clear+n),this.clear=r(n,this.out.columns)}},autocompleteMultiselect}function requireConfirm(){if(hasRequiredConfirm)return confirm;hasRequiredConfirm=1;const e=requireKleur(),t=requirePrompt(),{style:n,clear:r}=requireUtil$3(),{erase:i,cursor:o}=requireSrc$6();return confirm=class extends t{constructor(e={}){super(e),this.msg=e.message,this.value=e.initial,this.initialValue=!!e.initial,this.yesMsg=e.yes||"yes",this.yesOption=e.yesOption||"(Y/n)",this.noMsg=e.no||"no",this.noOption=e.noOption||"(y/N)",this.render()}reset(){this.value=this.initialValue,this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write("\n"),this.close()}submit(){this.value=this.value||!1,this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write("\n"),this.close()}_(e,t){return"y"===e.toLowerCase()?(this.value=!0,this.submit()):"n"===e.toLowerCase()?(this.value=!1,this.submit()):this.bell()}render(){this.closed||(this.firstRender?this.out.write(o.hide):this.out.write(r(this.outputText,this.out.columns)),super.render(),this.outputText=[n.symbol(this.done,this.aborted),e.bold(this.msg),n.delimiter(this.done),this.done?this.value?this.yesMsg:this.noMsg:e.gray(this.initialValue?this.yesOption:this.noOption)].join(" "),this.out.write(i.line+o.to(0)+this.outputText))}}}function requireElements(){return hasRequiredElements?elements:(hasRequiredElements=1,elements={TextPrompt:requireText$1(),SelectPrompt:requireSelect(),TogglePrompt:requireToggle(),DatePrompt:requireDate(),NumberPrompt:requireNumber(),MultiselectPrompt:requireMultiselect(),AutocompletePrompt:requireAutocomplete(),AutocompleteMultiselectPrompt:requireAutocompleteMultiselect(),ConfirmPrompt:requireConfirm()})}function requirePrompts$1(){return hasRequiredPrompts$1||(hasRequiredPrompts$1=1,function(){const e=prompts$2,t=requireElements(),n=e=>e;function r(e,r,i={}){return new Promise(((o,s)=>{const a=new t[e](r),c=i.onAbort||n,l=i.onSubmit||n,u=i.onExit||n;a.on("state",r.onState||n),a.on("submit",(e=>o(l(e)))),a.on("exit",(e=>o(u(e)))),a.on("abort",(e=>s(c(e))))}))}e.text=e=>r("TextPrompt",e),e.password=t=>(t.style="password",e.text(t)),e.invisible=t=>(t.style="invisible",e.text(t)),e.number=e=>r("NumberPrompt",e),e.date=e=>r("DatePrompt",e),e.confirm=e=>r("ConfirmPrompt",e),e.list=e=>{const t=e.separator||",";return r("TextPrompt",e,{onSubmit:e=>e.split(t).map((e=>e.trim()))})},e.toggle=e=>r("TogglePrompt",e),e.select=e=>r("SelectPrompt",e),e.multiselect=e=>{e.choices=[].concat(e.choices||[]);const t=e=>e.filter((e=>e.selected)).map((e=>e.value));return r("MultiselectPrompt",e,{onAbort:t,onSubmit:t})},e.autocompleteMultiselect=e=>{e.choices=[].concat(e.choices||[]);const t=e=>e.filter((e=>e.selected)).map((e=>e.value));return r("AutocompleteMultiselectPrompt",e,{onAbort:t,onSubmit:t})};const i=(e,t)=>Promise.resolve(t.filter((t=>t.title.slice(0,e.length).toLowerCase()===e.toLowerCase())));e.autocomplete=e=>(e.suggest=e.suggest||i,e.choices=[].concat(e.choices||[]),r("AutocompletePrompt",e))}()),prompts$2}function requireLib$e(){if(hasRequiredLib$e)return lib$f;hasRequiredLib$e=1;const e=requirePrompts$1(),t=["suggest","format","onState","validate","onRender","type"],n=()=>{};async function r(o=[],{onSubmit:s=n,onCancel:a=n}={}){const c={},l=r._override||{};let u,d,p,f,_,m;o=[].concat(o);const h=async(e,t,n=!1)=>{if(n||!e.validate||!0===e.validate(t))return e.format?await e.format(t,c):t};for(d of o)if(({name:f,type:_}=d),"function"==typeof _&&(_=await _(u,{...c},d),d.type=_),_){for(let e in d){if(t.includes(e))continue;let n=d[e];d[e]="function"==typeof n?await n(u,{...c},m):n}if(m=d,"string"!=typeof d.message)throw new Error("prompt message is required");if(({name:f,type:_}=d),void 0===e[_])throw new Error(`prompt type (${_}) is not defined`);if(void 0===l[d.name]||(u=await h(d,l[d.name]),void 0===u)){try{u=r._injected?i(r._injected,d.initial):await e[_](d),c[f]=u=await h(d,u,!0),p=await s(d,u,c)}catch(e){p=!await a(d,c)}if(p)return c}else c[f]=u}return c}function i(e,t){const n=e.shift();if(n instanceof Error)throw n;return void 0===n?t:n}return lib$f=Object.assign(r,{prompt:r,prompts:e,inject:function(e){r._injected=(r._injected||[]).concat(e)},override:function(e){r._override=Object.assign({},e)}})}function requirePrompts(){if(hasRequiredPrompts)return prompts$1;return hasRequiredPrompts=1,prompts$1=function(e){e=(Array.isArray(e)?e:e.split(".")).map(Number);let t=0,n=process.versions.node.split(".").map(Number);for(;t<e.length;t++){if(n[t]>e[t])return!1;if(e[t]>n[t])return!0}return!1}("8.6.0")?requireDist$6():requireLib$e(),prompts$1}var promptsExports=requirePrompts(),prompts=getDefaultExportFromCjs(promptsExports),dist$5={},src$5={},hasRequiredSrc$5,hasRequiredDist$5;function requireSrc$5(){return hasRequiredSrc$5||(hasRequiredSrc$5=1,function(e){var t=src$5&&src$5.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0});const n=require$$0$7,r=t(requireSrc$8()).default("@kwsites/file-exists");e.exists=function(t,i=e.READABLE){return function(e,t,i){r("checking %s",e);try{const o=n.statSync(e);return o.isFile()&&t?(r("[OK] path represents a file"),!0):o.isDirectory()&&i?(r("[OK] path represents a directory"),!0):(r("[FAIL] path represents something other than a file or directory"),!1)}catch(e){if("ENOENT"===e.code)return r("[FAIL] path is not accessible: %o",e),!1;throw r("[FATAL] %o",e),e}}(t,(i&e.FILE)>0,(i&e.FOLDER)>0)},e.FILE=1,e.FOLDER=2,e.READABLE=e.FILE+e.FOLDER}(src$5)),src$5}function requireDist$5(){return hasRequiredDist$5||(hasRequiredDist$5=1,e=dist$5,Object.defineProperty(e,"__esModule",{value:!0}),function(t){for(var n in t)e.hasOwnProperty(n)||(e[n]=t[n])}(requireSrc$5())),dist$5;var e}var distExports$2=requireDist$5(),dist$4={},hasRequiredDist$4;function requireDist$4(){if(hasRequiredDist$4)return dist$4;function e(){let e,t,n="pending";return{promise:new Promise(((n,r)=>{e=n,t=r})),done(t){"pending"===n&&(n="resolved",e(t))},fail(e){"pending"===n&&(n="rejected",t(e))},get fulfilled(){return"pending"!==n},get status(){return n}}}return hasRequiredDist$4=1,Object.defineProperty(dist$4,"__esModule",{value:!0}),dist$4.createDeferred=dist$4.deferred=void 0,dist$4.deferred=e,dist$4.createDeferred=e,dist$4.default=e,dist$4}var distExports$1=requireDist$4(),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropNames=Object.getOwnPropertyNames,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,t,n)=>t in e?__defProp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,__spreadValues=(e,t)=>{for(var n in t||(t={}))__hasOwnProp.call(t,n)&&__defNormalProp(e,n,t[n]);if(__getOwnPropSymbols)for(var n of __getOwnPropSymbols(t))__propIsEnum.call(t,n)&&__defNormalProp(e,n,t[n]);return e},__spreadProps=(e,t)=>__defProps(e,__getOwnPropDescs(t)),__esm=(e,t)=>function(){return e&&(t=(0,e[__getOwnPropNames(e)[0]])(e=0)),t},__commonJS=(e,t)=>function(){return t||(0,e[__getOwnPropNames(e)[0]])((t={exports:{}}).exports,t),t.exports},__export=(e,t)=>{for(var n in t)__defProp(e,n,{get:t[n],enumerable:!0})},__copyProps=(e,t,n,r)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let i of __getOwnPropNames(t))__hasOwnProp.call(e,i)||i===n||__defProp(e,i,{get:()=>t[i],enumerable:!(r=__getOwnPropDesc(t,i))||r.enumerable});return e},__toCommonJS=e=>__copyProps(__defProp({},"__esModule",{value:!0}),e),__async=(e,t,n)=>new Promise(((r,i)=>{var o=e=>{try{a(n.next(e))}catch(e){i(e)}},s=e=>{try{a(n.throw(e))}catch(e){i(e)}},a=e=>e.done?r(e.value):Promise.resolve(e.value).then(o,s);a((n=n.apply(e,t)).next())})),cache;function pathspec(...e){const t=new String(e);return cache.set(t,e),t}function isPathSpec(e){return e instanceof String&&cache.has(e)}function toPaths(e){return cache.get(e)||[]}var init_pathspec=__esm({"src/lib/args/pathspec.ts"(){cache=new WeakMap}}),GitError,init_git_error=__esm({"src/lib/errors/git-error.ts"(){GitError=class extends Error{constructor(e,t){super(t),this.task=e,Object.setPrototypeOf(this,new.target.prototype)}}}}),GitResponseError,init_git_response_error=__esm({"src/lib/errors/git-response-error.ts"(){init_git_error(),GitResponseError=class extends GitError{constructor(e,t){super(void 0,t||String(e)),this.git=e}}}}),TaskConfigurationError,init_task_configuration_error=__esm({"src/lib/errors/task-configuration-error.ts"(){init_git_error(),TaskConfigurationError=class extends GitError{constructor(e){super(void 0,e)}}}}),NULL,NOOP$1,objectToString;function asFunction(e){return"function"==typeof e?e:NOOP$1}function isUserFunction(e){return"function"==typeof e&&e!==NOOP$1}function splitOn(e,t){const n=e.indexOf(t);return n<=0?[e,""]:[e.substr(0,n),e.substr(n+1)]}function first(e,t=0){return isArrayLike(e)&&e.length>t?e[t]:void 0}function last(e,t=0){if(isArrayLike(e)&&e.length>t)return e[e.length-1-t]}function isArrayLike(e){return!(!e||"number"!=typeof e.length)}function toLinesWithContent(e="",t=!0,n="\n"){return e.split(n).reduce(((e,n)=>{const r=t?n.trim():n;return r&&e.push(r),e}),[])}function forEachLineWithContent(e,t){return toLinesWithContent(e,!0).map((e=>t(e)))}function folderExists(e){return distExports$2.exists(e,distExports$2.FOLDER)}function append(e,t){return Array.isArray(e)?e.includes(t)||e.push(t):e.add(t),t}function including(e,t){return Array.isArray(e)&&!e.includes(t)&&e.push(t),e}function remove(e,t){if(Array.isArray(e)){const n=e.indexOf(t);n>=0&&e.splice(n,1)}else e.delete(t);return t}function asArray(e){return Array.isArray(e)?e:[e]}function asCamelCase(e){return e.replace(/[\s-]+(.)/g,((e,t)=>t.toUpperCase()))}function asStringArray(e){return asArray(e).map(String)}function asNumber(e,t=0){if(null==e)return t;const n=parseInt(e,10);return isNaN(n)?t:n}function prefixedArray(e,t){const n=[];for(let r=0,i=e.length;r<i;r++)n.push(t,e[r]);return n}function bufferToString(e){return(Array.isArray(e)?Buffer.concat(e):e).toString("utf-8")}function pick(e,t){return Object.assign({},...t.map((t=>t in e?{[t]:e[t]}:{})))}function delay(e=0){return new Promise((t=>setTimeout(t,e)))}function orVoid(e){if(!1!==e)return e}var init_util=__esm({"src/lib/utils/util.ts"(){NULL="\0",NOOP$1=()=>{},objectToString=Object.prototype.toString.call.bind(Object.prototype.toString)}}),filterArray,filterString,filterStringArray,filterStringOrStringArray,filterHasLength;function filterType(e,t,n){return t(e)?e:arguments.length>2?n:void 0}function filterPrimitives(e,t){const n=isPathSpec(e)?"string":typeof e;return/number|string|boolean/.test(n)&&(!t||!t.includes(n))}function filterPlainObject(e){return!!e&&"[object Object]"===objectToString(e)}function filterFunction(e){return"function"==typeof e}var init_argument_filters=__esm({"src/lib/utils/argument-filters.ts"(){init_util(),init_pathspec(),filterArray=e=>Array.isArray(e),filterString=e=>"string"==typeof e,filterStringArray=e=>Array.isArray(e)&&e.every(filterString),filterStringOrStringArray=e=>filterString(e)||Array.isArray(e)&&e.every(filterString),filterHasLength=e=>null!=e&&!"number|boolean|function".includes(typeof e)&&(Array.isArray(e)||"string"==typeof e||"number"==typeof e.length)}}),ExitCodes,init_exit_codes=__esm({"src/lib/utils/exit-codes.ts"(){ExitCodes=(e=>(e[e.SUCCESS=0]="SUCCESS",e[e.ERROR=1]="ERROR",e[e.NOT_FOUND=-2]="NOT_FOUND",e[e.UNCLEAN=128]="UNCLEAN",e))(ExitCodes||{})}}),GitOutputStreams,init_git_output_streams=__esm({"src/lib/utils/git-output-streams.ts"(){GitOutputStreams=class{constructor(e,t){this.stdOut=e,this.stdErr=t}asStrings(){return new GitOutputStreams(this.stdOut.toString("utf8"),this.stdErr.toString("utf8"))}}}}),LineParser,RemoteLineParser,init_line_parser=__esm({"src/lib/utils/line-parser.ts"(){LineParser=class{constructor(e,t){this.matches=[],this.parse=(e,t)=>(this.resetMatches(),!!this._regExp.every(((t,n)=>this.addMatch(t,n,e(n))))&&!1!==this.useMatches(t,this.prepareMatches())),this._regExp=Array.isArray(e)?e:[e],t&&(this.useMatches=t)}useMatches(e,t){throw new Error("LineParser:useMatches not implemented")}resetMatches(){this.matches.length=0}prepareMatches(){return this.matches}addMatch(e,t,n){const r=n&&e.exec(n);return r&&this.pushMatch(t,r),!!r}pushMatch(e,t){this.matches.push(...t.slice(1))}},RemoteLineParser=class extends LineParser{addMatch(e,t,n){return/^remote:\s/.test(String(n))&&super.addMatch(e,t,n)}pushMatch(e,t){(e>0||t.length>1)&&super.pushMatch(e,t)}}}}),defaultOptions;function createInstanceConfig(...e){const t=process.cwd(),n=Object.assign(__spreadValues({baseDir:t},defaultOptions),...e.filter((e=>"object"==typeof e&&e)));return n.baseDir=n.baseDir||t,n.trimmed=!0===n.trimmed,n}var init_simple_git_options=__esm({"src/lib/utils/simple-git-options.ts"(){defaultOptions={binary:"git",maxConcurrentProcesses:5,config:[],trimmed:!1}}});function appendTaskOptions(e,t=[]){return filterPlainObject(e)?Object.keys(e).reduce(((t,n)=>{const r=e[n];return isPathSpec(r)?t.push(r):filterPrimitives(r,["boolean"])?t.push(n+"="+r):t.push(n),t}),t):t}function getTrailingOptions(e,t=0,n=!1){const r=[];for(let n=0,i=t<0?e.length:t;n<i;n++)"string|number".includes(typeof e[n])&&r.push(String(e[n]));return appendTaskOptions(trailingOptionsArgument(e),r),n||r.push(...trailingArrayArgument(e)),r}function trailingArrayArgument(e){const t="function"==typeof last(e);return filterType(last(e,t?1:0),filterArray,[])}function trailingOptionsArgument(e){const t=filterFunction(last(e));return filterType(last(e,t?1:0),filterPlainObject)}function trailingFunctionArgument(e,t=!0){const n=asFunction(last(e));return t||isUserFunction(n)?n:void 0}var init_task_options=__esm({"src/lib/utils/task-options.ts"(){init_argument_filters(),init_util(),init_pathspec()}});function callTaskParser(e,t){return e(t.stdOut,t.stdErr)}function parseStringResponse(e,t,n,r=!0){return asArray(n).forEach((n=>{for(let i=toLinesWithContent(n,r),o=0,s=i.length;o<s;o++){const n=(e=0)=>{if(!(o+e>=s))return i[o+e]};t.some((({parse:t})=>t(n,e)))}})),e}var init_task_parser=__esm({"src/lib/utils/task-parser.ts"(){init_util()}}),utils_exports={};__export(utils_exports,{ExitCodes:()=>ExitCodes,GitOutputStreams:()=>GitOutputStreams,LineParser:()=>LineParser,NOOP:()=>NOOP$1,NULL:()=>NULL,RemoteLineParser:()=>RemoteLineParser,append:()=>append,appendTaskOptions:()=>appendTaskOptions,asArray:()=>asArray,asCamelCase:()=>asCamelCase,asFunction:()=>asFunction,asNumber:()=>asNumber,asStringArray:()=>asStringArray,bufferToString:()=>bufferToString,callTaskParser:()=>callTaskParser,createInstanceConfig:()=>createInstanceConfig,delay:()=>delay,filterArray:()=>filterArray,filterFunction:()=>filterFunction,filterHasLength:()=>filterHasLength,filterPlainObject:()=>filterPlainObject,filterPrimitives:()=>filterPrimitives,filterString:()=>filterString,filterStringArray:()=>filterStringArray,filterStringOrStringArray:()=>filterStringOrStringArray,filterType:()=>filterType,first:()=>first,folderExists:()=>folderExists,forEachLineWithContent:()=>forEachLineWithContent,getTrailingOptions:()=>getTrailingOptions,including:()=>including,isUserFunction:()=>isUserFunction,last:()=>last,objectToString:()=>objectToString,orVoid:()=>orVoid,parseStringResponse:()=>parseStringResponse,pick:()=>pick,prefixedArray:()=>prefixedArray,remove:()=>remove,splitOn:()=>splitOn,toLinesWithContent:()=>toLinesWithContent,trailingFunctionArgument:()=>trailingFunctionArgument,trailingOptionsArgument:()=>trailingOptionsArgument});var init_utils=__esm({"src/lib/utils/index.ts"(){init_argument_filters(),init_exit_codes(),init_git_output_streams(),init_line_parser(),init_simple_git_options(),init_task_options(),init_task_parser(),init_util()}}),check_is_repo_exports={},CheckRepoActions,onError,parser;function checkIsRepoTask(e){switch(e){case"bare":return checkIsBareRepoTask();case"root":return checkIsRepoRootTask()}return{commands:["rev-parse","--is-inside-work-tree"],format:"utf-8",onError:onError,parser:parser}}function checkIsRepoRootTask(){return{commands:["rev-parse","--git-dir"],format:"utf-8",onError:onError,parser:e=>/^\.(git)?$/.test(e.trim())}}function checkIsBareRepoTask(){return{commands:["rev-parse","--is-bare-repository"],format:"utf-8",onError:onError,parser:parser}}function isNotRepoMessage(e){return/(Not a git repository|Kein Git-Repository)/i.test(String(e))}__export(check_is_repo_exports,{CheckRepoActions:()=>CheckRepoActions,checkIsBareRepoTask:()=>checkIsBareRepoTask,checkIsRepoRootTask:()=>checkIsRepoRootTask,checkIsRepoTask:()=>checkIsRepoTask});var init_check_is_repo=__esm({"src/lib/tasks/check-is-repo.ts"(){init_utils(),CheckRepoActions=(e=>(e.BARE="bare",e.IN_TREE="tree",e.IS_REPO_ROOT="root",e))(CheckRepoActions||{}),onError=({exitCode:e},t,n,r)=>{if(128===e&&isNotRepoMessage(t))return n(Buffer.from("false"));r(t)},parser=e=>"true"===e.trim()}}),CleanResponse,removalRegexp,dryRunRemovalRegexp,isFolderRegexp;function cleanSummaryParser(e,t){const n=new CleanResponse(e),r=e?dryRunRemovalRegexp:removalRegexp;return toLinesWithContent(t).forEach((e=>{const t=e.replace(r,"");n.paths.push(t),(isFolderRegexp.test(t)?n.folders:n.files).push(t)})),n}var init_CleanSummary=__esm({"src/lib/responses/CleanSummary.ts"(){init_utils(),CleanResponse=class{constructor(e){this.dryRun=e,this.paths=[],this.files=[],this.folders=[]}},removalRegexp=/^[a-z]+\s*/i,dryRunRemovalRegexp=/^[a-z]+\s+[a-z]+\s*/i,isFolderRegexp=/\/$/}}),task_exports={},EMPTY_COMMANDS;function adhocExecTask(e){return{commands:EMPTY_COMMANDS,format:"empty",parser:e}}function configurationErrorTask(e){return{commands:EMPTY_COMMANDS,format:"empty",parser(){throw"string"==typeof e?new TaskConfigurationError(e):e}}}function straightThroughStringTask(e,t=!1){return{commands:e,format:"utf-8",parser:e=>t?String(e).trim():e}}function straightThroughBufferTask(e){return{commands:e,format:"buffer",parser:e=>e}}function isBufferTask(e){return"buffer"===e.format}function isEmptyTask(e){return"empty"===e.format||!e.commands.length}__export(task_exports,{EMPTY_COMMANDS:()=>EMPTY_COMMANDS,adhocExecTask:()=>adhocExecTask,configurationErrorTask:()=>configurationErrorTask,isBufferTask:()=>isBufferTask,isEmptyTask:()=>isEmptyTask,straightThroughBufferTask:()=>straightThroughBufferTask,straightThroughStringTask:()=>straightThroughStringTask});var init_task=__esm({"src/lib/tasks/task.ts"(){init_task_configuration_error(),EMPTY_COMMANDS=[]}}),clean_exports={},CONFIG_ERROR_INTERACTIVE_MODE,CONFIG_ERROR_MODE_REQUIRED,CONFIG_ERROR_UNKNOWN_OPTION,CleanOptions,CleanOptionValues;function cleanWithOptionsTask(e,t){const{cleanMode:n,options:r,valid:i}=getCleanOptions(e);return n?i.options?(r.push(...t),r.some(isInteractiveMode)?configurationErrorTask(CONFIG_ERROR_INTERACTIVE_MODE):cleanTask(n,r)):configurationErrorTask(CONFIG_ERROR_UNKNOWN_OPTION+JSON.stringify(e)):configurationErrorTask(CONFIG_ERROR_MODE_REQUIRED)}function cleanTask(e,t){return{commands:["clean",`-${e}`,...t],format:"utf-8",parser:t=>cleanSummaryParser("n"===e,t)}}function isCleanOptionsArray(e){return Array.isArray(e)&&e.every((e=>CleanOptionValues.has(e)))}function getCleanOptions(e){let t,n=[],r={cleanMode:!1,options:!0};return e.replace(/[^a-z]i/g,"").split("").forEach((e=>{isCleanMode(e)?(t=e,r.cleanMode=!0):r.options=r.options&&isKnownOption(n[n.length]=`-${e}`)})),{cleanMode:t,options:n,valid:r}}function isCleanMode(e){return"f"===e||"n"===e}function isKnownOption(e){return/^-[a-z]$/i.test(e)&&CleanOptionValues.has(e.charAt(1))}function isInteractiveMode(e){return/^-[^\-]/.test(e)?e.indexOf("i")>0:"--interactive"===e}__export(clean_exports,{CONFIG_ERROR_INTERACTIVE_MODE:()=>CONFIG_ERROR_INTERACTIVE_MODE,CONFIG_ERROR_MODE_REQUIRED:()=>CONFIG_ERROR_MODE_REQUIRED,CONFIG_ERROR_UNKNOWN_OPTION:()=>CONFIG_ERROR_UNKNOWN_OPTION,CleanOptions:()=>CleanOptions,cleanTask:()=>cleanTask,cleanWithOptionsTask:()=>cleanWithOptionsTask,isCleanOptionsArray:()=>isCleanOptionsArray});var init_clean=__esm({"src/lib/tasks/clean.ts"(){init_CleanSummary(),init_utils(),init_task(),CONFIG_ERROR_INTERACTIVE_MODE="Git clean interactive mode is not supported",CONFIG_ERROR_MODE_REQUIRED='Git clean mode parameter ("n" or "f") is required',CONFIG_ERROR_UNKNOWN_OPTION="Git clean unknown option found in: ",CleanOptions=(e=>(e.DRY_RUN="n",e.FORCE="f",e.IGNORED_INCLUDED="x",e.IGNORED_ONLY="X",e.EXCLUDING="e",e.QUIET="q",e.RECURSIVE="d",e))(CleanOptions||{}),CleanOptionValues=new Set(["i",...asStringArray(Object.values(CleanOptions))])}}),ConfigList;function configListParser(e){const t=new ConfigList;for(const n of configParser(e))t.addValue(n.file,String(n.key),n.value);return t}function configGetParser(e,t){let n=null;const r=[],i=new Map;for(const o of configParser(e,t))o.key===t&&(r.push(n=o.value),i.has(o.file)||i.set(o.file,[]),i.get(o.file).push(n));return{key:t,paths:Array.from(i.keys()),scopes:i,value:n,values:r}}function configFilePath(e){return e.replace(/^(file):/,"")}function*configParser(e,t=null){const n=e.split("\0");for(let e=0,r=n.length-1;e<r;){const r=configFilePath(n[e++]);let i=n[e++],o=t;if(i.includes("\n")){const e=splitOn(i,"\n");o=e[0],i=e[1]}yield{file:r,key:o,value:i}}}var init_ConfigList=__esm({"src/lib/responses/ConfigList.ts"(){init_utils(),ConfigList=class{constructor(){this.files=[],this.values=Object.create(null)}get all(){return this._all||(this._all=this.files.reduce(((e,t)=>Object.assign(e,this.values[t])),{})),this._all}addFile(e){if(!(e in this.values)){const t=last(this.files);this.values[e]=t?Object.create(this.values[t]):{},this.files.push(e)}return this.values[e]}addValue(e,t,n){const r=this.addFile(e);r.hasOwnProperty(t)?Array.isArray(r[t])?r[t].push(n):r[t]=[r[t],n]:r[t]=n,this._all=void 0}}}}),GitConfigScope;function asConfigScope(e,t){return"string"==typeof e&&GitConfigScope.hasOwnProperty(e)?e:t}function addConfigTask(e,t,n,r){const i=["config",`--${r}`];return n&&i.push("--add"),i.push(e,t),{commands:i,format:"utf-8",parser:e=>e}}function getConfigTask(e,t){const n=["config","--null","--show-origin","--get-all",e];return t&&n.splice(1,0,`--${t}`),{commands:n,format:"utf-8",parser:t=>configGetParser(t,e)}}function listConfigTask(e){const t=["config","--list","--show-origin","--null"];return e&&t.push(`--${e}`),{commands:t,format:"utf-8",parser:e=>configListParser(e)}}function config_default(){return{addConfig(e,t,...n){return this._runTask(addConfigTask(e,t,!0===n[0],asConfigScope(n[1],"local")),trailingFunctionArgument(arguments))},getConfig(e,t){return this._runTask(getConfigTask(e,asConfigScope(t,void 0)),trailingFunctionArgument(arguments))},listConfig(...e){return this._runTask(listConfigTask(asConfigScope(e[0],void 0)),trailingFunctionArgument(arguments))}}}var init_config=__esm({"src/lib/tasks/config.ts"(){init_ConfigList(),init_utils(),GitConfigScope=(e=>(e.system="system",e.global="global",e.local="local",e.worktree="worktree",e))(GitConfigScope||{})}}),DiffNameStatus,diffNameStatus;function isDiffNameStatus(e){return diffNameStatus.has(e)}var init_diff_name_status=__esm({"src/lib/tasks/diff-name-status.ts"(){DiffNameStatus=(e=>(e.ADDED="A",e.COPIED="C",e.DELETED="D",e.MODIFIED="M",e.RENAMED="R",e.CHANGED="T",e.UNMERGED="U",e.UNKNOWN="X",e.BROKEN="B",e))(DiffNameStatus||{}),diffNameStatus=new Set(Object.values(DiffNameStatus))}}),disallowedOptions,Query,_a,GrepQuery;function grepQueryBuilder(...e){return(new GrepQuery).param(...e)}function parseGrep(e){const t=new Set,n={};return forEachLineWithContent(e,(e=>{const[r,i,o]=e.split(NULL);t.add(r),(n[r]=n[r]||[]).push({line:asNumber(i),path:r,preview:o})})),{paths:t,results:n}}function grep_default(){return{grep(e){const t=trailingFunctionArgument(arguments),n=getTrailingOptions(arguments);for(const e of disallowedOptions)if(n.includes(e))return this._runTask(configurationErrorTask(`git.grep: use of "${e}" is not supported.`),t);"string"==typeof e&&(e=grepQueryBuilder().param(e));const r=["grep","--null","-n","--full-name",...n,...e];return this._runTask({commands:r,format:"utf-8",parser:e=>parseGrep(e)},t)}}}var init_grep=__esm({"src/lib/tasks/grep.ts"(){init_utils(),init_task(),disallowedOptions=["-h"],Query=Symbol("grepQuery"),GrepQuery=class{constructor(){this[_a]=[]}*[(_a=Query,Symbol.iterator)](){for(const e of this[Query])yield e}and(...e){return e.length&&this[Query].push("--and","(",...prefixedArray(e,"-e"),")"),this}param(...e){return this[Query].push(...prefixedArray(e,"-e")),this}}}}),reset_exports={},ResetMode,ResetModes;function resetTask(e,t){const n=["reset"];return isValidResetMode(e)&&n.push(`--${e}`),n.push(...t),straightThroughStringTask(n)}function getResetMode(e){if(isValidResetMode(e))return e;switch(typeof e){case"string":case"undefined":return"soft"}}function isValidResetMode(e){return ResetModes.includes(e)}__export(reset_exports,{ResetMode:()=>ResetMode,getResetMode:()=>getResetMode,resetTask:()=>resetTask});var init_reset=__esm({"src/lib/tasks/reset.ts"(){init_task(),ResetMode=(e=>(e.MIXED="mixed",e.SOFT="soft",e.HARD="hard",e.MERGE="merge",e.KEEP="keep",e))(ResetMode||{}),ResetModes=Array.from(Object.values(ResetMode))}});function createLog(){return debugModule("simple-git")}function prefixedLogger(e,t,n){return t&&String(t).replace(/\s*/,"")?(r,...i)=>{e(`%s ${r}`,t,...i),n&&n(r,...i)}:n?(t,...r)=>{e(t,...r),n(t,...r)}:e}function childLoggerName(e,t,{namespace:n}){if("string"==typeof e)return e;const r=t&&t.namespace||"";return r.startsWith(n)?r.substr(n.length+1):r||n}function createLogger(e,t,n,r=createLog()){const i=e&&`[${e}]`||"",o=[],s="string"==typeof t?r.extend(t):t,a=childLoggerName(filterType(t,filterString),s,r);return function t(n){const o=n&&`[${n}]`||"",a=s&&prefixedLogger(s,o)||NOOP$1,l=prefixedLogger(r,`${i} ${o}`,a);return Object.assign(s?a:l,{label:e,sibling:c,info:l,step:t})}(n);function c(t,n){return append(o,createLogger(e,a.replace(/^[^:]+/,t),n,r))}}var init_git_logger=__esm({"src/lib/git-logger.ts"(){init_utils(),debugModule.formatters.L=e=>String(filterHasLength(e)?e.length:"-"),debugModule.formatters.B=e=>Buffer.isBuffer(e)?e.toString("utf8"):objectToString(e)}}),_TasksPendingQueue,TasksPendingQueue,init_tasks_pending_queue=__esm({"src/lib/runners/tasks-pending-queue.ts"(){init_git_error(),init_git_logger(),_TasksPendingQueue=class{constructor(e="GitExecutor"){this.logLabel=e,this._queue=new Map}withProgress(e){return this._queue.get(e)}createProgress(e){const t=_TasksPendingQueue.getName(e.commands[0]);return{task:e,logger:createLogger(this.logLabel,t),name:t}}push(e){const t=this.createProgress(e);return t.logger("Adding task to the queue, commands = %o",e.commands),this._queue.set(e,t),t}fatal(e){for(const[t,{logger:n}]of Array.from(this._queue.entries()))t===e.task?(n.info("Failed %o",e),n("Fatal exception, any as-yet un-started tasks run through this executor will not be attempted")):n.info("A fatal exception occurred in a previous task, the queue has been purged: %o",e.message),this.complete(t);if(0!==this._queue.size)throw new Error(`Queue size should be zero after fatal: ${this._queue.size}`)}complete(e){this.withProgress(e)&&this._queue.delete(e)}attempt(e){const t=this.withProgress(e);if(!t)throw new GitError(void 0,"TasksPendingQueue: attempt called for an unknown task");return t.logger("Starting task"),t}static getName(e="empty"){return`task:${e}:${++_TasksPendingQueue.counter}`}},(TasksPendingQueue=_TasksPendingQueue).counter=0}}),GitExecutorChain;function pluginContext(e,t){return{method:first(e.commands)||"",commands:t}}function onErrorReceived(e,t){return n=>{t("[ERROR] child process exception %o",n),e.push(Buffer.from(String(n.stack),"ascii"))}}function onDataReceived(e,t,n,r){return i=>{n("%s received %L bytes",t,i),r("%B",i),e.push(i)}}var init_git_executor_chain=__esm({"src/lib/runners/git-executor-chain.ts"(){init_git_error(),init_task(),init_utils(),init_tasks_pending_queue(),GitExecutorChain=class{constructor(e,t,n){this._executor=e,this._scheduler=t,this._plugins=n,this._chain=Promise.resolve(),this._queue=new TasksPendingQueue}get cwd(){return this._cwd||this._executor.cwd}set cwd(e){this._cwd=e}get env(){return this._executor.env}get outputHandler(){return this._executor.outputHandler}chain(){return this}push(e){return this._queue.push(e),this._chain=this._chain.then((()=>this.attemptTask(e)))}attemptTask(e){return __async(this,null,(function*(){const t=yield this._scheduler.next(),n=()=>this._queue.complete(e);try{const{logger:t}=this._queue.attempt(e);return yield isEmptyTask(e)?this.attemptEmptyTask(e,t):this.attemptRemoteTask(e,t)}catch(t){throw this.onFatalException(e,t)}finally{n(),t()}}))}onFatalException(e,t){const n=t instanceof GitError?Object.assign(t,{task:e}):new GitError(e,t&&String(t));return this._chain=Promise.resolve(),this._queue.fatal(n),n}attemptRemoteTask(e,t){return __async(this,null,(function*(){const n=this._plugins.exec("spawn.binary","",pluginContext(e,e.commands)),r=this._plugins.exec("spawn.args",[...e.commands],pluginContext(e,e.commands)),i=yield this.gitResponse(e,n,r,this.outputHandler,t.step("SPAWN")),o=yield this.handleTaskData(e,r,i,t.step("HANDLE"));return t("passing response to task's parser as a %s",e.format),isBufferTask(e)?callTaskParser(e.parser,o):callTaskParser(e.parser,o.asStrings())}))}attemptEmptyTask(e,t){return __async(this,null,(function*(){return t("empty task bypassing child process to call to task's parser"),e.parser(this)}))}handleTaskData(e,t,n,r){const{exitCode:i,rejection:o,stdOut:s,stdErr:a}=n;return new Promise(((c,l)=>{r("Preparing to handle process response exitCode=%d stdOut=",i);const{error:u}=this._plugins.exec("task.error",{error:o},__spreadValues(__spreadValues({},pluginContext(e,t)),n));return u&&e.onError?(r.info("exitCode=%s handling with custom error handler"),e.onError(n,u,(e=>{r.info("custom error handler treated as success"),r("custom error returned a %s",objectToString(e)),c(new GitOutputStreams(Array.isArray(e)?Buffer.concat(e):e,Buffer.concat(a)))}),l)):u?(r.info("handling as error: exitCode=%s stdErr=%s rejection=%o",i,a.length,o),l(u)):(r.info("retrieving task output complete"),void c(new GitOutputStreams(Buffer.concat(s),Buffer.concat(a))))}))}gitResponse(e,t,n,r,i){return __async(this,null,(function*(){const o=i.sibling("output"),s=this._plugins.exec("spawn.options",{cwd:this.cwd,env:this.env,windowsHide:!0},pluginContext(e,e.commands));return new Promise((a=>{const c=[],l=[];i.info("%s %o",t,n),i("%O",s);let u=this._beforeSpawn(e,n);if(u)return a({stdOut:c,stdErr:l,exitCode:9901,rejection:u});this._plugins.exec("spawn.before",void 0,__spreadProps(__spreadValues({},pluginContext(e,n)),{kill(e){u=e||u}}));const d=spawn(t,n,s);d.stdout.on("data",onDataReceived(c,"stdOut",i,o.step("stdOut"))),d.stderr.on("data",onDataReceived(l,"stdErr",i,o.step("stdErr"))),d.on("error",onErrorReceived(l,i)),r&&(i("Passing child process stdOut/stdErr to custom outputHandler"),r(t,d.stdout,d.stderr,[...n])),this._plugins.exec("spawn.after",void 0,__spreadProps(__spreadValues({},pluginContext(e,n)),{spawned:d,close(e,t){a({stdOut:c,stdErr:l,exitCode:e,rejection:u||t})},kill(e){d.killed||(u=e,d.kill("SIGINT"))}}))}))}))}_beforeSpawn(e,t){let n;return this._plugins.exec("spawn.before",void 0,__spreadProps(__spreadValues({},pluginContext(e,t)),{kill(e){n=e||n}})),n}}}}),git_executor_exports={},GitExecutor;__export(git_executor_exports,{GitExecutor:()=>GitExecutor});var init_git_executor=__esm({"src/lib/runners/git-executor.ts"(){init_git_executor_chain(),GitExecutor=class{constructor(e,t,n){this.cwd=e,this._scheduler=t,this._plugins=n,this._chain=new GitExecutorChain(this,this._scheduler,this._plugins)}chain(){return new GitExecutorChain(this,this._scheduler,this._plugins)}push(e){return this._chain.push(e)}}}});function taskCallback(e,t,n=NOOP$1){t.then((e=>{n(null,e)}),(t=>{(null==t?void 0:t.task)===e&&n(t instanceof GitResponseError?addDeprecationNoticeToError(t):t,void 0)}))}function addDeprecationNoticeToError(e){let t=e=>{console.warn(`simple-git deprecation notice: accessing GitResponseError.${e} should be GitResponseError.git.${e}, this will no longer be available in version 3`),t=NOOP$1};return Object.create(e,Object.getOwnPropertyNames(e.git).reduce((function(n,r){if(r in e)return n;return n[r]={enumerable:!1,configurable:!1,get:()=>(t(r),e.git[r])},n}),{}))}var init_task_callback=__esm({"src/lib/task-callback.ts"(){init_git_response_error(),init_utils()}});function changeWorkingDirectoryTask(e,t){return adhocExecTask((n=>{if(!folderExists(e))throw new Error(`Git.cwd: cannot change to non-directory "${e}"`);return(t||n).cwd=e}))}var init_change_working_directory=__esm({"src/lib/tasks/change-working-directory.ts"(){init_utils(),init_task()}});function checkoutTask(e){const t=["checkout",...e];return"-b"===t[1]&&t.includes("-B")&&(t[1]=remove(t,"-B")),straightThroughStringTask(t)}function checkout_default(){return{checkout(){return this._runTask(checkoutTask(getTrailingOptions(arguments,1)),trailingFunctionArgument(arguments))},checkoutBranch(e,t){return this._runTask(checkoutTask(["-b",e,t,...getTrailingOptions(arguments)]),trailingFunctionArgument(arguments))},checkoutLocalBranch(e){return this._runTask(checkoutTask(["-b",e,...getTrailingOptions(arguments)]),trailingFunctionArgument(arguments))}}}var init_checkout=__esm({"src/lib/tasks/checkout.ts"(){init_utils(),init_task()}}),parser2;function countObjectsResponse(){return{count:0,garbage:0,inPack:0,packs:0,prunePackable:0,size:0,sizeGarbage:0,sizePack:0}}function count_objects_default(){return{countObjects(){return this._runTask({commands:["count-objects","--verbose"],format:"utf-8",parser:e=>parseStringResponse(countObjectsResponse(),[parser2],e)})}}}var init_count_objects=__esm({"src/lib/tasks/count-objects.ts"(){init_utils(),parser2=new LineParser(/([a-z-]+): (\d+)$/,((e,[t,n])=>{const r=asCamelCase(t);e.hasOwnProperty(r)&&(e[r]=asNumber(n))}))}}),parsers;function parseCommitResult(e){return parseStringResponse({author:null,branch:"",commit:"",root:!1,summary:{changes:0,insertions:0,deletions:0}},parsers,e)}var init_parse_commit=__esm({"src/lib/parsers/parse-commit.ts"(){init_utils(),parsers=[new LineParser(/^\[([^\s]+)( \([^)]+\))? ([^\]]+)/,((e,[t,n,r])=>{e.branch=t,e.commit=r,e.root=!!n})),new LineParser(/\s*Author:\s(.+)/i,((e,[t])=>{const n=t.split("<"),r=n.pop();r&&r.includes("@")&&(e.author={email:r.substr(0,r.length-1),name:n.join("<").trim()})})),new LineParser(/(\d+)[^,]*(?:,\s*(\d+)[^,]*)(?:,\s*(\d+))/g,((e,[t,n,r])=>{e.summary.changes=parseInt(t,10)||0,e.summary.insertions=parseInt(n,10)||0,e.summary.deletions=parseInt(r,10)||0})),new LineParser(/^(\d+)[^,]*(?:,\s*(\d+)[^(]+\(([+-]))?/,((e,[t,n,r])=>{e.summary.changes=parseInt(t,10)||0;const i=parseInt(n,10)||0;"-"===r?e.summary.deletions=i:"+"===r&&(e.summary.insertions=i)}))]}});function commitTask(e,t,n){return{commands:["-c","core.abbrev=40","commit",...prefixedArray(e,"-m"),...t,...n],format:"utf-8",parser:parseCommitResult}}function commit_default(){return{commit(e,...t){const n=trailingFunctionArgument(arguments),r=function(e){return!filterStringOrStringArray(e)&&configurationErrorTask("git.commit: requires the commit message to be supplied as a string/string[]")}(e)||commitTask(asArray(e),asArray(filterType(t[0],filterStringOrStringArray,[])),[...filterType(t[1],filterArray,[]),...getTrailingOptions(arguments,0,!0)]);return this._runTask(r,n)}}}var init_commit=__esm({"src/lib/tasks/commit.ts"(){init_parse_commit(),init_utils(),init_task()}});function first_commit_default(){return{firstCommit(){return this._runTask(straightThroughStringTask(["rev-list","--max-parents=0","HEAD"],!0),trailingFunctionArgument(arguments))}}}var init_first_commit=__esm({"src/lib/tasks/first-commit.ts"(){init_utils(),init_task()}});function hashObjectTask(e,t){const n=["hash-object",e];return t&&n.push("-w"),straightThroughStringTask(n,!0)}var init_hash_object=__esm({"src/lib/tasks/hash-object.ts"(){init_task()}}),InitSummary,initResponseRegex,reInitResponseRegex;function parseInit(e,t,n){const r=String(n).trim();let i;if(i=initResponseRegex.exec(r))return new InitSummary(e,t,!1,i[1]);if(i=reInitResponseRegex.exec(r))return new InitSummary(e,t,!0,i[1]);let o="";const s=r.split(" ");for(;s.length;){if("in"===s.shift()){o=s.join(" ");break}}return new InitSummary(e,t,/^re/i.test(r),o)}var init_InitSummary=__esm({"src/lib/responses/InitSummary.ts"(){InitSummary=class{constructor(e,t,n,r){this.bare=e,this.path=t,this.existing=n,this.gitDir=r}},initResponseRegex=/^Init.+ repository in (.+)$/,reInitResponseRegex=/^Rein.+ in (.+)$/}}),bareCommand;function hasBareCommand(e){return e.includes(bareCommand)}function initTask(e=!1,t,n){const r=["init",...n];return e&&!hasBareCommand(r)&&r.splice(1,0,bareCommand),{commands:r,format:"utf-8",parser:e=>parseInit(r.includes("--bare"),t,e)}}var init_init=__esm({"src/lib/tasks/init.ts"(){init_InitSummary(),bareCommand="--bare"}}),logFormatRegex;function logFormatFromCommand(e){for(let t=0;t<e.length;t++){const n=logFormatRegex.exec(e[t]);if(n)return`--${n[1]}`}return""}function isLogFormat(e){return logFormatRegex.test(e)}var init_log_format=__esm({"src/lib/args/log-format.ts"(){logFormatRegex=/^--(stat|numstat|name-only|name-status)(=|$)/}}),DiffSummary,init_DiffSummary=__esm({"src/lib/responses/DiffSummary.ts"(){DiffSummary=class{constructor(){this.changed=0,this.deletions=0,this.insertions=0,this.files=[]}}}}),statParser,numStatParser,nameOnlyParser,nameStatusParser,diffSummaryParsers;function getDiffParser(e=""){const t=diffSummaryParsers[e];return e=>parseStringResponse(new DiffSummary,t,e,!1)}var init_parse_diff_summary=__esm({"src/lib/parsers/parse-diff-summary.ts"(){init_log_format(),init_DiffSummary(),init_diff_name_status(),init_utils(),statParser=[new LineParser(/^(.+)\s+\|\s+(\d+)(\s+[+\-]+)?$/,((e,[t,n,r=""])=>{e.files.push({file:t.trim(),changes:asNumber(n),insertions:r.replace(/[^+]/g,"").length,deletions:r.replace(/[^-]/g,"").length,binary:!1})})),new LineParser(/^(.+) \|\s+Bin ([0-9.]+) -> ([0-9.]+) ([a-z]+)/,((e,[t,n,r])=>{e.files.push({file:t.trim(),before:asNumber(n),after:asNumber(r),binary:!0})})),new LineParser(/(\d+) files? changed\s*((?:, \d+ [^,]+){0,2})/,((e,[t,n])=>{const r=/(\d+) i/.exec(n),i=/(\d+) d/.exec(n);e.changed=asNumber(t),e.insertions=asNumber(null==r?void 0:r[1]),e.deletions=asNumber(null==i?void 0:i[1])}))],numStatParser=[new LineParser(/(\d+)\t(\d+)\t(.+)$/,((e,[t,n,r])=>{const i=asNumber(t),o=asNumber(n);e.changed++,e.insertions+=i,e.deletions+=o,e.files.push({file:r,changes:i+o,insertions:i,deletions:o,binary:!1})})),new LineParser(/-\t-\t(.+)$/,((e,[t])=>{e.changed++,e.files.push({file:t,after:0,before:0,binary:!0})}))],nameOnlyParser=[new LineParser(/(.+)$/,((e,[t])=>{e.changed++,e.files.push({file:t,changes:0,insertions:0,deletions:0,binary:!1})}))],nameStatusParser=[new LineParser(/([ACDMRTUXB])([0-9]{0,3})\t(.[^\t]*)(\t(.[^\t]*))?$/,((e,[t,n,r,i,o])=>{e.changed++,e.files.push({file:null!=o?o:r,changes:0,insertions:0,deletions:0,binary:!1,status:orVoid(isDiffNameStatus(t)&&t),from:orVoid(!!o&&r!==o&&r),similarity:asNumber(n)})}))],diffSummaryParsers={"":statParser,"--stat":statParser,"--numstat":numStatParser,"--name-status":nameStatusParser,"--name-only":nameOnlyParser}}}),START_BOUNDARY,COMMIT_BOUNDARY,SPLITTER,defaultFieldNames;function lineBuilder(e,t){return t.reduce(((t,n,r)=>(t[n]=e[r]||"",t)),Object.create({diff:null}))}function createListLogSummaryParser(e=SPLITTER,t=defaultFieldNames,n=""){const r=getDiffParser(n);return function(n){const i=toLinesWithContent(n.trim(),!1,START_BOUNDARY).map((function(n){const i=n.split(COMMIT_BOUNDARY),o=lineBuilder(i[0].split(e),t);return i.length>1&&i[1].trim()&&(o.diff=r(i[1])),o}));return{all:i,latest:i.length&&i[0]||null,total:i.length}}}var init_parse_list_log_summary=__esm({"src/lib/parsers/parse-list-log-summary.ts"(){init_utils(),init_parse_diff_summary(),init_log_format(),START_BOUNDARY="òòòòòò ",COMMIT_BOUNDARY=" òò",SPLITTER=" ò ",defaultFieldNames=["hash","date","message","refs","author_name","author_email"]}}),diff_exports={};function diffSummaryTask(e){let t=logFormatFromCommand(e);const n=["diff"];return""===t&&(t="--stat",n.push("--stat=4096")),n.push(...e),validateLogFormatConfig(n)||{commands:n,format:"utf-8",parser:getDiffParser(t)}}function validateLogFormatConfig(e){const t=e.filter(isLogFormat);return t.length>1?configurationErrorTask(`Summary flags are mutually exclusive - pick one of ${t.join(",")}`):t.length&&e.includes("-z")?configurationErrorTask(`Summary flag ${t} parsing is not compatible with null termination option '-z'`):void 0}__export(diff_exports,{diffSummaryTask:()=>diffSummaryTask,validateLogFormatConfig:()=>validateLogFormatConfig});var init_diff=__esm({"src/lib/tasks/diff.ts"(){init_log_format(),init_parse_diff_summary(),init_task()}}),excludeOptions;function prettyFormat(e,t){const n=[],r=[];return Object.keys(e).forEach((t=>{n.push(t),r.push(String(e[t]))})),[n,r.join(t)]}function userOptions(e){return Object.keys(e).reduce(((t,n)=>(n in excludeOptions||(t[n]=e[n]),t)),{})}function parseLogOptions(e={},t=[]){const n=filterType(e.splitter,filterString,SPLITTER),r=!filterPrimitives(e.format)&&e.format?e.format:{hash:"%H",date:!1===e.strictDate?"%ai":"%aI",message:"%s",refs:"%D",body:e.multiLine?"%B":"%b",author_name:!1!==e.mailMap?"%aN":"%an",author_email:!1!==e.mailMap?"%aE":"%ae"},[i,o]=prettyFormat(r,n),s=[],a=[`--pretty=format:${START_BOUNDARY}${o}${COMMIT_BOUNDARY}`,...t],c=e.n||e["max-count"]||e.maxCount;if(c&&a.push(`--max-count=${c}`),e.from||e.to){const t=!1!==e.symmetric?"...":"..";s.push(`${e.from||""}${t}${e.to||""}`)}return filterString(e.file)&&a.push("--follow",pathspec(e.file)),appendTaskOptions(userOptions(e),a),{fields:i,splitter:n,commands:[...a,...s]}}function logTask(e,t,n){const r=createListLogSummaryParser(e,t,logFormatFromCommand(n));return{commands:["log",...n],format:"utf-8",parser:r}}function log_default(){return{log(...e){const t=trailingFunctionArgument(arguments),n=parseLogOptions(trailingOptionsArgument(arguments),filterType(arguments[0],filterArray)),r=function(e,t){return filterString(e)&&filterString(t)&&configurationErrorTask("git.log(string, string) should be replaced with git.log({ from: string, to: string })")}(...e)||validateLogFormatConfig(n.commands)||function(e){return logTask(e.splitter,e.fields,e.commands)}(n);return this._runTask(r,t)}}}var init_log=__esm({"src/lib/tasks/log.ts"(){init_log_format(),init_pathspec(),init_parse_list_log_summary(),init_utils(),init_task(),init_diff(),excludeOptions=(e=>(e[e["--pretty"]=0]="--pretty",e[e["max-count"]=1]="max-count",e[e.maxCount=2]="maxCount",e[e.n=3]="n",e[e.file=4]="file",e[e.format=5]="format",e[e.from=6]="from",e[e.to=7]="to",e[e.splitter=8]="splitter",e[e.symmetric=9]="symmetric",e[e.mailMap=10]="mailMap",e[e.multiLine=11]="multiLine",e[e.strictDate=12]="strictDate",e))(excludeOptions||{})}}),MergeSummaryConflict,MergeSummaryDetail,init_MergeSummary=__esm({"src/lib/responses/MergeSummary.ts"(){MergeSummaryConflict=class{constructor(e,t=null,n){this.reason=e,this.file=t,this.meta=n}toString(){return`${this.file}:${this.reason}`}},MergeSummaryDetail=class{constructor(){this.conflicts=[],this.merges=[],this.result="success"}get failed(){return this.conflicts.length>0}get reason(){return this.result}toString(){return this.conflicts.length?`CONFLICTS: ${this.conflicts.join(", ")}`:"OK"}}}}),PullSummary,PullFailedSummary,init_PullSummary=__esm({"src/lib/responses/PullSummary.ts"(){PullSummary=class{constructor(){this.remoteMessages={all:[]},this.created=[],this.deleted=[],this.files=[],this.deletions={},this.insertions={},this.summary={changes:0,deletions:0,insertions:0}}},PullFailedSummary=class{constructor(){this.remote="",this.hash={local:"",remote:""},this.branch={local:"",remote:""},this.message=""}toString(){return this.message}}}}),remoteMessagesObjectParsers;function objectEnumerationResult(e){return e.objects=e.objects||{compressing:0,counting:0,enumerating:0,packReused:0,reused:{count:0,delta:0},total:{count:0,delta:0}}}function asObjectCount(e){const t=/^\s*(\d+)/.exec(e),n=/delta (\d+)/i.exec(e);return{count:asNumber(t&&t[1]||"0"),delta:asNumber(n&&n[1]||"0")}}var init_parse_remote_objects=__esm({"src/lib/parsers/parse-remote-objects.ts"(){init_utils(),remoteMessagesObjectParsers=[new RemoteLineParser(/^remote:\s*(enumerating|counting|compressing) objects: (\d+),/i,((e,[t,n])=>{const r=t.toLowerCase(),i=objectEnumerationResult(e.remoteMessages);Object.assign(i,{[r]:asNumber(n)})})),new RemoteLineParser(/^remote:\s*(enumerating|counting|compressing) objects: \d+% \(\d+\/(\d+)\),/i,((e,[t,n])=>{const r=t.toLowerCase(),i=objectEnumerationResult(e.remoteMessages);Object.assign(i,{[r]:asNumber(n)})})),new RemoteLineParser(/total ([^,]+), reused ([^,]+), pack-reused (\d+)/i,((e,[t,n,r])=>{const i=objectEnumerationResult(e.remoteMessages);i.total=asObjectCount(t),i.reused=asObjectCount(n),i.packReused=asNumber(r)}))]}}),parsers2,RemoteMessageSummary;function parseRemoteMessages(e,t){return parseStringResponse({remoteMessages:new RemoteMessageSummary},parsers2,t)}var init_parse_remote_messages=__esm({"src/lib/parsers/parse-remote-messages.ts"(){init_utils(),init_parse_remote_objects(),parsers2=[new RemoteLineParser(/^remote:\s*(.+)$/,((e,[t])=>(e.remoteMessages.all.push(t.trim()),!1))),...remoteMessagesObjectParsers,new RemoteLineParser([/create a (?:pull|merge) request/i,/\s(https?:\/\/\S+)$/],((e,[t])=>{e.remoteMessages.pullRequestUrl=t})),new RemoteLineParser([/found (\d+) vulnerabilities.+\(([^)]+)\)/i,/\s(https?:\/\/\S+)$/],((e,[t,n,r])=>{e.remoteMessages.vulnerabilities={count:asNumber(t),summary:n,url:r}}))],RemoteMessageSummary=class{constructor(){this.all=[]}}}}),FILE_UPDATE_REGEX,SUMMARY_REGEX,ACTION_REGEX,parsers3,errorParsers,parsePullDetail,parsePullResult;function parsePullErrorResult(e,t){const n=parseStringResponse(new PullFailedSummary,errorParsers,[e,t]);return n.message&&n}var init_parse_pull=__esm({"src/lib/parsers/parse-pull.ts"(){init_PullSummary(),init_utils(),init_parse_remote_messages(),SUMMARY_REGEX=/(\d+)\D+((\d+)\D+\(\+\))?(\D+(\d+)\D+\(-\))?/,ACTION_REGEX=/^(create|delete) mode \d+ (.+)/,parsers3=[new LineParser(FILE_UPDATE_REGEX=/^\s*(.+?)\s+\|\s+\d+\s*(\+*)(-*)/,((e,[t,n,r])=>{e.files.push(t),n&&(e.insertions[t]=n.length),r&&(e.deletions[t]=r.length)})),new LineParser(SUMMARY_REGEX,((e,[t,,n,,r])=>(void 0!==n||void 0!==r)&&(e.summary.changes=+t||0,e.summary.insertions=+n||0,e.summary.deletions=+r||0,!0))),new LineParser(ACTION_REGEX,((e,[t,n])=>{append(e.files,n),append("create"===t?e.created:e.deleted,n)}))],errorParsers=[new LineParser(/^from\s(.+)$/i,((e,[t])=>{e.remote=t})),new LineParser(/^fatal:\s(.+)$/,((e,[t])=>{e.message=t})),new LineParser(/([a-z0-9]+)\.\.([a-z0-9]+)\s+(\S+)\s+->\s+(\S+)$/,((e,[t,n,r,i])=>{e.branch.local=r,e.hash.local=t,e.branch.remote=i,e.hash.remote=n}))],parsePullDetail=(e,t)=>parseStringResponse(new PullSummary,parsers3,[e,t]),parsePullResult=(e,t)=>Object.assign(new PullSummary,parsePullDetail(e,t),parseRemoteMessages(e,t))}}),parsers4,parseMergeResult,parseMergeDetail,init_parse_merge=__esm({"src/lib/parsers/parse-merge.ts"(){init_MergeSummary(),init_utils(),init_parse_pull(),parsers4=[new LineParser(/^Auto-merging\s+(.+)$/,((e,[t])=>{e.merges.push(t)})),new LineParser(/^CONFLICT\s+\((.+)\): Merge conflict in (.+)$/,((e,[t,n])=>{e.conflicts.push(new MergeSummaryConflict(t,n))})),new LineParser(/^CONFLICT\s+\((.+\/delete)\): (.+) deleted in (.+) and/,((e,[t,n,r])=>{e.conflicts.push(new MergeSummaryConflict(t,n,{deleteRef:r}))})),new LineParser(/^CONFLICT\s+\((.+)\):/,((e,[t])=>{e.conflicts.push(new MergeSummaryConflict(t,null))})),new LineParser(/^Automatic merge failed;\s+(.+)$/,((e,[t])=>{e.result=t}))],parseMergeResult=(e,t)=>Object.assign(parseMergeDetail(e,t),parsePullResult(e,t)),parseMergeDetail=e=>parseStringResponse(new MergeSummaryDetail,parsers4,e)}});function mergeTask(e){return e.length?{commands:["merge",...e],format:"utf-8",parser(e,t){const n=parseMergeResult(e,t);if(n.failed)throw new GitResponseError(n);return n}}:configurationErrorTask("Git.merge requires at least one option")}var init_merge=__esm({"src/lib/tasks/merge.ts"(){init_git_response_error(),init_parse_merge(),init_task()}}),parsers5,parsePushResult,parsePushDetail;function pushResultPushedItem(e,t,n){const r=n.includes("deleted"),i=n.includes("tag")||/^refs\/tags/.test(e),o=!n.includes("new");return{deleted:r,tag:i,branch:!i,new:!o,alreadyUpdated:o,local:e,remote:t}}var init_parse_push=__esm({"src/lib/parsers/parse-push.ts"(){init_utils(),init_parse_remote_messages(),parsers5=[new LineParser(/^Pushing to (.+)$/,((e,[t])=>{e.repo=t})),new LineParser(/^updating local tracking ref '(.+)'/,((e,[t])=>{e.ref=__spreadProps(__spreadValues({},e.ref||{}),{local:t})})),new LineParser(/^[=*-]\s+([^:]+):(\S+)\s+\[(.+)]$/,((e,[t,n,r])=>{e.pushed.push(pushResultPushedItem(t,n,r))})),new LineParser(/^Branch '([^']+)' set up to track remote branch '([^']+)' from '([^']+)'/,((e,[t,n,r])=>{e.branch=__spreadProps(__spreadValues({},e.branch||{}),{local:t,remote:n,remoteName:r})})),new LineParser(/^([^:]+):(\S+)\s+([a-z0-9]+)\.\.([a-z0-9]+)$/,((e,[t,n,r,i])=>{e.update={head:{local:t,remote:n},hash:{from:r,to:i}}}))],parsePushResult=(e,t)=>{const n=parsePushDetail(e,t),r=parseRemoteMessages(e,t);return __spreadValues(__spreadValues({},n),r)},parsePushDetail=(e,t)=>parseStringResponse({pushed:[]},parsers5,[e,t])}}),push_exports={};function pushTagsTask(e={},t){return append(t,"--tags"),pushTask(e,t)}function pushTask(e={},t){const n=["push",...t];return e.branch&&n.splice(1,0,e.branch),e.remote&&n.splice(1,0,e.remote),remove(n,"-v"),append(n,"--verbose"),append(n,"--porcelain"),{commands:n,format:"utf-8",parser:parsePushResult}}__export(push_exports,{pushTagsTask:()=>pushTagsTask,pushTask:()=>pushTask});var init_push=__esm({"src/lib/tasks/push.ts"(){init_parse_push(),init_utils()}});function show_default(){return{showBuffer(){const e=["show",...getTrailingOptions(arguments,1)];return e.includes("--binary")||e.splice(1,0,"--binary"),this._runTask(straightThroughBufferTask(e),trailingFunctionArgument(arguments))},show(){const e=["show",...getTrailingOptions(arguments,1)];return this._runTask(straightThroughStringTask(e),trailingFunctionArgument(arguments))}}}var init_show=__esm({"src/lib/tasks/show.ts"(){init_utils(),init_task()}}),fromPathRegex,FileStatusSummary,init_FileStatusSummary=__esm({"src/lib/responses/FileStatusSummary.ts"(){fromPathRegex=/^(.+)\0(.+)$/,FileStatusSummary=class{constructor(e,t,n){if(this.path=e,this.index=t,this.working_dir=n,"R"===t||"R"===n){const t=fromPathRegex.exec(e)||[null,e,e];this.from=t[2]||"",this.path=t[1]||""}}}}}),StatusSummary,parsers6,parseStatusSummary;function renamedFile(e){const[t,n]=e.split(NULL);return{from:n||t,to:t}}function parser3(e,t,n){return[`${e}${t}`,n]}function conflicts(e,...t){return t.map((t=>parser3(e,t,((e,t)=>append(e.conflicted,t)))))}function splitLine(e,t){const n=t.trim();switch(" "){case n.charAt(2):return r(n.charAt(0),n.charAt(1),n.substr(3));case n.charAt(1):return r(" ",n.charAt(0),n.substr(2));default:return}function r(t,n,r){const i=`${t}${n}`,o=parsers6.get(i);o&&o(e,r),"##"!==i&&"!!"!==i&&e.files.push(new FileStatusSummary(r,t,n))}}var init_StatusSummary=__esm({"src/lib/responses/StatusSummary.ts"(){init_utils(),init_FileStatusSummary(),StatusSummary=class{constructor(){this.not_added=[],this.conflicted=[],this.created=[],this.deleted=[],this.ignored=void 0,this.modified=[],this.renamed=[],this.files=[],this.staged=[],this.ahead=0,this.behind=0,this.current=null,this.tracking=null,this.detached=!1,this.isClean=()=>!this.files.length}},parsers6=new Map([parser3(" ","A",((e,t)=>append(e.created,t))),parser3(" ","D",((e,t)=>append(e.deleted,t))),parser3(" ","M",((e,t)=>append(e.modified,t))),parser3("A"," ",((e,t)=>append(e.created,t)&&append(e.staged,t))),parser3("A","M",((e,t)=>append(e.created,t)&&append(e.staged,t)&&append(e.modified,t))),parser3("D"," ",((e,t)=>append(e.deleted,t)&&append(e.staged,t))),parser3("M"," ",((e,t)=>append(e.modified,t)&&append(e.staged,t))),parser3("M","M",((e,t)=>append(e.modified,t)&&append(e.staged,t))),parser3("R"," ",((e,t)=>{append(e.renamed,renamedFile(t))})),parser3("R","M",((e,t)=>{const n=renamedFile(t);append(e.renamed,n),append(e.modified,n.to)})),parser3("!","!",((e,t)=>{append(e.ignored=e.ignored||[],t)})),parser3("?","?",((e,t)=>append(e.not_added,t))),...conflicts("A","A","U"),...conflicts("D","D","U"),...conflicts("U","A","D","U"),["##",(e,t)=>{let n;n=/ahead (\d+)/.exec(t),e.ahead=n&&+n[1]||0,n=/behind (\d+)/.exec(t),e.behind=n&&+n[1]||0,n=/^(.+?(?=(?:\.{3}|\s|$)))/.exec(t),e.current=n&&n[1],n=/\.{3}(\S*)/.exec(t),e.tracking=n&&n[1],n=/\son\s([\S]+)$/.exec(t),e.current=n&&n[1]||e.current,e.detached=/\(no branch\)/.test(t)}]]),parseStatusSummary=function(e){const t=e.split(NULL),n=new StatusSummary;for(let e=0,r=t.length;e<r;){let r=t[e++].trim();r&&("R"===r.charAt(0)&&(r+=NULL+(t[e++]||"")),splitLine(n,r))}return n}}}),ignoredOptions;function statusTask(e){return{format:"utf-8",commands:["status","--porcelain","-b","-u","--null",...e.filter((e=>!ignoredOptions.includes(e)))],parser:e=>parseStatusSummary(e)}}var init_status=__esm({"src/lib/tasks/status.ts"(){init_StatusSummary(),ignoredOptions=["--null","-z"]}}),NOT_INSTALLED,parsers7;function versionResponse(e=0,t=0,n=0,r="",i=!0){return Object.defineProperty({major:e,minor:t,patch:n,agent:r,installed:i},"toString",{value(){return`${this.major}.${this.minor}.${this.patch}`},configurable:!1,enumerable:!1})}function notInstalledResponse(){return versionResponse(0,0,0,"",!1)}function version_default(){return{version(){return this._runTask({commands:["--version"],format:"utf-8",parser:versionParser,onError(e,t,n,r){if(-2===e.exitCode)return n(Buffer.from(NOT_INSTALLED));r(t)}})}}}function versionParser(e){return e===NOT_INSTALLED?notInstalledResponse():parseStringResponse(versionResponse(0,0,0,e),parsers7,e)}var init_version=__esm({"src/lib/tasks/version.ts"(){init_utils(),NOT_INSTALLED="installed=false",parsers7=[new LineParser(/version (\d+)\.(\d+)\.(\d+)(?:\s*\((.+)\))?/,((e,[t,n,r,i=""])=>{Object.assign(e,versionResponse(asNumber(t),asNumber(n),asNumber(r),i))})),new LineParser(/version (\d+)\.(\d+)\.(\D+)(.+)?$/,((e,[t,n,r,i=""])=>{Object.assign(e,versionResponse(asNumber(t),asNumber(n),r,i))}))]}}),simple_git_api_exports={},SimpleGitApi;__export(simple_git_api_exports,{SimpleGitApi:()=>SimpleGitApi});var init_simple_git_api=__esm({"src/lib/simple-git-api.ts"(){init_task_callback(),init_change_working_directory(),init_checkout(),init_count_objects(),init_commit(),init_config(),init_first_commit(),init_grep(),init_hash_object(),init_init(),init_log(),init_merge(),init_push(),init_show(),init_status(),init_task(),init_version(),init_utils(),SimpleGitApi=class{constructor(e){this._executor=e}_runTask(e,t){const n=this._executor.chain(),r=n.push(e);return t&&taskCallback(e,r,t),Object.create(this,{then:{value:r.then.bind(r)},catch:{value:r.catch.bind(r)},_executor:{value:n}})}add(e){return this._runTask(straightThroughStringTask(["add",...asArray(e)]),trailingFunctionArgument(arguments))}cwd(e){const t=trailingFunctionArgument(arguments);return"string"==typeof e?this._runTask(changeWorkingDirectoryTask(e,this._executor),t):"string"==typeof(null==e?void 0:e.path)?this._runTask(changeWorkingDirectoryTask(e.path,e.root&&this._executor||void 0),t):this._runTask(configurationErrorTask("Git.cwd: workingDirectory must be supplied as a string"),t)}hashObject(e,t){return this._runTask(hashObjectTask(e,!0===t),trailingFunctionArgument(arguments))}init(e){return this._runTask(initTask(!0===e,this._executor.cwd,getTrailingOptions(arguments)),trailingFunctionArgument(arguments))}merge(){return this._runTask(mergeTask(getTrailingOptions(arguments)),trailingFunctionArgument(arguments))}mergeFromTo(e,t){return filterString(e)&&filterString(t)?this._runTask(mergeTask([e,t,...getTrailingOptions(arguments)]),trailingFunctionArgument(arguments,!1)):this._runTask(configurationErrorTask("Git.mergeFromTo requires that the 'remote' and 'branch' arguments are supplied as strings"))}outputHandler(e){return this._executor.outputHandler=e,this}push(){const e=pushTask({remote:filterType(arguments[0],filterString),branch:filterType(arguments[1],filterString)},getTrailingOptions(arguments));return this._runTask(e,trailingFunctionArgument(arguments))}stash(){return this._runTask(straightThroughStringTask(["stash",...getTrailingOptions(arguments)]),trailingFunctionArgument(arguments))}status(){return this._runTask(statusTask(getTrailingOptions(arguments)),trailingFunctionArgument(arguments))}},Object.assign(SimpleGitApi.prototype,checkout_default(),commit_default(),config_default(),count_objects_default(),first_commit_default(),grep_default(),log_default(),show_default(),version_default())}}),scheduler_exports={},createScheduledTask,Scheduler;__export(scheduler_exports,{Scheduler:()=>Scheduler});var init_scheduler=__esm({"src/lib/runners/scheduler.ts"(){init_utils(),init_git_logger(),createScheduledTask=(()=>{let e=0;return()=>{e++;const{promise:t,done:n}=distExports$1.createDeferred();return{promise:t,done:n,id:e}}})(),Scheduler=class{constructor(e=2){this.concurrency=e,this.logger=createLogger("","scheduler"),this.pending=[],this.running=[],this.logger("Constructed, concurrency=%s",e)}schedule(){if(!this.pending.length||this.running.length>=this.concurrency)return void this.logger("Schedule attempt ignored, pending=%s running=%s concurrency=%s",this.pending.length,this.running.length,this.concurrency);const e=append(this.running,this.pending.shift());this.logger("Attempting id=%s",e.id),e.done((()=>{this.logger("Completing id=",e.id),remove(this.running,e),this.schedule()}))}next(){const{promise:e,id:t}=append(this.pending,createScheduledTask());return this.logger("Scheduling id=%s",t),this.schedule(),e}}}}),apply_patch_exports={};function applyPatchTask(e,t){return straightThroughStringTask(["apply",...t,...e])}__export(apply_patch_exports,{applyPatchTask:()=>applyPatchTask});var init_apply_patch=__esm({"src/lib/tasks/apply-patch.ts"(){init_task()}}),BranchDeletionBatch;function branchDeletionSuccess(e,t){return{branch:e,hash:t,success:!0}}function branchDeletionFailure(e){return{branch:e,hash:null,success:!1}}var init_BranchDeleteSummary=__esm({"src/lib/responses/BranchDeleteSummary.ts"(){BranchDeletionBatch=class{constructor(){this.all=[],this.branches={},this.errors=[]}get success(){return!this.errors.length}}}}),deleteSuccessRegex,deleteErrorRegex,parsers8,parseBranchDeletions;function hasBranchDeletionError(e,t){return 1===t&&deleteErrorRegex.test(e)}var init_parse_branch_delete=__esm({"src/lib/parsers/parse-branch-delete.ts"(){init_BranchDeleteSummary(),init_utils(),deleteErrorRegex=/^error[^']+'([^']+)'/m,parsers8=[new LineParser(deleteSuccessRegex=/(\S+)\s+\(\S+\s([^)]+)\)/,((e,[t,n])=>{const r=branchDeletionSuccess(t,n);e.all.push(r),e.branches[t]=r})),new LineParser(deleteErrorRegex,((e,[t])=>{const n=branchDeletionFailure(t);e.errors.push(n),e.all.push(n),e.branches[t]=n}))],parseBranchDeletions=(e,t)=>parseStringResponse(new BranchDeletionBatch,parsers8,[e,t])}}),BranchSummaryResult,init_BranchSummary=__esm({"src/lib/responses/BranchSummary.ts"(){BranchSummaryResult=class{constructor(){this.all=[],this.branches={},this.current="",this.detached=!1}push(e,t,n,r,i){"*"===e&&(this.detached=t,this.current=n),this.all.push(n),this.branches[n]={current:"*"===e,linkedWorkTree:"+"===e,name:n,commit:r,label:i}}}}}),parsers9;function branchStatus(e){return e?e.charAt(0):""}function parseBranchSummary(e){return parseStringResponse(new BranchSummaryResult,parsers9,e)}var init_parse_branch=__esm({"src/lib/parsers/parse-branch.ts"(){init_BranchSummary(),init_utils(),parsers9=[new LineParser(/^([*+]\s)?\((?:HEAD )?detached (?:from|at) (\S+)\)\s+([a-z0-9]+)\s(.*)$/,((e,[t,n,r,i])=>{e.push(branchStatus(t),!0,n,r,i)})),new LineParser(new RegExp("^([*+]\\s)?(\\S+)\\s+([a-z0-9]+)\\s?(.*)$","s"),((e,[t,n,r,i])=>{e.push(branchStatus(t),!1,n,r,i)}))]}}),branch_exports={};function containsDeleteBranchCommand(e){const t=["-d","-D","--delete"];return e.some((e=>t.includes(e)))}function branchTask(e){const t=containsDeleteBranchCommand(e),n=["branch",...e];return 1===n.length&&n.push("-a"),n.includes("-v")||n.splice(1,0,"-v"),{format:"utf-8",commands:n,parser:(e,n)=>t?parseBranchDeletions(e,n).all[0]:parseBranchSummary(e)}}function branchLocalTask(){return{format:"utf-8",commands:["branch","-v"],parser:parseBranchSummary}}function deleteBranchesTask(e,t=!1){return{format:"utf-8",commands:["branch","-v",t?"-D":"-d",...e],parser:(e,t)=>parseBranchDeletions(e,t),onError({exitCode:e,stdOut:t},n,r,i){if(!hasBranchDeletionError(String(n),e))return i(n);r(t)}}}function deleteBranchTask(e,t=!1){const n={format:"utf-8",commands:["branch","-v",t?"-D":"-d",e],parser:(t,n)=>parseBranchDeletions(t,n).branches[e],onError({exitCode:e,stdErr:t,stdOut:r},i,o,s){if(!hasBranchDeletionError(String(i),e))return s(i);throw new GitResponseError(n.parser(bufferToString(r),bufferToString(t)),String(i))}};return n}__export(branch_exports,{branchLocalTask:()=>branchLocalTask,branchTask:()=>branchTask,containsDeleteBranchCommand:()=>containsDeleteBranchCommand,deleteBranchTask:()=>deleteBranchTask,deleteBranchesTask:()=>deleteBranchesTask});var init_branch=__esm({"src/lib/tasks/branch.ts"(){init_git_response_error(),init_parse_branch_delete(),init_parse_branch(),init_utils()}}),parseCheckIgnore,init_CheckIgnore=__esm({"src/lib/responses/CheckIgnore.ts"(){parseCheckIgnore=e=>e.split(/\n/g).map((e=>e.trim())).filter((e=>!!e))}}),check_ignore_exports={};function checkIgnoreTask(e){return{commands:["check-ignore",...e],format:"utf-8",parser:parseCheckIgnore}}__export(check_ignore_exports,{checkIgnoreTask:()=>checkIgnoreTask});var init_check_ignore=__esm({"src/lib/tasks/check-ignore.ts"(){init_CheckIgnore()}}),clone_exports={};function disallowedCommand(e){return/^--upload-pack(=|$)/.test(e)}function cloneTask(e,t,n){const r=["clone",...n];filterString(e)&&r.push(e),filterString(t)&&r.push(t);return r.find(disallowedCommand)?configurationErrorTask("git.fetch: potential exploit argument blocked."):straightThroughStringTask(r)}function cloneMirrorTask(e,t,n){return append(n,"--mirror"),cloneTask(e,t,n)}__export(clone_exports,{cloneMirrorTask:()=>cloneMirrorTask,cloneTask:()=>cloneTask});var init_clone=__esm({"src/lib/tasks/clone.ts"(){init_task(),init_utils()}}),parsers10;function parseFetchResult(e,t){return parseStringResponse({raw:e,remote:null,branches:[],tags:[],updated:[],deleted:[]},parsers10,[e,t])}var init_parse_fetch=__esm({"src/lib/parsers/parse-fetch.ts"(){init_utils(),parsers10=[new LineParser(/From (.+)$/,((e,[t])=>{e.remote=t})),new LineParser(/\* \[new branch]\s+(\S+)\s*-> (.+)$/,((e,[t,n])=>{e.branches.push({name:t,tracking:n})})),new LineParser(/\* \[new tag]\s+(\S+)\s*-> (.+)$/,((e,[t,n])=>{e.tags.push({name:t,tracking:n})})),new LineParser(/- \[deleted]\s+\S+\s*-> (.+)$/,((e,[t])=>{e.deleted.push({tracking:t})})),new LineParser(/\s*([^.]+)\.\.(\S+)\s+(\S+)\s*-> (.+)$/,((e,[t,n,r,i])=>{e.updated.push({name:r,tracking:i,to:n,from:t})}))]}}),fetch_exports={};function disallowedCommand2(e){return/^--upload-pack(=|$)/.test(e)}function fetchTask(e,t,n){const r=["fetch",...n];e&&t&&r.push(e,t);return r.find(disallowedCommand2)?configurationErrorTask("git.fetch: potential exploit argument blocked."):{commands:r,format:"utf-8",parser:parseFetchResult}}__export(fetch_exports,{fetchTask:()=>fetchTask});var init_fetch=__esm({"src/lib/tasks/fetch.ts"(){init_parse_fetch(),init_task()}}),parsers11;function parseMoveResult(e){return parseStringResponse({moves:[]},parsers11,e)}var init_parse_move=__esm({"src/lib/parsers/parse-move.ts"(){init_utils(),parsers11=[new LineParser(/^Renaming (.+) to (.+)$/,((e,[t,n])=>{e.moves.push({from:t,to:n})}))]}}),move_exports={};function moveTask(e,t){return{commands:["mv","-v",...asArray(e),t],format:"utf-8",parser:parseMoveResult}}__export(move_exports,{moveTask:()=>moveTask});var init_move=__esm({"src/lib/tasks/move.ts"(){init_parse_move(),init_utils()}}),pull_exports={};function pullTask(e,t,n){const r=["pull",...n];return e&&t&&r.splice(1,0,e,t),{commands:r,format:"utf-8",parser:(e,t)=>parsePullResult(e,t),onError(e,t,n,r){const i=parsePullErrorResult(bufferToString(e.stdOut),bufferToString(e.stdErr));if(i)return r(new GitResponseError(i));r(t)}}}__export(pull_exports,{pullTask:()=>pullTask});var init_pull=__esm({"src/lib/tasks/pull.ts"(){init_git_response_error(),init_parse_pull(),init_utils()}});function parseGetRemotes(e){const t={};return forEach$1(e,(([e])=>t[e]={name:e})),Object.values(t)}function parseGetRemotesVerbose(e){const t={};return forEach$1(e,(([e,n,r])=>{t.hasOwnProperty(e)||(t[e]={name:e,refs:{fetch:"",push:""}}),r&&n&&(t[e].refs[r.replace(/[^a-z]/g,"")]=n)})),Object.values(t)}function forEach$1(e,t){forEachLineWithContent(e,(e=>t(e.split(/\s+/))))}var init_GetRemoteSummary=__esm({"src/lib/responses/GetRemoteSummary.ts"(){init_utils()}}),remote_exports={};function addRemoteTask(e,t,n){return straightThroughStringTask(["remote","add",...n,e,t])}function getRemotesTask(e){const t=["remote"];return e&&t.push("-v"),{commands:t,format:"utf-8",parser:e?parseGetRemotesVerbose:parseGetRemotes}}function listRemotesTask(e){const t=[...e];return"ls-remote"!==t[0]&&t.unshift("ls-remote"),straightThroughStringTask(t)}function remoteTask(e){const t=[...e];return"remote"!==t[0]&&t.unshift("remote"),straightThroughStringTask(t)}function removeRemoteTask(e){return straightThroughStringTask(["remote","remove",e])}__export(remote_exports,{addRemoteTask:()=>addRemoteTask,getRemotesTask:()=>getRemotesTask,listRemotesTask:()=>listRemotesTask,remoteTask:()=>remoteTask,removeRemoteTask:()=>removeRemoteTask});var init_remote=__esm({"src/lib/tasks/remote.ts"(){init_GetRemoteSummary(),init_task()}}),stash_list_exports={};function stashListTask(e={},t){const n=parseLogOptions(e),r=["stash","list",...n.commands,...t],i=createListLogSummaryParser(n.splitter,n.fields,logFormatFromCommand(r));return validateLogFormatConfig(r)||{commands:r,format:"utf-8",parser:i}}__export(stash_list_exports,{stashListTask:()=>stashListTask});var init_stash_list=__esm({"src/lib/tasks/stash-list.ts"(){init_log_format(),init_parse_list_log_summary(),init_diff(),init_log()}}),sub_module_exports={};function addSubModuleTask(e,t){return subModuleTask(["add",e,t])}function initSubModuleTask(e){return subModuleTask(["init",...e])}function subModuleTask(e){const t=[...e];return"submodule"!==t[0]&&t.unshift("submodule"),straightThroughStringTask(t)}function updateSubModuleTask(e){return subModuleTask(["update",...e])}__export(sub_module_exports,{addSubModuleTask:()=>addSubModuleTask,initSubModuleTask:()=>initSubModuleTask,subModuleTask:()=>subModuleTask,updateSubModuleTask:()=>updateSubModuleTask});var init_sub_module=__esm({"src/lib/tasks/sub-module.ts"(){init_task()}}),TagList,parseTagList;function singleSorted(e,t){const n=isNaN(e);return n!==isNaN(t)?n?1:-1:n?sorted(e,t):0}function sorted(e,t){return e===t?0:e>t?1:-1}function trimmed(e){return e.trim()}function toNumber(e){return"string"==typeof e&&parseInt(e.replace(/^\D+/g,""),10)||0}var init_TagList=__esm({"src/lib/responses/TagList.ts"(){TagList=class{constructor(e,t){this.all=e,this.latest=t}},parseTagList=function(e,t=!1){const n=e.split("\n").map(trimmed).filter(Boolean);t||n.sort((function(e,t){const n=e.split("."),r=t.split(".");if(1===n.length||1===r.length)return singleSorted(toNumber(n[0]),toNumber(r[0]));for(let e=0,t=Math.max(n.length,r.length);e<t;e++){const t=sorted(toNumber(n[e]),toNumber(r[e]));if(t)return t}return 0}));const r=t?n[0]:[...n].reverse().find((e=>e.indexOf(".")>=0));return new TagList(n,r)}}}),tag_exports={};function tagListTask(e=[]){const t=e.some((e=>/^--sort=/.test(e)));return{format:"utf-8",commands:["tag","-l",...e],parser:e=>parseTagList(e,t)}}function addTagTask(e){return{format:"utf-8",commands:["tag",e],parser:()=>({name:e})}}function addAnnotatedTagTask(e,t){return{format:"utf-8",commands:["tag","-a","-m",t,e],parser:()=>({name:e})}}__export(tag_exports,{addAnnotatedTagTask:()=>addAnnotatedTagTask,addTagTask:()=>addTagTask,tagListTask:()=>tagListTask});var init_tag=__esm({"src/lib/tasks/tag.ts"(){init_TagList()}}),require_git=__commonJS({"src/git.js"(e,t){var{GitExecutor:n}=(init_git_executor(),__toCommonJS(git_executor_exports)),{SimpleGitApi:r}=(init_simple_git_api(),__toCommonJS(simple_git_api_exports)),{Scheduler:i}=(init_scheduler(),__toCommonJS(scheduler_exports)),{configurationErrorTask:o}=(init_task(),__toCommonJS(task_exports)),{asArray:s,filterArray:a,filterPrimitives:c,filterString:l,filterStringOrStringArray:u,filterType:d,getTrailingOptions:p,trailingFunctionArgument:f,trailingOptionsArgument:_}=(init_utils(),__toCommonJS(utils_exports)),{applyPatchTask:m}=(init_apply_patch(),__toCommonJS(apply_patch_exports)),{branchTask:h,branchLocalTask:g,deleteBranchesTask:A,deleteBranchTask:y}=(init_branch(),__toCommonJS(branch_exports)),{checkIgnoreTask:v}=(init_check_ignore(),__toCommonJS(check_ignore_exports)),{checkIsRepoTask:b}=(init_check_is_repo(),__toCommonJS(check_is_repo_exports)),{cloneTask:C,cloneMirrorTask:E}=(init_clone(),__toCommonJS(clone_exports)),{cleanWithOptionsTask:x,isCleanOptionsArray:S}=(init_clean(),__toCommonJS(clean_exports)),{diffSummaryTask:k}=(init_diff(),__toCommonJS(diff_exports)),{fetchTask:D}=(init_fetch(),__toCommonJS(fetch_exports)),{moveTask:w}=(init_move(),__toCommonJS(move_exports)),{pullTask:I}=(init_pull(),__toCommonJS(pull_exports)),{pushTagsTask:T}=(init_push(),__toCommonJS(push_exports)),{addRemoteTask:F,getRemotesTask:R,listRemotesTask:P,remoteTask:N,removeRemoteTask:B}=(init_remote(),__toCommonJS(remote_exports)),{getResetMode:O,resetTask:q}=(init_reset(),__toCommonJS(reset_exports)),{stashListTask:$}=(init_stash_list(),__toCommonJS(stash_list_exports)),{addSubModuleTask:Q,initSubModuleTask:L,subModuleTask:M,updateSubModuleTask:j}=(init_sub_module(),__toCommonJS(sub_module_exports)),{addAnnotatedTagTask:U,addTagTask:J,tagListTask:V}=(init_tag(),__toCommonJS(tag_exports)),{straightThroughBufferTask:H,straightThroughStringTask:G}=(init_task(),__toCommonJS(task_exports));function W(e,t){this._plugins=t,this._executor=new n(e.baseDir,new i(e.maxConcurrentProcesses),t),this._trimmed=e.trimmed}function z(e,t,n,r){return"string"!=typeof n?o(`git.${e}() requires a string 'repoPath'`):t(n,d(r,l),p(arguments))}(W.prototype=Object.create(r.prototype)).constructor=W,W.prototype.customBinary=function(e){return this._plugins.reconfigure("binary",e),this},W.prototype.env=function(e,t){return 1===arguments.length&&"object"==typeof e?this._executor.env=e:(this._executor.env=this._executor.env||{})[e]=t,this},W.prototype.stashList=function(e){return this._runTask($(_(arguments)||{},a(e)&&e||[]),f(arguments))},W.prototype.clone=function(){return this._runTask(z("clone",C,...arguments),f(arguments))},W.prototype.mirror=function(){return this._runTask(z("mirror",E,...arguments),f(arguments))},W.prototype.mv=function(e,t){return this._runTask(w(e,t),f(arguments))},W.prototype.checkoutLatestTag=function(e){var t=this;return this.pull((function(){t.tags((function(n,r){t.checkout(r.latest,e)}))}))},W.prototype.pull=function(e,t,n,r){return this._runTask(I(d(e,l),d(t,l),p(arguments)),f(arguments))},W.prototype.fetch=function(e,t){return this._runTask(D(d(e,l),d(t,l),p(arguments)),f(arguments))},W.prototype.silent=function(e){return console.warn("simple-git deprecation notice: git.silent: logging should be configured using the `debug` library / `DEBUG` environment variable, this will be an error in version 3"),this},W.prototype.tags=function(e,t){return this._runTask(V(p(arguments)),f(arguments))},W.prototype.rebase=function(){return this._runTask(G(["rebase",...p(arguments)]),f(arguments))},W.prototype.reset=function(e){return this._runTask(q(O(e),p(arguments)),f(arguments))},W.prototype.revert=function(e){const t=f(arguments);return"string"!=typeof e?this._runTask(o("Commit must be a string"),t):this._runTask(G(["revert",...p(arguments,0,!0),e]),t)},W.prototype.addTag=function(e){const t="string"==typeof e?J(e):o("Git.addTag requires a tag name");return this._runTask(t,f(arguments))},W.prototype.addAnnotatedTag=function(e,t){return this._runTask(U(e,t),f(arguments))},W.prototype.deleteLocalBranch=function(e,t,n){return this._runTask(y(e,"boolean"==typeof t&&t),f(arguments))},W.prototype.deleteLocalBranches=function(e,t,n){return this._runTask(A(e,"boolean"==typeof t&&t),f(arguments))},W.prototype.branch=function(e,t){return this._runTask(h(p(arguments)),f(arguments))},W.prototype.branchLocal=function(e){return this._runTask(g(),f(arguments))},W.prototype.raw=function(e){const t=!Array.isArray(e),n=[].slice.call(t?arguments:e,0);for(let e=0;e<n.length&&t;e++)if(!c(n[e])){n.splice(e,n.length-e);break}n.push(...p(arguments,0,!0));var r=f(arguments);return n.length?this._runTask(G(n,this._trimmed),r):this._runTask(o("Raw: must supply one or more command to execute"),r)},W.prototype.submoduleAdd=function(e,t,n){return this._runTask(Q(e,t),f(arguments))},W.prototype.submoduleUpdate=function(e,t){return this._runTask(j(p(arguments,!0)),f(arguments))},W.prototype.submoduleInit=function(e,t){return this._runTask(L(p(arguments,!0)),f(arguments))},W.prototype.subModule=function(e,t){return this._runTask(M(p(arguments)),f(arguments))},W.prototype.listRemote=function(){return this._runTask(P(p(arguments)),f(arguments))},W.prototype.addRemote=function(e,t,n){return this._runTask(F(e,t,p(arguments)),f(arguments))},W.prototype.removeRemote=function(e,t){return this._runTask(B(e),f(arguments))},W.prototype.getRemotes=function(e,t){return this._runTask(R(!0===e),f(arguments))},W.prototype.remote=function(e,t){return this._runTask(N(p(arguments)),f(arguments))},W.prototype.tag=function(e,t){const n=p(arguments);return"tag"!==n[0]&&n.unshift("tag"),this._runTask(G(n),f(arguments))},W.prototype.updateServerInfo=function(e){return this._runTask(G(["update-server-info"]),f(arguments))},W.prototype.pushTags=function(e,t){const n=T({remote:d(e,l)},p(arguments));return this._runTask(n,f(arguments))},W.prototype.rm=function(e){return this._runTask(G(["rm","-f",...s(e)]),f(arguments))},W.prototype.rmKeepLocal=function(e){return this._runTask(G(["rm","--cached",...s(e)]),f(arguments))},W.prototype.catFile=function(e,t){return this._catFile("utf-8",arguments)},W.prototype.binaryCatFile=function(){return this._catFile("buffer",arguments)},W.prototype._catFile=function(e,t){var n=f(t),r=["cat-file"],i=t[0];if("string"==typeof i)return this._runTask(o("Git.catFile: options must be supplied as an array of strings"),n);Array.isArray(i)&&r.push.apply(r,i);const s="buffer"===e?H(r):G(r);return this._runTask(s,n)},W.prototype.diff=function(e,t){const n=l(e)?o("git.diff: supplying options as a single string is no longer supported, switch to an array of strings"):G(["diff",...p(arguments)]);return this._runTask(n,f(arguments))},W.prototype.diffSummary=function(){return this._runTask(k(p(arguments,1)),f(arguments))},W.prototype.applyPatch=function(e){const t=u(e)?m(s(e),p([].slice.call(arguments,1))):o("git.applyPatch requires one or more string patches as the first argument");return this._runTask(t,f(arguments))},W.prototype.revparse=function(){const e=["rev-parse",...p(arguments,!0)];return this._runTask(G(e,!0),f(arguments))},W.prototype.clean=function(e,t,n){const r=S(e),i=r&&e.join("")||d(e,l)||"",o=p([].slice.call(arguments,r?1:0));return this._runTask(x(i,o),f(arguments))},W.prototype.exec=function(e){const t={commands:[],format:"utf-8",parser(){"function"==typeof e&&e()}};return this._runTask(t)},W.prototype.clearQueue=function(){return this},W.prototype.checkIgnore=function(e,t){return this._runTask(v(s(d(e,u,[]))),f(arguments))},W.prototype.checkIsRepo=function(e,t){return this._runTask(b(d(e,l)),f(arguments))},t.exports=W}});init_pathspec(),init_git_error();var GitConstructError=class extends GitError{constructor(e,t){super(void 0,t),this.config=e}};init_git_error(),init_git_error();var GitPluginError=class extends GitError{constructor(e,t,n){super(e,n),this.task=e,this.plugin=t,Object.setPrototypeOf(this,new.target.prototype)}};function abortPlugin(e){if(!e)return;const t={type:"spawn.after",action(t,n){function r(){n.kill(new GitPluginError(void 0,"abort","Abort signal received"))}e.addEventListener("abort",r),n.spawned.on("close",(()=>e.removeEventListener("abort",r)))}};return[{type:"spawn.before",action(t,n){e.aborted&&n.kill(new GitPluginError(void 0,"abort","Abort already signaled"))}},t]}function isConfigSwitch(e){return"string"==typeof e&&"-c"===e.trim().toLowerCase()}function preventProtocolOverride(e,t){if(isConfigSwitch(e)&&/^\s*protocol(.[a-z]+)?.allow/.test(t))throw new GitPluginError(void 0,"unsafe","Configuring protocol.allow is not permitted without enabling allowUnsafeExtProtocol")}function preventUploadPack(e,t){if(/^\s*--(upload|receive)-pack/.test(e))throw new GitPluginError(void 0,"unsafe","Use of --upload-pack or --receive-pack is not permitted without enabling allowUnsafePack");if("clone"===t&&/^\s*-u\b/.test(e))throw new GitPluginError(void 0,"unsafe","Use of clone with option -u is not permitted without enabling allowUnsafePack");if("push"===t&&/^\s*--exec\b/.test(e))throw new GitPluginError(void 0,"unsafe","Use of push with option --exec is not permitted without enabling allowUnsafePack")}function blockUnsafeOperationsPlugin({allowUnsafeProtocolOverride:e=!1,allowUnsafePack:t=!1}={}){return{type:"spawn.args",action:(n,r)=>(n.forEach(((i,o)=>{const s=o<n.length?n[o+1]:"";e||preventProtocolOverride(i,s),t||preventUploadPack(i,r.method)})),n)}}function commandConfigPrefixingPlugin(e){const t=prefixedArray(e,"-c");return{type:"spawn.args",action:e=>[...t,...e]}}init_git_response_error(),init_task_configuration_error(),init_check_is_repo(),init_clean(),init_config(),init_diff_name_status(),init_grep(),init_reset(),init_utils(),init_utils();var never=distExports$1.deferred().promise;function completionDetectionPlugin({onClose:e=!0,onExit:t=50}={}){function n(e,t,n){!1!==e&&(!0===e?t.promise:t.promise.then((()=>delay(e)))).then(n.done)}return{type:"spawn.after",action(r,i){return __async(this,arguments,(function*(r,{spawned:i,close:o}){var s,a;const c=function(){let r=-1;const i={close:distExports$1.deferred(),closeTimeout:distExports$1.deferred(),exit:distExports$1.deferred(),exitTimeout:distExports$1.deferred()},o=Promise.race([!1===e?never:i.closeTimeout.promise,!1===t?never:i.exitTimeout.promise]);return n(e,i.close,i.closeTimeout),n(t,i.exit,i.exitTimeout),{close(e){r=e,i.close.done()},exit(e){r=e,i.exit.done()},get exitCode(){return r},result:o}}();let l=!0,u=()=>{l=!1};null==(s=i.stdout)||s.on("data",u),null==(a=i.stderr)||a.on("data",u),i.on("error",u),i.on("close",(e=>c.close(e))),i.on("exit",(e=>c.exit(e)));try{yield c.result,l&&(yield delay(50)),o(c.exitCode)}catch(e){o(c.exitCode,e)}}))}}}init_utils();var WRONG_NUMBER_ERR="Invalid value supplied for custom binary, requires a single string or an array containing either one or two strings",WRONG_CHARS_ERR="Invalid value supplied for custom binary, restricted characters must be removed or supply the unsafe.allowUnsafeCustomBinary option";function isBadArgument(e){return!e||!/^([a-z]:)?([a-z0-9/.\\_-]+)$/i.test(e)}function toBinaryConfig(e,t){if(e.length<1||e.length>2)throw new GitPluginError(void 0,"binary",WRONG_NUMBER_ERR);if(e.some(isBadArgument)){if(!t)throw new GitPluginError(void 0,"binary",WRONG_CHARS_ERR);console.warn(WRONG_CHARS_ERR)}const[n,r]=e;return{binary:n,prefix:r}}function customBinaryPlugin(e,t=["git"],n=!1){let r=toBinaryConfig(asArray(t),n);e.on("binary",(e=>{r=toBinaryConfig(asArray(e),n)})),e.append("spawn.binary",(()=>r.binary)),e.append("spawn.args",(e=>r.prefix?[r.prefix,...e]:e))}function isTaskError(e){return!(!e.exitCode||!e.stdErr.length)}function getErrorMessage(e){return Buffer.concat([...e.stdOut,...e.stdErr])}function errorDetectionHandler(e=!1,t=isTaskError,n=getErrorMessage){return(r,i)=>!e&&r||!t(i)?r:n(i)}function errorDetectionPlugin(e){return{type:"task.error",action(t,n){const r=e(t.error,{stdErr:n.stdErr,stdOut:n.stdOut,exitCode:n.exitCode});return Buffer.isBuffer(r)?{error:new GitError(void 0,r.toString("utf-8"))}:{error:r}}}}init_git_error(),init_utils();var PluginStore=class{constructor(){this.plugins=new Set,this.events=new EventEmitter}on(e,t){this.events.on(e,t)}reconfigure(e,t){this.events.emit(e,t)}append(e,t){const n=append(this.plugins,{type:e,action:t});return()=>this.plugins.delete(n)}add(e){const t=[];return asArray(e).forEach((e=>e&&this.plugins.add(append(t,e)))),()=>{t.forEach((e=>this.plugins.delete(e)))}}exec(e,t,n){let r=t;const i=Object.freeze(Object.create(n));for(const t of this.plugins)t.type===e&&(r=t.action(r,i));return r}};function progressMonitorPlugin(e){const t="--progress",n=["checkout","clone","fetch","pull","push"],r={type:"spawn.args",action:(e,r)=>n.includes(r.method)?including(e,t):e};return[r,{type:"spawn.after",action(n,r){var i;r.commands.includes(t)&&(null==(i=r.spawned.stderr)||i.on("data",(t=>{const n=/^([\s\S]+?):\s*(\d+)% \((\d+)\/(\d+)\)/.exec(t.toString("utf8"));n&&e({method:r.method,stage:progressEventStage(n[1]),progress:asNumber(n[2]),processed:asNumber(n[3]),total:asNumber(n[4])})})))}}]}function progressEventStage(e){return String(e.toLowerCase().split(" ",1))||"unknown"}function spawnOptionsPlugin(e){const t=pick(e,["uid","gid"]);return{type:"spawn.options",action:e=>__spreadValues(__spreadValues({},t),e)}}function timeoutPlugin({block:e,stdErr:t=!0,stdOut:n=!0}){if(e>0)return{type:"spawn.after",action(r,i){var o,s;let a;function c(){a&&clearTimeout(a),a=setTimeout(u,e)}function l(){var e,t;null==(e=i.spawned.stdout)||e.off("data",c),null==(t=i.spawned.stderr)||t.off("data",c),i.spawned.off("exit",l),i.spawned.off("close",l),a&&clearTimeout(a)}function u(){l(),i.kill(new GitPluginError(void 0,"timeout","block timeout reached"))}n&&(null==(o=i.spawned.stdout)||o.on("data",c)),t&&(null==(s=i.spawned.stderr)||s.on("data",c)),i.spawned.on("exit",l),i.spawned.on("close",l),c()}}}function suffixPathsPlugin(){return{type:"spawn.args",action(e){const t=[];let n;function r(e){(n=n||[]).push(...e)}for(let n=0;n<e.length;n++){const i=e[n];if(isPathSpec(i))r(toPaths(i));else{if("--"===i){r(e.slice(n+1).flatMap((e=>isPathSpec(e)&&toPaths(e)||e)));break}t.push(i)}}return n?[...t,"--",...n.map(String)]:t}}}init_utils(),init_utils(),init_pathspec(),init_utils();var Git=require_git();function gitInstanceFactory(e,t){var n;const r=new PluginStore,i=createInstanceConfig(e&&("string"==typeof e?{baseDir:e}:e)||{},t);if(!folderExists(i.baseDir))throw new GitConstructError(i,"Cannot use simple-git on a directory that does not exist");return Array.isArray(i.config)&&r.add(commandConfigPrefixingPlugin(i.config)),r.add(blockUnsafeOperationsPlugin(i.unsafe)),r.add(suffixPathsPlugin()),r.add(completionDetectionPlugin(i.completion)),i.abort&&r.add(abortPlugin(i.abort)),i.progress&&r.add(progressMonitorPlugin(i.progress)),i.timeout&&r.add(timeoutPlugin(i.timeout)),i.spawnOptions&&r.add(spawnOptionsPlugin(i.spawnOptions)),r.add(errorDetectionPlugin(errorDetectionHandler(!0))),i.errors&&r.add(errorDetectionPlugin(i.errors)),customBinaryPlugin(r,i.binary,null==(n=i.unsafe)?void 0:n.allowUnsafeCustomBinary),new Git(i,r)}init_git_response_error();var simpleGit=gitInstanceFactory,polyfills,hasRequiredPolyfills,legacyStreams,hasRequiredLegacyStreams,clone_1$1,hasRequiredClone$1,gracefulFs,hasRequiredGracefulFs;function requirePolyfills(){if(hasRequiredPolyfills)return polyfills;hasRequiredPolyfills=1;var e=require$$0$n,t=process.cwd,n=null,r=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){return n||(n=t.call(process)),n};try{process.cwd()}catch(e){}if("function"==typeof process.chdir){var i=process.chdir;process.chdir=function(e){n=null,i.call(process,e)},Object.setPrototypeOf&&Object.setPrototypeOf(process.chdir,i)}return polyfills=function(t){e.hasOwnProperty("O_SYMLINK")&&process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)&&function(t){t.lchmod=function(n,r,i){t.open(n,e.O_WRONLY|e.O_SYMLINK,r,(function(e,n){e?i&&i(e):t.fchmod(n,r,(function(e){t.close(n,(function(t){i&&i(e||t)}))}))}))},t.lchmodSync=function(n,r){var i,o=t.openSync(n,e.O_WRONLY|e.O_SYMLINK,r),s=!0;try{i=t.fchmodSync(o,r),s=!1}finally{if(s)try{t.closeSync(o)}catch(e){}else t.closeSync(o)}return i}}(t);t.lutimes||function(t){e.hasOwnProperty("O_SYMLINK")&&t.futimes?(t.lutimes=function(n,r,i,o){t.open(n,e.O_SYMLINK,(function(e,n){e?o&&o(e):t.futimes(n,r,i,(function(e){t.close(n,(function(t){o&&o(e||t)}))}))}))},t.lutimesSync=function(n,r,i){var o,s=t.openSync(n,e.O_SYMLINK),a=!0;try{o=t.futimesSync(s,r,i),a=!1}finally{if(a)try{t.closeSync(s)}catch(e){}else t.closeSync(s)}return o}):t.futimes&&(t.lutimes=function(e,t,n,r){r&&process.nextTick(r)},t.lutimesSync=function(){})}(t);t.chown=o(t.chown),t.fchown=o(t.fchown),t.lchown=o(t.lchown),t.chmod=n(t.chmod),t.fchmod=n(t.fchmod),t.lchmod=n(t.lchmod),t.chownSync=s(t.chownSync),t.fchownSync=s(t.fchownSync),t.lchownSync=s(t.lchownSync),t.chmodSync=i(t.chmodSync),t.fchmodSync=i(t.fchmodSync),t.lchmodSync=i(t.lchmodSync),t.stat=a(t.stat),t.fstat=a(t.fstat),t.lstat=a(t.lstat),t.statSync=c(t.statSync),t.fstatSync=c(t.fstatSync),t.lstatSync=c(t.lstatSync),t.chmod&&!t.lchmod&&(t.lchmod=function(e,t,n){n&&process.nextTick(n)},t.lchmodSync=function(){});t.chown&&!t.lchown&&(t.lchown=function(e,t,n,r){r&&process.nextTick(r)},t.lchownSync=function(){});"win32"===r&&(t.rename="function"!=typeof t.rename?t.rename:function(e){function n(n,r,i){var o=Date.now(),s=0;e(n,r,(function a(c){if(c&&("EACCES"===c.code||"EPERM"===c.code||"EBUSY"===c.code)&&Date.now()-o<6e4)return setTimeout((function(){t.stat(r,(function(t,o){t&&"ENOENT"===t.code?e(n,r,a):i(c)}))}),s),void(s<100&&(s+=10));i&&i(c)}))}return Object.setPrototypeOf&&Object.setPrototypeOf(n,e),n}(t.rename));function n(e){return e?function(n,r,i){return e.call(t,n,r,(function(e){l(e)&&(e=null),i&&i.apply(this,arguments)}))}:e}function i(e){return e?function(n,r){try{return e.call(t,n,r)}catch(e){if(!l(e))throw e}}:e}function o(e){return e?function(n,r,i,o){return e.call(t,n,r,i,(function(e){l(e)&&(e=null),o&&o.apply(this,arguments)}))}:e}function s(e){return e?function(n,r,i){try{return e.call(t,n,r,i)}catch(e){if(!l(e))throw e}}:e}function a(e){return e?function(n,r,i){function o(e,t){t&&(t.uid<0&&(t.uid+=4294967296),t.gid<0&&(t.gid+=4294967296)),i&&i.apply(this,arguments)}return"function"==typeof r&&(i=r,r=null),r?e.call(t,n,r,o):e.call(t,n,o)}:e}function c(e){return e?function(n,r){var i=r?e.call(t,n,r):e.call(t,n);return i&&(i.uid<0&&(i.uid+=4294967296),i.gid<0&&(i.gid+=4294967296)),i}:e}function l(e){return!e||("ENOSYS"===e.code||!(process.getuid&&0===process.getuid()||"EINVAL"!==e.code&&"EPERM"!==e.code))}t.read="function"!=typeof t.read?t.read:function(e){function n(n,r,i,o,s,a){var c;if(a&&"function"==typeof a){var l=0;c=function(u,d,p){if(u&&"EAGAIN"===u.code&&l<10)return l++,e.call(t,n,r,i,o,s,c);a.apply(this,arguments)}}return e.call(t,n,r,i,o,s,c)}return Object.setPrototypeOf&&Object.setPrototypeOf(n,e),n}(t.read),t.readSync="function"!=typeof t.readSync?t.readSync:(u=t.readSync,function(e,n,r,i,o){for(var s=0;;)try{return u.call(t,e,n,r,i,o)}catch(e){if("EAGAIN"===e.code&&s<10){s++;continue}throw e}});var u},polyfills}function requireLegacyStreams(){if(hasRequiredLegacyStreams)return legacyStreams;hasRequiredLegacyStreams=1;var e=require$$0$b.Stream;return legacyStreams=function(t){return{ReadStream:function n(r,i){if(!(this instanceof n))return new n(r,i);e.call(this);var o=this;this.path=r,this.fd=null,this.readable=!0,this.paused=!1,this.flags="r",this.mode=438,this.bufferSize=65536,i=i||{};for(var s=Object.keys(i),a=0,c=s.length;a<c;a++){var l=s[a];this[l]=i[l]}this.encoding&&this.setEncoding(this.encoding);if(void 0!==this.start){if("number"!=typeof this.start)throw TypeError("start must be a Number");if(void 0===this.end)this.end=1/0;else if("number"!=typeof this.end)throw TypeError("end must be a Number");if(this.start>this.end)throw new Error("start must be <= end");this.pos=this.start}if(null!==this.fd)return void process.nextTick((function(){o._read()}));t.open(this.path,this.flags,this.mode,(function(e,t){if(e)return o.emit("error",e),void(o.readable=!1);o.fd=t,o.emit("open",t),o._read()}))},WriteStream:function n(r,i){if(!(this instanceof n))return new n(r,i);e.call(this),this.path=r,this.fd=null,this.writable=!0,this.flags="w",this.encoding="binary",this.mode=438,this.bytesWritten=0,i=i||{};for(var o=Object.keys(i),s=0,a=o.length;s<a;s++){var c=o[s];this[c]=i[c]}if(void 0!==this.start){if("number"!=typeof this.start)throw TypeError("start must be a Number");if(this.start<0)throw new Error("start must be >= zero");this.pos=this.start}this.busy=!1,this._queue=[],null===this.fd&&(this._open=t.open,this._queue.push([this._open,this.path,this.flags,this.mode,void 0]),this.flush())}}},legacyStreams}function requireClone$1(){if(hasRequiredClone$1)return clone_1$1;hasRequiredClone$1=1,clone_1$1=function(t){if(null===t||"object"!=typeof t)return t;if(t instanceof Object)var n={__proto__:e(t)};else n=Object.create(null);return Object.getOwnPropertyNames(t).forEach((function(e){Object.defineProperty(n,e,Object.getOwnPropertyDescriptor(t,e))})),n};var e=Object.getPrototypeOf||function(e){return e.__proto__};return clone_1$1}function requireGracefulFs(){if(hasRequiredGracefulFs)return gracefulFs;hasRequiredGracefulFs=1;var e,t,n=require$$0$7,r=requirePolyfills(),i=requireLegacyStreams(),o=requireClone$1(),s=require$$0__default;function a(t,n){Object.defineProperty(t,e,{get:function(){return n}})}"function"==typeof Symbol&&"function"==typeof Symbol.for?(e=Symbol.for("graceful-fs.queue"),t=Symbol.for("graceful-fs.previous")):(e="___graceful-fs.queue",t="___graceful-fs.previous");var c,l=function(){};if(s.debuglog?l=s.debuglog("gfs4"):/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&(l=function(){var e=s.format.apply(s,arguments);e="GFS4: "+e.split(/\n/).join("\nGFS4: "),console.error(e)}),!n[e]){var u=commonjsGlobal[e]||[];a(n,u),n.close=function(e){function r(t,r){return e.call(n,t,(function(e){e||f(),"function"==typeof r&&r.apply(this,arguments)}))}return Object.defineProperty(r,t,{value:e}),r}(n.close),n.closeSync=function(e){function r(t){e.apply(n,arguments),f()}return Object.defineProperty(r,t,{value:e}),r}(n.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&process.on("exit",(function(){l(n[e]),require$$0$f.equal(n[e].length,0)}))}function d(e){r(e),e.gracefulify=d,e.createReadStream=function(t,n){return new e.ReadStream(t,n)},e.createWriteStream=function(t,n){return new e.WriteStream(t,n)};var t=e.readFile;e.readFile=function(e,n,r){"function"==typeof n&&(r=n,n=null);return function e(n,r,i,o){return t(n,r,(function(t){!t||"EMFILE"!==t.code&&"ENFILE"!==t.code?"function"==typeof i&&i.apply(this,arguments):p([e,[n,r,i],t,o||Date.now(),Date.now()])}))}(e,n,r)};var n=e.writeFile;e.writeFile=function(e,t,r,i){"function"==typeof r&&(i=r,r=null);return function e(t,r,i,o,s){return n(t,r,i,(function(n){!n||"EMFILE"!==n.code&&"ENFILE"!==n.code?"function"==typeof o&&o.apply(this,arguments):p([e,[t,r,i,o],n,s||Date.now(),Date.now()])}))}(e,t,r,i)};var o=e.appendFile;o&&(e.appendFile=function(e,t,n,r){"function"==typeof n&&(r=n,n=null);return function e(t,n,r,i,s){return o(t,n,r,(function(o){!o||"EMFILE"!==o.code&&"ENFILE"!==o.code?"function"==typeof i&&i.apply(this,arguments):p([e,[t,n,r,i],o,s||Date.now(),Date.now()])}))}(e,t,n,r)});var s=e.copyFile;s&&(e.copyFile=function(e,t,n,r){"function"==typeof n&&(r=n,n=0);return function e(t,n,r,i,o){return s(t,n,r,(function(s){!s||"EMFILE"!==s.code&&"ENFILE"!==s.code?"function"==typeof i&&i.apply(this,arguments):p([e,[t,n,r,i],s,o||Date.now(),Date.now()])}))}(e,t,n,r)});var a=e.readdir;e.readdir=function(e,t,n){"function"==typeof t&&(n=t,t=null);var r=c.test(process.version)?function(e,t,n,r){return a(e,i(e,t,n,r))}:function(e,t,n,r){return a(e,t,i(e,t,n,r))};return r(e,t,n);function i(e,t,n,i){return function(o,s){!o||"EMFILE"!==o.code&&"ENFILE"!==o.code?(s&&s.sort&&s.sort(),"function"==typeof n&&n.call(this,o,s)):p([r,[e,t,n],o,i||Date.now(),Date.now()])}}};var c=/^v[0-5]\./;if("v0.8"===process.version.substr(0,4)){var l=i(e);h=l.ReadStream,g=l.WriteStream}var u=e.ReadStream;u&&(h.prototype=Object.create(u.prototype),h.prototype.open=function(){var e=this;y(e.path,e.flags,e.mode,(function(t,n){t?(e.autoClose&&e.destroy(),e.emit("error",t)):(e.fd=n,e.emit("open",n),e.read())}))});var f=e.WriteStream;f&&(g.prototype=Object.create(f.prototype),g.prototype.open=function(){var e=this;y(e.path,e.flags,e.mode,(function(t,n){t?(e.destroy(),e.emit("error",t)):(e.fd=n,e.emit("open",n))}))}),Object.defineProperty(e,"ReadStream",{get:function(){return h},set:function(e){h=e},enumerable:!0,configurable:!0}),Object.defineProperty(e,"WriteStream",{get:function(){return g},set:function(e){g=e},enumerable:!0,configurable:!0});var _=h;Object.defineProperty(e,"FileReadStream",{get:function(){return _},set:function(e){_=e},enumerable:!0,configurable:!0});var m=g;function h(e,t){return this instanceof h?(u.apply(this,arguments),this):h.apply(Object.create(h.prototype),arguments)}function g(e,t){return this instanceof g?(f.apply(this,arguments),this):g.apply(Object.create(g.prototype),arguments)}Object.defineProperty(e,"FileWriteStream",{get:function(){return m},set:function(e){m=e},enumerable:!0,configurable:!0});var A=e.open;function y(e,t,n,r){return"function"==typeof n&&(r=n,n=null),function e(t,n,r,i,o){return A(t,n,r,(function(s,a){!s||"EMFILE"!==s.code&&"ENFILE"!==s.code?"function"==typeof i&&i.apply(this,arguments):p([e,[t,n,r,i],s,o||Date.now(),Date.now()])}))}(e,t,n,r)}return e.open=y,e}function p(t){l("ENQUEUE",t[0].name,t[1]),n[e].push(t),_()}function f(){for(var t=Date.now(),r=0;r<n[e].length;++r)n[e][r].length>2&&(n[e][r][3]=t,n[e][r][4]=t);_()}function _(){if(clearTimeout(c),c=void 0,0!==n[e].length){var t=n[e].shift(),r=t[0],i=t[1],o=t[2],s=t[3],a=t[4];if(void 0===s)l("RETRY",r.name,i),r.apply(null,i);else if(Date.now()-s>=6e4){l("TIMEOUT",r.name,i);var u=i.pop();"function"==typeof u&&u.call(null,o)}else{var d=Date.now()-a,p=Math.max(a-s,1);d>=Math.min(1.2*p,100)?(l("RETRY",r.name,i),r.apply(null,i.concat([s]))):n[e].push(t)}void 0===c&&(c=setTimeout(_,0))}}return commonjsGlobal[e]||a(commonjsGlobal,n[e]),gracefulFs=d(o(n)),process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!n.__patched&&(gracefulFs=d(n),n.__patched=!0),gracefulFs}var gracefulFsExports=requireGracefulFs(),fs=getDefaultExportFromCjs(gracefulFsExports);const homeDirectory=require$$0$9.homedir(),{env:env}=process,xdgData=env.XDG_DATA_HOME||(homeDirectory?require$$0$8.join(homeDirectory,".local","share"):void 0),xdgConfig=env.XDG_CONFIG_HOME||(homeDirectory?require$$0$8.join(homeDirectory,".config"):void 0);env.XDG_STATE_HOME||homeDirectory&&require$$0$8.join(homeDirectory,".local","state"),env.XDG_CACHE_HOME||homeDirectory&&require$$0$8.join(homeDirectory,".cache"),env.XDG_RUNTIME_DIR;const xdgDataDirectories=(env.XDG_DATA_DIRS||"/usr/local/share/:/usr/share/").split(":");xdgData&&xdgDataDirectories.unshift(xdgData);const xdgConfigDirectories=(env.XDG_CONFIG_DIRS||"/etc/xdg").split(":");xdgConfig&&xdgConfigDirectories.unshift(xdgConfig);const attemptifyAsync=(e,t)=>function(...n){return e.apply(void 0,n).catch(t)},attemptifySync=(e,t)=>function(...n){try{return e.apply(void 0,n)}catch(e){return t(e)}},IS_USER_ROOT=!!process$2.getuid&&!process$2.getuid(),LIMIT_FILES_DESCRIPTORS=1e4,NOOP=()=>{},Handlers={isChangeErrorOk:e=>{if(!Handlers.isNodeError(e))return!1;const{code:t}=e;return"ENOSYS"===t||!(IS_USER_ROOT||"EINVAL"!==t&&"EPERM"!==t)},isNodeError:e=>e instanceof Error,isRetriableError:e=>{if(!Handlers.isNodeError(e))return!1;const{code:t}=e;return"EMFILE"===t||"ENFILE"===t||"EAGAIN"===t||"EBUSY"===t||"EACCESS"===t||"EACCES"===t||"EACCS"===t||"EPERM"===t},onChangeError:e=>{if(!Handlers.isNodeError(e))throw e;if(!Handlers.isChangeErrorOk(e))throw e}};class RetryfyQueue{constructor(){this.interval=25,this.intervalId=void 0,this.limit=LIMIT_FILES_DESCRIPTORS,this.queueActive=new Set,this.queueWaiting=new Set,this.init=()=>{this.intervalId||(this.intervalId=setInterval(this.tick,this.interval))},this.reset=()=>{this.intervalId&&(clearInterval(this.intervalId),delete this.intervalId)},this.add=e=>{this.queueWaiting.add(e),this.queueActive.size<this.limit/2?this.tick():this.init()},this.remove=e=>{this.queueWaiting.delete(e),this.queueActive.delete(e)},this.schedule=()=>new Promise((e=>{const t=()=>this.remove(n),n=()=>e(t);this.add(n)})),this.tick=()=>{if(!(this.queueActive.size>=this.limit)){if(!this.queueWaiting.size)return this.reset();for(const e of this.queueWaiting){if(this.queueActive.size>=this.limit)break;this.queueWaiting.delete(e),this.queueActive.add(e),e()}}}}}var RetryfyQueue$1=new RetryfyQueue;const retryifyAsync=(e,t)=>function(n){return function r(...i){return RetryfyQueue$1.schedule().then((o=>e.apply(void 0,i).then((e=>(o(),e)),(e=>{if(o(),Date.now()>=n)throw e;if(t(e)){const e=Math.round(100*Math.random()),t=new Promise((t=>setTimeout(t,e)));return t.then((()=>r.apply(void 0,i)))}throw e}))))}},retryifySync=(e,t)=>function(n){return function r(...i){try{return e.apply(void 0,i)}catch(e){if(Date.now()>n)throw e;if(t(e))return r.apply(void 0,i);throw e}}},FS={attempt:{chmod:attemptifyAsync(promisify(fs$6.chmod),Handlers.onChangeError),chown:attemptifyAsync(promisify(fs$6.chown),Handlers.onChangeError),close:attemptifyAsync(promisify(fs$6.close),NOOP),fsync:attemptifyAsync(promisify(fs$6.fsync),NOOP),mkdir:attemptifyAsync(promisify(fs$6.mkdir),NOOP),realpath:attemptifyAsync(promisify(fs$6.realpath),NOOP),stat:attemptifyAsync(promisify(fs$6.stat),NOOP),unlink:attemptifyAsync(promisify(fs$6.unlink),NOOP),chmodSync:attemptifySync(fs$6.chmodSync,Handlers.onChangeError),chownSync:attemptifySync(fs$6.chownSync,Handlers.onChangeError),closeSync:attemptifySync(fs$6.closeSync,NOOP),existsSync:attemptifySync(fs$6.existsSync,NOOP),fsyncSync:attemptifySync(fs$6.fsync,NOOP),mkdirSync:attemptifySync(fs$6.mkdirSync,NOOP),realpathSync:attemptifySync(fs$6.realpathSync,NOOP),statSync:attemptifySync(fs$6.statSync,NOOP),unlinkSync:attemptifySync(fs$6.unlinkSync,NOOP)},retry:{close:retryifyAsync(promisify(fs$6.close),Handlers.isRetriableError),fsync:retryifyAsync(promisify(fs$6.fsync),Handlers.isRetriableError),open:retryifyAsync(promisify(fs$6.open),Handlers.isRetriableError),readFile:retryifyAsync(promisify(fs$6.readFile),Handlers.isRetriableError),rename:retryifyAsync(promisify(fs$6.rename),Handlers.isRetriableError),stat:retryifyAsync(promisify(fs$6.stat),Handlers.isRetriableError),write:retryifyAsync(promisify(fs$6.write),Handlers.isRetriableError),writeFile:retryifyAsync(promisify(fs$6.writeFile),Handlers.isRetriableError),closeSync:retryifySync(fs$6.closeSync,Handlers.isRetriableError),fsyncSync:retryifySync(fs$6.fsyncSync,Handlers.isRetriableError),openSync:retryifySync(fs$6.openSync,Handlers.isRetriableError),readFileSync:retryifySync(fs$6.readFileSync,Handlers.isRetriableError),renameSync:retryifySync(fs$6.renameSync,Handlers.isRetriableError),statSync:retryifySync(fs$6.statSync,Handlers.isRetriableError),writeSync:retryifySync(fs$6.writeSync,Handlers.isRetriableError),writeFileSync:retryifySync(fs$6.writeFileSync,Handlers.isRetriableError)}},DEFAULT_ENCODING="utf8",DEFAULT_FILE_MODE=438,DEFAULT_FOLDER_MODE=511,DEFAULT_WRITE_OPTIONS={},DEFAULT_USER_UID=os$1.userInfo().uid,DEFAULT_USER_GID=os$1.userInfo().gid,DEFAULT_TIMEOUT_SYNC=1e3,IS_POSIX=!!process$2.getuid;process$2.getuid&&process$2.getuid();const LIMIT_BASENAME_LENGTH=128,isException=e=>e instanceof Error&&"code"in e,isString$1=e=>"string"==typeof e,isUndefined=e=>void 0===e,IS_LINUX="linux"===process$2.platform,IS_WINDOWS="win32"===process$2.platform,Signals=["SIGABRT","SIGALRM","SIGHUP","SIGINT","SIGTERM"];IS_WINDOWS||Signals.push("SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT"),IS_LINUX&&Signals.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT","SIGUNUSED");class Interceptor{constructor(){this.callbacks=new Set,this.exited=!1,this.exit=e=>{if(!this.exited){this.exited=!0;for(const e of this.callbacks)e();e&&(IS_WINDOWS&&"SIGINT"!==e&&"SIGTERM"!==e&&"SIGKILL"!==e?process$2.kill(process$2.pid,"SIGTERM"):process$2.kill(process$2.pid,e))}},this.hook=()=>{process$2.once("exit",(()=>this.exit()));for(const e of Signals)try{process$2.once(e,(()=>this.exit(e)))}catch{}},this.register=e=>(this.callbacks.add(e),()=>{this.callbacks.delete(e)}),this.hook()}}var Interceptor$1=new Interceptor;const whenExit=Interceptor$1.register,Temp={store:{},create:e=>{const t=`000000${Math.floor(16777215*Math.random()).toString(16)}`.slice(-6);return`${e}${`.tmp-${Date.now().toString().slice(-10)}${t}`}`},get:(e,t,n=!0)=>{const r=Temp.truncate(t(e));if(r in Temp.store)return Temp.get(e,t,n);Temp.store[r]=n;return[r,()=>delete Temp.store[r]]},purge:e=>{Temp.store[e]&&(delete Temp.store[e],FS.attempt.unlink(e))},purgeSync:e=>{Temp.store[e]&&(delete Temp.store[e],FS.attempt.unlinkSync(e))},purgeSyncAll:()=>{for(const e in Temp.store)Temp.purgeSync(e)},truncate:e=>{const t=path$1.basename(e);if(t.length<=LIMIT_BASENAME_LENGTH)return e;const n=/^(\.?)(.*?)((?:\.[^.]+)?(?:\.tmp-\d{10}[a-f0-9]{6})?)$/.exec(t);if(!n)return e;const r=t.length-LIMIT_BASENAME_LENGTH;return`${e.slice(0,-t.length)}${n[1]}${n[2].slice(0,-r)}${n[3]}`}};function writeFileSync(e,t,n=DEFAULT_WRITE_OPTIONS){if(isString$1(n))return writeFileSync(e,t,{encoding:n});const r=Date.now()+((n.timeout??DEFAULT_TIMEOUT_SYNC)||-1);let i=null,o=null,s=null;try{const a=FS.attempt.realpathSync(e),c=!!a;e=a||e,[o,i]=Temp.get(e,n.tmpCreate||Temp.create,!(!1===n.tmpPurge));const l=IS_POSIX&&isUndefined(n.chown),u=isUndefined(n.mode);if(c&&(l||u)){const t=FS.attempt.statSync(e);t&&(n={...n},l&&(n.chown={uid:t.uid,gid:t.gid}),u&&(n.mode=t.mode))}if(!c){const t=path$1.dirname(e);FS.attempt.mkdirSync(t,{mode:DEFAULT_FOLDER_MODE,recursive:!0})}s=FS.retry.openSync(r)(o,"w",n.mode||DEFAULT_FILE_MODE),n.tmpCreated&&n.tmpCreated(o),isString$1(t)?FS.retry.writeSync(r)(s,t,0,n.encoding||DEFAULT_ENCODING):isUndefined(t)||FS.retry.writeSync(r)(s,t,0,t.length,0),!1!==n.fsync&&(!1!==n.fsyncWait?FS.retry.fsyncSync(r)(s):FS.attempt.fsync(s)),FS.retry.closeSync(r)(s),s=null,!n.chown||n.chown.uid===DEFAULT_USER_UID&&n.chown.gid===DEFAULT_USER_GID||FS.attempt.chownSync(o,n.chown.uid,n.chown.gid),n.mode&&n.mode!==DEFAULT_FILE_MODE&&FS.attempt.chmodSync(o,n.mode);try{FS.retry.renameSync(r)(o,e)}catch(t){if(!isException(t))throw t;if("ENAMETOOLONG"!==t.code)throw t;FS.retry.renameSync(r)(o,Temp.truncate(e))}i(),o=null}finally{s&&FS.attempt.closeSync(s),o&&Temp.purge(o)}}whenExit(Temp.purgeSyncAll);const isObject$4=e=>{const t=typeof e;return null!==e&&("object"===t||"function"===t)},disallowedKeys=new Set(["__proto__","prototype","constructor"]),digits=new Set("0123456789");function getPathSegments(e){const t=[];let n="",r="start",i=!1;for(const o of e)switch(o){case"\\":if("index"===r)throw new Error("Invalid character in an index");if("indexEnd"===r)throw new Error("Invalid character after an index");i&&(n+=o),r="property",i=!i;break;case".":if("index"===r)throw new Error("Invalid character in an index");if("indexEnd"===r){r="property";break}if(i){i=!1,n+=o;break}if(disallowedKeys.has(n))return[];t.push(n),n="",r="property";break;case"[":if("index"===r)throw new Error("Invalid character in an index");if("indexEnd"===r){r="index";break}if(i){i=!1,n+=o;break}if("property"===r){if(disallowedKeys.has(n))return[];t.push(n),n=""}r="index";break;case"]":if("index"===r){t.push(Number.parseInt(n,10)),n="",r="indexEnd";break}if("indexEnd"===r)throw new Error("Invalid character after an index");default:if("index"===r&&!digits.has(o))throw new Error("Invalid character in an index");if("indexEnd"===r)throw new Error("Invalid character after an index");"start"===r&&(r="property"),i&&(i=!1,n+="\\"),n+=o}switch(i&&(n+="\\"),r){case"property":if(disallowedKeys.has(n))return[];t.push(n);break;case"index":throw new Error("Index was not closed");case"start":t.push("")}return t}function isStringIndex(e,t){if("number"!=typeof t&&Array.isArray(e)){const n=Number.parseInt(t,10);return Number.isInteger(n)&&e[n]===e[t]}return!1}function assertNotStringIndex(e,t){if(isStringIndex(e,t))throw new Error("Cannot use string index")}function getProperty(e,t,n){if(!isObject$4(e)||"string"!=typeof t)return void 0===n?e:n;const r=getPathSegments(t);if(0===r.length)return n;for(let t=0;t<r.length;t++){const i=r[t];if(null==(e=isStringIndex(e,i)?t===r.length-1?void 0:null:e[i])){if(t!==r.length-1)return n;break}}return void 0===e?n:e}function setProperty$1(e,t,n){if(!isObject$4(e)||"string"!=typeof t)return e;const r=e,i=getPathSegments(t);for(let t=0;t<i.length;t++){const r=i[t];assertNotStringIndex(e,r),t===i.length-1?e[r]=n:isObject$4(e[r])||(e[r]="number"==typeof i[t+1]?[]:{}),e=e[r]}return r}function deleteProperty(e,t){if(!isObject$4(e)||"string"!=typeof t)return!1;const n=getPathSegments(t);for(let t=0;t<n.length;t++){const r=n[t];if(assertNotStringIndex(e,r),t===n.length-1)return delete e[r],!0;if(e=e[r],!isObject$4(e))return!1}}function hasProperty(e,t){if(!isObject$4(e)||"string"!=typeof t)return!1;const n=getPathSegments(t);if(0===n.length)return!1;for(const t of n){if(!isObject$4(e)||!(t in e)||isStringIndex(e,t))return!1;e=e[t]}return!0}function getConfigDirectory(e,t){const n=t?path$1.join(e,"config.json"):path$1.join("configstore",`${e}.json`),r=xdgConfig??fs.mkdtempSync(fs.realpathSync(os$1.tmpdir())+path$1.sep);return path$1.join(r,n)}const permissionError="You don't have access to this file.",mkdirOptions={mode:448,recursive:!0},writeFileOptions={mode:384};class Configstore{constructor(e,t,n={}){this._path=n.configPath??getConfigDirectory(e,n.globalConfigPath),t&&(this.all={...t,...this.all})}get all(){try{return JSON.parse(fs.readFileSync(this._path,"utf8"))}catch(e){if("ENOENT"===e.code)return{};if("EACCES"===e.code&&(e.message=`${e.message}\n${permissionError}\n`),"SyntaxError"===e.name)return writeFileSync(this._path,"",writeFileOptions),{};throw e}}set all(e){try{fs.mkdirSync(path$1.dirname(this._path),mkdirOptions),writeFileSync(this._path,JSON.stringify(e,void 0,"\t"),writeFileOptions)}catch(e){throw"EACCES"===e.code&&(e.message=`${e.message}\n${permissionError}\n`),e}}get size(){return Object.keys(this.all||{}).length}get(e){return getProperty(this.all,e)}set(e,t){const n=this.all;if(1===arguments.length)for(const t of Object.keys(e))setProperty$1(n,t,e[t]);else setProperty$1(n,e,t);this.all=n}has(e){return hasProperty(this.all,e)}delete(e){const t=this.all;deleteProperty(t,e),this.all=t}clear(){this.all={}}get path(){return this._path}}const configstore=new Configstore(`${pkg.name}-${process.env.NODE_ENV||"production"}${process.env.VITEST_POOL_ID||""}${process.env.VITEST_WORKER_ID||""}`);var semverExports=requireSemver(),semver=getDefaultExportFromCjs(semverExports);const debugPackage=debugModule("rdme");function debug(e){return isGHA()&&!isTest()&&("object"==typeof e?coreExports.debug(`rdme: ${JSON.stringify(e)}`):coreExports.debug(`rdme: ${e}`)),debugPackage(e)}function error(e){return isGHA()&&!isTest()?coreExports.error(e):console.error(chalk.red(e))}function info(e,t={includeEmojiPrefix:!0}){return isGHA()&&!isTest()?coreExports.notice(e):t.includeEmojiPrefix?console.info(`ℹ️ ${e}`):console.info(e)}function oraOptions(){const e={isSilent:isTest()};return debugPackage.enabled&&(e.isEnabled=!1),e}function warn(e,t="Warning!"){return isGHA()&&!isTest()?coreExports.warning(e):console.warn(chalk.yellow(`⚠️ ${t} ${e}`))}const registryUrl="https://registry.npmjs.com/rdme";async function getPkgVersion(e){return e?fetch(registryUrl).then((e=>e.json())).then((t=>t["dist-tags"][e])).catch((e=>(error(`error fetching version from npm registry: ${e.message}`),pkg.version))):this?.config?.version||pkg.version}async function getMajorPkgVersion(e){return semver.major(await getPkgVersion.call(this,e))}async function promptTerminal(e,t){function n(){isCI()&&(process.stdout.write("\n"),process.stdout.write("Yikes! Looks like we were about to prompt you for something in a CI environment. Are you missing an argument?"),process.stdout.write("\n\n"),process.stdout.write("Try running `rdme <command> --help` or get in touch at support@readme.io."),process.stdout.write("\n\n"),process.exit(1))}return Array.isArray(e)?e=e.map((e=>({onRender:n,...e}))):e.onRender=n,prompts(e,{onCancel:()=>{process.stdout.write("\n"),process.stdout.write("Thanks for using rdme! See you soon ✌️"),process.stdout.write("\n\n"),process.exit(1)},...t})}const cleanFileName=e=>e.replace(/[^a-z0-9]/gi,"-");function validateFilePath(e,t=e=>e){if(e.length){const n=t(e);return!fs$6.existsSync(n)||"Specified output path already exists."}return"An output path must be supplied."}function validateSubdomain(e){return/^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*$/.test(e)||"Project subdomain must contain only letters, numbers and dashes."}const yamlBase="# This GitHub Actions workflow was auto-generated by the `rdme` cli on {{timestamp}}\n# You can view our full documentation here: https://docs.readme.com/docs/rdme\nname: ReadMe GitHub Action 🦉\n\non:\n push:\n branches:\n # This workflow will run every time you push code to the following branch: `{{branch}}`\n # Check out GitHub's docs for more info on configuring this:\n # https://docs.github.com/actions/using-workflows/events-that-trigger-workflows\n - {{branch}}\n\njobs:\n rdme-{{cleanCommand}}:\n runs-on: ubuntu-latest\n steps:\n - name: Check out repo 📚\n uses: actions/checkout@v4\n\n - name: Run `{{command}}` command 🚀\n uses: readmeio/rdme@{{rdmeVersion}}\n with:\n rdme: {{commandString}}\n",getConfigStoreKey=e=>`createGHA.${e}`,GITHUB_WORKFLOW_DIR=".github/workflows",GITHUB_SECRET_NAME="README_API_KEY",git=simpleGit(),getGHAFileName=e=>path$1.join(GITHUB_WORKFLOW_DIR,`${cleanFileName(e).toLowerCase()}.yml`);function getKey$1(e,t){return!!Object.keys(e).some((e=>"key"===e))&&`••••••••••••${t.key?.slice(-5)||""}`}function constructCommandString(e,t,n,r){return`${e} ${Object.keys(t).map((e=>r[e])).filter(Boolean).join(" ")} ${Object.keys(n).map((e=>{const t=r[e];return"key"===e?`--key=\${{ secrets.${GITHUB_SECRET_NAME} }}`:"github"!==e&&("boolean"===n[e].type&&t?`--${e}`:!!t&&`--${e}=${t}`)})).filter(Boolean).join(" ")}`.trim()}async function getGitData(){const e=/^ {2}HEAD branch: /g,t=/^ {2}HEAD branch:.*/gm,n=await git.checkIsRepo().catch((e=>(this.debug(`[getGitData] error running git repo check: ${e.message}`),!1)));let r,i;this.debug(`[getGitData] isRepo result: ${n}`);const o=await git.remote([]).catch((e=>(this.debug(`[getGitData] error grabbing git remotes: ${e.message}`),"")));if(this.debug(`[getGitData] rawRemotes result: ${o}`),o){const n=o.split("\n")[0];this.debug(`[getGitData] remote result: ${n}`);const s=await git.remote(["show",n]).catch((e=>(this.debug(`[getGitData] error accessing remote: ${e.message}`),"")));this.debug(`[getGitData] rawRemote result: ${s}`);const a=t.exec(s)?.[0];this.debug(`[getGitData] rawHead result: ${a}`),a&&(i=a.replace(e,""));const c=await git.remote(["-v"]);this.debug(`[getGitData] remotesList result: ${c}`),r=/github/.test(c)}this.debug(`[getGitData] containsGitHubRemote result: ${r}`),this.debug(`[getGitData] defaultBranch result: ${i}`);const s=await git.revparse(["--show-toplevel"]).catch((e=>(this.debug(`[getGitData] error grabbing git root: ${e.message}`),"")));return this.debug(`[getGitData] repoRoot result: ${s}`),{containsGitHubRemote:r,defaultBranch:i,isRepo:n,repoRoot:s}}async function createGHA(e,t,n){const{args:r,flags:i,id:o}=t;if(!o)throw new Error("unable to determine command ID yikes");if(this.debug(`running GHA onboarding for ${o} command`),this.debug(`opts used in createGHA: ${JSON.stringify(n)}`),!n.github&&(isCI()||isNpmScript()||isTest()&&!process.env.TEST_RDME_CREATEGHA))return this.debug("not running GHA onboarding workflow in CI, npm script, or default test env, exiting 👋"),e;const{containsGitHubRemote:s,defaultBranch:a,isRepo:c,repoRoot:l}=await getGitData.call(this),u=configstore.get(getConfigStoreKey(l));this.debug(`repo value in config: ${u}`);const d=await getMajorPkgVersion.call(this);if(this.debug(`major pkg version: ${d}`),!n.github&&(!c||u===d||c&&!s))return this.debug("not running GHA onboarding workflow, exiting"),e;e&&info(e,{includeEmojiPrefix:!1}),n.github?info(chalk.bold("\n🚀 Let's get you set up with GitHub Actions! 🚀\n"),{includeEmojiPrefix:!1}):info(["",chalk.bold("🐙 Looks like you're running this command in a GitHub Repository! 🐙"),"",`🚀 With a few quick clicks, you can run this \`${o}\` command via GitHub Actions (${chalk.underline("https://github.com/features/actions")})`,"",`✨ This means it will run ${chalk.italic("automagically")} with every push to a branch of your choice!`,""].join("\n"),{includeEmojiPrefix:!1});const p=process.cwd();l&&l!==p&&(process.chdir(l),this.debug(`switching working directory from ${p} to ${process.cwd()}`)),prompts.override({shouldCreateGHA:n.github});const{branch:f,filePath:_,shouldCreateGHA:m}=await promptTerminal([{message:"Would you like to add a GitHub Actions workflow?",name:"shouldCreateGHA",type:"confirm",initial:!0},{message:"What GitHub branch should this workflow run on?",name:"branch",type:"text",initial:a||"main"},{message:"What would you like to name the GitHub Actions workflow file?",name:"filePath",type:"text",initial:cleanFileName(`rdme-${o}`),format:e=>getGHAFileName(e),validate:e=>validateFilePath(e,getGHAFileName)}],{onSubmit:(e,t,n)=>!n.shouldCreateGHA});if(!m)throw configstore.set(getConfigStoreKey(l),d),new Error("GitHub Actions workflow creation cancelled. If you ever change your mind, you can run this command again with the `--github` flag.");const h={branch:f,cleanCommand:cleanFileName(o),command:o,commandString:constructCommandString(o,r,i,n),rdmeVersion:`v${d}`,timestamp:(new Date).toISOString()};this.debug(`data for resolver: ${JSON.stringify(h)}`);let g=yamlBase;Object.keys(h).forEach((e=>{g=g.replace(new RegExp(`{{${e}}}`,"g"),h[e])})),fs$6.existsSync(GITHUB_WORKFLOW_DIR)||(this.debug("GHA workflow directory does not exist, creating"),fs$6.mkdirSync(GITHUB_WORKFLOW_DIR,{recursive:!0})),fs$6.writeFileSync(_,g);const A=[chalk.green("\nYour GitHub Actions workflow file has been created! ✨\n")],y=getKey$1(i,n);return y?A.push(chalk.bold("Almost done! Just a couple more steps:"),`1. Push your newly created file (${chalk.underline(_)}) to GitHub 🚀`,`2. Create a GitHub secret called ${chalk.bold(GITHUB_SECRET_NAME)} and populate the value with your ReadMe API key (${y}) 🔑`,"",`🔐 Check out GitHub's docs for more info on creating encrypted secrets (${chalk.underline("https://docs.github.com/actions/security-guides/encrypted-secrets#creating-encrypted-secrets-for-a-repository")})`):A.push(`${chalk.bold("Almost done!")} Push your newly created file (${chalk.underline(_)}) to GitHub and you're all set 🚀`),A.push("",`🦉 If you have any more questions, feel free to drop us a line! ${chalk.underline("support@readme.io")}`,""),Promise.resolve(A.join("\n"))}const SUCCESS_NO_CONTENT=204;function getProxy(){return process.env.HTTPS_PROXY||process.env.https_proxy}function stripQuotes(e){return e?e.replace(/(^"|[",]*$)/g,""):""}function parseWarningHeader(e){try{let t;return e.split(/([0-9]{3} [a-z0-9.@\-/]*) /g).reduce(((e,n)=>{const r=(n=n.trim()).match(/^([0-9]{3}) (.*)/);if(r)t={code:r[1],agent:r[2],message:""};else if(n){const r=n.split(/" "/);r&&(t.message=stripQuotes(r[0]),t.date=stripQuotes(r[1]),e.push(t))}return e}),[])}catch(t){return debug(`error parsing warning header: ${t.message}`),[{code:"199",agent:"-",message:e}]}}function getUserAgent(){return`rdme${isGHA()?"-github":""}/${pkg.version}`}async function normalizeFilePath(e){if("path"===e.fileType){const t=await git.revparse(["--show-toplevel"]).catch((e=>(debug(`[fetch] error grabbing git root: ${e.message}`),"")));return path$1.relative(t,e.filePath)}return e.filePath}function sanitizeHeaders(e){const t=Array.from(e.entries()).reduce(((e,t)=>(e[t[0]]="authorization"===t[0].toLowerCase()?"redacted":t[1],e)),{});return JSON.stringify(t)}async function readmeAPIv1Fetch(e,t={headers:new Headers},n={filePath:"",fileType:!1}){let r="cli",i=t.headers;if(t.headers instanceof Headers||(i=new Headers(t.headers)),i.set("User-Agent",getUserAgent()),isGHA()){r="cli-gh",process.env.GITHUB_REPOSITORY&&i.set("x-github-repository",process.env.GITHUB_REPOSITORY),process.env.GITHUB_RUN_ATTEMPT&&i.set("x-github-run-attempt",process.env.GITHUB_RUN_ATTEMPT),process.env.GITHUB_RUN_ID&&i.set("x-github-run-id",process.env.GITHUB_RUN_ID),process.env.GITHUB_RUN_NUMBER&&i.set("x-github-run-number",process.env.GITHUB_RUN_NUMBER),process.env.GITHUB_SHA&&i.set("x-github-sha",process.env.GITHUB_SHA);const e=await normalizeFilePath(n);if(e)try{const t=new URL(`${process.env.GITHUB_SERVER_URL}/${process.env.GITHUB_REPOSITORY}/blob/${process.env.GITHUB_SHA}/${e}`).href;i.set("x-readme-source-url",t)}catch(e){debug(`error constructing github source url: ${e.message}`)}}isCI()&&i.set("x-rdme-ci",ciName()),i.set("x-readme-source",r),n.filePath&&"url"===n.fileType&&i.set("x-readme-source-url",n.filePath);const o=`${config.host}${e}`,s=getProxy();return debug(`making ${(t.method||"get").toUpperCase()} request to ${o} ${s?`with proxy ${s} and `:""}with headers: ${sanitizeHeaders(i)}`),fetch(o,{...t,headers:i,dispatcher:s?new undiciExports.ProxyAgent(s):void 0}).then((e=>{const t=e.headers.get("Warning");if(t){debug(`received warning header: ${t}`);parseWarningHeader(t).forEach((e=>{warn(e.message,"ReadMe API Warning:")}))}return e})).catch((e=>{throw debug(`error making fetch request: ${e}`),e}))}async function handleAPIv1Res(e,t=!0){const n=e.headers.get("content-type")||"";if("json"===mime.extension(n)){const n=await e.json();return debug(`received status code ${e.status} from ${e.url} with JSON response: ${JSON.stringify(n)}`),n.error&&t?Promise.reject(new APIv1Error(n)):n}if(e.status===SUCCESS_NO_CONTENT)return debug(`received status code ${e.status} from ${e.url} with no content`),{};const r=await e.text();return debug(`received status code ${e.status} from ${e.url} with non-JSON response: ${r}`),Promise.reject(r)}function cleanAPIv1Headers(e,t,n=new Headers){const r=Buffer.from(`${e}:`).toString("base64"),i=new Headers({Authorization:`Basic ${r}`});t&&i.set("x-readme-version",t);for(const e of n.entries())"null"!==e[1]&&"undefined"!==e[1]&&e[1].length>0&&i.set(e[0],e[1]);return i}async function getCategories(e,t){const{firstPage:n,totalCount:r}=await async function(){let n=0;return readmeAPIv1Fetch("/api/v1/categories?perPage=20&page=1",{method:"get",headers:cleanAPIv1Headers(e,t,new Headers({Accept:"application/json"}))}).then((e=>(n=Math.ceil(parseInt(e.headers.get("x-total-count")||"0",10)/20),handleAPIv1Res(e)))).then((e=>({firstPage:e,totalCount:n})))}();return n.concat(...await Promise.all([...new Array(r+1).keys()].slice(2).map((async n=>readmeAPIv1Fetch(`/api/v1/categories?perPage=20&page=${n}`,{method:"get",headers:cleanAPIv1Headers(e,t,new Headers({Accept:"application/json"}))}).then(handleAPIv1Res)))))}async function getProjectVersion(e,t,n=!1){try{if(e)return await readmeAPIv1Fetch(`/api/v1/version/${e}`,{method:"get",headers:cleanAPIv1Headers(t)}).then(handleAPIv1Res).then((e=>e.version));if(isCI())return void warn("No `--version` parameter detected in current CI environment. Defaulting to main version.");const r=await readmeAPIv1Fetch("/api/v1/version",{method:"get",headers:cleanAPIv1Headers(t)}).then(handleAPIv1Res);if(1===r.length)return r[0].version;if(n){const e=r.find((e=>!0===e.is_stable));if(!e)throw new Error("Unexpected version response from the ReadMe API. Get in touch with us at support@readme.io!");return e.version}const{versionSelection:i}=await promptTerminal({type:"select",name:"versionSelection",message:"Select your desired version",choices:r.map((e=>({title:e.version,value:e.version})))});return i}catch(e){return Promise.reject(new APIv1Error(e))}}class CategoriesCreateCommand extends BaseCommand{static id="categories create";static state="deprecated";static deprecationOptions={message:`\`rdme ${this.id}\` is deprecated and will be removed in v10. For more information, please visit our migration guide: https://github.com/readmeio/rdme/tree/v9/documentation/migration-guide.md`};static description="Create a category with the specified title and guide in your ReadMe project.";static args={title:libExports$3.Args.string({description:"Title of the category",required:!0})};static flags={categoryType:libExports$3.Flags.option({description:"Category type",options:["guide","reference"],required:!0})(),key:keyFlag,preventDuplicates:libExports$3.Flags.boolean({description:"Prevents the creation of a new category if there is an existing category with a matching `categoryType` and `title`"}),version:versionFlag};static examples=[{description:"Create a new category for your project version:",command:"<%= config.bin %> <%= command.id %> <title> --categoryType={guide|reference} --version={project-version}"},{description:"If you want to prevent the creation of a duplicate category with a matching `title` and `categoryType`, supply the `--preventDuplicates` flag:",command:"<%= config.bin %> <%= command.id %> <title> --categoryType={guide|reference} --version={project-version} --preventDuplicates"}];async run(){const{title:e}=this.args,{categoryType:t,key:n,version:r,preventDuplicates:i}=this.flags,o=await getProjectVersion(r,n);if(this.debug(`selectedVersion: ${o}`),i){const r=(await getCategories(n,o)).find((n=>n.title.trim().toLowerCase()===e.trim().toLowerCase()&&n.type===t));if(void 0!==r)return Promise.reject(new Error(`The '${r.title}' category with a type of '${r.type}' already exists with an id of '${r.id}'. A new category was not created.`))}const s=await readmeAPIv1Fetch("/api/v1/categories",{method:"post",headers:cleanAPIv1Headers(n,o,new Headers({"Content-Type":"application/json"})),body:JSON.stringify({title:e,type:t})}).then(handleAPIv1Res).then((e=>`🌱 successfully created '${e.title}' with a type of '${e.type}' and an id of '${e.id}'`));return Promise.resolve(chalk.green(s))}}class CategoriesCommand extends BaseCommand{static id="categories";static state="deprecated";static deprecationOptions={message:`\`rdme ${this.id}\` is deprecated and will be removed in v10. For more information, please visit our migration guide: https://github.com/readmeio/rdme/tree/v9/documentation/migration-guide.md`};static description="Get all categories in your ReadMe project.";static flags={key:keyFlag,version:versionFlag};static examples=[{description:"Get all categories associated to your project version:",command:"<%= config.bin %> <%= command.id %> --version={project-version}"}];async run(){const{key:e,version:t}=this.flags,n=await getProjectVersion(t,e);this.debug(`selectedVersion: ${n}`);const r=await getCategories(e,n);return Promise.resolve(JSON.stringify(r,null,2))}}var toposort$1={exports:{}},hasRequiredToposort;function requireToposort(){if(hasRequiredToposort)return toposort$1.exports;function e(e,t){var n=e.length,r=new Array(n),i={},o=n,s=function(e){for(var t=new Map,n=0,r=e.length;n<r;n++){var i=e[n];t.has(i[0])||t.set(i[0],new Set),t.has(i[1])||t.set(i[1],new Set),t.get(i[0]).add(i[1])}return t}(t),a=function(e){for(var t=new Map,n=0,r=e.length;n<r;n++)t.set(e[n],n);return t}(e);for(t.forEach((function(e){if(!a.has(e[0])||!a.has(e[1]))throw new Error("Unknown node. There is an unknown node in the supplied edges.")}));o--;)i[o]||c(e[o],o,new Set);return r;function c(e,t,o){if(o.has(e)){var l;try{l=", node was:"+JSON.stringify(e)}catch(e){l=""}throw new Error("Cyclic dependency"+l)}if(!a.has(e))throw new Error("Found unknown node. Make sure to provided all involved nodes. Unknown node: "+JSON.stringify(e));if(!i[t]){i[t]=!0;var u=s.get(e)||new Set;if(t=(u=Array.from(u)).length){o.add(e);do{var d=u[--t];c(d,a.get(d),o)}while(t);o.delete(e)}r[--n]=e}}}return hasRequiredToposort=1,toposort$1.exports=function(t){return e(function(e){for(var t=new Set,n=0,r=e.length;n<r;n++){var i=e[n];t.add(i[0]),t.add(i[1])}return Array.from(t)}(t),t)},toposort$1.exports.array=e,toposort$1.exports}var toposortExports=requireToposort(),toposort=getDefaultExportFromCjs(toposortExports),ignore$1,hasRequiredIgnore;function requireIgnore(){if(hasRequiredIgnore)return ignore$1;function e(e){return Array.isArray(e)?e:[e]}hasRequiredIgnore=1;const t=/^\s+$/,n=/(?:[^\\]|^)\\$/,r=/^\\!/,i=/^\\#/,o=/\r?\n/g,s=/^\.*\/|^\.+$/;let a="node-ignore";"undefined"!=typeof Symbol&&(a=Symbol.for("node-ignore"));const c=a,l=/([0-z])-([0-z])/g,u=()=>!1,d=[[/^\uFEFF/,()=>""],[/((?:\\\\)*?)(\\?\s+)$/,(e,t,n)=>t+(0===n.indexOf("\\")?" ":"")],[/(\\+?)\s/g,(e,t)=>{const{length:n}=t;return t.slice(0,n-n%2)+" "}],[/[\\$.|*+(){^]/g,e=>`\\${e}`],[/(?!\\)\?/g,()=>"[^/]"],[/^\//,()=>"^"],[/\//g,()=>"\\/"],[/^\^*\\\*\\\*\\\//,()=>"^(?:.*\\/)?"],[/^(?=[^^])/,function(){return/\/(?!$)/.test(this)?"^":"(?:^|\\/)"}],[/\\\/\\\*\\\*(?=\\\/|$)/g,(e,t,n)=>t+6<n.length?"(?:\\/[^\\/]+)*":"\\/.+"],[/(^|[^\\]+)(\\\*)+(?=.+)/g,(e,t,n)=>t+n.replace(/\\\*/g,"[^\\/]*")],[/\\\\\\(?=[$.|*+(){^])/g,()=>"\\"],[/\\\\/g,()=>"\\"],[/(\\)?\[([^\]/]*?)(\\*)($|\])/g,(e,t,n,r,i)=>"\\"===t?`\\[${n}${(e=>{const{length:t}=e;return e.slice(0,t-t%2)})(r)}${i}`:"]"===i&&r.length%2==0?`[${(e=>e.replace(l,((e,t,n)=>t.charCodeAt(0)<=n.charCodeAt(0)?e:"")))(n)}${r}]`:"[]"],[/(?:[^*])$/,e=>/\/$/.test(e)?`${e}$`:`${e}(?=$|\\/$)`],[/(\^|\\\/)?\\\*$/,(e,t)=>`${t?`${t}[^/]+`:"[^/]*"}(?=$|\\/$)`]],p=Object.create(null),f=e=>"string"==typeof e;class _{constructor(e,t,n,r){this.origin=e,this.pattern=t,this.negative=n,this.regex=r}}const m=(e,t)=>{const n=e;let o=!1;0===e.indexOf("!")&&(o=!0,e=e.substr(1));const s=((e,t)=>{let n=p[e];return n||(n=d.reduce(((t,[n,r])=>t.replace(n,r.bind(e))),e),p[e]=n),t?new RegExp(n,"i"):new RegExp(n)})(e=e.replace(r,"!").replace(i,"#"),t);return new _(n,e,o,s)},h=(e,t)=>{throw new t(e)},g=(e,t,n)=>{if(!f(e))return n(`path must be a string, but got \`${t}\``,TypeError);if(!e)return n("path must not be empty",TypeError);if(g.isNotRelative(e)){return n(`path should be a ${"`path.relative()`d"} string, but got "${t}"`,RangeError)}return!0},A=e=>s.test(e);g.isNotRelative=A,g.convert=e=>e;class y{constructor({ignorecase:e=!0,ignoreCase:t=e,allowRelativePaths:n=!1}={}){var r,i,o;r=this,i=c,o=!0,Object.defineProperty(r,i,{value:o}),this._rules=[],this._ignoreCase=t,this._allowRelativePaths=n,this._initCache()}_initCache(){this._ignoreCache=Object.create(null),this._testCache=Object.create(null)}_addPattern(e){if(e&&e[c])return this._rules=this._rules.concat(e._rules),void(this._added=!0);if((e=>e&&f(e)&&!t.test(e)&&!n.test(e)&&0!==e.indexOf("#"))(e)){const t=m(e,this._ignoreCase);this._added=!0,this._rules.push(t)}}add(t){return this._added=!1,e(f(t)?(e=>e.split(o))(t):t).forEach(this._addPattern,this),this._added&&this._initCache(),this}addPattern(e){return this.add(e)}_testOne(e,t){let n=!1,r=!1;return this._rules.forEach((i=>{const{negative:o}=i;if(r===o&&n!==r||o&&!n&&!r&&!t)return;i.regex.test(e)&&(n=!o,r=o)})),{ignored:n,unignored:r}}_test(e,t,n,r){const i=e&&g.convert(e);return g(i,e,this._allowRelativePaths?u:h),this._t(i,t,n,r)}_t(e,t,n,r){if(e in t)return t[e];if(r||(r=e.split("/")),r.pop(),!r.length)return t[e]=this._testOne(e,n);const i=this._t(r.join("/")+"/",t,n,r);return t[e]=i.ignored?i:this._testOne(e,n)}ignores(e){return this._test(e,this._ignoreCache,!1).ignored}createFilter(){return e=>!this.ignores(e)}filter(t){return e(t).filter(this.createFilter())}test(e){return this._test(e,this._testCache,!0)}}const v=e=>new y(e);if(v.isPathValid=e=>g(e&&g.convert(e),e,u),v.default=v,ignore$1=v,"undefined"!=typeof process&&(process.env&&process.env.IGNORE_TEST_WIN32||"win32"===process.platform)){const e=e=>/^\\\\\?\\/.test(e)||/["<>|\u0000-\u001F]+/u.test(e)?e:e.replace(/\\/g,"/");g.convert=e;const t=/^[a-z]:\//i;g.isNotRelative=e=>t.test(e)||A(e)}return ignore$1}var ignoreExports=requireIgnore(),ignore=getDefaultExportFromCjs(ignoreExports),kindOf,hasRequiredKindOf,isExtendable,hasRequiredIsExtendable,extendShallow,hasRequiredExtendShallow,sectionMatter,hasRequiredSectionMatter;function readdirRecursive(e,t=!1){let n;debug(`current readdirRecursive folder: ${e}`),t&&(n=ignore.default().add(path$1.join(e,".git/")),fs$6.existsSync(path$1.join(e,".gitignore"))&&(debug(".gitignore file found, adding to ignore filter"),n.add(fs$6.readFileSync(path$1.join(e,".gitignore")).toString())));const r=fs$6.readdirSync(e,{withFileTypes:!0}).filter((r=>{if(!t)return!0;let i=path$1.join(e,r.name);return r.isDirectory()&&(i=`${i}/`),!n.ignores(i)})),i=r.filter((e=>e.isFile())).map((t=>path$1.join(e,t.name))),o=r.filter((e=>e.isDirectory()));return[...i,...[].concat(...o.map((n=>readdirRecursive(path$1.join(e,n.name),t))))]}function requireKindOf(){if(hasRequiredKindOf)return kindOf;hasRequiredKindOf=1;var e=Object.prototype.toString;function t(e){return"function"==typeof e.constructor?e.constructor.name:null}return kindOf=function(n){if(void 0===n)return"undefined";if(null===n)return"null";var r=typeof n;if("boolean"===r)return"boolean";if("string"===r)return"string";if("number"===r)return"number";if("symbol"===r)return"symbol";if("function"===r)return function(e){return"GeneratorFunction"===t(e)}(n)?"generatorfunction":"function";if(function(e){return Array.isArray?Array.isArray(e):e instanceof Array}(n))return"array";if(function(e){if(e.constructor&&"function"==typeof e.constructor.isBuffer)return e.constructor.isBuffer(e);return!1}(n))return"buffer";if(function(e){try{if("number"==typeof e.length&&"function"==typeof e.callee)return!0}catch(e){if(-1!==e.message.indexOf("callee"))return!0}return!1}(n))return"arguments";if(function(e){return e instanceof Date||"function"==typeof e.toDateString&&"function"==typeof e.getDate&&"function"==typeof e.setDate}(n))return"date";if(function(e){return e instanceof Error||"string"==typeof e.message&&e.constructor&&"number"==typeof e.constructor.stackTraceLimit}(n))return"error";if(function(e){return e instanceof RegExp||"string"==typeof e.flags&&"boolean"==typeof e.ignoreCase&&"boolean"==typeof e.multiline&&"boolean"==typeof e.global}(n))return"regexp";switch(t(n)){case"Symbol":return"symbol";case"Promise":return"promise";case"WeakMap":return"weakmap";case"WeakSet":return"weakset";case"Map":return"map";case"Set":return"set";case"Int8Array":return"int8array";case"Uint8Array":return"uint8array";case"Uint8ClampedArray":return"uint8clampedarray";case"Int16Array":return"int16array";case"Uint16Array":return"uint16array";case"Int32Array":return"int32array";case"Uint32Array":return"uint32array";case"Float32Array":return"float32array";case"Float64Array":return"float64array"}if(function(e){return"function"==typeof e.throw&&"function"==typeof e.return&&"function"==typeof e.next}(n))return"generator";switch(r=e.call(n)){case"[object Object]":return"object";case"[object Map Iterator]":return"mapiterator";case"[object Set Iterator]":return"setiterator";case"[object String Iterator]":return"stringiterator";case"[object Array Iterator]":return"arrayiterator"}return r.slice(8,-1).toLowerCase().replace(/\s/g,"")},kindOf} /*! * is-extendable <https://github.com/jonschlinkert/is-extendable> * diff --git a/package-lock.json b/package-lock.json index 8b13deecf..cb390d2eb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "rdme", - "version": "9.0.0", + "version": "9.0.1-next.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "rdme", - "version": "9.0.0", + "version": "9.0.1-next.1", "license": "MIT", "dependencies": { "@actions/core": "^1.6.0", diff --git a/package.json b/package.json index ef199da1a..4e3a510b8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "rdme", - "version": "9.0.0", + "version": "9.0.1-next.1", "description": "ReadMe's official CLI and GitHub Action.", "license": "MIT", "author": "ReadMe <support@readme.io> (https://readme.com)",