create-qwik 2.0.0-beta.13 → 2.0.0-beta.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs ADDED
@@ -0,0 +1,193 @@
1
+ /**
2
+ * @license
3
+ * create-qwik 2.0.0-beta.14-dev+1e7496d
4
+ * Copyright QwikDev. All Rights Reserved.
5
+ * Use of this source code is governed by an MIT-style license that can be
6
+ * found in the LICENSE file at https://github.com/QwikDev/qwik/blob/main/LICENSE
7
+ */
8
+ var wu=Object.create;var er=Object.defineProperty;var Au=Object.getOwnPropertyDescriptor;var vu=Object.getOwnPropertyNames;var xu=Object.getPrototypeOf,Ou=Object.prototype.hasOwnProperty;var Qe=(s=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(s,{get:(e,t)=>(typeof require<"u"?require:e)[t]}):s)(function(s){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+s+'" is not supported')});var ee=(s,e)=>()=>(e||s((e={exports:{}}).exports,e),e.exports);var $u=(s,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of vu(e))!Ou.call(s,r)&&r!==t&&er(s,r,{get:()=>e[r],enumerable:!(n=Au(e,r))||n.enumerable});return s};var Lt=(s,e,t)=>(t=s!=null?wu(xu(s)):{},$u(e||!s||!s.__esModule?er(t,"default",{value:s,enumerable:!0}):t,s));var ks=ee((Bl,tr)=>{"use strict";var Ss={to(s,e){return e?`\x1B[${e+1};${s+1}H`:`\x1B[${s+1}G`},move(s,e){let t="";return s<0?t+=`\x1B[${-s}D`:s>0&&(t+=`\x1B[${s}C`),e<0?t+=`\x1B[${-e}A`:e>0&&(t+=`\x1B[${e}B`),t},up:(s=1)=>`\x1B[${s}A`,down:(s=1)=>`\x1B[${s}B`,forward:(s=1)=>`\x1B[${s}C`,backward:(s=1)=>`\x1B[${s}D`,nextLine:(s=1)=>"\x1B[E".repeat(s),prevLine:(s=1)=>"\x1B[F".repeat(s),left:"\x1B[G",hide:"\x1B[?25l",show:"\x1B[?25h",save:"\x1B7",restore:"\x1B8"},Tu={up:(s=1)=>"\x1B[S".repeat(s),down:(s=1)=>"\x1B[T".repeat(s)},_u={screen:"\x1B[2J",up:(s=1)=>"\x1B[1J".repeat(s),down:(s=1)=>"\x1B[J".repeat(s),line:"\x1B[2K",lineEnd:"\x1B[K",lineStart:"\x1B[1K",lines(s){let e="";for(let t=0;t<s;t++)e+=this.line+(t<s-1?Ss.up():"");return s&&(e+=Ss.left),e}};tr.exports={cursor:Ss,scroll:Tu,erase:_u,beep:"\x07"}});var Ms=ee((Nl,js)=>{var An=process||{},nr=An.argv||[],wn=An.env||{},Iu=!(wn.NO_COLOR||nr.includes("--no-color"))&&(!!wn.FORCE_COLOR||nr.includes("--color")||An.platform==="win32"||(An.stdout||{}).isTTY&&wn.TERM!=="dumb"||!!wn.CI),Bu=(s,e,t=s)=>n=>{let r=""+n,o=r.indexOf(e,s.length);return~o?s+Nu(r,e,t,o)+e:s+r+e},Nu=(s,e,t,n)=>{let r="",o=0;do r+=s.substring(o,n)+t,o=n+e.length,n=s.indexOf(e,o);while(~n);return r+s.substring(o)},sr=(s=Iu)=>{let e=s?Bu:()=>String;return{isColorSupported:s,reset:e("\x1B[0m","\x1B[0m"),bold:e("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"),dim:e("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"),italic:e("\x1B[3m","\x1B[23m"),underline:e("\x1B[4m","\x1B[24m"),inverse:e("\x1B[7m","\x1B[27m"),hidden:e("\x1B[8m","\x1B[28m"),strikethrough:e("\x1B[9m","\x1B[29m"),black:e("\x1B[30m","\x1B[39m"),red:e("\x1B[31m","\x1B[39m"),green:e("\x1B[32m","\x1B[39m"),yellow:e("\x1B[33m","\x1B[39m"),blue:e("\x1B[34m","\x1B[39m"),magenta:e("\x1B[35m","\x1B[39m"),cyan:e("\x1B[36m","\x1B[39m"),white:e("\x1B[37m","\x1B[39m"),gray:e("\x1B[90m","\x1B[39m"),bgBlack:e("\x1B[40m","\x1B[49m"),bgRed:e("\x1B[41m","\x1B[49m"),bgGreen:e("\x1B[42m","\x1B[49m"),bgYellow:e("\x1B[43m","\x1B[49m"),bgBlue:e("\x1B[44m","\x1B[49m"),bgMagenta:e("\x1B[45m","\x1B[49m"),bgCyan:e("\x1B[46m","\x1B[49m"),bgWhite:e("\x1B[47m","\x1B[49m"),blackBright:e("\x1B[90m","\x1B[39m"),redBright:e("\x1B[91m","\x1B[39m"),greenBright:e("\x1B[92m","\x1B[39m"),yellowBright:e("\x1B[93m","\x1B[39m"),blueBright:e("\x1B[94m","\x1B[39m"),magentaBright:e("\x1B[95m","\x1B[39m"),cyanBright:e("\x1B[96m","\x1B[39m"),whiteBright:e("\x1B[97m","\x1B[39m"),bgBlackBright:e("\x1B[100m","\x1B[49m"),bgRedBright:e("\x1B[101m","\x1B[49m"),bgGreenBright:e("\x1B[102m","\x1B[49m"),bgYellowBright:e("\x1B[103m","\x1B[49m"),bgBlueBright:e("\x1B[104m","\x1B[49m"),bgMagentaBright:e("\x1B[105m","\x1B[49m"),bgCyanBright:e("\x1B[106m","\x1B[49m"),bgWhiteBright:e("\x1B[107m","\x1B[49m")}};js.exports=sr();js.exports.createColors=sr});var jr=ee((Eh,kr)=>{"use strict";kr.exports=function(){if(process.env.npm_config_user_agent)return pa(process.env.npm_config_user_agent)};function pa(s){let e=s.split(" ")[0],t=e.lastIndexOf("/"),n=e.substring(0,t);return{name:n==="npminstall"?"cnpm":n,version:e.substring(t+1)}}});var Vt=ee(Ve=>{"use strict";Object.defineProperty(Ve,"__esModule",{value:!0});Ve.identifierRegex=Ve.reservedIdentifiers=void 0;Ve.isReserved=Yr;Ve.isIdentifier=Oa;Ve.reservedIdentifiers=["await","break","case","catch","class","const","continue","debugger","default","delete","do","else","enum","export","extends","false","finally","for","function","if","import","in","instanceof","new","null","return","super","switch","this","throw","true","try","typeof","var","void","while","with","yield","implements","interface","package","private","protected","public"];Ve.identifierRegex=/[$_\p{ID_Start}][$_\u200C\u200D\p{ID_Continue}]*/u;var xa=new RegExp(`^${Ve.identifierRegex.source}$`,Ve.identifierRegex.flags);function Yr(s){return Ve.reservedIdentifiers.includes(s)}function Oa(s){return xa.test(s)&&!Yr(s)}});var He=ee(Ht=>{"use strict";Object.defineProperty(Ht,"__esModule",{value:!0});Ht.JsonToken=Ht.JsonTokenType=void 0;var Kr;(function(s){s.IDENTIFIER="IDENTIFIER",s.STRING="STRING",s.NUMBER="NUMBER",s.BOOLEAN="BOOLEAN",s.NULL="NULL",s.COLON="COLON",s.COMMA="COMMA",s.LINE_COMMENT="LINE_COMMENT",s.BLOCK_COMMENT="BLOCK_COMMENT",s.BRACE_LEFT="BRACE_LEFT",s.BRACE_RIGHT="BRACE_RIGHT",s.BRACKET_LEFT="BRACKET_LEFT",s.BRACKET_RIGHT="BRACKET_RIGHT",s.WHITESPACE="WHITESPACE",s.NEWLINE="NEWLINE",s.EOF="EOF"})(Kr||(Ht.JsonTokenType=Kr={}));var Qr;(function(s){function e(t,n){return t.type===n}s.isType=e})(Qr||(Ht.JsonToken=Qr={}))});var ct=ee(zt=>{"use strict";Object.defineProperty(zt,"__esModule",{value:!0});zt.JsonParseError=zt.JsonError=void 0;var Jn=class extends Error{constructor(e){super(e),Object.setPrototypeOf(this,new.target.prototype)}};zt.JsonError=Jn;var ii=class extends Jn{constructor(e,t){super(e),this.location=t,Object.setPrototypeOf(this,new.target.prototype)}};zt.JsonParseError=ii});var ri=ee(Ln=>{"use strict";Object.defineProperty(Ln,"__esModule",{value:!0});Ln.JsonLexer=void 0;var ue=He(),Zr=Vt(),Xr=ct(),Rn=class s{constructor(e){this.current=null,this.remaining=e}static tokenize(e){return[...new s(e)]}isEof(){return this.current?.type===ue.JsonTokenType.EOF}[Symbol.iterator](){return{next:()=>this.isEof()?{done:!0,value:void 0}:{done:!1,value:this.next()}}}skipInsignificant(){return this.skip(ue.JsonTokenType.WHITESPACE,ue.JsonTokenType.NEWLINE,ue.JsonTokenType.LINE_COMMENT,ue.JsonTokenType.BLOCK_COMMENT)}skip(...e){let t=[];for(;!this.isEof()&&this.matches(...e);)t.push(this.peek()),this.next();return t}expect(e,...t){let n=this.peek(),r=[e,...t];if(!s.isTokenType(n,r)){let{line:o,column:i}=n.location.start,u=r.length===1?r[0]:`either ${r.slice(0,-1).join(", ")} or ${r[r.length-1]}`;throw new Xr.JsonParseError(`Expected ${u}, but got ${n.type} at ${o}:${i}.`,n.location)}return n}consume(e,...t){let n=this.expect(e,...t);return this.isEof()||this.next(),n}matches(...e){return s.isTokenType(this.peek(),e)}peek(){if(this.current===null)throw new Error("No token has been consumed yet.");return this.current}next(){if(this.isEof())throw new Error("The end of the input has been reached.");return this.remaining===""?this.current=this.createToken(ue.JsonTokenType.EOF,""):(this.current=this.match(),this.remaining=this.remaining.slice(this.current.value.length)),this.current}match(){for(let{type:r,pattern:o}of s.PATTERNS){if(typeof o=="string"){if(this.remaining.startsWith(o))return this.createToken(r,o);continue}let i=this.remaining.match(o);if(i!==null)return this.createToken(r,i[0])}let e={index:this.current?.location.end.index??0,line:this.current?.location.end.line??1,column:this.current?.location.end.column??1},t={index:e.index+1,line:e.line,column:e.column+1},n=this.remaining[0];throw new Xr.JsonParseError(`Unexpected token '${n}' at ${e.line}:${e.column}.`,{start:e,end:t})}createToken(e,t){let n={index:this.current?.location.end.index??0,line:this.current?.location.end.line??1,column:this.current?.location.end.column??1},r={index:n.index,line:n.line,column:n.column};r.index+=[...t].length;for(let o of t)o===`
9
+ `?(r.line++,r.column=1):r.column++;return{type:e,value:t,location:{start:n,end:r}}}static isTokenType(e,t){return t.length===0||t.includes(e.type)}};Ln.JsonLexer=Rn;Rn.PATTERNS=[{type:ue.JsonTokenType.BRACE_LEFT,pattern:"{"},{type:ue.JsonTokenType.BRACE_RIGHT,pattern:"}"},{type:ue.JsonTokenType.BRACKET_LEFT,pattern:"["},{type:ue.JsonTokenType.BRACKET_RIGHT,pattern:"]"},{type:ue.JsonTokenType.COLON,pattern:":"},{type:ue.JsonTokenType.COMMA,pattern:","},{type:ue.JsonTokenType.LINE_COMMENT,pattern:/^\/\/.*/},{type:ue.JsonTokenType.BLOCK_COMMENT,pattern:/^\/\*[\s\S]*?\*\//},{type:ue.JsonTokenType.STRING,pattern:/^"(?:[^"\r\n\u2028\u2029\\]|\\(?:.|\r\n|\r|\n|\u2028|\u2029))*"/u},{type:ue.JsonTokenType.STRING,pattern:/^'(?:[^'\r\n\u2028\u2029\\]|\\(?:.|\r\n|\r|\n|\u2028|\u2029))*'/u},{type:ue.JsonTokenType.NEWLINE,pattern:/^(\r?\n)/},{type:ue.JsonTokenType.WHITESPACE,pattern:/^[ \r\t\v\f\u00A0\u2028\u2029\uFEFF\u1680\u2000-\u200A\u202F\u205F\u3000]+/},{type:ue.JsonTokenType.NUMBER,pattern:/^[-+]?((?:NaN|Infinity)(?![$_\u200C\u200D\p{ID_Continue}])|0[xX][\da-fA-F]+|(?:(?:0|[1-9]\d*)(?:\.\d*)?|\.\d*)(?:[eE][+-]?\d+)?)/u},{type:ue.JsonTokenType.NULL,pattern:/^null(?![$_\u200C\u200D\p{ID_Continue}])/u},{type:ue.JsonTokenType.BOOLEAN,pattern:/^(true|false)(?![$_\u200C\u200D\p{ID_Continue}])/u},{type:ue.JsonTokenType.IDENTIFIER,pattern:new RegExp(`^${Zr.identifierRegex.source}`,Zr.identifierRegex.flags)}]});var oi=ee(Yt=>{"use strict";Object.defineProperty(Yt,"__esModule",{value:!0});Yt.SourceLocation=Yt.SourcePosition=void 0;var Wn;(function(s){function e(){return{index:-1,line:0,column:0}}s.unknown=e})(Wn||(Yt.SourcePosition=Wn={}));var eo;(function(s){function e(){return{start:Wn.unknown(),end:Wn.unknown()}}s.unknown=e})(eo||(Yt.SourceLocation=eo={}))});var Gn=ee(qn=>{"use strict";Object.defineProperty(qn,"__esModule",{value:!0});qn.JsonNode=void 0;var $a=oi(),ui=class{constructor(e){this.location=e.location??$a.SourceLocation.unknown()}equals(e){return this.equalsLocation(e)&&this.isEquivalent(e)}equalsLocation(e){return this.location.start.index===e.location.start.index&&this.location.start.line===e.location.start.line&&this.location.start.column===e.location.start.column&&this.location.end.index===e.location.end.index&&this.location.end.line===e.location.end.line&&this.location.end.column===e.location.end.column}};qn.JsonNode=ui});var fn=ee(Un=>{"use strict";Object.defineProperty(Un,"__esModule",{value:!0});Un.JsonCompositeNode=void 0;var Ta=Gn(),ai=class s extends Ta.JsonNode{constructor(e){super(e),this.children=[...e.children??[]]}toString(e){let t=this.clone();return t.rebuild(e),s.flatten(t).join("")}reformat(e={}){this.reset(),this.rebuild(e)}static flatten(e){return e instanceof s?e.children.flatMap(s.flatten):[e]}};Un.JsonCompositeNode=ai});var wt=ee(Vn=>{"use strict";Object.defineProperty(Vn,"__esModule",{value:!0});Vn.JsonValueNode=void 0;var _a=fn(),Ia=ct(),ci=class extends _a.JsonCompositeNode{cast(e){if(!(this instanceof e))throw new Ia.JsonError(`Expected value of type ${e.name}, but got ${this.constructor.name}.`);return this}};Vn.JsonValueNode=ci});var At=ee(Hn=>{"use strict";Object.defineProperty(Hn,"__esModule",{value:!0});Hn.JsonTokenNode=void 0;var Ba=He(),Na=Gn(),li=class s extends Na.JsonNode{constructor(e){super(e),this.type=e.type,this.value=e.value}isType(e){return Ba.JsonToken.isType(this,e)}clone(){return new s({type:this.type,value:this.value,location:this.location})}isEquivalent(e){return e instanceof s&&this.type===e.type&&this.value===e.value}toString(){return this.value}};Hn.JsonTokenNode=li});var Qt=ee(Kt=>{"use strict";Object.defineProperty(Kt,"__esModule",{value:!0});Kt.NodeManipulator=Kt.NodeMatcher=void 0;var ze=He(),ke=zn(),me;(function(s){s.ANY=()=>!0,s.NONE=()=>!1,s.SIGNIFICANT=e=>!s.INSIGNIFICANT(e),s.INSIGNIFICANT=e=>s.SPACE(e)||s.COMMENT(e),s.SPACE=e=>s.WHITESPACE(e)||s.NEWLINE(e),s.WHITESPACE=e=>e instanceof ke.JsonTokenNode&&e.type===ze.JsonTokenType.WHITESPACE,s.NEWLINE=e=>e instanceof ke.JsonTokenNode&&e.type===ze.JsonTokenType.NEWLINE,s.COMMENT=e=>s.LINE_COMMENT(e)||s.BLOCK_COMMENT(e),s.LINE_COMMENT=e=>e instanceof ke.JsonTokenNode&&e.type===ze.JsonTokenType.LINE_COMMENT,s.BLOCK_COMMENT=e=>e instanceof ke.JsonTokenNode&&e.type===ze.JsonTokenType.BLOCK_COMMENT,s.PUNCTUATION=e=>e instanceof ke.JsonTokenNode&&[ze.JsonTokenType.COLON,ze.JsonTokenType.COMMA,ze.JsonTokenType.BRACE_LEFT,ze.JsonTokenType.BRACE_RIGHT,ze.JsonTokenType.BRACKET_LEFT,ze.JsonTokenType.BRACKET_RIGHT].includes(e.type)})(me||(Kt.NodeMatcher=me={}));var hi=class s{constructor(e){this.index=0,this.fixing=!1,this.list=e}done(){return this.index>=this.list.length}next(){if(this.done())throw new Error("The iterator is at the end of the list.");this.index++}get position(){return this.index}seek(e){if(e<0||e>=this.list.length)throw new Error("The position is out of bounds.");this.index=e}previous(){if(this.index===0)throw new Error("The iterator is at the beginning of the list.");this.index--}get current(){if(this.done())throw new Error("The iterator is at the end of the list.");return this.list[this.index]}get nodeList(){return this.list}matchesPreviousToken(e){if(this.index===0)return!1;let t=this.list[this.index-1];return t instanceof ke.JsonTokenNode&&t.type===e}matches(e){return this.findMatch([e])>=0}matchesToken(e){return this.matchesNext(t=>t instanceof ke.JsonTokenNode&&t.type===e,me.NONE)}matchesNext(e,t){return this.findNext(e,t)>=0}findNext(e,t=me.INSIGNIFICANT){let n=-1,r=this.index;for(;!this.done();){let{current:o}=this;if(e(o)){n=this.index;break}if(t(o)){this.next();continue}break}return this.index=r,n}token(e,t=!1){return this.nodes([e],t)}node(e,t=!1){return this.nodes([e],t)}nodes(e,t=!1){let n=this.findMatch(e);return n>=0?(e.length===1?(this.seek(n),this.remove(),this.insert(e[0])):this.seek(n+1),this.fixing=!1):t||(this.fixing=!0,this.accommodate(e[0])),this}insert(e){return this.list.splice(this.index,0,e),this.next(),this}remove(){return this.list.splice(this.index,1),this}dropUntil(e){let t=!1,n=this.index;for(;!this.done();){let r=this.current;if(e(r))return t&&this.fixSpacing(n),!0;if(!(r instanceof ke.JsonTokenNode)||me.SIGNIFICANT(r)){this.remove(),t=!0;continue}if(!t||r.type===ze.JsonTokenType.WHITESPACE){this.next();continue}this.fixSpacing(n),t=!1}return t&&this.fixSpacing(n),!1}end(){if(this.dropUntil(me.NONE),!this.fixing)return this;for(;this.index>0;){this.previous();let e=this.current;if(me.INSIGNIFICANT(e)){this.remove();continue}this.next();break}return this}findMatch(e){return this.findNext(t=>e.some(n=>t?.isEquivalent(n)),me.INSIGNIFICANT)}fixSpacing(e){let t=this.done()?null:this.current,n=0;for(;this.index>e;){this.previous();let o=this.current;if(!me.WHITESPACE(o)){this.next();break}n++}let r=this.list[this.index-1]??null;for(t!==null&&(r===null&&me.SPACE(t)||n>0&&(me.BLOCK_COMMENT(r)&&me.PUNCTUATION(t)||me.BLOCK_COMMENT(t)&&me.PUNCTUATION(r))?n++:me.NEWLINE(r)&&me.NEWLINE(t)?(n++,this.previous()):me.NEWLINE(t)||(n--,this.next()));n-- >0;)this.remove()}accommodate(e){if(me.INSIGNIFICANT(e)){this.insert(e);return}if(!this.done()){let t=this.findNext(n=>s.isReplacement(n,e));t>=0&&(this.seek(t),this.remove(),this.fixing=!1)}this.insert(e)}static isReplacement(e,t){return t instanceof ke.JsonTokenNode||e instanceof ke.JsonTokenNode?e.isEquivalent(t):t instanceof ke.JsonValueNode&&e instanceof ke.JsonValueNode?!0:e.constructor===t.constructor}};Kt.NodeManipulator=hi});var vt=ee(Yn=>{"use strict";Object.defineProperty(Yn,"__esModule",{value:!0});Yn.JsonValueFactory=void 0;var Sa=wt(),to;(function(s){let e={};function t(r,o){e[r]=o}s.register=t;function n(r){return r instanceof Sa.JsonValueNode?r:Array.isArray(r)?e.array(r):typeof r=="object"&&r!==null?e.object(r):e.primitive(r)}s.create=n})(to||(Yn.JsonValueFactory=to={}))});var Di=ee(Kn=>{"use strict";Object.defineProperty(Kn,"__esModule",{value:!0});Kn.JsonIdentifierNode=void 0;var ka=wt(),ja=Qt(),Ma=At(),Pa=He(),Ja=vt(),Ra=Vt(),La=ct(),fi=class s extends ka.JsonValueNode{constructor(e){super(e),this.token=e.token}static of(e){if(!(0,Ra.isIdentifier)(e))throw new La.JsonError(`Invalid identifier '${e}'.`);return new s({token:new Ma.JsonTokenNode({type:Pa.JsonTokenType.IDENTIFIER,value:e})})}update(e){let t=Ja.JsonValueFactory.create(e);return this.isEquivalent(t)?this:t}reset(){this.children.length=0}rebuild(){new ja.NodeManipulator(this.children).node(this.token).end()}clone(){let e=this.token.clone();return new s({token:e,children:this.children.map(t=>t===this.token?e:t),location:this.location})}isEquivalent(e){return e instanceof s&&this.token.equals(e.token)}toJSON(){return this.token.value}};Kn.JsonIdentifierNode=fi});var Xn=ee(Zn=>{"use strict";Object.defineProperty(Zn,"__esModule",{value:!0});Zn.JsonPrimitiveNode=void 0;var Wa=wt(),qa=Qt(),pi=At(),xt=He(),di=vt(),Qn=class s extends Wa.JsonValueNode{constructor(e){super(e),this.token=e.token,this.value=e.value}static of(e){return di.JsonValueFactory.create(e)}static ofHex(e){return new s({token:new pi.JsonTokenNode({type:xt.JsonTokenType.NUMBER,value:`"0x${e.toString(16)}"`}),value:e})}update(e){let t=di.JsonValueFactory.create(e);return this.isEquivalent(t)?this:t}reset(){this.children.length=0}rebuild(e){let t=new qa.NodeManipulator(this.children),n=this.token;if(n.isType(xt.JsonTokenType.STRING)&&t.done()&&e?.string?.quote==="single"){let o=JSON.stringify(this.value).slice(1,-1).replace(/((?:^|[^\\])(?:\\\\)*)\\"/g,(i,u)=>`${u}"`).replace(/'/g,"\\'");o=`'${o}'`,n=new pi.JsonTokenNode({type:xt.JsonTokenType.STRING,value:o})}t.node(n),t.end()}clone(){let e=this.token.clone();return new s({token:e,value:this.value,children:this.children.map(t=>t===this.token?e:t.clone()),location:this.location})}isEquivalent(e){return e instanceof s&&this.token.equals(e.token)&&this.value===e.value}toJSON(){return this.value}};Zn.JsonPrimitiveNode=Qn;var Ga={string:xt.JsonTokenType.STRING,number:xt.JsonTokenType.NUMBER,boolean:xt.JsonTokenType.BOOLEAN,null:xt.JsonTokenType.NULL};di.JsonValueFactory.register("primitive",s=>new Qn({value:s,token:new pi.JsonTokenNode({type:Ga[s===null?"null":typeof s],value:JSON.stringify(s)})}))});var ts=ee(es=>{"use strict";Object.defineProperty(es,"__esModule",{value:!0});es.JsonPropertyNode=void 0;var no=At(),so=He(),Ua=fn(),Va=Qt(),Ha=vt(),za=Di(),Ya=Vt(),Ka=Xn(),mi=class s extends Ua.JsonCompositeNode{constructor(e){super(e),this.key=e.key,this.value=e.value}reset(){this.key.reset(),this.value.reset(),this.children.length=0}set(e){this.value=Ha.JsonValueFactory.create(e)}rebuild(e){this.value.rebuild(e);let t=e?.property?.quote,n=e?.object?.colonSpacing??!1,r=new Va.NodeManipulator(this.children),{key:o}=this;r.matches(this.key)?o.rebuild():(o=this.formatKey(e),o.rebuild({...e,string:{quote:t==="single"||t==="double"?t:e?.string?.quote}})),r.node(o),r.token(new no.JsonTokenNode({type:so.JsonTokenType.COLON,value:":"})),n&&r.token(new no.JsonTokenNode({type:so.JsonTokenType.WHITESPACE,value:" "}),!r.done()),r.node(this.value).end()}formatKey(e){return this.key instanceof Ka.JsonPrimitiveNode&&e?.property?.unquoted===!0&&(0,Ya.isIdentifier)(this.key.value)?za.JsonIdentifierNode.of(this.key.value):this.key}clone(){let e=this.key.clone(),t=this.value.clone();return new s({key:e,value:t,children:this.children.map(n=>n===this.key?e:n===this.value?t:n.clone()),location:this.location})}isEquivalent(e){return e instanceof s?this.key.isEquivalent(e.key)&&this.value.isEquivalent(e.value):!1}};es.JsonPropertyNode=mi});var ns=ee(Ot=>{"use strict";Object.defineProperty(Ot,"__esModule",{value:!0});Ot.JsonStructureNode=Ot.StructureDelimiter=void 0;var Qa=wt(),ae=He(),Ze=At(),we=Qt(),io=fn(),Za=ts(),Xa=we.NodeMatcher.COMMENT,lt=we.NodeMatcher.WHITESPACE,Zt=we.NodeMatcher.NEWLINE,ec=we.NodeMatcher.SPACE,tc=we.NodeMatcher.INSIGNIFICANT,ht;(function(s){s.OBJECT="object",s.ARRAY="array"})(ht||(Ot.StructureDelimiter=ht={}));(function(s){let e={[s.OBJECT]:{start:{type:ae.JsonTokenType.BRACE_LEFT,value:"{"},end:{type:ae.JsonTokenType.BRACE_RIGHT,value:"}"}},[s.ARRAY]:{start:{type:ae.JsonTokenType.BRACKET_LEFT,value:"["},end:{type:ae.JsonTokenType.BRACKET_RIGHT,value:"]"}}};function t(i){return Object.values(e).some(({start:u})=>u.type===i.type)}s.isStartToken=t;function n(i){return Object.values(e).some(({end:u})=>u.type===i.type)}s.isEndToken=n;function r(i){return new Ze.JsonTokenNode(e[i].start)}s.getStartToken=r;function o(i){return new Ze.JsonTokenNode(e[i].end)}s.getEndToken=o})(ht||(Ot.StructureDelimiter=ht={}));var gi=class s extends Qa.JsonValueNode{reset(){for(let e of this.getList())e.reset();this.children.length=0}rebuild(e={}){let t=this.detectFormatting(e),n=t,r=[...this.children];for(let o=0;o<r.length;o++){let i=r[o];if(i instanceof s){n={...i.detectFormatting(n),indentationLevel:n.indentationLevel};continue}i instanceof io.JsonCompositeNode&&this.children.includes(i)&&r.splice(o+1,0,...i.children)}for(let o of this.getList())o.rebuild(n);this.rebuildChildren(t)}rebuildChildren(e){let t=new we.NodeManipulator(this.children),n=this.getDelimiter(),r=ht.getStartToken(n),o=ht.getEndToken(n);t.token(r);let i=this.getList(),u=i.length,{indentationLevel:h=0}=e,{indentationSize:f=0,commaSpacing:p=!1,entryIndentation:l=!1,leadingIndentation:m=!1,trailingIndentation:C=!1,trailingComma:w=!1}=e[n]??{},y=!1;for(let D=0;D<u;D++){let I=i[D],A=D!==0&&l||D===0&&m;if(s.matchesInsertion(t,i,D))A&&this.indent(t,e),t.insert(I),y=!1;else if(s.matchesRemoval(t,i,D))t.dropUntil(I.isEquivalent.bind(I)),t.node(I),y=!0;else{let k=t.matches(I);if(k||s.skipComments(t),A&&(f>0&&t.matchesNext(b=>o.isEquivalent(b))?(t.node(new Ze.JsonTokenNode({type:ae.JsonTokenType.NEWLINE,value:`
10
+ `})),t.matchesToken(ae.JsonTokenType.WHITESPACE)&&t.matchesNext(we.NodeMatcher.NEWLINE,we.NodeMatcher.WHITESPACE)&&t.remove(),t.token(this.getIndentationToken(e))):this.indent(t,e,y&&k)),y=k,t.matchesPreviousToken(ae.JsonTokenType.LINE_COMMENT))t.insert(new Ze.JsonTokenNode({type:ae.JsonTokenType.NEWLINE,value:`
11
+ `}));else if(t.position>1&&!k&&t.matchesPreviousToken(ae.JsonTokenType.BLOCK_COMMENT)&&!t.matchesToken(ae.JsonTokenType.WHITESPACE)){t.previous();let b=t.matchesPreviousToken(ae.JsonTokenType.WHITESPACE);t.next(),b&&t.token(new Ze.JsonTokenNode({type:ae.JsonTokenType.WHITESPACE,value:" "}))}t.node(I)}(D<u-1||w)&&t.node(new Ze.JsonTokenNode({type:ae.JsonTokenType.COMMA,value:","})),D===u-1?C&&this.indent(t,{...e,indentationLevel:h-1}):(f===0||!l)&&p&&(!t.matchesNext(we.NodeMatcher.SPACE)||t.matchesNext(k=>o.isEquivalent(k),we.NodeMatcher.SPACE))&&t.token(new Ze.JsonTokenNode({type:ae.JsonTokenType.WHITESPACE,value:" "}),t.matchesNext(k=>i[D+1].isEquivalent(k),we.NodeMatcher.SPACE))}u===0&&t.findNext(I=>I.isEquivalent(o),we.NodeMatcher.ANY)>=0&&t.dropUntil(I=>I.isEquivalent(o)),t.token(o),t.end()}detectFormatting(e={}){let t=!1,n=!0,r=!1,o=!1,i=!1,u=0,h=0,f,p,l=!1,m=!1,C=!0,w=!0,y={},D={},I=[...s.iterate(this,this.getMaxDepth())];for(let k=0;k<I.length;k++){let{token:b,depth:R,parents:Z}=I[k];switch(b.type){case ae.JsonTokenType.IDENTIFIER:y.property={...y.property,unquoted:!0};break;case ae.JsonTokenType.STRING:{let H=Z[Z.length-2],ye=b.value.startsWith("'")?"single":"double";H instanceof Za.JsonPropertyNode&&H.key.equals(Z[Z.length-1])?y.property={...y.property,quote:ye}:y.string={...y.string,quote:ye};break}}if(R===0&&ht.isStartToken(b))t=!0;else{let H=ht.isEndToken(b);R===0&&(H&&(p=n,l=i),t&&(f=Zt(b),lt(b)||(t=!1))),H||(h=u,C=!1,ec(b)||(w=!1))}if(lt(b)&&(b.value.includes(" ")&&(y.indentationCharacter="tab"),R===0&&n&&(u=b.value.includes(" ")?b.value.replace(/[^\t]/g,"").length:b.value.replace(/[^ ]/g,"").length)),r&&k>0&&I[k-1].depth===0){Zt(b)||(D.commaSpacing=lt(b));let H=Zt(b);for(let ye=k;!H&&ye<I.length;ye++){let{token:Le,depth:V}=I[ye];if(V===0){if(lt(Le)||Xa(Le))continue;Zt(Le)&&(H=!0)}break}D.entryIndentation=H,r=!1}o&&(D.colonSpacing=lt(b),o=!1),o=b.type===ae.JsonTokenType.COLON||o&&lt(b),r=b.type===ae.JsonTokenType.COMMA||r&&lt(b),i=R===0&&b.type===ae.JsonTokenType.COMMA||i&&tc(b),n=Zt(b)||n&&lt(b),m=m||Zt(b)}C||(w||(D.indentationSize=0,D.trailingComma=l),D.leadingIndentation=f??!1,D.trailingIndentation=p??!1);let A=Math.max(e.indentationLevel??0,0)+1;if(h>0&&!w){let k=h%A;D.indentationSize=(h-k)/A+k}return m&&(D.commaSpacing===void 0&&(D.commaSpacing=!0),D.colonSpacing===void 0&&(D.colonSpacing=!0),D.entryIndentation===void 0&&(D.entryIndentation=!0)),y[this.getDelimiter()]=D,y.indentationLevel=A,{...e,...y,object:{...e.array,...y.array,...e.object,...y.object},array:{...e.object,...y.object,...e.array,...y.array}}}indent(e,t,n=!1){let r=this.getDelimiter(),{indentationSize:o=0,leadingIndentation:i=!1,trailingIndentation:u=!1}=t[r]??{};if(o<=0&&!i&&!u)return;let h=new Ze.JsonTokenNode({type:ae.JsonTokenType.NEWLINE,value:`
12
+ `});e.token(h,n),e.matchesToken(ae.JsonTokenType.WHITESPACE)?e.next():e.token(this.getIndentationToken(t),n)}getIndentationToken(e){let t=this.getDelimiter(),{indentationLevel:n=0}=e,{indentationSize:r=0}=e[t]??{},o=e.indentationCharacter==="tab"?" ":" ";return new Ze.JsonTokenNode({type:ae.JsonTokenType.WHITESPACE,value:o.repeat(n*r)})}static*iterate(e,t,n=[]){for(let r of e.children)r instanceof Ze.JsonTokenNode&&(yield{depth:n.length,token:r,parents:[...n,e]}),t>0&&r instanceof io.JsonCompositeNode&&(yield*s.iterate(r,t-1,[...n,e]))}static skipComments(e){for(;e.matchesNext(we.NodeMatcher.COMMENT,we.NodeMatcher.SPACE);)e.next()}static matchesInsertion(e,t,n){let r=t.length,o=t[n];if(e.matchesNext(o.isEquivalent.bind(o),we.NodeMatcher.ANY))return!1;for(let i=n+1;i<r;i++)if(e.matches(t[i]))return!0;return!1}static matchesRemoval(e,t,n){if(e.matches(t[n]))return!1;let r=t.slice(n+1);return e.matchesNext(t[n].isEquivalent.bind(t[n]),o=>r.every(i=>!i.isEquivalent(o)))}};Ot.JsonStructureNode=gi});var oo=ee(is=>{"use strict";Object.defineProperty(is,"__esModule",{value:!0});is.JsonArrayNode=void 0;var ro=ns(),ft=vt(),nc=ct(),ss=class s extends ro.JsonStructureNode{constructor(e){super(e),this.elementNodes=[...e.elements]}static of(...e){return new s({elements:e.map(ft.JsonValueFactory.create)})}update(e){if(!(e instanceof s)&&!Array.isArray(e))return ft.JsonValueFactory.create(e);let t=e instanceof s?e.elements:e,n=this.elementNodes.splice(0);for(let r=0;r<t.length;r++)this.push(r<n.length?n[r].update(t[r]):t[r]);return t.length<n.length&&this.splice(t.length,n.length-t.length),this}getList(){return[...this.elementNodes]}getDelimiter(){return ro.StructureDelimiter.ARRAY}getMaxDepth(){return 1}get elements(){return[...this.elementNodes]}get(e,t){let n=this.elementNodes[e];if(t!==void 0&&!(n instanceof t))throw new nc.JsonError(`Expected ${t.name} at index ${e}, but got ${n.constructor.name}.`);return n}set(e,t){if(e<0||e>=this.elementNodes.length)throw new Error(`Index ${e} is out of bounds.`);this.elementNodes[e]=ft.JsonValueFactory.create(t)}clear(){this.elementNodes.length=0}delete(e){if(e<0||e>=this.elementNodes.length)throw new Error(`Index ${e} is out of bounds.`);this.splice(e,1)}unshift(...e){this.elementNodes.unshift(...e.map(ft.JsonValueFactory.create))}push(...e){this.elementNodes.push(...e.map(ft.JsonValueFactory.create))}shift(){return this.elementNodes.shift()}pop(){return this.elementNodes.pop()}splice(e,t,...n){return this.elementNodes.splice(e,t,...n.map(ft.JsonValueFactory.create))}clone(){let e=new Map;for(let t of this.elementNodes)e.set(t,t.clone());return new s({elements:[...e.values()],children:this.children.map(t=>e.get(t)??t.clone()),location:this.location})}isEquivalent(e){return!(e instanceof s)||this.elements.length!==e.elements.length?!1:this.elements.every((t,n)=>e.elements[n].isEquivalent(t))}toJSON(){return this.elements.map(e=>e.toJSON())}};is.JsonArrayNode=ss;ft.JsonValueFactory.register("array",s=>new ss({elements:s.map(ft.JsonValueFactory.create)}))});var ao=ee(cs=>{"use strict";Object.defineProperty(cs,"__esModule",{value:!0});cs.JsonObjectNode=void 0;var sc=wt(),uo=ns(),os=ts(),yi=Xn(),pn=vt(),ic=ct(),as=Qt(),rs=At(),Dn=He(),rc=as.NodeMatcher.INSIGNIFICANT,Ci=as.NodeMatcher.NEWLINE,Ei=as.NodeMatcher.SIGNIFICANT,oc=as.NodeMatcher.SPACE,us=class s extends uo.JsonStructureNode{constructor(e){super(e),this.propertyNodes=[...e.properties]}static of(e){return new s({properties:Object.entries(e).map(([t,n])=>new os.JsonPropertyNode({key:yi.JsonPrimitiveNode.of(t),value:pn.JsonValueFactory.create(n)}))})}merge(e){if(e.propertyNodes.length!==0){if(this.propertyNodes.length===0){this.propertyNodes.push(...e.propertyNodes.map(t=>t.clone())),this.children.splice(0,this.children.length,...e.children.map(t=>t.clone()));return}this.children.length===0&&this.rebuild({...e.detectFormatting(),indentationLevel:0});for(let t of e.propertyNodes){let n=t.key.toJSON(),r=e.findPropertyRange(n);if(r===null){this.set(t.key,t.value.clone());continue}let o=e.children.slice(r[0],r[1]+1),i=t.clone();o=o.map(f=>f===t?i:f.clone());let u=this.findPropertyRange(n);if(u===null){this.propertyNodes.push(i),this.insert(o);continue}let h=this.propertyNodes.findIndex(f=>f.key.toJSON()===n);this.propertyNodes.splice(h,1,i),this.children.splice(u[0],u[1]-u[0]+1,...o)}}}insert(e){let t=this.children.length;for(let r=this.children.length-1;r>=0;r--){let o=this.children[r];if(o instanceof rs.JsonTokenNode){if(o.isType(Dn.JsonTokenType.BRACE_RIGHT)){t=r;continue}if(o.isType(Dn.JsonTokenType.COMMA)){t=r+1;break}}if(Ei(o))break;if(Ci(o)){for(;r>0&&oc(this.children[r-1]);)r--;t=r;break}t=r}let n=!1;for(let r=t-1;r>=0;r--){let o=this.children[r];if(o instanceof rs.JsonTokenNode&&o.isType(Dn.JsonTokenType.COMMA)){n=!1;break}if(Ei(o)){n=!0;break}}n&&(this.children.splice(t,0,new rs.JsonTokenNode({type:Dn.JsonTokenType.COMMA,value:","})),t++),this.children.splice(t,0,...e)}findPropertyRange(e){let t=this.children.findIndex(r=>r instanceof os.JsonPropertyNode&&r.key.toJSON()===e);if(t===-1)return null;let n=t;for(let r=t-1;r>=0;r--){let o=this.children[r];if(!rc(o))break;Ci(o)&&(t=r)}for(let r=n+1;r<this.children.length;r++){let o=this.children[r];if(!(o instanceof rs.JsonTokenNode)||Ei(o)&&!o.isType(Dn.JsonTokenType.COMMA))break;if(Ci(o)){n=r-1;break}n=r}return[t,n]}update(e){if(!(e instanceof sc.JsonValueNode)){if(typeof e!="object"||e===null||Array.isArray(e))return pn.JsonValueFactory.create(e);for(let[t,n]of Object.entries(e)){if(n===void 0){this.delete(t);continue}let r=this.propertyNodes.find(o=>o.key.toJSON()===t);if(r!==void 0){r.value=r.value.update(n);continue}this.set(t,n)}for(let t of this.propertyNodes){let n=t.key.toJSON();e[n]===void 0&&this.delete(t.key.toJSON())}return this}if(!(e instanceof s))return e;for(let t of e.propertyNodes){let n=this.propertyNodes.findIndex(r=>r.key.toJSON()===t.key.toJSON());if(n>=0){let r=this.propertyNodes[n].clone();r.value=r.value.update(t.value)}else this.propertyNodes.push(t)}for(let t of this.propertyNodes){let n=t.key.toJSON();e.has(n)||this.delete(n)}return this}getList(){return[...this.propertyNodes]}getDelimiter(){return uo.StructureDelimiter.OBJECT}getMaxDepth(){return 2}has(e){return this.propertyNodes.some(t=>t.key.toJSON()===e)}get properties(){return[...this.propertyNodes]}set(e,t){let n=typeof e=="string"?e:e.toJSON(),r=this.propertyNodes.findIndex(o=>o.key.toJSON()===n);if(r>=0){this.propertyNodes[r].set(t);return}this.propertyNodes.push(new os.JsonPropertyNode({key:typeof e=="string"?yi.JsonPrimitiveNode.of(e):e,value:pn.JsonValueFactory.create(t)}))}delete(e){for(let t=0;t<this.propertyNodes.length;t++)if(this.propertyNodes[t].key.toJSON()===e){this.propertyNodes.splice(t,1);break}}get(e,t){let n=this.propertyNodes.find(o=>o.key.toJSON()===e);if(n===void 0)throw new Error(`Property "${e}" does not exist.`);let{value:r}=n;if(t!==void 0&&!(r instanceof t))throw new ic.JsonError(`Expected a value of type ${t.name}, but got ${r.constructor.name}`);return r}clone(){let e=new Map;for(let t of this.propertyNodes)e.set(t,t.clone());return new s({properties:[...e.values()],children:this.children.map(t=>e.get(t)??t.clone()),location:this.location})}isEquivalent(e){if(!(e instanceof s)||this.properties.length!==e.properties.length)return!1;let t=Object.fromEntries(e.properties.map(n=>[n.key.toJSON(),n]));return this.properties.every(n=>t[n.key.toJSON()]?.isEquivalent(n)===!0)}toJSON(){return Object.fromEntries(this.properties.map(e=>[e.key.toJSON(),e.value.toJSON()]))}};cs.JsonObjectNode=us;pn.JsonValueFactory.register("object",s=>new us({properties:Object.entries(s).flatMap(([e,t])=>t===void 0?[]:[new os.JsonPropertyNode({key:yi.JsonPrimitiveNode.of(e),value:pn.JsonValueFactory.create(t)})])}))});var zn=ee(Ce=>{"use strict";var uc=Ce&&Ce.__createBinding||(Object.create?(function(s,e,t,n){n===void 0&&(n=t);var r=Object.getOwnPropertyDescriptor(e,t);(!r||("get"in r?!e.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(s,n,r)}):(function(s,e,t,n){n===void 0&&(n=t),s[n]=e[t]})),Ye=Ce&&Ce.__exportStar||function(s,e){for(var t in s)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&uc(e,s,t)};Object.defineProperty(Ce,"__esModule",{value:!0});Ye(ns(),Ce);Ye(oo(),Ce);Ye(fn(),Ce);Ye(Di(),Ce);Ye(Gn(),Ce);Ye(ao(),Ce);Ye(Xn(),Ce);Ye(ts(),Ce);Ye(At(),Ce);Ye(wt(),Ce);Ye(vt(),Ce)});var co=ee(ls=>{"use strict";Object.defineProperty(ls,"__esModule",{value:!0});ls.JsonParser=void 0;var ac=ri(),Y=He(),Ae=zn(),cc=Vt(),dn=ct(),Fi=class s{constructor(e){this.lexer=new ac.JsonLexer(e)}static parse(e,t){let n=new s(e);return t!==void 0?n.parseValue(t):n.parseValue()}parseValue(e){let t=this.parseRoot();if(e!==void 0&&!(t instanceof e))throw new dn.JsonError(`Expected ${e.name}, but got ${t.constructor.name}.`);return t}parseRoot(){this.lexer.next();let e=this.lexer.skipInsignificant(),t=this.parseNext(),n=this.lexer.skipInsignificant();if(t.children.unshift(...s.createChildren(e)),t.children.push(...s.createChildren(n)),!this.lexer.isEof()){let r=this.lexer.peek(),o=r.location.start;throw new dn.JsonParseError(`Unexpected token '${r.value}' at ${o.line}:${o.column}.`,r.location)}return t}parseNext(){let e=this.lexer.peek();switch(e.type){case Y.JsonTokenType.BRACE_LEFT:return this.parseObject();case Y.JsonTokenType.BRACKET_LEFT:return this.parseArray();case Y.JsonTokenType.NUMBER:return this.parseNumber();case Y.JsonTokenType.STRING:return this.parseString();case Y.JsonTokenType.BOOLEAN:return this.parseBoolean();case Y.JsonTokenType.NULL:return this.parseNull();default:{let t=e.location.start;throw new dn.JsonParseError(`Unexpected token '${e.value}' at ${t.line}:${t.column}.`,e.location)}}}parseNumber(){let e=this.lexer.consume(Y.JsonTokenType.NUMBER),t=new Ae.JsonTokenNode(e);return new Ae.JsonPrimitiveNode({token:t,value:this.parseNumberValue(e),children:[t],location:e.location})}parseNumberValue(e){let{value:t}=e,n=1;return t.startsWith("+")?t=t.slice(1):t.startsWith("-")&&(n=-1,t=t.slice(1)),t==="Infinity"?n*(1/0):t==="NaN"?NaN:(t.startsWith(".")?t=`0${t}`:t=t.replace(/\.(?!\d)/,""),t.startsWith("0x")||t.startsWith("0X")?n*Number.parseInt(t,16):n*JSON.parse(t))}parseString(){let e=this.lexer.consume(Y.JsonTokenType.STRING),{value:t}=e;t.startsWith("'")&&(t=t.slice(1,-1).replace(/((?:^|[^\\])(?:\\\\)*)\\(["'])/g,(o,i,u)=>`${i}${u==='"'?'\\"':"'"}`),t=`"${t}"`),t=t.replace(/\\(?:\r\n|\r|\n|\u2028|\u2029)/gu,"");let n=new Ae.JsonTokenNode(e),r;try{r=JSON.parse(t)}catch(o){throw o instanceof Error?new dn.JsonParseError(`Invalid string at ${e.location.start.line}:${e.location.start.column}: ${o.message}`,e.location):o}return new Ae.JsonPrimitiveNode({token:n,value:r,children:[n],location:e.location})}parseNull(){let e=this.lexer.consume(Y.JsonTokenType.NULL),t=new Ae.JsonTokenNode(e);return new Ae.JsonPrimitiveNode({token:t,value:null,children:[t],location:e.location})}parseBoolean(){let e=this.lexer.consume(Y.JsonTokenType.BOOLEAN),t=new Ae.JsonTokenNode(e);return new Ae.JsonPrimitiveNode({token:t,value:e.value==="true",children:[t],location:e.location})}parseArray(){let e=[this.lexer.consume(Y.JsonTokenType.BRACKET_LEFT),...this.lexer.skipInsignificant()],t=[];for(;!this.lexer.matches(Y.JsonTokenType.BRACKET_RIGHT);){let n=this.parseNext();t.push(n),e.push(n,...this.lexer.skipInsignificant()),this.lexer.matches(Y.JsonTokenType.BRACKET_RIGHT)||e.push(this.lexer.consume(Y.JsonTokenType.COMMA),...this.lexer.skipInsignificant())}return e.push(this.lexer.consume(Y.JsonTokenType.BRACKET_RIGHT)),new Ae.JsonArrayNode({elements:t,children:s.createChildren(e),location:{start:e[0].location.start,end:e[e.length-1].location.end}})}parseObject(){let e=[this.lexer.consume(Y.JsonTokenType.BRACE_LEFT),...this.lexer.skipInsignificant()],t=[];for(;!this.lexer.matches(Y.JsonTokenType.BRACE_RIGHT);){let n=this.parseObjectProperty();t.push(n),e.push(n,...this.lexer.skipInsignificant()),this.lexer.matches(Y.JsonTokenType.BRACE_RIGHT)||e.push(this.lexer.consume(Y.JsonTokenType.COMMA),...this.lexer.skipInsignificant())}return e.push(this.lexer.consume(Y.JsonTokenType.BRACE_RIGHT)),new Ae.JsonObjectNode({properties:t,children:s.createChildren(e),location:{start:e[0].location.start,end:e[e.length-1].location.end}})}parseObjectProperty(){let e=[];this.lexer.expect(Y.JsonTokenType.STRING,Y.JsonTokenType.IDENTIFIER);let t=this.lexer.matches(Y.JsonTokenType.STRING)?this.parseString():this.parseIdentifier();e.push(t,...this.lexer.skipInsignificant(),this.lexer.consume(Y.JsonTokenType.COLON),...this.lexer.skipInsignificant());let n=this.parseNext();return e.push(n),new Ae.JsonPropertyNode({key:t,value:n,children:s.createChildren(e),location:{start:e[0].location.start,end:e[e.length-1].location.end}})}parseIdentifier(){let e=this.lexer.consume(Y.JsonTokenType.IDENTIFIER);if((0,cc.isReserved)(e.value)){let n=e.location.start;throw new dn.JsonParseError(`Reserved identifier '${e.value}' at ${n.line}:${n.column}.`,e.location)}let t=new Ae.JsonTokenNode(e);return new Ae.JsonIdentifierNode({token:t,children:[t],location:e.location})}static createChildren(e){return e.map(t=>t instanceof Ae.JsonNode?t:new Ae.JsonTokenNode(t))}};ls.JsonParser=Fi});var ho=ee(lo=>{"use strict";Object.defineProperty(lo,"__esModule",{value:!0})});var fo=ee(Oe=>{"use strict";var lc=Oe&&Oe.__createBinding||(Object.create?(function(s,e,t,n){n===void 0&&(n=t);var r=Object.getOwnPropertyDescriptor(e,t);(!r||("get"in r?!e.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(s,n,r)}):(function(s,e,t,n){n===void 0&&(n=t),s[n]=e[t]})),Dt=Oe&&Oe.__exportStar||function(s,e){for(var t in s)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&lc(e,s,t)};Object.defineProperty(Oe,"__esModule",{value:!0});Dt(Vt(),Oe);Dt(ri(),Oe);Dt(oi(),Oe);Dt(co(),Oe);Dt(He(),Oe);Dt(ho(),Oe);Dt(zn(),Oe);Dt(ct(),Oe)});var Ee=Lt(ks(),1),pr=Lt(Ms(),1);import{stdin as fr,stdout as Dr}from"node:process";import*as it from"node:readline";import ir from"node:readline";import{Writable as Su}from"node:stream";function ku({onlyFirst:s=!1}={}){let e=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");return new RegExp(e,s?void 0:"g")}var ju=ku();function dr(s){if(typeof s!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof s}\``);return s.replace(ju,"")}function mr(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}var gr={exports:{}};(function(s){var e={};s.exports=e,e.eastAsianWidth=function(n){var r=n.charCodeAt(0),o=n.length==2?n.charCodeAt(1):0,i=r;return 55296<=r&&r<=56319&&56320<=o&&o<=57343&&(r&=1023,o&=1023,i=r<<10|o,i+=65536),i==12288||65281<=i&&i<=65376||65504<=i&&i<=65510?"F":i==8361||65377<=i&&i<=65470||65474<=i&&i<=65479||65482<=i&&i<=65487||65490<=i&&i<=65495||65498<=i&&i<=65500||65512<=i&&i<=65518?"H":4352<=i&&i<=4447||4515<=i&&i<=4519||4602<=i&&i<=4607||9001<=i&&i<=9002||11904<=i&&i<=11929||11931<=i&&i<=12019||12032<=i&&i<=12245||12272<=i&&i<=12283||12289<=i&&i<=12350||12353<=i&&i<=12438||12441<=i&&i<=12543||12549<=i&&i<=12589||12593<=i&&i<=12686||12688<=i&&i<=12730||12736<=i&&i<=12771||12784<=i&&i<=12830||12832<=i&&i<=12871||12880<=i&&i<=13054||13056<=i&&i<=19903||19968<=i&&i<=42124||42128<=i&&i<=42182||43360<=i&&i<=43388||44032<=i&&i<=55203||55216<=i&&i<=55238||55243<=i&&i<=55291||63744<=i&&i<=64255||65040<=i&&i<=65049||65072<=i&&i<=65106||65108<=i&&i<=65126||65128<=i&&i<=65131||110592<=i&&i<=110593||127488<=i&&i<=127490||127504<=i&&i<=127546||127552<=i&&i<=127560||127568<=i&&i<=127569||131072<=i&&i<=194367||177984<=i&&i<=196605||196608<=i&&i<=262141?"W":32<=i&&i<=126||162<=i&&i<=163||165<=i&&i<=166||i==172||i==175||10214<=i&&i<=10221||10629<=i&&i<=10630?"Na":i==161||i==164||167<=i&&i<=168||i==170||173<=i&&i<=174||176<=i&&i<=180||182<=i&&i<=186||188<=i&&i<=191||i==198||i==208||215<=i&&i<=216||222<=i&&i<=225||i==230||232<=i&&i<=234||236<=i&&i<=237||i==240||242<=i&&i<=243||247<=i&&i<=250||i==252||i==254||i==257||i==273||i==275||i==283||294<=i&&i<=295||i==299||305<=i&&i<=307||i==312||319<=i&&i<=322||i==324||328<=i&&i<=331||i==333||338<=i&&i<=339||358<=i&&i<=359||i==363||i==462||i==464||i==466||i==468||i==470||i==472||i==474||i==476||i==593||i==609||i==708||i==711||713<=i&&i<=715||i==717||i==720||728<=i&&i<=731||i==733||i==735||768<=i&&i<=879||913<=i&&i<=929||931<=i&&i<=937||945<=i&&i<=961||963<=i&&i<=969||i==1025||1040<=i&&i<=1103||i==1105||i==8208||8211<=i&&i<=8214||8216<=i&&i<=8217||8220<=i&&i<=8221||8224<=i&&i<=8226||8228<=i&&i<=8231||i==8240||8242<=i&&i<=8243||i==8245||i==8251||i==8254||i==8308||i==8319||8321<=i&&i<=8324||i==8364||i==8451||i==8453||i==8457||i==8467||i==8470||8481<=i&&i<=8482||i==8486||i==8491||8531<=i&&i<=8532||8539<=i&&i<=8542||8544<=i&&i<=8555||8560<=i&&i<=8569||i==8585||8592<=i&&i<=8601||8632<=i&&i<=8633||i==8658||i==8660||i==8679||i==8704||8706<=i&&i<=8707||8711<=i&&i<=8712||i==8715||i==8719||i==8721||i==8725||i==8730||8733<=i&&i<=8736||i==8739||i==8741||8743<=i&&i<=8748||i==8750||8756<=i&&i<=8759||8764<=i&&i<=8765||i==8776||i==8780||i==8786||8800<=i&&i<=8801||8804<=i&&i<=8807||8810<=i&&i<=8811||8814<=i&&i<=8815||8834<=i&&i<=8835||8838<=i&&i<=8839||i==8853||i==8857||i==8869||i==8895||i==8978||9312<=i&&i<=9449||9451<=i&&i<=9547||9552<=i&&i<=9587||9600<=i&&i<=9615||9618<=i&&i<=9621||9632<=i&&i<=9633||9635<=i&&i<=9641||9650<=i&&i<=9651||9654<=i&&i<=9655||9660<=i&&i<=9661||9664<=i&&i<=9665||9670<=i&&i<=9672||i==9675||9678<=i&&i<=9681||9698<=i&&i<=9701||i==9711||9733<=i&&i<=9734||i==9737||9742<=i&&i<=9743||9748<=i&&i<=9749||i==9756||i==9758||i==9792||i==9794||9824<=i&&i<=9825||9827<=i&&i<=9829||9831<=i&&i<=9834||9836<=i&&i<=9837||i==9839||9886<=i&&i<=9887||9918<=i&&i<=9919||9924<=i&&i<=9933||9935<=i&&i<=9953||i==9955||9960<=i&&i<=9983||i==10045||i==10071||10102<=i&&i<=10111||11093<=i&&i<=11097||12872<=i&&i<=12879||57344<=i&&i<=63743||65024<=i&&i<=65039||i==65533||127232<=i&&i<=127242||127248<=i&&i<=127277||127280<=i&&i<=127337||127344<=i&&i<=127386||917760<=i&&i<=917999||983040<=i&&i<=1048573||1048576<=i&&i<=1114109?"A":"N"},e.characterLength=function(n){var r=this.eastAsianWidth(n);return r=="F"||r=="W"||r=="A"?2:1};function t(n){return n.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g)||[]}e.length=function(n){for(var r=t(n),o=0,i=0;i<r.length;i++)o=o+this.characterLength(r[i]);return o},e.slice=function(n,r,o){textLen=e.length(n),r=r||0,o=o||1,r<0&&(r=textLen+r),o<0&&(o=textLen+o);for(var i="",u=0,h=t(n),f=0;f<h.length;f++){var p=h[f],l=e.length(p);if(u>=r-(l==2?1:0))if(u+l<=o)i+=p;else break;u+=l}return i}})(gr);var Mu=gr.exports,Pu=mr(Mu),Ju=function(){return/\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67)\uDB40\uDC7F|(?:\uD83E\uDDD1\uD83C\uDFFF\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFC-\uDFFF])|\uD83D\uDC68(?:\uD83C\uDFFB(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|[\u2695\u2696\u2708]\uFE0F|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))?|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])\uFE0F|\u200D(?:(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D[\uDC66\uDC67])|\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC)?|(?:\uD83D\uDC69(?:\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69]))|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC69(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83E\uDDD1(?:\u200D(?:\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDE36\u200D\uD83C\uDF2B|\uD83C\uDFF3\uFE0F\u200D\u26A7|\uD83D\uDC3B\u200D\u2744|(?:(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\uD83C\uDFF4\u200D\u2620|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])\u200D[\u2640\u2642]|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u2600-\u2604\u260E\u2611\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26B0\u26B1\u26C8\u26CF\u26D1\u26D3\u26E9\u26F0\u26F1\u26F4\u26F7\u26F8\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u3030\u303D\u3297\u3299]|\uD83C[\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]|\uD83D[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3])\uFE0F|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDE35\u200D\uD83D\uDCAB|\uD83D\uDE2E\u200D\uD83D\uDCA8|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83E\uDDD1(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83D\uDC69(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF6\uD83C\uDDE6|\uD83C\uDDF4\uD83C\uDDF2|\uD83D\uDC08\u200D\u2B1B|\u2764\uFE0F\u200D(?:\uD83D\uDD25|\uD83E\uDE79)|\uD83D\uDC41\uFE0F|\uD83C\uDFF3\uFE0F|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|[#\*0-9]\uFE0F\u20E3|\u2764\uFE0F|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|\uD83C\uDFF4|(?:[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270C\u270D]|\uD83D[\uDD74\uDD90])(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC08\uDC15\uDC3B\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE2E\uDE35\uDE36\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5]|\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD]|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF]|[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0D\uDD0E\uDD10-\uDD17\uDD1D\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78\uDD7A-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCB\uDDD0\uDDE0-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6]|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26A7\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5-\uDED7\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDD77\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g},Ru=mr(Ju);function an(s,e={}){if(typeof s!="string"||s.length===0||(e={ambiguousIsNarrow:!0,...e},s=dr(s),s.length===0))return 0;s=s.replace(Ru()," ");let t=e.ambiguousIsNarrow?1:2,n=0;for(let r of s){let o=r.codePointAt(0);if(!(o<=31||o>=127&&o<=159||o>=768&&o<=879))switch(Pu.eastAsianWidth(r)){case"F":case"W":n+=2;break;case"A":n+=t;break;default:n+=1}}return n}var Ps=10,rr=(s=0)=>e=>`\x1B[${e+s}m`,or=(s=0)=>e=>`\x1B[${38+s};5;${e}m`,ur=(s=0)=>(e,t,n)=>`\x1B[${38+s};2;${e};${t};${n}m`,te={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};Object.keys(te.modifier);var Lu=Object.keys(te.color),Wu=Object.keys(te.bgColor);[...Lu,...Wu];function qu(){let s=new Map;for(let[e,t]of Object.entries(te)){for(let[n,r]of Object.entries(t))te[n]={open:`\x1B[${r[0]}m`,close:`\x1B[${r[1]}m`},t[n]=te[n],s.set(r[0],r[1]);Object.defineProperty(te,e,{value:t,enumerable:!1})}return Object.defineProperty(te,"codes",{value:s,enumerable:!1}),te.color.close="\x1B[39m",te.bgColor.close="\x1B[49m",te.color.ansi=rr(),te.color.ansi256=or(),te.color.ansi16m=ur(),te.bgColor.ansi=rr(Ps),te.bgColor.ansi256=or(Ps),te.bgColor.ansi16m=ur(Ps),Object.defineProperties(te,{rgbToAnsi256:{value:(e,t,n)=>e===t&&t===n?e<8?16:e>248?231:Math.round((e-8)/247*24)+232:16+36*Math.round(e/255*5)+6*Math.round(t/255*5)+Math.round(n/255*5),enumerable:!1},hexToRgb:{value:e=>{let t=/[a-f\d]{6}|[a-f\d]{3}/i.exec(e.toString(16));if(!t)return[0,0,0];let[n]=t;n.length===3&&(n=[...n].map(o=>o+o).join(""));let r=Number.parseInt(n,16);return[r>>16&255,r>>8&255,r&255]},enumerable:!1},hexToAnsi256:{value:e=>te.rgbToAnsi256(...te.hexToRgb(e)),enumerable:!1},ansi256ToAnsi:{value:e=>{if(e<8)return 30+e;if(e<16)return 90+(e-8);let t,n,r;if(e>=232)t=((e-232)*10+8)/255,n=t,r=t;else{e-=16;let u=e%36;t=Math.floor(e/36)/5,n=Math.floor(u/6)/5,r=u%6/5}let o=Math.max(t,n,r)*2;if(o===0)return 30;let i=30+(Math.round(r)<<2|Math.round(n)<<1|Math.round(t));return o===2&&(i+=60),i},enumerable:!1},rgbToAnsi:{value:(e,t,n)=>te.ansi256ToAnsi(te.rgbToAnsi256(e,t,n)),enumerable:!1},hexToAnsi:{value:e=>te.ansi256ToAnsi(te.hexToAnsi256(e)),enumerable:!1}}),te}var Gu=qu(),_n=new Set(["\x1B","\x9B"]),Uu=39,Ls="\x07",Cr="[",Vu="]",Er="m",Ws=`${Vu}8;;`,ar=s=>`${_n.values().next().value}${Cr}${s}${Er}`,cr=s=>`${_n.values().next().value}${Ws}${s}${Ls}`,Hu=s=>s.split(" ").map(e=>an(e)),Js=(s,e,t)=>{let n=[...e],r=!1,o=!1,i=an(dr(s[s.length-1]));for(let[u,h]of n.entries()){let f=an(h);if(i+f<=t?s[s.length-1]+=h:(s.push(h),i=0),_n.has(h)&&(r=!0,o=n.slice(u+1).join("").startsWith(Ws)),r){o?h===Ls&&(r=!1,o=!1):h===Er&&(r=!1);continue}i+=f,i===t&&u<n.length-1&&(s.push(""),i=0)}!i&&s[s.length-1].length>0&&s.length>1&&(s[s.length-2]+=s.pop())},zu=s=>{let e=s.split(" "),t=e.length;for(;t>0&&!(an(e[t-1])>0);)t--;return t===e.length?s:e.slice(0,t).join(" ")+e.slice(t).join("")},Yu=(s,e,t={})=>{if(t.trim!==!1&&s.trim()==="")return"";let n="",r,o,i=Hu(s),u=[""];for(let[f,p]of s.split(" ").entries()){t.trim!==!1&&(u[u.length-1]=u[u.length-1].trimStart());let l=an(u[u.length-1]);if(f!==0&&(l>=e&&(t.wordWrap===!1||t.trim===!1)&&(u.push(""),l=0),(l>0||t.trim===!1)&&(u[u.length-1]+=" ",l++)),t.hard&&i[f]>e){let m=e-l,C=1+Math.floor((i[f]-m-1)/e);Math.floor((i[f]-1)/e)<C&&u.push(""),Js(u,p,e);continue}if(l+i[f]>e&&l>0&&i[f]>0){if(t.wordWrap===!1&&l<e){Js(u,p,e);continue}u.push("")}if(l+i[f]>e&&t.wordWrap===!1){Js(u,p,e);continue}u[u.length-1]+=p}t.trim!==!1&&(u=u.map(f=>zu(f)));let h=[...u.join(`
13
+ `)];for(let[f,p]of h.entries()){if(n+=p,_n.has(p)){let{groups:m}=new RegExp(`(?:\\${Cr}(?<code>\\d+)m|\\${Ws}(?<uri>.*)${Ls})`).exec(h.slice(f).join(""))||{groups:{}};if(m.code!==void 0){let C=Number.parseFloat(m.code);r=C===Uu?void 0:C}else m.uri!==void 0&&(o=m.uri.length===0?void 0:m.uri)}let l=Gu.codes.get(Number(r));h[f+1]===`
14
+ `?(o&&(n+=cr("")),r&&l&&(n+=ar(l))):p===`
15
+ `&&(r&&l&&(n+=ar(r)),o&&(n+=cr(o)))}return n};function lr(s,e,t){return String(s).normalize().replace(/\r\n/g,`
16
+ `).split(`
17
+ `).map(n=>Yu(n,e,t)).join(`
18
+ `)}var Ku=["up","down","left","right","space","enter","cancel"],xn={actions:new Set(Ku),aliases:new Map([["k","up"],["j","down"],["h","left"],["l","right"],["","cancel"],["escape","cancel"]])};function qs(s,e){if(typeof s=="string")return xn.aliases.get(s)===e;for(let t of s)if(t!==void 0&&qs(t,e))return!0;return!1}function Qu(s,e){if(s===e)return;let t=s.split(`
19
+ `),n=e.split(`
20
+ `),r=[];for(let o=0;o<Math.max(t.length,n.length);o++)t[o]!==n[o]&&r.push(o);return r}var Zu=globalThis.process.platform.startsWith("win"),Rs=Symbol("clack:cancel");function rt(s){return s===Rs}function vn(s,e){let t=s;t.isTTY&&t.setRawMode(e)}function yr({input:s=fr,output:e=Dr,overwrite:t=!0,hideCursor:n=!0}={}){let r=it.createInterface({input:s,output:e,prompt:"",tabSize:1});it.emitKeypressEvents(s,r),s.isTTY&&s.setRawMode(!0);let o=(i,{name:u,sequence:h})=>{let f=String(i);if(qs([f,u,h],"cancel")){n&&e.write(Ee.cursor.show),process.exit(0);return}if(!t)return;it.moveCursor(e,u==="return"?0:-1,u==="return"?-1:0,()=>{it.clearLine(e,1,()=>{s.once("keypress",o)})})};return n&&e.write(Ee.cursor.hide),s.once("keypress",o),()=>{s.off("keypress",o),n&&e.write(Ee.cursor.show),s.isTTY&&!Zu&&s.setRawMode(!1),r.terminal=!1,r.close()}}var Xu=Object.defineProperty,ea=(s,e,t)=>e in s?Xu(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,$e=(s,e,t)=>(ea(s,typeof e!="symbol"?e+"":e,t),t),cn=class{constructor(e,t=!0){$e(this,"input"),$e(this,"output"),$e(this,"_abortSignal"),$e(this,"rl"),$e(this,"opts"),$e(this,"_render"),$e(this,"_track",!1),$e(this,"_prevFrame",""),$e(this,"_subscribers",new Map),$e(this,"_cursor",0),$e(this,"state","initial"),$e(this,"error",""),$e(this,"value");let{input:n=fr,output:r=Dr,render:o,signal:i,...u}=e;this.opts=u,this.onKeypress=this.onKeypress.bind(this),this.close=this.close.bind(this),this.render=this.render.bind(this),this._render=o.bind(this),this._track=t,this._abortSignal=i,this.input=n,this.output=r}unsubscribe(){this._subscribers.clear()}setSubscriber(e,t){let n=this._subscribers.get(e)??[];n.push(t),this._subscribers.set(e,n)}on(e,t){this.setSubscriber(e,{cb:t})}once(e,t){this.setSubscriber(e,{cb:t,once:!0})}emit(e,...t){let n=this._subscribers.get(e)??[],r=[];for(let o of n)o.cb(...t),o.once&&r.push(()=>n.splice(n.indexOf(o),1));for(let o of r)o()}prompt(){return new Promise((e,t)=>{if(this._abortSignal){if(this._abortSignal.aborted)return this.state="cancel",this.close(),e(Rs);this._abortSignal.addEventListener("abort",()=>{this.state="cancel",this.close()},{once:!0})}let n=new Su;n._write=(r,o,i)=>{this._track&&(this.value=this.rl?.line.replace(/\t/g,""),this._cursor=this.rl?.cursor??0,this.emit("value",this.value)),i()},this.input.pipe(n),this.rl=ir.createInterface({input:this.input,output:n,tabSize:2,prompt:"",escapeCodeTimeout:50,terminal:!0}),ir.emitKeypressEvents(this.input,this.rl),this.rl.prompt(),this.opts.initialValue!==void 0&&this._track&&this.rl.write(this.opts.initialValue),this.input.on("keypress",this.onKeypress),vn(this.input,!0),this.output.on("resize",this.render),this.render(),this.once("submit",()=>{this.output.write(Ee.cursor.show),this.output.off("resize",this.render),vn(this.input,!1),e(this.value)}),this.once("cancel",()=>{this.output.write(Ee.cursor.show),this.output.off("resize",this.render),vn(this.input,!1),e(Rs)})})}onKeypress(e,t){if(this.state==="error"&&(this.state="active"),t?.name&&(!this._track&&xn.aliases.has(t.name)&&this.emit("cursor",xn.aliases.get(t.name)),xn.actions.has(t.name)&&this.emit("cursor",t.name)),e&&(e.toLowerCase()==="y"||e.toLowerCase()==="n")&&this.emit("confirm",e.toLowerCase()==="y"),e===" "&&this.opts.placeholder&&(this.value||(this.rl?.write(this.opts.placeholder),this.emit("value",this.opts.placeholder))),e&&this.emit("key",e.toLowerCase()),t?.name==="return"){if(this.opts.validate){let n=this.opts.validate(this.value);n&&(this.error=n instanceof Error?n.message:n,this.state="error",this.rl?.write(this.value))}this.state!=="error"&&(this.state="submit")}qs([e,t?.name,t?.sequence],"cancel")&&(this.state="cancel"),(this.state==="submit"||this.state==="cancel")&&this.emit("finalize"),this.render(),(this.state==="submit"||this.state==="cancel")&&this.close()}close(){this.input.unpipe(),this.input.removeListener("keypress",this.onKeypress),this.output.write(`
21
+ `),vn(this.input,!1),this.rl?.close(),this.rl=void 0,this.emit(`${this.state}`,this.value),this.unsubscribe()}restoreCursor(){let e=lr(this._prevFrame,process.stdout.columns,{hard:!0}).split(`
22
+ `).length-1;this.output.write(Ee.cursor.move(-999,e*-1))}render(){let e=lr(this._render(this)??"",process.stdout.columns,{hard:!0});if(e!==this._prevFrame){if(this.state==="initial")this.output.write(Ee.cursor.hide);else{let t=Qu(this._prevFrame,e);if(this.restoreCursor(),t&&t?.length===1){let n=t[0];this.output.write(Ee.cursor.move(0,n)),this.output.write(Ee.erase.lines(1));let r=e.split(`
23
+ `);this.output.write(r[n]),this._prevFrame=e,this.output.write(Ee.cursor.move(0,r.length-n-1));return}if(t&&t?.length>1){let n=t[0];this.output.write(Ee.cursor.move(0,n)),this.output.write(Ee.erase.down());let r=e.split(`
24
+ `).slice(n);this.output.write(r.join(`
25
+ `)),this._prevFrame=e;return}this.output.write(Ee.erase.down())}this.output.write(e),this.state==="initial"&&(this.state="active"),this._prevFrame=e}}},On=class extends cn{get cursor(){return this.value?0:1}get _value(){return this.cursor===0}constructor(e){super(e,!1),this.value=!!e.initialValue,this.on("value",()=>{this.value=this._value}),this.on("confirm",t=>{this.output.write(Ee.cursor.move(0,-1)),this.value=t,this.state="submit",this.close()}),this.on("cursor",()=>{this.value=!this.value})}};var ta;ta=new WeakMap;var na=Object.defineProperty,sa=(s,e,t)=>e in s?na(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,hr=(s,e,t)=>(sa(s,typeof e!="symbol"?e+"":e,t),t),$n=class extends cn{constructor(e){super(e,!1),hr(this,"options"),hr(this,"cursor",0),this.options=e.options,this.cursor=this.options.findIndex(({value:t})=>t===e.initialValue),this.cursor===-1&&(this.cursor=0),this.changeValue(),this.on("cursor",t=>{switch(t){case"left":case"up":this.cursor=this.cursor===0?this.options.length-1:this.cursor-1;break;case"down":case"right":this.cursor=this.cursor===this.options.length-1?0:this.cursor+1;break}this.changeValue()})}get _value(){return this.options[this.cursor]}changeValue(){this.value=this._value.value}};var Tn=class extends cn{get valueWithCursor(){if(this.state==="submit")return this.value;if(this.cursor>=this.value.length)return`${this.value}\u2588`;let e=this.value.slice(0,this.cursor),[t,...n]=this.value.slice(this.cursor);return`${e}${pr.default.inverse(t)}${n.join("")}`}get cursor(){return this._cursor}constructor(e){super(e),this.on("finalize",()=>{this.value||(this.value=e.defaultValue)})}};var v=Lt(Ms(),1),In=Lt(ks(),1);import Ge from"node:process";function ia(){return Ge.platform!=="win32"?Ge.env.TERM!=="linux":!!Ge.env.CI||!!Ge.env.WT_SESSION||!!Ge.env.TERMINUS_SUBLIME||Ge.env.ConEmuTask==="{cmd::Cmder}"||Ge.env.TERM_PROGRAM==="Terminus-Sublime"||Ge.env.TERM_PROGRAM==="vscode"||Ge.env.TERM==="xterm-256color"||Ge.env.TERM==="alacritty"||Ge.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var Gs=ia(),he=(s,e)=>Gs?s:e,ra=he("\u25C6","*"),Fr=he("\u25A0","x"),br=he("\u25B2","x"),Hs=he("\u25C7","o"),oa=he("\u250C","T"),se=he("\u2502","|"),Wt=he("\u2514","\u2014"),Us=he("\u25CF",">"),Vs=he("\u25CB"," "),Ul=he("\u25FB","[\u2022]"),Vl=he("\u25FC","[+]"),Hl=he("\u25FB","[ ]"),zl=he("\u25AA","\u2022"),Yl=he("\u2500","-"),Kl=he("\u256E","+"),Ql=he("\u251C","+"),Zl=he("\u256F","+"),ua=he("\u25CF","\u2022"),aa=he("\u25C6","*"),ca=he("\u25B2","!"),la=he("\u25A0","x"),zs=s=>{switch(s){case"initial":case"active":return v.default.cyan(ra);case"cancel":return v.default.red(Fr);case"error":return v.default.yellow(br);case"submit":return v.default.green(Hs)}},ha=s=>{let{cursor:e,options:t,style:n}=s,r=s.maxItems??Number.POSITIVE_INFINITY,o=Math.max(process.stdout.rows-4,0),i=Math.min(o,Math.max(r,5)),u=0;e>=u+i-3?u=Math.max(Math.min(e-i+3,t.length-i),0):e<u+2&&(u=Math.max(e-2,0));let h=i<t.length&&u>0,f=i<t.length&&u+i<t.length;return t.slice(u,u+i).map((p,l,m)=>{let C=l===0&&h,w=l===m.length-1&&f;return C||w?v.default.dim("..."):n(p,l+u===e)})},wr=s=>new Tn({validate:s.validate,placeholder:s.placeholder,defaultValue:s.defaultValue,initialValue:s.initialValue,render(){let e=`${v.default.gray(se)}
26
+ ${zs(this.state)} ${s.message}
27
+ `,t=s.placeholder?v.default.inverse(s.placeholder[0])+v.default.dim(s.placeholder.slice(1)):v.default.inverse(v.default.hidden("_")),n=this.value?this.valueWithCursor:t;switch(this.state){case"error":return`${e.trim()}
28
+ ${v.default.yellow(se)} ${n}
29
+ ${v.default.yellow(Wt)} ${v.default.yellow(this.error)}
30
+ `;case"submit":return`${e}${v.default.gray(se)} ${v.default.dim(this.value||s.placeholder)}`;case"cancel":return`${e}${v.default.gray(se)} ${v.default.strikethrough(v.default.dim(this.value??""))}${this.value?.trim()?`
31
+ ${v.default.gray(se)}`:""}`;default:return`${e}${v.default.cyan(se)} ${n}
32
+ ${v.default.cyan(Wt)}
33
+ `}}}).prompt();var Bn=s=>{let e=s.active??"Yes",t=s.inactive??"No";return new On({active:e,inactive:t,initialValue:s.initialValue??!0,render(){let n=`${v.default.gray(se)}
34
+ ${zs(this.state)} ${s.message}
35
+ `,r=this.value?e:t;switch(this.state){case"submit":return`${n}${v.default.gray(se)} ${v.default.dim(r)}`;case"cancel":return`${n}${v.default.gray(se)} ${v.default.strikethrough(v.default.dim(r))}
36
+ ${v.default.gray(se)}`;default:return`${n}${v.default.cyan(se)} ${this.value?`${v.default.green(Us)} ${e}`:`${v.default.dim(Vs)} ${v.default.dim(e)}`} ${v.default.dim("/")} ${this.value?`${v.default.dim(Vs)} ${v.default.dim(t)}`:`${v.default.green(Us)} ${t}`}
37
+ ${v.default.cyan(Wt)}
38
+ `}}}).prompt()},Ys=s=>{let e=(t,n)=>{let r=t.label??String(t.value);switch(n){case"selected":return`${v.default.dim(r)}`;case"active":return`${v.default.green(Us)} ${r} ${t.hint?v.default.dim(`(${t.hint})`):""}`;case"cancelled":return`${v.default.strikethrough(v.default.dim(r))}`;default:return`${v.default.dim(Vs)} ${v.default.dim(r)}`}};return new $n({options:s.options,initialValue:s.initialValue,render(){let t=`${v.default.gray(se)}
39
+ ${zs(this.state)} ${s.message}
40
+ `;switch(this.state){case"submit":return`${t}${v.default.gray(se)} ${e(this.options[this.cursor],"selected")}`;case"cancel":return`${t}${v.default.gray(se)} ${e(this.options[this.cursor],"cancelled")}
41
+ ${v.default.gray(se)}`;default:return`${t}${v.default.cyan(se)} ${ha({cursor:this.cursor,options:this.options,maxItems:s.maxItems,style:(n,r)=>e(n,r?"active":"inactive")}).join(`
42
+ ${v.default.cyan(se)} `)}
43
+ ${v.default.cyan(Wt)}
44
+ `}}}).prompt()};var ln=(s="")=>{process.stdout.write(`${v.default.gray(Wt)} ${v.default.red(s)}
45
+
46
+ `)},Nn=(s="")=>{process.stdout.write(`${v.default.gray(oa)} ${s}
47
+ `)},Ks=(s="")=>{process.stdout.write(`${v.default.gray(se)}
48
+ ${v.default.gray(Wt)} ${s}
49
+
50
+ `)},ie={message:(s="",{symbol:e=v.default.gray(se)}={})=>{let t=[`${v.default.gray(se)}`];if(s){let[n,...r]=s.split(`
51
+ `);t.push(`${e} ${n}`,...r.map(o=>`${v.default.gray(se)} ${o}`))}process.stdout.write(`${t.join(`
52
+ `)}
53
+ `)},info:s=>{ie.message(s,{symbol:v.default.blue(ua)})},success:s=>{ie.message(s,{symbol:v.default.green(aa)})},step:s=>{ie.message(s,{symbol:v.default.green(Hs)})},warn:s=>{ie.message(s,{symbol:v.default.yellow(ca)})},warning:s=>{ie.warn(s)},error:s=>{ie.message(s,{symbol:v.default.red(la)})}},Xl=`${v.default.gray(se)} `;var qt=({indicator:s="dots"}={})=>{let e=Gs?["\u25D2","\u25D0","\u25D3","\u25D1"]:["\u2022","o","O","0"],t=Gs?80:120,n=process.env.CI==="true",r,o,i=!1,u="",h,f=performance.now(),p=b=>{let R=b>1?"Something went wrong":"Canceled";i&&k(R,b)},l=()=>p(2),m=()=>p(1),C=()=>{process.on("uncaughtExceptionMonitor",l),process.on("unhandledRejection",l),process.on("SIGINT",m),process.on("SIGTERM",m),process.on("exit",p)},w=()=>{process.removeListener("uncaughtExceptionMonitor",l),process.removeListener("unhandledRejection",l),process.removeListener("SIGINT",m),process.removeListener("SIGTERM",m),process.removeListener("exit",p)},y=()=>{if(h===void 0)return;n&&process.stdout.write(`
54
+ `);let b=h.split(`
55
+ `);process.stdout.write(In.cursor.move(-999,b.length-1)),process.stdout.write(In.erase.down(b.length))},D=b=>b.replace(/\.+$/,""),I=b=>{let R=(performance.now()-b)/1e3,Z=Math.floor(R/60),H=Math.floor(R%60);return Z>0?`[${Z}m ${H}s]`:`[${H}s]`},A=(b="")=>{i=!0,r=yr(),u=D(b),f=performance.now(),process.stdout.write(`${v.default.gray(se)}
56
+ `);let R=0,Z=0;C(),o=setInterval(()=>{if(n&&u===h)return;y(),h=u;let H=v.default.magenta(e[R]);if(n)process.stdout.write(`${H} ${u}...`);else if(s==="timer")process.stdout.write(`${H} ${u} ${I(f)}`);else{let ye=".".repeat(Math.floor(Z)).slice(0,3);process.stdout.write(`${H} ${u}${ye}`)}R=R+1<e.length?R+1:0,Z=Z<e.length?Z+.125:0},t)},k=(b="",R=0)=>{i=!1,clearInterval(o),y();let Z=R===0?v.default.green(Hs):R===1?v.default.red(Fr):v.default.red(br);u=D(b??u),s==="timer"?process.stdout.write(`${Z} ${u} ${I(f)}
57
+ `):process.stdout.write(`${Z} ${u}
58
+ `),w(),r()};return{start:A,stop:k,message:(b="")=>{u=D(b??u)}}};var Qs,Ar,vr,xr,Or=!0;typeof process<"u"&&({FORCE_COLOR:Qs,NODE_DISABLE_COLORS:Ar,NO_COLOR:vr,TERM:xr}=process.env||{},Or=process.stdout&&process.stdout.isTTY);var fa={enabled:!Ar&&vr==null&&xr!=="dumb"&&(Qs!=null&&Qs!=="0"||Or)};function z(s,e){let t=new RegExp(`\\x1b\\[${e}m`,"g"),n=`\x1B[${s}m`,r=`\x1B[${e}m`;return function(o){return!fa.enabled||o==null?o:n+(~(""+o).indexOf(r)?o.replace(t,r+n):o)+r}}var $r=z(0,0),Tr=z(1,22),nh=z(2,22),sh=z(3,23),ih=z(4,24),rh=z(7,27),oh=z(8,28),uh=z(9,29),ah=z(30,39),Te=z(31,39),_r=z(32,39),Ir=z(33,39),Br=z(34,39),be=z(35,39),_e=z(36,39),Nr=z(37,39),ot=z(90,39),ch=z(90,39),lh=z(40,49),Sn=z(41,49),hh=z(42,49),fh=z(43,49),hn=z(44,49),Zs=z(45,49),Dh=z(46,49),ph=z(47,49);import Sr from"node:fs";import{join as Da}from"node:path";var kn=async s=>{let e=await Sr.promises.readdir(s);return await Promise.all(e.map(t=>Sr.promises.rm(Da(s,t),{recursive:!0})))};import vi from"node:fs";import{isAbsolute as yc,join as Fc}from"node:path";var Pr=Lt(jr(),1);import Jr from"node:fs";import{join as Rr}from"node:path";import{execa as da}from"execa";function Gt(s,e,t){let n=da(s,e,{cwd:t,stdio:"ignore"}),r=n.then(()=>!0).catch(i=>(i&&(i.message?ie.error(Te(String(i.message))+`
59
+
60
+ `):ie.error(Te(String(i))+`
61
+
62
+ `)),!1));return{abort:async()=>{n.kill("SIGINT")},install:r}}async function Lr(s){let e=Rr(s,"package.json");return JSON.parse(await Jr.promises.readFile(e,"utf-8"))}async function Wr(s,e){let t=Rr(s,"package.json");await Jr.promises.writeFile(t,JSON.stringify(e,null,2)+`
63
+ `)}function qr(s){return new Promise(e=>setTimeout(e,s))}function Gr(s){s={...s};let e={name:s.name,version:s.version,description:s.description,scripts:s.scripts,dependencies:s.dependencies,devDependencies:s.devDependencies,main:s.main,qwik:s.qwik,module:s.module,types:s.types,exports:s.exports,files:s.files,engines:{node:s.engines?.node||"^18.17.0 || ^20.3.0 || >=21.0.0"}};Object.keys(e).forEach(n=>{delete s[n]}),delete s.__qwik__;let t=Object.keys(s).sort();for(let n of t)e[n]=s[n];return e}function Ur(s){return s.toLocaleLowerCase().split("-").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")}function ut(){return(0,Pr.default)()?.name||"pnpm"}function jn(s){console.error(`
64
+ \u274C ${Te(s)}
65
+ `),process.exit(1)}function Vr(){console.log(Br(`
66
+ ${be("............")}
67
+ .::: ${be(":--------:.")}
68
+ .:::: ${be(".:-------:.")}
69
+ .:::::. ${be(".:-------.")}
70
+ ::::::. ${be(".:------.")}
71
+ ::::::. ${be(":-----:")}
72
+ ::::::. ${be(".:-----.")}
73
+ :::::::. ${be(".-----.")}
74
+ ::::::::.. ${be("---:.")}
75
+ .:::::::::. ${be(":-:.")}
76
+ ..::::::::::::
77
+ ...::::
78
+ `),`
79
+ `)}function Hr(){return process.platform!=="win32"?process.env.TERM!=="linux":!!process.env.CI||!!process.env.WT_SESSION||!!process.env.TERMINUS_SUBLIME||process.env.ConEmuTask==="{cmd::Cmder}"||process.env.TERM_PROGRAM==="Terminus-Sublime"||process.env.TERM_PROGRAM==="vscode"||process.env.TERM==="xterm-256color"||process.env.TERM==="alacritty"||process.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var ma=Hr(),Ut=(s,e)=>ma?s:e,Xs=Ut("\u2502","|"),Mr=Ut("\u2500","-"),ga=Ut("\u256E","+"),Ca=Ut("\u251C","+"),Ea=Ut("\u256F","+"),ya=Ut("\u25C7","o");function Fa(){let s=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");return new RegExp(s,"g")}var ei=s=>s.replace(Fa(),""),Mn=(s="",e="")=>{let t=`
80
+ ${s}
81
+ `.split(`
82
+ `),n=ei(e).length,r=Math.max(t.reduce((i,u)=>(u=ei(u),u.length>i?u.length:i),0),n)+2,o=t.map(i=>`${ot(Xs)} ${Nr(i)}${" ".repeat(r-ei(i).length)}${ot(Xs)}`).join(`
83
+ `);process.stdout.write(`${ot(Xs)}
84
+ ${_r(ya)} ${$r(e)} ${ot(Mr.repeat(Math.max(r-n-1,1))+ga)}
85
+ ${o}
86
+ ${ot(Ca+Mr.repeat(r+2)+Ea)}
87
+ `)};import Do from"node:fs";import{dirname as Ec}from"node:path";import at from"node:fs";import Ue from"node:path";function bt(s,e){return Gt(s,["install"],e)}function zr(s,e){let{tmpInstallDir:t}=ba(e),{install:n,abort:r}=bt(s,t),i={abort:()=>r().finally(()=>at.rmSync(t,{recursive:!0})),complete:async u=>{let h=!1;try{if(await n){let p=Ue.join(t,"node_modules"),l=Ue.join(u,"node_modules");await at.promises.rename(p,l);try{await at.promises.rename(Ue.join(t,"package-lock.json"),Ue.join(u,"package-lock.json"))}catch{}try{await at.promises.rename(Ue.join(t,"yarn.lock"),Ue.join(u,"yarn.lock"))}catch{}try{await at.promises.rename(Ue.join(t,"pnpm-lock.yaml"),Ue.join(u,"pnpm-lock.yaml"))}catch{}h=!0,at.rmSync(t,{recursive:!0})}}catch(f){f&&(f.message?ie.error(Te(String(f.message))+`
88
+
89
+ `):ie.error(Te(String(f))+`
90
+
91
+ `))}if(!h){let f=`${Sn(` ${s} install failed `)}
92
+ You might need to run ${_e(`"${s} install"`)} manually inside the root of the project.
93
+
94
+ `;ie.error(f)}return h},success:void 0};return n.then(u=>i.success=u),i}function ba(s){let e=".create-qwik-"+Math.round(Math.random()*Number.MAX_SAFE_INTEGER).toString(36).toLowerCase(),t=Ue.resolve(s.target,"..",e);try{at.mkdirSync(t)}catch(o){ie.error(`\u274C ${Te(String(o))}`)}let n=Ue.join(s.dir,"package.json"),r=Ue.join(t,"package.json");return at.copyFileSync(n,r),{tmpInstallDir:t}}import ti from"node:fs";import{join as ni,dirname as wa}from"node:path";import{fileURLToPath as Aa}from"node:url";var va=wa(Aa(import.meta.url)),si=null;async function Pn(){if(!si){let s=[],e=["app","feature","adapter"],t=ni(va,"starters"),n=await ti.promises.readdir(t);await Promise.all(n.map(async r=>{let o=r.slice(0,r.length-1);if(e.includes(o)){let i=ni(t,r),u=await ti.promises.readdir(i);await Promise.all(u.map(async h=>{let f=ni(i,h);if((await ti.promises.stat(f)).isDirectory()){let l=await Lr(f),m={id:h,name:l.__qwik__?.displayName??Ur(h),type:o,dir:f,pkgJson:l,docs:l.__qwik__?.docs??[],priority:l?.__qwik__?.priority??0,alwaysInRoot:l.__qwik__?.alwaysInRoot??[]};s.push(m)}}))}})),s.sort((r,o)=>r.priority>o.priority?-1:r.priority<o.priority?1:r.id<o.id?-1:1),si=s}return si}var Xt=Lt(fo(),1);import ve from"node:fs";import{extname as hc,join as bi}from"node:path";async function wi(s,e,t,n,r){let o=await ve.promises.readdir(t);await Promise.all(o.map(async i=>{let u=i==="gitignore"?".gitignore":i,h=hc(u),f=bi(t,i),p=bi(n,u),l=await ve.promises.stat(f);if(l.isDirectory())await wi(s,e,f,p,r);else if(l.isFile()){let m=fc(e,p,n,u,r);u==="package.json"?await Dc(s,f,p):n.endsWith(".vscode")&&u==="settings.json"?await pc(s,f,m):u==="README.md"?await mc(s,f,m):u===".gitignore"||u===".prettierignore"||u===".eslintignore"?await gc(s,f,p):h===".css"?await Cc(s,f,m,e):ve.existsSync(m)?s.files.push({path:m,content:await ve.promises.readFile(f),type:"overwrite"}):s.files.push({path:m,content:await ve.promises.readFile(f),type:"create"})}}))}function fc(s,e,t,n,r){let o=s.projectDir?s.projectDir:"",i=t.indexOf(s.rootDir)+s.rootDir.length,u=t.slice(i),h=bi(s.rootDir,o,u,n);return r&&r.some(p=>n.includes(p)||t.includes(p))?e:h}async function Dc(s,e,t){let n=await ve.promises.readFile(e,"utf-8");try{let r=JSON.parse(n),o=["scripts","dependencies","devDependencies"],i=JSON.parse(await ve.promises.readFile(t,"utf-8"));if(o.forEach(u=>{dc(r,i,u)}),i.scripts?.qwik){let u=i.scripts.qwik;delete i.scripts.qwik,i.scripts.qwik=u}s.files.push({path:t,content:JSON.stringify(i,null,2)+`
95
+ `,type:"modify"})}catch{s.files.push({path:t,content:n,type:"create"})}}async function pc(s,e,t){let n=await ve.promises.readFile(e,"utf-8");try{let r=Xt.JsonParser.parse(n,Xt.JsonObjectNode),o=Xt.JsonParser.parse(await ve.promises.readFile(t,"utf-8"),Xt.JsonObjectNode);o.merge(r),s.files.push({path:t,content:o.toString()+`
96
+ `,type:"modify"})}catch{s.files.push({path:t,content:n,type:"create"})}}function dc(s,e,t){if(s[t]){e[t]?Object.assign(e[t],{...s[t]}):e[t]={...s[t]};let n={},r=Object.keys(e[t]).sort();for(let o of r)n[o]=e[t][o];e[t]=n}}async function mc(s,e,t){let n=await ve.promises.readFile(e,"utf-8"),r,o="";try{o=await ve.promises.readFile(t,"utf-8"),o=o.trim()+`
97
+
98
+ `+n,r="modify"}catch{o=n,r="create"}let i=ut();i!=="npm"&&(o=o.replace(/\b(npm run|pnpm run|yarn( run)?)\b/g,i)),s.files.push({path:t,content:o.trim()+`
99
+ `,type:r})}async function gc(s,e,t){let n=await ve.promises.readFile(e,"utf-8");try{let r=await ve.promises.readFile(t,"utf-8"),o=n.trim().split(/\r?\n/),i=r.trim().split(/\r?\n/);for(let u of o)i.includes(u)||(u.startsWith("#")&&i.push(""),i.push(u));s.files.push({path:t,content:i.join(`
100
+ `).trim()+`
101
+ `,type:"modify"})}catch{s.files.push({path:t,content:n,type:"create"})}}async function Cc(s,e,t,n){let r=await ve.promises.readFile(e,"utf-8");try{let o=await ve.promises.readFile(t,"utf-8"),i=r.trim()+`
102
+
103
+ `+o.trim()+`
104
+ `,u=n.installDeps===!0;s.files.push({path:t,content:u?i:r,type:u?"modify":"overwrite"})}catch{s.files.push({path:t,content:r,type:"create"})}}async function Ai(s,e){let n=(await Pn()).find(u=>u.id===e.integration);if(!n)throw new Error(`Unable to find integration "${e.integration}"`);let r={files:[],installedDeps:{},installedScripts:Object.keys(n.pkgJson.scripts||{})};e.installDeps&&(r.installedDeps={...n.pkgJson.dependencies,...n.pkgJson.devDependencies}),await wi(r,e,n.dir,e.rootDir,n.alwaysInRoot);let o=async u=>{let h=Object.keys(r.installedDeps).length>0,f=qt();u&&f.start(`Updating app${h?" and installing dependencies":""}...`);let p=!0;try{let l=new Set(r.files.map(C=>Ec(C.path)));for(let C of Array.from(l))try{Do.mkdirSync(C,{recursive:!0})}catch{}let m=Promise.all(r.files.map(async C=>{await Do.promises.writeFile(C.path,C.content)}));if(e.installDeps&&Object.keys(r.installedDeps).length>0){let{install:C}=bt(s,e.rootDir);p=await C}if(await m,u&&f.stop("App updated"),!p){let C=`${Sn(` ${s} install failed `)}
105
+ You might need to run "${_e(`${s} install`)}" manually inside the root of the project.`;ie.error(C)}}catch(l){u&&f.stop("App updated"),jn(String(l))}};return{rootDir:e.rootDir,integration:n,updates:r,commit:o}}function bc(s){return typeof s=="string"&&s.trim().length>0}function wc(s){if(!bc(s.outDir))throw new Error("Missing outDir");if(!yc(s.outDir))throw new Error("outDir must be an absolute path")}async function en(s){let{appId:e,outDir:t,pkgManager:n,templateManager:r}=s,{baseApp:o,starterApp:i}=r.getBootstrapApps(e);wc(s),vi.existsSync(t)||vi.mkdirSync(decodeURIComponent(t),{recursive:!0});let u=await Ac({baseApp:o,starterApp:i,pkgManager:n,outDir:t});return{starterId:s.appId,outDir:t,pkgManager:n,docs:u}}async function Ac({baseApp:s,starterApp:e,outDir:t,pkgManager:n}){let r=[...s.docs],o=e??s,i=Gr({...s.pkgJson,name:`my-${o.pkgJson.name}`,description:o.pkgJson.description,scripts:void 0,dependencies:void 0,devDependencies:void 0});await Wr(t,i);let u=Fc(t,"README.md");return await vi.promises.writeFile(u,""),await(await Ai(n,{rootDir:t,integration:s.id,installDeps:!1})).commit(!1),e&&(r.push(...e.docs),await(await Ai(n,{rootDir:t,integration:e.id,installDeps:!1})).commit(!1)),r}import Eu from"node:fs";async function hs(s,{pkgManager:e,spinner:t}){t.start(`Installing ${e} dependencies...`);let n=await s();return t.stop(`${n?"Installed":"Failed to install"} ${e} dependencies \u{1F4CB}`),n}function po(s){let e=[];return s.length>0&&(e.push(`\u{1F4C4} ${_e("Relevant docs:")}`),s.forEach(t=>{e.push(` ${t}`)})),e.push(""),e.push(`\u{1F4AC} ${_e("Questions? Start the conversation at:")}`),e.push(" https://qwik.dev/chat"),e.push(" https://twitter.com/QwikDev"),e.push(""),e.join(`
106
+ `)}import{relative as vc}from"node:path";function fs(s,e,t){let n=process.cwd()===e.outDir,r=vc(process.cwd(),e.outDir),o=[];n?o.push(`\u{1F984} ${Zs(" Success! ")}`):o.push(`\u{1F984} ${Zs(" Success! ")} ${_e("Project created in")} ${Tr(be(r))} ${_e("directory")}`),o.push("");let i=s!=="npm"?`${s} qwik add`:"npm run qwik add";o.push(`\u{1F90D} ${_e("Integrations? Add Netlify, Cloudflare, Tailwind...")}`),o.push(` ${i}`),o.push(""),o.push(po(e.docs)),o.push(`\u{1F440} ${_e("Presentations, Podcasts and Videos:")}`),o.push(" https://qwik.dev/media/"),o.push(""),o.push(`\u{1F430} ${_e("Next steps:")}`),n||o.push(` cd ${r}`),t||o.push(` ${s} install`),s==="deno"?o.push(" deno task start"):o.push(` ${s} start`),o.push(""),Mn(o.join(`
107
+ `),"Result"),Ks("Happy coding! \u{1F389}")}var xi,xc="library",Ds="base",mn=class extends Error{constructor(e,t){super(),this.message=`Invalid app id "${e}". It can only be one of${t.map(n=>` "${n.id}"`)}.`}},tn=async s=>{xi||(xi=await Pn());let e=xi.filter(i=>i.type===s),t=e.filter(i=>i.id!==Ds);function n(i,u=!0){return u?t.find(h=>h.id===i):e.find(h=>h.id===i)}function r(){return n(Ds,!1)}function o(i){if(i===xc){let p=n(i);if(!p)throw new mn(i,t);return{baseApp:p}}let h=n(Ds,!1),f=n(i);if(!h)throw new mn(Ds,t);if(!f)throw new mn(i,t);return{baseApp:h,starterApp:f}}return{templates:e,standaloneTemplates:t,getAppById:n,getBootstrapApps:o,getBaseApp:r}};import{resolve as mo}from"path";import Oc from"node:os";function ps(s){return s.startsWith("~/")?mo(Oc.homedir(),s):mo(process.cwd(),s)}import{notStrictEqual as Xc,strictEqual as el}from"assert";var $c={right:Nc,center:Sc},Tc=0,ds=1,_c=2,ms=3,Oi=class{constructor(e){var t;this.width=e.width,this.wrap=(t=e.wrap)!==null&&t!==void 0?t:!0,this.rows=[]}span(...e){let t=this.div(...e);t.span=!0}resetOutput(){this.rows=[]}div(...e){if(e.length===0&&this.div(""),this.wrap&&this.shouldApplyLayoutDSL(...e)&&typeof e[0]=="string")return this.applyLayoutDSL(e[0]);let t=e.map(n=>typeof n=="string"?this.colFromString(n):n);return this.rows.push(t),t}shouldApplyLayoutDSL(...e){return e.length===1&&typeof e[0]=="string"&&/[\t\n]/.test(e[0])}applyLayoutDSL(e){let t=e.split(`
108
+ `).map(r=>r.split(" ")),n=0;return t.forEach(r=>{r.length>1&&Ie.stringWidth(r[0])>n&&(n=Math.min(Math.floor(this.width*.5),Ie.stringWidth(r[0])))}),t.forEach(r=>{this.div(...r.map((o,i)=>({text:o.trim(),padding:this.measurePadding(o),width:i===0&&r.length>1?n:void 0})))}),this.rows[this.rows.length-1]}colFromString(e){return{text:e,padding:this.measurePadding(e)}}measurePadding(e){let t=Ie.stripAnsi(e);return[0,t.match(/\s*$/)[0].length,0,t.match(/^\s*/)[0].length]}toString(){let e=[];return this.rows.forEach(t=>{this.rowToString(t,e)}),e.filter(t=>!t.hidden).map(t=>t.text).join(`
109
+ `)}rowToString(e,t){return this.rasterize(e).forEach((n,r)=>{let o="";n.forEach((i,u)=>{let{width:h}=e[u],f=this.negatePadding(e[u]),p=i;if(f>Ie.stringWidth(i)&&(p+=" ".repeat(f-Ie.stringWidth(i))),e[u].align&&e[u].align!=="left"&&this.wrap){let m=$c[e[u].align];p=m(p,f),Ie.stringWidth(p)<f&&(p+=" ".repeat((h||0)-Ie.stringWidth(p)-1))}let l=e[u].padding||[0,0,0,0];l[ms]&&(o+=" ".repeat(l[ms])),o+=go(e[u],p,"| "),o+=p,o+=go(e[u],p," |"),l[ds]&&(o+=" ".repeat(l[ds])),r===0&&t.length>0&&(o=this.renderInline(o,t[t.length-1]))}),t.push({text:o.replace(/ +$/,""),span:e.span})}),t}renderInline(e,t){let n=e.match(/^ */),r=n?n[0].length:0,o=t.text,i=Ie.stringWidth(o.trimRight());return t.span?this.wrap?r<i?e:(t.hidden=!0,o.trimRight()+" ".repeat(r-i)+e.trimLeft()):(t.hidden=!0,o+e):e}rasterize(e){let t=[],n=this.columnWidths(e),r;return e.forEach((o,i)=>{o.width=n[i],this.wrap?r=Ie.wrap(o.text,this.negatePadding(o),{hard:!0}).split(`
110
+ `):r=o.text.split(`
111
+ `),o.border&&(r.unshift("."+"-".repeat(this.negatePadding(o)+2)+"."),r.push("'"+"-".repeat(this.negatePadding(o)+2)+"'")),o.padding&&(r.unshift(...new Array(o.padding[Tc]||0).fill("")),r.push(...new Array(o.padding[_c]||0).fill(""))),r.forEach((u,h)=>{t[h]||t.push([]);let f=t[h];for(let p=0;p<i;p++)f[p]===void 0&&f.push("");f.push(u)})}),t}negatePadding(e){let t=e.width||0;return e.padding&&(t-=(e.padding[ms]||0)+(e.padding[ds]||0)),e.border&&(t-=4),t}columnWidths(e){if(!this.wrap)return e.map(i=>i.width||Ie.stringWidth(i.text));let t=e.length,n=this.width,r=e.map(i=>{if(i.width)return t--,n-=i.width,i.width}),o=t?Math.floor(n/t):0;return r.map((i,u)=>i===void 0?Math.max(o,Ic(e[u])):i)}};function go(s,e,t){return s.border?/[.']-+[.']/.test(e)?"":e.trim().length!==0?t:" ":""}function Ic(s){let e=s.padding||[],t=1+(e[ms]||0)+(e[ds]||0);return s.border?t+4:t}function Bc(){return typeof process=="object"&&process.stdout&&process.stdout.columns?process.stdout.columns:80}function Nc(s,e){s=s.trim();let t=Ie.stringWidth(s);return t<e?" ".repeat(e-t)+s:s}function Sc(s,e){s=s.trim();let t=Ie.stringWidth(s);return t>=e?s:" ".repeat(e-t>>1)+s}var Ie;function Co(s,e){return Ie=e,new Oi({width:s?.width||Bc(),wrap:s?.wrap})}var Eo=new RegExp("\x1B(?:\\[(?:\\d+[ABCDEFGJKSTm]|\\d+;\\d+[Hfm]|\\d+;\\d+;\\d+m|6n|s|u|\\?25[lh])|\\w)","g");function $i(s){return s.replace(Eo,"")}function yo(s,e){let[t,n]=s.match(Eo)||["",""];s=$i(s);let r="";for(let o=0;o<s.length;o++)o!==0&&o%e===0&&(r+=`
112
+ `),r+=s.charAt(o);return t&&n&&(r=`${t}${r}${n}`),r}function Ti(s){return Co(s,{stringWidth:e=>[...e].length,stripAnsi:$i,wrap:yo})}import{dirname as Fo,resolve as bo}from"path";import{readdirSync as kc,statSync as jc}from"fs";function wo(s,e){let t=bo(".",s),n;for(jc(t).isDirectory()||(t=Fo(t));;){if(n=e(t,kc(t)),n)return bo(t,n);if(t=Fo(n=t),n===t)break}}import{inspect as tl}from"util";import{readFileSync as nl}from"fs";import{fileURLToPath as sl}from"url";import{format as Jc}from"util";import{normalize as Rc,resolve as Lc}from"path";function $t(s){if(s!==s.toLowerCase()&&s!==s.toUpperCase()||(s=s.toLowerCase()),s.indexOf("-")===-1&&s.indexOf("_")===-1)return s;{let t="",n=!1,r=s.match(/^-+/);for(let o=r?r[0].length:0;o<s.length;o++){let i=s.charAt(o);n&&(n=!1,i=i.toUpperCase()),o!==0&&(i==="-"||i==="_")?n=!0:i!=="-"&&i!=="_"&&(t+=i)}return t}}function gs(s,e){let t=s.toLowerCase();e=e||"-";let n="";for(let r=0;r<s.length;r++){let o=t.charAt(r),i=s.charAt(r);o!==i&&r>0?n+=`${e}${t.charAt(r)}`:n+=i}return n}function Cs(s){return s==null?!1:typeof s=="number"||/^0x[0-9a-f]+$/i.test(s)?!0:/^0[^.]/.test(s)?!1:/^[-]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(s)}function Ao(s){if(Array.isArray(s))return s.map(i=>typeof i!="string"?i+"":i);s=s.trim();let e=0,t=null,n=null,r=null,o=[];for(let i=0;i<s.length;i++){if(t=n,n=s.charAt(i),n===" "&&!r){t!==" "&&e++;continue}n===r?r=null:(n==="'"||n==='"')&&!r&&(r=n),o[e]||(o[e]=""),o[e]+=n}return o}var je;(function(s){s.BOOLEAN="boolean",s.STRING="string",s.NUMBER="number",s.ARRAY="array"})(je||(je={}));var st,Es=class{constructor(e){st=e}parse(e,t){let n=Object.assign({alias:void 0,array:void 0,boolean:void 0,config:void 0,configObjects:void 0,configuration:void 0,coerce:void 0,count:void 0,default:void 0,envPrefix:void 0,narg:void 0,normalize:void 0,string:void 0,number:void 0,__:void 0,key:void 0},t),r=Ao(e),o=typeof e=="string",i=Mc(Object.assign(Object.create(null),n.alias)),u=Object.assign({"boolean-negation":!0,"camel-case-expansion":!0,"combine-arrays":!1,"dot-notation":!0,"duplicate-arguments-array":!0,"flatten-duplicate-arrays":!0,"greedy-arrays":!0,"halt-at-non-option":!1,"nargs-eats-options":!1,"negation-prefix":"no-","parse-numbers":!0,"parse-positional-numbers":!0,"populate--":!1,"set-placeholder-key":!1,"short-option-groups":!0,"strip-aliased":!1,"strip-dashed":!1,"unknown-options-as-args":!1},n.configuration),h=Object.assign(Object.create(null),n.default),f=n.configObjects||[],p=n.envPrefix,l=u["populate--"],m=l?"--":"_",C=Object.create(null),w=Object.create(null),y=n.__||st.format,D={aliases:Object.create(null),arrays:Object.create(null),bools:Object.create(null),strings:Object.create(null),numbers:Object.create(null),counts:Object.create(null),normalize:Object.create(null),configs:Object.create(null),nargs:Object.create(null),coercions:Object.create(null),keys:[]},I=/^-([0-9]+(\.[0-9]+)?|\.[0-9]+)$/,A=new RegExp("^--"+u["negation-prefix"]+"(.+)");[].concat(n.array||[]).filter(Boolean).forEach(function(c){let g=typeof c=="object"?c.key:c,F=Object.keys(c).map(function(E){return{boolean:"bools",string:"strings",number:"numbers"}[E]}).filter(Boolean).pop();F&&(D[F][g]=!0),D.arrays[g]=!0,D.keys.push(g)}),[].concat(n.boolean||[]).filter(Boolean).forEach(function(c){D.bools[c]=!0,D.keys.push(c)}),[].concat(n.string||[]).filter(Boolean).forEach(function(c){D.strings[c]=!0,D.keys.push(c)}),[].concat(n.number||[]).filter(Boolean).forEach(function(c){D.numbers[c]=!0,D.keys.push(c)}),[].concat(n.count||[]).filter(Boolean).forEach(function(c){D.counts[c]=!0,D.keys.push(c)}),[].concat(n.normalize||[]).filter(Boolean).forEach(function(c){D.normalize[c]=!0,D.keys.push(c)}),typeof n.narg=="object"&&Object.entries(n.narg).forEach(([c,g])=>{typeof g=="number"&&(D.nargs[c]=g,D.keys.push(c))}),typeof n.coerce=="object"&&Object.entries(n.coerce).forEach(([c,g])=>{typeof g=="function"&&(D.coercions[c]=g,D.keys.push(c))}),typeof n.config<"u"&&(Array.isArray(n.config)||typeof n.config=="string"?[].concat(n.config).filter(Boolean).forEach(function(c){D.configs[c]=!0}):typeof n.config=="object"&&Object.entries(n.config).forEach(([c,g])=>{(typeof g=="boolean"||typeof g=="function")&&(D.configs[c]=g)})),Ft(n.key,i,n.default,D.arrays),Object.keys(h).forEach(function(c){(D.aliases[c]||[]).forEach(function(g){h[g]=h[c]})});let k=null;bn();let b=[],R=Object.assign(Object.create(null),{_:[]}),Z={};for(let c=0;c<r.length;c++){let g=r[c],F=g.replace(/^-{3,}/,"---"),E,d,B,O,j,de;if(g!=="--"&&/^-/.test(g)&&re(g))H(g);else if(F.match(/^---+(=|$)/)){H(g);continue}else if(g.match(/^--.+=/)||!u["short-option-groups"]&&g.match(/^-.+=/))O=g.match(/^--?([^=]+)=([\s\S]*)$/),O!==null&&Array.isArray(O)&&O.length>=3&&(P(O[1],D.arrays)?c=Le(c,O[1],r,O[2]):P(O[1],D.nargs)!==!1?c=ye(c,O[1],r,O[2]):V(O[1],O[2],!0));else if(g.match(A)&&u["boolean-negation"])O=g.match(A),O!==null&&Array.isArray(O)&&O.length>=2&&(d=O[1],V(d,P(d,D.arrays)?[!1]:!1));else if(g.match(/^--.+/)||!u["short-option-groups"]&&g.match(/^-[^-]+/))O=g.match(/^--?(.+)/),O!==null&&Array.isArray(O)&&O.length>=2&&(d=O[1],P(d,D.arrays)?c=Le(c,d,r):P(d,D.nargs)!==!1?c=ye(c,d,r):(j=r[c+1],j!==void 0&&(!j.match(/^-/)||j.match(I))&&!P(d,D.bools)&&!P(d,D.counts)||/^(true|false)$/.test(j)?(V(d,j),c++):V(d,oe(d))));else if(g.match(/^-.\..+=/))O=g.match(/^-([^=]+)=([\s\S]*)$/),O!==null&&Array.isArray(O)&&O.length>=3&&V(O[1],O[2]);else if(g.match(/^-.\..+/)&&!g.match(I))j=r[c+1],O=g.match(/^-(.\..+)/),O!==null&&Array.isArray(O)&&O.length>=2&&(d=O[1],j!==void 0&&!j.match(/^-/)&&!P(d,D.bools)&&!P(d,D.counts)?(V(d,j),c++):V(d,oe(d)));else if(g.match(/^-[^-]+/)&&!g.match(I)){B=g.slice(1,-1).split(""),E=!1;for(let Fe=0;Fe<B.length;Fe++){if(j=g.slice(Fe+2),B[Fe+1]&&B[Fe+1]==="="){de=g.slice(Fe+3),d=B[Fe],P(d,D.arrays)?c=Le(c,d,r,de):P(d,D.nargs)!==!1?c=ye(c,d,r,de):V(d,de),E=!0;break}if(j==="-"){V(B[Fe],j);continue}if(/[A-Za-z]/.test(B[Fe])&&/^-?\d+(\.\d*)?(e-?\d+)?$/.test(j)&&P(j,D.bools)===!1){V(B[Fe],j),E=!0;break}if(B[Fe+1]&&B[Fe+1].match(/\W/)){V(B[Fe],j),E=!0;break}else V(B[Fe],oe(B[Fe]))}d=g.slice(-1)[0],!E&&d!=="-"&&(P(d,D.arrays)?c=Le(c,d,r):P(d,D.nargs)!==!1?c=ye(c,d,r):(j=r[c+1],j!==void 0&&(!/^(-|--)[^-]/.test(j)||j.match(I))&&!P(d,D.bools)&&!P(d,D.counts)||/^(true|false)$/.test(j)?(V(d,j),c++):V(d,oe(d))))}else if(g.match(/^-[0-9]$/)&&g.match(I)&&P(g.slice(1),D.bools))d=g.slice(1),V(d,oe(d));else if(g==="--"){b=r.slice(c+1);break}else if(u["halt-at-non-option"]){b=r.slice(c);break}else H(g)}G(R,!0),G(R,!1),W(R),De(),ne(R,D.aliases,h,!0),pe(R),u["set-placeholder-key"]&&yt(R),Object.keys(D.counts).forEach(function(c){tt(R,c.split("."))||V(c,0)}),l&&b.length&&(R[m]=[]),b.forEach(function(c){R[m].push(c)}),u["camel-case-expansion"]&&u["strip-dashed"]&&Object.keys(R).filter(c=>c!=="--"&&c.includes("-")).forEach(c=>{delete R[c]}),u["strip-aliased"]&&[].concat(...Object.keys(i).map(c=>i[c])).forEach(c=>{u["camel-case-expansion"]&&c.includes("-")&&delete R[c.split(".").map(g=>$t(g)).join(".")],delete R[c]});function H(c){let g=_("_",c);(typeof g=="string"||typeof g=="number")&&R._.push(g)}function ye(c,g,F,E){let d,B=P(g,D.nargs);if(B=typeof B!="number"||isNaN(B)?1:B,B===0)return qe(E)||(k=Error(y("Argument unexpected for: %s",g))),V(g,oe(g)),c;let O=qe(E)?0:1;if(u["nargs-eats-options"])F.length-(c+1)+O<B&&(k=Error(y("Not enough arguments following: %s",g))),O=B;else{for(d=c+1;d<F.length&&(!F[d].match(/^-[^0-9]/)||F[d].match(I)||re(F[d]));d++)O++;O<B&&(k=Error(y("Not enough arguments following: %s",g)))}let j=Math.min(O,B);for(!qe(E)&&j>0&&(V(g,E),j--),d=c+1;d<j+c+1;d++)V(g,F[d]);return c+j}function Le(c,g,F,E){let d=[],B=E||F[c+1],O=P(g,D.nargs);if(P(g,D.bools)&&!/^(true|false)$/.test(B))d.push(!0);else if(qe(B)||qe(E)&&/^-/.test(B)&&!I.test(B)&&!re(B)){if(h[g]!==void 0){let j=h[g];d=Array.isArray(j)?j:[j]}}else{qe(E)||d.push(x(g,E,!0));for(let j=c+1;j<F.length&&!(!u["greedy-arrays"]&&d.length>0||O&&typeof O=="number"&&d.length>=O||(B=F[j],/^-/.test(B)&&!I.test(B)&&!re(B)));j++)c=j,d.push(x(g,B,o))}return typeof O=="number"&&(O&&d.length<O||isNaN(O)&&d.length===0)&&(k=Error(y("Not enough arguments following: %s",g))),V(g,d),c}function V(c,g,F=o){if(/-/.test(c)&&u["camel-case-expansion"]){let B=c.split(".").map(function(O){return $t(O)}).join(".");N(c,B)}let E=x(c,g,F),d=c.split(".");nt(R,d,E),D.aliases[c]&&D.aliases[c].forEach(function(B){let O=B.split(".");nt(R,O,E)}),d.length>1&&u["dot-notation"]&&(D.aliases[d[0]]||[]).forEach(function(B){let O=B.split("."),j=[].concat(d);j.shift(),O=O.concat(j),(D.aliases[c]||[]).includes(O.join("."))||nt(R,O,E)}),P(c,D.normalize)&&!P(c,D.arrays)&&[c].concat(D.aliases[c]||[]).forEach(function(O){Object.defineProperty(Z,O,{enumerable:!0,get(){return g},set(j){g=typeof j=="string"?st.normalize(j):j}})})}function N(c,g){D.aliases[c]&&D.aliases[c].length||(D.aliases[c]=[g],C[g]=!0),D.aliases[g]&&D.aliases[g].length||N(g,c)}function x(c,g,F){F&&(g=Pc(g)),(P(c,D.bools)||P(c,D.counts))&&typeof g=="string"&&(g=g==="true");let E=Array.isArray(g)?g.map(function(d){return _(c,d)}):_(c,g);return P(c,D.counts)&&(qe(E)||typeof E=="boolean")&&(E=_i()),P(c,D.normalize)&&P(c,D.arrays)&&(Array.isArray(g)?E=g.map(d=>st.normalize(d)):E=st.normalize(g)),E}function _(c,g){return!u["parse-positional-numbers"]&&c==="_"||!P(c,D.strings)&&!P(c,D.bools)&&!Array.isArray(g)&&(Cs(g)&&u["parse-numbers"]&&Number.isSafeInteger(Math.floor(parseFloat(`${g}`)))||!qe(g)&&P(c,D.numbers))&&(g=Number(g)),g}function W(c){let g=Object.create(null);ne(g,D.aliases,h),Object.keys(D.configs).forEach(function(F){let E=c[F]||g[F];if(E)try{let d=null,B=st.resolve(st.cwd(),E),O=D.configs[F];if(typeof O=="function"){try{d=O(B)}catch(j){d=j}if(d instanceof Error){k=d;return}}else d=st.require(B);U(d)}catch(d){d.name==="PermissionDenied"?k=d:c[F]&&(k=Error(y("Invalid JSON config file: %s",E)))}})}function U(c,g){Object.keys(c).forEach(function(F){let E=c[F],d=g?g+"."+F:F;typeof E=="object"&&E!==null&&!Array.isArray(E)&&u["dot-notation"]?U(E,d):(!tt(R,d.split("."))||P(d,D.arrays)&&u["combine-arrays"])&&V(d,E)})}function De(){typeof f<"u"&&f.forEach(function(c){U(c)})}function G(c,g){if(typeof p>"u")return;let F=typeof p=="string"?p:"",E=st.env();Object.keys(E).forEach(function(d){if(F===""||d.lastIndexOf(F,0)===0){let B=d.split("__").map(function(O,j){return j===0&&(O=O.substring(F.length)),$t(O)});(g&&D.configs[B.join(".")]||!g)&&!tt(c,B)&&V(B.join("."),E[d])}})}function pe(c){let g,F=new Set;Object.keys(c).forEach(function(E){if(!F.has(E)&&(g=P(E,D.coercions),typeof g=="function"))try{let d=_(E,g(c[E]));[].concat(D.aliases[E]||[],E).forEach(B=>{F.add(B),c[B]=d})}catch(d){k=d}})}function yt(c){return D.keys.forEach(g=>{~g.indexOf(".")||typeof c[g]>"u"&&(c[g]=void 0)}),c}function ne(c,g,F,E=!1){Object.keys(F).forEach(function(d){tt(c,d.split("."))||(nt(c,d.split("."),F[d]),E&&(w[d]=!0),(g[d]||[]).forEach(function(B){tt(c,B.split("."))||nt(c,B.split("."),F[d])}))})}function tt(c,g){let F=c;u["dot-notation"]||(g=[g.join(".")]),g.slice(0,-1).forEach(function(d){F=F[d]||{}});let E=g[g.length-1];return typeof F!="object"?!1:E in F}function nt(c,g,F){let E=c;u["dot-notation"]||(g=[g.join(".")]),g.slice(0,-1).forEach(function(de){de=vo(de),typeof E=="object"&&E[de]===void 0&&(E[de]={}),typeof E[de]!="object"||Array.isArray(E[de])?(Array.isArray(E[de])?E[de].push({}):E[de]=[E[de],{}],E=E[de][E[de].length-1]):E=E[de]});let d=vo(g[g.length-1]),B=P(g.join("."),D.arrays),O=Array.isArray(F),j=u["duplicate-arguments-array"];!j&&P(d,D.nargs)&&(j=!0,(!qe(E[d])&&D.nargs[d]===1||Array.isArray(E[d])&&E[d].length===D.nargs[d])&&(E[d]=void 0)),F===_i()?E[d]=_i(E[d]):Array.isArray(E[d])?j&&B&&O?E[d]=u["flatten-duplicate-arrays"]?E[d].concat(F):(Array.isArray(E[d][0])?E[d]:[E[d]]).concat([F]):!j&&!!B==!!O?E[d]=F:E[d]=E[d].concat([F]):E[d]===void 0&&B?E[d]=O?F:[F]:j&&!(E[d]===void 0||P(d,D.counts)||P(d,D.bools))?E[d]=[E[d],F]:E[d]=F}function Ft(...c){c.forEach(function(g){Object.keys(g||{}).forEach(function(F){D.aliases[F]||(D.aliases[F]=[].concat(i[F]||[]),D.aliases[F].concat(F).forEach(function(E){if(/-/.test(E)&&u["camel-case-expansion"]){let d=$t(E);d!==F&&D.aliases[F].indexOf(d)===-1&&(D.aliases[F].push(d),C[d]=!0)}}),D.aliases[F].concat(F).forEach(function(E){if(E.length>1&&/[A-Z]/.test(E)&&u["camel-case-expansion"]){let d=gs(E,"-");d!==F&&D.aliases[F].indexOf(d)===-1&&(D.aliases[F].push(d),C[d]=!0)}}),D.aliases[F].forEach(function(E){D.aliases[E]=[F].concat(D.aliases[F].filter(function(d){return E!==d}))}))})})}function P(c,g){let F=[].concat(D.aliases[c]||[],c),E=Object.keys(g),d=F.find(B=>E.includes(B));return d?g[d]:!1}function Ns(c){let g=Object.keys(D);return[].concat(g.map(E=>D[E])).some(function(E){return Array.isArray(E)?E.includes(c):E[c]})}function M(c,...g){return[].concat(...g).some(function(E){let d=c.match(E);return d&&Ns(d[1])})}function X(c){if(c.match(I)||!c.match(/^-[^-]+/))return!1;let g=!0,F,E=c.slice(1).split("");for(let d=0;d<E.length;d++){if(F=c.slice(d+2),!Ns(E[d])){g=!1;break}if(E[d+1]&&E[d+1]==="="||F==="-"||/[A-Za-z]/.test(E[d])&&/^-?\d+(\.\d*)?(e-?\d+)?$/.test(F)||E[d+1]&&E[d+1].match(/\W/))break}return g}function re(c){return u["unknown-options-as-args"]&&q(c)}function q(c){return c=c.replace(/^-{3,}/,"--"),c.match(I)||X(c)?!1:!M(c,/^-+([^=]+?)=[\s\S]*$/,A,/^-+([^=]+?)$/,/^-+([^=]+?)-$/,/^-+([^=]+?\d+)$/,/^-+([^=]+?)\W+.*$/)}function oe(c){return!P(c,D.bools)&&!P(c,D.counts)&&`${c}`in h?h[c]:le(We(c))}function le(c){return{[je.BOOLEAN]:!0,[je.STRING]:"",[je.NUMBER]:void 0,[je.ARRAY]:[]}[c]}function We(c){let g=je.BOOLEAN;return P(c,D.strings)?g=je.STRING:P(c,D.numbers)?g=je.NUMBER:P(c,D.bools)?g=je.BOOLEAN:P(c,D.arrays)&&(g=je.ARRAY),g}function qe(c){return c===void 0}function bn(){Object.keys(D.counts).find(c=>P(c,D.arrays)?(k=Error(y("Invalid configuration: %s, opts.count excludes opts.array.",c)),!0):P(c,D.nargs)?(k=Error(y("Invalid configuration: %s, opts.count excludes opts.narg.",c)),!0):!1)}return{aliases:Object.assign({},D.aliases),argv:Object.assign(Z,R),configuration:u,defaulted:Object.assign({},w),error:k,newAliases:Object.assign({},C)}}};function Mc(s){let e=[],t=Object.create(null),n=!0;for(Object.keys(s).forEach(function(r){e.push([].concat(s[r],r))});n;){n=!1;for(let r=0;r<e.length;r++)for(let o=r+1;o<e.length;o++)if(e[r].filter(function(u){return e[o].indexOf(u)!==-1}).length){e[r]=e[r].concat(e[o]),e.splice(o,1),n=!0;break}}return e.forEach(function(r){r=r.filter(function(i,u,h){return h.indexOf(i)===u});let o=r.pop();o!==void 0&&typeof o=="string"&&(t[o]=r)}),t}function _i(s){return s!==void 0?s+1:1}function vo(s){return s==="__proto__"?"___proto___":s}function Pc(s){return typeof s=="string"&&(s[0]==="'"||s[0]==='"')&&s[s.length-1]===s[0]?s.substring(1,s.length-1):s}import{readFileSync as Wc}from"fs";var Ii,Bi,Ni,xo=process&&process.env&&process.env.YARGS_MIN_NODE_VERSION?Number(process.env.YARGS_MIN_NODE_VERSION):12,Oo=(Bi=(Ii=process==null?void 0:process.versions)===null||Ii===void 0?void 0:Ii.node)!==null&&Bi!==void 0?Bi:(Ni=process==null?void 0:process.version)===null||Ni===void 0?void 0:Ni.slice(1);if(Oo&&Number(Oo.match(/^([^.]+)/)[1])<xo)throw Error(`yargs parser supports a minimum Node.js version of ${xo}. Read our version support policy: https://github.com/yargs/yargs-parser#supported-nodejs-versions`);var qc=process?process.env:{},$o=new Es({cwd:process.cwd,env:()=>qc,format:Jc,normalize:Rc,resolve:Lc,require:s=>{if(typeof Qe<"u")return Qe(s);if(s.match(/\.json$/))return JSON.parse(Wc(s,"utf8"));throw Error("only .json config files are supported in ESM")}}),gn=function(e,t){return $o.parse(e.slice(),t).argv};gn.detailed=function(s,e){return $o.parse(s.slice(),e)};gn.camelCase=$t;gn.decamelize=gs;gn.looksLikeNumber=Cs;var To=gn;import{basename as il,dirname as rl,extname as ol,relative as ul,resolve as So}from"path";function Gc(){return Uc()?0:1}function Uc(){return Vc()&&!process.defaultApp}function Vc(){return!!process.versions.electron}function _o(){return process.argv[Gc()]}var K=class s extends Error{constructor(e){super(e||"yargs error"),this.name="YError",Error.captureStackTrace&&Error.captureStackTrace(this,s)}};import{readFileSync as Hc,statSync as zc,writeFile as Yc}from"fs";import{format as Kc}from"util";import{resolve as Qc}from"path";var Io={fs:{readFileSync:Hc,writeFile:Yc},format:Kc,resolve:Qc,exists:s=>{try{return zc(s).isFile()}catch{return!1}}};var Ke,Si=class{constructor(e){e=e||{},this.directory=e.directory||"./locales",this.updateFiles=typeof e.updateFiles=="boolean"?e.updateFiles:!0,this.locale=e.locale||"en",this.fallbackToLanguage=typeof e.fallbackToLanguage=="boolean"?e.fallbackToLanguage:!0,this.cache=Object.create(null),this.writeQueue=[]}__(...e){if(typeof arguments[0]!="string")return this._taggedLiteral(arguments[0],...arguments);let t=e.shift(),n=function(){};return typeof e[e.length-1]=="function"&&(n=e.pop()),n=n||function(){},this.cache[this.locale]||this._readLocaleFile(),!this.cache[this.locale][t]&&this.updateFiles?(this.cache[this.locale][t]=t,this._enqueueWrite({directory:this.directory,locale:this.locale,cb:n})):n(),Ke.format.apply(Ke.format,[this.cache[this.locale][t]||t].concat(e))}__n(){let e=Array.prototype.slice.call(arguments),t=e.shift(),n=e.shift(),r=e.shift(),o=function(){};typeof e[e.length-1]=="function"&&(o=e.pop()),this.cache[this.locale]||this._readLocaleFile();let i=r===1?t:n;this.cache[this.locale][t]&&(i=this.cache[this.locale][t][r===1?"one":"other"]),!this.cache[this.locale][t]&&this.updateFiles?(this.cache[this.locale][t]={one:t,other:n},this._enqueueWrite({directory:this.directory,locale:this.locale,cb:o})):o();let u=[i];return~i.indexOf("%d")&&u.push(r),Ke.format.apply(Ke.format,u.concat(e))}setLocale(e){this.locale=e}getLocale(){return this.locale}updateLocale(e){this.cache[this.locale]||this._readLocaleFile();for(let t in e)Object.prototype.hasOwnProperty.call(e,t)&&(this.cache[this.locale][t]=e[t])}_taggedLiteral(e,...t){let n="";return e.forEach(function(r,o){let i=t[o+1];n+=r,typeof i<"u"&&(n+="%s")}),this.__.apply(this,[n].concat([].slice.call(t,1)))}_enqueueWrite(e){this.writeQueue.push(e),this.writeQueue.length===1&&this._processWriteQueue()}_processWriteQueue(){let e=this,t=this.writeQueue[0],n=t.directory,r=t.locale,o=t.cb,i=this._resolveLocaleFile(n,r),u=JSON.stringify(this.cache[r],null,2);Ke.fs.writeFile(i,u,"utf-8",function(h){e.writeQueue.shift(),e.writeQueue.length>0&&e._processWriteQueue(),o(h)})}_readLocaleFile(){let e={},t=this._resolveLocaleFile(this.directory,this.locale);try{Ke.fs.readFileSync&&(e=JSON.parse(Ke.fs.readFileSync(t,"utf-8")))}catch(n){if(n instanceof SyntaxError&&(n.message="syntax error in "+t),n.code==="ENOENT")e={};else throw n}this.cache[this.locale]=e}_resolveLocaleFile(e,t){let n=Ke.resolve(e,"./",t+".json");if(this.fallbackToLanguage&&!this._fileExistsSync(n)&&~t.lastIndexOf("_")){let r=Ke.resolve(e,"./",t.split("_")[0]+".json");this._fileExistsSync(r)&&(n=r)}return n}_fileExistsSync(e){return Ke.exists(e)}};function Bo(s,e){Ke=e;let t=new Si(s);return{__:t.__.bind(t),__n:t.__n.bind(t),setLocale:t.setLocale.bind(t),getLocale:t.getLocale.bind(t),updateLocale:t.updateLocale.bind(t),locale:t.locale}}var Zc=s=>Bo(s,Io),No=Zc;var al="require is not supported by ESM",ko="loading a directory of commands is not supported yet for ESM",Cn;try{Cn=sl(import.meta.url)}catch{Cn=process.cwd()}var cl=Cn.substring(0,Cn.lastIndexOf("node_modules")),jo={assert:{notStrictEqual:Xc,strictEqual:el},cliui:Ti,findUp:wo,getEnv:s=>process.env[s],inspect:tl,getCallerFile:()=>{throw new K(ko)},getProcessArgvBin:_o,mainFilename:cl||process.cwd(),Parser:To,path:{basename:il,dirname:rl,extname:ol,relative:ul,resolve:So},process:{argv:()=>process.argv,cwd:process.cwd,emitWarning:(s,e)=>process.emitWarning(s,e),execPath:()=>process.execPath,exit:process.exit,nextTick:process.nextTick,stdColumns:typeof process.stdout.columns<"u"?process.stdout.columns:null},readFileSync:nl,require:()=>{throw new K(al)},requireDirectory:()=>{throw new K(ko)},stringWidth:s=>[...s].length,y18n:No({directory:So(Cn,"../../../locales"),updateFiles:!1})};function xe(s,e,t,n){t.assert.notStrictEqual(s,e,n)}function ki(s,e){e.assert.strictEqual(typeof s,"string")}function nn(s){return Object.keys(s)}function Q(s){return!!s&&!!s.then&&typeof s.then=="function"}function pt(s){let t=s.replace(/\s{2,}/g," ").split(/\s+(?![^[]*]|[^<]*>)/),n=/\.*[\][<>]/g,r=t.shift();if(!r)throw new Error(`No command found in: ${s}`);let o={cmd:r.replace(n,""),demanded:[],optional:[]};return t.forEach((i,u)=>{let h=!1;i=i.replace(/\s/g,""),/\.+[\]>]/.test(i)&&u===t.length-1&&(h=!0),/^\[/.test(i)?o.optional.push({cmd:i.replace(n,"").split("|"),variadic:h}):o.demanded.push({cmd:i.replace(n,"").split("|"),variadic:h})}),o}var ll=["first","second","third","fourth","fifth","sixth"];function $(s,e,t){function n(){return typeof s=="object"?[{demanded:[],optional:[]},s,e]:[pt(`cmd ${s}`),e,t]}try{let r=0,[o,i,u]=n(),h=[].slice.call(i);for(;h.length&&h[h.length-1]===void 0;)h.pop();let f=u||h.length;if(f<o.demanded.length)throw new K(`Not enough arguments provided. Expected ${o.demanded.length} but received ${h.length}.`);let p=o.demanded.length+o.optional.length;if(f>p)throw new K(`Too many arguments provided. Expected max ${p} but received ${f}.`);o.demanded.forEach(l=>{let m=h.shift(),C=Mo(m);l.cmd.filter(y=>y===C||y==="*").length===0&&Po(C,l.cmd,r),r+=1}),o.optional.forEach(l=>{if(h.length===0)return;let m=h.shift(),C=Mo(m);l.cmd.filter(y=>y===C||y==="*").length===0&&Po(C,l.cmd,r),r+=1})}catch(r){console.warn(r.stack)}}function Mo(s){return Array.isArray(s)?"array":s===null?"null":typeof s}function Po(s,e,t){throw new K(`Invalid ${ll[t]||"manyith"} argument. Expected ${e.join(" or ")} but received ${s}.`)}var ys=class{constructor(e){this.globalMiddleware=[],this.frozens=[],this.yargs=e}addMiddleware(e,t,n=!0,r=!1){if($("<array|function> [boolean] [boolean] [boolean]",[e,t,n],arguments.length),Array.isArray(e)){for(let o=0;o<e.length;o++){if(typeof e[o]!="function")throw Error("middleware must be a function");let i=e[o];i.applyBeforeValidation=t,i.global=n}Array.prototype.push.apply(this.globalMiddleware,e)}else if(typeof e=="function"){let o=e;o.applyBeforeValidation=t,o.global=n,o.mutates=r,this.globalMiddleware.push(e)}return this.yargs}addCoerceMiddleware(e,t){let n=this.yargs.getAliases();return this.globalMiddleware=this.globalMiddleware.filter(r=>{let o=[...n[t]||[],t];return r.option?!o.includes(r.option):!0}),e.option=t,this.addMiddleware(e,!0,!0,!0)}getMiddleware(){return this.globalMiddleware}freeze(){this.frozens.push([...this.globalMiddleware])}unfreeze(){let e=this.frozens.pop();e!==void 0&&(this.globalMiddleware=e)}reset(){this.globalMiddleware=this.globalMiddleware.filter(e=>e.global)}};function Jo(s){return s?s.map(e=>(e.applyBeforeValidation=!1,e)):[]}function Tt(s,e,t,n){return t.reduce((r,o)=>{if(o.applyBeforeValidation!==n)return r;if(o.mutates){if(o.applied)return r;o.applied=!0}if(Q(r))return r.then(i=>Promise.all([i,o(i,e)])).then(([i,u])=>Object.assign(i,u));{let i=o(r,e);return Q(i)?i.then(u=>Object.assign(r,u)):Object.assign(r,i)}},s)}function _t(s,e,t=n=>{throw n}){try{let n=hl(s)?s():s;return Q(n)?n.then(r=>e(r)):e(n)}catch(n){return t(n)}}function hl(s){return typeof s=="function"}function ji(s){if(typeof Qe>"u")return null;for(let e=0,t=Object.keys(Qe.cache),n;e<t.length;e++)if(n=Qe.cache[t[e]],n.exports===s)return n;return null}var sn=/(^\*)|(^\$0)/,Mi=class{constructor(e,t,n,r){this.requireCache=new Set,this.handlers={},this.aliasMap={},this.frozens=[],this.shim=r,this.usage=e,this.globalMiddleware=n,this.validation=t}addDirectory(e,t,n,r){r=r||{},typeof r.recurse!="boolean"&&(r.recurse=!1),Array.isArray(r.extensions)||(r.extensions=["js"]);let o=typeof r.visit=="function"?r.visit:i=>i;r.visit=(i,u,h)=>{let f=o(i,u,h);if(f){if(this.requireCache.has(u))return f;this.requireCache.add(u),this.addHandler(f)}return f},this.shim.requireDirectory({require:t,filename:n},e,r)}addHandler(e,t,n,r,o,i){let u=[],h=Jo(o);if(r=r||(()=>{}),Array.isArray(e))if(fl(e))[e,...u]=e;else for(let f of e)this.addHandler(f);else if(pl(e)){let f=Array.isArray(e.command)||typeof e.command=="string"?e.command:this.moduleName(e);e.aliases&&(f=[].concat(f).concat(e.aliases)),this.addHandler(f,this.extractDesc(e),e.builder,e.handler,e.middlewares,e.deprecated);return}else if(Ro(n)){this.addHandler([e].concat(u),t,n.builder,n.handler,n.middlewares,n.deprecated);return}if(typeof e=="string"){let f=pt(e);u=u.map(m=>pt(m).cmd);let p=!1,l=[f.cmd].concat(u).filter(m=>sn.test(m)?(p=!0,!1):!0);l.length===0&&p&&l.push("$0"),p&&(f.cmd=l[0],u=l.slice(1),e=e.replace(sn,f.cmd)),u.forEach(m=>{this.aliasMap[m]=f.cmd}),t!==!1&&this.usage.command(e,t,p,u,i),this.handlers[f.cmd]={original:e,description:t,handler:r,builder:n||{},middlewares:h,deprecated:i,demanded:f.demanded,optional:f.optional},p&&(this.defaultCommand=this.handlers[f.cmd])}}getCommandHandlers(){return this.handlers}getCommands(){return Object.keys(this.handlers).concat(Object.keys(this.aliasMap))}hasDefaultCommand(){return!!this.defaultCommand}runCommand(e,t,n,r,o,i){let u=this.handlers[e]||this.handlers[this.aliasMap[e]]||this.defaultCommand,h=t.getInternalMethods().getContext(),f=h.commands.slice(),p=!e;e&&(h.commands.push(e),h.fullCommands.push(u.original));let l=this.applyBuilderUpdateUsageAndParse(p,u,t,n.aliases,f,r,o,i);return Q(l)?l.then(m=>this.applyMiddlewareAndGetResult(p,u,m.innerArgv,h,o,m.aliases,t)):this.applyMiddlewareAndGetResult(p,u,l.innerArgv,h,o,l.aliases,t)}applyBuilderUpdateUsageAndParse(e,t,n,r,o,i,u,h){let f=t.builder,p=n;if(Fs(f)){n.getInternalMethods().getUsageInstance().freeze();let l=f(n.getInternalMethods().reset(r),h);if(Q(l))return l.then(m=>(p=Wo(m)?m:n,this.parseAndUpdateUsage(e,t,p,o,i,u)))}else Dl(f)&&(n.getInternalMethods().getUsageInstance().freeze(),p=n.getInternalMethods().reset(r),Object.keys(t.builder).forEach(l=>{p.option(l,f[l])}));return this.parseAndUpdateUsage(e,t,p,o,i,u)}parseAndUpdateUsage(e,t,n,r,o,i){e&&n.getInternalMethods().getUsageInstance().unfreeze(!0),this.shouldUpdateUsage(n)&&n.getInternalMethods().getUsageInstance().usage(this.usageFromParentCommandsCommandHandler(r,t),t.description);let u=n.getInternalMethods().runYargsParserAndExecuteCommands(null,void 0,!0,o,i);return Q(u)?u.then(h=>({aliases:n.parsed.aliases,innerArgv:h})):{aliases:n.parsed.aliases,innerArgv:u}}shouldUpdateUsage(e){return!e.getInternalMethods().getUsageInstance().getUsageDisabled()&&e.getInternalMethods().getUsageInstance().getUsage().length===0}usageFromParentCommandsCommandHandler(e,t){let n=sn.test(t.original)?t.original.replace(sn,"").trim():t.original,r=e.filter(o=>!sn.test(o));return r.push(n),`$0 ${r.join(" ")}`}handleValidationAndGetResult(e,t,n,r,o,i,u,h){if(!i.getInternalMethods().getHasOutput()){let f=i.getInternalMethods().runValidation(o,h,i.parsed.error,e);n=_t(n,p=>(f(p),p))}if(t.handler&&!i.getInternalMethods().getHasOutput()){i.getInternalMethods().setHasOutput();let f=!!i.getOptions().configuration["populate--"];i.getInternalMethods().postProcess(n,f,!1,!1),n=Tt(n,i,u,!1),n=_t(n,p=>{let l=t.handler(p);return Q(l)?l.then(()=>p):p}),e||i.getInternalMethods().getUsageInstance().cacheHelpMessage(),Q(n)&&!i.getInternalMethods().hasParseCallback()&&n.catch(p=>{try{i.getInternalMethods().getUsageInstance().fail(null,p)}catch{}})}return e||(r.commands.pop(),r.fullCommands.pop()),n}applyMiddlewareAndGetResult(e,t,n,r,o,i,u){let h={};if(o)return n;u.getInternalMethods().getHasOutput()||(h=this.populatePositionals(t,n,r,u));let f=this.globalMiddleware.getMiddleware().slice(0).concat(t.middlewares),p=Tt(n,u,f,!0);return Q(p)?p.then(l=>this.handleValidationAndGetResult(e,t,l,r,i,u,f,h)):this.handleValidationAndGetResult(e,t,p,r,i,u,f,h)}populatePositionals(e,t,n,r){t._=t._.slice(n.commands.length);let o=e.demanded.slice(0),i=e.optional.slice(0),u={};for(this.validation.positionalCount(o.length,t._.length);o.length;){let h=o.shift();this.populatePositional(h,t,u)}for(;i.length;){let h=i.shift();this.populatePositional(h,t,u)}return t._=n.commands.concat(t._.map(h=>""+h)),this.postProcessPositionals(t,u,this.cmdToParseOptions(e.original),r),u}populatePositional(e,t,n){let r=e.cmd[0];e.variadic?n[r]=t._.splice(0).map(String):t._.length&&(n[r]=[String(t._.shift())])}cmdToParseOptions(e){let t={array:[],default:{},alias:{},demand:{}},n=pt(e);return n.demanded.forEach(r=>{let[o,...i]=r.cmd;r.variadic&&(t.array.push(o),t.default[o]=[]),t.alias[o]=i,t.demand[o]=!0}),n.optional.forEach(r=>{let[o,...i]=r.cmd;r.variadic&&(t.array.push(o),t.default[o]=[]),t.alias[o]=i}),t}postProcessPositionals(e,t,n,r){let o=Object.assign({},r.getOptions());o.default=Object.assign(n.default,o.default);for(let f of Object.keys(n.alias))o.alias[f]=(o.alias[f]||[]).concat(n.alias[f]);o.array=o.array.concat(n.array),o.config={};let i=[];if(Object.keys(t).forEach(f=>{t[f].map(p=>{o.configuration["unknown-options-as-args"]&&(o.key[f]=!0),i.push(`--${f}`),i.push(p)})}),!i.length)return;let u=Object.assign({},o.configuration,{"populate--":!1}),h=this.shim.Parser.detailed(i,Object.assign({},o,{configuration:u}));if(h.error)r.getInternalMethods().getUsageInstance().fail(h.error.message,h.error);else{let f=Object.keys(t);Object.keys(t).forEach(p=>{f.push(...h.aliases[p])}),Object.keys(h.argv).forEach(p=>{f.includes(p)&&(t[p]||(t[p]=h.argv[p]),!this.isInConfigs(r,p)&&!this.isDefaulted(r,p)&&Object.prototype.hasOwnProperty.call(e,p)&&Object.prototype.hasOwnProperty.call(h.argv,p)&&(Array.isArray(e[p])||Array.isArray(h.argv[p]))?e[p]=[].concat(e[p],h.argv[p]):e[p]=h.argv[p])})}}isDefaulted(e,t){let{default:n}=e.getOptions();return Object.prototype.hasOwnProperty.call(n,t)||Object.prototype.hasOwnProperty.call(n,this.shim.Parser.camelCase(t))}isInConfigs(e,t){let{configObjects:n}=e.getOptions();return n.some(r=>Object.prototype.hasOwnProperty.call(r,t))||n.some(r=>Object.prototype.hasOwnProperty.call(r,this.shim.Parser.camelCase(t)))}runDefaultBuilderOn(e){if(!this.defaultCommand)return;if(this.shouldUpdateUsage(e)){let n=sn.test(this.defaultCommand.original)?this.defaultCommand.original:this.defaultCommand.original.replace(/^[^[\]<>]*/,"$0 ");e.getInternalMethods().getUsageInstance().usage(n,this.defaultCommand.description)}let t=this.defaultCommand.builder;if(Fs(t))return t(e,!0);Ro(t)||Object.keys(t).forEach(n=>{e.option(n,t[n])})}moduleName(e){let t=ji(e);if(!t)throw new Error(`No command name given for module: ${this.shim.inspect(e)}`);return this.commandFromFilename(t.filename)}commandFromFilename(e){return this.shim.path.basename(e,this.shim.path.extname(e))}extractDesc({describe:e,description:t,desc:n}){for(let r of[e,t,n]){if(typeof r=="string"||r===!1)return r;xe(r,!0,this.shim)}return!1}freeze(){this.frozens.push({handlers:this.handlers,aliasMap:this.aliasMap,defaultCommand:this.defaultCommand})}unfreeze(){let e=this.frozens.pop();xe(e,void 0,this.shim),{handlers:this.handlers,aliasMap:this.aliasMap,defaultCommand:this.defaultCommand}=e}reset(){return this.handlers={},this.aliasMap={},this.defaultCommand=void 0,this.requireCache=new Set,this}};function Lo(s,e,t,n){return new Mi(s,e,t,n)}function Ro(s){return typeof s=="object"&&!!s.builder&&typeof s.handler=="function"}function fl(s){return s.every(e=>typeof e=="string")}function Fs(s){return typeof s=="function"}function Dl(s){return typeof s=="object"}function pl(s){return typeof s=="object"&&!Array.isArray(s)}function dt(s={},e=()=>!0){let t={};return nn(s).forEach(n=>{e(n,s[n])&&(t[n]=s[n])}),t}function mt(s){typeof process>"u"||[process.stdout,process.stderr].forEach(e=>{let t=e;t._handle&&t.isTTY&&typeof t._handle.setBlocking=="function"&&t._handle.setBlocking(s)})}function dl(s){return typeof s=="boolean"}function Go(s,e){let t=e.y18n.__,n={},r=[];n.failFn=function(x){r.push(x)};let o=null,i=null,u=!0;n.showHelpOnFail=function(x=!0,_){let[W,U]=typeof x=="string"?[!0,x]:[x,_];return s.getInternalMethods().isGlobalContext()&&(i=U),o=U,u=W,n};let h=!1;n.fail=function(x,_){let W=s.getInternalMethods().getLoggerInstance();if(r.length)for(let U=r.length-1;U>=0;--U){let De=r[U];if(dl(De)){if(_)throw _;if(x)throw Error(x)}else De(x,_,n)}else{if(s.getExitProcess()&&mt(!0),!h){h=!0,u&&(s.showHelp("error"),W.error()),(x||_)&&W.error(x||_);let U=o||i;U&&((x||_)&&W.error(""),W.error(U))}if(_=_||new K(x),s.getExitProcess())return s.exit(1);if(s.getInternalMethods().hasParseCallback())return s.exit(1,_);throw _}};let f=[],p=!1;n.usage=(N,x)=>N===null?(p=!0,f=[],n):(p=!1,f.push([N,x||""]),n),n.getUsage=()=>f,n.getUsageDisabled=()=>p,n.getPositionalGroupName=()=>t("Positionals:");let l=[];n.example=(N,x)=>{l.push([N,x||""])};let m=[];n.command=function(x,_,W,U,De=!1){W&&(m=m.map(G=>(G[2]=!1,G))),m.push([x,_||"",W,U,De])},n.getCommands=()=>m;let C={};n.describe=function(x,_){Array.isArray(x)?x.forEach(W=>{n.describe(W,_)}):typeof x=="object"?Object.keys(x).forEach(W=>{n.describe(W,x[W])}):C[x]=_},n.getDescriptions=()=>C;let w=[];n.epilog=N=>{w.push(N)};let y=!1,D;n.wrap=N=>{y=!0,D=N},n.getWrap=()=>e.getEnv("YARGS_DISABLE_WRAP")?null:(y||(D=ye(),y=!0),D);let I="__yargsString__:";n.deferY18nLookup=N=>I+N,n.help=function(){if(b)return b;k();let x=s.customScriptName?s.$0:e.path.basename(s.$0),_=s.getDemandedOptions(),W=s.getDemandedCommands(),U=s.getDeprecatedOptions(),De=s.getGroups(),G=s.getOptions(),pe=[];pe=pe.concat(Object.keys(C)),pe=pe.concat(Object.keys(_)),pe=pe.concat(Object.keys(W)),pe=pe.concat(Object.keys(G.default)),pe=pe.filter(Z),pe=Object.keys(pe.reduce((M,X)=>(X!=="_"&&(M[X]=!0),M),{}));let yt=n.getWrap(),ne=e.cliui({width:yt,wrap:!!yt});if(!p){if(f.length)f.forEach(M=>{ne.div({text:`${M[0].replace(/\$0/g,x)}`}),M[1]&&ne.div({text:`${M[1]}`,padding:[1,0,0,0]})}),ne.div();else if(m.length){let M=null;W._?M=`${x} <${t("command")}>
113
+ `:M=`${x} [${t("command")}]
114
+ `,ne.div(`${M}`)}}if(m.length>1||m.length===1&&!m[0][2]){ne.div(t("Commands:"));let M=s.getInternalMethods().getContext(),X=M.commands.length?`${M.commands.join(" ")} `:"";s.getInternalMethods().getParserConfiguration()["sort-commands"]===!0&&(m=m.sort((q,oe)=>q[0].localeCompare(oe[0])));let re=x?`${x} `:"";m.forEach(q=>{let oe=`${re}${X}${q[0].replace(/^\$0 ?/,"")}`;ne.span({text:oe,padding:[0,2,0,2],width:A(m,yt,`${x}${X}`)+4},{text:q[1]});let le=[];q[2]&&le.push(`[${t("default")}]`),q[3]&&q[3].length&&le.push(`[${t("aliases:")} ${q[3].join(", ")}]`),q[4]&&(typeof q[4]=="string"?le.push(`[${t("deprecated: %s",q[4])}]`):le.push(`[${t("deprecated")}]`)),le.length?ne.div({text:le.join(" "),padding:[0,0,0,2],align:"right"}):ne.div()}),ne.div()}let tt=(Object.keys(G.alias)||[]).concat(Object.keys(s.parsed.newAliases)||[]);pe=pe.filter(M=>!s.parsed.newAliases[M]&&tt.every(X=>(G.alias[X]||[]).indexOf(M)===-1));let nt=t("Options:");De[nt]||(De[nt]=[]),R(pe,G.alias,De,nt);let Ft=M=>/^--/.test(bs(M)),P=Object.keys(De).filter(M=>De[M].length>0).map(M=>{let X=De[M].filter(Z).map(re=>{if(tt.includes(re))return re;for(let q=0,oe;(oe=tt[q])!==void 0;q++)if((G.alias[oe]||[]).includes(re))return oe;return re});return{groupName:M,normalizedKeys:X}}).filter(({normalizedKeys:M})=>M.length>0).map(({groupName:M,normalizedKeys:X})=>{let re=X.reduce((q,oe)=>(q[oe]=[oe].concat(G.alias[oe]||[]).map(le=>M===n.getPositionalGroupName()?le:(/^[0-9]$/.test(le)?G.boolean.includes(oe)?"-":"--":le.length>1?"--":"-")+le).sort((le,We)=>Ft(le)===Ft(We)?0:Ft(le)?1:-1).join(", "),q),{});return{groupName:M,normalizedKeys:X,switches:re}});if(P.filter(({groupName:M})=>M!==n.getPositionalGroupName()).some(({normalizedKeys:M,switches:X})=>!M.every(re=>Ft(X[re])))&&P.filter(({groupName:M})=>M!==n.getPositionalGroupName()).forEach(({normalizedKeys:M,switches:X})=>{M.forEach(re=>{Ft(X[re])&&(X[re]=ml(X[re],4))})}),P.forEach(({groupName:M,normalizedKeys:X,switches:re})=>{ne.div(M),X.forEach(q=>{let oe=re[q],le=C[q]||"",We=null;le.includes(I)&&(le=t(le.substring(I.length))),G.boolean.includes(q)&&(We=`[${t("boolean")}]`),G.count.includes(q)&&(We=`[${t("count")}]`),G.string.includes(q)&&(We=`[${t("string")}]`),G.normalize.includes(q)&&(We=`[${t("string")}]`),G.array.includes(q)&&(We=`[${t("array")}]`),G.number.includes(q)&&(We=`[${t("number")}]`);let qe=g=>typeof g=="string"?`[${t("deprecated: %s",g)}]`:`[${t("deprecated")}]`,bn=[q in U?qe(U[q]):null,We,q in _?`[${t("required")}]`:null,G.choices&&G.choices[q]?`[${t("choices:")} ${n.stringifiedValues(G.choices[q])}]`:null,H(G.default[q],G.defaultDescription[q])].filter(Boolean).join(" ");ne.span({text:bs(oe),padding:[0,2,0,2+qo(oe)],width:A(re,yt)+4},le);let c=s.getInternalMethods().getUsageConfiguration()["hide-types"]===!0;bn&&!c?ne.div({text:bn,padding:[0,0,0,2],align:"right"}):ne.div()}),ne.div()}),l.length&&(ne.div(t("Examples:")),l.forEach(M=>{M[0]=M[0].replace(/\$0/g,x)}),l.forEach(M=>{M[1]===""?ne.div({text:M[0],padding:[0,2,0,2]}):ne.div({text:M[0],padding:[0,2,0,2],width:A(l,yt)+4},{text:M[1]})}),ne.div()),w.length>0){let M=w.map(X=>X.replace(/\$0/g,x)).join(`
115
+ `);ne.div(`${M}
116
+ `)}return ne.toString().replace(/\s*$/,"")};function A(N,x,_){let W=0;return Array.isArray(N)||(N=Object.values(N).map(U=>[U])),N.forEach(U=>{W=Math.max(e.stringWidth(_?`${_} ${bs(U[0])}`:bs(U[0]))+qo(U[0]),W)}),x&&(W=Math.min(W,parseInt((x*.5).toString(),10))),W}function k(){let N=s.getDemandedOptions(),x=s.getOptions();(Object.keys(x.alias)||[]).forEach(_=>{x.alias[_].forEach(W=>{C[W]&&n.describe(_,C[W]),W in N&&s.demandOption(_,N[W]),x.boolean.includes(W)&&s.boolean(_),x.count.includes(W)&&s.count(_),x.string.includes(W)&&s.string(_),x.normalize.includes(W)&&s.normalize(_),x.array.includes(W)&&s.array(_),x.number.includes(W)&&s.number(_)})})}let b;n.cacheHelpMessage=function(){b=this.help()},n.clearCachedHelpMessage=function(){b=void 0},n.hasCachedHelpMessage=function(){return!!b};function R(N,x,_,W){let U=[],De=null;return Object.keys(_).forEach(G=>{U=U.concat(_[G])}),N.forEach(G=>{De=[G].concat(x[G]),De.some(pe=>U.indexOf(pe)!==-1)||_[W].push(G)}),U}function Z(N){return s.getOptions().hiddenOptions.indexOf(N)<0||s.parsed.argv[s.getOptions().showHiddenOpt]}n.showHelp=N=>{let x=s.getInternalMethods().getLoggerInstance();N||(N="error"),(typeof N=="function"?N:x[N])(n.help())},n.functionDescription=N=>["(",N.name?e.Parser.decamelize(N.name,"-"):t("generated-value"),")"].join(""),n.stringifiedValues=function(x,_){let W="",U=_||", ",De=[].concat(x);return!x||!De.length||De.forEach(G=>{W.length&&(W+=U),W+=JSON.stringify(G)}),W};function H(N,x){let _=`[${t("default:")} `;if(N===void 0&&!x)return null;if(x)_+=x;else switch(typeof N){case"string":_+=`"${N}"`;break;case"object":_+=JSON.stringify(N);break;default:_+=N}return`${_}]`}function ye(){return e.process.stdColumns?Math.min(80,e.process.stdColumns):80}let Le=null;n.version=N=>{Le=N},n.showVersion=N=>{let x=s.getInternalMethods().getLoggerInstance();N||(N="error"),(typeof N=="function"?N:x[N])(Le)},n.reset=function(x){return o=null,h=!1,f=[],p=!1,w=[],l=[],m=[],C=dt(C,_=>!x[_]),n};let V=[];return n.freeze=function(){V.push({failMessage:o,failureOutput:h,usages:f,usageDisabled:p,epilogs:w,examples:l,commands:m,descriptions:C})},n.unfreeze=function(x=!1){let _=V.pop();_&&(x?(C={..._.descriptions,...C},m=[..._.commands,...m],f=[..._.usages,...f],l=[..._.examples,...l],w=[..._.epilogs,...w]):{failMessage:o,failureOutput:h,usages:f,usageDisabled:p,epilogs:w,examples:l,commands:m,descriptions:C}=_)},n}function Pi(s){return typeof s=="object"}function ml(s,e){return Pi(s)?{text:s.text,indentation:s.indentation+e}:{text:s,indentation:e}}function qo(s){return Pi(s)?s.indentation:0}function bs(s){return Pi(s)?s.text:s}var Uo=`###-begin-{{app_name}}-completions-###
117
+ #
118
+ # yargs command completion script
119
+ #
120
+ # Installation: {{app_path}} {{completion_command}} >> ~/.bashrc
121
+ # or {{app_path}} {{completion_command}} >> ~/.bash_profile on OSX.
122
+ #
123
+ _{{app_name}}_yargs_completions()
124
+ {
125
+ local cur_word args type_list
126
+
127
+ cur_word="\${COMP_WORDS[COMP_CWORD]}"
128
+ args=("\${COMP_WORDS[@]}")
129
+
130
+ # ask yargs to generate completions.
131
+ type_list=$({{app_path}} --get-yargs-completions "\${args[@]}")
132
+
133
+ COMPREPLY=( $(compgen -W "\${type_list}" -- \${cur_word}) )
134
+
135
+ # if no match was found, fall back to filename completion
136
+ if [ \${#COMPREPLY[@]} -eq 0 ]; then
137
+ COMPREPLY=()
138
+ fi
139
+
140
+ return 0
141
+ }
142
+ complete -o bashdefault -o default -F _{{app_name}}_yargs_completions {{app_name}}
143
+ ###-end-{{app_name}}-completions-###
144
+ `,Vo=`#compdef {{app_name}}
145
+ ###-begin-{{app_name}}-completions-###
146
+ #
147
+ # yargs command completion script
148
+ #
149
+ # Installation: {{app_path}} {{completion_command}} >> ~/.zshrc
150
+ # or {{app_path}} {{completion_command}} >> ~/.zprofile on OSX.
151
+ #
152
+ _{{app_name}}_yargs_completions()
153
+ {
154
+ local reply
155
+ local si=$IFS
156
+ IFS=$'
157
+ ' reply=($(COMP_CWORD="$((CURRENT-1))" COMP_LINE="$BUFFER" COMP_POINT="$CURSOR" {{app_path}} --get-yargs-completions "\${words[@]}"))
158
+ IFS=$si
159
+ _describe 'values' reply
160
+ }
161
+ compdef _{{app_name}}_yargs_completions {{app_name}}
162
+ ###-end-{{app_name}}-completions-###
163
+ `;var Ji=class{constructor(e,t,n,r){var o,i,u;this.yargs=e,this.usage=t,this.command=n,this.shim=r,this.completionKey="get-yargs-completions",this.aliases=null,this.customCompletionFunction=null,this.indexAfterLastReset=0,this.zshShell=(u=((o=this.shim.getEnv("SHELL"))===null||o===void 0?void 0:o.includes("zsh"))||((i=this.shim.getEnv("ZSH_NAME"))===null||i===void 0?void 0:i.includes("zsh")))!==null&&u!==void 0?u:!1}defaultCompletion(e,t,n,r){let o=this.command.getCommandHandlers();for(let u=0,h=e.length;u<h;++u)if(o[e[u]]&&o[e[u]].builder){let f=o[e[u]].builder;if(Fs(f)){this.indexAfterLastReset=u+1;let p=this.yargs.getInternalMethods().reset();return f(p,!0),p.argv}}let i=[];this.commandCompletions(i,e,n),this.optionCompletions(i,e,t,n),this.choicesFromOptionsCompletions(i,e,t,n),this.choicesFromPositionalsCompletions(i,e,t,n),r(null,i)}commandCompletions(e,t,n){let r=this.yargs.getInternalMethods().getContext().commands;!n.match(/^-/)&&r[r.length-1]!==n&&!this.previousArgHasChoices(t)&&this.usage.getCommands().forEach(o=>{let i=pt(o[0]).cmd;if(t.indexOf(i)===-1)if(!this.zshShell)e.push(i);else{let u=o[1]||"";e.push(i.replace(/:/g,"\\:")+":"+u)}})}optionCompletions(e,t,n,r){if((r.match(/^-/)||r===""&&e.length===0)&&!this.previousArgHasChoices(t)){let o=this.yargs.getOptions(),i=this.yargs.getGroups()[this.usage.getPositionalGroupName()]||[];Object.keys(o.key).forEach(u=>{let h=!!o.configuration["boolean-negation"]&&o.boolean.includes(u);!i.includes(u)&&!o.hiddenOptions.includes(u)&&!this.argsContainKey(t,u,h)&&this.completeOptionKey(u,e,r,h&&!!o.default[u])})}}choicesFromOptionsCompletions(e,t,n,r){if(this.previousArgHasChoices(t)){let o=this.getPreviousArgChoices(t);o&&o.length>0&&e.push(...o.map(i=>i.replace(/:/g,"\\:")))}}choicesFromPositionalsCompletions(e,t,n,r){if(r===""&&e.length>0&&this.previousArgHasChoices(t))return;let o=this.yargs.getGroups()[this.usage.getPositionalGroupName()]||[],i=Math.max(this.indexAfterLastReset,this.yargs.getInternalMethods().getContext().commands.length+1),u=o[n._.length-i-1];if(!u)return;let h=this.yargs.getOptions().choices[u]||[];for(let f of h)f.startsWith(r)&&e.push(f.replace(/:/g,"\\:"))}getPreviousArgChoices(e){if(e.length<1)return;let t=e[e.length-1],n="";if(!t.startsWith("-")&&e.length>1&&(n=t,t=e[e.length-2]),!t.startsWith("-"))return;let r=t.replace(/^-+/,""),o=this.yargs.getOptions(),i=[r,...this.yargs.getAliases()[r]||[]],u;for(let h of i)if(Object.prototype.hasOwnProperty.call(o.key,h)&&Array.isArray(o.choices[h])){u=o.choices[h];break}if(u)return u.filter(h=>!n||h.startsWith(n))}previousArgHasChoices(e){let t=this.getPreviousArgChoices(e);return t!==void 0&&t.length>0}argsContainKey(e,t,n){let r=o=>e.indexOf((/^[^0-9]$/.test(o)?"-":"--")+o)!==-1;if(r(t)||n&&r(`no-${t}`))return!0;if(this.aliases){for(let o of this.aliases[t])if(r(o))return!0}return!1}completeOptionKey(e,t,n,r){var o,i,u,h;let f=e;if(this.zshShell){let C=this.usage.getDescriptions(),w=(i=(o=this===null||this===void 0?void 0:this.aliases)===null||o===void 0?void 0:o[e])===null||i===void 0?void 0:i.find(I=>{let A=C[I];return typeof A=="string"&&A.length>0}),y=w?C[w]:void 0,D=(h=(u=C[e])!==null&&u!==void 0?u:y)!==null&&h!==void 0?h:"";f=`${e.replace(/:/g,"\\:")}:${D.replace("__yargsString__:","").replace(/(\r\n|\n|\r)/gm," ")}`}let p=C=>/^--/.test(C),l=C=>/^[^0-9]$/.test(C),m=!p(n)&&l(e)?"-":"--";t.push(m+f),r&&t.push(m+"no-"+f)}customCompletion(e,t,n,r){if(xe(this.customCompletionFunction,null,this.shim),Cl(this.customCompletionFunction)){let o=this.customCompletionFunction(n,t);return Q(o)?o.then(i=>{this.shim.process.nextTick(()=>{r(null,i)})}).catch(i=>{this.shim.process.nextTick(()=>{r(i,void 0)})}):r(null,o)}else return El(this.customCompletionFunction)?this.customCompletionFunction(n,t,(o=r)=>this.defaultCompletion(e,t,n,o),o=>{r(null,o)}):this.customCompletionFunction(n,t,o=>{r(null,o)})}getCompletion(e,t){let n=e.length?e[e.length-1]:"",r=this.yargs.parse(e,!0),o=this.customCompletionFunction?i=>this.customCompletion(e,i,n,t):i=>this.defaultCompletion(e,i,n,t);return Q(r)?r.then(o):o(r)}generateCompletionScript(e,t){let n=this.zshShell?Vo:Uo,r=this.shim.path.basename(e);return e.match(/\.js$/)&&(e=`./${e}`),n=n.replace(/{{app_name}}/g,r),n=n.replace(/{{completion_command}}/g,t),n.replace(/{{app_path}}/g,e)}registerFunction(e){this.customCompletionFunction=e}setParsed(e){this.aliases=e.aliases}};function Ho(s,e,t,n){return new Ji(s,e,t,n)}function Cl(s){return s.length<3}function El(s){return s.length>3}function zo(s,e){if(s.length===0)return e.length;if(e.length===0)return s.length;let t=[],n;for(n=0;n<=e.length;n++)t[n]=[n];let r;for(r=0;r<=s.length;r++)t[0][r]=r;for(n=1;n<=e.length;n++)for(r=1;r<=s.length;r++)e.charAt(n-1)===s.charAt(r-1)?t[n][r]=t[n-1][r-1]:n>1&&r>1&&e.charAt(n-2)===s.charAt(r-1)&&e.charAt(n-1)===s.charAt(r-2)?t[n][r]=t[n-2][r-2]+1:t[n][r]=Math.min(t[n-1][r-1]+1,Math.min(t[n][r-1]+1,t[n-1][r]+1));return t[e.length][s.length]}var Yo=["$0","--","_"];function Ko(s,e,t){let n=t.y18n.__,r=t.y18n.__n,o={};o.nonOptionCount=function(l){let m=s.getDemandedCommands(),w=l._.length+(l["--"]?l["--"].length:0)-s.getInternalMethods().getContext().commands.length;m._&&(w<m._.min||w>m._.max)&&(w<m._.min?m._.minMsg!==void 0?e.fail(m._.minMsg?m._.minMsg.replace(/\$0/g,w.toString()).replace(/\$1/,m._.min.toString()):null):e.fail(r("Not enough non-option arguments: got %s, need at least %s","Not enough non-option arguments: got %s, need at least %s",w,w.toString(),m._.min.toString())):w>m._.max&&(m._.maxMsg!==void 0?e.fail(m._.maxMsg?m._.maxMsg.replace(/\$0/g,w.toString()).replace(/\$1/,m._.max.toString()):null):e.fail(r("Too many non-option arguments: got %s, maximum of %s","Too many non-option arguments: got %s, maximum of %s",w,w.toString(),m._.max.toString()))))},o.positionalCount=function(l,m){m<l&&e.fail(r("Not enough non-option arguments: got %s, need at least %s","Not enough non-option arguments: got %s, need at least %s",m,m+"",l+""))},o.requiredArguments=function(l,m){let C=null;for(let w of Object.keys(m))(!Object.prototype.hasOwnProperty.call(l,w)||typeof l[w]>"u")&&(C=C||{},C[w]=m[w]);if(C){let w=[];for(let D of Object.keys(C)){let I=C[D];I&&w.indexOf(I)<0&&w.push(I)}let y=w.length?`
164
+ ${w.join(`
165
+ `)}`:"";e.fail(r("Missing required argument: %s","Missing required arguments: %s",Object.keys(C).length,Object.keys(C).join(", ")+y))}},o.unknownArguments=function(l,m,C,w,y=!0){var D;let I=s.getInternalMethods().getCommandInstance().getCommands(),A=[],k=s.getInternalMethods().getContext();if(Object.keys(l).forEach(b=>{!Yo.includes(b)&&!Object.prototype.hasOwnProperty.call(C,b)&&!Object.prototype.hasOwnProperty.call(s.getInternalMethods().getParseContext(),b)&&!o.isValidAndSomeAliasIsNotNew(b,m)&&A.push(b)}),y&&(k.commands.length>0||I.length>0||w)&&l._.slice(k.commands.length).forEach(b=>{I.includes(""+b)||A.push(""+b)}),y){let R=((D=s.getDemandedCommands()._)===null||D===void 0?void 0:D.max)||0,Z=k.commands.length+R;Z<l._.length&&l._.slice(Z).forEach(H=>{H=String(H),!k.commands.includes(H)&&!A.includes(H)&&A.push(H)})}A.length&&e.fail(r("Unknown argument: %s","Unknown arguments: %s",A.length,A.map(b=>b.trim()?b:`"${b}"`).join(", ")))},o.unknownCommands=function(l){let m=s.getInternalMethods().getCommandInstance().getCommands(),C=[],w=s.getInternalMethods().getContext();return(w.commands.length>0||m.length>0)&&l._.slice(w.commands.length).forEach(y=>{m.includes(""+y)||C.push(""+y)}),C.length>0?(e.fail(r("Unknown command: %s","Unknown commands: %s",C.length,C.join(", "))),!0):!1},o.isValidAndSomeAliasIsNotNew=function(l,m){if(!Object.prototype.hasOwnProperty.call(m,l))return!1;let C=s.parsed.newAliases;return[l,...m[l]].some(w=>!Object.prototype.hasOwnProperty.call(C,w)||!C[l])},o.limitedChoices=function(l){let m=s.getOptions(),C={};if(!Object.keys(m.choices).length)return;Object.keys(l).forEach(D=>{Yo.indexOf(D)===-1&&Object.prototype.hasOwnProperty.call(m.choices,D)&&[].concat(l[D]).forEach(I=>{m.choices[D].indexOf(I)===-1&&I!==void 0&&(C[D]=(C[D]||[]).concat(I))})});let w=Object.keys(C);if(!w.length)return;let y=n("Invalid values:");w.forEach(D=>{y+=`
166
+ ${n("Argument: %s, Given: %s, Choices: %s",D,e.stringifiedValues(C[D]),e.stringifiedValues(m.choices[D]))}`}),e.fail(y)};let i={};o.implies=function(l,m){$("<string|object> [array|number|string]",[l,m],arguments.length),typeof l=="object"?Object.keys(l).forEach(C=>{o.implies(C,l[C])}):(s.global(l),i[l]||(i[l]=[]),Array.isArray(m)?m.forEach(C=>o.implies(l,C)):(xe(m,void 0,t),i[l].push(m)))},o.getImplied=function(){return i};function u(p,l){let m=Number(l);return l=isNaN(m)?l:m,typeof l=="number"?l=p._.length>=l:l.match(/^--no-.+/)?(l=l.match(/^--no-(.+)/)[1],l=!Object.prototype.hasOwnProperty.call(p,l)):l=Object.prototype.hasOwnProperty.call(p,l),l}o.implications=function(l){let m=[];if(Object.keys(i).forEach(C=>{let w=C;(i[C]||[]).forEach(y=>{let D=w,I=y;D=u(l,D),y=u(l,y),D&&!y&&m.push(` ${w} -> ${I}`)})}),m.length){let C=`${n("Implications failed:")}
167
+ `;m.forEach(w=>{C+=w}),e.fail(C)}};let h={};o.conflicts=function(l,m){$("<string|object> [array|string]",[l,m],arguments.length),typeof l=="object"?Object.keys(l).forEach(C=>{o.conflicts(C,l[C])}):(s.global(l),h[l]||(h[l]=[]),Array.isArray(m)?m.forEach(C=>o.conflicts(l,C)):h[l].push(m))},o.getConflicting=()=>h,o.conflicting=function(l){Object.keys(l).forEach(m=>{h[m]&&h[m].forEach(C=>{C&&l[m]!==void 0&&l[C]!==void 0&&e.fail(n("Arguments %s and %s are mutually exclusive",m,C))})}),s.getInternalMethods().getParserConfiguration()["strip-dashed"]&&Object.keys(h).forEach(m=>{h[m].forEach(C=>{C&&l[t.Parser.camelCase(m)]!==void 0&&l[t.Parser.camelCase(C)]!==void 0&&e.fail(n("Arguments %s and %s are mutually exclusive",m,C))})})},o.recommendCommands=function(l,m){m=m.sort((D,I)=>I.length-D.length);let w=null,y=1/0;for(let D=0,I;(I=m[D])!==void 0;D++){let A=zo(l,I);A<=3&&A<y&&(y=A,w=I)}w&&e.fail(n("Did you mean %s?",w))},o.reset=function(l){return i=dt(i,m=>!l[m]),h=dt(h,m=>!l[m]),o};let f=[];return o.freeze=function(){f.push({implied:i,conflicting:h})},o.unfreeze=function(){let l=f.pop();xe(l,void 0,t),{implied:i,conflicting:h}=l},o}var Ri=[],En;function ws(s,e,t,n){En=n;let r={};if(Object.prototype.hasOwnProperty.call(s,"extends")){if(typeof s.extends!="string")return r;let o=/\.json|\..*rc$/.test(s.extends),i=null;if(o)i=Fl(e,s.extends);else try{i=Qe.resolve(s.extends)}catch{return s}yl(i),Ri.push(i),r=o?JSON.parse(En.readFileSync(i,"utf8")):Qe(s.extends),delete s.extends,r=ws(r,En.path.dirname(i),t,En)}return Ri=[],t?Qo(r,s):Object.assign({},r,s)}function yl(s){if(Ri.indexOf(s)>-1)throw new K(`Circular extended configurations: '${s}'.`)}function Fl(s,e){return En.path.resolve(s,e)}function Qo(s,e){let t={};function n(r){return r&&typeof r=="object"&&!Array.isArray(r)}Object.assign(t,s);for(let r of Object.keys(e))n(e[r])&&n(t[r])?t[r]=Qo(s[r],e[r]):t[r]=e[r];return t}var T=function(s,e,t,n,r){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!r)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?s!==e||!r:!e.has(s))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?r.call(s,t):r?r.value=t:e.set(s,t),t},a=function(s,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?s!==e||!n:!e.has(s))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(s):n?n.value:e.get(s)},fe,It,yn,Me,Be,As,gt,Bt,vs,Pe,xs,Je,Xe,Ne,Re,Os,rn,ge,S,$s,Ts,Se,Nt,on,St,Ct,_s,J,kt,jt,Mt,L,Is,et,ce;function gu(s){return(e=[],t=s.process.cwd(),n)=>{let r=new Qi(e,t,n,s);return Object.defineProperty(r,"argv",{get:()=>r.parse(),enumerable:!0}),r.help(),r.version(),r}}var Zo=Symbol("copyDoubleDash"),Xo=Symbol("copyDoubleDash"),Li=Symbol("deleteFromParserHintObject"),eu=Symbol("emitWarning"),tu=Symbol("freeze"),nu=Symbol("getDollarZero"),Pt=Symbol("getParserConfiguration"),su=Symbol("getUsageConfiguration"),Wi=Symbol("guessLocale"),iu=Symbol("guessVersion"),ru=Symbol("parsePositionalNumbers"),qi=Symbol("pkgUp"),Et=Symbol("populateParserHintArray"),un=Symbol("populateParserHintSingleValueDictionary"),Gi=Symbol("populateParserHintArrayDictionary"),Ui=Symbol("populateParserHintDictionary"),Vi=Symbol("sanitizeKey"),Hi=Symbol("setKey"),zi=Symbol("unfreeze"),ou=Symbol("validateAsync"),uu=Symbol("getCommandInstance"),au=Symbol("getContext"),cu=Symbol("getHasOutput"),lu=Symbol("getLoggerInstance"),hu=Symbol("getParseContext"),fu=Symbol("getUsageInstance"),Du=Symbol("getValidationInstance"),Bs=Symbol("hasParseCallback"),pu=Symbol("isGlobalContext"),Jt=Symbol("postProcess"),du=Symbol("rebase"),Yi=Symbol("reset"),Fn=Symbol("runYargsParserAndExecuteCommands"),Ki=Symbol("runValidation"),mu=Symbol("setHasOutput"),Rt=Symbol("kTrackManuallySetKeys"),Qi=class{constructor(e=[],t,n,r){this.customScriptName=!1,this.parsed=!1,fe.set(this,void 0),It.set(this,void 0),yn.set(this,{commands:[],fullCommands:[]}),Me.set(this,null),Be.set(this,null),As.set(this,"show-hidden"),gt.set(this,null),Bt.set(this,!0),vs.set(this,{}),Pe.set(this,!0),xs.set(this,[]),Je.set(this,void 0),Xe.set(this,{}),Ne.set(this,!1),Re.set(this,null),Os.set(this,!0),rn.set(this,void 0),ge.set(this,""),S.set(this,void 0),$s.set(this,void 0),Ts.set(this,{}),Se.set(this,null),Nt.set(this,null),on.set(this,{}),St.set(this,{}),Ct.set(this,void 0),_s.set(this,!1),J.set(this,void 0),kt.set(this,!1),jt.set(this,!1),Mt.set(this,!1),L.set(this,void 0),Is.set(this,{}),et.set(this,null),ce.set(this,void 0),T(this,J,r,"f"),T(this,Ct,e,"f"),T(this,It,t,"f"),T(this,$s,n,"f"),T(this,Je,new ys(this),"f"),this.$0=this[nu](),this[Yi](),T(this,fe,a(this,fe,"f"),"f"),T(this,L,a(this,L,"f"),"f"),T(this,ce,a(this,ce,"f"),"f"),T(this,S,a(this,S,"f"),"f"),a(this,S,"f").showHiddenOpt=a(this,As,"f"),T(this,rn,this[Xo](),"f")}addHelpOpt(e,t){let n="help";return $("[string|boolean] [string]",[e,t],arguments.length),a(this,Re,"f")&&(this[Li](a(this,Re,"f")),T(this,Re,null,"f")),e===!1&&t===void 0?this:(T(this,Re,typeof e=="string"?e:n,"f"),this.boolean(a(this,Re,"f")),this.describe(a(this,Re,"f"),t||a(this,L,"f").deferY18nLookup("Show help")),this)}help(e,t){return this.addHelpOpt(e,t)}addShowHiddenOpt(e,t){if($("[string|boolean] [string]",[e,t],arguments.length),e===!1&&t===void 0)return this;let n=typeof e=="string"?e:a(this,As,"f");return this.boolean(n),this.describe(n,t||a(this,L,"f").deferY18nLookup("Show hidden options")),a(this,S,"f").showHiddenOpt=n,this}showHidden(e,t){return this.addShowHiddenOpt(e,t)}alias(e,t){return $("<object|string|array> [string|array]",[e,t],arguments.length),this[Gi](this.alias.bind(this),"alias",e,t),this}array(e){return $("<array|string>",[e],arguments.length),this[Et]("array",e),this[Rt](e),this}boolean(e){return $("<array|string>",[e],arguments.length),this[Et]("boolean",e),this[Rt](e),this}check(e,t){return $("<function> [boolean]",[e,t],arguments.length),this.middleware((n,r)=>_t(()=>e(n,r.getOptions()),o=>(o?(typeof o=="string"||o instanceof Error)&&a(this,L,"f").fail(o.toString(),o):a(this,L,"f").fail(a(this,J,"f").y18n.__("Argument check failed: %s",e.toString())),n),o=>(a(this,L,"f").fail(o.message?o.message:o.toString(),o),n)),!1,t),this}choices(e,t){return $("<object|string|array> [string|array]",[e,t],arguments.length),this[Gi](this.choices.bind(this),"choices",e,t),this}coerce(e,t){if($("<object|string|array> [function]",[e,t],arguments.length),Array.isArray(e)){if(!t)throw new K("coerce callback must be provided");for(let n of e)this.coerce(n,t);return this}else if(typeof e=="object"){for(let n of Object.keys(e))this.coerce(n,e[n]);return this}if(!t)throw new K("coerce callback must be provided");return a(this,S,"f").key[e]=!0,a(this,Je,"f").addCoerceMiddleware((n,r)=>{let o;return Object.prototype.hasOwnProperty.call(n,e)?_t(()=>(o=r.getAliases(),t(n[e])),u=>{n[e]=u;let h=r.getInternalMethods().getParserConfiguration()["strip-aliased"];if(o[e]&&h!==!0)for(let f of o[e])n[f]=u;return n},u=>{throw new K(u.message)}):n},e),this}conflicts(e,t){return $("<string|object> [string|array]",[e,t],arguments.length),a(this,ce,"f").conflicts(e,t),this}config(e="config",t,n){return $("[object|string] [string|function] [function]",[e,t,n],arguments.length),typeof e=="object"&&!Array.isArray(e)?(e=ws(e,a(this,It,"f"),this[Pt]()["deep-merge-config"]||!1,a(this,J,"f")),a(this,S,"f").configObjects=(a(this,S,"f").configObjects||[]).concat(e),this):(typeof t=="function"&&(n=t,t=void 0),this.describe(e,t||a(this,L,"f").deferY18nLookup("Path to JSON config file")),(Array.isArray(e)?e:[e]).forEach(r=>{a(this,S,"f").config[r]=n||!0}),this)}completion(e,t,n){return $("[string] [string|boolean|function] [function]",[e,t,n],arguments.length),typeof t=="function"&&(n=t,t=void 0),T(this,Be,e||a(this,Be,"f")||"completion","f"),!t&&t!==!1&&(t="generate completion script"),this.command(a(this,Be,"f"),t),n&&a(this,Me,"f").registerFunction(n),this}command(e,t,n,r,o,i){return $("<string|array|object> [string|boolean] [function|object] [function] [array] [boolean|string]",[e,t,n,r,o,i],arguments.length),a(this,fe,"f").addHandler(e,t,n,r,o,i),this}commands(e,t,n,r,o,i){return this.command(e,t,n,r,o,i)}commandDir(e,t){$("<string> [object]",[e,t],arguments.length);let n=a(this,$s,"f")||a(this,J,"f").require;return a(this,fe,"f").addDirectory(e,n,a(this,J,"f").getCallerFile(),t),this}count(e){return $("<array|string>",[e],arguments.length),this[Et]("count",e),this[Rt](e),this}default(e,t,n){return $("<object|string|array> [*] [string]",[e,t,n],arguments.length),n&&(ki(e,a(this,J,"f")),a(this,S,"f").defaultDescription[e]=n),typeof t=="function"&&(ki(e,a(this,J,"f")),a(this,S,"f").defaultDescription[e]||(a(this,S,"f").defaultDescription[e]=a(this,L,"f").functionDescription(t)),t=t.call()),this[un](this.default.bind(this),"default",e,t),this}defaults(e,t,n){return this.default(e,t,n)}demandCommand(e=1,t,n,r){return $("[number] [number|string] [string|null|undefined] [string|null|undefined]",[e,t,n,r],arguments.length),typeof t!="number"&&(n=t,t=1/0),this.global("_",!1),a(this,S,"f").demandedCommands._={min:e,max:t,minMsg:n,maxMsg:r},this}demand(e,t,n){return Array.isArray(t)?(t.forEach(r=>{xe(n,!0,a(this,J,"f")),this.demandOption(r,n)}),t=1/0):typeof t!="number"&&(n=t,t=1/0),typeof e=="number"?(xe(n,!0,a(this,J,"f")),this.demandCommand(e,t,n,n)):Array.isArray(e)?e.forEach(r=>{xe(n,!0,a(this,J,"f")),this.demandOption(r,n)}):typeof n=="string"?this.demandOption(e,n):(n===!0||typeof n>"u")&&this.demandOption(e),this}demandOption(e,t){return $("<object|string|array> [string]",[e,t],arguments.length),this[un](this.demandOption.bind(this),"demandedOptions",e,t),this}deprecateOption(e,t){return $("<string> [string|boolean]",[e,t],arguments.length),a(this,S,"f").deprecatedOptions[e]=t,this}describe(e,t){return $("<object|string|array> [string]",[e,t],arguments.length),this[Hi](e,!0),a(this,L,"f").describe(e,t),this}detectLocale(e){return $("<boolean>",[e],arguments.length),T(this,Bt,e,"f"),this}env(e){return $("[string|boolean]",[e],arguments.length),e===!1?delete a(this,S,"f").envPrefix:a(this,S,"f").envPrefix=e||"",this}epilogue(e){return $("<string>",[e],arguments.length),a(this,L,"f").epilog(e),this}epilog(e){return this.epilogue(e)}example(e,t){return $("<string|array> [string]",[e,t],arguments.length),Array.isArray(e)?e.forEach(n=>this.example(...n)):a(this,L,"f").example(e,t),this}exit(e,t){T(this,Ne,!0,"f"),T(this,gt,t,"f"),a(this,Pe,"f")&&a(this,J,"f").process.exit(e)}exitProcess(e=!0){return $("[boolean]",[e],arguments.length),T(this,Pe,e,"f"),this}fail(e){if($("<function|boolean>",[e],arguments.length),typeof e=="boolean"&&e!==!1)throw new K("Invalid first argument. Expected function or boolean 'false'");return a(this,L,"f").failFn(e),this}getAliases(){return this.parsed?this.parsed.aliases:{}}async getCompletion(e,t){return $("<array> [function]",[e,t],arguments.length),t?a(this,Me,"f").getCompletion(e,t):new Promise((n,r)=>{a(this,Me,"f").getCompletion(e,(o,i)=>{o?r(o):n(i)})})}getDemandedOptions(){return $([],0),a(this,S,"f").demandedOptions}getDemandedCommands(){return $([],0),a(this,S,"f").demandedCommands}getDeprecatedOptions(){return $([],0),a(this,S,"f").deprecatedOptions}getDetectLocale(){return a(this,Bt,"f")}getExitProcess(){return a(this,Pe,"f")}getGroups(){return Object.assign({},a(this,Xe,"f"),a(this,St,"f"))}getHelp(){if(T(this,Ne,!0,"f"),!a(this,L,"f").hasCachedHelpMessage()){if(!this.parsed){let t=this[Fn](a(this,Ct,"f"),void 0,void 0,0,!0);if(Q(t))return t.then(()=>a(this,L,"f").help())}let e=a(this,fe,"f").runDefaultBuilderOn(this);if(Q(e))return e.then(()=>a(this,L,"f").help())}return Promise.resolve(a(this,L,"f").help())}getOptions(){return a(this,S,"f")}getStrict(){return a(this,kt,"f")}getStrictCommands(){return a(this,jt,"f")}getStrictOptions(){return a(this,Mt,"f")}global(e,t){return $("<string|array> [boolean]",[e,t],arguments.length),e=[].concat(e),t!==!1?a(this,S,"f").local=a(this,S,"f").local.filter(n=>e.indexOf(n)===-1):e.forEach(n=>{a(this,S,"f").local.includes(n)||a(this,S,"f").local.push(n)}),this}group(e,t){$("<string|array> <string>",[e,t],arguments.length);let n=a(this,St,"f")[t]||a(this,Xe,"f")[t];a(this,St,"f")[t]&&delete a(this,St,"f")[t];let r={};return a(this,Xe,"f")[t]=(n||[]).concat(e).filter(o=>r[o]?!1:r[o]=!0),this}hide(e){return $("<string>",[e],arguments.length),a(this,S,"f").hiddenOptions.push(e),this}implies(e,t){return $("<string|object> [number|string|array]",[e,t],arguments.length),a(this,ce,"f").implies(e,t),this}locale(e){return $("[string]",[e],arguments.length),e===void 0?(this[Wi](),a(this,J,"f").y18n.getLocale()):(T(this,Bt,!1,"f"),a(this,J,"f").y18n.setLocale(e),this)}middleware(e,t,n){return a(this,Je,"f").addMiddleware(e,!!t,n)}nargs(e,t){return $("<string|object|array> [number]",[e,t],arguments.length),this[un](this.nargs.bind(this),"narg",e,t),this}normalize(e){return $("<array|string>",[e],arguments.length),this[Et]("normalize",e),this}number(e){return $("<array|string>",[e],arguments.length),this[Et]("number",e),this[Rt](e),this}option(e,t){if($("<string|object> [object]",[e,t],arguments.length),typeof e=="object")Object.keys(e).forEach(n=>{this.options(n,e[n])});else{typeof t!="object"&&(t={}),this[Rt](e),a(this,et,"f")&&(e==="version"||t?.alias==="version")&&this[eu](['"version" is a reserved word.',"Please do one of the following:",'- Disable version with `yargs.version(false)` if using "version" as an option',"- Use the built-in `yargs.version` method instead (if applicable)","- Use a different option key","https://yargs.js.org/docs/#api-reference-version"].join(`
168
+ `),void 0,"versionWarning"),a(this,S,"f").key[e]=!0,t.alias&&this.alias(e,t.alias);let n=t.deprecate||t.deprecated;n&&this.deprecateOption(e,n);let r=t.demand||t.required||t.require;r&&this.demand(e,r),t.demandOption&&this.demandOption(e,typeof t.demandOption=="string"?t.demandOption:void 0),t.conflicts&&this.conflicts(e,t.conflicts),"default"in t&&this.default(e,t.default),t.implies!==void 0&&this.implies(e,t.implies),t.nargs!==void 0&&this.nargs(e,t.nargs),t.config&&this.config(e,t.configParser),t.normalize&&this.normalize(e),t.choices&&this.choices(e,t.choices),t.coerce&&this.coerce(e,t.coerce),t.group&&this.group(e,t.group),(t.boolean||t.type==="boolean")&&(this.boolean(e),t.alias&&this.boolean(t.alias)),(t.array||t.type==="array")&&(this.array(e),t.alias&&this.array(t.alias)),(t.number||t.type==="number")&&(this.number(e),t.alias&&this.number(t.alias)),(t.string||t.type==="string")&&(this.string(e),t.alias&&this.string(t.alias)),(t.count||t.type==="count")&&this.count(e),typeof t.global=="boolean"&&this.global(e,t.global),t.defaultDescription&&(a(this,S,"f").defaultDescription[e]=t.defaultDescription),t.skipValidation&&this.skipValidation(e);let o=t.describe||t.description||t.desc,i=a(this,L,"f").getDescriptions();(!Object.prototype.hasOwnProperty.call(i,e)||typeof o=="string")&&this.describe(e,o),t.hidden&&this.hide(e),t.requiresArg&&this.requiresArg(e)}return this}options(e,t){return this.option(e,t)}parse(e,t,n){$("[string|array] [function|boolean|object] [function]",[e,t,n],arguments.length),this[tu](),typeof e>"u"&&(e=a(this,Ct,"f")),typeof t=="object"&&(T(this,Nt,t,"f"),t=n),typeof t=="function"&&(T(this,Se,t,"f"),t=!1),t||T(this,Ct,e,"f"),a(this,Se,"f")&&T(this,Pe,!1,"f");let r=this[Fn](e,!!t),o=this.parsed;return a(this,Me,"f").setParsed(this.parsed),Q(r)?r.then(i=>(a(this,Se,"f")&&a(this,Se,"f").call(this,a(this,gt,"f"),i,a(this,ge,"f")),i)).catch(i=>{throw a(this,Se,"f")&&a(this,Se,"f")(i,this.parsed.argv,a(this,ge,"f")),i}).finally(()=>{this[zi](),this.parsed=o}):(a(this,Se,"f")&&a(this,Se,"f").call(this,a(this,gt,"f"),r,a(this,ge,"f")),this[zi](),this.parsed=o,r)}parseAsync(e,t,n){let r=this.parse(e,t,n);return Q(r)?r:Promise.resolve(r)}parseSync(e,t,n){let r=this.parse(e,t,n);if(Q(r))throw new K(".parseSync() must not be used with asynchronous builders, handlers, or middleware");return r}parserConfiguration(e){return $("<object>",[e],arguments.length),T(this,Ts,e,"f"),this}pkgConf(e,t){$("<string> [string]",[e,t],arguments.length);let n=null,r=this[qi](t||a(this,It,"f"));return r[e]&&typeof r[e]=="object"&&(n=ws(r[e],t||a(this,It,"f"),this[Pt]()["deep-merge-config"]||!1,a(this,J,"f")),a(this,S,"f").configObjects=(a(this,S,"f").configObjects||[]).concat(n)),this}positional(e,t){$("<string> <object>",[e,t],arguments.length);let n=["default","defaultDescription","implies","normalize","choices","conflicts","coerce","type","describe","desc","description","alias"];t=dt(t,(i,u)=>i==="type"&&!["string","number","boolean"].includes(u)?!1:n.includes(i));let r=a(this,yn,"f").fullCommands[a(this,yn,"f").fullCommands.length-1],o=r?a(this,fe,"f").cmdToParseOptions(r):{array:[],alias:{},default:{},demand:{}};return nn(o).forEach(i=>{let u=o[i];Array.isArray(u)?u.indexOf(e)!==-1&&(t[i]=!0):u[e]&&!(i in t)&&(t[i]=u[e])}),this.group(e,a(this,L,"f").getPositionalGroupName()),this.option(e,t)}recommendCommands(e=!0){return $("[boolean]",[e],arguments.length),T(this,_s,e,"f"),this}required(e,t,n){return this.demand(e,t,n)}require(e,t,n){return this.demand(e,t,n)}requiresArg(e){return $("<array|string|object> [number]",[e],arguments.length),typeof e=="string"&&a(this,S,"f").narg[e]?this:(this[un](this.requiresArg.bind(this),"narg",e,NaN),this)}showCompletionScript(e,t){return $("[string] [string]",[e,t],arguments.length),e=e||this.$0,a(this,rn,"f").log(a(this,Me,"f").generateCompletionScript(e,t||a(this,Be,"f")||"completion")),this}showHelp(e){if($("[string|function]",[e],arguments.length),T(this,Ne,!0,"f"),!a(this,L,"f").hasCachedHelpMessage()){if(!this.parsed){let n=this[Fn](a(this,Ct,"f"),void 0,void 0,0,!0);if(Q(n))return n.then(()=>{a(this,L,"f").showHelp(e)}),this}let t=a(this,fe,"f").runDefaultBuilderOn(this);if(Q(t))return t.then(()=>{a(this,L,"f").showHelp(e)}),this}return a(this,L,"f").showHelp(e),this}scriptName(e){return this.customScriptName=!0,this.$0=e,this}showHelpOnFail(e,t){return $("[boolean|string] [string]",[e,t],arguments.length),a(this,L,"f").showHelpOnFail(e,t),this}showVersion(e){return $("[string|function]",[e],arguments.length),a(this,L,"f").showVersion(e),this}skipValidation(e){return $("<array|string>",[e],arguments.length),this[Et]("skipValidation",e),this}strict(e){return $("[boolean]",[e],arguments.length),T(this,kt,e!==!1,"f"),this}strictCommands(e){return $("[boolean]",[e],arguments.length),T(this,jt,e!==!1,"f"),this}strictOptions(e){return $("[boolean]",[e],arguments.length),T(this,Mt,e!==!1,"f"),this}string(e){return $("<array|string>",[e],arguments.length),this[Et]("string",e),this[Rt](e),this}terminalWidth(){return $([],0),a(this,J,"f").process.stdColumns}updateLocale(e){return this.updateStrings(e)}updateStrings(e){return $("<object>",[e],arguments.length),T(this,Bt,!1,"f"),a(this,J,"f").y18n.updateLocale(e),this}usage(e,t,n,r){if($("<string|null|undefined> [string|boolean] [function|object] [function]",[e,t,n,r],arguments.length),t!==void 0){if(xe(e,null,a(this,J,"f")),(e||"").match(/^\$0( |$)/))return this.command(e,t,n,r);throw new K(".usage() description must start with $0 if being used as alias for .command()")}else return a(this,L,"f").usage(e),this}usageConfiguration(e){return $("<object>",[e],arguments.length),T(this,Is,e,"f"),this}version(e,t,n){let r="version";if($("[boolean|string] [string] [string]",[e,t,n],arguments.length),a(this,et,"f")&&(this[Li](a(this,et,"f")),a(this,L,"f").version(void 0),T(this,et,null,"f")),arguments.length===0)n=this[iu](),e=r;else if(arguments.length===1){if(e===!1)return this;n=e,e=r}else arguments.length===2&&(n=t,t=void 0);return T(this,et,typeof e=="string"?e:r,"f"),t=t||a(this,L,"f").deferY18nLookup("Show version number"),a(this,L,"f").version(n||void 0),this.boolean(a(this,et,"f")),this.describe(a(this,et,"f"),t),this}wrap(e){return $("<number|null|undefined>",[e],arguments.length),a(this,L,"f").wrap(e),this}[(fe=new WeakMap,It=new WeakMap,yn=new WeakMap,Me=new WeakMap,Be=new WeakMap,As=new WeakMap,gt=new WeakMap,Bt=new WeakMap,vs=new WeakMap,Pe=new WeakMap,xs=new WeakMap,Je=new WeakMap,Xe=new WeakMap,Ne=new WeakMap,Re=new WeakMap,Os=new WeakMap,rn=new WeakMap,ge=new WeakMap,S=new WeakMap,$s=new WeakMap,Ts=new WeakMap,Se=new WeakMap,Nt=new WeakMap,on=new WeakMap,St=new WeakMap,Ct=new WeakMap,_s=new WeakMap,J=new WeakMap,kt=new WeakMap,jt=new WeakMap,Mt=new WeakMap,L=new WeakMap,Is=new WeakMap,et=new WeakMap,ce=new WeakMap,Zo)](e){if(!e._||!e["--"])return e;e._.push.apply(e._,e["--"]);try{delete e["--"]}catch{}return e}[Xo](){return{log:(...e)=>{this[Bs]()||console.log(...e),T(this,Ne,!0,"f"),a(this,ge,"f").length&&T(this,ge,a(this,ge,"f")+`
169
+ `,"f"),T(this,ge,a(this,ge,"f")+e.join(" "),"f")},error:(...e)=>{this[Bs]()||console.error(...e),T(this,Ne,!0,"f"),a(this,ge,"f").length&&T(this,ge,a(this,ge,"f")+`
170
+ `,"f"),T(this,ge,a(this,ge,"f")+e.join(" "),"f")}}}[Li](e){nn(a(this,S,"f")).forEach(t=>{if((r=>r==="configObjects")(t))return;let n=a(this,S,"f")[t];Array.isArray(n)?n.includes(e)&&n.splice(n.indexOf(e),1):typeof n=="object"&&delete n[e]}),delete a(this,L,"f").getDescriptions()[e]}[eu](e,t,n){a(this,vs,"f")[n]||(a(this,J,"f").process.emitWarning(e,t),a(this,vs,"f")[n]=!0)}[tu](){a(this,xs,"f").push({options:a(this,S,"f"),configObjects:a(this,S,"f").configObjects.slice(0),exitProcess:a(this,Pe,"f"),groups:a(this,Xe,"f"),strict:a(this,kt,"f"),strictCommands:a(this,jt,"f"),strictOptions:a(this,Mt,"f"),completionCommand:a(this,Be,"f"),output:a(this,ge,"f"),exitError:a(this,gt,"f"),hasOutput:a(this,Ne,"f"),parsed:this.parsed,parseFn:a(this,Se,"f"),parseContext:a(this,Nt,"f")}),a(this,L,"f").freeze(),a(this,ce,"f").freeze(),a(this,fe,"f").freeze(),a(this,Je,"f").freeze()}[nu](){let e="",t;return/\b(node|iojs|electron)(\.exe)?$/.test(a(this,J,"f").process.argv()[0])?t=a(this,J,"f").process.argv().slice(1,2):t=a(this,J,"f").process.argv().slice(0,1),e=t.map(n=>{let r=this[du](a(this,It,"f"),n);return n.match(/^(\/|([a-zA-Z]:)?\\)/)&&r.length<n.length?r:n}).join(" ").trim(),a(this,J,"f").getEnv("_")&&a(this,J,"f").getProcessArgvBin()===a(this,J,"f").getEnv("_")&&(e=a(this,J,"f").getEnv("_").replace(`${a(this,J,"f").path.dirname(a(this,J,"f").process.execPath())}/`,"")),e}[Pt](){return a(this,Ts,"f")}[su](){return a(this,Is,"f")}[Wi](){if(!a(this,Bt,"f"))return;let e=a(this,J,"f").getEnv("LC_ALL")||a(this,J,"f").getEnv("LC_MESSAGES")||a(this,J,"f").getEnv("LANG")||a(this,J,"f").getEnv("LANGUAGE")||"en_US";this.locale(e.replace(/[.:].*/,""))}[iu](){return this[qi]().version||"unknown"}[ru](e){let t=e["--"]?e["--"]:e._;for(let n=0,r;(r=t[n])!==void 0;n++)a(this,J,"f").Parser.looksLikeNumber(r)&&Number.isSafeInteger(Math.floor(parseFloat(`${r}`)))&&(t[n]=Number(r));return e}[qi](e){let t=e||"*";if(a(this,on,"f")[t])return a(this,on,"f")[t];let n={};try{let r=e||a(this,J,"f").mainFilename;!e&&a(this,J,"f").path.extname(r)&&(r=a(this,J,"f").path.dirname(r));let o=a(this,J,"f").findUp(r,(i,u)=>{if(u.includes("package.json"))return"package.json"});xe(o,void 0,a(this,J,"f")),n=JSON.parse(a(this,J,"f").readFileSync(o,"utf8"))}catch{}return a(this,on,"f")[t]=n||{},a(this,on,"f")[t]}[Et](e,t){t=[].concat(t),t.forEach(n=>{n=this[Vi](n),a(this,S,"f")[e].push(n)})}[un](e,t,n,r){this[Ui](e,t,n,r,(o,i,u)=>{a(this,S,"f")[o][i]=u})}[Gi](e,t,n,r){this[Ui](e,t,n,r,(o,i,u)=>{a(this,S,"f")[o][i]=(a(this,S,"f")[o][i]||[]).concat(u)})}[Ui](e,t,n,r,o){if(Array.isArray(n))n.forEach(i=>{e(i,r)});else if((i=>typeof i=="object")(n))for(let i of nn(n))e(i,n[i]);else o(t,this[Vi](n),r)}[Vi](e){return e==="__proto__"?"___proto___":e}[Hi](e,t){return this[un](this[Hi].bind(this),"key",e,t),this}[zi](){var e,t,n,r,o,i,u,h,f,p,l,m;let C=a(this,xs,"f").pop();xe(C,void 0,a(this,J,"f"));let w;e=this,t=this,n=this,r=this,o=this,i=this,u=this,h=this,f=this,p=this,l=this,m=this,{options:{set value(y){T(e,S,y,"f")}}.value,configObjects:w,exitProcess:{set value(y){T(t,Pe,y,"f")}}.value,groups:{set value(y){T(n,Xe,y,"f")}}.value,output:{set value(y){T(r,ge,y,"f")}}.value,exitError:{set value(y){T(o,gt,y,"f")}}.value,hasOutput:{set value(y){T(i,Ne,y,"f")}}.value,parsed:this.parsed,strict:{set value(y){T(u,kt,y,"f")}}.value,strictCommands:{set value(y){T(h,jt,y,"f")}}.value,strictOptions:{set value(y){T(f,Mt,y,"f")}}.value,completionCommand:{set value(y){T(p,Be,y,"f")}}.value,parseFn:{set value(y){T(l,Se,y,"f")}}.value,parseContext:{set value(y){T(m,Nt,y,"f")}}.value}=C,a(this,S,"f").configObjects=w,a(this,L,"f").unfreeze(),a(this,ce,"f").unfreeze(),a(this,fe,"f").unfreeze(),a(this,Je,"f").unfreeze()}[ou](e,t){return _t(t,n=>(e(n),n))}getInternalMethods(){return{getCommandInstance:this[uu].bind(this),getContext:this[au].bind(this),getHasOutput:this[cu].bind(this),getLoggerInstance:this[lu].bind(this),getParseContext:this[hu].bind(this),getParserConfiguration:this[Pt].bind(this),getUsageConfiguration:this[su].bind(this),getUsageInstance:this[fu].bind(this),getValidationInstance:this[Du].bind(this),hasParseCallback:this[Bs].bind(this),isGlobalContext:this[pu].bind(this),postProcess:this[Jt].bind(this),reset:this[Yi].bind(this),runValidation:this[Ki].bind(this),runYargsParserAndExecuteCommands:this[Fn].bind(this),setHasOutput:this[mu].bind(this)}}[uu](){return a(this,fe,"f")}[au](){return a(this,yn,"f")}[cu](){return a(this,Ne,"f")}[lu](){return a(this,rn,"f")}[hu](){return a(this,Nt,"f")||{}}[fu](){return a(this,L,"f")}[Du](){return a(this,ce,"f")}[Bs](){return!!a(this,Se,"f")}[pu](){return a(this,Os,"f")}[Jt](e,t,n,r){return n||Q(e)||(t||(e=this[Zo](e)),(this[Pt]()["parse-positional-numbers"]||this[Pt]()["parse-positional-numbers"]===void 0)&&(e=this[ru](e)),r&&(e=Tt(e,this,a(this,Je,"f").getMiddleware(),!1))),e}[Yi](e={}){T(this,S,a(this,S,"f")||{},"f");let t={};t.local=a(this,S,"f").local||[],t.configObjects=a(this,S,"f").configObjects||[];let n={};t.local.forEach(i=>{n[i]=!0,(e[i]||[]).forEach(u=>{n[u]=!0})}),Object.assign(a(this,St,"f"),Object.keys(a(this,Xe,"f")).reduce((i,u)=>{let h=a(this,Xe,"f")[u].filter(f=>!(f in n));return h.length>0&&(i[u]=h),i},{})),T(this,Xe,{},"f");let r=["array","boolean","string","skipValidation","count","normalize","number","hiddenOptions"],o=["narg","key","alias","default","defaultDescription","config","choices","demandedOptions","demandedCommands","deprecatedOptions"];return r.forEach(i=>{t[i]=(a(this,S,"f")[i]||[]).filter(u=>!n[u])}),o.forEach(i=>{t[i]=dt(a(this,S,"f")[i],u=>!n[u])}),t.envPrefix=a(this,S,"f").envPrefix,T(this,S,t,"f"),T(this,L,a(this,L,"f")?a(this,L,"f").reset(n):Go(this,a(this,J,"f")),"f"),T(this,ce,a(this,ce,"f")?a(this,ce,"f").reset(n):Ko(this,a(this,L,"f"),a(this,J,"f")),"f"),T(this,fe,a(this,fe,"f")?a(this,fe,"f").reset():Lo(a(this,L,"f"),a(this,ce,"f"),a(this,Je,"f"),a(this,J,"f")),"f"),a(this,Me,"f")||T(this,Me,Ho(this,a(this,L,"f"),a(this,fe,"f"),a(this,J,"f")),"f"),a(this,Je,"f").reset(),T(this,Be,null,"f"),T(this,ge,"","f"),T(this,gt,null,"f"),T(this,Ne,!1,"f"),this.parsed=!1,this}[du](e,t){return a(this,J,"f").path.relative(e,t)}[Fn](e,t,n,r=0,o=!1){let i=!!n||o;e=e||a(this,Ct,"f"),a(this,S,"f").__=a(this,J,"f").y18n.__,a(this,S,"f").configuration=this[Pt]();let u=!!a(this,S,"f").configuration["populate--"],h=Object.assign({},a(this,S,"f").configuration,{"populate--":!0}),f=a(this,J,"f").Parser.detailed(e,Object.assign({},a(this,S,"f"),{configuration:{"parse-positional-numbers":!1,...h}})),p=Object.assign(f.argv,a(this,Nt,"f")),l,m=f.aliases,C=!1,w=!1;Object.keys(p).forEach(y=>{y===a(this,Re,"f")&&p[y]?C=!0:y===a(this,et,"f")&&p[y]&&(w=!0)}),p.$0=this.$0,this.parsed=f,r===0&&a(this,L,"f").clearCachedHelpMessage();try{if(this[Wi](),t)return this[Jt](p,u,!!n,!1);a(this,Re,"f")&&[a(this,Re,"f")].concat(m[a(this,Re,"f")]||[]).filter(k=>k.length>1).includes(""+p._[p._.length-1])&&(p._.pop(),C=!0),T(this,Os,!1,"f");let y=a(this,fe,"f").getCommands(),D=a(this,Me,"f").completionKey in p,I=C||D||o;if(p._.length){if(y.length){let A;for(let k=r||0,b;p._[k]!==void 0;k++)if(b=String(p._[k]),y.includes(b)&&b!==a(this,Be,"f")){let R=a(this,fe,"f").runCommand(b,this,f,k+1,o,C||w||o);return this[Jt](R,u,!!n,!1)}else if(!A&&b!==a(this,Be,"f")){A=b;break}!a(this,fe,"f").hasDefaultCommand()&&a(this,_s,"f")&&A&&!I&&a(this,ce,"f").recommendCommands(A,y)}a(this,Be,"f")&&p._.includes(a(this,Be,"f"))&&!D&&(a(this,Pe,"f")&&mt(!0),this.showCompletionScript(),this.exit(0))}if(a(this,fe,"f").hasDefaultCommand()&&!I){let A=a(this,fe,"f").runCommand(null,this,f,0,o,C||w||o);return this[Jt](A,u,!!n,!1)}if(D){a(this,Pe,"f")&&mt(!0),e=[].concat(e);let A=e.slice(e.indexOf(`--${a(this,Me,"f").completionKey}`)+1);return a(this,Me,"f").getCompletion(A,(k,b)=>{if(k)throw new K(k.message);(b||[]).forEach(R=>{a(this,rn,"f").log(R)}),this.exit(0)}),this[Jt](p,!u,!!n,!1)}if(a(this,Ne,"f")||(C?(a(this,Pe,"f")&&mt(!0),i=!0,this.showHelp("log"),this.exit(0)):w&&(a(this,Pe,"f")&&mt(!0),i=!0,a(this,L,"f").showVersion("log"),this.exit(0))),!i&&a(this,S,"f").skipValidation.length>0&&(i=Object.keys(p).some(A=>a(this,S,"f").skipValidation.indexOf(A)>=0&&p[A]===!0)),!i){if(f.error)throw new K(f.error.message);if(!D){let A=this[Ki](m,{},f.error);n||(l=Tt(p,this,a(this,Je,"f").getMiddleware(),!0)),l=this[ou](A,l??p),Q(l)&&!n&&(l=l.then(()=>Tt(p,this,a(this,Je,"f").getMiddleware(),!1)))}}}catch(y){if(y instanceof K)a(this,L,"f").fail(y.message,y);else throw y}return this[Jt](l??p,u,!!n,!0)}[Ki](e,t,n,r){let o={...this.getDemandedOptions()};return i=>{if(n)throw new K(n.message);a(this,ce,"f").nonOptionCount(i),a(this,ce,"f").requiredArguments(i,o);let u=!1;a(this,jt,"f")&&(u=a(this,ce,"f").unknownCommands(i)),a(this,kt,"f")&&!u?a(this,ce,"f").unknownArguments(i,e,t,!!r):a(this,Mt,"f")&&a(this,ce,"f").unknownArguments(i,e,{},!1,!1),a(this,ce,"f").limitedChoices(i),a(this,ce,"f").implications(i),a(this,ce,"f").conflicting(i)}}[mu](){T(this,Ne,!0,"f")}[Rt](e){if(typeof e=="string")a(this,S,"f").key[e]=!0;else for(let t of e)a(this,S,"f").key[t]=!0}};function Wo(s){return!!s&&typeof s.getInternalMethods=="function"}var bl=gu(jo),Cu=bl;function wl(s,e){return Cu(s).strict().command("* <template> <outDir>","Create a new project powered by qwik",n=>n.positional("template",{type:"string",desc:"Starter template",choices:e}).positional("outDir",{type:"string",desc:"Directory of the project"}).option("force",{alias:"f",type:"boolean",default:!1,desc:"Overwrite target directory if it exists"}).option("installDeps",{alias:"i",default:!1,type:"boolean",desc:"Install dependencies"}).usage("npm create qwik@latest base ./my-project <options>")).argv}async function yu(...s){let e=ut(),t=await tn("app"),n=t.standaloneTemplates.map(({id:m})=>m),r=wl(s,n),{force:o,installDeps:i,template:u}=r,h=r.outDir;Nn(`Let's create a ${hn(" Qwik App ")} \u2728 (v2.0.0-beta.14-dev+1e7496d)`),Al()?h=process.cwd():(h=ps(h),Eu.existsSync(h)&&Eu.readdirSync(h).length>0&&(o?await kn(h):(ie.error(`Directory "${h}" already exists.`),ie.info("Please either remove this directory, choose another location or run the command again with '--force | -f' flag."),ln(),process.exit(1))));let f=await en({outDir:h,appId:u,pkgManager:e,templateManager:t}),p=qt(),l=!1;return i&&(l=await hs(async()=>await bt(e,h).install,{pkgManager:e,spinner:p})),fs(e,f,l),f}function Al(){return vl()}function vl(){try{return process.cwd().startsWith("/home/projects/")}catch{}return!1}import{join as Ol,relative as $l}from"node:path";import Xi from"node:fs";var Zi=[["What's the best thing about a Boolean?","Even if you're wrong, you're only off by a bit."],["Why did the developer stay at home?","Because he couldn't find his keys."],["How many programmers does it take to change a lightbulb?","None that's a hardware problem"],["A user interface is like a joke.","If you have to explain it then it is not that good."],["['hip', 'hip']","(hip hip array)"],["A SQL query goes into a bar, walks up to two tables and asks:","'Can I JOIN you?'"],["Why did the developer go to therapy?","He had too many unresolved issues."],["Why do C# and Java developers keep breaking their keyboards?","Because they use a strongly typed language."],["What's the object-oriented way to become wealthy?","Inheritance"],["Where do programmers like to hangout?","The Foo Bar."],["Why do Java programmers wear glasses?","Because they don't C#"],["To understand what recursion is...","You must first understand what recursion is"],["The punchline often arrives before the set-up.","Do you know the problem with UDP jokes?"],["Why did the programmer quit his job?","Because he didn't get arrays."],["Why was the computer tired when it got home?","It had a hard drive."],["There are 10 types of people in this world...","Those who understand binary and those who don't"],["Why do programmers always mix up Halloween and Christmas?","Because Oct 31 == Dec 25"],["I was gonna tell you a joke about UDP...","...but you might not get it."],["Normal People: give me just a second","Developers: give me 1000 milliseconds!"],["Why do programmers prefer dark mode?","Because light attracts bugs."],["Why don't programmers like nature?","It has too many bugs."],["Why was the computer freezing?","It left its Windows open!"],["What did the Java code say to the C code?","You've got no class."],["Why do programmers prefer the outdoors?","Because it's free of bugs."],["Why do programmers love movies?","Because they can 'script' the ending."],["why do desert animals hate Qwik?","Because there's no hydration...."],["What can you do if you cannot push your git changes?","Use the --force, Luke"],["How did the developer announce he's getting married?","'She returned true!'"],["How many Prolog programmers does it take to change a lightbulb?","Yes."],["Why did the developer ground their kid?","They weren't telling the truthy"],["!false","It's funny 'cause it's true."],["Where did the parallel function wash its hands?","Async"],["How do functions break up?","They stop calling each other"],["Why did the functions stop calling each other?","Because they had constant arguments."],["What's the second movie about a database engineer called?","The SQL."],["What did the computer do at lunchtime?","NoSQL."],["Why doesn't Hollywood make more Big Data movies?","Had a byte!"],["What does a baby computer call his father?","Data!"],["I never tell the same joke twice","I have a DRY sense of humor."],["How do programming pirates pass method parameters?","ARRRRRGS."],["Why don't bachelors like Git?","Because they are afraid to commit."],["Why do astronauts use Linux?","They can't open Windows in space!"],["How do front end devs like their brownies?","GUI"],["What do hackers do on a boat?","Phishing."],["Why couldn't the HTML list be trusted?","There were LI's everywhere"],["To the person who invented zero:","Thank's for nothing!"],["What do you call a bee that lives in America?","A USB"],["want about to a race conditions hear joke?",""],["What is a Package Managers favorite holiday?","Dependency Day"],["Where do we get all of these dad jokes from?","A dad-a-base!"],["What advice do you give to a JS developer who has never played baseball?","Try catch."],["We don't have any DNS jokes, know why?","Because it may take 24 hours to get them"],["Why do Front-End Developers eat lunch alone?","Because they don't know how to join tables."],["How do you help JS errors?","You `console` them!"],["When do front end developers go out to eat?","On their lunch <br>."],["What do you call optimistic front-end developers?","Stack half-full developers."]];function Fu(){let s=Math.floor(Math.random()*Zi.length);return Zi[s]}async function bu(){let s=ut(),e=await tn("app"),t="./qwik-app";Nn(`Let's create a ${hn(" Qwik App ")} \u2728 (v2.0.0-beta.14-dev+1e7496d)`),await qr(500);let n=await wr({message:`Where would you like to create your new project? ${ot("(Use '.' or './' for current directory)")}`,placeholder:t})||t;rt(n)&&(ln("Operation cancelled."),process.exit(0));let r=e.getBaseApp();if(!r)throw new Error("Base app not found");let o=e.templates.filter(A=>A.id!==r.id).sort((A,k)=>A.name.localeCompare(k.name)),i=ps(n.trim());r.target=i;let u=zr(s,r),h=async()=>{await u.abort(),ln("Operation cancelled."),process.exit(0)};ie.info(`Creating new project in ${hn(" "+i+" ")} ... \u{1F407}`);let f=null;if(Xi.existsSync(i)&&Xi.readdirSync(i).length>0){let A=await Ys({message:`Directory "./${$l(process.cwd(),i)}" already exists and is not empty. What would you like to do?`,options:[{value:"exit",label:"Do not overwrite this directory and exit"},{value:"replace",label:"Remove contents of this directory"}]});if(rt(A)||A==="exit")return await h();A==="replace"&&(f=kn(i))}let p=await Ys({message:"Select a starter",options:o.map(A=>({label:A.name,value:A.id,hint:A.pkgJson?.description}))});if(rt(p))return await h();let l=p,m=await Bn({message:`Would you like to install ${s} dependencies?`,initialValue:!0});if(rt(m))return await h();let C=await Bn({message:"Initialize a new git repository?",initialValue:!0});f&&await f;let w=m;if(!w)u.abort();else if(typeof u.success>"u")try{let A=await Bn({message:"Finishing the install. Wanna hear a joke?",initialValue:!0});if(!rt(A)&&A){let[k,b]=Fu();Mn(be(`${k.trim()}
171
+ ${b.trim()}`),"\u{1F648}")}}catch{}let y=qt();y.start("Creating App...");let D=await en({appId:l,outDir:i,pkgManager:s,templateManager:e});if(y.stop("App Created \u{1F430}"),C)if(Xi.existsSync(Ol(i,".git")))ie.info("Git has already been initialized before. Skipping...");else{y.start("Git initializing...");try{let A=[];if(A.push(await Gt("git",["init"],i).install),A.push(await Gt("git",["add","-A"],i).install),A.push(await Gt("git",["commit","-m","Initial commit \u26A1\uFE0F"],i).install),A.some(k=>k===!1))throw"";y.stop("Git initialized \u{1F3B2}")}catch{y.stop("Git failed to initialize"),ie.error(Te("Git failed to initialize. You can do this manually by running: git init"))}}let I=!1;return w&&(I=await hs(async()=>{let A=await u.complete(D.outDir);return A&&await bt(s,D.outDir).install},{pkgManager:s,spinner:y})),fs(s,D,I),D}async function Tl(s){let e=ut(),t=await tn("app");return await en({appId:s.starterId,templateManager:t,outDir:s.outDir,pkgManager:e})}async function Cd(){Vr(),_l();try{let s=process.argv.slice(2);s.length>0?await yu(...s):await bu()}catch(s){jn(s.message||s)}}function _l(){let s=process.version,[e,t]=s.replace("v","").split(".");Number(e)<16?(console.error(Te(`Qwik requires Node.js 16.8 or higher. You are currently running Node.js ${s}.`)),process.exit(1)):Number(e)===16?Number(t)<8&&console.warn(Ir(`Node.js 16.8 or higher is recommended. You are currently running Node.js ${s}.`)):Number(e)===18&&Number(t)<11&&console.error(Te(`Node.js 18.11 or higher is REQUIRED. From Node 18.0.0 to 18.11.0, there is a bug preventing correct behaviour of Qwik. You are currently running Node.js ${s}. https://github.com/QwikDev/qwik/issues/3035`))}export{Tl as createApp,Cd as runCli,yu as runCreateCli,bu as runCreateInteractiveCli};
172
+ /*! Bundled license information:
173
+
174
+ yargs-parser/build/lib/string-utils.js:
175
+ yargs-parser/build/lib/tokenize-arg-string.js:
176
+ yargs-parser/build/lib/yargs-parser-types.js:
177
+ yargs-parser/build/lib/yargs-parser.js:
178
+ (**
179
+ * @license
180
+ * Copyright (c) 2016, Contributors
181
+ * SPDX-License-Identifier: ISC
182
+ *)
183
+
184
+ yargs-parser/build/lib/index.js:
185
+ (**
186
+ * @fileoverview Main entrypoint for libraries using yargs-parser in Node.js
187
+ * CJS and ESM environments.
188
+ *
189
+ * @license
190
+ * Copyright (c) 2016, Contributors
191
+ * SPDX-License-Identifier: ISC
192
+ *)
193
+ */