cmetrix
Version:
CLI to build code metrics charts for your projects
2 lines • 300 kB
JavaScript
/*! For license information please see main.js.LICENSE.txt */
(()=>{var t={141:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(3101);class o{constructor(t,e){this.value=t,this.name=e}toBePresent(){if(n.is(this.value).absent())throw new Error(`${this.name} must be present`);return this}toBeAbsent(){if(n.is(this.value).present())throw new Error(`${this.name} must be absent`);return this}toBeAString(){if(n.is(this.value).present()&&!n.is(this.value).aString())throw new Error(`${this.name} must be a string`);return this}toBeABoolean(){if(n.is(this.value).present()&&!n.is(this.value).aBoolean())throw new Error(`${this.name} must be a boolean`);return this}toBeANumber(){if(n.is(this.value).present()&&!n.is(this.value).aNumber())throw new Error(`${this.name} must be a number`);return this}toBeADate(){if(n.is(this.value).present()&&!n.is(this.value).aDate())throw new Error(`${this.name} must be a date`);return this}toBeAFunction(){if(n.is(this.value).present()&&!n.is(this.value).aFunction())throw new Error(`${this.name} must be a function`);return this}toBeAnArray(){if(n.is(this.value).present()&&!n.is(this.value).anArray())throw new Error(`${this.name} must be an array`);return this}toBeAnObject(){if(n.is(this.value).present()&&!n.is(this.value).anObject())throw new Error(`${this.name} must be an object`);return this}}e.Assert=o,e.assert=function(t,e="value"){return new o(t,e)}},3061:(t,e,r)=>{"use strict";function n(t){for(var r in t)e.hasOwnProperty(r)||(e[r]=t[r])}Object.defineProperty(e,"__esModule",{value:!0}),n(r(141)),n(r(3101))},3101:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});class r{constructor(t){this.value=t}present(){return!this.absent()}absent(){return null===this.value||void 0===this.value}aString(){return"string"==typeof this.value}aBoolean(){return"boolean"==typeof this.value}aNumber(){return"number"==typeof this.value&&!Number.isNaN(this.value)}aDate(){return"[object Date]"===Object.prototype.toString.call(this.value)}aFunction(){return"function"==typeof this.value}anArray(){return Array.isArray(this.value)}anObject(){return"object"==typeof this.value}}e.Is=r,e.is=function(t){return new r(t)}},7701:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.basename=function(t){return t?function(t){const e=t.lastIndexOf(".");return 0===e||-1===e?t:t.substring(0,e)}(function(t){const e=t.replace("\\","/").split("/");return e[e.length-1]}(t)):""}},6751:(t,e,r)=>{"use strict";function n(t){for(var r in t)e.hasOwnProperty(r)||(e[r]=t[r])}Object.defineProperty(e,"__esModule",{value:!0}),n(r(6866)),n(r(4805));const o=r(4805);e.logger=o.createLogger()},6866:(t,e)=>{"use strict";var r;Object.defineProperty(e,"__esModule",{value:!0}),function(t){t.all="all",t.debug="debug",t.info="info",t.warn="warn",t.error="error",t.off="off"}(r=e.Level||(e.Level={})),e.levels={[r.all]:{priority:1},[r.debug]:{priority:2,log:t=>t.debug||t.log},[r.info]:{priority:3,log:t=>t.log},[r.warn]:{priority:4,log:t=>t.warn||t.log},[r.error]:{priority:5,log:t=>t.error||t.log},off:{priority:6}}},4805:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(3061),o=r(7701),i=r(6866),s={level:process.env.LOG_LEVEL||i.Level.info,category:"default",filter:process.env.LOG_FILTER||".*",console,getDateString:()=>(new Date).toISOString(),getLogInputs:function(t){const{date:e,category:r,level:n,args:o}=t;return[`${e?`${e} - `:""}${n}: [${r}]`].concat(o)}};e.createLogger=(t={})=>{!function(){if(n.assert(t.level,"level").toBeAString(),void 0!==t.level&&void 0===i.levels[t.level])throw new Error(`level ${t.level} is invalid, pick one in [${Object.keys(i.levels)}]`);n.assert(t.category,"options#category").toBeAString(),n.assert(t.filter,"options#filter").toBeAString(),n.assert(t.fileName,"options#fileName").toBeAString(),void 0!==t.console&&(n.assert(t.console.log,"options#console#log").toBeAFunction(),n.assert(t.console.warn,"options#console#warn").toBeAFunction(),n.assert(t.console.error,"options#console#error").toBeAFunction()),null!==t.getDateString&&n.assert(t.getDateString,"getDateString").toBeAFunction(),n.assert(t.getLogInputs,"getLogInputs").toBeAFunction()}();const e=Object.assign({},s,t,t.fileName?{category:o.basename(t.fileName)}:{}),r=i.levels[e.level],a=new RegExp(e.filter).test(e.category);return Object.entries(i.levels).reduce(((t,[e,r])=>Object.assign(t,r.log?{[e]:c(e,r)}:{})),{});function c(t,n){if(r.priority<=n.priority&&a){const r=n.log(e.console);return(...n)=>{const o=e.getLogInputs({date:null!==e.getDateString?e.getDateString():"",category:e.category,level:t,args:n});r(...o)}}return()=>{}}}},1106:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.autoCurry=void 0,e.autoCurry=function(t){return function e(...r){return r.length>=t.length?t(...r):(...t)=>e(...r,...t)}}},8846:function(t,e,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(t,e,r,n){void 0===n&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]}),o=this&&this.__exportStar||function(t,e){for(var r in t)"default"===r||Object.prototype.hasOwnProperty.call(e,r)||n(e,t,r)};Object.defineProperty(e,"__esModule",{value:!0}),o(r(5807),e),o(r(9642),e)},3515:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.compose=void 0;const n=r(1344);e.compose=function(t=[]){return 0===t.length?t=>Promise.resolve(t):1===t.length?n.wrap(t[0]):(...e)=>new Promise(((r,o)=>{let i=0;!function e(...s){if(i===t.length){const[t]=s;r(t)}else{const r=t.length-i-1;n.wrap(t[r])(...s).then((t=>{i++,e(t)})).catch((t=>{o(t)}))}}(...e)}))}},801:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.delay=void 0;const n=r(1106).autoCurry((function(t,e){return(...r)=>new Promise((e=>setTimeout(e,t))).then((()=>e(...r)))}));e.delay=function(...t){return n(...t)}},5807:function(t,e,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(t,e,r,n){void 0===n&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]}),o=this&&this.__exportStar||function(t,e){for(var r in t)"default"===r||Object.prototype.hasOwnProperty.call(e,r)||n(e,t,r)};Object.defineProperty(e,"__esModule",{value:!0}),o(r(3515),e),o(r(801),e),o(r(2287),e),o(r(6434),e),o(r(4820),e),o(r(5278),e),o(r(6594),e),o(r(2868),e),o(r(1344),e)},2287:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.mapSeries=e.map=e.mapWithOptions=void 0;const n=r(1106),o=r(1344);function i(t,e,r){const n=Object.assign({},{concurrency:3},e);return function(t,e,r){return 0===r.length?Promise.resolve([]):1===r.length?t(r[0]).then((t=>[t])):new Promise(((n,o)=>{const i=new Array(r.length);let s,a=0,c=0;for(let t=0;t<e.concurrency;t++)u();function u(){if(a!==r.length){const e=a;t(r[a]).then((t=>{!function(t,e){i[e]=t,l()}(t,e)})).catch((t=>{!function(t){s=s||t,l()}(t)})),a++}}function l(){c++,c===r.length?s?o(s):n(i):u()}}))}(o.wrap(t),n,r)}const s=n.autoCurry(i);e.mapWithOptions=function(...t){return s(...t)};const a=n.autoCurry((function(t,e){return i(t,{},e)}));e.map=function(...t){return a(...t)};const c=n.autoCurry((function(t,e){return i(t,{concurrency:1},e)}));e.mapSeries=function(...t){return c(...t)}},6434:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.pipe=void 0;const n=r(3515);e.pipe=function(t=[]){return n.compose(t.slice().reverse())}},4820:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.promisify=void 0,e.promisify=function(t){return(...e)=>new Promise(((r,n)=>{t(...e,((t,e)=>{t?n(t):r(e)}))}))}},5278:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.retry=e.retryWithOptions=e.rawRetryWithOptions=void 0;const n=r(1106),o=r(1344);function i(t,e){const{count:r=3,onTryError:n=(()=>{}),onFinalError:i=(()=>{}),shouldRetry:a=(()=>!0)}=t;return s({count:r,onTryError:o.wrap(n),onFinalError:o.wrap(i),shouldRetry:o.wrap(a)},o.wrap(e))}function s(t,e){const{count:r,onTryError:n,onFinalError:o,shouldRetry:i}=t;return(...t)=>e(...t).catch((a=>{const c=r-1;return function(t,e){return i(t).then((t=>t&&e>=0))}(a,c).then((r=>r?n(a).then((()=>s({count:c,onTryError:n,onFinalError:o,shouldRetry:i},e)(...t))):o(a).then((()=>Promise.reject(a)))))}))}e.rawRetryWithOptions=i;const a=n.autoCurry(i);e.retryWithOptions=function(...t){return a(...t)};const c=n.autoCurry((function(t,e){return i({count:t},e)}));e.retry=function(...t){return c(...t)}},6594:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.timeout=e.timeoutWithOptions=void 0;const n=r(1106),o=r(1344);function i(t,e,r){return(...n)=>{const i=Object.assign({},{createError:s},e);return new Promise(((e,s)=>{const a=setTimeout((()=>{s(i.createError(t))}),t);return o.wrap(r)(...n).then((t=>{clearTimeout(a),e(t)})).catch((t=>{clearTimeout(a),s(t)}))}))}}function s(t){return new Error(`Timeout expired (${t}ms)`)}const a=n.autoCurry(i);e.timeoutWithOptions=function(...t){return a(...t)};const c=n.autoCurry((function(t,e){return i(t,{},e)}));e.timeout=function(...t){return c(...t)}},2868:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.wait=void 0,e.wait=function(t){return()=>new Promise((e=>setTimeout(e,t)))}},1344:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.wrap=void 0,e.wrap=function(t){return(...e)=>new Promise(((r,n)=>{try{r(t(...e))}catch(t){n(t)}}))}},9642:function(t,e,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(t,e,r,n){void 0===n&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]}),o=this&&this.__exportStar||function(t,e){for(var r in t)"default"===r||Object.prototype.hasOwnProperty.call(e,r)||n(e,t,r)};Object.defineProperty(e,"__esModule",{value:!0}),o(r(6097),e)},6097:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.createQueue=void 0,e.createQueue=function(t){const{capacity:e,concurrency:r,onRunningUpdated:n,onCountUpdated:o}=Object.assign({},{capacity:Number.MAX_SAFE_INTEGER,concurrency:1,onRunningUpdated:()=>{},onCountUpdated:()=>{}},t);let i=null,s=null,a=0,c=0;return{enqueue:function(t){if(a>=e)return Promise.resolve();const{resolve:u,promise:l}=function(){let t=()=>{};return{promise:new Promise((e=>{t=e})),resolve:t}}();return f=u,null!==i?(s.next={resolve:f,next:null},s=s.next):(i={resolve:u,next:null},s=i),d(a+1),c<r&&p(),l.then((()=>t())).then((t=>(h(),t))).catch((t=>{throw h(),t}));var f;function h(){d(a-1),m(c-1),p()}function p(){null!==i?(m(c+1),i.resolve(),i=i.next):s=null}function d(t){a=t,o(a)}function m(t){c=t,n(c)}}}}},1513:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),function(t){for(var r in t)e.hasOwnProperty(r)||(e[r]=t[r])}(r(3593))},3593:function(t,e,r){"use strict";var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const o=r(5747),i=n(r(5158)).default("@kwsites/file-exists");e.exists=function(t,r=e.READABLE){return function(t,e,r){i("checking %s",t);try{const n=o.statSync(t);return n.isFile()&&e?(i("[OK] path represents a file"),!0):n.isDirectory()&&r?(i("[OK] path represents a directory"),!0):(i("[FAIL] path represents something other than a file or directory"),!1)}catch(t){if("ENOENT"===t.code)return i("[FAIL] path is not accessible: %o",t),!1;throw i("[FATAL] %o",t),t}}(t,(r&e.FILE)>0,(r&e.FOLDER)>0)},e.FILE=1,e.FOLDER=2,e.READABLE=e.FILE+e.FOLDER},2443:(t,e)=>{"use strict";function r(){let t,e,r="pending";return{promise:new Promise(((r,n)=>{t=r,e=n})),done(e){"pending"===r&&(r="resolved",t(e))},fail(t){"pending"===r&&(r="rejected",e(t))},get fulfilled(){return"pending"!==r},get status(){return r}}}Object.defineProperty(e,"__esModule",{value:!0}),e.createDeferred=e.deferred=void 0,e.deferred=r,e.createDeferred=r,e.default=r},2954:(t,e,r)=>{"use strict";t=r.nmd(t);const n=(t,e)=>(...r)=>`[${t(...r)+e}m`,o=(t,e)=>(...r)=>{const n=t(...r);return`[${38+e};5;${n}m`},i=(t,e)=>(...r)=>{const n=t(...r);return`[${38+e};2;${n[0]};${n[1]};${n[2]}m`},s=t=>t,a=(t,e,r)=>[t,e,r],c=(t,e,r)=>{Object.defineProperty(t,e,{get:()=>{const n=r();return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0}),n},enumerable:!0,configurable:!0})};let u;const l=(t,e,n,o)=>{void 0===u&&(u=r(2085));const i=o?10:0,s={};for(const[r,o]of Object.entries(u)){const a="ansi16"===r?"ansi":r;r===e?s[a]=t(n,i):"object"==typeof o&&(s[a]=t(o[e],i))}return s};Object.defineProperty(t,"exports",{enumerable:!0,get:function(){const t=new Map,e={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};e.color.gray=e.color.blackBright,e.bgColor.bgGray=e.bgColor.bgBlackBright,e.color.grey=e.color.blackBright,e.bgColor.bgGrey=e.bgColor.bgBlackBright;for(const[r,n]of Object.entries(e)){for(const[r,o]of Object.entries(n))e[r]={open:`[${o[0]}m`,close:`[${o[1]}m`},n[r]=e[r],t.set(o[0],o[1]);Object.defineProperty(e,r,{value:n,enumerable:!1})}return Object.defineProperty(e,"codes",{value:t,enumerable:!1}),e.color.close="[39m",e.bgColor.close="[49m",c(e.color,"ansi",(()=>l(n,"ansi16",s,!1))),c(e.color,"ansi256",(()=>l(o,"ansi256",s,!1))),c(e.color,"ansi16m",(()=>l(i,"rgb",a,!1))),c(e.bgColor,"ansi",(()=>l(n,"ansi16",s,!0))),c(e.bgColor,"ansi256",(()=>l(o,"ansi256",s,!0))),c(e.bgColor,"ansi16m",(()=>l(i,"rgb",a,!0))),e}})},5623:t=>{"use strict";function e(t,e,o){t instanceof RegExp&&(t=r(t,o)),e instanceof RegExp&&(e=r(e,o));var i=n(t,e,o);return i&&{start:i[0],end:i[1],pre:o.slice(0,i[0]),body:o.slice(i[0]+t.length,i[1]),post:o.slice(i[1]+e.length)}}function r(t,e){var r=e.match(t);return r?r[0]:null}function n(t,e,r){var n,o,i,s,a,c=r.indexOf(t),u=r.indexOf(e,c+1),l=c;if(c>=0&&u>0){for(n=[],i=r.length;l>=0&&!a;)l==c?(n.push(l),c=r.indexOf(t,l+1)):1==n.length?a=[n.pop(),u]:((o=n.pop())<i&&(i=o,s=u),u=r.indexOf(e,l+1)),l=c<u&&c>=0?c:u;n.length&&(a=[i,s])}return a}t.exports=e,e.range=n},3644:(t,e,r)=>{var n=r(1048),o=r(5623);t.exports=function(t){return t?("{}"===t.substr(0,2)&&(t="\\{\\}"+t.substr(2)),y(function(t){return t.split("\\\\").join(i).split("\\{").join(s).split("\\}").join(a).split("\\,").join(c).split("\\.").join(u)}(t),!0).map(f)):[]};var i="\0SLASH"+Math.random()+"\0",s="\0OPEN"+Math.random()+"\0",a="\0CLOSE"+Math.random()+"\0",c="\0COMMA"+Math.random()+"\0",u="\0PERIOD"+Math.random()+"\0";function l(t){return parseInt(t,10)==t?parseInt(t,10):t.charCodeAt(0)}function f(t){return t.split(i).join("\\").split(s).join("{").split(a).join("}").split(c).join(",").split(u).join(".")}function h(t){if(!t)return[""];var e=[],r=o("{","}",t);if(!r)return t.split(",");var n=r.pre,i=r.body,s=r.post,a=n.split(",");a[a.length-1]+="{"+i+"}";var c=h(s);return s.length&&(a[a.length-1]+=c.shift(),a.push.apply(a,c)),e.push.apply(e,a),e}function p(t){return"{"+t+"}"}function d(t){return/^-?0\d/.test(t)}function m(t,e){return t<=e}function g(t,e){return t>=e}function y(t,e){var r=[],i=o("{","}",t);if(!i||/\$$/.test(i.pre))return[t];var s,c=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(i.body),u=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(i.body),f=c||u,v=i.body.indexOf(",")>=0;if(!f&&!v)return i.post.match(/,.*\}/)?y(t=i.pre+"{"+i.body+a+i.post):[t];if(f)s=i.body.split(/\.\./);else if(1===(s=h(i.body)).length&&1===(s=y(s[0],!1).map(p)).length)return(w=i.post.length?y(i.post,!1):[""]).map((function(t){return i.pre+s[0]+t}));var _,b=i.pre,w=i.post.length?y(i.post,!1):[""];if(f){var O=l(s[0]),k=l(s[1]),x=Math.max(s[0].length,s[1].length),E=3==s.length?Math.abs(l(s[2])):1,C=m;k<O&&(E*=-1,C=g);var S=s.some(d);_=[];for(var j=O;C(j,k);j+=E){var T;if(u)"\\"===(T=String.fromCharCode(j))&&(T="");else if(T=String(j),S){var P=x-T.length;if(P>0){var A=new Array(P+1).join("0");T=j<0?"-"+A+T.slice(1):A+T}}_.push(T)}}else _=n(s,(function(t){return y(t,!1)}));for(var F=0;F<_.length;F++)for(var M=0;M<w.length;M++){var R=b+_[F]+w[M];(!e||f||R)&&r.push(R)}return r}},4061:(t,e,r)=>{"use strict";const n=r(2954),{stdout:o,stderr:i}=r(2130),{stringReplaceAll:s,stringEncaseCRLFWithFirstIndex:a}=r(3559),{isArray:c}=Array,u=["ansi","ansi","ansi256","ansi16m"],l=Object.create(null);class f{constructor(t){return h(t)}}const h=t=>{const e={};return((t,e={})=>{if(e.level&&!(Number.isInteger(e.level)&&e.level>=0&&e.level<=3))throw new Error("The `level` option should be an integer from 0 to 3");const r=o?o.level:0;t.level=void 0===e.level?r:e.level})(e,t),e.template=(...t)=>b(e.template,...t),Object.setPrototypeOf(e,p.prototype),Object.setPrototypeOf(e.template,e),e.template.constructor=()=>{throw new Error("`chalk.constructor()` is deprecated. Use `new chalk.Instance()` instead.")},e.template.Instance=f,e.template};function p(t){return h(t)}for(const[t,e]of Object.entries(n))l[t]={get(){const r=y(this,g(e.open,e.close,this._styler),this._isEmpty);return Object.defineProperty(this,t,{value:r}),r}};l.visible={get(){const t=y(this,this._styler,!0);return Object.defineProperty(this,"visible",{value:t}),t}};const d=["rgb","hex","keyword","hsl","hsv","hwb","ansi","ansi256"];for(const t of d)l[t]={get(){const{level:e}=this;return function(...r){const o=g(n.color[u[e]][t](...r),n.color.close,this._styler);return y(this,o,this._isEmpty)}}};for(const t of d)l["bg"+t[0].toUpperCase()+t.slice(1)]={get(){const{level:e}=this;return function(...r){const o=g(n.bgColor[u[e]][t](...r),n.bgColor.close,this._styler);return y(this,o,this._isEmpty)}}};const m=Object.defineProperties((()=>{}),{...l,level:{enumerable:!0,get(){return this._generator.level},set(t){this._generator.level=t}}}),g=(t,e,r)=>{let n,o;return void 0===r?(n=t,o=e):(n=r.openAll+t,o=e+r.closeAll),{open:t,close:e,openAll:n,closeAll:o,parent:r}},y=(t,e,r)=>{const n=(...t)=>c(t[0])&&c(t[0].raw)?v(n,b(n,...t)):v(n,1===t.length?""+t[0]:t.join(" "));return Object.setPrototypeOf(n,m),n._generator=t,n._styler=e,n._isEmpty=r,n},v=(t,e)=>{if(t.level<=0||!e)return t._isEmpty?"":e;let r=t._styler;if(void 0===r)return e;const{openAll:n,closeAll:o}=r;if(-1!==e.indexOf(""))for(;void 0!==r;)e=s(e,r.close,r.open),r=r.parent;const i=e.indexOf("\n");return-1!==i&&(e=a(e,o,n,i)),n+e+o};let _;const b=(t,...e)=>{const[n]=e;if(!c(n)||!c(n.raw))return e.join(" ");const o=e.slice(1),i=[n.raw[0]];for(let t=1;t<n.length;t++)i.push(String(o[t-1]).replace(/[{}\\]/g,"\\$&"),String(n.raw[t]));return void 0===_&&(_=r(9515)),_(t,i.join(""))};Object.defineProperties(p.prototype,l);const w=p();w.supportsColor=o,w.stderr=p({level:i?i.level:0}),w.stderr.supportsColor=i,t.exports=w},9515:t=>{"use strict";const e=/(?:\\(u(?:[a-f\d]{4}|\{[a-f\d]{1,6}\})|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi,r=/(?:^|\.)(\w+)(?:\(([^)]*)\))?/g,n=/^(['"])((?:\\.|(?!\1)[^\\])*)\1$/,o=/\\(u(?:[a-f\d]{4}|{[a-f\d]{1,6}})|x[a-f\d]{2}|.)|([^\\])/gi,i=new Map([["n","\n"],["r","\r"],["t","\t"],["b","\b"],["f","\f"],["v","\v"],["0","\0"],["\\","\\"],["e",""],["a",""]]);function s(t){const e="u"===t[0],r="{"===t[1];return e&&!r&&5===t.length||"x"===t[0]&&3===t.length?String.fromCharCode(parseInt(t.slice(1),16)):e&&r?String.fromCodePoint(parseInt(t.slice(2,-1),16)):i.get(t)||t}function a(t,e){const r=[],i=e.trim().split(/\s*,\s*/g);let a;for(const e of i){const i=Number(e);if(Number.isNaN(i)){if(!(a=e.match(n)))throw new Error(`Invalid Chalk template style argument: ${e} (in style '${t}')`);r.push(a[2].replace(o,((t,e,r)=>e?s(e):r)))}else r.push(i)}return r}function c(t){r.lastIndex=0;const e=[];let n;for(;null!==(n=r.exec(t));){const t=n[1];if(n[2]){const r=a(t,n[2]);e.push([t].concat(r))}else e.push([t])}return e}function u(t,e){const r={};for(const t of e)for(const e of t.styles)r[e[0]]=t.inverse?null:e.slice(1);let n=t;for(const[t,e]of Object.entries(r))if(Array.isArray(e)){if(!(t in n))throw new Error(`Unknown Chalk style: ${t}`);n=e.length>0?n[t](...e):n[t]}return n}t.exports=(t,r)=>{const n=[],o=[];let i=[];if(r.replace(e,((e,r,a,l,f,h)=>{if(r)i.push(s(r));else if(l){const e=i.join("");i=[],o.push(0===n.length?e:u(t,n)(e)),n.push({inverse:a,styles:c(l)})}else if(f){if(0===n.length)throw new Error("Found extraneous } in Chalk template literal");o.push(u(t,n)(i.join(""))),i=[],n.pop()}else i.push(h)})),o.push(i.join("")),n.length>0){const t=`Chalk template literal is missing ${n.length} closing bracket${1===n.length?"":"s"} (\`}\`)`;throw new Error(t)}return o.join("")}},3559:t=>{"use strict";t.exports={stringReplaceAll:(t,e,r)=>{let n=t.indexOf(e);if(-1===n)return t;const o=e.length;let i=0,s="";do{s+=t.substr(i,n-i)+e+r,i=n+o,n=t.indexOf(e,i)}while(-1!==n);return s+=t.substr(i),s},stringEncaseCRLFWithFirstIndex:(t,e,r,n)=>{let o=0,i="";do{const s="\r"===t[n-1];i+=t.substr(o,(s?n-1:n)-o)+e+(s?"\r\n":"\n")+r,o=n+1,n=t.indexOf("\n",o)}while(-1!==n);return i+=t.substr(o),i}}},8168:(t,e,r)=>{const n=r(8874),o={};for(const t of Object.keys(n))o[n[t]]=t;const i={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},lch:{channels:3,labels:"lch"},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}};t.exports=i;for(const t of Object.keys(i)){if(!("channels"in i[t]))throw new Error("missing channels property: "+t);if(!("labels"in i[t]))throw new Error("missing channel labels property: "+t);if(i[t].labels.length!==i[t].channels)throw new Error("channel and label counts mismatch: "+t);const{channels:e,labels:r}=i[t];delete i[t].channels,delete i[t].labels,Object.defineProperty(i[t],"channels",{value:e}),Object.defineProperty(i[t],"labels",{value:r})}i.rgb.hsl=function(t){const e=t[0]/255,r=t[1]/255,n=t[2]/255,o=Math.min(e,r,n),i=Math.max(e,r,n),s=i-o;let a,c;i===o?a=0:e===i?a=(r-n)/s:r===i?a=2+(n-e)/s:n===i&&(a=4+(e-r)/s),a=Math.min(60*a,360),a<0&&(a+=360);const u=(o+i)/2;return c=i===o?0:u<=.5?s/(i+o):s/(2-i-o),[a,100*c,100*u]},i.rgb.hsv=function(t){let e,r,n,o,i;const s=t[0]/255,a=t[1]/255,c=t[2]/255,u=Math.max(s,a,c),l=u-Math.min(s,a,c),f=function(t){return(u-t)/6/l+.5};return 0===l?(o=0,i=0):(i=l/u,e=f(s),r=f(a),n=f(c),s===u?o=n-r:a===u?o=1/3+e-n:c===u&&(o=2/3+r-e),o<0?o+=1:o>1&&(o-=1)),[360*o,100*i,100*u]},i.rgb.hwb=function(t){const e=t[0],r=t[1];let n=t[2];const o=i.rgb.hsl(t)[0],s=1/255*Math.min(e,Math.min(r,n));return n=1-1/255*Math.max(e,Math.max(r,n)),[o,100*s,100*n]},i.rgb.cmyk=function(t){const e=t[0]/255,r=t[1]/255,n=t[2]/255,o=Math.min(1-e,1-r,1-n);return[100*((1-e-o)/(1-o)||0),100*((1-r-o)/(1-o)||0),100*((1-n-o)/(1-o)||0),100*o]},i.rgb.keyword=function(t){const e=o[t];if(e)return e;let r,i=1/0;for(const e of Object.keys(n)){const o=(a=n[e],((s=t)[0]-a[0])**2+(s[1]-a[1])**2+(s[2]-a[2])**2);o<i&&(i=o,r=e)}var s,a;return r},i.keyword.rgb=function(t){return n[t]},i.rgb.xyz=function(t){let e=t[0]/255,r=t[1]/255,n=t[2]/255;return e=e>.04045?((e+.055)/1.055)**2.4:e/12.92,r=r>.04045?((r+.055)/1.055)**2.4:r/12.92,n=n>.04045?((n+.055)/1.055)**2.4:n/12.92,[100*(.4124*e+.3576*r+.1805*n),100*(.2126*e+.7152*r+.0722*n),100*(.0193*e+.1192*r+.9505*n)]},i.rgb.lab=function(t){const e=i.rgb.xyz(t);let r=e[0],n=e[1],o=e[2];return r/=95.047,n/=100,o/=108.883,r=r>.008856?r**(1/3):7.787*r+16/116,n=n>.008856?n**(1/3):7.787*n+16/116,o=o>.008856?o**(1/3):7.787*o+16/116,[116*n-16,500*(r-n),200*(n-o)]},i.hsl.rgb=function(t){const e=t[0]/360,r=t[1]/100,n=t[2]/100;let o,i,s;if(0===r)return s=255*n,[s,s,s];o=n<.5?n*(1+r):n+r-n*r;const a=2*n-o,c=[0,0,0];for(let t=0;t<3;t++)i=e+1/3*-(t-1),i<0&&i++,i>1&&i--,s=6*i<1?a+6*(o-a)*i:2*i<1?o:3*i<2?a+(o-a)*(2/3-i)*6:a,c[t]=255*s;return c},i.hsl.hsv=function(t){const e=t[0];let r=t[1]/100,n=t[2]/100,o=r;const i=Math.max(n,.01);return n*=2,r*=n<=1?n:2-n,o*=i<=1?i:2-i,[e,100*(0===n?2*o/(i+o):2*r/(n+r)),(n+r)/2*100]},i.hsv.rgb=function(t){const e=t[0]/60,r=t[1]/100;let n=t[2]/100;const o=Math.floor(e)%6,i=e-Math.floor(e),s=255*n*(1-r),a=255*n*(1-r*i),c=255*n*(1-r*(1-i));switch(n*=255,o){case 0:return[n,c,s];case 1:return[a,n,s];case 2:return[s,n,c];case 3:return[s,a,n];case 4:return[c,s,n];case 5:return[n,s,a]}},i.hsv.hsl=function(t){const e=t[0],r=t[1]/100,n=t[2]/100,o=Math.max(n,.01);let i,s;s=(2-r)*n;const a=(2-r)*o;return i=r*o,i/=a<=1?a:2-a,i=i||0,s/=2,[e,100*i,100*s]},i.hwb.rgb=function(t){const e=t[0]/360;let r=t[1]/100,n=t[2]/100;const o=r+n;let i;o>1&&(r/=o,n/=o);const s=Math.floor(6*e),a=1-n;i=6*e-s,0!=(1&s)&&(i=1-i);const c=r+i*(a-r);let u,l,f;switch(s){default:case 6:case 0:u=a,l=c,f=r;break;case 1:u=c,l=a,f=r;break;case 2:u=r,l=a,f=c;break;case 3:u=r,l=c,f=a;break;case 4:u=c,l=r,f=a;break;case 5:u=a,l=r,f=c}return[255*u,255*l,255*f]},i.cmyk.rgb=function(t){const e=t[0]/100,r=t[1]/100,n=t[2]/100,o=t[3]/100;return[255*(1-Math.min(1,e*(1-o)+o)),255*(1-Math.min(1,r*(1-o)+o)),255*(1-Math.min(1,n*(1-o)+o))]},i.xyz.rgb=function(t){const e=t[0]/100,r=t[1]/100,n=t[2]/100;let o,i,s;return o=3.2406*e+-1.5372*r+-.4986*n,i=-.9689*e+1.8758*r+.0415*n,s=.0557*e+-.204*r+1.057*n,o=o>.0031308?1.055*o**(1/2.4)-.055:12.92*o,i=i>.0031308?1.055*i**(1/2.4)-.055:12.92*i,s=s>.0031308?1.055*s**(1/2.4)-.055:12.92*s,o=Math.min(Math.max(0,o),1),i=Math.min(Math.max(0,i),1),s=Math.min(Math.max(0,s),1),[255*o,255*i,255*s]},i.xyz.lab=function(t){let e=t[0],r=t[1],n=t[2];return e/=95.047,r/=100,n/=108.883,e=e>.008856?e**(1/3):7.787*e+16/116,r=r>.008856?r**(1/3):7.787*r+16/116,n=n>.008856?n**(1/3):7.787*n+16/116,[116*r-16,500*(e-r),200*(r-n)]},i.lab.xyz=function(t){let e,r,n;r=(t[0]+16)/116,e=t[1]/500+r,n=r-t[2]/200;const o=r**3,i=e**3,s=n**3;return r=o>.008856?o:(r-16/116)/7.787,e=i>.008856?i:(e-16/116)/7.787,n=s>.008856?s:(n-16/116)/7.787,e*=95.047,r*=100,n*=108.883,[e,r,n]},i.lab.lch=function(t){const e=t[0],r=t[1],n=t[2];let o;return o=360*Math.atan2(n,r)/2/Math.PI,o<0&&(o+=360),[e,Math.sqrt(r*r+n*n),o]},i.lch.lab=function(t){const e=t[0],r=t[1],n=t[2]/360*2*Math.PI;return[e,r*Math.cos(n),r*Math.sin(n)]},i.rgb.ansi16=function(t,e=null){const[r,n,o]=t;let s=null===e?i.rgb.hsv(t)[2]:e;if(s=Math.round(s/50),0===s)return 30;let a=30+(Math.round(o/255)<<2|Math.round(n/255)<<1|Math.round(r/255));return 2===s&&(a+=60),a},i.hsv.ansi16=function(t){return i.rgb.ansi16(i.hsv.rgb(t),t[2])},i.rgb.ansi256=function(t){const e=t[0],r=t[1],n=t[2];return e===r&&r===n?e<8?16:e>248?231:Math.round((e-8)/247*24)+232:16+36*Math.round(e/255*5)+6*Math.round(r/255*5)+Math.round(n/255*5)},i.ansi16.rgb=function(t){let e=t%10;if(0===e||7===e)return t>50&&(e+=3.5),e=e/10.5*255,[e,e,e];const r=.5*(1+~~(t>50));return[(1&e)*r*255,(e>>1&1)*r*255,(e>>2&1)*r*255]},i.ansi256.rgb=function(t){if(t>=232){const e=10*(t-232)+8;return[e,e,e]}let e;return t-=16,[Math.floor(t/36)/5*255,Math.floor((e=t%36)/6)/5*255,e%6/5*255]},i.rgb.hex=function(t){const e=(((255&Math.round(t[0]))<<16)+((255&Math.round(t[1]))<<8)+(255&Math.round(t[2]))).toString(16).toUpperCase();return"000000".substring(e.length)+e},i.hex.rgb=function(t){const e=t.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!e)return[0,0,0];let r=e[0];3===e[0].length&&(r=r.split("").map((t=>t+t)).join(""));const n=parseInt(r,16);return[n>>16&255,n>>8&255,255&n]},i.rgb.hcg=function(t){const e=t[0]/255,r=t[1]/255,n=t[2]/255,o=Math.max(Math.max(e,r),n),i=Math.min(Math.min(e,r),n),s=o-i;let a,c;return a=s<1?i/(1-s):0,c=s<=0?0:o===e?(r-n)/s%6:o===r?2+(n-e)/s:4+(e-r)/s,c/=6,c%=1,[360*c,100*s,100*a]},i.hsl.hcg=function(t){const e=t[1]/100,r=t[2]/100,n=r<.5?2*e*r:2*e*(1-r);let o=0;return n<1&&(o=(r-.5*n)/(1-n)),[t[0],100*n,100*o]},i.hsv.hcg=function(t){const e=t[1]/100,r=t[2]/100,n=e*r;let o=0;return n<1&&(o=(r-n)/(1-n)),[t[0],100*n,100*o]},i.hcg.rgb=function(t){const e=t[0]/360,r=t[1]/100,n=t[2]/100;if(0===r)return[255*n,255*n,255*n];const o=[0,0,0],i=e%1*6,s=i%1,a=1-s;let c=0;switch(Math.floor(i)){case 0:o[0]=1,o[1]=s,o[2]=0;break;case 1:o[0]=a,o[1]=1,o[2]=0;break;case 2:o[0]=0,o[1]=1,o[2]=s;break;case 3:o[0]=0,o[1]=a,o[2]=1;break;case 4:o[0]=s,o[1]=0,o[2]=1;break;default:o[0]=1,o[1]=0,o[2]=a}return c=(1-r)*n,[255*(r*o[0]+c),255*(r*o[1]+c),255*(r*o[2]+c)]},i.hcg.hsv=function(t){const e=t[1]/100,r=e+t[2]/100*(1-e);let n=0;return r>0&&(n=e/r),[t[0],100*n,100*r]},i.hcg.hsl=function(t){const e=t[1]/100,r=t[2]/100*(1-e)+.5*e;let n=0;return r>0&&r<.5?n=e/(2*r):r>=.5&&r<1&&(n=e/(2*(1-r))),[t[0],100*n,100*r]},i.hcg.hwb=function(t){const e=t[1]/100,r=e+t[2]/100*(1-e);return[t[0],100*(r-e),100*(1-r)]},i.hwb.hcg=function(t){const e=t[1]/100,r=1-t[2]/100,n=r-e;let o=0;return n<1&&(o=(r-n)/(1-n)),[t[0],100*n,100*o]},i.apple.rgb=function(t){return[t[0]/65535*255,t[1]/65535*255,t[2]/65535*255]},i.rgb.apple=function(t){return[t[0]/255*65535,t[1]/255*65535,t[2]/255*65535]},i.gray.rgb=function(t){return[t[0]/100*255,t[0]/100*255,t[0]/100*255]},i.gray.hsl=function(t){return[0,0,t[0]]},i.gray.hsv=i.gray.hsl,i.gray.hwb=function(t){return[0,100,t[0]]},i.gray.cmyk=function(t){return[0,0,0,t[0]]},i.gray.lab=function(t){return[t[0],0,0]},i.gray.hex=function(t){const e=255&Math.round(t[0]/100*255),r=((e<<16)+(e<<8)+e).toString(16).toUpperCase();return"000000".substring(r.length)+r},i.rgb.gray=function(t){return[(t[0]+t[1]+t[2])/3/255*100]}},2085:(t,e,r)=>{const n=r(8168),o=r(4111),i={};Object.keys(n).forEach((t=>{i[t]={},Object.defineProperty(i[t],"channels",{value:n[t].channels}),Object.defineProperty(i[t],"labels",{value:n[t].labels});const e=o(t);Object.keys(e).forEach((r=>{const n=e[r];i[t][r]=function(t){const e=function(...e){const r=e[0];if(null==r)return r;r.length>1&&(e=r);const n=t(e);if("object"==typeof n)for(let t=n.length,e=0;e<t;e++)n[e]=Math.round(n[e]);return n};return"conversion"in t&&(e.conversion=t.conversion),e}(n),i[t][r].raw=function(t){const e=function(...e){const r=e[0];return null==r?r:(r.length>1&&(e=r),t(e))};return"conversion"in t&&(e.conversion=t.conversion),e}(n)}))})),t.exports=i},4111:(t,e,r)=>{const n=r(8168);function o(t,e){return function(r){return e(t(r))}}function i(t,e){const r=[e[t].parent,t];let i=n[e[t].parent][t],s=e[t].parent;for(;e[s].parent;)r.unshift(e[s].parent),i=o(n[e[s].parent][s],i),s=e[s].parent;return i.conversion=r,i}t.exports=function(t){const e=function(t){const e=function(){const t={},e=Object.keys(n);for(let r=e.length,n=0;n<r;n++)t[e[n]]={distance:-1,parent:null};return t}(),r=[t];for(e[t].distance=0;r.length;){const t=r.pop(),o=Object.keys(n[t]);for(let n=o.length,i=0;i<n;i++){const n=o[i],s=e[n];-1===s.distance&&(s.distance=e[t].distance+1,s.parent=t,r.unshift(n))}}return e}(t),r={},o=Object.keys(e);for(let t=o.length,n=0;n<t;n++){const t=o[n];null!==e[t].parent&&(r[t]=i(t,e))}return r}},8874:t=>{"use strict";t.exports={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}},8783:(t,e,r)=>{const n=r(8614).EventEmitter,o=r(3129).spawn,i=r(5622),s=r(5747);class a{constructor(t,e){this.flags=t,this.required=t.includes("<"),this.optional=t.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test(t),this.mandatory=!1;const r=m(t);this.short=r.shortFlag,this.long=r.longFlag,this.negate=!1,this.long&&(this.negate=this.long.startsWith("--no-")),this.description=e||"",this.defaultValue=void 0}name(){return this.long?this.long.replace(/^--/,""):this.short.replace(/^-/,"")}attributeName(){return this.name().replace(/^no-/,"").split("-").reduce(((t,e)=>t+e[0].toUpperCase()+e.slice(1)))}is(t){return this.short===t||this.long===t}}class c extends Error{constructor(t,e,r){super(r),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=e,this.exitCode=t,this.nestedError=void 0}}class u extends n{constructor(t){super(),this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=!1,this._args=[],this.rawArgs=null,this._scriptPath=null,this._name=t||"",this._optionValues={},this._storeOptionsAsProperties=!0,this._storeOptionsAsPropertiesCalled=!1,this._passCommandToAction=!0,this._actionResults=[],this._actionHandler=null,this._executableHandler=!1,this._executableFile=null,this._defaultCommandName=null,this._exitCallback=null,this._aliases=[],this._combineFlagAndOptionalValue=!0,this._hidden=!1,this._hasHelpOption=!0,this._helpFlags="-h, --help",this._helpDescription="display help for command",this._helpShortFlag="-h",this._helpLongFlag="--help",this._hasImplicitHelpCommand=void 0,this._helpCommandName="help",this._helpCommandnameAndArgs="help [command]",this._helpCommandDescription="display help for command"}command(t,e,r){let n=e,o=r;"object"==typeof n&&null!==n&&(o=n,n=null),o=o||{};const i=t.split(/ +/),s=this.createCommand(i.shift());return n&&(s.description(n),s._executableHandler=!0),o.isDefault&&(this._defaultCommandName=s._name),s._hidden=!(!o.noHelp&&!o.hidden),s._hasHelpOption=this._hasHelpOption,s._helpFlags=this._helpFlags,s._helpDescription=this._helpDescription,s._helpShortFlag=this._helpShortFlag,s._helpLongFlag=this._helpLongFlag,s._helpCommandName=this._helpCommandName,s._helpCommandnameAndArgs=this._helpCommandnameAndArgs,s._helpCommandDescription=this._helpCommandDescription,s._exitCallback=this._exitCallback,s._storeOptionsAsProperties=this._storeOptionsAsProperties,s._passCommandToAction=this._passCommandToAction,s._combineFlagAndOptionalValue=this._combineFlagAndOptionalValue,s._executableFile=o.executableFile||null,this.commands.push(s),s._parseExpectedArgs(i),s.parent=this,n?this:s}createCommand(t){return new u(t)}addCommand(t,e){if(!t._name)throw new Error("Command passed to .addCommand() must have a name");return function t(e){e.forEach((e=>{if(e._executableHandler&&!e._executableFile)throw new Error(`Must specify executableFile for deeply nested executable: ${e.name()}`);t(e.commands)}))}(t.commands),(e=e||{}).isDefault&&(this._defaultCommandName=t._name),(e.noHelp||e.hidden)&&(t._hidden=!0),this.commands.push(t),t.parent=this,this}arguments(t){return this._parseExpectedArgs(t.split(/ +/))}addHelpCommand(t,e){return!1===t?this._hasImplicitHelpCommand=!1:(this._hasImplicitHelpCommand=!0,"string"==typeof t&&(this._helpCommandName=t.split(" ")[0],this._helpCommandnameAndArgs=t),this._helpCommandDescription=e||this._helpCommandDescription),this}_lazyHasImplicitHelpCommand(){return void 0===this._hasImplicitHelpCommand&&(this._hasImplicitHelpCommand=this.commands.length&&!this._actionHandler&&!this._findCommand("help")),this._hasImplicitHelpCommand}_parseExpectedArgs(t){if(t.length)return t.forEach((t=>{const e={required:!1,name:"",variadic:!1};switch(t[0]){case"<":e.required=!0,e.name=t.slice(1,-1);break;case"[":e.name=t.slice(1,-1)}e.name.length>3&&"..."===e.name.slice(-3)&&(e.variadic=!0,e.name=e.name.slice(0,-3)),e.name&&this._args.push(e)})),this._args.forEach(((t,e)=>{if(t.variadic&&e<this._args.length-1)throw new Error(`only the last argument can be variadic '${t.name}'`)})),this}exitOverride(t){return this._exitCallback=t||(t=>{if("commander.executeSubCommandAsync"!==t.code)throw t}),this}_exit(t,e,r){this._exitCallback&&this._exitCallback(new c(t,e,r)),process.exit(t)}action(t){return this._actionHandler=e=>{const r=this._args.length,n=e.slice(0,r);this._passCommandToAction?n[r]=this:n[r]=this.opts(),e.length>r&&n.push(e.slice(r));const o=t.apply(this,n);let i=this;for(;i.parent;)i=i.parent;i._actionResults.push(o)},this}_checkForOptionNameClash(t){if(!this._storeOptionsAsProperties||this._storeOptionsAsPropertiesCalled)return;if("help"===t.name())return;if(void 0===this._getOptionValue(t.attributeName()))return;let e=!0;if(t.negate){const r=t.long.replace(/^--no-/,"--");e=!this._findOption(r)}else if(t.long){const r=t.long.replace(/^--/,"--no-");e=!this._findOption(r)}if(e)throw new Error(`option '${t.name()}' clashes with existing property '${t.attributeName()}' on Command\n- call storeOptionsAsProperties(false) to store option values safely,\n- or call storeOptionsAsProperties(true) to suppress this check,\n- or change option name\n\nRead more on https://git.io/JJc0W`)}_optionEx(t,e,r,n,o){const i=new a(e,r),s=i.name(),c=i.attributeName();if(i.mandatory=!!t.mandatory,this._checkForOptionNameClash(i),"function"!=typeof n)if(n instanceof RegExp){const t=n;n=(e,r)=>{const n=t.exec(e);return n?n[0]:r}}else o=n,n=null;if(i.negate||i.optional||i.required||"boolean"==typeof o){if(i.negate){const t=i.long.replace(/^--no-/,"--");o=!this._findOption(t)||this._getOptionValue(c)}void 0!==o&&(this._setOptionValue(c,o),i.defaultValue=o)}return this.options.push(i),this.on("option:"+s,(t=>{const e=this._getOptionValue(c);null!==t&&n?t=n(t,void 0===e?o:e):null!==t&&i.variadic&&(t=e!==o&&Array.isArray(e)?e.concat(t):[t]),"boolean"==typeof e||void 0===e?null==t?this._setOptionValue(c,!i.negate&&(o||!0)):this._setOptionValue(c,t):null!==t&&this._setOptionValue(c,!i.negate&&t)})),this}option(t,e,r,n){return this._optionEx({},t,e,r,n)}requiredOption(t,e,r,n){return this._optionEx({mandatory:!0},t,e,r,n)}combineFlagAndOptionalValue(t){return this._combineFlagAndOptionalValue=void 0===t||t,this}allowUnknownOption(t){return this._allowUnknownOption=void 0===t||t,this}storeOptionsAsProperties(t){if(this._storeOptionsAsPropertiesCalled=!0,this._storeOptionsAsProperties=void 0===t||t,this.options.length)throw new Error("call .storeOptionsAsProperties() before adding options");return this}passCommandToAction(t){return this._passCommandToAction=void 0===t||t,this}_setOptionValue(t,e){this._storeOptionsAsProperties?this[t]=e:this._optionValues[t]=e}_getOptionValue(t){return this._storeOptionsAsProperties?this[t]:this._optionValues[t]}parse(t,e){if(void 0!==t&&!Array.isArray(t))throw new Error("first parameter to parse must be array or undefined");let r;switch(e=e||{},void 0===t&&(t=process.argv,process.versions&&process.versions.electron&&(e.from="electron")),this.rawArgs=t.slice(),e.from){case void 0:case"node":this._scriptPath=t[1],r=t.slice(2);break;case"electron":process.defaultApp?(this._scriptPath=t[1],r=t.slice(2)):r=t.slice(1);break;case"user":r=t.slice(0);break;default:throw new Error(`unexpected parse option { from: '${e.from}' }`)}return!this._scriptPath&&process.mainModule&&(this._scriptPath=process.mainModule.filename),this._name=this._name||this._scriptPath&&i.basename(this._scriptPath,i.extname(this._scriptPath)),this._parseCommand([],r),this}parseAsync(t,e){return this.parse(t,e),Promise.all(this._actionResults).then((()=>this))}_executeSubCommand(t,e){e=e.slice();let r=!1;const n=[".js",".ts",".tsx",".mjs"];this._checkForMissingMandatoryOptions();let a,u=this._scriptPath;!u&&process.mainModule&&(u=process.mainModule.filename);try{const t=s.realpathSync(u);a=i.dirname(t)}catch(t){a="."}let l=i.basename(u,i.extname(u))+"-"+t._name;t._executableFile&&(l=t._executableFile);const f=i.join(a,l);let h;s.existsSync(f)?l=f:n.forEach((t=>{s.existsSync(`${f}${t}`)&&(l=`${f}${t}`)})),r=n.includes(i.extname(l)),"win32"!==process.platform?r?(e.unshift(l),e=g(process.execArgv).concat(e),h=o(process.argv[0],e,{stdio:"inherit"})):h=o(l,e,{stdio:"inherit"}):(e.unshift(l),e=g(process.execArgv).concat(e),h=o(process.execPath,e,{stdio:"inherit"})),["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach((t=>{process.on(t,(()=>{!1===h.killed&&null===h.exitCode&&h.kill(t)}))}));const p=this._exitCallback;p?h.on("close",(()=>{p(new c(process.exitCode||0,"commander.executeSubCommandAsync","(close)"))})):h.on("close",process.exit.bind(process)),h.on("error",(e=>{if("ENOENT"===e.code){const e=`'${l}' does not exist\n - if '${t._name}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead\n - if the default executable name is not suitable, use the executableFile option to supply a custom name`;throw new Error(e)}if("EACCES"===e.code)throw new Error(`'${l}' not executable`);if(p){const t=new c(1,"commander.executeSubCommandAsync","(error)");t.nestedError=e,p(t)}else process.exit(1)})),this.runningCommand=h}_dispatchSubcommand(t,e,r){const n=this._findCommand(t);n||this._helpAndError(),n._executableHandler?this._executeSubCommand(n,e.concat(r)):n._parseCommand(e,r)}_parseCommand(t,e){const r=this.parseOptions(e);if(t=t.concat(r.operands),e=r.unknown,this.args=t.concat(e),t&&this._findCommand(t[0]))this._dispatchSubcommand(t[0],t.slice(1),e);else if(this._lazyHasImplicitHelpCommand()&&t[0]===this._helpCommandName)1===t.length?this.help():this._dispatchSubcommand(t[1],[],[this._helpLongFlag]);else if(this._defaultCommandName)p(this,e),this._dispatchSubcommand(this._defaultCommandName,t,e);else if(!this.commands.length||0!==this.args.length||this._actionHandler||this._defaultCommandName||this._helpAndError(),p(this,r.unknown),this._checkForMissingMandatoryOptions(),r.unknown.length>0&&this.unknownOption(r.unknown[0]),this._actionHandler){const r=this.args.slice();this._args.forEach(((t,e)=>{t.required&&null==r[e]?this.missingArgument(t.name):t.variadic&&(r[e]=r.splice(e))})),this._actionHandler(r),this.emit("command:"+this.name(),t,e)}else t.length?this._findCommand("*")?this._dispatchSubcommand("*",t,e):this.listenerCount("command:*")?this.emit("command:*",t,e):this.commands.length&&this.unknownCommand():this.commands.length&&this._helpAndError()}_findCommand(t){if(t)return this.commands.find((e=>e._name===t||e._aliases.includes(t)))}_findOption(t){return this.options.find((e=>e.is(t)))}_checkForMissingMandatoryOptions(){for(let t=this;t;t=t.parent)t.options.forEach((e=>{e.mandatory&&void 0===t._getOptionValue(e.attributeName())&&t.missingMandatoryOptionValue(e)}))}parseOptions(t){const e=[],r=[];let n=e;const o=t.slice();function i(t){return t.length>1&&"-"===t[0]}let s=null;for(;o.length;){const t=o.shift();if("--"===t){n===r&&n.push(t),n.push(...o);break}if(!s||i(t)){if(s=null,i(t)){const e=this._findOption(t);if(e){if(e.required){const t=o.shift();void 0===t&&this.optionMissingArgument(e),this.emit(`option:${e.name()}`,t)}else if(e.optional){let t=null;o.length>0&&!i(o[0])&&(t=o.shift()),this.emit(`option:${e.name()}`,t)}else this.emit(`option:${e.name()}`);s=e.variadic?e:null;continue}}if(t.length>2&&"-"===t[0]&&"-"!==t[1]){const e=this._findOption(`-${t[1]}`);if(e){e.required||e.optional&&this._combineFlagAndOptionalValue?this.emit(`option:${e.name()}`,t.slice(2)):(this.emit(`option:${e.name()}`),o.unshift(`-${t.slice(2)}`));continue}}if(/^--[^=]+=/.test(t)){const e=t.indexOf("="),r=this._findOption(t.slice(0,e));if(r&&(r.required||r.optional)){this.emit(`option:${r.name()}`,t.slice(e+1));continue}}t.length>1&&"-"===t[0]&&(n=r),n.push(t)}else this.emit(`option:${s.name()}`,t)}return{operands:e,unknown:r}}opts(){if(this._storeOptionsAsProperties){const t={},e=this.options.length;for(let r=0;r<e;r++){const e=this.options[r].attributeName();t[e]=e===this._versionOptionName?this._version:this[e]}return t}return this._optionValues}missingArgument(t){const e=`error: missing required argument '${t}'`;console.error(e),this._exit(1,"commander.missingArgument",e)}optionMissingArgument(t,e){let r;r=e?`error: option '${t.flags}' argument missing, got '${e}'`:`error: option '${t.flags}' argument missing`,console.error(r),this._exit(1,"commander.optionMissingArgument",r)}missingMandatoryOptionValue(t){const e=`error: required option '${t.flags}' not specified`;console.error(e),this._exit(1,"commander.missingMandatoryOptionValue",e)}unknownOption(t){if(this._allowUnknownOption)return;const e=`error: unknown option '${t}'`;console.error(e),this._exit(1,"commander.unknownOption",e)}unknownCommand(){const t=[this.name()];for(let e=this.parent;e;e=e.parent)t.unshift(e.name());const e=t.join(" "),r=`error: unknown command '${this.args[0]}'.`+(this._hasHelpOption?` See '${e} ${this._helpLongFlag}'.`:"");console.error(r),this._exit(1,"commander.unknownCommand",r)}version(t,e,r){if(void 0===t)return this._version;this._version=t;const n=new a(e=e||"-V, --version",r=r||"output the version number");return this._versionOptionName=n.attributeName(),this.options.push(n),this.on("option:"+n.name(),(()=>{process.stdout.write(t+"\n"),this._exit(0,"commander.version",t)})),this}description(t,e){return void 0===t&&void 0===e?this._description:(this._description=t,this._argsDescription=e,this)}alias(t){if(void 0===t)return this._aliases[0];let e=this;if(0!==this.commands.length&&this.commands[this.commands.length-1]._executableHandler&&(e=this.commands[this.commands.length-1]),t===e._name)throw new Error("Command alias can't be the same as its name");return e._aliases.push(t),this}aliases(t){return void 0===t?this._aliases:(t.forEach((t=>this.alias(t))),this)}usage(t){if(void 0===t){if(this._usage)return this._usage;const t=this._args.map((t=>d(t)));return[].concat(this.options.length||this._hasHelpOption?"[options]":[],this.commands.length?"[command]":[],this._args.length?t:[]).join(" ")}return this._usage=t,this}name(t){return void 0===t?this._name:(this._name=t,this)}prepareCommands(){const t=this.commands.filter((t=>!t._hidden)).map((t=>{const e=t._args.map((t=>d(t))).join(" ");return[t._name+(t._aliases[0]?"|"+t._aliases[0]:"")+(t.options.length?" [options]":"")+(e?" "+e:""),t._description]}));return this._lazyHasImplicitHelpCommand()&&t.push([this._helpCommandnameAndArgs,this._helpCommandDescription]),t}largestCommandLength(){return this.prepareCommands().reduce(((t,e)=>Math.max(t,e[0].length)),0)}largestOptionLength(){const t=[].slice.call(this.options);return t.push({flags:this._helpFlags}),t.reduce(((t,e)=>Math.max(t,e.flags.length)),0)}largestArgLength(){return this._args.reduce(((t,e)=>Math.max(t,e.name.length)),0)}padWidth(){let t=this.largestOptionLength();return this._argsDescription&&this._args.length&&this.largestArgLength()>t&&(t=this.largestArgLength()),this.commands&&this.commands.length&&this.largestCommandLength()>t&&(t=this.largestCommandLength()),t}optionHelp(){const t=this.padWidth(),e=(process.stdout.columns||80)-t-4;function r(r,n){return l(r,t)+" "+h(n,e,t+2)}const n=this.options.map((t=>{cons