cligr 1.0.4 → 1.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,41 +1,41 @@
1
1
  #!/usr/bin/env node
2
- import Z from"fs";import bn from"os";import q from"path";function De(e){return typeof e>"u"||e===null}function Ln(e){return typeof e=="object"&&e!==null}function Nn(e){return Array.isArray(e)?e:De(e)?[]:[e]}function Rn(e,n){var r,o,i,t;if(n)for(t=Object.keys(n),r=0,o=t.length;r<o;r+=1)i=t[r],e[i]=n[i];return e}function Dn(e,n){var r="",o;for(o=0;o<n;o+=1)r+=e;return r}function Mn(e){return e===0&&Number.NEGATIVE_INFINITY===1/e}var Gn=De,$n=Ln,jn=Nn,Yn=Dn,Bn=Mn,Hn=Rn,A={isNothing:Gn,isObject:$n,toArray:jn,repeat:Yn,isNegativeZero:Bn,extend:Hn};function Me(e,n){var r="",o=e.reason||"(unknown reason)";return e.mark?(e.mark.name&&(r+='in "'+e.mark.name+'" '),r+="("+(e.mark.line+1)+":"+(e.mark.column+1)+")",!n&&e.mark.snippet&&(r+=`
2
+ import Z from"fs";import _r from"os";import q from"path";function De(e){return typeof e>"u"||e===null}function Or(e){return typeof e=="object"&&e!==null}function Lr(e){return Array.isArray(e)?e:De(e)?[]:[e]}function Nr(e,r){var n,i,o,t;if(r)for(t=Object.keys(r),n=0,i=t.length;n<i;n+=1)o=t[n],e[o]=r[o];return e}function Rr(e,r){var n="",i;for(i=0;i<r;i+=1)n+=e;return n}function Dr(e){return e===0&&Number.NEGATIVE_INFINITY===1/e}var Mr=De,$r=Or,jr=Lr,Gr=Rr,Yr=Dr,Br=Nr,A={isNothing:Mr,isObject:$r,toArray:jr,repeat:Gr,isNegativeZero:Yr,extend:Br};function Me(e,r){var n="",i=e.reason||"(unknown reason)";return e.mark?(e.mark.name&&(n+='in "'+e.mark.name+'" '),n+="("+(e.mark.line+1)+":"+(e.mark.column+1)+")",!r&&e.mark.snippet&&(n+=`
3
3
 
4
- `+e.mark.snippet),o+" "+r):o}function B(e,n){Error.call(this),this.name="YAMLException",this.reason=e,this.mark=n,this.message=Me(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack||""}B.prototype=Object.create(Error.prototype);B.prototype.constructor=B;B.prototype.toString=function(n){return this.name+": "+Me(this,n)};var E=B;function oe(e,n,r,o,i){var t="",l="",u=Math.floor(i/2)-1;return o-n>u&&(t=" ... ",n=o-u+t.length),r-o>u&&(l=" ...",r=o+u-l.length),{str:t+e.slice(n,r).replace(/\t/g,"\u2192")+l,pos:o-n+t.length}}function le(e,n){return A.repeat(" ",n-e.length)+e}function Un(e,n){if(n=Object.create(n||null),!e.buffer)return null;n.maxLength||(n.maxLength=79),typeof n.indent!="number"&&(n.indent=1),typeof n.linesBefore!="number"&&(n.linesBefore=3),typeof n.linesAfter!="number"&&(n.linesAfter=2);for(var r=/\r?\n|\r|\0/g,o=[0],i=[],t,l=-1;t=r.exec(e.buffer);)i.push(t.index),o.push(t.index+t[0].length),e.position<=t.index&&l<0&&(l=o.length-2);l<0&&(l=o.length-1);var u="",c,a,f=Math.min(e.line+n.linesAfter,i.length).toString().length,s=n.maxLength-(n.indent+f+3);for(c=1;c<=n.linesBefore&&!(l-c<0);c++)a=oe(e.buffer,o[l-c],i[l-c],e.position-(o[l]-o[l-c]),s),u=A.repeat(" ",n.indent)+le((e.line-c+1).toString(),f)+" | "+a.str+`
5
- `+u;for(a=oe(e.buffer,o[l],i[l],e.position,s),u+=A.repeat(" ",n.indent)+le((e.line+1).toString(),f)+" | "+a.str+`
6
- `,u+=A.repeat("-",n.indent+f+3+a.pos)+`^
7
- `,c=1;c<=n.linesAfter&&!(l+c>=i.length);c++)a=oe(e.buffer,o[l+c],i[l+c],e.position-(o[l]-o[l+c]),s),u+=A.repeat(" ",n.indent)+le((e.line+c+1).toString(),f)+" | "+a.str+`
8
- `;return u.replace(/\n$/,"")}var Kn=Un,qn=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],Wn=["scalar","sequence","mapping"];function Qn(e){var n={};return e!==null&&Object.keys(e).forEach(function(r){e[r].forEach(function(o){n[String(o)]=r})}),n}function Vn(e,n){if(n=n||{},Object.keys(n).forEach(function(r){if(qn.indexOf(r)===-1)throw new E('Unknown option "'+r+'" is met in definition of "'+e+'" YAML type.')}),this.options=n,this.tag=e,this.kind=n.kind||null,this.resolve=n.resolve||function(){return!0},this.construct=n.construct||function(r){return r},this.instanceOf=n.instanceOf||null,this.predicate=n.predicate||null,this.represent=n.represent||null,this.representName=n.representName||null,this.defaultStyle=n.defaultStyle||null,this.multi=n.multi||!1,this.styleAliases=Qn(n.styleAliases||null),Wn.indexOf(this.kind)===-1)throw new E('Unknown kind "'+this.kind+'" is specified for "'+e+'" YAML type.')}var w=Vn;function we(e,n){var r=[];return e[n].forEach(function(o){var i=r.length;r.forEach(function(t,l){t.tag===o.tag&&t.kind===o.kind&&t.multi===o.multi&&(i=l)}),r[i]=o}),r}function Xn(){var e={scalar:{},sequence:{},mapping:{},fallback:{},multi:{scalar:[],sequence:[],mapping:[],fallback:[]}},n,r;function o(i){i.multi?(e.multi[i.kind].push(i),e.multi.fallback.push(i)):e[i.kind][i.tag]=e.fallback[i.tag]=i}for(n=0,r=arguments.length;n<r;n+=1)arguments[n].forEach(o);return e}function ue(e){return this.extend(e)}ue.prototype.extend=function(n){var r=[],o=[];if(n instanceof w)o.push(n);else if(Array.isArray(n))o=o.concat(n);else if(n&&(Array.isArray(n.implicit)||Array.isArray(n.explicit)))n.implicit&&(r=r.concat(n.implicit)),n.explicit&&(o=o.concat(n.explicit));else throw new E("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");r.forEach(function(t){if(!(t instanceof w))throw new E("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(t.loadKind&&t.loadKind!=="scalar")throw new E("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");if(t.multi)throw new E("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.")}),o.forEach(function(t){if(!(t instanceof w))throw new E("Specified list of YAML types (or a single Type object) contains a non-Type object.")});var i=Object.create(ue.prototype);return i.implicit=(this.implicit||[]).concat(r),i.explicit=(this.explicit||[]).concat(o),i.compiledImplicit=we(i,"implicit"),i.compiledExplicit=we(i,"explicit"),i.compiledTypeMap=Xn(i.compiledImplicit,i.compiledExplicit),i};var Ge=ue,$e=new w("tag:yaml.org,2002:str",{kind:"scalar",construct:function(e){return e!==null?e:""}}),je=new w("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(e){return e!==null?e:[]}}),Ye=new w("tag:yaml.org,2002:map",{kind:"mapping",construct:function(e){return e!==null?e:{}}}),Be=new Ge({explicit:[$e,je,Ye]});function Jn(e){if(e===null)return!0;var n=e.length;return n===1&&e==="~"||n===4&&(e==="null"||e==="Null"||e==="NULL")}function zn(){return null}function Zn(e){return e===null}var He=new w("tag:yaml.org,2002:null",{kind:"scalar",resolve:Jn,construct:zn,predicate:Zn,represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"},empty:function(){return""}},defaultStyle:"lowercase"});function er(e){if(e===null)return!1;var n=e.length;return n===4&&(e==="true"||e==="True"||e==="TRUE")||n===5&&(e==="false"||e==="False"||e==="FALSE")}function nr(e){return e==="true"||e==="True"||e==="TRUE"}function rr(e){return Object.prototype.toString.call(e)==="[object Boolean]"}var Ue=new w("tag:yaml.org,2002:bool",{kind:"scalar",resolve:er,construct:nr,predicate:rr,represent:{lowercase:function(e){return e?"true":"false"},uppercase:function(e){return e?"TRUE":"FALSE"},camelcase:function(e){return e?"True":"False"}},defaultStyle:"lowercase"});function ir(e){return 48<=e&&e<=57||65<=e&&e<=70||97<=e&&e<=102}function or(e){return 48<=e&&e<=55}function lr(e){return 48<=e&&e<=57}function tr(e){if(e===null)return!1;var n=e.length,r=0,o=!1,i;if(!n)return!1;if(i=e[r],(i==="-"||i==="+")&&(i=e[++r]),i==="0"){if(r+1===n)return!0;if(i=e[++r],i==="b"){for(r++;r<n;r++)if(i=e[r],i!=="_"){if(i!=="0"&&i!=="1")return!1;o=!0}return o&&i!=="_"}if(i==="x"){for(r++;r<n;r++)if(i=e[r],i!=="_"){if(!ir(e.charCodeAt(r)))return!1;o=!0}return o&&i!=="_"}if(i==="o"){for(r++;r<n;r++)if(i=e[r],i!=="_"){if(!or(e.charCodeAt(r)))return!1;o=!0}return o&&i!=="_"}}if(i==="_")return!1;for(;r<n;r++)if(i=e[r],i!=="_"){if(!lr(e.charCodeAt(r)))return!1;o=!0}return!(!o||i==="_")}function ur(e){var n=e,r=1,o;if(n.indexOf("_")!==-1&&(n=n.replace(/_/g,"")),o=n[0],(o==="-"||o==="+")&&(o==="-"&&(r=-1),n=n.slice(1),o=n[0]),n==="0")return 0;if(o==="0"){if(n[1]==="b")return r*parseInt(n.slice(2),2);if(n[1]==="x")return r*parseInt(n.slice(2),16);if(n[1]==="o")return r*parseInt(n.slice(2),8)}return r*parseInt(n,10)}function cr(e){return Object.prototype.toString.call(e)==="[object Number]"&&e%1===0&&!A.isNegativeZero(e)}var Ke=new w("tag:yaml.org,2002:int",{kind:"scalar",resolve:tr,construct:ur,predicate:cr,represent:{binary:function(e){return e>=0?"0b"+e.toString(2):"-0b"+e.toString(2).slice(1)},octal:function(e){return e>=0?"0o"+e.toString(8):"-0o"+e.toString(8).slice(1)},decimal:function(e){return e.toString(10)},hexadecimal:function(e){return e>=0?"0x"+e.toString(16).toUpperCase():"-0x"+e.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}}),ar=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");function sr(e){return!(e===null||!ar.test(e)||e[e.length-1]==="_")}function fr(e){var n,r;return n=e.replace(/_/g,"").toLowerCase(),r=n[0]==="-"?-1:1,"+-".indexOf(n[0])>=0&&(n=n.slice(1)),n===".inf"?r===1?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:n===".nan"?NaN:r*parseFloat(n,10)}var pr=/^[-+]?[0-9]+e/;function dr(e,n){var r;if(isNaN(e))switch(n){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===e)switch(n){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===e)switch(n){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(A.isNegativeZero(e))return"-0.0";return r=e.toString(10),pr.test(r)?r.replace("e",".e"):r}function hr(e){return Object.prototype.toString.call(e)==="[object Number]"&&(e%1!==0||A.isNegativeZero(e))}var qe=new w("tag:yaml.org,2002:float",{kind:"scalar",resolve:sr,construct:fr,predicate:hr,represent:dr,defaultStyle:"lowercase"}),We=Be.extend({implicit:[He,Ue,Ke,qe]}),Qe=We,Ve=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),Xe=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");function mr(e){return e===null?!1:Ve.exec(e)!==null||Xe.exec(e)!==null}function gr(e){var n,r,o,i,t,l,u,c=0,a=null,f,s,d;if(n=Ve.exec(e),n===null&&(n=Xe.exec(e)),n===null)throw new Error("Date resolve error");if(r=+n[1],o=+n[2]-1,i=+n[3],!n[4])return new Date(Date.UTC(r,o,i));if(t=+n[4],l=+n[5],u=+n[6],n[7]){for(c=n[7].slice(0,3);c.length<3;)c+="0";c=+c}return n[9]&&(f=+n[10],s=+(n[11]||0),a=(f*60+s)*6e4,n[9]==="-"&&(a=-a)),d=new Date(Date.UTC(r,o,i,t,l,u,c)),a&&d.setTime(d.getTime()-a),d}function xr(e){return e.toISOString()}var Je=new w("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:mr,construct:gr,instanceOf:Date,represent:xr});function vr(e){return e==="<<"||e===null}var ze=new w("tag:yaml.org,2002:merge",{kind:"scalar",resolve:vr}),pe=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
9
- \r`;function yr(e){if(e===null)return!1;var n,r,o=0,i=e.length,t=pe;for(r=0;r<i;r++)if(n=t.indexOf(e.charAt(r)),!(n>64)){if(n<0)return!1;o+=6}return o%8===0}function Ar(e){var n,r,o=e.replace(/[\r\n=]/g,""),i=o.length,t=pe,l=0,u=[];for(n=0;n<i;n++)n%4===0&&n&&(u.push(l>>16&255),u.push(l>>8&255),u.push(l&255)),l=l<<6|t.indexOf(o.charAt(n));return r=i%4*6,r===0?(u.push(l>>16&255),u.push(l>>8&255),u.push(l&255)):r===18?(u.push(l>>10&255),u.push(l>>2&255)):r===12&&u.push(l>>4&255),new Uint8Array(u)}function wr(e){var n="",r=0,o,i,t=e.length,l=pe;for(o=0;o<t;o++)o%3===0&&o&&(n+=l[r>>18&63],n+=l[r>>12&63],n+=l[r>>6&63],n+=l[r&63]),r=(r<<8)+e[o];return i=t%3,i===0?(n+=l[r>>18&63],n+=l[r>>12&63],n+=l[r>>6&63],n+=l[r&63]):i===2?(n+=l[r>>10&63],n+=l[r>>4&63],n+=l[r<<2&63],n+=l[64]):i===1&&(n+=l[r>>2&63],n+=l[r<<4&63],n+=l[64],n+=l[64]),n}function Cr(e){return Object.prototype.toString.call(e)==="[object Uint8Array]"}var Ze=new w("tag:yaml.org,2002:binary",{kind:"scalar",resolve:yr,construct:Ar,predicate:Cr,represent:wr}),Er=Object.prototype.hasOwnProperty,Sr=Object.prototype.toString;function _r(e){if(e===null)return!0;var n=[],r,o,i,t,l,u=e;for(r=0,o=u.length;r<o;r+=1){if(i=u[r],l=!1,Sr.call(i)!=="[object Object]")return!1;for(t in i)if(Er.call(i,t))if(!l)l=!0;else return!1;if(!l)return!1;if(n.indexOf(t)===-1)n.push(t);else return!1}return!0}function br(e){return e!==null?e:[]}var en=new w("tag:yaml.org,2002:omap",{kind:"sequence",resolve:_r,construct:br}),Tr=Object.prototype.toString;function Ir(e){if(e===null)return!0;var n,r,o,i,t,l=e;for(t=new Array(l.length),n=0,r=l.length;n<r;n+=1){if(o=l[n],Tr.call(o)!=="[object Object]"||(i=Object.keys(o),i.length!==1))return!1;t[n]=[i[0],o[i[0]]]}return!0}function Fr(e){if(e===null)return[];var n,r,o,i,t,l=e;for(t=new Array(l.length),n=0,r=l.length;n<r;n+=1)o=l[n],i=Object.keys(o),t[n]=[i[0],o[i[0]]];return t}var nn=new w("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:Ir,construct:Fr}),kr=Object.prototype.hasOwnProperty;function Pr(e){if(e===null)return!0;var n,r=e;for(n in r)if(kr.call(r,n)&&r[n]!==null)return!1;return!0}function Or(e){return e!==null?e:{}}var rn=new w("tag:yaml.org,2002:set",{kind:"mapping",resolve:Pr,construct:Or}),de=Qe.extend({implicit:[Je,ze],explicit:[Ze,en,nn,rn]}),F=Object.prototype.hasOwnProperty,W=1,on=2,ln=3,Q=4,te=1,Lr=2,Ce=3,Nr=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,Rr=/[\x85\u2028\u2029]/,Dr=/[,\[\]\{\}]/,tn=/^(?:!|!!|![a-z\-]+!)$/i,un=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;function Ee(e){return Object.prototype.toString.call(e)}function b(e){return e===10||e===13}function O(e){return e===9||e===32}function S(e){return e===9||e===32||e===10||e===13}function D(e){return e===44||e===91||e===93||e===123||e===125}function Mr(e){var n;return 48<=e&&e<=57?e-48:(n=e|32,97<=n&&n<=102?n-97+10:-1)}function Gr(e){return e===120?2:e===117?4:e===85?8:0}function $r(e){return 48<=e&&e<=57?e-48:-1}function Se(e){return e===48?"\0":e===97?"\x07":e===98?"\b":e===116||e===9?" ":e===110?`
10
- `:e===118?"\v":e===102?"\f":e===114?"\r":e===101?"\x1B":e===32?" ":e===34?'"':e===47?"/":e===92?"\\":e===78?"\x85":e===95?"\xA0":e===76?"\u2028":e===80?"\u2029":""}function jr(e){return e<=65535?String.fromCharCode(e):String.fromCharCode((e-65536>>10)+55296,(e-65536&1023)+56320)}function cn(e,n,r){n==="__proto__"?Object.defineProperty(e,n,{configurable:!0,enumerable:!0,writable:!0,value:r}):e[n]=r}var an=new Array(256),sn=new Array(256);for(P=0;P<256;P++)an[P]=Se(P)?1:0,sn[P]=Se(P);var P;function Yr(e,n){this.input=e,this.filename=n.filename||null,this.schema=n.schema||de,this.onWarning=n.onWarning||null,this.legacy=n.legacy||!1,this.json=n.json||!1,this.listener=n.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=e.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.firstTabInLine=-1,this.documents=[]}function fn(e,n){var r={name:e.filename,buffer:e.input.slice(0,-1),position:e.position,line:e.line,column:e.position-e.lineStart};return r.snippet=Kn(r),new E(n,r)}function p(e,n){throw fn(e,n)}function V(e,n){e.onWarning&&e.onWarning.call(null,fn(e,n))}var _e={YAML:function(n,r,o){var i,t,l;n.version!==null&&p(n,"duplication of %YAML directive"),o.length!==1&&p(n,"YAML directive accepts exactly one argument"),i=/^([0-9]+)\.([0-9]+)$/.exec(o[0]),i===null&&p(n,"ill-formed argument of the YAML directive"),t=parseInt(i[1],10),l=parseInt(i[2],10),t!==1&&p(n,"unacceptable YAML version of the document"),n.version=o[0],n.checkLineBreaks=l<2,l!==1&&l!==2&&V(n,"unsupported YAML version of the document")},TAG:function(n,r,o){var i,t;o.length!==2&&p(n,"TAG directive accepts exactly two arguments"),i=o[0],t=o[1],tn.test(i)||p(n,"ill-formed tag handle (first argument) of the TAG directive"),F.call(n.tagMap,i)&&p(n,'there is a previously declared suffix for "'+i+'" tag handle'),un.test(t)||p(n,"ill-formed tag prefix (second argument) of the TAG directive");try{t=decodeURIComponent(t)}catch{p(n,"tag prefix is malformed: "+t)}n.tagMap[i]=t}};function I(e,n,r,o){var i,t,l,u;if(n<r){if(u=e.input.slice(n,r),o)for(i=0,t=u.length;i<t;i+=1)l=u.charCodeAt(i),l===9||32<=l&&l<=1114111||p(e,"expected valid JSON character");else Nr.test(u)&&p(e,"the stream contains non-printable characters");e.result+=u}}function be(e,n,r,o){var i,t,l,u;for(A.isObject(r)||p(e,"cannot merge mappings; the provided source object is unacceptable"),i=Object.keys(r),l=0,u=i.length;l<u;l+=1)t=i[l],F.call(n,t)||(cn(n,t,r[t]),o[t]=!0)}function M(e,n,r,o,i,t,l,u,c){var a,f;if(Array.isArray(i))for(i=Array.prototype.slice.call(i),a=0,f=i.length;a<f;a+=1)Array.isArray(i[a])&&p(e,"nested arrays are not supported inside keys"),typeof i=="object"&&Ee(i[a])==="[object Object]"&&(i[a]="[object Object]");if(typeof i=="object"&&Ee(i)==="[object Object]"&&(i="[object Object]"),i=String(i),n===null&&(n={}),o==="tag:yaml.org,2002:merge")if(Array.isArray(t))for(a=0,f=t.length;a<f;a+=1)be(e,n,t[a],r);else be(e,n,t,r);else!e.json&&!F.call(r,i)&&F.call(n,i)&&(e.line=l||e.line,e.lineStart=u||e.lineStart,e.position=c||e.position,p(e,"duplicated mapping key")),cn(n,i,t),delete r[i];return n}function he(e){var n;n=e.input.charCodeAt(e.position),n===10?e.position++:n===13?(e.position++,e.input.charCodeAt(e.position)===10&&e.position++):p(e,"a line break is expected"),e.line+=1,e.lineStart=e.position,e.firstTabInLine=-1}function y(e,n,r){for(var o=0,i=e.input.charCodeAt(e.position);i!==0;){for(;O(i);)i===9&&e.firstTabInLine===-1&&(e.firstTabInLine=e.position),i=e.input.charCodeAt(++e.position);if(n&&i===35)do i=e.input.charCodeAt(++e.position);while(i!==10&&i!==13&&i!==0);if(b(i))for(he(e),i=e.input.charCodeAt(e.position),o++,e.lineIndent=0;i===32;)e.lineIndent++,i=e.input.charCodeAt(++e.position);else break}return r!==-1&&o!==0&&e.lineIndent<r&&V(e,"deficient indentation"),o}function z(e){var n=e.position,r;return r=e.input.charCodeAt(n),!!((r===45||r===46)&&r===e.input.charCodeAt(n+1)&&r===e.input.charCodeAt(n+2)&&(n+=3,r=e.input.charCodeAt(n),r===0||S(r)))}function me(e,n){n===1?e.result+=" ":n>1&&(e.result+=A.repeat(`
11
- `,n-1))}function Br(e,n,r){var o,i,t,l,u,c,a,f,s=e.kind,d=e.result,h;if(h=e.input.charCodeAt(e.position),S(h)||D(h)||h===35||h===38||h===42||h===33||h===124||h===62||h===39||h===34||h===37||h===64||h===96||(h===63||h===45)&&(i=e.input.charCodeAt(e.position+1),S(i)||r&&D(i)))return!1;for(e.kind="scalar",e.result="",t=l=e.position,u=!1;h!==0;){if(h===58){if(i=e.input.charCodeAt(e.position+1),S(i)||r&&D(i))break}else if(h===35){if(o=e.input.charCodeAt(e.position-1),S(o))break}else{if(e.position===e.lineStart&&z(e)||r&&D(h))break;if(b(h))if(c=e.line,a=e.lineStart,f=e.lineIndent,y(e,!1,-1),e.lineIndent>=n){u=!0,h=e.input.charCodeAt(e.position);continue}else{e.position=l,e.line=c,e.lineStart=a,e.lineIndent=f;break}}u&&(I(e,t,l,!1),me(e,e.line-c),t=l=e.position,u=!1),O(h)||(l=e.position+1),h=e.input.charCodeAt(++e.position)}return I(e,t,l,!1),e.result?!0:(e.kind=s,e.result=d,!1)}function Hr(e,n){var r,o,i;if(r=e.input.charCodeAt(e.position),r!==39)return!1;for(e.kind="scalar",e.result="",e.position++,o=i=e.position;(r=e.input.charCodeAt(e.position))!==0;)if(r===39)if(I(e,o,e.position,!0),r=e.input.charCodeAt(++e.position),r===39)o=e.position,e.position++,i=e.position;else return!0;else b(r)?(I(e,o,i,!0),me(e,y(e,!1,n)),o=i=e.position):e.position===e.lineStart&&z(e)?p(e,"unexpected end of the document within a single quoted scalar"):(e.position++,i=e.position);p(e,"unexpected end of the stream within a single quoted scalar")}function Ur(e,n){var r,o,i,t,l,u;if(u=e.input.charCodeAt(e.position),u!==34)return!1;for(e.kind="scalar",e.result="",e.position++,r=o=e.position;(u=e.input.charCodeAt(e.position))!==0;){if(u===34)return I(e,r,e.position,!0),e.position++,!0;if(u===92){if(I(e,r,e.position,!0),u=e.input.charCodeAt(++e.position),b(u))y(e,!1,n);else if(u<256&&an[u])e.result+=sn[u],e.position++;else if((l=Gr(u))>0){for(i=l,t=0;i>0;i--)u=e.input.charCodeAt(++e.position),(l=Mr(u))>=0?t=(t<<4)+l:p(e,"expected hexadecimal character");e.result+=jr(t),e.position++}else p(e,"unknown escape sequence");r=o=e.position}else b(u)?(I(e,r,o,!0),me(e,y(e,!1,n)),r=o=e.position):e.position===e.lineStart&&z(e)?p(e,"unexpected end of the document within a double quoted scalar"):(e.position++,o=e.position)}p(e,"unexpected end of the stream within a double quoted scalar")}function Kr(e,n){var r=!0,o,i,t,l=e.tag,u,c=e.anchor,a,f,s,d,h,m=Object.create(null),x,v,_,g;if(g=e.input.charCodeAt(e.position),g===91)f=93,h=!1,u=[];else if(g===123)f=125,h=!0,u={};else return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=u),g=e.input.charCodeAt(++e.position);g!==0;){if(y(e,!0,n),g=e.input.charCodeAt(e.position),g===f)return e.position++,e.tag=l,e.anchor=c,e.kind=h?"mapping":"sequence",e.result=u,!0;r?g===44&&p(e,"expected the node content, but found ','"):p(e,"missed comma between flow collection entries"),v=x=_=null,s=d=!1,g===63&&(a=e.input.charCodeAt(e.position+1),S(a)&&(s=d=!0,e.position++,y(e,!0,n))),o=e.line,i=e.lineStart,t=e.position,G(e,n,W,!1,!0),v=e.tag,x=e.result,y(e,!0,n),g=e.input.charCodeAt(e.position),(d||e.line===o)&&g===58&&(s=!0,g=e.input.charCodeAt(++e.position),y(e,!0,n),G(e,n,W,!1,!0),_=e.result),h?M(e,u,m,v,x,_,o,i,t):s?u.push(M(e,null,m,v,x,_,o,i,t)):u.push(x),y(e,!0,n),g=e.input.charCodeAt(e.position),g===44?(r=!0,g=e.input.charCodeAt(++e.position)):r=!1}p(e,"unexpected end of the stream within a flow collection")}function qr(e,n){var r,o,i=te,t=!1,l=!1,u=n,c=0,a=!1,f,s;if(s=e.input.charCodeAt(e.position),s===124)o=!1;else if(s===62)o=!0;else return!1;for(e.kind="scalar",e.result="";s!==0;)if(s=e.input.charCodeAt(++e.position),s===43||s===45)te===i?i=s===43?Ce:Lr:p(e,"repeat of a chomping mode identifier");else if((f=$r(s))>=0)f===0?p(e,"bad explicit indentation width of a block scalar; it cannot be less than one"):l?p(e,"repeat of an indentation width identifier"):(u=n+f-1,l=!0);else break;if(O(s)){do s=e.input.charCodeAt(++e.position);while(O(s));if(s===35)do s=e.input.charCodeAt(++e.position);while(!b(s)&&s!==0)}for(;s!==0;){for(he(e),e.lineIndent=0,s=e.input.charCodeAt(e.position);(!l||e.lineIndent<u)&&s===32;)e.lineIndent++,s=e.input.charCodeAt(++e.position);if(!l&&e.lineIndent>u&&(u=e.lineIndent),b(s)){c++;continue}if(e.lineIndent<u){i===Ce?e.result+=A.repeat(`
12
- `,t?1+c:c):i===te&&t&&(e.result+=`
13
- `);break}for(o?O(s)?(a=!0,e.result+=A.repeat(`
4
+ `+e.mark.snippet),i+" "+n):i}function B(e,r){Error.call(this),this.name="YAMLException",this.reason=e,this.mark=r,this.message=Me(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack||""}B.prototype=Object.create(Error.prototype);B.prototype.constructor=B;B.prototype.toString=function(r){return this.name+": "+Me(this,r)};var E=B;function oe(e,r,n,i,o){var t="",l="",u=Math.floor(o/2)-1;return i-r>u&&(t=" ... ",r=i-u+t.length),n-i>u&&(l=" ...",n=i+u-l.length),{str:t+e.slice(r,n).replace(/\t/g,"\u2192")+l,pos:i-r+t.length}}function le(e,r){return A.repeat(" ",r-e.length)+e}function Hr(e,r){if(r=Object.create(r||null),!e.buffer)return null;r.maxLength||(r.maxLength=79),typeof r.indent!="number"&&(r.indent=1),typeof r.linesBefore!="number"&&(r.linesBefore=3),typeof r.linesAfter!="number"&&(r.linesAfter=2);for(var n=/\r?\n|\r|\0/g,i=[0],o=[],t,l=-1;t=n.exec(e.buffer);)o.push(t.index),i.push(t.index+t[0].length),e.position<=t.index&&l<0&&(l=i.length-2);l<0&&(l=i.length-1);var u="",c,a,f=Math.min(e.line+r.linesAfter,o.length).toString().length,s=r.maxLength-(r.indent+f+3);for(c=1;c<=r.linesBefore&&!(l-c<0);c++)a=oe(e.buffer,i[l-c],o[l-c],e.position-(i[l]-i[l-c]),s),u=A.repeat(" ",r.indent)+le((e.line-c+1).toString(),f)+" | "+a.str+`
5
+ `+u;for(a=oe(e.buffer,i[l],o[l],e.position,s),u+=A.repeat(" ",r.indent)+le((e.line+1).toString(),f)+" | "+a.str+`
6
+ `,u+=A.repeat("-",r.indent+f+3+a.pos)+`^
7
+ `,c=1;c<=r.linesAfter&&!(l+c>=o.length);c++)a=oe(e.buffer,i[l+c],o[l+c],e.position-(i[l]-i[l+c]),s),u+=A.repeat(" ",r.indent)+le((e.line+c+1).toString(),f)+" | "+a.str+`
8
+ `;return u.replace(/\n$/,"")}var Ur=Hr,Kr=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],qr=["scalar","sequence","mapping"];function Wr(e){var r={};return e!==null&&Object.keys(e).forEach(function(n){e[n].forEach(function(i){r[String(i)]=n})}),r}function Qr(e,r){if(r=r||{},Object.keys(r).forEach(function(n){if(Kr.indexOf(n)===-1)throw new E('Unknown option "'+n+'" is met in definition of "'+e+'" YAML type.')}),this.options=r,this.tag=e,this.kind=r.kind||null,this.resolve=r.resolve||function(){return!0},this.construct=r.construct||function(n){return n},this.instanceOf=r.instanceOf||null,this.predicate=r.predicate||null,this.represent=r.represent||null,this.representName=r.representName||null,this.defaultStyle=r.defaultStyle||null,this.multi=r.multi||!1,this.styleAliases=Wr(r.styleAliases||null),qr.indexOf(this.kind)===-1)throw new E('Unknown kind "'+this.kind+'" is specified for "'+e+'" YAML type.')}var w=Qr;function we(e,r){var n=[];return e[r].forEach(function(i){var o=n.length;n.forEach(function(t,l){t.tag===i.tag&&t.kind===i.kind&&t.multi===i.multi&&(o=l)}),n[o]=i}),n}function Vr(){var e={scalar:{},sequence:{},mapping:{},fallback:{},multi:{scalar:[],sequence:[],mapping:[],fallback:[]}},r,n;function i(o){o.multi?(e.multi[o.kind].push(o),e.multi.fallback.push(o)):e[o.kind][o.tag]=e.fallback[o.tag]=o}for(r=0,n=arguments.length;r<n;r+=1)arguments[r].forEach(i);return e}function ue(e){return this.extend(e)}ue.prototype.extend=function(r){var n=[],i=[];if(r instanceof w)i.push(r);else if(Array.isArray(r))i=i.concat(r);else if(r&&(Array.isArray(r.implicit)||Array.isArray(r.explicit)))r.implicit&&(n=n.concat(r.implicit)),r.explicit&&(i=i.concat(r.explicit));else throw new E("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");n.forEach(function(t){if(!(t instanceof w))throw new E("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(t.loadKind&&t.loadKind!=="scalar")throw new E("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");if(t.multi)throw new E("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.")}),i.forEach(function(t){if(!(t instanceof w))throw new E("Specified list of YAML types (or a single Type object) contains a non-Type object.")});var o=Object.create(ue.prototype);return o.implicit=(this.implicit||[]).concat(n),o.explicit=(this.explicit||[]).concat(i),o.compiledImplicit=we(o,"implicit"),o.compiledExplicit=we(o,"explicit"),o.compiledTypeMap=Vr(o.compiledImplicit,o.compiledExplicit),o};var $e=ue,je=new w("tag:yaml.org,2002:str",{kind:"scalar",construct:function(e){return e!==null?e:""}}),Ge=new w("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(e){return e!==null?e:[]}}),Ye=new w("tag:yaml.org,2002:map",{kind:"mapping",construct:function(e){return e!==null?e:{}}}),Be=new $e({explicit:[je,Ge,Ye]});function Xr(e){if(e===null)return!0;var r=e.length;return r===1&&e==="~"||r===4&&(e==="null"||e==="Null"||e==="NULL")}function Jr(){return null}function zr(e){return e===null}var He=new w("tag:yaml.org,2002:null",{kind:"scalar",resolve:Xr,construct:Jr,predicate:zr,represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"},empty:function(){return""}},defaultStyle:"lowercase"});function Zr(e){if(e===null)return!1;var r=e.length;return r===4&&(e==="true"||e==="True"||e==="TRUE")||r===5&&(e==="false"||e==="False"||e==="FALSE")}function en(e){return e==="true"||e==="True"||e==="TRUE"}function rn(e){return Object.prototype.toString.call(e)==="[object Boolean]"}var Ue=new w("tag:yaml.org,2002:bool",{kind:"scalar",resolve:Zr,construct:en,predicate:rn,represent:{lowercase:function(e){return e?"true":"false"},uppercase:function(e){return e?"TRUE":"FALSE"},camelcase:function(e){return e?"True":"False"}},defaultStyle:"lowercase"});function nn(e){return 48<=e&&e<=57||65<=e&&e<=70||97<=e&&e<=102}function on(e){return 48<=e&&e<=55}function ln(e){return 48<=e&&e<=57}function tn(e){if(e===null)return!1;var r=e.length,n=0,i=!1,o;if(!r)return!1;if(o=e[n],(o==="-"||o==="+")&&(o=e[++n]),o==="0"){if(n+1===r)return!0;if(o=e[++n],o==="b"){for(n++;n<r;n++)if(o=e[n],o!=="_"){if(o!=="0"&&o!=="1")return!1;i=!0}return i&&o!=="_"}if(o==="x"){for(n++;n<r;n++)if(o=e[n],o!=="_"){if(!nn(e.charCodeAt(n)))return!1;i=!0}return i&&o!=="_"}if(o==="o"){for(n++;n<r;n++)if(o=e[n],o!=="_"){if(!on(e.charCodeAt(n)))return!1;i=!0}return i&&o!=="_"}}if(o==="_")return!1;for(;n<r;n++)if(o=e[n],o!=="_"){if(!ln(e.charCodeAt(n)))return!1;i=!0}return!(!i||o==="_")}function un(e){var r=e,n=1,i;if(r.indexOf("_")!==-1&&(r=r.replace(/_/g,"")),i=r[0],(i==="-"||i==="+")&&(i==="-"&&(n=-1),r=r.slice(1),i=r[0]),r==="0")return 0;if(i==="0"){if(r[1]==="b")return n*parseInt(r.slice(2),2);if(r[1]==="x")return n*parseInt(r.slice(2),16);if(r[1]==="o")return n*parseInt(r.slice(2),8)}return n*parseInt(r,10)}function cn(e){return Object.prototype.toString.call(e)==="[object Number]"&&e%1===0&&!A.isNegativeZero(e)}var Ke=new w("tag:yaml.org,2002:int",{kind:"scalar",resolve:tn,construct:un,predicate:cn,represent:{binary:function(e){return e>=0?"0b"+e.toString(2):"-0b"+e.toString(2).slice(1)},octal:function(e){return e>=0?"0o"+e.toString(8):"-0o"+e.toString(8).slice(1)},decimal:function(e){return e.toString(10)},hexadecimal:function(e){return e>=0?"0x"+e.toString(16).toUpperCase():"-0x"+e.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}}),an=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");function sn(e){return!(e===null||!an.test(e)||e[e.length-1]==="_")}function fn(e){var r,n;return r=e.replace(/_/g,"").toLowerCase(),n=r[0]==="-"?-1:1,"+-".indexOf(r[0])>=0&&(r=r.slice(1)),r===".inf"?n===1?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:r===".nan"?NaN:n*parseFloat(r,10)}var pn=/^[-+]?[0-9]+e/;function dn(e,r){var n;if(isNaN(e))switch(r){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===e)switch(r){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===e)switch(r){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(A.isNegativeZero(e))return"-0.0";return n=e.toString(10),pn.test(n)?n.replace("e",".e"):n}function hn(e){return Object.prototype.toString.call(e)==="[object Number]"&&(e%1!==0||A.isNegativeZero(e))}var qe=new w("tag:yaml.org,2002:float",{kind:"scalar",resolve:sn,construct:fn,predicate:hn,represent:dn,defaultStyle:"lowercase"}),We=Be.extend({implicit:[He,Ue,Ke,qe]}),Qe=We,Ve=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),Xe=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");function mn(e){return e===null?!1:Ve.exec(e)!==null||Xe.exec(e)!==null}function gn(e){var r,n,i,o,t,l,u,c=0,a=null,f,s,d;if(r=Ve.exec(e),r===null&&(r=Xe.exec(e)),r===null)throw new Error("Date resolve error");if(n=+r[1],i=+r[2]-1,o=+r[3],!r[4])return new Date(Date.UTC(n,i,o));if(t=+r[4],l=+r[5],u=+r[6],r[7]){for(c=r[7].slice(0,3);c.length<3;)c+="0";c=+c}return r[9]&&(f=+r[10],s=+(r[11]||0),a=(f*60+s)*6e4,r[9]==="-"&&(a=-a)),d=new Date(Date.UTC(n,i,o,t,l,u,c)),a&&d.setTime(d.getTime()-a),d}function xn(e){return e.toISOString()}var Je=new w("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:mn,construct:gn,instanceOf:Date,represent:xn});function vn(e){return e==="<<"||e===null}var ze=new w("tag:yaml.org,2002:merge",{kind:"scalar",resolve:vn}),pe=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
9
+ \r`;function yn(e){if(e===null)return!1;var r,n,i=0,o=e.length,t=pe;for(n=0;n<o;n++)if(r=t.indexOf(e.charAt(n)),!(r>64)){if(r<0)return!1;i+=6}return i%8===0}function An(e){var r,n,i=e.replace(/[\r\n=]/g,""),o=i.length,t=pe,l=0,u=[];for(r=0;r<o;r++)r%4===0&&r&&(u.push(l>>16&255),u.push(l>>8&255),u.push(l&255)),l=l<<6|t.indexOf(i.charAt(r));return n=o%4*6,n===0?(u.push(l>>16&255),u.push(l>>8&255),u.push(l&255)):n===18?(u.push(l>>10&255),u.push(l>>2&255)):n===12&&u.push(l>>4&255),new Uint8Array(u)}function wn(e){var r="",n=0,i,o,t=e.length,l=pe;for(i=0;i<t;i++)i%3===0&&i&&(r+=l[n>>18&63],r+=l[n>>12&63],r+=l[n>>6&63],r+=l[n&63]),n=(n<<8)+e[i];return o=t%3,o===0?(r+=l[n>>18&63],r+=l[n>>12&63],r+=l[n>>6&63],r+=l[n&63]):o===2?(r+=l[n>>10&63],r+=l[n>>4&63],r+=l[n<<2&63],r+=l[64]):o===1&&(r+=l[n>>2&63],r+=l[n<<4&63],r+=l[64],r+=l[64]),r}function Cn(e){return Object.prototype.toString.call(e)==="[object Uint8Array]"}var Ze=new w("tag:yaml.org,2002:binary",{kind:"scalar",resolve:yn,construct:An,predicate:Cn,represent:wn}),En=Object.prototype.hasOwnProperty,Sn=Object.prototype.toString;function _n(e){if(e===null)return!0;var r=[],n,i,o,t,l,u=e;for(n=0,i=u.length;n<i;n+=1){if(o=u[n],l=!1,Sn.call(o)!=="[object Object]")return!1;for(t in o)if(En.call(o,t))if(!l)l=!0;else return!1;if(!l)return!1;if(r.indexOf(t)===-1)r.push(t);else return!1}return!0}function bn(e){return e!==null?e:[]}var er=new w("tag:yaml.org,2002:omap",{kind:"sequence",resolve:_n,construct:bn}),Tn=Object.prototype.toString;function In(e){if(e===null)return!0;var r,n,i,o,t,l=e;for(t=new Array(l.length),r=0,n=l.length;r<n;r+=1){if(i=l[r],Tn.call(i)!=="[object Object]"||(o=Object.keys(i),o.length!==1))return!1;t[r]=[o[0],i[o[0]]]}return!0}function Fn(e){if(e===null)return[];var r,n,i,o,t,l=e;for(t=new Array(l.length),r=0,n=l.length;r<n;r+=1)i=l[r],o=Object.keys(i),t[r]=[o[0],i[o[0]]];return t}var rr=new w("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:In,construct:Fn}),kn=Object.prototype.hasOwnProperty;function Pn(e){if(e===null)return!0;var r,n=e;for(r in n)if(kn.call(n,r)&&n[r]!==null)return!1;return!0}function On(e){return e!==null?e:{}}var nr=new w("tag:yaml.org,2002:set",{kind:"mapping",resolve:Pn,construct:On}),de=Qe.extend({implicit:[Je,ze],explicit:[Ze,er,rr,nr]}),F=Object.prototype.hasOwnProperty,W=1,ir=2,or=3,Q=4,te=1,Ln=2,Ce=3,Nn=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,Rn=/[\x85\u2028\u2029]/,Dn=/[,\[\]\{\}]/,lr=/^(?:!|!!|![a-z\-]+!)$/i,tr=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;function Ee(e){return Object.prototype.toString.call(e)}function b(e){return e===10||e===13}function O(e){return e===9||e===32}function S(e){return e===9||e===32||e===10||e===13}function D(e){return e===44||e===91||e===93||e===123||e===125}function Mn(e){var r;return 48<=e&&e<=57?e-48:(r=e|32,97<=r&&r<=102?r-97+10:-1)}function $n(e){return e===120?2:e===117?4:e===85?8:0}function jn(e){return 48<=e&&e<=57?e-48:-1}function Se(e){return e===48?"\0":e===97?"\x07":e===98?"\b":e===116||e===9?" ":e===110?`
10
+ `:e===118?"\v":e===102?"\f":e===114?"\r":e===101?"\x1B":e===32?" ":e===34?'"':e===47?"/":e===92?"\\":e===78?"\x85":e===95?"\xA0":e===76?"\u2028":e===80?"\u2029":""}function Gn(e){return e<=65535?String.fromCharCode(e):String.fromCharCode((e-65536>>10)+55296,(e-65536&1023)+56320)}function ur(e,r,n){r==="__proto__"?Object.defineProperty(e,r,{configurable:!0,enumerable:!0,writable:!0,value:n}):e[r]=n}var cr=new Array(256),ar=new Array(256);for(P=0;P<256;P++)cr[P]=Se(P)?1:0,ar[P]=Se(P);var P;function Yn(e,r){this.input=e,this.filename=r.filename||null,this.schema=r.schema||de,this.onWarning=r.onWarning||null,this.legacy=r.legacy||!1,this.json=r.json||!1,this.listener=r.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=e.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.firstTabInLine=-1,this.documents=[]}function sr(e,r){var n={name:e.filename,buffer:e.input.slice(0,-1),position:e.position,line:e.line,column:e.position-e.lineStart};return n.snippet=Ur(n),new E(r,n)}function p(e,r){throw sr(e,r)}function V(e,r){e.onWarning&&e.onWarning.call(null,sr(e,r))}var _e={YAML:function(r,n,i){var o,t,l;r.version!==null&&p(r,"duplication of %YAML directive"),i.length!==1&&p(r,"YAML directive accepts exactly one argument"),o=/^([0-9]+)\.([0-9]+)$/.exec(i[0]),o===null&&p(r,"ill-formed argument of the YAML directive"),t=parseInt(o[1],10),l=parseInt(o[2],10),t!==1&&p(r,"unacceptable YAML version of the document"),r.version=i[0],r.checkLineBreaks=l<2,l!==1&&l!==2&&V(r,"unsupported YAML version of the document")},TAG:function(r,n,i){var o,t;i.length!==2&&p(r,"TAG directive accepts exactly two arguments"),o=i[0],t=i[1],lr.test(o)||p(r,"ill-formed tag handle (first argument) of the TAG directive"),F.call(r.tagMap,o)&&p(r,'there is a previously declared suffix for "'+o+'" tag handle'),tr.test(t)||p(r,"ill-formed tag prefix (second argument) of the TAG directive");try{t=decodeURIComponent(t)}catch{p(r,"tag prefix is malformed: "+t)}r.tagMap[o]=t}};function I(e,r,n,i){var o,t,l,u;if(r<n){if(u=e.input.slice(r,n),i)for(o=0,t=u.length;o<t;o+=1)l=u.charCodeAt(o),l===9||32<=l&&l<=1114111||p(e,"expected valid JSON character");else Nn.test(u)&&p(e,"the stream contains non-printable characters");e.result+=u}}function be(e,r,n,i){var o,t,l,u;for(A.isObject(n)||p(e,"cannot merge mappings; the provided source object is unacceptable"),o=Object.keys(n),l=0,u=o.length;l<u;l+=1)t=o[l],F.call(r,t)||(ur(r,t,n[t]),i[t]=!0)}function M(e,r,n,i,o,t,l,u,c){var a,f;if(Array.isArray(o))for(o=Array.prototype.slice.call(o),a=0,f=o.length;a<f;a+=1)Array.isArray(o[a])&&p(e,"nested arrays are not supported inside keys"),typeof o=="object"&&Ee(o[a])==="[object Object]"&&(o[a]="[object Object]");if(typeof o=="object"&&Ee(o)==="[object Object]"&&(o="[object Object]"),o=String(o),r===null&&(r={}),i==="tag:yaml.org,2002:merge")if(Array.isArray(t))for(a=0,f=t.length;a<f;a+=1)be(e,r,t[a],n);else be(e,r,t,n);else!e.json&&!F.call(n,o)&&F.call(r,o)&&(e.line=l||e.line,e.lineStart=u||e.lineStart,e.position=c||e.position,p(e,"duplicated mapping key")),ur(r,o,t),delete n[o];return r}function he(e){var r;r=e.input.charCodeAt(e.position),r===10?e.position++:r===13?(e.position++,e.input.charCodeAt(e.position)===10&&e.position++):p(e,"a line break is expected"),e.line+=1,e.lineStart=e.position,e.firstTabInLine=-1}function y(e,r,n){for(var i=0,o=e.input.charCodeAt(e.position);o!==0;){for(;O(o);)o===9&&e.firstTabInLine===-1&&(e.firstTabInLine=e.position),o=e.input.charCodeAt(++e.position);if(r&&o===35)do o=e.input.charCodeAt(++e.position);while(o!==10&&o!==13&&o!==0);if(b(o))for(he(e),o=e.input.charCodeAt(e.position),i++,e.lineIndent=0;o===32;)e.lineIndent++,o=e.input.charCodeAt(++e.position);else break}return n!==-1&&i!==0&&e.lineIndent<n&&V(e,"deficient indentation"),i}function z(e){var r=e.position,n;return n=e.input.charCodeAt(r),!!((n===45||n===46)&&n===e.input.charCodeAt(r+1)&&n===e.input.charCodeAt(r+2)&&(r+=3,n=e.input.charCodeAt(r),n===0||S(n)))}function me(e,r){r===1?e.result+=" ":r>1&&(e.result+=A.repeat(`
11
+ `,r-1))}function Bn(e,r,n){var i,o,t,l,u,c,a,f,s=e.kind,d=e.result,h;if(h=e.input.charCodeAt(e.position),S(h)||D(h)||h===35||h===38||h===42||h===33||h===124||h===62||h===39||h===34||h===37||h===64||h===96||(h===63||h===45)&&(o=e.input.charCodeAt(e.position+1),S(o)||n&&D(o)))return!1;for(e.kind="scalar",e.result="",t=l=e.position,u=!1;h!==0;){if(h===58){if(o=e.input.charCodeAt(e.position+1),S(o)||n&&D(o))break}else if(h===35){if(i=e.input.charCodeAt(e.position-1),S(i))break}else{if(e.position===e.lineStart&&z(e)||n&&D(h))break;if(b(h))if(c=e.line,a=e.lineStart,f=e.lineIndent,y(e,!1,-1),e.lineIndent>=r){u=!0,h=e.input.charCodeAt(e.position);continue}else{e.position=l,e.line=c,e.lineStart=a,e.lineIndent=f;break}}u&&(I(e,t,l,!1),me(e,e.line-c),t=l=e.position,u=!1),O(h)||(l=e.position+1),h=e.input.charCodeAt(++e.position)}return I(e,t,l,!1),e.result?!0:(e.kind=s,e.result=d,!1)}function Hn(e,r){var n,i,o;if(n=e.input.charCodeAt(e.position),n!==39)return!1;for(e.kind="scalar",e.result="",e.position++,i=o=e.position;(n=e.input.charCodeAt(e.position))!==0;)if(n===39)if(I(e,i,e.position,!0),n=e.input.charCodeAt(++e.position),n===39)i=e.position,e.position++,o=e.position;else return!0;else b(n)?(I(e,i,o,!0),me(e,y(e,!1,r)),i=o=e.position):e.position===e.lineStart&&z(e)?p(e,"unexpected end of the document within a single quoted scalar"):(e.position++,o=e.position);p(e,"unexpected end of the stream within a single quoted scalar")}function Un(e,r){var n,i,o,t,l,u;if(u=e.input.charCodeAt(e.position),u!==34)return!1;for(e.kind="scalar",e.result="",e.position++,n=i=e.position;(u=e.input.charCodeAt(e.position))!==0;){if(u===34)return I(e,n,e.position,!0),e.position++,!0;if(u===92){if(I(e,n,e.position,!0),u=e.input.charCodeAt(++e.position),b(u))y(e,!1,r);else if(u<256&&cr[u])e.result+=ar[u],e.position++;else if((l=$n(u))>0){for(o=l,t=0;o>0;o--)u=e.input.charCodeAt(++e.position),(l=Mn(u))>=0?t=(t<<4)+l:p(e,"expected hexadecimal character");e.result+=Gn(t),e.position++}else p(e,"unknown escape sequence");n=i=e.position}else b(u)?(I(e,n,i,!0),me(e,y(e,!1,r)),n=i=e.position):e.position===e.lineStart&&z(e)?p(e,"unexpected end of the document within a double quoted scalar"):(e.position++,i=e.position)}p(e,"unexpected end of the stream within a double quoted scalar")}function Kn(e,r){var n=!0,i,o,t,l=e.tag,u,c=e.anchor,a,f,s,d,h,m=Object.create(null),x,v,_,g;if(g=e.input.charCodeAt(e.position),g===91)f=93,h=!1,u=[];else if(g===123)f=125,h=!0,u={};else return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=u),g=e.input.charCodeAt(++e.position);g!==0;){if(y(e,!0,r),g=e.input.charCodeAt(e.position),g===f)return e.position++,e.tag=l,e.anchor=c,e.kind=h?"mapping":"sequence",e.result=u,!0;n?g===44&&p(e,"expected the node content, but found ','"):p(e,"missed comma between flow collection entries"),v=x=_=null,s=d=!1,g===63&&(a=e.input.charCodeAt(e.position+1),S(a)&&(s=d=!0,e.position++,y(e,!0,r))),i=e.line,o=e.lineStart,t=e.position,$(e,r,W,!1,!0),v=e.tag,x=e.result,y(e,!0,r),g=e.input.charCodeAt(e.position),(d||e.line===i)&&g===58&&(s=!0,g=e.input.charCodeAt(++e.position),y(e,!0,r),$(e,r,W,!1,!0),_=e.result),h?M(e,u,m,v,x,_,i,o,t):s?u.push(M(e,null,m,v,x,_,i,o,t)):u.push(x),y(e,!0,r),g=e.input.charCodeAt(e.position),g===44?(n=!0,g=e.input.charCodeAt(++e.position)):n=!1}p(e,"unexpected end of the stream within a flow collection")}function qn(e,r){var n,i,o=te,t=!1,l=!1,u=r,c=0,a=!1,f,s;if(s=e.input.charCodeAt(e.position),s===124)i=!1;else if(s===62)i=!0;else return!1;for(e.kind="scalar",e.result="";s!==0;)if(s=e.input.charCodeAt(++e.position),s===43||s===45)te===o?o=s===43?Ce:Ln:p(e,"repeat of a chomping mode identifier");else if((f=jn(s))>=0)f===0?p(e,"bad explicit indentation width of a block scalar; it cannot be less than one"):l?p(e,"repeat of an indentation width identifier"):(u=r+f-1,l=!0);else break;if(O(s)){do s=e.input.charCodeAt(++e.position);while(O(s));if(s===35)do s=e.input.charCodeAt(++e.position);while(!b(s)&&s!==0)}for(;s!==0;){for(he(e),e.lineIndent=0,s=e.input.charCodeAt(e.position);(!l||e.lineIndent<u)&&s===32;)e.lineIndent++,s=e.input.charCodeAt(++e.position);if(!l&&e.lineIndent>u&&(u=e.lineIndent),b(s)){c++;continue}if(e.lineIndent<u){o===Ce?e.result+=A.repeat(`
12
+ `,t?1+c:c):o===te&&t&&(e.result+=`
13
+ `);break}for(i?O(s)?(a=!0,e.result+=A.repeat(`
14
14
  `,t?1+c:c)):a?(a=!1,e.result+=A.repeat(`
15
15
  `,c+1)):c===0?t&&(e.result+=" "):e.result+=A.repeat(`
16
16
  `,c):e.result+=A.repeat(`
17
- `,t?1+c:c),t=!0,l=!0,c=0,r=e.position;!b(s)&&s!==0;)s=e.input.charCodeAt(++e.position);I(e,r,e.position,!1)}return!0}function Te(e,n){var r,o=e.tag,i=e.anchor,t=[],l,u=!1,c;if(e.firstTabInLine!==-1)return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=t),c=e.input.charCodeAt(e.position);c!==0&&(e.firstTabInLine!==-1&&(e.position=e.firstTabInLine,p(e,"tab characters must not be used in indentation")),!(c!==45||(l=e.input.charCodeAt(e.position+1),!S(l))));){if(u=!0,e.position++,y(e,!0,-1)&&e.lineIndent<=n){t.push(null),c=e.input.charCodeAt(e.position);continue}if(r=e.line,G(e,n,ln,!1,!0),t.push(e.result),y(e,!0,-1),c=e.input.charCodeAt(e.position),(e.line===r||e.lineIndent>n)&&c!==0)p(e,"bad indentation of a sequence entry");else if(e.lineIndent<n)break}return u?(e.tag=o,e.anchor=i,e.kind="sequence",e.result=t,!0):!1}function Wr(e,n,r){var o,i,t,l,u,c,a=e.tag,f=e.anchor,s={},d=Object.create(null),h=null,m=null,x=null,v=!1,_=!1,g;if(e.firstTabInLine!==-1)return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=s),g=e.input.charCodeAt(e.position);g!==0;){if(!v&&e.firstTabInLine!==-1&&(e.position=e.firstTabInLine,p(e,"tab characters must not be used in indentation")),o=e.input.charCodeAt(e.position+1),t=e.line,(g===63||g===58)&&S(o))g===63?(v&&(M(e,s,d,h,m,null,l,u,c),h=m=x=null),_=!0,v=!0,i=!0):v?(v=!1,i=!0):p(e,"incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line"),e.position+=1,g=o;else{if(l=e.line,u=e.lineStart,c=e.position,!G(e,r,on,!1,!0))break;if(e.line===t){for(g=e.input.charCodeAt(e.position);O(g);)g=e.input.charCodeAt(++e.position);if(g===58)g=e.input.charCodeAt(++e.position),S(g)||p(e,"a whitespace character is expected after the key-value separator within a block mapping"),v&&(M(e,s,d,h,m,null,l,u,c),h=m=x=null),_=!0,v=!1,i=!1,h=e.tag,m=e.result;else if(_)p(e,"can not read an implicit mapping pair; a colon is missed");else return e.tag=a,e.anchor=f,!0}else if(_)p(e,"can not read a block mapping entry; a multiline key may not be an implicit key");else return e.tag=a,e.anchor=f,!0}if((e.line===t||e.lineIndent>n)&&(v&&(l=e.line,u=e.lineStart,c=e.position),G(e,n,Q,!0,i)&&(v?m=e.result:x=e.result),v||(M(e,s,d,h,m,x,l,u,c),h=m=x=null),y(e,!0,-1),g=e.input.charCodeAt(e.position)),(e.line===t||e.lineIndent>n)&&g!==0)p(e,"bad indentation of a mapping entry");else if(e.lineIndent<n)break}return v&&M(e,s,d,h,m,null,l,u,c),_&&(e.tag=a,e.anchor=f,e.kind="mapping",e.result=s),_}function Qr(e){var n,r=!1,o=!1,i,t,l;if(l=e.input.charCodeAt(e.position),l!==33)return!1;if(e.tag!==null&&p(e,"duplication of a tag property"),l=e.input.charCodeAt(++e.position),l===60?(r=!0,l=e.input.charCodeAt(++e.position)):l===33?(o=!0,i="!!",l=e.input.charCodeAt(++e.position)):i="!",n=e.position,r){do l=e.input.charCodeAt(++e.position);while(l!==0&&l!==62);e.position<e.length?(t=e.input.slice(n,e.position),l=e.input.charCodeAt(++e.position)):p(e,"unexpected end of the stream within a verbatim tag")}else{for(;l!==0&&!S(l);)l===33&&(o?p(e,"tag suffix cannot contain exclamation marks"):(i=e.input.slice(n-1,e.position+1),tn.test(i)||p(e,"named tag handle cannot contain such characters"),o=!0,n=e.position+1)),l=e.input.charCodeAt(++e.position);t=e.input.slice(n,e.position),Dr.test(t)&&p(e,"tag suffix cannot contain flow indicator characters")}t&&!un.test(t)&&p(e,"tag name cannot contain such characters: "+t);try{t=decodeURIComponent(t)}catch{p(e,"tag name is malformed: "+t)}return r?e.tag=t:F.call(e.tagMap,i)?e.tag=e.tagMap[i]+t:i==="!"?e.tag="!"+t:i==="!!"?e.tag="tag:yaml.org,2002:"+t:p(e,'undeclared tag handle "'+i+'"'),!0}function Vr(e){var n,r;if(r=e.input.charCodeAt(e.position),r!==38)return!1;for(e.anchor!==null&&p(e,"duplication of an anchor property"),r=e.input.charCodeAt(++e.position),n=e.position;r!==0&&!S(r)&&!D(r);)r=e.input.charCodeAt(++e.position);return e.position===n&&p(e,"name of an anchor node must contain at least one character"),e.anchor=e.input.slice(n,e.position),!0}function Xr(e){var n,r,o;if(o=e.input.charCodeAt(e.position),o!==42)return!1;for(o=e.input.charCodeAt(++e.position),n=e.position;o!==0&&!S(o)&&!D(o);)o=e.input.charCodeAt(++e.position);return e.position===n&&p(e,"name of an alias node must contain at least one character"),r=e.input.slice(n,e.position),F.call(e.anchorMap,r)||p(e,'unidentified alias "'+r+'"'),e.result=e.anchorMap[r],y(e,!0,-1),!0}function G(e,n,r,o,i){var t,l,u,c=1,a=!1,f=!1,s,d,h,m,x,v;if(e.listener!==null&&e.listener("open",e),e.tag=null,e.anchor=null,e.kind=null,e.result=null,t=l=u=Q===r||ln===r,o&&y(e,!0,-1)&&(a=!0,e.lineIndent>n?c=1:e.lineIndent===n?c=0:e.lineIndent<n&&(c=-1)),c===1)for(;Qr(e)||Vr(e);)y(e,!0,-1)?(a=!0,u=t,e.lineIndent>n?c=1:e.lineIndent===n?c=0:e.lineIndent<n&&(c=-1)):u=!1;if(u&&(u=a||i),(c===1||Q===r)&&(W===r||on===r?x=n:x=n+1,v=e.position-e.lineStart,c===1?u&&(Te(e,v)||Wr(e,v,x))||Kr(e,x)?f=!0:(l&&qr(e,x)||Hr(e,x)||Ur(e,x)?f=!0:Xr(e)?(f=!0,(e.tag!==null||e.anchor!==null)&&p(e,"alias node should not have any properties")):Br(e,x,W===r)&&(f=!0,e.tag===null&&(e.tag="?")),e.anchor!==null&&(e.anchorMap[e.anchor]=e.result)):c===0&&(f=u&&Te(e,v))),e.tag===null)e.anchor!==null&&(e.anchorMap[e.anchor]=e.result);else if(e.tag==="?"){for(e.result!==null&&e.kind!=="scalar"&&p(e,'unacceptable node kind for !<?> tag; it should be "scalar", not "'+e.kind+'"'),s=0,d=e.implicitTypes.length;s<d;s+=1)if(m=e.implicitTypes[s],m.resolve(e.result)){e.result=m.construct(e.result),e.tag=m.tag,e.anchor!==null&&(e.anchorMap[e.anchor]=e.result);break}}else if(e.tag!=="!"){if(F.call(e.typeMap[e.kind||"fallback"],e.tag))m=e.typeMap[e.kind||"fallback"][e.tag];else for(m=null,h=e.typeMap.multi[e.kind||"fallback"],s=0,d=h.length;s<d;s+=1)if(e.tag.slice(0,h[s].tag.length)===h[s].tag){m=h[s];break}m||p(e,"unknown tag !<"+e.tag+">"),e.result!==null&&m.kind!==e.kind&&p(e,"unacceptable node kind for !<"+e.tag+'> tag; it should be "'+m.kind+'", not "'+e.kind+'"'),m.resolve(e.result,e.tag)?(e.result=m.construct(e.result,e.tag),e.anchor!==null&&(e.anchorMap[e.anchor]=e.result)):p(e,"cannot resolve a node with !<"+e.tag+"> explicit tag")}return e.listener!==null&&e.listener("close",e),e.tag!==null||e.anchor!==null||f}function Jr(e){var n=e.position,r,o,i,t=!1,l;for(e.version=null,e.checkLineBreaks=e.legacy,e.tagMap=Object.create(null),e.anchorMap=Object.create(null);(l=e.input.charCodeAt(e.position))!==0&&(y(e,!0,-1),l=e.input.charCodeAt(e.position),!(e.lineIndent>0||l!==37));){for(t=!0,l=e.input.charCodeAt(++e.position),r=e.position;l!==0&&!S(l);)l=e.input.charCodeAt(++e.position);for(o=e.input.slice(r,e.position),i=[],o.length<1&&p(e,"directive name must not be less than one character in length");l!==0;){for(;O(l);)l=e.input.charCodeAt(++e.position);if(l===35){do l=e.input.charCodeAt(++e.position);while(l!==0&&!b(l));break}if(b(l))break;for(r=e.position;l!==0&&!S(l);)l=e.input.charCodeAt(++e.position);i.push(e.input.slice(r,e.position))}l!==0&&he(e),F.call(_e,o)?_e[o](e,o,i):V(e,'unknown document directive "'+o+'"')}if(y(e,!0,-1),e.lineIndent===0&&e.input.charCodeAt(e.position)===45&&e.input.charCodeAt(e.position+1)===45&&e.input.charCodeAt(e.position+2)===45?(e.position+=3,y(e,!0,-1)):t&&p(e,"directives end mark is expected"),G(e,e.lineIndent-1,Q,!1,!0),y(e,!0,-1),e.checkLineBreaks&&Rr.test(e.input.slice(n,e.position))&&V(e,"non-ASCII line breaks are interpreted as content"),e.documents.push(e.result),e.position===e.lineStart&&z(e)){e.input.charCodeAt(e.position)===46&&(e.position+=3,y(e,!0,-1));return}if(e.position<e.length-1)p(e,"end of the stream or a document separator is expected");else return}function pn(e,n){e=String(e),n=n||{},e.length!==0&&(e.charCodeAt(e.length-1)!==10&&e.charCodeAt(e.length-1)!==13&&(e+=`
18
- `),e.charCodeAt(0)===65279&&(e=e.slice(1)));var r=new Yr(e,n),o=e.indexOf("\0");for(o!==-1&&(r.position=o,p(r,"null byte is not allowed in input")),r.input+="\0";r.input.charCodeAt(r.position)===32;)r.lineIndent+=1,r.position+=1;for(;r.position<r.length-1;)Jr(r);return r.documents}function zr(e,n,r){n!==null&&typeof n=="object"&&typeof r>"u"&&(r=n,n=null);var o=pn(e,r);if(typeof n!="function")return o;for(var i=0,t=o.length;i<t;i+=1)n(o[i])}function Zr(e,n){var r=pn(e,n);if(r.length!==0){if(r.length===1)return r[0];throw new E("expected a single document in the stream, but found more")}}var ei=zr,ni=Zr,dn={loadAll:ei,load:ni},hn=Object.prototype.toString,mn=Object.prototype.hasOwnProperty,ge=65279,ri=9,H=10,ii=13,oi=32,li=33,ti=34,ce=35,ui=37,ci=38,ai=39,si=42,gn=44,fi=45,X=58,pi=61,di=62,hi=63,mi=64,xn=91,vn=93,gi=96,yn=123,xi=124,An=125,C={};C[0]="\\0";C[7]="\\a";C[8]="\\b";C[9]="\\t";C[10]="\\n";C[11]="\\v";C[12]="\\f";C[13]="\\r";C[27]="\\e";C[34]='\\"';C[92]="\\\\";C[133]="\\N";C[160]="\\_";C[8232]="\\L";C[8233]="\\P";var vi=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"],yi=/^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;function Ai(e,n){var r,o,i,t,l,u,c;if(n===null)return{};for(r={},o=Object.keys(n),i=0,t=o.length;i<t;i+=1)l=o[i],u=String(n[l]),l.slice(0,2)==="!!"&&(l="tag:yaml.org,2002:"+l.slice(2)),c=e.compiledTypeMap.fallback[l],c&&mn.call(c.styleAliases,u)&&(u=c.styleAliases[u]),r[l]=u;return r}function wi(e){var n,r,o;if(n=e.toString(16).toUpperCase(),e<=255)r="x",o=2;else if(e<=65535)r="u",o=4;else if(e<=4294967295)r="U",o=8;else throw new E("code point within a string may not be greater than 0xFFFFFFFF");return"\\"+r+A.repeat("0",o-n.length)+n}var Ci=1,U=2;function Ei(e){this.schema=e.schema||de,this.indent=Math.max(1,e.indent||2),this.noArrayIndent=e.noArrayIndent||!1,this.skipInvalid=e.skipInvalid||!1,this.flowLevel=A.isNothing(e.flowLevel)?-1:e.flowLevel,this.styleMap=Ai(this.schema,e.styles||null),this.sortKeys=e.sortKeys||!1,this.lineWidth=e.lineWidth||80,this.noRefs=e.noRefs||!1,this.noCompatMode=e.noCompatMode||!1,this.condenseFlow=e.condenseFlow||!1,this.quotingType=e.quotingType==='"'?U:Ci,this.forceQuotes=e.forceQuotes||!1,this.replacer=typeof e.replacer=="function"?e.replacer:null,this.implicitTypes=this.schema.compiledImplicit,this.explicitTypes=this.schema.compiledExplicit,this.tag=null,this.result="",this.duplicates=[],this.usedDuplicates=null}function Ie(e,n){for(var r=A.repeat(" ",n),o=0,i=-1,t="",l,u=e.length;o<u;)i=e.indexOf(`
19
- `,o),i===-1?(l=e.slice(o),o=u):(l=e.slice(o,i+1),o=i+1),l.length&&l!==`
20
- `&&(t+=r),t+=l;return t}function ae(e,n){return`
21
- `+A.repeat(" ",e.indent*n)}function Si(e,n){var r,o,i;for(r=0,o=e.implicitTypes.length;r<o;r+=1)if(i=e.implicitTypes[r],i.resolve(n))return!0;return!1}function J(e){return e===oi||e===ri}function K(e){return 32<=e&&e<=126||161<=e&&e<=55295&&e!==8232&&e!==8233||57344<=e&&e<=65533&&e!==ge||65536<=e&&e<=1114111}function Fe(e){return K(e)&&e!==ge&&e!==ii&&e!==H}function ke(e,n,r){var o=Fe(e),i=o&&!J(e);return(r?o:o&&e!==gn&&e!==xn&&e!==vn&&e!==yn&&e!==An)&&e!==ce&&!(n===X&&!i)||Fe(n)&&!J(n)&&e===ce||n===X&&i}function _i(e){return K(e)&&e!==ge&&!J(e)&&e!==fi&&e!==hi&&e!==X&&e!==gn&&e!==xn&&e!==vn&&e!==yn&&e!==An&&e!==ce&&e!==ci&&e!==si&&e!==li&&e!==xi&&e!==pi&&e!==di&&e!==ai&&e!==ti&&e!==ui&&e!==mi&&e!==gi}function bi(e){return!J(e)&&e!==X}function Y(e,n){var r=e.charCodeAt(n),o;return r>=55296&&r<=56319&&n+1<e.length&&(o=e.charCodeAt(n+1),o>=56320&&o<=57343)?(r-55296)*1024+o-56320+65536:r}function wn(e){var n=/^\n* /;return n.test(e)}var Cn=1,se=2,En=3,Sn=4,R=5;function Ti(e,n,r,o,i,t,l,u){var c,a=0,f=null,s=!1,d=!1,h=o!==-1,m=-1,x=_i(Y(e,0))&&bi(Y(e,e.length-1));if(n||l)for(c=0;c<e.length;a>=65536?c+=2:c++){if(a=Y(e,c),!K(a))return R;x=x&&ke(a,f,u),f=a}else{for(c=0;c<e.length;a>=65536?c+=2:c++){if(a=Y(e,c),a===H)s=!0,h&&(d=d||c-m-1>o&&e[m+1]!==" ",m=c);else if(!K(a))return R;x=x&&ke(a,f,u),f=a}d=d||h&&c-m-1>o&&e[m+1]!==" "}return!s&&!d?x&&!l&&!i(e)?Cn:t===U?R:se:r>9&&wn(e)?R:l?t===U?R:se:d?Sn:En}function Ii(e,n,r,o,i){e.dump=function(){if(n.length===0)return e.quotingType===U?'""':"''";if(!e.noCompatMode&&(vi.indexOf(n)!==-1||yi.test(n)))return e.quotingType===U?'"'+n+'"':"'"+n+"'";var t=e.indent*Math.max(1,r),l=e.lineWidth===-1?-1:Math.max(Math.min(e.lineWidth,40),e.lineWidth-t),u=o||e.flowLevel>-1&&r>=e.flowLevel;function c(a){return Si(e,a)}switch(Ti(n,u,e.indent,l,c,e.quotingType,e.forceQuotes&&!o,i)){case Cn:return n;case se:return"'"+n.replace(/'/g,"''")+"'";case En:return"|"+Pe(n,e.indent)+Oe(Ie(n,t));case Sn:return">"+Pe(n,e.indent)+Oe(Ie(Fi(n,l),t));case R:return'"'+ki(n)+'"';default:throw new E("impossible error: invalid scalar style")}}()}function Pe(e,n){var r=wn(e)?String(n):"",o=e[e.length-1]===`
22
- `,i=o&&(e[e.length-2]===`
17
+ `,t?1+c:c),t=!0,l=!0,c=0,n=e.position;!b(s)&&s!==0;)s=e.input.charCodeAt(++e.position);I(e,n,e.position,!1)}return!0}function Te(e,r){var n,i=e.tag,o=e.anchor,t=[],l,u=!1,c;if(e.firstTabInLine!==-1)return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=t),c=e.input.charCodeAt(e.position);c!==0&&(e.firstTabInLine!==-1&&(e.position=e.firstTabInLine,p(e,"tab characters must not be used in indentation")),!(c!==45||(l=e.input.charCodeAt(e.position+1),!S(l))));){if(u=!0,e.position++,y(e,!0,-1)&&e.lineIndent<=r){t.push(null),c=e.input.charCodeAt(e.position);continue}if(n=e.line,$(e,r,or,!1,!0),t.push(e.result),y(e,!0,-1),c=e.input.charCodeAt(e.position),(e.line===n||e.lineIndent>r)&&c!==0)p(e,"bad indentation of a sequence entry");else if(e.lineIndent<r)break}return u?(e.tag=i,e.anchor=o,e.kind="sequence",e.result=t,!0):!1}function Wn(e,r,n){var i,o,t,l,u,c,a=e.tag,f=e.anchor,s={},d=Object.create(null),h=null,m=null,x=null,v=!1,_=!1,g;if(e.firstTabInLine!==-1)return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=s),g=e.input.charCodeAt(e.position);g!==0;){if(!v&&e.firstTabInLine!==-1&&(e.position=e.firstTabInLine,p(e,"tab characters must not be used in indentation")),i=e.input.charCodeAt(e.position+1),t=e.line,(g===63||g===58)&&S(i))g===63?(v&&(M(e,s,d,h,m,null,l,u,c),h=m=x=null),_=!0,v=!0,o=!0):v?(v=!1,o=!0):p(e,"incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line"),e.position+=1,g=i;else{if(l=e.line,u=e.lineStart,c=e.position,!$(e,n,ir,!1,!0))break;if(e.line===t){for(g=e.input.charCodeAt(e.position);O(g);)g=e.input.charCodeAt(++e.position);if(g===58)g=e.input.charCodeAt(++e.position),S(g)||p(e,"a whitespace character is expected after the key-value separator within a block mapping"),v&&(M(e,s,d,h,m,null,l,u,c),h=m=x=null),_=!0,v=!1,o=!1,h=e.tag,m=e.result;else if(_)p(e,"can not read an implicit mapping pair; a colon is missed");else return e.tag=a,e.anchor=f,!0}else if(_)p(e,"can not read a block mapping entry; a multiline key may not be an implicit key");else return e.tag=a,e.anchor=f,!0}if((e.line===t||e.lineIndent>r)&&(v&&(l=e.line,u=e.lineStart,c=e.position),$(e,r,Q,!0,o)&&(v?m=e.result:x=e.result),v||(M(e,s,d,h,m,x,l,u,c),h=m=x=null),y(e,!0,-1),g=e.input.charCodeAt(e.position)),(e.line===t||e.lineIndent>r)&&g!==0)p(e,"bad indentation of a mapping entry");else if(e.lineIndent<r)break}return v&&M(e,s,d,h,m,null,l,u,c),_&&(e.tag=a,e.anchor=f,e.kind="mapping",e.result=s),_}function Qn(e){var r,n=!1,i=!1,o,t,l;if(l=e.input.charCodeAt(e.position),l!==33)return!1;if(e.tag!==null&&p(e,"duplication of a tag property"),l=e.input.charCodeAt(++e.position),l===60?(n=!0,l=e.input.charCodeAt(++e.position)):l===33?(i=!0,o="!!",l=e.input.charCodeAt(++e.position)):o="!",r=e.position,n){do l=e.input.charCodeAt(++e.position);while(l!==0&&l!==62);e.position<e.length?(t=e.input.slice(r,e.position),l=e.input.charCodeAt(++e.position)):p(e,"unexpected end of the stream within a verbatim tag")}else{for(;l!==0&&!S(l);)l===33&&(i?p(e,"tag suffix cannot contain exclamation marks"):(o=e.input.slice(r-1,e.position+1),lr.test(o)||p(e,"named tag handle cannot contain such characters"),i=!0,r=e.position+1)),l=e.input.charCodeAt(++e.position);t=e.input.slice(r,e.position),Dn.test(t)&&p(e,"tag suffix cannot contain flow indicator characters")}t&&!tr.test(t)&&p(e,"tag name cannot contain such characters: "+t);try{t=decodeURIComponent(t)}catch{p(e,"tag name is malformed: "+t)}return n?e.tag=t:F.call(e.tagMap,o)?e.tag=e.tagMap[o]+t:o==="!"?e.tag="!"+t:o==="!!"?e.tag="tag:yaml.org,2002:"+t:p(e,'undeclared tag handle "'+o+'"'),!0}function Vn(e){var r,n;if(n=e.input.charCodeAt(e.position),n!==38)return!1;for(e.anchor!==null&&p(e,"duplication of an anchor property"),n=e.input.charCodeAt(++e.position),r=e.position;n!==0&&!S(n)&&!D(n);)n=e.input.charCodeAt(++e.position);return e.position===r&&p(e,"name of an anchor node must contain at least one character"),e.anchor=e.input.slice(r,e.position),!0}function Xn(e){var r,n,i;if(i=e.input.charCodeAt(e.position),i!==42)return!1;for(i=e.input.charCodeAt(++e.position),r=e.position;i!==0&&!S(i)&&!D(i);)i=e.input.charCodeAt(++e.position);return e.position===r&&p(e,"name of an alias node must contain at least one character"),n=e.input.slice(r,e.position),F.call(e.anchorMap,n)||p(e,'unidentified alias "'+n+'"'),e.result=e.anchorMap[n],y(e,!0,-1),!0}function $(e,r,n,i,o){var t,l,u,c=1,a=!1,f=!1,s,d,h,m,x,v;if(e.listener!==null&&e.listener("open",e),e.tag=null,e.anchor=null,e.kind=null,e.result=null,t=l=u=Q===n||or===n,i&&y(e,!0,-1)&&(a=!0,e.lineIndent>r?c=1:e.lineIndent===r?c=0:e.lineIndent<r&&(c=-1)),c===1)for(;Qn(e)||Vn(e);)y(e,!0,-1)?(a=!0,u=t,e.lineIndent>r?c=1:e.lineIndent===r?c=0:e.lineIndent<r&&(c=-1)):u=!1;if(u&&(u=a||o),(c===1||Q===n)&&(W===n||ir===n?x=r:x=r+1,v=e.position-e.lineStart,c===1?u&&(Te(e,v)||Wn(e,v,x))||Kn(e,x)?f=!0:(l&&qn(e,x)||Hn(e,x)||Un(e,x)?f=!0:Xn(e)?(f=!0,(e.tag!==null||e.anchor!==null)&&p(e,"alias node should not have any properties")):Bn(e,x,W===n)&&(f=!0,e.tag===null&&(e.tag="?")),e.anchor!==null&&(e.anchorMap[e.anchor]=e.result)):c===0&&(f=u&&Te(e,v))),e.tag===null)e.anchor!==null&&(e.anchorMap[e.anchor]=e.result);else if(e.tag==="?"){for(e.result!==null&&e.kind!=="scalar"&&p(e,'unacceptable node kind for !<?> tag; it should be "scalar", not "'+e.kind+'"'),s=0,d=e.implicitTypes.length;s<d;s+=1)if(m=e.implicitTypes[s],m.resolve(e.result)){e.result=m.construct(e.result),e.tag=m.tag,e.anchor!==null&&(e.anchorMap[e.anchor]=e.result);break}}else if(e.tag!=="!"){if(F.call(e.typeMap[e.kind||"fallback"],e.tag))m=e.typeMap[e.kind||"fallback"][e.tag];else for(m=null,h=e.typeMap.multi[e.kind||"fallback"],s=0,d=h.length;s<d;s+=1)if(e.tag.slice(0,h[s].tag.length)===h[s].tag){m=h[s];break}m||p(e,"unknown tag !<"+e.tag+">"),e.result!==null&&m.kind!==e.kind&&p(e,"unacceptable node kind for !<"+e.tag+'> tag; it should be "'+m.kind+'", not "'+e.kind+'"'),m.resolve(e.result,e.tag)?(e.result=m.construct(e.result,e.tag),e.anchor!==null&&(e.anchorMap[e.anchor]=e.result)):p(e,"cannot resolve a node with !<"+e.tag+"> explicit tag")}return e.listener!==null&&e.listener("close",e),e.tag!==null||e.anchor!==null||f}function Jn(e){var r=e.position,n,i,o,t=!1,l;for(e.version=null,e.checkLineBreaks=e.legacy,e.tagMap=Object.create(null),e.anchorMap=Object.create(null);(l=e.input.charCodeAt(e.position))!==0&&(y(e,!0,-1),l=e.input.charCodeAt(e.position),!(e.lineIndent>0||l!==37));){for(t=!0,l=e.input.charCodeAt(++e.position),n=e.position;l!==0&&!S(l);)l=e.input.charCodeAt(++e.position);for(i=e.input.slice(n,e.position),o=[],i.length<1&&p(e,"directive name must not be less than one character in length");l!==0;){for(;O(l);)l=e.input.charCodeAt(++e.position);if(l===35){do l=e.input.charCodeAt(++e.position);while(l!==0&&!b(l));break}if(b(l))break;for(n=e.position;l!==0&&!S(l);)l=e.input.charCodeAt(++e.position);o.push(e.input.slice(n,e.position))}l!==0&&he(e),F.call(_e,i)?_e[i](e,i,o):V(e,'unknown document directive "'+i+'"')}if(y(e,!0,-1),e.lineIndent===0&&e.input.charCodeAt(e.position)===45&&e.input.charCodeAt(e.position+1)===45&&e.input.charCodeAt(e.position+2)===45?(e.position+=3,y(e,!0,-1)):t&&p(e,"directives end mark is expected"),$(e,e.lineIndent-1,Q,!1,!0),y(e,!0,-1),e.checkLineBreaks&&Rn.test(e.input.slice(r,e.position))&&V(e,"non-ASCII line breaks are interpreted as content"),e.documents.push(e.result),e.position===e.lineStart&&z(e)){e.input.charCodeAt(e.position)===46&&(e.position+=3,y(e,!0,-1));return}if(e.position<e.length-1)p(e,"end of the stream or a document separator is expected");else return}function fr(e,r){e=String(e),r=r||{},e.length!==0&&(e.charCodeAt(e.length-1)!==10&&e.charCodeAt(e.length-1)!==13&&(e+=`
18
+ `),e.charCodeAt(0)===65279&&(e=e.slice(1)));var n=new Yn(e,r),i=e.indexOf("\0");for(i!==-1&&(n.position=i,p(n,"null byte is not allowed in input")),n.input+="\0";n.input.charCodeAt(n.position)===32;)n.lineIndent+=1,n.position+=1;for(;n.position<n.length-1;)Jn(n);return n.documents}function zn(e,r,n){r!==null&&typeof r=="object"&&typeof n>"u"&&(n=r,r=null);var i=fr(e,n);if(typeof r!="function")return i;for(var o=0,t=i.length;o<t;o+=1)r(i[o])}function Zn(e,r){var n=fr(e,r);if(n.length!==0){if(n.length===1)return n[0];throw new E("expected a single document in the stream, but found more")}}var ei=zn,ri=Zn,pr={loadAll:ei,load:ri},dr=Object.prototype.toString,hr=Object.prototype.hasOwnProperty,ge=65279,ni=9,H=10,ii=13,oi=32,li=33,ti=34,ce=35,ui=37,ci=38,ai=39,si=42,mr=44,fi=45,X=58,pi=61,di=62,hi=63,mi=64,gr=91,xr=93,gi=96,vr=123,xi=124,yr=125,C={};C[0]="\\0";C[7]="\\a";C[8]="\\b";C[9]="\\t";C[10]="\\n";C[11]="\\v";C[12]="\\f";C[13]="\\r";C[27]="\\e";C[34]='\\"';C[92]="\\\\";C[133]="\\N";C[160]="\\_";C[8232]="\\L";C[8233]="\\P";var vi=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"],yi=/^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;function Ai(e,r){var n,i,o,t,l,u,c;if(r===null)return{};for(n={},i=Object.keys(r),o=0,t=i.length;o<t;o+=1)l=i[o],u=String(r[l]),l.slice(0,2)==="!!"&&(l="tag:yaml.org,2002:"+l.slice(2)),c=e.compiledTypeMap.fallback[l],c&&hr.call(c.styleAliases,u)&&(u=c.styleAliases[u]),n[l]=u;return n}function wi(e){var r,n,i;if(r=e.toString(16).toUpperCase(),e<=255)n="x",i=2;else if(e<=65535)n="u",i=4;else if(e<=4294967295)n="U",i=8;else throw new E("code point within a string may not be greater than 0xFFFFFFFF");return"\\"+n+A.repeat("0",i-r.length)+r}var Ci=1,U=2;function Ei(e){this.schema=e.schema||de,this.indent=Math.max(1,e.indent||2),this.noArrayIndent=e.noArrayIndent||!1,this.skipInvalid=e.skipInvalid||!1,this.flowLevel=A.isNothing(e.flowLevel)?-1:e.flowLevel,this.styleMap=Ai(this.schema,e.styles||null),this.sortKeys=e.sortKeys||!1,this.lineWidth=e.lineWidth||80,this.noRefs=e.noRefs||!1,this.noCompatMode=e.noCompatMode||!1,this.condenseFlow=e.condenseFlow||!1,this.quotingType=e.quotingType==='"'?U:Ci,this.forceQuotes=e.forceQuotes||!1,this.replacer=typeof e.replacer=="function"?e.replacer:null,this.implicitTypes=this.schema.compiledImplicit,this.explicitTypes=this.schema.compiledExplicit,this.tag=null,this.result="",this.duplicates=[],this.usedDuplicates=null}function Ie(e,r){for(var n=A.repeat(" ",r),i=0,o=-1,t="",l,u=e.length;i<u;)o=e.indexOf(`
19
+ `,i),o===-1?(l=e.slice(i),i=u):(l=e.slice(i,o+1),i=o+1),l.length&&l!==`
20
+ `&&(t+=n),t+=l;return t}function ae(e,r){return`
21
+ `+A.repeat(" ",e.indent*r)}function Si(e,r){var n,i,o;for(n=0,i=e.implicitTypes.length;n<i;n+=1)if(o=e.implicitTypes[n],o.resolve(r))return!0;return!1}function J(e){return e===oi||e===ni}function K(e){return 32<=e&&e<=126||161<=e&&e<=55295&&e!==8232&&e!==8233||57344<=e&&e<=65533&&e!==ge||65536<=e&&e<=1114111}function Fe(e){return K(e)&&e!==ge&&e!==ii&&e!==H}function ke(e,r,n){var i=Fe(e),o=i&&!J(e);return(n?i:i&&e!==mr&&e!==gr&&e!==xr&&e!==vr&&e!==yr)&&e!==ce&&!(r===X&&!o)||Fe(r)&&!J(r)&&e===ce||r===X&&o}function _i(e){return K(e)&&e!==ge&&!J(e)&&e!==fi&&e!==hi&&e!==X&&e!==mr&&e!==gr&&e!==xr&&e!==vr&&e!==yr&&e!==ce&&e!==ci&&e!==si&&e!==li&&e!==xi&&e!==pi&&e!==di&&e!==ai&&e!==ti&&e!==ui&&e!==mi&&e!==gi}function bi(e){return!J(e)&&e!==X}function Y(e,r){var n=e.charCodeAt(r),i;return n>=55296&&n<=56319&&r+1<e.length&&(i=e.charCodeAt(r+1),i>=56320&&i<=57343)?(n-55296)*1024+i-56320+65536:n}function Ar(e){var r=/^\n* /;return r.test(e)}var wr=1,se=2,Cr=3,Er=4,R=5;function Ti(e,r,n,i,o,t,l,u){var c,a=0,f=null,s=!1,d=!1,h=i!==-1,m=-1,x=_i(Y(e,0))&&bi(Y(e,e.length-1));if(r||l)for(c=0;c<e.length;a>=65536?c+=2:c++){if(a=Y(e,c),!K(a))return R;x=x&&ke(a,f,u),f=a}else{for(c=0;c<e.length;a>=65536?c+=2:c++){if(a=Y(e,c),a===H)s=!0,h&&(d=d||c-m-1>i&&e[m+1]!==" ",m=c);else if(!K(a))return R;x=x&&ke(a,f,u),f=a}d=d||h&&c-m-1>i&&e[m+1]!==" "}return!s&&!d?x&&!l&&!o(e)?wr:t===U?R:se:n>9&&Ar(e)?R:l?t===U?R:se:d?Er:Cr}function Ii(e,r,n,i,o){e.dump=function(){if(r.length===0)return e.quotingType===U?'""':"''";if(!e.noCompatMode&&(vi.indexOf(r)!==-1||yi.test(r)))return e.quotingType===U?'"'+r+'"':"'"+r+"'";var t=e.indent*Math.max(1,n),l=e.lineWidth===-1?-1:Math.max(Math.min(e.lineWidth,40),e.lineWidth-t),u=i||e.flowLevel>-1&&n>=e.flowLevel;function c(a){return Si(e,a)}switch(Ti(r,u,e.indent,l,c,e.quotingType,e.forceQuotes&&!i,o)){case wr:return r;case se:return"'"+r.replace(/'/g,"''")+"'";case Cr:return"|"+Pe(r,e.indent)+Oe(Ie(r,t));case Er:return">"+Pe(r,e.indent)+Oe(Ie(Fi(r,l),t));case R:return'"'+ki(r)+'"';default:throw new E("impossible error: invalid scalar style")}}()}function Pe(e,r){var n=Ar(e)?String(r):"",i=e[e.length-1]===`
22
+ `,o=i&&(e[e.length-2]===`
23
23
  `||e===`
24
- `),t=i?"+":o?"":"-";return r+t+`
24
+ `),t=o?"+":i?"":"-";return n+t+`
25
25
  `}function Oe(e){return e[e.length-1]===`
26
- `?e.slice(0,-1):e}function Fi(e,n){for(var r=/(\n+)([^\n]*)/g,o=function(){var a=e.indexOf(`
27
- `);return a=a!==-1?a:e.length,r.lastIndex=a,Le(e.slice(0,a),n)}(),i=e[0]===`
28
- `||e[0]===" ",t,l;l=r.exec(e);){var u=l[1],c=l[2];t=c[0]===" ",o+=u+(!i&&!t&&c!==""?`
29
- `:"")+Le(c,n),i=t}return o}function Le(e,n){if(e===""||e[0]===" ")return e;for(var r=/ [^ ]/g,o,i=0,t,l=0,u=0,c="";o=r.exec(e);)u=o.index,u-i>n&&(t=l>i?l:u,c+=`
30
- `+e.slice(i,t),i=t+1),l=u;return c+=`
31
- `,e.length-i>n&&l>i?c+=e.slice(i,l)+`
32
- `+e.slice(l+1):c+=e.slice(i),c.slice(1)}function ki(e){for(var n="",r=0,o,i=0;i<e.length;r>=65536?i+=2:i++)r=Y(e,i),o=C[r],!o&&K(r)?(n+=e[i],r>=65536&&(n+=e[i+1])):n+=o||wi(r);return n}function Pi(e,n,r){var o="",i=e.tag,t,l,u;for(t=0,l=r.length;t<l;t+=1)u=r[t],e.replacer&&(u=e.replacer.call(r,String(t),u)),(T(e,n,u,!1,!1)||typeof u>"u"&&T(e,n,null,!1,!1))&&(o!==""&&(o+=","+(e.condenseFlow?"":" ")),o+=e.dump);e.tag=i,e.dump="["+o+"]"}function Ne(e,n,r,o){var i="",t=e.tag,l,u,c;for(l=0,u=r.length;l<u;l+=1)c=r[l],e.replacer&&(c=e.replacer.call(r,String(l),c)),(T(e,n+1,c,!0,!0,!1,!0)||typeof c>"u"&&T(e,n+1,null,!0,!0,!1,!0))&&((!o||i!=="")&&(i+=ae(e,n)),e.dump&&H===e.dump.charCodeAt(0)?i+="-":i+="- ",i+=e.dump);e.tag=t,e.dump=i||"[]"}function Oi(e,n,r){var o="",i=e.tag,t=Object.keys(r),l,u,c,a,f;for(l=0,u=t.length;l<u;l+=1)f="",o!==""&&(f+=", "),e.condenseFlow&&(f+='"'),c=t[l],a=r[c],e.replacer&&(a=e.replacer.call(r,c,a)),T(e,n,c,!1,!1)&&(e.dump.length>1024&&(f+="? "),f+=e.dump+(e.condenseFlow?'"':"")+":"+(e.condenseFlow?"":" "),T(e,n,a,!1,!1)&&(f+=e.dump,o+=f));e.tag=i,e.dump="{"+o+"}"}function Li(e,n,r,o){var i="",t=e.tag,l=Object.keys(r),u,c,a,f,s,d;if(e.sortKeys===!0)l.sort();else if(typeof e.sortKeys=="function")l.sort(e.sortKeys);else if(e.sortKeys)throw new E("sortKeys must be a boolean or a function");for(u=0,c=l.length;u<c;u+=1)d="",(!o||i!=="")&&(d+=ae(e,n)),a=l[u],f=r[a],e.replacer&&(f=e.replacer.call(r,a,f)),T(e,n+1,a,!0,!0,!0)&&(s=e.tag!==null&&e.tag!=="?"||e.dump&&e.dump.length>1024,s&&(e.dump&&H===e.dump.charCodeAt(0)?d+="?":d+="? "),d+=e.dump,s&&(d+=ae(e,n)),T(e,n+1,f,!0,s)&&(e.dump&&H===e.dump.charCodeAt(0)?d+=":":d+=": ",d+=e.dump,i+=d));e.tag=t,e.dump=i||"{}"}function Re(e,n,r){var o,i,t,l,u,c;for(i=r?e.explicitTypes:e.implicitTypes,t=0,l=i.length;t<l;t+=1)if(u=i[t],(u.instanceOf||u.predicate)&&(!u.instanceOf||typeof n=="object"&&n instanceof u.instanceOf)&&(!u.predicate||u.predicate(n))){if(r?u.multi&&u.representName?e.tag=u.representName(n):e.tag=u.tag:e.tag="?",u.represent){if(c=e.styleMap[u.tag]||u.defaultStyle,hn.call(u.represent)==="[object Function]")o=u.represent(n,c);else if(mn.call(u.represent,c))o=u.represent[c](n,c);else throw new E("!<"+u.tag+'> tag resolver accepts not "'+c+'" style');e.dump=o}return!0}return!1}function T(e,n,r,o,i,t,l){e.tag=null,e.dump=r,Re(e,r,!1)||Re(e,r,!0);var u=hn.call(e.dump),c=o,a;o&&(o=e.flowLevel<0||e.flowLevel>n);var f=u==="[object Object]"||u==="[object Array]",s,d;if(f&&(s=e.duplicates.indexOf(r),d=s!==-1),(e.tag!==null&&e.tag!=="?"||d||e.indent!==2&&n>0)&&(i=!1),d&&e.usedDuplicates[s])e.dump="*ref_"+s;else{if(f&&d&&!e.usedDuplicates[s]&&(e.usedDuplicates[s]=!0),u==="[object Object]")o&&Object.keys(e.dump).length!==0?(Li(e,n,e.dump,i),d&&(e.dump="&ref_"+s+e.dump)):(Oi(e,n,e.dump),d&&(e.dump="&ref_"+s+" "+e.dump));else if(u==="[object Array]")o&&e.dump.length!==0?(e.noArrayIndent&&!l&&n>0?Ne(e,n-1,e.dump,i):Ne(e,n,e.dump,i),d&&(e.dump="&ref_"+s+e.dump)):(Pi(e,n,e.dump),d&&(e.dump="&ref_"+s+" "+e.dump));else if(u==="[object String]")e.tag!=="?"&&Ii(e,e.dump,n,t,c);else{if(u==="[object Undefined]")return!1;if(e.skipInvalid)return!1;throw new E("unacceptable kind of an object to dump "+u)}e.tag!==null&&e.tag!=="?"&&(a=encodeURI(e.tag[0]==="!"?e.tag.slice(1):e.tag).replace(/!/g,"%21"),e.tag[0]==="!"?a="!"+a:a.slice(0,18)==="tag:yaml.org,2002:"?a="!!"+a.slice(18):a="!<"+a+">",e.dump=a+" "+e.dump)}return!0}function Ni(e,n){var r=[],o=[],i,t;for(fe(e,r,o),i=0,t=o.length;i<t;i+=1)n.duplicates.push(r[o[i]]);n.usedDuplicates=new Array(t)}function fe(e,n,r){var o,i,t;if(e!==null&&typeof e=="object")if(i=n.indexOf(e),i!==-1)r.indexOf(i)===-1&&r.push(i);else if(n.push(e),Array.isArray(e))for(i=0,t=e.length;i<t;i+=1)fe(e[i],n,r);else for(o=Object.keys(e),i=0,t=o.length;i<t;i+=1)fe(e[o[i]],n,r)}function Ri(e,n){n=n||{};var r=new Ei(n);r.noRefs||Ni(e,r);var o=e;return r.replacer&&(o=r.replacer.call({"":o},"",o)),T(r,0,o,!0,!0)?r.dump+`
33
- `:""}var Di=Ri,Mi={dump:Di};function xe(e,n){return function(){throw new Error("Function yaml."+e+" is removed in js-yaml 4. Use yaml."+n+" instead, which is now safe by default.")}}var Gi=w,$i=Ge,ji=Be,Yi=We,Bi=Qe,Hi=de,Ui=dn.load,Ki=dn.loadAll,qi=Mi.dump,Wi=E,Qi={binary:Ze,float:qe,map:Ye,null:He,pairs:nn,set:rn,timestamp:Je,bool:Ue,int:Ke,merge:ze,omap:en,seq:je,str:$e},Vi=xe("safeLoad","load"),Xi=xe("safeLoadAll","loadAll"),Ji=xe("safeDump","dump"),_n={Type:Gi,Schema:$i,FAILSAFE_SCHEMA:ji,JSON_SCHEMA:Yi,CORE_SCHEMA:Bi,DEFAULT_SCHEMA:Hi,load:Ui,loadAll:Ki,dump:qi,YAMLException:Wi,types:Qi,safeLoad:Vi,safeLoadAll:Xi,safeDump:Ji};var ee=".cligr.yml",L=class extends Error{constructor(n){super(n),this.name="ConfigError"}},k=class{configPath;constructor(n){if(n)this.configPath=q.resolve(n);else{let r=q.join(bn.homedir(),ee),o=q.resolve(ee);Z.existsSync(r)?this.configPath=r:Z.existsSync(o)?this.configPath=o:this.configPath=r}}load(){if(!Z.existsSync(this.configPath))throw new L(`Config file not found. Looking for:
34
- - ${q.join(bn.homedir(),ee)}
35
- - ${q.resolve(ee)}`);let n=Z.readFileSync(this.configPath,"utf-8"),r;try{r=_n.load(n)}catch(o){throw new L(`Invalid YAML: ${o.message}`)}return this.validate(r)}validate(n){if(!n||typeof n!="object")throw new L("Config must be an object");let r=n;if(!r.groups||typeof r.groups!="object")throw new L('Config must have a "groups" object');return r}getGroup(n){let r=this.load(),o=r.groups[n];if(!o){let l=Object.keys(r.groups).join(", ");throw new L(`Unknown group: ${n}. Available: ${l}`)}let i=null,t=null;return r.tools&&r.tools[o.tool]?(i=r.tools[o.tool].cmd,t=o.tool):(t=null,i=null),{config:o,tool:t,toolTemplate:i}}listGroups(){let n=this.load();return Object.keys(n.groups)}};var ne=class{static expand(n,r,o){let i=r.split(",").map(u=>u.trim()),t=i[0]||`item-${o}`,l=n;for(let u=i.length-1;u>=0;u--){let c=`$${u+1}`;l=l.replaceAll(c,i[u])}return{name:t,args:i,fullCmd:l}}static parseItem(n,r,o,i){if(r){let t=this.expand(r,o,i),l=r.match(/\$\d+/g)||[],u=0;for(let c of l){let a=parseInt(c.substring(1),10);a>u&&(u=a)}if(u>0&&t.args.length>u){let c=t.args.slice(u);t.fullCmd=`${t.fullCmd} ${c.join(" ")}`}return t}else{let t=o.split(",").map(c=>c.trim()),l=t[0]||`item-${i}`;!o.includes(",")&&t.length===1&&(l=t[0].split(/\s+/)[0]||`item-${i}`);let u=n?`${n} ${o}`:o;return{name:l,args:t,fullCmd:u}}}};import{spawn as Zi}from"child_process";import{promises as N}from"fs";import re from"path";import zi from"os";var $=class{pidsDir;constructor(){this.pidsDir=re.join(zi.homedir(),".cligr","pids")}async ensureDir(){try{await N.mkdir(this.pidsDir,{recursive:!0})}catch(n){if(n.code!=="EEXIST")throw n}}sanitizeItemName(n){return n.replace(/[<>:"/\\|?*]/g,"_")}getPidFilePath(n,r){let o=this.sanitizeItemName(r);return re.join(this.pidsDir,`${n}_${o}.pid`)}async writePid(n){await this.ensureDir();let r=this.getPidFilePath(n.groupName,n.itemName);await N.writeFile(r,JSON.stringify(n,null,2),"utf-8")}async readPidsByGroup(n){await this.ensureDir();let r=[];try{let o=await N.readdir(this.pidsDir),i=`${n}_`;for(let t of o)if(t.startsWith(i)&&t.endsWith(".pid"))try{let l=await N.readFile(re.join(this.pidsDir,t),"utf-8");r.push(JSON.parse(l))}catch{continue}}catch{return[]}return r}async readAllPids(){await this.ensureDir();let n=[];try{let r=await N.readdir(this.pidsDir);for(let o of r)if(o.endsWith(".pid"))try{let i=await N.readFile(re.join(this.pidsDir,o),"utf-8");n.push(JSON.parse(i))}catch{continue}}catch{return[]}return n}async deletePid(n,r){let o=this.getPidFilePath(n,r);try{await N.unlink(o)}catch(i){if(i.code!=="ENOENT")throw i}}async deleteGroupPids(n){let r=await this.readPidsByGroup(n);for(let o of r)await this.deletePid(o.groupName,o.itemName)}isPidRunning(n){try{return process.kill(n,0),!0}catch{return!1}}isPidEntryValid(n){if(!this.isPidRunning(n.pid))return!1;let r=Date.now()-5*60*1e3;return n.startTime>r}async cleanupStalePids(){let n=await this.readAllPids(),r=[];for(let o of n)this.isPidEntryValid(o)||(r.push(o),await this.deletePid(o.groupName,o.itemName));return r}async getRunningGroups(){let n=await this.readAllPids(),r=new Set(n.map(o=>o.groupName));return Array.from(r)}};var ve=class{constructor(n,r,o="running"){this.item=n;this.process=r;this.status=o}},ie=class{groups=new Map;restartTimestamps=new Map;maxRestarts=3;restartWindow=1e4;pidStore=new $;spawnGroup(n,r,o){if(this.groups.has(n))throw new Error(`Group ${n} is already running`);let i=[];for(let t of r){let l=this.spawnProcess(t,n,o);i.push(new ve(t,l))}this.groups.set(n,i)}spawnProcess(n,r,o){let{cmd:i,args:t}=this.parseCommand(n.fullCmd),l=Zi(i,t,{stdio:["inherit","pipe","pipe"],shell:!1,windowsHide:!0});if(this.pidStore.deletePid(r,n.name).catch(()=>{}),l.pid){let u={pid:l.pid,groupName:r,itemName:n.name,startTime:Date.now(),restartPolicy:o,fullCmd:n.fullCmd};this.pidStore.writePid(u).catch(c=>{console.error(`[${n.name}] Failed to write PID file:`,c)})}return l.stdout&&l.stdout.on("data",u=>{process.stdout.write(`[${n.name}] ${u}`)}),l.stderr&&l.stderr.on("data",u=>{process.stderr.write(`[${n.name}] ${u}`)}),l.on("exit",(u,c)=>{this.handleExit(r,n,o,u,c)}),l}parseCommand(n){let r=[],o="",i=!1,t="";for(let l=0;l<n.length;l++){let u=n[l],c=n[l+1];(u==='"'||u==="'")&&!i?(i=!0,t=u):u===t&&i?(i=!1,t=""):u===" "&&!i?o&&(r.push(o),o=""):o+=u}return o&&r.push(o),{cmd:r[0]||"",args:r.slice(1)}}handleExit(n,r,o,i,t){if(o==="unless-stopped"&&t==="SIGTERM"){this.pidStore.deletePid(n,r.name).catch(()=>{});return}if(o==="no"){this.pidStore.deletePid(n,r.name).catch(()=>{});return}let l=`${n}-${r.name}`,u=Date.now(),a=(this.restartTimestamps.get(l)||[]).filter(f=>u-f<this.restartWindow);if(a.push(u),this.restartTimestamps.set(l,a),a.length>this.maxRestarts){console.error(`[${r.name}] Crash loop detected. Stopping restarts.`),this.pidStore.deletePid(n,r.name).catch(()=>{});return}setTimeout(()=>{console.log(`[${r.name}] Restarting... (exit code: ${i})`);let f=this.spawnProcess(r,n,o),s=this.groups.get(n);if(s){let d=s.find(h=>h.item.name===r.name);d&&(d.process=f)}},1e3)}killGroup(n){let r=this.groups.get(n);if(!r)return Promise.resolve();let o=r.map(i=>this.killProcess(i.process));return this.groups.delete(n),Promise.all(o).then(async()=>{await this.pidStore.deleteGroupPids(n)})}killPid(n){return new Promise((r,o)=>{try{process.kill(n,"SIGTERM");let i=setTimeout(()=>{try{process.kill(n,"SIGKILL")}catch{}},5e3),t=setInterval(()=>{this.pidStore.isPidRunning(n)||(clearTimeout(i),clearInterval(t),r())},100);this.pidStore.isPidRunning(n)||(clearTimeout(i),clearInterval(t),r())}catch(i){o(i)}})}killProcess(n){return new Promise(r=>{n.kill("SIGTERM");let o=setTimeout(()=>{n.killed||n.kill("SIGKILL")},5e3);n.on("exit",()=>{clearTimeout(o),r()}),(n.killed||n.exitCode!==null)&&(clearTimeout(o),r())})}killAll(){let n=[];for(let r of this.groups.keys())n.push(this.killGroup(r));return Promise.all(n).then(()=>{})}getGroupStatus(n){let r=this.groups.get(n);return r?r.map(o=>o.status):[]}isGroupRunning(n){return this.groups.has(n)}getRunningGroups(){return Array.from(this.groups.keys())}};async function ye(e){let n=new k,r=new ie,o=new $;try{await o.cleanupStalePids();let{config:i,tool:t,toolTemplate:l}=n.getGroup(e),u=i.items.map((c,a)=>ne.parseItem(t,l,c,a));return r.spawnGroup(e,u,i.restart),console.log(`Started group ${e} with ${u.length} process(es)`),console.log("Press Ctrl+C to stop..."),new Promise(c=>{let a=async()=>{console.log(`
36
- Shutting down...`),process.removeListener("SIGINT",a),process.removeListener("SIGTERM",a),await r.killAll(),c(0)};process.on("SIGINT",a),process.on("SIGTERM",a)})}catch(i){if(i instanceof Error&&i.name==="ConfigError")return console.error(i.message),1;throw i}}async function Tn(e){let n=new k;try{let{config:r}=n.getGroup(e);console.log(`
37
- Group: ${e}`),console.log(`Tool: ${r.tool}`),console.log(`Restart: ${r.restart}`),console.log(`
38
- Items:`);for(let o of r.items)console.log(` - ${o}`);return console.log(""),0}catch(r){return console.error(r.message),1}}import{spawn as eo,spawnSync as Fn}from"child_process";import j from"fs";import no from"os";import Ae from"path";var In=".cligr.yml",ro=`# Cligr Configuration
26
+ `?e.slice(0,-1):e}function Fi(e,r){for(var n=/(\n+)([^\n]*)/g,i=function(){var a=e.indexOf(`
27
+ `);return a=a!==-1?a:e.length,n.lastIndex=a,Le(e.slice(0,a),r)}(),o=e[0]===`
28
+ `||e[0]===" ",t,l;l=n.exec(e);){var u=l[1],c=l[2];t=c[0]===" ",i+=u+(!o&&!t&&c!==""?`
29
+ `:"")+Le(c,r),o=t}return i}function Le(e,r){if(e===""||e[0]===" ")return e;for(var n=/ [^ ]/g,i,o=0,t,l=0,u=0,c="";i=n.exec(e);)u=i.index,u-o>r&&(t=l>o?l:u,c+=`
30
+ `+e.slice(o,t),o=t+1),l=u;return c+=`
31
+ `,e.length-o>r&&l>o?c+=e.slice(o,l)+`
32
+ `+e.slice(l+1):c+=e.slice(o),c.slice(1)}function ki(e){for(var r="",n=0,i,o=0;o<e.length;n>=65536?o+=2:o++)n=Y(e,o),i=C[n],!i&&K(n)?(r+=e[o],n>=65536&&(r+=e[o+1])):r+=i||wi(n);return r}function Pi(e,r,n){var i="",o=e.tag,t,l,u;for(t=0,l=n.length;t<l;t+=1)u=n[t],e.replacer&&(u=e.replacer.call(n,String(t),u)),(T(e,r,u,!1,!1)||typeof u>"u"&&T(e,r,null,!1,!1))&&(i!==""&&(i+=","+(e.condenseFlow?"":" ")),i+=e.dump);e.tag=o,e.dump="["+i+"]"}function Ne(e,r,n,i){var o="",t=e.tag,l,u,c;for(l=0,u=n.length;l<u;l+=1)c=n[l],e.replacer&&(c=e.replacer.call(n,String(l),c)),(T(e,r+1,c,!0,!0,!1,!0)||typeof c>"u"&&T(e,r+1,null,!0,!0,!1,!0))&&((!i||o!=="")&&(o+=ae(e,r)),e.dump&&H===e.dump.charCodeAt(0)?o+="-":o+="- ",o+=e.dump);e.tag=t,e.dump=o||"[]"}function Oi(e,r,n){var i="",o=e.tag,t=Object.keys(n),l,u,c,a,f;for(l=0,u=t.length;l<u;l+=1)f="",i!==""&&(f+=", "),e.condenseFlow&&(f+='"'),c=t[l],a=n[c],e.replacer&&(a=e.replacer.call(n,c,a)),T(e,r,c,!1,!1)&&(e.dump.length>1024&&(f+="? "),f+=e.dump+(e.condenseFlow?'"':"")+":"+(e.condenseFlow?"":" "),T(e,r,a,!1,!1)&&(f+=e.dump,i+=f));e.tag=o,e.dump="{"+i+"}"}function Li(e,r,n,i){var o="",t=e.tag,l=Object.keys(n),u,c,a,f,s,d;if(e.sortKeys===!0)l.sort();else if(typeof e.sortKeys=="function")l.sort(e.sortKeys);else if(e.sortKeys)throw new E("sortKeys must be a boolean or a function");for(u=0,c=l.length;u<c;u+=1)d="",(!i||o!=="")&&(d+=ae(e,r)),a=l[u],f=n[a],e.replacer&&(f=e.replacer.call(n,a,f)),T(e,r+1,a,!0,!0,!0)&&(s=e.tag!==null&&e.tag!=="?"||e.dump&&e.dump.length>1024,s&&(e.dump&&H===e.dump.charCodeAt(0)?d+="?":d+="? "),d+=e.dump,s&&(d+=ae(e,r)),T(e,r+1,f,!0,s)&&(e.dump&&H===e.dump.charCodeAt(0)?d+=":":d+=": ",d+=e.dump,o+=d));e.tag=t,e.dump=o||"{}"}function Re(e,r,n){var i,o,t,l,u,c;for(o=n?e.explicitTypes:e.implicitTypes,t=0,l=o.length;t<l;t+=1)if(u=o[t],(u.instanceOf||u.predicate)&&(!u.instanceOf||typeof r=="object"&&r instanceof u.instanceOf)&&(!u.predicate||u.predicate(r))){if(n?u.multi&&u.representName?e.tag=u.representName(r):e.tag=u.tag:e.tag="?",u.represent){if(c=e.styleMap[u.tag]||u.defaultStyle,dr.call(u.represent)==="[object Function]")i=u.represent(r,c);else if(hr.call(u.represent,c))i=u.represent[c](r,c);else throw new E("!<"+u.tag+'> tag resolver accepts not "'+c+'" style');e.dump=i}return!0}return!1}function T(e,r,n,i,o,t,l){e.tag=null,e.dump=n,Re(e,n,!1)||Re(e,n,!0);var u=dr.call(e.dump),c=i,a;i&&(i=e.flowLevel<0||e.flowLevel>r);var f=u==="[object Object]"||u==="[object Array]",s,d;if(f&&(s=e.duplicates.indexOf(n),d=s!==-1),(e.tag!==null&&e.tag!=="?"||d||e.indent!==2&&r>0)&&(o=!1),d&&e.usedDuplicates[s])e.dump="*ref_"+s;else{if(f&&d&&!e.usedDuplicates[s]&&(e.usedDuplicates[s]=!0),u==="[object Object]")i&&Object.keys(e.dump).length!==0?(Li(e,r,e.dump,o),d&&(e.dump="&ref_"+s+e.dump)):(Oi(e,r,e.dump),d&&(e.dump="&ref_"+s+" "+e.dump));else if(u==="[object Array]")i&&e.dump.length!==0?(e.noArrayIndent&&!l&&r>0?Ne(e,r-1,e.dump,o):Ne(e,r,e.dump,o),d&&(e.dump="&ref_"+s+e.dump)):(Pi(e,r,e.dump),d&&(e.dump="&ref_"+s+" "+e.dump));else if(u==="[object String]")e.tag!=="?"&&Ii(e,e.dump,r,t,c);else{if(u==="[object Undefined]")return!1;if(e.skipInvalid)return!1;throw new E("unacceptable kind of an object to dump "+u)}e.tag!==null&&e.tag!=="?"&&(a=encodeURI(e.tag[0]==="!"?e.tag.slice(1):e.tag).replace(/!/g,"%21"),e.tag[0]==="!"?a="!"+a:a.slice(0,18)==="tag:yaml.org,2002:"?a="!!"+a.slice(18):a="!<"+a+">",e.dump=a+" "+e.dump)}return!0}function Ni(e,r){var n=[],i=[],o,t;for(fe(e,n,i),o=0,t=i.length;o<t;o+=1)r.duplicates.push(n[i[o]]);r.usedDuplicates=new Array(t)}function fe(e,r,n){var i,o,t;if(e!==null&&typeof e=="object")if(o=r.indexOf(e),o!==-1)n.indexOf(o)===-1&&n.push(o);else if(r.push(e),Array.isArray(e))for(o=0,t=e.length;o<t;o+=1)fe(e[o],r,n);else for(i=Object.keys(e),o=0,t=i.length;o<t;o+=1)fe(e[i[o]],r,n)}function Ri(e,r){r=r||{};var n=new Ei(r);n.noRefs||Ni(e,n);var i=e;return n.replacer&&(i=n.replacer.call({"":i},"",i)),T(n,0,i,!0,!0)?n.dump+`
33
+ `:""}var Di=Ri,Mi={dump:Di};function xe(e,r){return function(){throw new Error("Function yaml."+e+" is removed in js-yaml 4. Use yaml."+r+" instead, which is now safe by default.")}}var $i=w,ji=$e,Gi=Be,Yi=We,Bi=Qe,Hi=de,Ui=pr.load,Ki=pr.loadAll,qi=Mi.dump,Wi=E,Qi={binary:Ze,float:qe,map:Ye,null:He,pairs:rr,set:nr,timestamp:Je,bool:Ue,int:Ke,merge:ze,omap:er,seq:Ge,str:je},Vi=xe("safeLoad","load"),Xi=xe("safeLoadAll","loadAll"),Ji=xe("safeDump","dump"),Sr={Type:$i,Schema:ji,FAILSAFE_SCHEMA:Gi,JSON_SCHEMA:Yi,CORE_SCHEMA:Bi,DEFAULT_SCHEMA:Hi,load:Ui,loadAll:Ki,dump:qi,YAMLException:Wi,types:Qi,safeLoad:Vi,safeLoadAll:Xi,safeDump:Ji};var ee=".cligr.yml",L=class extends Error{constructor(r){super(r),this.name="ConfigError"}},k=class{configPath;constructor(r){if(r)this.configPath=q.resolve(r);else{let n=q.join(_r.homedir(),ee),i=q.resolve(ee);Z.existsSync(n)?this.configPath=n:Z.existsSync(i)?this.configPath=i:this.configPath=n}}load(){if(!Z.existsSync(this.configPath))throw new L(`Config file not found. Looking for:
34
+ - ${q.join(_r.homedir(),ee)}
35
+ - ${q.resolve(ee)}`);let r=Z.readFileSync(this.configPath,"utf-8"),n;try{n=Sr.load(r)}catch(i){throw new L(`Invalid YAML: ${i.message}`)}return this.validate(n)}validate(r){if(!r||typeof r!="object")throw new L("Config must be an object");let n=r;if(!n.groups||typeof n.groups!="object")throw new L('Config must have a "groups" object');return n}getGroup(r){let n=this.load(),i=n.groups[r];if(!i){let u=Object.keys(n.groups).join(", ");throw new L(`Unknown group: ${r}. Available: ${u}`)}let o=null,t=null;n.tools&&n.tools[i.tool]?(o=n.tools[i.tool].cmd,t=i.tool):(t=null,o=null);let l=i.params||{};return{config:i,tool:t,toolTemplate:o,params:l}}listGroups(){let r=this.load();return Object.keys(r.groups)}};var re=class{static expandNamedParams(r,n){let i=r;for(let[o,t]of Object.entries(n)){let l=`$${o}`;i=i.replaceAll(l,t)}return i}static expand(r,n,i,o={}){let t=n.split(",").map(c=>c.trim()),l=t[0]||`item-${i}`,u=r;for(let c=t.length-1;c>=0;c--){let a=`$${c+1}`;u=u.replaceAll(a,t[c])}return u=this.expandNamedParams(u,o),{name:l,args:t,fullCmd:u}}static parseItem(r,n,i,o,t={}){if(n){let l=this.expand(n,i,o,t),u=n.match(/\$\d+/g)||[],c=0;for(let a of u){let f=parseInt(a.substring(1),10);f>c&&(c=f)}if(c>0&&l.args.length>c){let a=l.args.slice(c);l.fullCmd=`${l.fullCmd} ${a.join(" ")}`}return l}else{let l=i.split(",").map(a=>a.trim()),u=l[0]||`item-${o}`;!i.includes(",")&&l.length===1&&(u=l[0].split(/\s+/)[0]||`item-${o}`);let c=r?`${r} ${i}`:i;return{name:u,args:l,fullCmd:c}}}};import{spawn as Zi}from"child_process";import{promises as N}from"fs";import ne from"path";import zi from"os";var j=class{pidsDir;constructor(){this.pidsDir=ne.join(zi.homedir(),".cligr","pids")}async ensureDir(){try{await N.mkdir(this.pidsDir,{recursive:!0})}catch(r){if(r.code!=="EEXIST")throw r}}sanitizeItemName(r){return r.replace(/[<>:"/\\|?*]/g,"_")}getPidFilePath(r,n){let i=this.sanitizeItemName(n);return ne.join(this.pidsDir,`${r}_${i}.pid`)}async writePid(r){await this.ensureDir();let n=this.getPidFilePath(r.groupName,r.itemName);await N.writeFile(n,JSON.stringify(r,null,2),"utf-8")}async readPidsByGroup(r){await this.ensureDir();let n=[];try{let i=await N.readdir(this.pidsDir),o=`${r}_`;for(let t of i)if(t.startsWith(o)&&t.endsWith(".pid"))try{let l=await N.readFile(ne.join(this.pidsDir,t),"utf-8");n.push(JSON.parse(l))}catch{continue}}catch{return[]}return n}async readAllPids(){await this.ensureDir();let r=[];try{let n=await N.readdir(this.pidsDir);for(let i of n)if(i.endsWith(".pid"))try{let o=await N.readFile(ne.join(this.pidsDir,i),"utf-8");r.push(JSON.parse(o))}catch{continue}}catch{return[]}return r}async deletePid(r,n){let i=this.getPidFilePath(r,n);try{await N.unlink(i)}catch(o){if(o.code!=="ENOENT")throw o}}async deleteGroupPids(r){let n=await this.readPidsByGroup(r);for(let i of n)await this.deletePid(i.groupName,i.itemName)}isPidRunning(r){try{return process.kill(r,0),!0}catch{return!1}}isPidEntryValid(r){if(!this.isPidRunning(r.pid))return!1;let n=Date.now()-5*60*1e3;return r.startTime>n}async cleanupStalePids(){let r=await this.readAllPids(),n=[];for(let i of r)this.isPidEntryValid(i)||(n.push(i),await this.deletePid(i.groupName,i.itemName));return n}async getRunningGroups(){let r=await this.readAllPids(),n=new Set(r.map(i=>i.groupName));return Array.from(n)}};var ve=class{constructor(r,n,i="running"){this.item=r;this.process=n;this.status=i}},ie=class{groups=new Map;restartTimestamps=new Map;maxRestarts=3;restartWindow=1e4;pidStore=new j;spawnGroup(r,n,i){if(this.groups.has(r))throw new Error(`Group ${r} is already running`);let o=[];for(let t of n){let l=this.spawnProcess(t,r,i);o.push(new ve(t,l))}this.groups.set(r,o)}spawnProcess(r,n,i){let{cmd:o,args:t}=this.parseCommand(r.fullCmd),l=Zi(o,t,{stdio:["inherit","pipe","pipe"],shell:!1,windowsHide:!0});if(this.pidStore.deletePid(n,r.name).catch(()=>{}),l.pid){let u={pid:l.pid,groupName:n,itemName:r.name,startTime:Date.now(),restartPolicy:i,fullCmd:r.fullCmd};this.pidStore.writePid(u).catch(c=>{console.error(`[${r.name}] Failed to write PID file:`,c)})}return l.stdout&&l.stdout.on("data",u=>{process.stdout.write(`[${r.name}] ${u}`)}),l.stderr&&l.stderr.on("data",u=>{process.stderr.write(`[${r.name}] ${u}`)}),l.on("exit",(u,c)=>{this.handleExit(n,r,i,u,c)}),l}parseCommand(r){let n=[],i="",o=!1,t="";for(let l=0;l<r.length;l++){let u=r[l],c=r[l+1];(u==='"'||u==="'")&&!o?(o=!0,t=u):u===t&&o?(o=!1,t=""):u===" "&&!o?i&&(n.push(i),i=""):i+=u}return i&&n.push(i),{cmd:n[0]||"",args:n.slice(1)}}handleExit(r,n,i,o,t){if(i==="unless-stopped"&&t==="SIGTERM"){this.pidStore.deletePid(r,n.name).catch(()=>{});return}if(i==="no"){this.pidStore.deletePid(r,n.name).catch(()=>{});return}let l=`${r}-${n.name}`,u=Date.now(),a=(this.restartTimestamps.get(l)||[]).filter(f=>u-f<this.restartWindow);if(a.push(u),this.restartTimestamps.set(l,a),a.length>this.maxRestarts){console.error(`[${n.name}] Crash loop detected. Stopping restarts.`),this.pidStore.deletePid(r,n.name).catch(()=>{});return}setTimeout(()=>{console.log(`[${n.name}] Restarting... (exit code: ${o})`);let f=this.spawnProcess(n,r,i),s=this.groups.get(r);if(s){let d=s.find(h=>h.item.name===n.name);d&&(d.process=f)}},1e3)}killGroup(r){let n=this.groups.get(r);if(!n)return Promise.resolve();let i=n.map(o=>this.killProcess(o.process));return this.groups.delete(r),Promise.all(i).then(async()=>{await this.pidStore.deleteGroupPids(r)})}killPid(r){return new Promise((n,i)=>{try{process.kill(r,"SIGTERM");let o=setTimeout(()=>{try{process.kill(r,"SIGKILL")}catch{}},5e3),t=setInterval(()=>{this.pidStore.isPidRunning(r)||(clearTimeout(o),clearInterval(t),n())},100);this.pidStore.isPidRunning(r)||(clearTimeout(o),clearInterval(t),n())}catch(o){i(o)}})}killProcess(r){return new Promise(n=>{r.kill("SIGTERM");let i=setTimeout(()=>{r.killed||r.kill("SIGKILL")},5e3);r.on("exit",()=>{clearTimeout(i),n()}),(r.killed||r.exitCode!==null)&&(clearTimeout(i),n())})}killAll(){let r=[];for(let n of this.groups.keys())r.push(this.killGroup(n));return Promise.all(r).then(()=>{})}getGroupStatus(r){let n=this.groups.get(r);return n?n.map(i=>i.status):[]}isGroupRunning(r){return this.groups.has(r)}getRunningGroups(){return Array.from(this.groups.keys())}};async function ye(e){let r=new k,n=new ie,i=new j;try{await i.cleanupStalePids();let{config:o,tool:t,toolTemplate:l,params:u}=r.getGroup(e),c=o.items.map((a,f)=>re.parseItem(t,l,a,f,u));return n.spawnGroup(e,c,o.restart),console.log(`Started group ${e} with ${c.length} process(es)`),console.log("Press Ctrl+C to stop..."),new Promise(a=>{let f=async()=>{console.log(`
36
+ Shutting down...`),process.removeListener("SIGINT",f),process.removeListener("SIGTERM",f),await n.killAll(),a(0)};process.on("SIGINT",f),process.on("SIGTERM",f)})}catch(o){if(o instanceof Error&&o.name==="ConfigError")return console.error(o.message),1;throw o}}async function br(e){let r=new k;try{let{config:n}=r.getGroup(e);console.log(`
37
+ Group: ${e}`),console.log(`Tool: ${n.tool}`),console.log(`Restart: ${n.restart}`),console.log(`
38
+ Items:`);for(let i of n.items)console.log(` - ${i}`);return console.log(""),0}catch(n){return console.error(n.message),1}}import{spawn as eo,spawnSync as Ir}from"child_process";import G from"fs";import ro from"os";import Ae from"path";var Tr=".cligr.yml",no=`# Cligr Configuration
39
39
 
40
40
  groups:
41
41
  web:
@@ -61,12 +61,12 @@ tools:
61
61
  # - $1 = name (first value)
62
62
  # - $2, $3... = additional arguments
63
63
  # - If no tool specified, executes directly
64
- `;function io(){let e=process.platform;return Fn(e==="win32"?"where":"which",["code"],{stdio:"ignore"}).status===0?"code":process.env.EDITOR?process.env.EDITOR:e==="win32"?"notepad.exe":"vim"}function oo(e,n){let r=process.platform;if(Fn(r==="win32"?"where":"which",[n],{stdio:"ignore"}).status!==0&&n!==process.env.EDITOR)throw new Error(`Editor '${n}' not found.
64
+ `;function io(){let e=process.platform;return Ir(e==="win32"?"where":"which",["code"],{stdio:"ignore"}).status===0?"code":process.env.EDITOR?process.env.EDITOR:e==="win32"?"notepad.exe":"vim"}function oo(e,r){let n=process.platform;if(Ir(n==="win32"?"where":"which",[r],{stdio:"ignore"}).status!==0&&r!==process.env.EDITOR)throw new Error(`Editor '${r}' not found.
65
65
  Install VS Code or set EDITOR environment variable.
66
66
 
67
67
  Example:
68
68
  export EDITOR=vim
69
- cligr config`);eo(n,[e],{detached:!0,stdio:"ignore",shell:r==="win32"}).unref()}function lo(e){let n=Ae.dirname(e);j.existsSync(n)||j.mkdirSync(n,{recursive:!0}),j.writeFileSync(e,ro,"utf-8")}async function kn(){try{let e=Ae.join(no.homedir(),In),n=Ae.resolve(In),r;j.existsSync(e)?r=e:j.existsSync(n)?r=n:r=e,j.existsSync(r)||lo(r);let o=io();return oo(r,o),console.log(`Opening ${r} in ${o}...`),0}catch(e){return console.error(`Error: ${e.message}`),1}}async function Pn(e){let n=new k;try{let r=n.listGroups();if(r.length===0)return 0;if(e){let o=n.load(),i=[];for(let a of r){let f=o.groups[a];i.push({name:a,tool:f.tool||"(none)",restart:f.restart||"(none)",itemCount:f.items.length})}let t=Math.max(5,...i.map(a=>a.name.length)),l=Math.max(4,...i.map(a=>a.tool.length)),u=Math.max(7,...i.map(a=>a.restart.length)),c="GROUP".padEnd(t)+" "+"TOOL".padEnd(l)+" "+"RESTART".padEnd(u)+" ITEMS";console.log(c);for(let a of i){let f=a.name.padEnd(t)+" "+a.tool.padEnd(l)+" "+a.restart.padEnd(u)+" "+String(a.itemCount);console.log(f)}}else for(let o of r)console.log(o);return 0}catch(r){return console.error(r.message),1}}async function to(){let e=process.argv.slice(2);if(e.length===0){On(),process.exit(1);return}let[n,...r]=e,o=!1;if(["config","up","ls","groups"].includes(n)){let t=n,l;if(t==="groups"){let c=r.findIndex(a=>a==="-v"||a==="--verbose");c!==-1&&(o=!0,r.splice(c,1))}if(l=r[0],t!=="config"&&t!=="groups"&&!l){console.error("Error: group name required"),On(),process.exit(1);return}let u=0;switch(t){case"config":u=await kn();break;case"up":u=await ye(l);break;case"ls":u=await Tn(l);break;case"groups":u=await Pn(o);break}process.exit(u)}else{let t=await ye(n);process.exit(t)}}function On(){console.log(`
69
+ cligr config`);eo(r,[e],{detached:!0,stdio:"ignore",shell:n==="win32"}).unref()}function lo(e){let r=Ae.dirname(e);G.existsSync(r)||G.mkdirSync(r,{recursive:!0}),G.writeFileSync(e,no,"utf-8")}async function Fr(){try{let e=Ae.join(ro.homedir(),Tr),r=Ae.resolve(Tr),n;G.existsSync(e)?n=e:G.existsSync(r)?n=r:n=e,G.existsSync(n)||lo(n);let i=io();return oo(n,i),console.log(`Opening ${n} in ${i}...`),0}catch(e){return console.error(`Error: ${e.message}`),1}}async function kr(e){let r=new k;try{let n=r.listGroups();if(n.length===0)return 0;if(e){let i=r.load(),o=[];for(let a of n){let f=i.groups[a];o.push({name:a,tool:f.tool||"(none)",restart:f.restart||"(none)",itemCount:f.items.length})}let t=Math.max(5,...o.map(a=>a.name.length)),l=Math.max(4,...o.map(a=>a.tool.length)),u=Math.max(7,...o.map(a=>a.restart.length)),c="GROUP".padEnd(t)+" "+"TOOL".padEnd(l)+" "+"RESTART".padEnd(u)+" ITEMS";console.log(c);for(let a of o){let f=a.name.padEnd(t)+" "+a.tool.padEnd(l)+" "+a.restart.padEnd(u)+" "+String(a.itemCount);console.log(f)}}else for(let i of n)console.log(i);return 0}catch(n){return console.error(n.message),1}}async function to(){let e=process.argv.slice(2);if(e.length===0){Pr(),process.exit(1);return}let[r,...n]=e,i=!1;if(["config","up","ls","groups"].includes(r)){let t=r,l;if(t==="groups"){let c=n.findIndex(a=>a==="-v"||a==="--verbose");c!==-1&&(i=!0,n.splice(c,1))}if(l=n[0],t!=="config"&&t!=="groups"&&!l){console.error("Error: group name required"),Pr(),process.exit(1);return}let u=0;switch(t){case"config":u=await Fr();break;case"up":u=await ye(l);break;case"ls":u=await br(l);break;case"groups":u=await kr(i);break}process.exit(u)}else{let t=await ye(r);process.exit(t)}}function Pr(){console.log(`
70
70
  Usage: cligr <group> | <command> [options]
71
71
 
72
72
  Commands:
@@ -0,0 +1,391 @@
1
+ # Named Params Support Implementation Plan
2
+
3
+ > **For Claude:** REQUIRED SUB-SKILL: Use superpowers:executing-plans to implement this plan task-by-task.
4
+
5
+ **Goal:** Add support for named parameters in group configs that can be referenced in tool templates using `$paramName` syntax.
6
+
7
+ **Architecture:** Extend the existing `TemplateExpander` to handle named params alongside positional params ($1, $2). The params are defined at the group level and passed through during template expansion. Named params are replaced AFTER positional params to avoid conflicts.
8
+
9
+ **Tech Stack:** TypeScript, Node.js, js-yaml
10
+
11
+ ---
12
+
13
+ ## Task 1: Update Types
14
+
15
+ **Files:**
16
+ - Modify: `src/config/types.ts:5-9`
17
+
18
+ **Step 1: Add params field to GroupConfig type**
19
+
20
+ Add optional `params` field to `GroupConfig`:
21
+
22
+ ```typescript
23
+ export interface GroupConfig {
24
+ tool: string;
25
+ restart?: 'yes' | 'no' | 'unless-stopped';
26
+ params?: Record<string, string>;
27
+ items: string[];
28
+ }
29
+ ```
30
+
31
+ **Step 2: Verify TypeScript compiles**
32
+
33
+ Run: `npm run typecheck`
34
+ Expected: No errors
35
+
36
+ **Step 3: Commit**
37
+
38
+ ```bash
39
+ git add src/config/types.ts
40
+ git commit -m "feat(types): add optional params field to GroupConfig"
41
+ ```
42
+
43
+ ---
44
+
45
+ ## Task 2: Update ConfigLoader
46
+
47
+ **Files:**
48
+ - Modify: `src/config/loader.ts:74-97`
49
+
50
+ **Step 1: Update getGroup return type to include params**
51
+
52
+ Modify the `getGroup` method to extract and return params from group config:
53
+
54
+ ```typescript
55
+ getGroup(name: string): { config: GroupConfig; tool: string | null; toolTemplate: string | null; params: Record<string, string> } {
56
+ const config = this.load();
57
+ const group = config.groups[name];
58
+
59
+ if (!group) {
60
+ const available = Object.keys(config.groups).join(', ');
61
+ throw new ConfigError(`Unknown group: ${name}. Available: ${available}`);
62
+ }
63
+
64
+ // Resolve tool
65
+ let toolTemplate: string | null = null;
66
+ let tool: string | null = null;
67
+
68
+ if (config.tools && config.tools[group.tool]) {
69
+ toolTemplate = config.tools[group.tool].cmd;
70
+ tool = group.tool;
71
+ } else {
72
+ tool = null;
73
+ toolTemplate = null;
74
+ }
75
+
76
+ // Extract params (default to empty object)
77
+ const params = group.params || {};
78
+
79
+ return { config: group, tool, toolTemplate, params };
80
+ }
81
+ ```
82
+
83
+ **Step 2: Verify TypeScript compiles**
84
+
85
+ Run: `npm run typecheck`
86
+ Expected: No errors
87
+
88
+ **Step 3: Commit**
89
+
90
+ ```bash
91
+ git add src/config/loader.ts
92
+ git commit -m "feat(loader): extract and return params from group config"
93
+ ```
94
+
95
+ ---
96
+
97
+ ## Task 3: Update TemplateExpander
98
+
99
+ **Files:**
100
+ - Modify: `src/process/template.ts:10-25`
101
+
102
+ **Step 1: Add expandNamedParams helper method**
103
+
104
+ Add a new static method to handle named parameter replacement:
105
+
106
+ ```typescript
107
+ /**
108
+ * Replaces named params in template ($name, $env, etc.)
109
+ * @param template - Command template with $paramName placeholders
110
+ * @param params - Key-value pairs for substitution
111
+ * @returns Template with named params replaced
112
+ */
113
+ private static expandNamedParams(template: string, params: Record<string, string>): string {
114
+ let result = template;
115
+ for (const [key, value] of Object.entries(params)) {
116
+ const placeholder = `$${key}`;
117
+ result = result.replaceAll(placeholder, value);
118
+ }
119
+ return result;
120
+ }
121
+ ```
122
+
123
+ **Step 2: Update expand method signature and logic**
124
+
125
+ Update the `expand` method to accept optional params and apply them after positional replacement:
126
+
127
+ ```typescript
128
+ static expand(template: string, itemStr: string, index: number, params: Record<string, string> = {}): ProcessItem {
129
+ const args = itemStr.split(',').map(s => s.trim());
130
+
131
+ // Generate name from first arg or use index
132
+ const name = args[0] || `item-${index}`;
133
+
134
+ // Replace $1, $2, $3 etc. with args (positional params)
135
+ // Must replace in reverse order to avoid replacing $1 in $10, $11, etc.
136
+ let fullCmd = template;
137
+ for (let i = args.length - 1; i >= 0; i--) {
138
+ const placeholder = `$${i + 1}`;
139
+ fullCmd = fullCmd.replaceAll(placeholder, args[i]);
140
+ }
141
+
142
+ // Replace named params ($name, $env, etc.) AFTER positional params
143
+ fullCmd = this.expandNamedParams(fullCmd, params);
144
+
145
+ return { name, args, fullCmd };
146
+ }
147
+ ```
148
+
149
+ **Step 3: Update parseItem method signature**
150
+
151
+ Update `parseItem` to accept optional params:
152
+
153
+ ```typescript
154
+ static parseItem(
155
+ tool: string | null,
156
+ toolTemplate: string | null,
157
+ itemStr: string,
158
+ index: number,
159
+ params: Record<string, string> = {}
160
+ ): ProcessItem {
161
+ if (toolTemplate) {
162
+ // Use registered tool template
163
+ const result = this.expand(toolTemplate, itemStr, index, params);
164
+
165
+ // ... rest of the method stays the same
166
+ ```
167
+
168
+ **Step 4: Verify TypeScript compiles**
169
+
170
+ Run: `npm run typecheck`
171
+ Expected: No errors
172
+
173
+ **Step 5: Commit**
174
+
175
+ ```bash
176
+ git add src/process/template.ts
177
+ git commit -m "feat(template): add named params support to TemplateExpander"
178
+ ```
179
+
180
+ ---
181
+
182
+ ## Task 4: Write Tests for Named Params
183
+
184
+ **Files:**
185
+ - Modify: `tests/integration/template-expander.test.ts`
186
+
187
+ **Step 1: Add test block for named params**
188
+
189
+ Add new describe block at the end of the test file (before the closing of the outer describe):
190
+
191
+ ```typescript
192
+ describe('Named params', () => {
193
+ it('should replace named param in template', () => {
194
+ const template = 'node $1.js --name $name';
195
+ const itemStr = 'server';
196
+ const params = { name: 'John doe' };
197
+
198
+ const result = TemplateExpander.expand(template, itemStr, 0, params);
199
+
200
+ assert.strictEqual(result.name, 'server');
201
+ assert.strictEqual(result.fullCmd, 'node server.js --name John doe');
202
+ });
203
+
204
+ it('should replace multiple named params', () => {
205
+ const template = 'app --host $host --port $port --env $env';
206
+ const itemStr = 'myapp';
207
+ const params = { host: 'localhost', port: '3000', env: 'production' };
208
+
209
+ const result = TemplateExpander.expand(template, itemStr, 0, params);
210
+
211
+ assert.strictEqual(result.fullCmd, 'app --host localhost --port 3000 --env production');
212
+ });
213
+
214
+ it('should combine positional and named params', () => {
215
+ const template = 'node $1.js --name $name --port $port';
216
+ const itemStr = 'server';
217
+ const params = { name: 'Alice', port: '8080' };
218
+
219
+ const result = TemplateExpander.expand(template, itemStr, 0, params);
220
+
221
+ assert.strictEqual(result.fullCmd, 'node server.js --name Alice --port 8080');
222
+ });
223
+
224
+ it('should handle empty params object', () => {
225
+ const template = 'node $1.js';
226
+ const itemStr = 'server';
227
+
228
+ const result = TemplateExpander.expand(template, itemStr, 0, {});
229
+
230
+ assert.strictEqual(result.fullCmd, 'node server.js');
231
+ });
232
+
233
+ it('should leave unreplaced named params as-is', () => {
234
+ const template = 'node $1.js --name $name --env $env';
235
+ const itemStr = 'server';
236
+ const params = { name: 'Bob' }; // env not provided
237
+
238
+ const result = TemplateExpander.expand(template, itemStr, 0, params);
239
+
240
+ assert.strictEqual(result.fullCmd, 'node server.js --name Bob --env $env');
241
+ });
242
+
243
+ it('should replace all occurrences of named param', () => {
244
+ const template = 'echo $name and $name again';
245
+ const itemStr = 'test';
246
+ const params = { name: 'world' };
247
+
248
+ const result = TemplateExpander.expand(template, itemStr, 0, params);
249
+
250
+ assert.strictEqual(result.fullCmd, 'echo world and world again');
251
+ });
252
+
253
+ it('should work with parseItem for registered tools', () => {
254
+ const tool = 'node-param';
255
+ const toolTemplate = 'node $1.js --name $name';
256
+ const itemStr = 'server';
257
+ const params = { name: 'Charlie' };
258
+
259
+ const result = TemplateExpander.parseItem(tool, toolTemplate, itemStr, 0, params);
260
+
261
+ assert.strictEqual(result.name, 'server');
262
+ assert.strictEqual(result.fullCmd, 'node server.js --name Charlie');
263
+ });
264
+
265
+ it('should handle named params with spaces in values', () => {
266
+ const template = 'echo "Hello, $name!"';
267
+ const itemStr = 'test';
268
+ const params = { name: 'John Doe' };
269
+
270
+ const result = TemplateExpander.expand(template, itemStr, 0, params);
271
+
272
+ assert.strictEqual(result.fullCmd, 'echo "Hello, John Doe!"');
273
+ });
274
+ });
275
+ ```
276
+
277
+ **Step 2: Run tests to verify they fail**
278
+
279
+ Run: `npm test`
280
+ Expected: Named params tests fail (feature not implemented yet)
281
+
282
+ **Step 3: Commit**
283
+
284
+ ```bash
285
+ git add tests/integration/template-expander.test.ts
286
+ git commit -m "test: add tests for named params support"
287
+ ```
288
+
289
+ ---
290
+
291
+ ## Task 5: Update up.ts Command
292
+
293
+ **Files:**
294
+ - Modify: `src/commands/up.ts:16-21`
295
+
296
+ **Step 1: Pass params to TemplateExpander.parseItem**
297
+
298
+ Update the `upCommand` to extract and pass params:
299
+
300
+ ```typescript
301
+ export async function upCommand(groupName: string): Promise<number> {
302
+ const loader = new ConfigLoader();
303
+ const manager = new ProcessManager();
304
+ const pidStore = new PidStore();
305
+
306
+ try {
307
+ // Clean up any stale PID files for this group on startup
308
+ await pidStore.cleanupStalePids();
309
+
310
+ // Load group config
311
+ const { config, tool, toolTemplate, params } = loader.getGroup(groupName);
312
+
313
+ // Build process items
314
+ const items = config.items.map((itemStr, index) =>
315
+ TemplateExpander.parseItem(tool, toolTemplate, itemStr, index, params)
316
+ );
317
+
318
+ // ... rest stays the same
319
+ ```
320
+
321
+ **Step 2: Verify TypeScript compiles**
322
+
323
+ Run: `npm run typecheck`
324
+ Expected: No errors
325
+
326
+ **Step 3: Commit**
327
+
328
+ ```bash
329
+ git add src/commands/up.ts
330
+ git commit -m "feat(up): pass params to template expander"
331
+ ```
332
+
333
+ ---
334
+
335
+ ## Task 6: Run All Tests
336
+
337
+ **Step 1: Run full test suite**
338
+
339
+ Run: `npm test`
340
+ Expected: All tests pass including new named params tests
341
+
342
+ **Step 2: Run verbose tests for details**
343
+
344
+ Run: `npm run test:verbose`
345
+ Expected: All tests pass with detailed output
346
+
347
+ ---
348
+
349
+ ## Task 7: Integration Test
350
+
351
+ **Step 1: Build the project**
352
+
353
+ Run: `npm run build`
354
+ Expected: Build succeeds
355
+
356
+ **Step 2: Create test config file**
357
+
358
+ Create a temporary test config at `~/.cligr.yml` (or use existing one) with the named params example:
359
+
360
+ ```yaml
361
+ groups:
362
+ test-named-params:
363
+ tool: node-param
364
+ params:
365
+ name: 'John doe'
366
+ items:
367
+ - "server"
368
+
369
+ tools:
370
+ node-param:
371
+ cmd: "echo $1.js --name $name"
372
+ ```
373
+
374
+ **Step 3: Run the command**
375
+
376
+ Run: `node dist/index.js test-named-params`
377
+ Expected: Output shows `echo server.js --name John doe`
378
+
379
+ ---
380
+
381
+ ## Summary
382
+
383
+ | Task | Description | Files Modified |
384
+ |------|-------------|----------------|
385
+ | 1 | Update types | `src/config/types.ts` |
386
+ | 2 | Update loader | `src/config/loader.ts` |
387
+ | 3 | Update template expander | `src/process/template.ts` |
388
+ | 4 | Write tests | `tests/integration/template-expander.test.ts` |
389
+ | 5 | Update up command | `src/commands/up.ts` |
390
+ | 6 | Run all tests | - |
391
+ | 7 | Integration test | - |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cligr",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
4
4
  "main": "dist/index.js",
5
5
  "bin": {
6
6
  "cligr": "./dist/index.js"
@@ -13,11 +13,11 @@ export async function upCommand(groupName: string): Promise<number> {
13
13
  await pidStore.cleanupStalePids();
14
14
 
15
15
  // Load group config
16
- const { config, tool, toolTemplate } = loader.getGroup(groupName);
16
+ const { config, tool, toolTemplate, params } = loader.getGroup(groupName);
17
17
 
18
18
  // Build process items
19
19
  const items = config.items.map((itemStr, index) =>
20
- TemplateExpander.parseItem(tool, toolTemplate, itemStr, index)
20
+ TemplateExpander.parseItem(tool, toolTemplate, itemStr, index, params)
21
21
  );
22
22
 
23
23
  // Spawn all processes
@@ -68,10 +68,10 @@ export class ConfigLoader {
68
68
  throw new ConfigError('Config must have a "groups" object');
69
69
  }
70
70
 
71
- return cfg as CliGrConfig;
71
+ return cfg as unknown as CliGrConfig;
72
72
  }
73
73
 
74
- getGroup(name: string): { config: GroupConfig; tool: string | null; toolTemplate: string | null } {
74
+ getGroup(name: string): { config: GroupConfig; tool: string | null; toolTemplate: string | null; params: Record<string, string> } {
75
75
  const config = this.load();
76
76
  const group = config.groups[name];
77
77
 
@@ -93,7 +93,10 @@ export class ConfigLoader {
93
93
  toolTemplate = null;
94
94
  }
95
95
 
96
- return { config: group, tool, toolTemplate };
96
+ // Extract params (default to empty object)
97
+ const params = group.params || {};
98
+
99
+ return { config: group, tool, toolTemplate, params };
97
100
  }
98
101
 
99
102
  listGroups(): string[] {
@@ -4,7 +4,8 @@ export interface ToolConfig {
4
4
 
5
5
  export interface GroupConfig {
6
6
  tool: string;
7
- restart: 'yes' | 'no' | 'unless-stopped';
7
+ restart?: 'yes' | 'no' | 'unless-stopped';
8
+ params?: Record<string, string>;
8
9
  items: string[];
9
10
  }
10
11
 
@@ -1,19 +1,35 @@
1
1
  import type { ProcessItem } from '../config/types.js';
2
2
 
3
3
  export class TemplateExpander {
4
+ /**
5
+ * Replaces named params in template ($name, $env, etc.)
6
+ * @param template - Command template with $paramName placeholders
7
+ * @param params - Key-value pairs for substitution
8
+ * @returns Template with named params replaced
9
+ */
10
+ private static expandNamedParams(template: string, params: Record<string, string>): string {
11
+ let result = template;
12
+ for (const [key, value] of Object.entries(params)) {
13
+ const placeholder = `$${key}`;
14
+ result = result.replaceAll(placeholder, value);
15
+ }
16
+ return result;
17
+ }
18
+
4
19
  /**
5
20
  * Expands a command template with item arguments
6
21
  * @param template - Command template with $1, $2, $3 etc.
7
22
  * @param itemStr - Comma-separated item args (e.g., "service1,8080,80")
23
+ * @param params - Optional named params for substitution ($name, $env, etc.)
8
24
  * @returns ProcessItem with expanded command
9
25
  */
10
- static expand(template: string, itemStr: string, index: number): ProcessItem {
26
+ static expand(template: string, itemStr: string, index: number, params: Record<string, string> = {}): ProcessItem {
11
27
  const args = itemStr.split(',').map(s => s.trim());
12
28
 
13
29
  // Generate name from first arg or use index
14
30
  const name = args[0] || `item-${index}`;
15
31
 
16
- // Replace $1, $2, $3 etc. with args
32
+ // Replace $1, $2, $3 etc. with args (positional params)
17
33
  // Must replace in reverse order to avoid replacing $1 in $10, $11, etc.
18
34
  let fullCmd = template;
19
35
  for (let i = args.length - 1; i >= 0; i--) {
@@ -21,6 +37,9 @@ export class TemplateExpander {
21
37
  fullCmd = fullCmd.replaceAll(placeholder, args[i]);
22
38
  }
23
39
 
40
+ // Replace named params ($name, $env, etc.) AFTER positional params
41
+ fullCmd = this.expandNamedParams(fullCmd, params);
42
+
24
43
  return { name, args, fullCmd };
25
44
  }
26
45
 
@@ -30,11 +49,18 @@ export class TemplateExpander {
30
49
  * @param toolTemplate - Template from tools config (if registered tool)
31
50
  * @param itemStr - Comma-separated args
32
51
  * @param index - Item index in group
52
+ * @param params - Optional named params for substitution
33
53
  */
34
- static parseItem(tool: string | null, toolTemplate: string | null, itemStr: string, index: number): ProcessItem {
54
+ static parseItem(
55
+ tool: string | null,
56
+ toolTemplate: string | null,
57
+ itemStr: string,
58
+ index: number,
59
+ params: Record<string, string> = {}
60
+ ): ProcessItem {
35
61
  if (toolTemplate) {
36
62
  // Use registered tool template
37
- const result = this.expand(toolTemplate, itemStr, index);
63
+ const result = this.expand(toolTemplate, itemStr, index, params);
38
64
 
39
65
  // If there are more args than placeholders in the template, append them
40
66
  // Count unique placeholders in the ORIGINAL template (before replacement)
@@ -359,4 +359,88 @@ describe('TemplateExpander Integration Tests', () => {
359
359
  }
360
360
  });
361
361
  });
362
+
363
+ describe('Named params', () => {
364
+ it('should replace named param in template', () => {
365
+ const template = 'node $1.js --name $name';
366
+ const itemStr = 'server';
367
+ const params = { name: 'John doe' };
368
+
369
+ const result = TemplateExpander.expand(template, itemStr, 0, params);
370
+
371
+ assert.strictEqual(result.name, 'server');
372
+ assert.strictEqual(result.fullCmd, 'node server.js --name John doe');
373
+ });
374
+
375
+ it('should replace multiple named params', () => {
376
+ const template = 'app --host $host --port $port --env $env';
377
+ const itemStr = 'myapp';
378
+ const params = { host: 'localhost', port: '3000', env: 'production' };
379
+
380
+ const result = TemplateExpander.expand(template, itemStr, 0, params);
381
+
382
+ assert.strictEqual(result.fullCmd, 'app --host localhost --port 3000 --env production');
383
+ });
384
+
385
+ it('should combine positional and named params', () => {
386
+ const template = 'node $1.js --name $name --port $port';
387
+ const itemStr = 'server';
388
+ const params = { name: 'Alice', port: '8080' };
389
+
390
+ const result = TemplateExpander.expand(template, itemStr, 0, params);
391
+
392
+ assert.strictEqual(result.fullCmd, 'node server.js --name Alice --port 8080');
393
+ });
394
+
395
+ it('should handle empty params object', () => {
396
+ const template = 'node $1.js';
397
+ const itemStr = 'server';
398
+
399
+ const result = TemplateExpander.expand(template, itemStr, 0, {});
400
+
401
+ assert.strictEqual(result.fullCmd, 'node server.js');
402
+ });
403
+
404
+ it('should leave unreplaced named params as-is', () => {
405
+ const template = 'node $1.js --name $name --env $env';
406
+ const itemStr = 'server';
407
+ const params = { name: 'Bob' }; // env not provided
408
+
409
+ const result = TemplateExpander.expand(template, itemStr, 0, params);
410
+
411
+ assert.strictEqual(result.fullCmd, 'node server.js --name Bob --env $env');
412
+ });
413
+
414
+ it('should replace all occurrences of named param', () => {
415
+ const template = 'echo $name and $name again';
416
+ const itemStr = 'test';
417
+ const params = { name: 'world' };
418
+
419
+ const result = TemplateExpander.expand(template, itemStr, 0, params);
420
+
421
+ assert.strictEqual(result.fullCmd, 'echo world and world again');
422
+ });
423
+
424
+ it('should work with parseItem for registered tools', () => {
425
+ const tool = 'node-param';
426
+ const toolTemplate = 'node $1.js --name $name';
427
+ const itemStr = 'server';
428
+ const params = { name: 'Charlie' };
429
+
430
+ const result = TemplateExpander.parseItem(tool, toolTemplate, itemStr, 0, params);
431
+
432
+ assert.strictEqual(result.name, 'server');
433
+ assert.strictEqual(result.fullCmd, 'node server.js --name Charlie');
434
+ });
435
+
436
+ it('should handle named params with spaces in values', () => {
437
+ const template = 'echo "Hello, $name!"';
438
+ const itemStr = 'test';
439
+ const params = { name: 'John Doe' };
440
+
441
+ const result = TemplateExpander.expand(template, itemStr, 0, params);
442
+
443
+ assert.strictEqual(result.fullCmd, 'echo "Hello, John Doe!"');
444
+ });
445
+ });
362
446
  });