@soybeanjs/cli 0.8.4 → 0.8.7
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/README.md +7 -7
- package/dist/chunks/index.cjs +56 -56
- package/dist/chunks/index.mjs +80 -80
- package/dist/index.cjs +2 -2
- package/dist/index.mjs +2 -2
- package/package.json +18 -19
package/dist/chunks/index.mjs
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
var Wa=Object.defineProperty;var Ya=(s,e,t)=>e in s?Wa(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t;var v=(s,e,t)=>(Ya(s,typeof e!="symbol"?e+"":e,t),t);var Zt,es,ts,ss,ns,rs,is,os,ve,Ge,Le,as,Me,ke,ls,cs,us,fs,hs,ps,ds,gs,ms;import*as cn from"tty";import Va from"tty";import un,{format as za}from"util";import bs,{EOL as Oe}from"os";import{inspect as Mr}from"node:util";import{StringDecoder as Qa}from"string_decoder";import{Writable as Xa,Readable as Ja}from"stream";import{randomUUID as Za}from"crypto";import H from"node:path";import{execa as Dr,execaCommand as el}from"execa";import fn from"path";import{EOL as tl}from"node:os";import{Writable as sl}from"node:stream";import Fe from"node:fs/promises";import nl from"child_process";import rl from"events";import{pathToFileURL as il}from"node:url";import{createRequire as ol}from"node:module";import{constants as Fr}from"node:fs";var al=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function nt(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}var hn={exports:{}},ws={exports:{}},pn,xr;function ll(){if(xr)return pn;xr=1;var s=1e3,e=s*60,t=e*60,n=t*24,r=n*7,i=n*365.25;pn=function(h,u){u=u||{};var f=typeof h;if(f==="string"&&h.length>0)return o(h);if(f==="number"&&isFinite(h))return u.long?l(h):a(h);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(h))};function o(h){if(h=String(h),!(h.length>100)){var u=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(h);if(u){var f=parseFloat(u[1]),d=(u[2]||"ms").toLowerCase();switch(d){case"years":case"year":case"yrs":case"yr":case"y":return f*i;case"weeks":case"week":case"w":return f*r;case"days":case"day":case"d":return f*n;case"hours":case"hour":case"hrs":case"hr":case"h":return f*t;case"minutes":case"minute":case"mins":case"min":case"m":return f*e;case"seconds":case"second":case"secs":case"sec":case"s":return f*s;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return f;default:return}}}}function a(h){var u=Math.abs(h);return u>=n?Math.round(h/n)+"d":u>=t?Math.round(h/t)+"h":u>=e?Math.round(h/e)+"m":u>=s?Math.round(h/s)+"s":h+"ms"}function l(h){var u=Math.abs(h);return u>=n?c(h,u,n,"day"):u>=t?c(h,u,t,"hour"):u>=e?c(h,u,e,"minute"):u>=s?c(h,u,s,"second"):h+" ms"}function c(h,u,f,d){var m=u>=f*1.5;return Math.round(h/f)+" "+d+(m?"s":"")}return pn}var dn,Hr;function Ur(){if(Hr)return dn;Hr=1;function s(e){n.debug=n,n.default=n,n.coerce=c,n.disable=o,n.enable=i,n.enabled=a,n.humanize=ll(),n.destroy=h,Object.keys(e).forEach(u=>{n[u]=e[u]}),n.names=[],n.skips=[],n.formatters={};function t(u){let f=0;for(let d=0;d<u.length;d++)f=(f<<5)-f+u.charCodeAt(d),f|=0;return n.colors[Math.abs(f)%n.colors.length]}n.selectColor=t;function n(u){let f,d=null,m,p;function g(...y){if(!g.enabled)return;const S=g,A=Number(new Date),L=A-(f||A);S.diff=L,S.prev=f,S.curr=A,f=A,y[0]=n.coerce(y[0]),typeof y[0]!="string"&&y.unshift("%O");let R=0;y[0]=y[0].replace(/%([a-zA-Z%])/g,(I,_)=>{if(I==="%%")return"%";R++;const k=n.formatters[_];if(typeof k=="function"){const j=y[R];I=k.call(S,j),y.splice(R,1),R--}return I}),n.formatArgs.call(S,y),(S.log||n.log).apply(S,y)}return g.namespace=u,g.useColors=n.useColors(),g.color=n.selectColor(u),g.extend=r,g.destroy=n.destroy,Object.defineProperty(g,"enabled",{enumerable:!0,configurable:!1,get:()=>d!==null?d:(m!==n.namespaces&&(m=n.namespaces,p=n.enabled(u)),p),set:y=>{d=y}}),typeof n.init=="function"&&n.init(g),g}function r(u,f){const d=n(this.namespace+(typeof f>"u"?":":f)+u);return d.log=this.log,d}function i(u){n.save(u),n.namespaces=u,n.names=[],n.skips=[];let f;const d=(typeof u=="string"?u:"").split(/[\s,]+/),m=d.length;for(f=0;f<m;f++)d[f]&&(u=d[f].replace(/\*/g,".*?"),u[0]==="-"?n.skips.push(new RegExp("^"+u.slice(1)+"$")):n.names.push(new RegExp("^"+u+"$")))}function o(){const u=[...n.names.map(l),...n.skips.map(l).map(f=>"-"+f)].join(",");return n.enable(""),u}function a(u){if(u[u.length-1]==="*")return!0;let f,d;for(f=0,d=n.skips.length;f<d;f++)if(n.skips[f].test(u))return!1;for(f=0,d=n.names.length;f<d;f++)if(n.names[f].test(u))return!0;return!1}function l(u){return u.toString().substring(2,u.toString().length-2).replace(/\.\*\?$/,"*")}function c(u){return u instanceof Error?u.stack||u.message:u}function h(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return n.enable(n.load()),n}return dn=s,dn}var jr;function cl(){return jr||(jr=1,function(s,e){e.formatArgs=n,e.save=r,e.load=i,e.useColors=t,e.storage=o(),e.destroy=(()=>{let l=!1;return()=>{l||(l=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),e.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function t(){return typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs)?!0:typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)?!1:typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function n(l){if(l[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+l[0]+(this.useColors?"%c ":" ")+"+"+s.exports.humanize(this.diff),!this.useColors)return;const c="color: "+this.color;l.splice(1,0,c,"color: inherit");let h=0,u=0;l[0].replace(/%[a-zA-Z%]/g,f=>{f!=="%%"&&(h++,f==="%c"&&(u=h))}),l.splice(u,0,c)}e.log=console.debug||console.log||(()=>{});function r(l){try{l?e.storage.setItem("debug",l):e.storage.removeItem("debug")}catch{}}function i(){let l;try{l=e.storage.getItem("debug")}catch{}return!l&&typeof process<"u"&&"env"in process&&(l=process.env.DEBUG),l}function o(){try{return localStorage}catch{}}s.exports=Ur()(e);const{formatters:a}=s.exports;a.j=function(l){try{return JSON.stringify(l)}catch(c){return"[UnexpectedJSONParseError]: "+c.message}}}(ws,ws.exports)),ws.exports}var Es={exports:{}},gn,Kr;function ul(){return Kr||(Kr=1,gn=(s,e)=>{e=e||process.argv;const t=s.startsWith("-")?"":s.length===1?"-":"--",n=e.indexOf(t+s),r=e.indexOf("--");return n!==-1&&(r===-1?!0:n<r)}),gn}var mn,Gr;function fl(){if(Gr)return mn;Gr=1;const s=bs,e=ul(),t=process.env;let n;e("no-color")||e("no-colors")||e("color=false")?n=!1:(e("color")||e("colors")||e("color=true")||e("color=always"))&&(n=!0),"FORCE_COLOR"in t&&(n=t.FORCE_COLOR.length===0||parseInt(t.FORCE_COLOR,10)!==0);function r(a){return a===0?!1:{level:a,hasBasic:!0,has256:a>=2,has16m:a>=3}}function i(a){if(n===!1)return 0;if(e("color=16m")||e("color=full")||e("color=truecolor"))return 3;if(e("color=256"))return 2;if(a&&!a.isTTY&&n!==!0)return 0;const l=n?1:0;if(process.platform==="win32"){const c=s.release().split(".");return Number(process.versions.node.split(".")[0])>=8&&Number(c[0])>=10&&Number(c[2])>=10586?Number(c[2])>=14931?3:2:1}if("CI"in t)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI"].some(c=>c in t)||t.CI_NAME==="codeship"?1:l;if("TEAMCITY_VERSION"in t)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(t.TEAMCITY_VERSION)?1:0;if(t.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in t){const c=parseInt((t.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(t.TERM_PROGRAM){case"iTerm.app":return c>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(t.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(t.TERM)||"COLORTERM"in t?1:(t.TERM==="dumb",l)}function o(a){const l=i(a);return r(l)}return mn={supportsColor:o,stdout:o(process.stdout),stderr:o(process.stderr)},mn}var qr;function hl(){return qr||(qr=1,function(s,e){const t=Va,n=un;e.init=h,e.log=a,e.formatArgs=i,e.save=l,e.load=c,e.useColors=r,e.destroy=n.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."),e.colors=[6,2,3,4,5,1];try{const f=fl();f&&(f.stderr||f).level>=2&&(e.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch{}e.inspectOpts=Object.keys(process.env).filter(f=>/^debug_/i.test(f)).reduce((f,d)=>{const m=d.substring(6).toLowerCase().replace(/_([a-z])/g,(g,y)=>y.toUpperCase());let p=process.env[d];return/^(yes|on|true|enabled)$/i.test(p)?p=!0:/^(no|off|false|disabled)$/i.test(p)?p=!1:p==="null"?p=null:p=Number(p),f[m]=p,f},{});function r(){return"colors"in e.inspectOpts?!!e.inspectOpts.colors:t.isatty(process.stderr.fd)}function i(f){const{namespace:d,useColors:m}=this;if(m){const p=this.color,g="\x1B[3"+(p<8?p:"8;5;"+p),y=` ${g};1m${d} \x1B[0m`;f[0]=y+f[0].split(`
|
|
1
|
+
var Ya=Object.defineProperty;var Va=(s,e,t)=>e in s?Ya(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t;var v=(s,e,t)=>(Va(s,typeof e!="symbol"?e+"":e,t),t);var Zt,es,ts,ss,ns,rs,is,os,ve,Ge,Le,as,Me,ke,ls,cs,us,fs,hs,ps,ds,gs,ms;import*as cn from"tty";import Mr from"tty";import un,{format as za}from"util";import bs,{EOL as Oe}from"os";import{inspect as Fr}from"node:util";import{StringDecoder as Qa}from"string_decoder";import{Writable as Xa,Readable as Ja}from"stream";import{randomUUID as Za}from"crypto";import H from"node:path";import{execa as Dr,execaCommand as el}from"execa";import fn from"path";import{EOL as tl}from"node:os";import{Writable as sl}from"node:stream";import De from"node:fs/promises";import nl from"child_process";import rl from"events";import{pathToFileURL as il}from"node:url";import{createRequire as ol}from"node:module";import{constants as xr}from"node:fs";var al=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function nt(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}var hn={exports:{}},ws={exports:{}},pn,Hr;function ll(){if(Hr)return pn;Hr=1;var s=1e3,e=s*60,t=e*60,n=t*24,r=n*7,i=n*365.25;pn=function(f,u){u=u||{};var h=typeof f;if(h==="string"&&f.length>0)return o(f);if(h==="number"&&isFinite(f))return u.long?l(f):a(f);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(f))};function o(f){if(f=String(f),!(f.length>100)){var u=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(f);if(u){var h=parseFloat(u[1]),d=(u[2]||"ms").toLowerCase();switch(d){case"years":case"year":case"yrs":case"yr":case"y":return h*i;case"weeks":case"week":case"w":return h*r;case"days":case"day":case"d":return h*n;case"hours":case"hour":case"hrs":case"hr":case"h":return h*t;case"minutes":case"minute":case"mins":case"min":case"m":return h*e;case"seconds":case"second":case"secs":case"sec":case"s":return h*s;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return h;default:return}}}}function a(f){var u=Math.abs(f);return u>=n?Math.round(f/n)+"d":u>=t?Math.round(f/t)+"h":u>=e?Math.round(f/e)+"m":u>=s?Math.round(f/s)+"s":f+"ms"}function l(f){var u=Math.abs(f);return u>=n?c(f,u,n,"day"):u>=t?c(f,u,t,"hour"):u>=e?c(f,u,e,"minute"):u>=s?c(f,u,s,"second"):f+" ms"}function c(f,u,h,d){var m=u>=h*1.5;return Math.round(f/h)+" "+d+(m?"s":"")}return pn}var dn,Ur;function jr(){if(Ur)return dn;Ur=1;function s(e){n.debug=n,n.default=n,n.coerce=c,n.disable=o,n.enable=i,n.enabled=a,n.humanize=ll(),n.destroy=f,Object.keys(e).forEach(u=>{n[u]=e[u]}),n.names=[],n.skips=[],n.formatters={};function t(u){let h=0;for(let d=0;d<u.length;d++)h=(h<<5)-h+u.charCodeAt(d),h|=0;return n.colors[Math.abs(h)%n.colors.length]}n.selectColor=t;function n(u){let h,d=null,m,p;function g(...y){if(!g.enabled)return;const S=g,A=Number(new Date),L=A-(h||A);S.diff=L,S.prev=h,S.curr=A,h=A,y[0]=n.coerce(y[0]),typeof y[0]!="string"&&y.unshift("%O");let R=0;y[0]=y[0].replace(/%([a-zA-Z%])/g,(I,_)=>{if(I==="%%")return"%";R++;const k=n.formatters[_];if(typeof k=="function"){const j=y[R];I=k.call(S,j),y.splice(R,1),R--}return I}),n.formatArgs.call(S,y),(S.log||n.log).apply(S,y)}return g.namespace=u,g.useColors=n.useColors(),g.color=n.selectColor(u),g.extend=r,g.destroy=n.destroy,Object.defineProperty(g,"enabled",{enumerable:!0,configurable:!1,get:()=>d!==null?d:(m!==n.namespaces&&(m=n.namespaces,p=n.enabled(u)),p),set:y=>{d=y}}),typeof n.init=="function"&&n.init(g),g}function r(u,h){const d=n(this.namespace+(typeof h>"u"?":":h)+u);return d.log=this.log,d}function i(u){n.save(u),n.namespaces=u,n.names=[],n.skips=[];let h;const d=(typeof u=="string"?u:"").split(/[\s,]+/),m=d.length;for(h=0;h<m;h++)d[h]&&(u=d[h].replace(/\*/g,".*?"),u[0]==="-"?n.skips.push(new RegExp("^"+u.slice(1)+"$")):n.names.push(new RegExp("^"+u+"$")))}function o(){const u=[...n.names.map(l),...n.skips.map(l).map(h=>"-"+h)].join(",");return n.enable(""),u}function a(u){if(u[u.length-1]==="*")return!0;let h,d;for(h=0,d=n.skips.length;h<d;h++)if(n.skips[h].test(u))return!1;for(h=0,d=n.names.length;h<d;h++)if(n.names[h].test(u))return!0;return!1}function l(u){return u.toString().substring(2,u.toString().length-2).replace(/\.\*\?$/,"*")}function c(u){return u instanceof Error?u.stack||u.message:u}function f(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return n.enable(n.load()),n}return dn=s,dn}var Kr;function cl(){return Kr||(Kr=1,function(s,e){e.formatArgs=n,e.save=r,e.load=i,e.useColors=t,e.storage=o(),e.destroy=(()=>{let l=!1;return()=>{l||(l=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),e.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function t(){return typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs)?!0:typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)?!1:typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function n(l){if(l[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+l[0]+(this.useColors?"%c ":" ")+"+"+s.exports.humanize(this.diff),!this.useColors)return;const c="color: "+this.color;l.splice(1,0,c,"color: inherit");let f=0,u=0;l[0].replace(/%[a-zA-Z%]/g,h=>{h!=="%%"&&(f++,h==="%c"&&(u=f))}),l.splice(u,0,c)}e.log=console.debug||console.log||(()=>{});function r(l){try{l?e.storage.setItem("debug",l):e.storage.removeItem("debug")}catch{}}function i(){let l;try{l=e.storage.getItem("debug")}catch{}return!l&&typeof process<"u"&&"env"in process&&(l=process.env.DEBUG),l}function o(){try{return localStorage}catch{}}s.exports=jr()(e);const{formatters:a}=s.exports;a.j=function(l){try{return JSON.stringify(l)}catch(c){return"[UnexpectedJSONParseError]: "+c.message}}}(ws,ws.exports)),ws.exports}var Es={exports:{}},gn,Gr;function ul(){return Gr||(Gr=1,gn=(s,e=process.argv)=>{const t=s.startsWith("-")?"":s.length===1?"-":"--",n=e.indexOf(t+s),r=e.indexOf("--");return n!==-1&&(r===-1||n<r)}),gn}var mn,qr;function fl(){if(qr)return mn;qr=1;const s=bs,e=Mr,t=ul(),{env:n}=process;let r;t("no-color")||t("no-colors")||t("color=false")||t("color=never")?r=0:(t("color")||t("colors")||t("color=true")||t("color=always"))&&(r=1),"FORCE_COLOR"in n&&(n.FORCE_COLOR==="true"?r=1:n.FORCE_COLOR==="false"?r=0:r=n.FORCE_COLOR.length===0?1:Math.min(parseInt(n.FORCE_COLOR,10),3));function i(l){return l===0?!1:{level:l,hasBasic:!0,has256:l>=2,has16m:l>=3}}function o(l,c){if(r===0)return 0;if(t("color=16m")||t("color=full")||t("color=truecolor"))return 3;if(t("color=256"))return 2;if(l&&!c&&r===void 0)return 0;const f=r||0;if(n.TERM==="dumb")return f;if(process.platform==="win32"){const u=s.release().split(".");return Number(u[0])>=10&&Number(u[2])>=10586?Number(u[2])>=14931?3:2:1}if("CI"in n)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some(u=>u in n)||n.CI_NAME==="codeship"?1:f;if("TEAMCITY_VERSION"in n)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(n.TEAMCITY_VERSION)?1:0;if(n.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in n){const u=parseInt((n.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(n.TERM_PROGRAM){case"iTerm.app":return u>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(n.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(n.TERM)||"COLORTERM"in n?1:f}function a(l){const c=o(l,l&&l.isTTY);return i(c)}return mn={supportsColor:a,stdout:i(o(!0,e.isatty(1))),stderr:i(o(!0,e.isatty(2)))},mn}var Wr;function hl(){return Wr||(Wr=1,function(s,e){const t=Mr,n=un;e.init=f,e.log=a,e.formatArgs=i,e.save=l,e.load=c,e.useColors=r,e.destroy=n.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."),e.colors=[6,2,3,4,5,1];try{const h=fl();h&&(h.stderr||h).level>=2&&(e.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch{}e.inspectOpts=Object.keys(process.env).filter(h=>/^debug_/i.test(h)).reduce((h,d)=>{const m=d.substring(6).toLowerCase().replace(/_([a-z])/g,(g,y)=>y.toUpperCase());let p=process.env[d];return/^(yes|on|true|enabled)$/i.test(p)?p=!0:/^(no|off|false|disabled)$/i.test(p)?p=!1:p==="null"?p=null:p=Number(p),h[m]=p,h},{});function r(){return"colors"in e.inspectOpts?!!e.inspectOpts.colors:t.isatty(process.stderr.fd)}function i(h){const{namespace:d,useColors:m}=this;if(m){const p=this.color,g="\x1B[3"+(p<8?p:"8;5;"+p),y=` ${g};1m${d} \x1B[0m`;h[0]=y+h[0].split(`
|
|
2
2
|
`).join(`
|
|
3
|
-
`+y),
|
|
4
|
-
`)}function l(
|
|
5
|
-
`).map(d=>d.trim()).join(" ")},u.O=function(
|
|
3
|
+
`+y),h.push(g+"m+"+s.exports.humanize(this.diff)+"\x1B[0m")}else h[0]=o()+d+" "+h[0]}function o(){return e.inspectOpts.hideDate?"":new Date().toISOString()+" "}function a(...h){return process.stderr.write(n.format(...h)+`
|
|
4
|
+
`)}function l(h){h?process.env.DEBUG=h:delete process.env.DEBUG}function c(){return process.env.DEBUG}function f(h){h.inspectOpts={};const d=Object.keys(e.inspectOpts);for(let m=0;m<d.length;m++)h.inspectOpts[d[m]]=e.inspectOpts[d[m]]}s.exports=jr()(e);const{formatters:u}=s.exports;u.o=function(h){return this.inspectOpts.colors=this.useColors,n.inspect(h,this.inspectOpts).split(`
|
|
5
|
+
`).map(d=>d.trim()).join(" ")},u.O=function(h){return this.inspectOpts.colors=this.useColors,n.inspect(h,this.inspectOpts)}}(Es,Es.exports)),Es.exports}typeof process>"u"||process.type==="renderer"||process.browser===!0||process.__nwjs?hn.exports=cl():hn.exports=hl();var pl=hn.exports;const oe=nt(pl),yn=10,Yr=(s=0)=>e=>`\x1B[${e+s}m`,Vr=(s=0)=>e=>`\x1B[${38+s};5;${e}m`,zr=(s=0)=>(e,t,n)=>`\x1B[${38+s};2;${e};${t};${n}m`,V={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(V.modifier);const dl=Object.keys(V.color),gl=Object.keys(V.bgColor);[...dl,...gl];function ml(){const s=new Map;for(const[e,t]of Object.entries(V)){for(const[n,r]of Object.entries(t))V[n]={open:`\x1B[${r[0]}m`,close:`\x1B[${r[1]}m`},t[n]=V[n],s.set(r[0],r[1]);Object.defineProperty(V,e,{value:t,enumerable:!1})}return Object.defineProperty(V,"codes",{value:s,enumerable:!1}),V.color.close="\x1B[39m",V.bgColor.close="\x1B[49m",V.color.ansi=Yr(),V.color.ansi256=Vr(),V.color.ansi16m=zr(),V.bgColor.ansi=Yr(yn),V.bgColor.ansi256=Vr(yn),V.bgColor.ansi16m=zr(yn),Object.defineProperties(V,{rgbToAnsi256:{value(e,t,n){return 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){const 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(i=>i+i).join(""));const r=Number.parseInt(n,16);return[r>>16&255,r>>8&255,r&255]},enumerable:!1},hexToAnsi256:{value:e=>V.rgbToAnsi256(...V.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;const a=e%36;t=Math.floor(e/36)/5,n=Math.floor(a/6)/5,r=a%6/5}const i=Math.max(t,n,r)*2;if(i===0)return 30;let o=30+(Math.round(r)<<2|Math.round(n)<<1|Math.round(t));return i===2&&(o+=60),o},enumerable:!1},rgbToAnsi:{value:(e,t,n)=>V.ansi256ToAnsi(V.rgbToAnsi256(e,t,n)),enumerable:!1},hexToAnsi:{value:e=>V.ansi256ToAnsi(V.hexToAnsi256(e)),enumerable:!1}}),V}const Ce=ml(),Ss=(()=>{if(navigator.userAgentData){const s=navigator.userAgentData.brands.find(({brand:e})=>e==="Chromium");if(s&&s.version>93)return 3}return/\b(Chrome|Chromium)\//.test(navigator.userAgent)?1:0})(),Qr=Ss!==0&&{level:Ss,hasBasic:!0,has256:Ss>=2,has16m:Ss>=3},yl={stdout:Qr,stderr:Qr};function bl(s,e,t){let n=s.indexOf(e);if(n===-1)return s;const r=e.length;let i=0,o="";do o+=s.slice(i,n)+e+t,i=n+r,n=s.indexOf(e,i);while(n!==-1);return o+=s.slice(i),o}function wl(s,e,t,n){let r=0,i="";do{const o=s[n-1]==="\r";i+=s.slice(r,o?n-1:n)+e+(o?`\r
|
|
6
6
|
`:`
|
|
7
7
|
`)+t,r=n+1,n=s.indexOf(`
|
|
8
|
-
`,r)}while(n!==-1);return i+=s.slice(r),i}const{stdout:
|
|
9
|
-
`);return i!==-1&&(e=wl(e,r,n,i)),n+e+r};Object.defineProperties(Nt.prototype,it);const Rl=Nt();Nt({level:Xr?Xr.level:0});const q=Rl;var Zr={exports:{}};(function(s){var e=Object.prototype.hasOwnProperty,t="~";function n(){}Object.create&&(n.prototype=Object.create(null),new n().__proto__||(t=!1));function r(l,c,h){this.fn=l,this.context=c,this.once=h||!1}function i(l,c,h,u,f){if(typeof h!="function")throw new TypeError("The listener must be a function");var d=new r(h,u||l,f),m=t?t+c:c;return l._events[m]?l._events[m].fn?l._events[m]=[l._events[m],d]:l._events[m].push(d):(l._events[m]=d,l._eventsCount++),l}function o(l,c){--l._eventsCount===0?l._events=new n:delete l._events[c]}function a(){this._events=new n,this._eventsCount=0}a.prototype.eventNames=function(){var c=[],h,u;if(this._eventsCount===0)return c;for(u in h=this._events)e.call(h,u)&&c.push(t?u.slice(1):u);return Object.getOwnPropertySymbols?c.concat(Object.getOwnPropertySymbols(h)):c},a.prototype.listeners=function(c){var h=t?t+c:c,u=this._events[h];if(!u)return[];if(u.fn)return[u.fn];for(var f=0,d=u.length,m=new Array(d);f<d;f++)m[f]=u[f].fn;return m},a.prototype.listenerCount=function(c){var h=t?t+c:c,u=this._events[h];return u?u.fn?1:u.length:0},a.prototype.emit=function(c,h,u,f,d,m){var p=t?t+c:c;if(!this._events[p])return!1;var g=this._events[p],y=arguments.length,S,A;if(g.fn){switch(g.once&&this.removeListener(c,g.fn,void 0,!0),y){case 1:return g.fn.call(g.context),!0;case 2:return g.fn.call(g.context,h),!0;case 3:return g.fn.call(g.context,h,u),!0;case 4:return g.fn.call(g.context,h,u,f),!0;case 5:return g.fn.call(g.context,h,u,f,d),!0;case 6:return g.fn.call(g.context,h,u,f,d,m),!0}for(A=1,S=new Array(y-1);A<y;A++)S[A-1]=arguments[A];g.fn.apply(g.context,S)}else{var L=g.length,R;for(A=0;A<L;A++)switch(g[A].once&&this.removeListener(c,g[A].fn,void 0,!0),y){case 1:g[A].fn.call(g[A].context);break;case 2:g[A].fn.call(g[A].context,h);break;case 3:g[A].fn.call(g[A].context,h,u);break;case 4:g[A].fn.call(g[A].context,h,u,f);break;default:if(!S)for(R=1,S=new Array(y-1);R<y;R++)S[R-1]=arguments[R];g[A].fn.apply(g[A].context,S)}}return!0},a.prototype.on=function(c,h,u){return i(this,c,h,u,!1)},a.prototype.once=function(c,h,u){return i(this,c,h,u,!0)},a.prototype.removeListener=function(c,h,u,f){var d=t?t+c:c;if(!this._events[d])return this;if(!h)return o(this,d),this;var m=this._events[d];if(m.fn)m.fn===h&&(!f||m.once)&&(!u||m.context===u)&&o(this,d);else{for(var p=0,g=[],y=m.length;p<y;p++)(m[p].fn!==h||f&&!m[p].once||u&&m[p].context!==u)&&g.push(m[p]);g.length?this._events[d]=g.length===1?g[0]:g:o(this,d)}return this},a.prototype.removeAllListeners=function(c){var h;return c?(h=t?t+c:c,this._events[h]&&o(this,h)):(this._events=new n,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=t,a.EventEmitter=a,s.exports=a})(Zr);var Tl=Zr.exports;const _l=nt(Tl),{env:xe={},argv:ei=[],platform:vl=""}=typeof process>"u"?{}:process,Ll="NO_COLOR"in xe||ei.includes("--no-color"),kl="FORCE_COLOR"in xe||ei.includes("--color"),$l=vl==="win32",ti=xe.TERM==="dumb",Il=cn&&cn.isatty&&cn.isatty(1)&&xe.TERM&&!ti,Nl="CI"in xe&&("GITHUB_ACTIONS"in xe||"GITLAB_CI"in xe||"CIRCLECI"in xe),Pl=!Ll&&(kl||$l&&!ti||Il||Nl),si=(s,e,t,n,r=e.substring(0,s)+n,i=e.substring(s+t.length),o=i.indexOf(t))=>r+(o<0?i:si(o,i,t,n)),Bl=(s,e,t,n,r)=>s<0?t+e+n:t+si(s,e,n,r)+n,Ml=(s,e,t=s,n=s.length+1)=>r=>r||!(r===""||r===void 0)?Bl((""+r).indexOf(e,n),r,s,e,t):"",P=(s,e,t)=>Ml(`\x1B[${s}m`,`\x1B[${e}m`,t),ni={reset:P(0,0),bold:P(1,22,"\x1B[22m\x1B[1m"),dim:P(2,22,"\x1B[22m\x1B[2m"),italic:P(3,23),underline:P(4,24),inverse:P(7,27),hidden:P(8,28),strikethrough:P(9,29),black:P(30,39),red:P(31,39),green:P(32,39),yellow:P(33,39),blue:P(34,39),magenta:P(35,39),cyan:P(36,39),white:P(37,39),gray:P(90,39),bgBlack:P(40,49),bgRed:P(41,49),bgGreen:P(42,49),bgYellow:P(43,49),bgBlue:P(44,49),bgMagenta:P(45,49),bgCyan:P(46,49),bgWhite:P(47,49),blackBright:P(90,39),redBright:P(91,39),greenBright:P(92,39),yellowBright:P(93,39),blueBright:P(94,39),magentaBright:P(95,39),cyanBright:P(96,39),whiteBright:P(97,39),bgBlackBright:P(100,49),bgRedBright:P(101,49),bgGreenBright:P(102,49),bgYellowBright:P(103,49),bgBlueBright:P(104,49),bgMagentaBright:P(105,49),bgCyanBright:P(106,49),bgWhiteBright:P(107,49)},ri=({useColor:s=Pl}={})=>s?ni:Object.keys(ni).reduce((e,t)=>({...e,[t]:String}),{});ri();var Dl=Fl;function ot(s){return s instanceof Buffer?Buffer.from(s):new s.constructor(s.buffer.slice(),s.byteOffset,s.length)}function Fl(s){if(s=s||{},s.circles)return xl(s);return s.proto?n:t;function e(r,i){for(var o=Object.keys(r),a=new Array(o.length),l=0;l<o.length;l++){var c=o[l],h=r[c];typeof h!="object"||h===null?a[c]=h:h instanceof Date?a[c]=new Date(h):ArrayBuffer.isView(h)?a[c]=ot(h):a[c]=i(h)}return a}function t(r){if(typeof r!="object"||r===null)return r;if(r instanceof Date)return new Date(r);if(Array.isArray(r))return e(r,t);if(r instanceof Map)return new Map(e(Array.from(r),t));if(r instanceof Set)return new Set(e(Array.from(r),t));var i={};for(var o in r)if(Object.hasOwnProperty.call(r,o)!==!1){var a=r[o];typeof a!="object"||a===null?i[o]=a:a instanceof Date?i[o]=new Date(a):a instanceof Map?i[o]=new Map(e(Array.from(a),t)):a instanceof Set?i[o]=new Set(e(Array.from(a),t)):ArrayBuffer.isView(a)?i[o]=ot(a):i[o]=t(a)}return i}function n(r){if(typeof r!="object"||r===null)return r;if(r instanceof Date)return new Date(r);if(Array.isArray(r))return e(r,n);if(r instanceof Map)return new Map(e(Array.from(r),n));if(r instanceof Set)return new Set(e(Array.from(r),n));var i={};for(var o in r){var a=r[o];typeof a!="object"||a===null?i[o]=a:a instanceof Date?i[o]=new Date(a):a instanceof Map?i[o]=new Map(e(Array.from(a),n)):a instanceof Set?i[o]=new Set(e(Array.from(a),n)):ArrayBuffer.isView(a)?i[o]=ot(a):i[o]=n(a)}return i}}function xl(s){var e=[],t=[];return s.proto?i:r;function n(o,a){for(var l=Object.keys(o),c=new Array(l.length),h=0;h<l.length;h++){var u=l[h],f=o[u];if(typeof f!="object"||f===null)c[u]=f;else if(f instanceof Date)c[u]=new Date(f);else if(ArrayBuffer.isView(f))c[u]=ot(f);else{var d=e.indexOf(f);d!==-1?c[u]=t[d]:c[u]=a(f)}}return c}function r(o){if(typeof o!="object"||o===null)return o;if(o instanceof Date)return new Date(o);if(Array.isArray(o))return n(o,r);if(o instanceof Map)return new Map(n(Array.from(o),r));if(o instanceof Set)return new Set(n(Array.from(o),r));var a={};e.push(o),t.push(a);for(var l in o)if(Object.hasOwnProperty.call(o,l)!==!1){var c=o[l];if(typeof c!="object"||c===null)a[l]=c;else if(c instanceof Date)a[l]=new Date(c);else if(c instanceof Map)a[l]=new Map(n(Array.from(c),r));else if(c instanceof Set)a[l]=new Set(n(Array.from(c),r));else if(ArrayBuffer.isView(c))a[l]=ot(c);else{var h=e.indexOf(c);h!==-1?a[l]=t[h]:a[l]=r(c)}}return e.pop(),t.pop(),a}function i(o){if(typeof o!="object"||o===null)return o;if(o instanceof Date)return new Date(o);if(Array.isArray(o))return n(o,i);if(o instanceof Map)return new Map(n(Array.from(o),i));if(o instanceof Set)return new Set(n(Array.from(o),i));var a={};e.push(o),t.push(a);for(var l in o){var c=o[l];if(typeof c!="object"||c===null)a[l]=c;else if(c instanceof Date)a[l]=new Date(c);else if(c instanceof Map)a[l]=new Map(n(Array.from(c),i));else if(c instanceof Set)a[l]=new Set(n(Array.from(c),i));else if(ArrayBuffer.isView(c))a[l]=ot(c);else{var h=e.indexOf(c);h!==-1?a[l]=t[h]:a[l]=i(c)}}return e.pop(),t.pop(),a}}const Hl=nt(Dl);var Ul=Object.defineProperty,B=(s,e)=>Ul(s,"name",{value:e,configurable:!0}),ii="\x1B[",oi={CURSOR_HIDE:ii+"?25l",CURSOR_SHOW:ii+"?25h"},ai=(s=>(s.WAITING="WAITING",s.STARTED="STARTED",s.COMPLETED="COMPLETED",s.FAILED="FAILED",s.SKIPPED="SKIPPED",s.ROLLING_BACK="ROLLING_BACK",s.ROLLED_BACK="ROLLED_BACK",s.RETRY="RETRY",s.PAUSED="PAUSED",s.PROMPT="PROMPT",s.PROMPT_COMPLETED="PROMPT_COMPLETED",s.PROMPT_FAILED="PROMPT_FAILED",s))(ai||{}),li=(Zt=class{constructor(){v(this,"emitter",new _l)}emit(e,t){this.emitter.emit(e,t)}on(e,t){this.emitter.addListener(e,t)}once(e,t){this.emitter.once(e,t)}off(e,t){this.emitter.off(e,t)}complete(){this.emitter.removeAllListeners()}},B(Zt,"EventManager"),Zt);es=class{},B(es,"BaseEventMap");function ci(s){return!!s&&typeof s.lift=="function"&&typeof s.subscribe=="function"}B(ci,"isObservable");function Sn(){return!!process.env.LISTR_FORCE_UNICODE||process.platform!=="win32"||!!process.env.CI||!!process.env.WT_SESSION||process.env.TERM_PROGRAM==="vscode"||process.env.TERM==="xterm-256color"||process.env.TERM==="alacritty"}B(Sn,"isUnicodeSupported");var jl="(?:\\u001b|\\u009b)\\[[\\=><~/#&.:=?%@~_-]*[0-9]*[\\a-ln-tqyz=><~/#&.:=?%@~_-]+",Kl=/\u0007/;function at(s){return String(s).replace(new RegExp(jl,"gmi"),"").replace(new RegExp(Kl,"gmi"),"").trim()}B(at,"cleanseAnsi");var K=ri();function An(s,e){return s.replace(/^(?!\s*$)/gm," ".repeat(e))}B(An,"indent");var ui={warning:"\u26A0",cross:"\u2716",arrowDown:"\u2193",tick:"\u2714",arrowRight:"\u2192",pointer:"\u276F",checkboxOn:"\u2612",arrowLeft:"\u2190",squareSmallFilled:"\u25FC",pointerSmall:"\u203A"},Gl={...ui,warning:"\u203C",cross:"\xD7",tick:"\u221A",pointer:">",checkboxOn:"[\xD7]",squareSmallFilled:"\u25A0"},W=Sn()?ui:Gl;function lt(s,...e){return za(String(s),...e)}B(lt,"splat");var Os={icon:{STARTED:W.pointer,FAILED:W.cross,SKIPPED:W.arrowDown,COMPLETED:W.tick,OUTPUT:W.pointerSmall,TITLE:W.arrowRight,RETRY:W.warning,ROLLBACK:W.arrowLeft,PAUSED:W.squareSmallFilled},color:{STARTED:K.yellow,FAILED:K.red,SKIPPED:K.yellow,COMPLETED:K.green,RETRY:K.yellowBright,ROLLBACK:K.redBright,PAUSED:K.yellowBright}},fi=["RETRY","ROLLBACK","FAILED"],Pt=(ts=class{constructor(e){v(this,"process");var t,n,r;this.options=e,this.options={useIcons:!0,toStderr:[],...e??{}},(t=this.options).fields??(t.fields={}),(n=this.options.fields).prefix??(n.prefix=[]),(r=this.options.fields).suffix??(r.suffix=[]),this.process=this.options.processOutput??new pi}log(e,t,n){const r=this.format(e,t,n);if(this.options.toStderr.includes(e)){this.process.toStderr(r);return}this.process.toStdout(r)}toStdout(e,t,n=!0){this.process.toStdout(this.format(null,e,t),n)}toStderr(e,t,n=!0){this.process.toStderr(this.format(null,e,t),n)}wrap(e,t){return e&&this.applyFormat(`[${e}]`,t)}splat(...e){const t=e.shift()??"";return e.length===0?t:lt(t,e)}suffix(e,...t){return t.filter(Boolean).forEach(n=>{if(e+=this.spacing(e),typeof n=="string")e+=this.wrap(n);else if(typeof n=="object"){if(n.args??(n.args=[]),typeof n.condition=="function"?!n.condition(...n.args):!(n.condition??!0))return e;e+=this.wrap(typeof n.field=="function"?n.field(...n.args):n.field,{format:n?.format(...n.args)})}}),e}prefix(e,...t){return t.filter(Boolean).forEach(n=>{if(e=this.spacing(e)+e,typeof n=="string")e=this.wrap(n)+e;else if(typeof n=="object"){if(n.args??(n.args=[]),typeof n.condition=="function"?!n.condition(...n.args):!(n.condition??!0))return e;e=this.wrap(typeof n.field=="function"?n.field(...n.args):n.field,{format:n?.format()})+e}}),e}fields(e,t){return this.options?.fields?.prefix&&(e=this.prefix(e,...this.options.fields.prefix)),t?.prefix&&(e=this.prefix(e,...t.prefix)),t?.suffix&&(e=this.suffix(e,...t.suffix)),this.options?.fields?.suffix&&(e=this.suffix(e,...this.options.fields.suffix)),e}icon(e,t){if(!e)return null;t||(t=this.options.icon?.[e]);const n=this.options.color?.[e];return t&&n&&(t=n(t)),t}format(e,t,n){return Array.isArray(t)||(t=[t]),t=this.splat(t.shift(),...t).toString().split(Oe).filter(r=>!r||r.trim()!=="").map(r=>this.style(e,this.fields(r,{prefix:Array.isArray(n?.prefix)?n.prefix:[n?.prefix],suffix:Array.isArray(n?.suffix)?n.suffix:[n?.suffix]}))).join(Oe),t}style(e,t){if(!e||!t)return t;const n=this.icon(e,!this.options.useIcons&&this.wrap(e));return n&&(t=n+" "+t),t}applyFormat(e,t){return t?.format?t.format(e):e}spacing(e){return typeof e>"u"||e.trim()===""?"":" "}},B(ts,"ListrLogger"),ts),On=(ss=class{constructor(e){v(this,"buffer",[]);v(this,"decoder",new Qa);this.options=e}get all(){return this.buffer}get last(){return this.buffer.at(-1)}get length(){return this.buffer.length}write(e,...t){const n=t[t.length-1];return this.buffer.push({time:Date.now(),stream:this.options?.stream,entry:this.decoder.write(typeof e=="string"?Buffer.from(e,typeof t[0]=="string"?t[0]:void 0):Buffer.from(e))}),this.options?.limit&&(this.buffer=this.buffer.slice(-this.options.limit)),typeof n=="function"&&n(),!0}reset(){this.buffer=[]}},B(ss,"ProcessOutputBuffer"),ss),hi=(ns=class{constructor(e){v(this,"method");v(this,"buffer");this.stream=e,this.method=e.write,this.buffer=new On({stream:e})}get out(){return Object.assign({},this.stream,{write:this.write.bind(this)})}hijack(){this.stream.write=this.buffer.write.bind(this.buffer)}release(){this.stream.write=this.method;const e=[...this.buffer.all];return this.buffer.reset(),e}write(...e){return this.method.apply(this.stream,e)}},B(ns,"ProcessOutputStream"),ns),pi=(rs=class{constructor(e,t,n){v(this,"stream");v(this,"active");this.options=n,this.stream={stdout:new hi(e??process.stdout),stderr:new hi(t??process.stderr)},this.options={dump:["stdout","stderr"],leaveEmptyLine:!0,...n}}get stdout(){return this.stream.stdout.out}get stderr(){return this.stream.stderr.out}hijack(){if(this.active)throw new Error("ProcessOutput has been already hijacked!");this.stream.stdout.write(oi.CURSOR_HIDE),Object.values(this.stream).forEach(e=>e.hijack()),this.active=!0}release(){const e=Object.entries(this.stream).map(([t,n])=>({name:t,buffer:n.release()})).filter(t=>this.options.dump.includes(t.name)).flatMap(t=>t.buffer).sort((t,n)=>t.time-n.time).map(t=>({...t,entry:at(t.entry)})).filter(t=>t.entry);e.length>0&&(this.options.leaveEmptyLine&&this.stdout.write(Oe),e.forEach(t=>{(t.stream??this.stdout).write(t.entry+Oe)})),this.stream.stdout.write(oi.CURSOR_SHOW),this.active=!1}toStdout(e,t=!0){return t&&(e=e+Oe),this.stream.stdout.write(e)}toStderr(e,t=!0){return t&&(e=e+Oe),this.stream.stderr.write(e)}},B(rs,"ProcessOutput"),rs);function di(s){const e=new Xa;return e.write=t=>(s(t.toString()),!0),e}B(di,"createWritable"),is=class{constructor(e,t){v(this,"state");this.task=e,this.wrapper=t}reportStarted(){if(this.state=this.task.state,this.task.prompt)throw new Si("There is already an active prompt attached to this task which may not be cleaned up properly.");this.task.prompt=this,this.task.state$="PROMPT"}reportFailed(){this.task.state$="PROMPT_FAILED",this.restoreState()}reportCompleted(){this.task.state$="PROMPT_COMPLETED",this.restoreState()}restoreState(){this.task.prompt=void 0,this.state&&(this.task.state=this.state)}},B(is,"ListrPromptAdapter");var ql=(os=class{constructor(){v(this,"spinner",Sn()?["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"]:["-","\\","|","/"]);v(this,"id");v(this,"spinnerPosition",0)}spin(){this.spinnerPosition=++this.spinnerPosition%this.spinner.length}fetch(){return this.spinner[this.spinnerPosition]}isRunning(){return!!this.id}start(e,t=100){this.id=setInterval(()=>{this.spin(),e&&e()},t)}stop(){clearInterval(this.id)}},B(os,"Spinner"),os),gi={icon:{SKIPPED_WITH_COLLAPSE:W.arrowDown,SKIPPED_WITHOUT_COLLAPSE:W.warning,OUTPUT:W.pointerSmall,OUTPUT_WITH_BOTTOMBAR:W.pointerSmall,PENDING:W.pointer,COMPLETED:W.tick,COMPLETED_WITH_FAILED_SUBTASKS:W.warning,COMPLETED_WITH_SISTER_TASKS_FAILED:W.squareSmallFilled,RETRY:W.warning,ROLLING_BACK:W.warning,ROLLED_BACK:W.arrowLeft,FAILED:W.cross,FAILED_WITH_SUBTASKS:W.pointer,WAITING:W.squareSmallFilled,PAUSED:W.squareSmallFilled},color:{SKIPPED_WITH_COLLAPSE:K.yellow,SKIPPED_WITHOUT_COLLAPSE:K.yellow,PENDING:K.yellow,COMPLETED:K.green,COMPLETED_WITH_FAILED_SUBTASKS:K.yellow,COMPLETED_WITH_SISTER_TASKS_FAILED:K.red,RETRY:K.yellowBright,ROLLING_BACK:K.redBright,ROLLED_BACK:K.redBright,FAILED:K.red,FAILED_WITH_SUBTASKS:K.red,WAITING:K.dim,PAUSED:K.yellowBright}};function mi(s){const e=Math.floor(s/1e3),t=Math.floor(e/60);let n;return e===0&&t===0&&(n=`0.${Math.floor(s/100)}s`),e>0&&(n=`${e%60}s`),t>0&&(n=`${t}m${n}`),n}B(mi,"parseTimer");var Cn={condition:!0,field:mi,format:()=>K.dim};function Wl(){const s=new Date;return String(s.getHours()).padStart(2,"0")+":"+String(s.getMinutes()).padStart(2,"0")+":"+String(s.getSeconds()).padStart(2,"0")}B(Wl,"parseTimestamp");var Yl=(ve=class{constructor(e,t,n){v(this,"prompt");v(this,"activePrompt");v(this,"spinner");v(this,"logger");v(this,"updater");v(this,"truncate");v(this,"wrap");v(this,"buffer",{output:new Map,bottom:new Map});v(this,"cache",{render:new Map,rendererOptions:new Map,rendererTaskOptions:new Map});this.tasks=e,this.options=t,this.events=n,this.options={...ve.rendererOptions,...this.options,icon:{...gi.icon,...t?.icon??{}},color:{...gi.color,...t?.color??{}}},this.spinner=this.options.spinner??new ql,this.logger=this.options.logger??new Pt({useIcons:!0,toStderr:[]}),this.logger.options.icon=this.options.icon,this.logger.options.color=this.options.color}async render(){const{createLogUpdate:e}=await import("./index2.mjs"),{default:t}=await import("./index3.mjs"),{default:n}=await import("./index4.mjs");this.updater=e(this.logger.process.stdout),this.truncate=t,this.wrap=n,this.logger.process.hijack(),this.options?.lazy||this.spinner.start(()=>{this.update()}),this.events.on("SHOUD_REFRESH_RENDER",()=>{this.update()})}update(){this.updater(this.create())}end(){this.spinner.stop(),this.updater.clear(),this.updater.done(),this.options.clearOutput||this.logger.process.toStdout(this.create({prompt:!1})),this.logger.process.release()}create(e){e={tasks:!0,bottomBar:!0,prompt:!0,...e};const t=[],n=this.renderer(this.tasks),r=this.renderBottomBar(),i=this.renderPrompt();return e.tasks&&n.length>0&&t.push(...n),e.bottomBar&&r.length>0&&(t.length>0&&t.push(""),t.push(...r)),e.prompt&&i.length>0&&(t.length>0&&t.push(""),t.push(...i)),t.join(Oe)}style(e,t=!1){const n=this.cache.rendererOptions.get(e.id);if(e.isSkipped()){if(t||n.collapseSkips)return this.logger.icon("SKIPPED_WITH_COLLAPSE");if(n.collapseSkips===!1)return this.logger.icon("SKIPPED_WITHOUT_COLLAPSE")}if(t)return this.shouldOutputToBottomBar(e)?this.logger.icon("OUTPUT_WITH_BOTTOMBAR"):this.logger.icon("OUTPUT");if(e.hasSubtasks()){if(e.isStarted()||e.isPrompt()&&n.showSubtasks!==!1&&!e.subtasks.every(r=>!r.hasTitle()))return this.logger.icon("PENDING");if(e.isCompleted()&&e.subtasks.some(r=>r.hasFailed()))return this.logger.icon("COMPLETED_WITH_FAILED_SUBTASKS");if(e.hasFailed())return this.logger.icon("FAILED_WITH_SUBTASKS")}return e.isStarted()||e.isPrompt()?this.logger.icon("PENDING",!this.options?.lazy&&this.spinner.fetch()):e.isCompleted()?this.logger.icon("COMPLETED"):e.isRetrying()?this.logger.icon("RETRY",!this.options?.lazy&&this.spinner.fetch()):e.isRollingBack()?this.logger.icon("ROLLING_BACK",!this.options?.lazy&&this.spinner.fetch()):e.hasRolledBack()?this.logger.icon("ROLLED_BACK"):e.hasFailed()?this.logger.icon("FAILED"):e.isPaused()?this.logger.icon("PAUSED"):this.logger.icon("WAITING")}format(e,t,n){if(e.trim()==="")return[];t&&(e=t+" "+e);let r;const i=(process.stdout.columns??80)-n*this.options.indentation-2;switch(this.options.formatOutput){case"truncate":r=e.split(Oe).map((o,a)=>this.truncate(this.indent(o,a),i));break;case"wrap":r=this.wrap(e,i,{hard:!0}).split(Oe).map((o,a)=>this.indent(o,a));break;default:throw new Ei("Format option for the renderer is wrong.")}return this.options.removeEmptyLines&&(r=r.filter(Boolean)),r.map(o=>An(o,n*this.options.indentation))}shouldOutputToOutputBar(e){const t=this.cache.rendererTaskOptions.get(e.id).outputBar;return typeof t=="number"&&t!==0||typeof t=="boolean"&&t!==!1}shouldOutputToBottomBar(e){const t=this.cache.rendererTaskOptions.get(e.id).bottomBar;return typeof t=="number"&&t!==0||typeof t=="boolean"&&t!==!1||!e.hasTitle()}renderer(e,t=0){return e.flatMap(n=>{if(!n.isEnabled())return[];if(this.cache.render.has(n.id))return this.cache.render.get(n.id);this.calculate(n),this.setupBuffer(n);const r=this.cache.rendererOptions.get(n.id),i=this.cache.rendererTaskOptions.get(n.id),o=[];if(n.isPrompt()){if(this.activePrompt&&this.activePrompt!==n.id)throw new Ei("Only one prompt can be active at the given time, please re-evaluate your task design.");this.activePrompt||(n.on("PROMPT",a=>{const l=at(a);l&&(this.prompt=l)}),n.on("STATE",a=>{(a==="PROMPT_COMPLETED"||n.hasFinalized()||n.hasReset())&&(this.prompt=null,this.activePrompt=null,n.off("PROMPT"))}),this.activePrompt=n.id)}if(n.hasTitle()&&(e.some(a=>a.hasFailed())&&!n.hasFailed()&&n.options.exitOnError!==!1&&!(n.isCompleted()||n.isSkipped())?o.push(...this.format(n.title,this.logger.icon("COMPLETED_WITH_SISTER_TASKS_FAILED"),t)):n.hasFailed()&&r.collapseErrors?o.push(...this.format(!n.hasSubtasks()&&n.message.error&&r.showErrorMessage?n.message.error:n.title,this.style(n),t)):n.isSkipped()&&r.collapseSkips?o.push(...this.format(this.logger.suffix(n.message.skip&&r.showSkipMessage?n.message.skip:n.title,{field:"SKIPPED",condition:r.suffixSkips,format:()=>K.dim}),this.style(n),t)):n.isRetrying()?o.push(...this.format(this.logger.suffix(n.title,{field:`RETRY:${n.message.retry.count}`,format:()=>K.yellow,condition:r.suffixRetries}),this.style(n),t)):n.isCompleted()&&n.hasTitle()&&qe(i.timer?.condition,n.message.duration)?o.push(...this.format(this.logger.suffix(n?.title,{...i.timer,args:[n.message.duration]}),this.style(n),t)):n.isPaused()?o.push(...this.format(this.logger.suffix(n.title,{...r.pausedTimer,args:[n.message.paused-Date.now()]}),this.style(n),t)):o.push(...this.format(n.title,this.style(n),t))),(!n.hasSubtasks()||!r.showSubtasks)&&(n.hasFailed()&&r.collapseErrors===!1&&(r.showErrorMessage||!r.showSubtasks)?o.push(...this.dump(n,t,"FAILED")):n.isSkipped()&&r.collapseSkips===!1&&(r.showSkipMessage||!r.showSubtasks)&&o.push(...this.dump(n,t,"SKIPPED"))),(n.isPending()||i.persistentOutput)&&o.push(...this.renderOutputBar(n,t)),r.showSubtasks!==!1&&n.hasSubtasks()&&(n.isPending()||n.hasFinalized()&&!n.hasTitle()||n.isCompleted()&&r.collapseSubtasks===!1&&!n.subtasks.some(a=>this.cache.rendererOptions.get(a.id)?.collapseSubtasks===!0)||n.subtasks.some(a=>this.cache.rendererOptions.get(a.id)?.collapseSubtasks===!1)||n.subtasks.some(a=>a.hasFailed())||n.subtasks.some(a=>a.hasRolledBack()))){const a=n.hasTitle()?t+1:t,l=this.renderer(n.subtasks,a);o.push(...l)}return n.hasFinalized()&&(i.persistentOutput||(this.buffer.bottom.delete(n.id),this.buffer.output.delete(n.id))),n.isClosed()&&(this.cache.render.set(n.id,o),this.reset(n)),o})}renderOutputBar(e,t){const n=this.buffer.output.get(e.id);return n?n.all.flatMap(r=>this.dump(e,t,"OUTPUT",r.entry)):[]}renderBottomBar(){return this.buffer.bottom.size===0?[]:Array.from(this.buffer.bottom.values()).flatMap(e=>e.all).sort((e,t)=>e.time-t.time).map(e=>e.entry)}renderPrompt(){return this.prompt?[this.prompt]:[]}calculate(e){if(this.cache.rendererOptions.has(e.id)&&this.cache.rendererTaskOptions.has(e.id))return;const t={...this.options,...e.rendererOptions};this.cache.rendererOptions.set(e.id,t),this.cache.rendererTaskOptions.set(e.id,{...ve.rendererTaskOptions,timer:t.timer,...e.rendererTaskOptions})}setupBuffer(e){if(this.buffer.bottom.has(e.id)||this.buffer.output.has(e.id))return;const t=this.cache.rendererTaskOptions.get(e.id);this.shouldOutputToBottomBar(e)&&!this.buffer.bottom.has(e.id)?(this.buffer.bottom.set(e.id,new On({limit:typeof t.bottomBar=="number"?t.bottomBar:1})),e.on("OUTPUT",n=>{const r=this.dump(e,-1,"OUTPUT",n);this.buffer.bottom.get(e.id).write(r.join(Oe))}),e.on("STATE",n=>{switch(n){case"RETRY":this.buffer.bottom.delete(e.id);break}})):this.shouldOutputToOutputBar(e)&&!this.buffer.output.has(e.id)&&(this.buffer.output.set(e.id,new On({limit:typeof t.outputBar=="number"?t.outputBar:1})),e.on("OUTPUT",n=>{this.buffer.output.get(e.id).write(n)}),e.on("STATE",n=>{switch(n){case"RETRY":this.buffer.output.delete(e.id);break}}))}reset(e){this.cache.rendererOptions.delete(e.id),this.cache.rendererTaskOptions.delete(e.id),this.buffer.output.delete(e.id)}dump(e,t,n="OUTPUT",r){if(!r)switch(n){case"OUTPUT":r=e.output;break;case"SKIPPED":r=e.message.skip;break;case"FAILED":r=e.message.error;break}return e.hasTitle()&&n==="FAILED"&&r===e.title||typeof r!="string"?[]:(n==="OUTPUT"&&(r=at(r)),this.format(r,this.style(e,!0),t+1))}indent(e,t){return t>0?An(e.trim(),this.options.indentation):e.trim()}},B(ve,"DefaultRenderer"),v(ve,"nonTTY",!1),v(ve,"rendererOptions",{indentation:2,clearOutput:!1,showSubtasks:!0,collapseSubtasks:!0,collapseSkips:!0,showSkipMessage:!0,suffixSkips:!1,collapseErrors:!0,showErrorMessage:!0,suffixRetries:!0,lazy:!1,removeEmptyLines:!0,formatOutput:"wrap",pausedTimer:{...Cn,format:()=>K.yellowBright}}),v(ve,"rendererTaskOptions",{outputBar:!0}),ve),Vl=(Ge=class{constructor(e,t){this.tasks=e,this.options=t}render(){}end(){}},B(Ge,"SilentRenderer"),v(Ge,"nonTTY",!0),v(Ge,"rendererOptions"),v(Ge,"rendererTaskOptions"),Ge),zl=(Le=class{constructor(e,t){v(this,"logger");v(this,"cache",{rendererOptions:new Map,rendererTaskOptions:new Map});this.tasks=e,this.options=t,this.options={...Le.rendererOptions,...t,icon:{...Os.icon,...t?.icon??{}},color:{...Os.color,...t?.color??{}}},this.logger=this.options.logger??new Pt({useIcons:!0,toStderr:fi}),this.logger.options.icon=this.options.icon,this.logger.options.color=this.options.color,this.options.timestamp&&this.logger.options.fields.prefix.unshift(this.options.timestamp)}end(){this.logger.process.release()}render(){this.renderer(this.tasks)}renderer(e){e.forEach(t=>{this.calculate(t),t.once("CLOSED",()=>{this.reset(t)});const n=this.cache.rendererOptions.get(t.id),r=this.cache.rendererTaskOptions.get(t.id);t.on("SUBTASK",i=>{this.renderer(i)}),t.on("STATE",i=>{if(t.hasTitle())if(i==="STARTED")this.logger.log("STARTED",t.title);else if(i==="COMPLETED"){const o=r?.timer;this.logger.log("COMPLETED",t.title,o&&{suffix:{...o,condition:!!t.message?.duration&&o.condition,args:[t.message.duration]}})}else i==="PROMPT"?(this.logger.process.hijack(),t.on("PROMPT",o=>{this.logger.process.toStderr(o,!1)})):i==="PROMPT_COMPLETED"&&(t.off("PROMPT"),this.logger.process.release())}),t.on("OUTPUT",i=>{this.logger.log("OUTPUT",i)}),t.on("MESSAGE",i=>{if(i.error)this.logger.log("FAILED",t.title,{suffix:{field:`FAILED: ${i.error}`,format:()=>K.red}});else if(i.skip)this.logger.log("SKIPPED",t.title,{suffix:{field:`SKIPPED: ${i.skip}`,format:()=>K.yellow}});else if(i.rollback)this.logger.log("ROLLBACK",t.title,{suffix:{field:`ROLLBACK: ${i.rollback}`,format:()=>K.red}});else if(i.retry)this.logger.log("RETRY",t.title,{suffix:{field:`RETRY:${i.retry.count}`,format:()=>K.red}});else if(i.paused){const o=n?.pausedTimer;this.logger.log("PAUSED",t.title,o&&{suffix:{...o,condition:!!i?.paused&&o.condition,args:[i.paused-Date.now()]}})}})})}calculate(e){if(this.cache.rendererOptions.has(e.id)&&this.cache.rendererTaskOptions.has(e.id))return;const t={...this.options,...e.rendererOptions};this.cache.rendererOptions.set(e.id,t),this.cache.rendererTaskOptions.set(e.id,{...Le.rendererTaskOptions,timer:t.timer,...e.rendererTaskOptions})}reset(e){this.cache.rendererOptions.delete(e.id),this.cache.rendererTaskOptions.delete(e.id)}},B(Le,"SimpleRenderer"),v(Le,"nonTTY",!0),v(Le,"rendererOptions",{pausedTimer:{...Cn,field:e=>`PAUSED:${e}`,format:()=>K.yellowBright}}),v(Le,"rendererTaskOptions",{}),Le),Ql=(as=class{constructor(e){this.options=e}serialize(e,t,n){return JSON.stringify(this.generate(e,t,n))}generate(e,t,n){const r={event:e,data:t};if(typeof this.options?.task!="boolean"){const i=Object.fromEntries(this.options.task.map(o=>{const a=n[o];return typeof a=="function"?[o,a.call(n)]:[o,a]}));Object.keys(n).length>0&&(r.task=i)}return r}},B(as,"TestRendererSerializer"),as),Xl=(Me=class{constructor(e,t){v(this,"logger");v(this,"serializer");this.tasks=e,this.options=t,this.options={...Me.rendererOptions,...this.options},this.logger=this.options.logger??new Pt({useIcons:!1}),this.serializer=new Ql(this.options)}render(){this.renderer(this.tasks)}end(){}renderer(e){e.forEach(t=>{this.options.subtasks&&t.on("SUBTASK",n=>{this.renderer(n)}),this.options.state&&t.on("STATE",n=>{this.logger.toStdout(this.serializer.serialize("STATE",n,t))}),this.options.output&&t.on("OUTPUT",n=>{this.logger.toStdout(this.serializer.serialize("OUTPUT",n,t))}),this.options.prompt&&t.on("PROMPT",n=>{this.logger.toStdout(this.serializer.serialize("PROMPT",n,t))}),this.options.title&&t.on("TITLE",n=>{this.logger.toStdout(this.serializer.serialize("TITLE",n,t))}),t.on("MESSAGE",n=>{const r=Object.fromEntries(Object.entries(n).map(([i,o])=>{if(this.options.messages.includes(i))return[i,o]}).filter(Boolean));if(Object.keys(r).length>0){const i=this.serializer.serialize("MESSAGE",r,t);this.options.messagesToStderr.some(o=>Object.keys(r).includes(o))?this.logger.toStderr(i):this.logger.toStdout(i)}})})}},B(Me,"TestRenderer"),v(Me,"nonTTY",!0),v(Me,"rendererOptions",{subtasks:!0,state:Object.values(ai),output:!0,prompt:!0,title:!0,messages:["skip","error","retry","rollback","paused"],messagesToStderr:["error","rollback","retry"],task:["hasRolledBack","isRollingBack","isCompleted","isSkipped","hasFinalized","hasSubtasks","title","hasReset","hasTitle","isPrompt","isPaused","isPending","isSkipped","isStarted","hasFailed","isEnabled","isRetrying","path"]}),v(Me,"rendererTaskOptions"),Me),Jl=(ke=class{constructor(e,t){v(this,"logger");v(this,"cache",{rendererOptions:new Map,rendererTaskOptions:new Map});this.tasks=e,this.options=t,this.options={...ke.rendererOptions,...this.options,icon:{...Os.icon,...t?.icon??{}},color:{...Os.color,...t?.color??{}}},this.logger=this.options.logger??new Pt({useIcons:!1,toStderr:fi}),this.logger.options.icon=this.options.icon,this.logger.options.color=this.options.color,this.options.timestamp&&this.logger.options.fields.prefix.unshift(this.options.timestamp)}render(){this.renderer(this.tasks)}end(){}renderer(e){e.forEach(t=>{this.calculate(t),t.once("CLOSED",()=>{this.reset(t)});const n=this.cache.rendererOptions.get(t.id),r=this.cache.rendererTaskOptions.get(t.id);t.on("SUBTASK",i=>{this.renderer(i)}),t.on("STATE",i=>{if(t.hasTitle()){if(i==="STARTED")this.logger.log("STARTED",t.title);else if(i==="COMPLETED"){const o=r.timer;this.logger.log("COMPLETED",t.title,o&&{suffix:{...o,condition:!!t.message?.duration&&o.condition,args:[t.message.duration]}})}}}),t.on("OUTPUT",i=>{this.logger.log("OUTPUT",i)}),t.on("PROMPT",i=>{const o=at(i);o&&this.logger.log("PROMPT",o)}),this.options?.logTitleChange!==!1&&t.on("TITLE",i=>{this.logger.log("TITLE",i)}),t.on("MESSAGE",i=>{if(i?.error)this.logger.log("FAILED",i.error);else if(i?.skip)this.logger.log("SKIPPED",i.skip);else if(i?.rollback)this.logger.log("ROLLBACK",i.rollback);else if(i?.retry)this.logger.log("RETRY",t.title,{suffix:i.retry.count.toString()});else if(i?.paused){const o=n?.pausedTimer;this.logger.log("PAUSED",t.title,o&&{suffix:{...o,condition:!!i?.paused&&o.condition,args:[i.paused-Date.now()]}})}})})}calculate(e){if(this.cache.rendererOptions.has(e.id)&&this.cache.rendererTaskOptions.has(e.id))return;const t={...this.options,...e.rendererOptions};this.cache.rendererOptions.set(e.id,t),this.cache.rendererTaskOptions.set(e.id,{...ke.rendererTaskOptions,timer:t.timer,...e.rendererTaskOptions})}reset(e){this.cache.rendererOptions.delete(e.id),this.cache.rendererTaskOptions.delete(e.id)}},B(ke,"VerboseRenderer"),v(ke,"nonTTY",!0),v(ke,"rendererOptions",{logTitleChange:!1,pausedTimer:{...Cn,format:()=>K.yellowBright}}),v(ke,"rendererTaskOptions"),ke),Rn={default:Yl,simple:zl,verbose:Jl,test:Xl,silent:Vl};function yi(s){return process.stdout.isTTY===!0||s.nonTTY===!0}B(yi,"isRendererSupported");function Bt(s){return typeof s=="string"?Rn[s]??Rn.default:typeof s=="function"?s:Rn.default}B(Bt,"getRendererClass");function bi(s){if(qe(s?.silentRendererCondition))return{renderer:Bt("silent"),selection:"SILENT"};const e={renderer:Bt(s.renderer),options:s.rendererOptions,selection:"PRIMARY"};return!yi(e.renderer)||qe(s?.fallbackRendererCondition)?{renderer:Bt(s.fallbackRenderer),options:s.fallbackRendererOptions,selection:"SECONDARY"}:e}B(bi,"getRenderer");function qe(s,...e){return typeof s=="function"?s(...e):s}B(qe,"assertFunctionOrSelf");var Zl=Hl({circles:!0});function Tn(s){return Zl(s)}B(Tn,"cloneObject");var ec=(ls=class{constructor(e){v(this,"concurrency");v(this,"count");v(this,"queue");this.concurrency=e.concurrency,this.count=0,this.queue=new Set}add(e){return this.count<this.concurrency?this.run(e):new Promise(t=>{const n=B(()=>t(this.run(e)),"callback");this.queue.add(n)})}flush(){for(const e of this.queue){if(this.count>=this.concurrency)break;this.queue.delete(e),e()}}run(e){this.count++;const t=e(),n=B(()=>{this.count--,this.flush()},"cleanup");return t.then(n,()=>{this.queue.clear()}),t}},B(ls,"Concurrency"),ls);function wi(s){return new Promise(e=>{setTimeout(e,s)})}B(wi,"delay");var tc=(cs=class extends Error{constructor(t,n,r){super(t.message);v(this,"path");v(this,"ctx");this.error=t,this.type=n,this.task=r,this.name="ListrError",this.path=r.path,r?.options.collectErrors==="full"&&(this.task=Tn(r),this.ctx=Tn(r.listr.ctx)),this.stack=t?.stack}},B(cs,"ListrError"),cs),Ei=(us=class extends Error{},B(us,"ListrRendererError"),us),Si=(fs=class extends Error{},B(fs,"PromptError"),fs),sc=(hs=class{constructor(e){this.task=e}get title(){return this.task.title}set title(e){e=Array.isArray(e)?e:[e],this.task.title$=lt(e.shift(),...e)}get output(){return this.task.output}set output(e){e=Array.isArray(e)?e:[e],this.task.output$=lt(e.shift(),...e)}set promptOutput(e){this.task.promptOutput$=e}newListr(e,t){let n;return typeof e=="function"?n=e(this):n=e,new _n(n,t,this.task)}report(e,t){this.task.options.collectErrors!==!1&&this.task.listr.errors.push(new tc(e,t,this.task)),this.task.message$={error:e.message??this.task?.title}}skip(e,...t){this.task.state$="SKIPPED",e&&(this.task.message$={skip:e?lt(e,...t):this.task?.title})}isRetrying(){return this.task.isRetrying()?this.task.retry:{count:0}}prompt(e){return this.task.prompt?this.task.prompt:new e(this.task,this)}stdout(e){return di(t=>{switch(e){case"PROMPT":this.promptOutput=t;break;default:this.output=t}})}run(e){return this.task.run(e,this)}},B(hs,"TaskWrapper"),hs),nc=(ps=class extends li{},B(ps,"ListrTaskEventManager"),ps),rc=(ds=class extends nc{constructor(t,n,r,i,o){super();v(this,"id",Za());v(this,"state","WAITING");v(this,"subtasks");v(this,"title");v(this,"initialTitle");v(this,"output");v(this,"retry");v(this,"message",{});v(this,"prompt");v(this,"parent");v(this,"enabled");v(this,"taskFn");v(this,"closed");if(this.listr=t,this.task=n,this.options=r,this.rendererOptions=i,this.rendererTaskOptions=o,n.title){const a=Array.isArray(n?.title)?n.title:[n.title];this.title=lt(a.shift(),...a),this.initialTitle=this.title}this.taskFn=n.task,this.parent=t.parentTask}set state$(t){if(this.state=t,this.emit("STATE",t),this.hasSubtasks()&&this.hasFailed())for(const n of this.subtasks)n.state==="STARTED"&&(n.state$="FAILED");this.listr.events.emit("SHOUD_REFRESH_RENDER")}set output$(t){this.output=t,this.emit("OUTPUT",t),this.listr.events.emit("SHOUD_REFRESH_RENDER")}set promptOutput$(t){this.emit("PROMPT",t),at(t)&&this.listr.events.emit("SHOUD_REFRESH_RENDER")}set message$(t){this.message={...this.message,...t},this.emit("MESSAGE",t),this.listr.events.emit("SHOUD_REFRESH_RENDER")}set title$(t){this.title=t,this.emit("TITLE",t),this.listr.events.emit("SHOUD_REFRESH_RENDER")}get path(){return[...this.listr.path,this.initialTitle]}async check(t){return this.state==="WAITING"&&(this.enabled=await qe(this.task?.enabled??!0,t),this.emit("ENABLED",this.enabled),this.listr.events.emit("SHOUD_REFRESH_RENDER")),this.enabled}hasSubtasks(){return this.subtasks?.length>0}hasFinalized(){return this.isCompleted()||this.hasFailed()||this.isSkipped()||this.hasRolledBack()}isPending(){return this.isStarted()||this.isPrompt()||this.hasReset()}isStarted(){return this.state==="STARTED"}isSkipped(){return this.state==="SKIPPED"}isCompleted(){return this.state==="COMPLETED"}hasFailed(){return this.state==="FAILED"}isRollingBack(){return this.state==="ROLLING_BACK"}hasRolledBack(){return this.state==="ROLLED_BACK"}isRetrying(){return this.state==="RETRY"}hasReset(){return this.state==="RETRY"||this.state==="ROLLING_BACK"}isEnabled(){return this.enabled}hasTitle(){return typeof this?.title=="string"}isPrompt(){return this.state==="PROMPT"||this.state==="PROMPT_COMPLETED"}isPaused(){return this.state==="PAUSED"}isClosed(){return this.closed}async pause(t){const n=this.state;this.state$="PAUSED",this.message$={paused:Date.now()+t},await wi(t),this.state$=n,this.message$={paused:null}}async run(t,n){const r=B(a=>(a instanceof _n?(a.options={...this.options,...a.options},a.rendererClass=Bt("silent"),this.subtasks=a.tasks,a.errors=this.listr.errors,this.emit("SUBTASK",this.subtasks),a=a.run(t)):a instanceof Promise?a=a.then(r):a instanceof Ja?a=new Promise((l,c)=>{a.on("data",h=>{this.output$=h.toString()}),a.on("error",h=>c(h)),a.on("end",()=>l(null))}):ci(a)&&(a=new Promise((l,c)=>{a.subscribe({next:h=>{this.output$=h},error:c,complete:l})})),a),"handleResult"),i=Date.now();this.state$="STARTED";const o=await qe(this.task?.skip??!1,t);if(o){typeof o=="string"?this.message$={skip:o}:this.hasTitle()?this.message$={skip:this.title}:this.message$={skip:"Skipped task without a title."},this.state$="SKIPPED";return}try{const a=typeof this.task?.retry=="number"&&this.task.retry>0?this.task.retry+1:typeof this.task?.retry=="object"&&this.task.retry.tries>0?this.task.retry.tries+1:1,l=typeof this.task.retry=="object"&&this.task.retry.delay;for(let c=1;c<=a;c++)try{await r(this.taskFn(t,n));break}catch(h){if(c!==a)this.retry={count:c,error:h},this.message$={retry:this.retry},this.title$=this.initialTitle,this.output=void 0,n.report(h,"WILL_RETRY"),this.state$="RETRY",l&&await this.pause(l);else throw h}(this.isStarted()||this.isRetrying())&&(this.message$={duration:Date.now()-i},this.state$="COMPLETED")}catch(a){if(this.prompt instanceof Si&&(a=this.prompt),this.task?.rollback){n.report(a,"WILL_ROLLBACK");try{this.state$="ROLLING_BACK",await this.task.rollback(t,n),this.message$={rollback:this.title},this.state$="ROLLED_BACK"}catch(l){throw this.state$="FAILED",n.report(l,"HAS_FAILED_TO_ROLLBACK"),this.close(),l}if(this.listr.options?.exitAfterRollback!==!1)throw this.close(),a}else{if(this.state$="FAILED",this.listr.options.exitOnError!==!1&&await qe(this.task?.exitOnError,t)!==!1)throw n.report(a,"HAS_FAILED"),this.close(),a;this.hasSubtasks()||n.report(a,"HAS_FAILED_WITHOUT_ERROR")}}finally{this.close()}}close(){this.emit("CLOSED"),this.listr.events.emit("SHOUD_REFRESH_RENDER"),this.complete()}},B(ds,"Task"),ds),Ai=(gs=class extends li{},B(gs,"ListrEventManager"),gs),_n=(ms=class{constructor(e,t,n){v(this,"tasks",[]);v(this,"errors",[]);v(this,"ctx");v(this,"events");v(this,"path",[]);v(this,"rendererClass");v(this,"rendererClassOptions");v(this,"rendererSelection");v(this,"concurrency");v(this,"renderer");this.task=e,this.options=t,this.parentTask=n,this.options={concurrent:!1,renderer:"default",fallbackRenderer:"simple",exitOnError:!0,exitAfterRollback:!0,collectErrors:!1,registerSignalListeners:!0,...this.parentTask?.options??{},...t},this.options.concurrent===!0?this.options.concurrent=1/0:typeof this.options.concurrent!="number"&&(this.options.concurrent=1),this.concurrency=new ec({concurrency:this.options.concurrent}),n&&(this.path=[...n.listr.path,n.title],this.errors=n.listr.errors),this.parentTask?.listr.events instanceof Ai?this.events=this.parentTask.listr.events:this.events=new Ai;const r=bi({renderer:this.options.renderer,rendererOptions:this.options.rendererOptions,fallbackRenderer:this.options.fallbackRenderer,fallbackRendererOptions:this.options.fallbackRendererOptions,fallbackRendererCondition:this.options?.fallbackRendererCondition,silentRendererCondition:this.options?.silentRendererCondition});this.rendererClass=r.renderer,this.rendererClassOptions=r.options,this.rendererSelection=r.selection,this.add(e??[]),this.options.registerSignalListeners&&process.once("SIGINT",()=>{this.tasks.forEach(async i=>{i.isPending()&&(i.state$="FAILED")}),this.renderer.end(new Error("Interrupted.")),process.exit(127)}).setMaxListeners(0),(this.options?.forceTTY||process.env.LISTR_FORCE_TTY)&&(process.stdout.isTTY=!0,process.stderr.isTTY=!0),this.options?.forceUnicode&&(process.env.LISTR_FORCE_UNICODE="1")}add(e){this.tasks.push(...this.generate(e))}async run(e){this.renderer||(this.renderer=new this.rendererClass(this.tasks,this.rendererClassOptions,this.events)),await this.renderer.render(),this.ctx=this.options?.ctx??e??{},await Promise.all(this.tasks.map(t=>t.check(this.ctx)));try{await Promise.all(this.tasks.map(t=>this.concurrency.add(()=>this.runTask(t)))),this.renderer.end()}catch(t){if(this.options.exitOnError!==!1)throw this.renderer.end(t),t}return this.ctx}generate(e){return e=Array.isArray(e)?e:[e],e.map(t=>{let n;return this.rendererSelection==="PRIMARY"?n=t.rendererOptions:this.rendererSelection==="SECONDARY"&&(n=t.fallbackRendererOptions),new rc(this,t,this.options,this.rendererClassOptions,n)})}async runTask(e){if(await e.check(this.ctx))return new sc(e).run(this.ctx)}},B(ms,"Listr"),ms);const vn=q.blue(W.arrowRight),$e=q.redBright(W.cross),Mt=q.yellow(W.warning),Ln=(s,e,t)=>`${q.redBright(`${$e} Validation Error:`)}
|
|
8
|
+
`,r)}while(n!==-1);return i+=s.slice(r),i}const{stdout:Xr,stderr:Jr}=yl,bn=Symbol("GENERATOR"),rt=Symbol("STYLER"),It=Symbol("IS_EMPTY"),Zr=["ansi","ansi","ansi256","ansi16m"],it=Object.create(null),El=(s,e={})=>{if(e.level&&!(Number.isInteger(e.level)&&e.level>=0&&e.level<=3))throw new Error("The `level` option should be an integer from 0 to 3");const t=Xr?Xr.level:0;s.level=e.level===void 0?t:e.level},Sl=s=>{const e=(...t)=>t.join(" ");return El(e,s),Object.setPrototypeOf(e,Nt.prototype),e};function Nt(s){return Sl(s)}Object.setPrototypeOf(Nt.prototype,Function.prototype);for(const[s,e]of Object.entries(Ce))it[s]={get(){const t=As(this,En(e.open,e.close,this[rt]),this[It]);return Object.defineProperty(this,s,{value:t}),t}};it.visible={get(){const s=As(this,this[rt],!0);return Object.defineProperty(this,"visible",{value:s}),s}};const wn=(s,e,t,...n)=>s==="rgb"?e==="ansi16m"?Ce[t].ansi16m(...n):e==="ansi256"?Ce[t].ansi256(Ce.rgbToAnsi256(...n)):Ce[t].ansi(Ce.rgbToAnsi(...n)):s==="hex"?wn("rgb",e,t,...Ce.hexToRgb(...n)):Ce[t][s](...n),Al=["rgb","hex","ansi256"];for(const s of Al){it[s]={get(){const{level:t}=this;return function(...n){const r=En(wn(s,Zr[t],"color",...n),Ce.color.close,this[rt]);return As(this,r,this[It])}}};const e="bg"+s[0].toUpperCase()+s.slice(1);it[e]={get(){const{level:t}=this;return function(...n){const r=En(wn(s,Zr[t],"bgColor",...n),Ce.bgColor.close,this[rt]);return As(this,r,this[It])}}}}const Ol=Object.defineProperties(()=>{},{...it,level:{enumerable:!0,get(){return this[bn].level},set(s){this[bn].level=s}}}),En=(s,e,t)=>{let n,r;return t===void 0?(n=s,r=e):(n=t.openAll+s,r=e+t.closeAll),{open:s,close:e,openAll:n,closeAll:r,parent:t}},As=(s,e,t)=>{const n=(...r)=>Cl(n,r.length===1?""+r[0]:r.join(" "));return Object.setPrototypeOf(n,Ol),n[bn]=s,n[rt]=e,n[It]=t,n},Cl=(s,e)=>{if(s.level<=0||!e)return s[It]?"":e;let t=s[rt];if(t===void 0)return e;const{openAll:n,closeAll:r}=t;if(e.includes("\x1B"))for(;t!==void 0;)e=bl(e,t.close,t.open),t=t.parent;const i=e.indexOf(`
|
|
9
|
+
`);return i!==-1&&(e=wl(e,r,n,i)),n+e+r};Object.defineProperties(Nt.prototype,it);const Rl=Nt();Nt({level:Jr?Jr.level:0});const q=Rl;var ei={exports:{}};(function(s){var e=Object.prototype.hasOwnProperty,t="~";function n(){}Object.create&&(n.prototype=Object.create(null),new n().__proto__||(t=!1));function r(l,c,f){this.fn=l,this.context=c,this.once=f||!1}function i(l,c,f,u,h){if(typeof f!="function")throw new TypeError("The listener must be a function");var d=new r(f,u||l,h),m=t?t+c:c;return l._events[m]?l._events[m].fn?l._events[m]=[l._events[m],d]:l._events[m].push(d):(l._events[m]=d,l._eventsCount++),l}function o(l,c){--l._eventsCount===0?l._events=new n:delete l._events[c]}function a(){this._events=new n,this._eventsCount=0}a.prototype.eventNames=function(){var c=[],f,u;if(this._eventsCount===0)return c;for(u in f=this._events)e.call(f,u)&&c.push(t?u.slice(1):u);return Object.getOwnPropertySymbols?c.concat(Object.getOwnPropertySymbols(f)):c},a.prototype.listeners=function(c){var f=t?t+c:c,u=this._events[f];if(!u)return[];if(u.fn)return[u.fn];for(var h=0,d=u.length,m=new Array(d);h<d;h++)m[h]=u[h].fn;return m},a.prototype.listenerCount=function(c){var f=t?t+c:c,u=this._events[f];return u?u.fn?1:u.length:0},a.prototype.emit=function(c,f,u,h,d,m){var p=t?t+c:c;if(!this._events[p])return!1;var g=this._events[p],y=arguments.length,S,A;if(g.fn){switch(g.once&&this.removeListener(c,g.fn,void 0,!0),y){case 1:return g.fn.call(g.context),!0;case 2:return g.fn.call(g.context,f),!0;case 3:return g.fn.call(g.context,f,u),!0;case 4:return g.fn.call(g.context,f,u,h),!0;case 5:return g.fn.call(g.context,f,u,h,d),!0;case 6:return g.fn.call(g.context,f,u,h,d,m),!0}for(A=1,S=new Array(y-1);A<y;A++)S[A-1]=arguments[A];g.fn.apply(g.context,S)}else{var L=g.length,R;for(A=0;A<L;A++)switch(g[A].once&&this.removeListener(c,g[A].fn,void 0,!0),y){case 1:g[A].fn.call(g[A].context);break;case 2:g[A].fn.call(g[A].context,f);break;case 3:g[A].fn.call(g[A].context,f,u);break;case 4:g[A].fn.call(g[A].context,f,u,h);break;default:if(!S)for(R=1,S=new Array(y-1);R<y;R++)S[R-1]=arguments[R];g[A].fn.apply(g[A].context,S)}}return!0},a.prototype.on=function(c,f,u){return i(this,c,f,u,!1)},a.prototype.once=function(c,f,u){return i(this,c,f,u,!0)},a.prototype.removeListener=function(c,f,u,h){var d=t?t+c:c;if(!this._events[d])return this;if(!f)return o(this,d),this;var m=this._events[d];if(m.fn)m.fn===f&&(!h||m.once)&&(!u||m.context===u)&&o(this,d);else{for(var p=0,g=[],y=m.length;p<y;p++)(m[p].fn!==f||h&&!m[p].once||u&&m[p].context!==u)&&g.push(m[p]);g.length?this._events[d]=g.length===1?g[0]:g:o(this,d)}return this},a.prototype.removeAllListeners=function(c){var f;return c?(f=t?t+c:c,this._events[f]&&o(this,f)):(this._events=new n,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=t,a.EventEmitter=a,s.exports=a})(ei);var Tl=ei.exports;const _l=nt(Tl),{env:xe={},argv:ti=[],platform:vl=""}=typeof process>"u"?{}:process,Ll="NO_COLOR"in xe||ti.includes("--no-color"),kl="FORCE_COLOR"in xe||ti.includes("--color"),$l=vl==="win32",si=xe.TERM==="dumb",Il=cn&&cn.isatty&&cn.isatty(1)&&xe.TERM&&!si,Nl="CI"in xe&&("GITHUB_ACTIONS"in xe||"GITLAB_CI"in xe||"CIRCLECI"in xe),Pl=!Ll&&(kl||$l&&!si||Il||Nl),ni=(s,e,t,n,r=e.substring(0,s)+n,i=e.substring(s+t.length),o=i.indexOf(t))=>r+(o<0?i:ni(o,i,t,n)),Bl=(s,e,t,n,r)=>s<0?t+e+n:t+ni(s,e,n,r)+n,Ml=(s,e,t=s,n=s.length+1)=>r=>r||!(r===""||r===void 0)?Bl((""+r).indexOf(e,n),r,s,e,t):"",P=(s,e,t)=>Ml(`\x1B[${s}m`,`\x1B[${e}m`,t),ri={reset:P(0,0),bold:P(1,22,"\x1B[22m\x1B[1m"),dim:P(2,22,"\x1B[22m\x1B[2m"),italic:P(3,23),underline:P(4,24),inverse:P(7,27),hidden:P(8,28),strikethrough:P(9,29),black:P(30,39),red:P(31,39),green:P(32,39),yellow:P(33,39),blue:P(34,39),magenta:P(35,39),cyan:P(36,39),white:P(37,39),gray:P(90,39),bgBlack:P(40,49),bgRed:P(41,49),bgGreen:P(42,49),bgYellow:P(43,49),bgBlue:P(44,49),bgMagenta:P(45,49),bgCyan:P(46,49),bgWhite:P(47,49),blackBright:P(90,39),redBright:P(91,39),greenBright:P(92,39),yellowBright:P(93,39),blueBright:P(94,39),magentaBright:P(95,39),cyanBright:P(96,39),whiteBright:P(97,39),bgBlackBright:P(100,49),bgRedBright:P(101,49),bgGreenBright:P(102,49),bgYellowBright:P(103,49),bgBlueBright:P(104,49),bgMagentaBright:P(105,49),bgCyanBright:P(106,49),bgWhiteBright:P(107,49)},ii=({useColor:s=Pl}={})=>s?ri:Object.keys(ri).reduce((e,t)=>({...e,[t]:String}),{});ii();var Fl=Dl;function ot(s){return s instanceof Buffer?Buffer.from(s):new s.constructor(s.buffer.slice(),s.byteOffset,s.length)}function Dl(s){if(s=s||{},s.circles)return xl(s);return s.proto?n:t;function e(r,i){for(var o=Object.keys(r),a=new Array(o.length),l=0;l<o.length;l++){var c=o[l],f=r[c];typeof f!="object"||f===null?a[c]=f:f instanceof Date?a[c]=new Date(f):ArrayBuffer.isView(f)?a[c]=ot(f):a[c]=i(f)}return a}function t(r){if(typeof r!="object"||r===null)return r;if(r instanceof Date)return new Date(r);if(Array.isArray(r))return e(r,t);if(r instanceof Map)return new Map(e(Array.from(r),t));if(r instanceof Set)return new Set(e(Array.from(r),t));var i={};for(var o in r)if(Object.hasOwnProperty.call(r,o)!==!1){var a=r[o];typeof a!="object"||a===null?i[o]=a:a instanceof Date?i[o]=new Date(a):a instanceof Map?i[o]=new Map(e(Array.from(a),t)):a instanceof Set?i[o]=new Set(e(Array.from(a),t)):ArrayBuffer.isView(a)?i[o]=ot(a):i[o]=t(a)}return i}function n(r){if(typeof r!="object"||r===null)return r;if(r instanceof Date)return new Date(r);if(Array.isArray(r))return e(r,n);if(r instanceof Map)return new Map(e(Array.from(r),n));if(r instanceof Set)return new Set(e(Array.from(r),n));var i={};for(var o in r){var a=r[o];typeof a!="object"||a===null?i[o]=a:a instanceof Date?i[o]=new Date(a):a instanceof Map?i[o]=new Map(e(Array.from(a),n)):a instanceof Set?i[o]=new Set(e(Array.from(a),n)):ArrayBuffer.isView(a)?i[o]=ot(a):i[o]=n(a)}return i}}function xl(s){var e=[],t=[];return s.proto?i:r;function n(o,a){for(var l=Object.keys(o),c=new Array(l.length),f=0;f<l.length;f++){var u=l[f],h=o[u];if(typeof h!="object"||h===null)c[u]=h;else if(h instanceof Date)c[u]=new Date(h);else if(ArrayBuffer.isView(h))c[u]=ot(h);else{var d=e.indexOf(h);d!==-1?c[u]=t[d]:c[u]=a(h)}}return c}function r(o){if(typeof o!="object"||o===null)return o;if(o instanceof Date)return new Date(o);if(Array.isArray(o))return n(o,r);if(o instanceof Map)return new Map(n(Array.from(o),r));if(o instanceof Set)return new Set(n(Array.from(o),r));var a={};e.push(o),t.push(a);for(var l in o)if(Object.hasOwnProperty.call(o,l)!==!1){var c=o[l];if(typeof c!="object"||c===null)a[l]=c;else if(c instanceof Date)a[l]=new Date(c);else if(c instanceof Map)a[l]=new Map(n(Array.from(c),r));else if(c instanceof Set)a[l]=new Set(n(Array.from(c),r));else if(ArrayBuffer.isView(c))a[l]=ot(c);else{var f=e.indexOf(c);f!==-1?a[l]=t[f]:a[l]=r(c)}}return e.pop(),t.pop(),a}function i(o){if(typeof o!="object"||o===null)return o;if(o instanceof Date)return new Date(o);if(Array.isArray(o))return n(o,i);if(o instanceof Map)return new Map(n(Array.from(o),i));if(o instanceof Set)return new Set(n(Array.from(o),i));var a={};e.push(o),t.push(a);for(var l in o){var c=o[l];if(typeof c!="object"||c===null)a[l]=c;else if(c instanceof Date)a[l]=new Date(c);else if(c instanceof Map)a[l]=new Map(n(Array.from(c),i));else if(c instanceof Set)a[l]=new Set(n(Array.from(c),i));else if(ArrayBuffer.isView(c))a[l]=ot(c);else{var f=e.indexOf(c);f!==-1?a[l]=t[f]:a[l]=i(c)}}return e.pop(),t.pop(),a}}const Hl=nt(Fl);var Ul=Object.defineProperty,B=(s,e)=>Ul(s,"name",{value:e,configurable:!0}),oi="\x1B[",ai={CURSOR_HIDE:oi+"?25l",CURSOR_SHOW:oi+"?25h"},li=(s=>(s.WAITING="WAITING",s.STARTED="STARTED",s.COMPLETED="COMPLETED",s.FAILED="FAILED",s.SKIPPED="SKIPPED",s.ROLLING_BACK="ROLLING_BACK",s.ROLLED_BACK="ROLLED_BACK",s.RETRY="RETRY",s.PAUSED="PAUSED",s.PROMPT="PROMPT",s.PROMPT_COMPLETED="PROMPT_COMPLETED",s.PROMPT_FAILED="PROMPT_FAILED",s))(li||{}),ci=(Zt=class{constructor(){v(this,"emitter",new _l)}emit(e,t){this.emitter.emit(e,t)}on(e,t){this.emitter.addListener(e,t)}once(e,t){this.emitter.once(e,t)}off(e,t){this.emitter.off(e,t)}complete(){this.emitter.removeAllListeners()}},B(Zt,"EventManager"),Zt);es=class{},B(es,"BaseEventMap");function ui(s){return!!s&&typeof s.lift=="function"&&typeof s.subscribe=="function"}B(ui,"isObservable");function Sn(){return!!process.env.LISTR_FORCE_UNICODE||process.platform!=="win32"||!!process.env.CI||!!process.env.WT_SESSION||process.env.TERM_PROGRAM==="vscode"||process.env.TERM==="xterm-256color"||process.env.TERM==="alacritty"}B(Sn,"isUnicodeSupported");var jl="(?:\\u001b|\\u009b)\\[[\\=><~/#&.:=?%@~_-]*[0-9]*[\\a-ln-tqyz=><~/#&.:=?%@~_-]+",Kl=/\u0007/;function at(s){return String(s).replace(new RegExp(jl,"gmi"),"").replace(new RegExp(Kl,"gmi"),"").trim()}B(at,"cleanseAnsi");var K=ii();function An(s,e){return s.replace(/^(?!\s*$)/gm," ".repeat(e))}B(An,"indent");var fi={warning:"\u26A0",cross:"\u2716",arrowDown:"\u2193",tick:"\u2714",arrowRight:"\u2192",pointer:"\u276F",checkboxOn:"\u2612",arrowLeft:"\u2190",squareSmallFilled:"\u25FC",pointerSmall:"\u203A"},Gl={...fi,warning:"\u203C",cross:"\xD7",tick:"\u221A",pointer:">",checkboxOn:"[\xD7]",squareSmallFilled:"\u25A0"},W=Sn()?fi:Gl;function lt(s,...e){return za(String(s),...e)}B(lt,"splat");var Os={icon:{STARTED:W.pointer,FAILED:W.cross,SKIPPED:W.arrowDown,COMPLETED:W.tick,OUTPUT:W.pointerSmall,TITLE:W.arrowRight,RETRY:W.warning,ROLLBACK:W.arrowLeft,PAUSED:W.squareSmallFilled},color:{STARTED:K.yellow,FAILED:K.red,SKIPPED:K.yellow,COMPLETED:K.green,RETRY:K.yellowBright,ROLLBACK:K.redBright,PAUSED:K.yellowBright}},hi=["RETRY","ROLLBACK","FAILED"],Pt=(ts=class{constructor(e){v(this,"process");var t,n,r;this.options=e,this.options={useIcons:!0,toStderr:[],...e??{}},(t=this.options).fields??(t.fields={}),(n=this.options.fields).prefix??(n.prefix=[]),(r=this.options.fields).suffix??(r.suffix=[]),this.process=this.options.processOutput??new di}log(e,t,n){const r=this.format(e,t,n);if(this.options.toStderr.includes(e)){this.process.toStderr(r);return}this.process.toStdout(r)}toStdout(e,t,n=!0){this.process.toStdout(this.format(null,e,t),n)}toStderr(e,t,n=!0){this.process.toStderr(this.format(null,e,t),n)}wrap(e,t){return e&&this.applyFormat(`[${e}]`,t)}splat(...e){const t=e.shift()??"";return e.length===0?t:lt(t,e)}suffix(e,...t){return t.filter(Boolean).forEach(n=>{if(e+=this.spacing(e),typeof n=="string")e+=this.wrap(n);else if(typeof n=="object"){if(n.args??(n.args=[]),typeof n.condition=="function"?!n.condition(...n.args):!(n.condition??!0))return e;e+=this.wrap(typeof n.field=="function"?n.field(...n.args):n.field,{format:n?.format(...n.args)})}}),e}prefix(e,...t){return t.filter(Boolean).forEach(n=>{if(e=this.spacing(e)+e,typeof n=="string")e=this.wrap(n)+e;else if(typeof n=="object"){if(n.args??(n.args=[]),typeof n.condition=="function"?!n.condition(...n.args):!(n.condition??!0))return e;e=this.wrap(typeof n.field=="function"?n.field(...n.args):n.field,{format:n?.format()})+e}}),e}fields(e,t){return this.options?.fields?.prefix&&(e=this.prefix(e,...this.options.fields.prefix)),t?.prefix&&(e=this.prefix(e,...t.prefix)),t?.suffix&&(e=this.suffix(e,...t.suffix)),this.options?.fields?.suffix&&(e=this.suffix(e,...this.options.fields.suffix)),e}icon(e,t){if(!e)return null;t||(t=this.options.icon?.[e]);const n=this.options.color?.[e];return t&&n&&(t=n(t)),t}format(e,t,n){return Array.isArray(t)||(t=[t]),t=this.splat(t.shift(),...t).toString().split(Oe).filter(r=>!r||r.trim()!=="").map(r=>this.style(e,this.fields(r,{prefix:Array.isArray(n?.prefix)?n.prefix:[n?.prefix],suffix:Array.isArray(n?.suffix)?n.suffix:[n?.suffix]}))).join(Oe),t}style(e,t){if(!e||!t)return t;const n=this.icon(e,!this.options.useIcons&&this.wrap(e));return n&&(t=n+" "+t),t}applyFormat(e,t){return t?.format?t.format(e):e}spacing(e){return typeof e>"u"||e.trim()===""?"":" "}},B(ts,"ListrLogger"),ts),On=(ss=class{constructor(e){v(this,"buffer",[]);v(this,"decoder",new Qa);this.options=e}get all(){return this.buffer}get last(){return this.buffer.at(-1)}get length(){return this.buffer.length}write(e,...t){const n=t[t.length-1];return this.buffer.push({time:Date.now(),stream:this.options?.stream,entry:this.decoder.write(typeof e=="string"?Buffer.from(e,typeof t[0]=="string"?t[0]:void 0):Buffer.from(e))}),this.options?.limit&&(this.buffer=this.buffer.slice(-this.options.limit)),typeof n=="function"&&n(),!0}reset(){this.buffer=[]}},B(ss,"ProcessOutputBuffer"),ss),pi=(ns=class{constructor(e){v(this,"method");v(this,"buffer");this.stream=e,this.method=e.write,this.buffer=new On({stream:e})}get out(){return Object.assign({},this.stream,{write:this.write.bind(this)})}hijack(){this.stream.write=this.buffer.write.bind(this.buffer)}release(){this.stream.write=this.method;const e=[...this.buffer.all];return this.buffer.reset(),e}write(...e){return this.method.apply(this.stream,e)}},B(ns,"ProcessOutputStream"),ns),di=(rs=class{constructor(e,t,n){v(this,"stream");v(this,"active");this.options=n,this.stream={stdout:new pi(e??process.stdout),stderr:new pi(t??process.stderr)},this.options={dump:["stdout","stderr"],leaveEmptyLine:!0,...n}}get stdout(){return this.stream.stdout.out}get stderr(){return this.stream.stderr.out}hijack(){if(this.active)throw new Error("ProcessOutput has been already hijacked!");this.stream.stdout.write(ai.CURSOR_HIDE),Object.values(this.stream).forEach(e=>e.hijack()),this.active=!0}release(){const e=Object.entries(this.stream).map(([t,n])=>({name:t,buffer:n.release()})).filter(t=>this.options.dump.includes(t.name)).flatMap(t=>t.buffer).sort((t,n)=>t.time-n.time).map(t=>({...t,entry:at(t.entry)})).filter(t=>t.entry);e.length>0&&(this.options.leaveEmptyLine&&this.stdout.write(Oe),e.forEach(t=>{(t.stream??this.stdout).write(t.entry+Oe)})),this.stream.stdout.write(ai.CURSOR_SHOW),this.active=!1}toStdout(e,t=!0){return t&&(e=e+Oe),this.stream.stdout.write(e)}toStderr(e,t=!0){return t&&(e=e+Oe),this.stream.stderr.write(e)}},B(rs,"ProcessOutput"),rs);function gi(s){const e=new Xa;return e.write=t=>(s(t.toString()),!0),e}B(gi,"createWritable"),is=class{constructor(e,t){v(this,"state");this.task=e,this.wrapper=t}reportStarted(){if(this.state=this.task.state,this.task.prompt)throw new Ai("There is already an active prompt attached to this task which may not be cleaned up properly.");this.task.prompt=this,this.task.state$="PROMPT"}reportFailed(){this.task.state$="PROMPT_FAILED",this.restoreState()}reportCompleted(){this.task.state$="PROMPT_COMPLETED",this.restoreState()}restoreState(){this.task.prompt=void 0,this.state&&(this.task.state=this.state)}},B(is,"ListrPromptAdapter");var ql=(os=class{constructor(){v(this,"spinner",Sn()?["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"]:["-","\\","|","/"]);v(this,"id");v(this,"spinnerPosition",0)}spin(){this.spinnerPosition=++this.spinnerPosition%this.spinner.length}fetch(){return this.spinner[this.spinnerPosition]}isRunning(){return!!this.id}start(e,t=100){this.id=setInterval(()=>{this.spin(),e&&e()},t)}stop(){clearInterval(this.id)}},B(os,"Spinner"),os),mi={icon:{SKIPPED_WITH_COLLAPSE:W.arrowDown,SKIPPED_WITHOUT_COLLAPSE:W.warning,OUTPUT:W.pointerSmall,OUTPUT_WITH_BOTTOMBAR:W.pointerSmall,PENDING:W.pointer,COMPLETED:W.tick,COMPLETED_WITH_FAILED_SUBTASKS:W.warning,COMPLETED_WITH_SISTER_TASKS_FAILED:W.squareSmallFilled,RETRY:W.warning,ROLLING_BACK:W.warning,ROLLED_BACK:W.arrowLeft,FAILED:W.cross,FAILED_WITH_SUBTASKS:W.pointer,WAITING:W.squareSmallFilled,PAUSED:W.squareSmallFilled},color:{SKIPPED_WITH_COLLAPSE:K.yellow,SKIPPED_WITHOUT_COLLAPSE:K.yellow,PENDING:K.yellow,COMPLETED:K.green,COMPLETED_WITH_FAILED_SUBTASKS:K.yellow,COMPLETED_WITH_SISTER_TASKS_FAILED:K.red,RETRY:K.yellowBright,ROLLING_BACK:K.redBright,ROLLED_BACK:K.redBright,FAILED:K.red,FAILED_WITH_SUBTASKS:K.red,WAITING:K.dim,PAUSED:K.yellowBright}};function yi(s){const e=Math.floor(s/1e3),t=Math.floor(e/60);let n;return e===0&&t===0&&(n=`0.${Math.floor(s/100)}s`),e>0&&(n=`${e%60}s`),t>0&&(n=`${t}m${n}`),n}B(yi,"parseTimer");var Cn={condition:!0,field:yi,format:()=>K.dim};function Wl(){const s=new Date;return String(s.getHours()).padStart(2,"0")+":"+String(s.getMinutes()).padStart(2,"0")+":"+String(s.getSeconds()).padStart(2,"0")}B(Wl,"parseTimestamp");var Yl=(ve=class{constructor(e,t,n){v(this,"prompt");v(this,"activePrompt");v(this,"spinner");v(this,"logger");v(this,"updater");v(this,"truncate");v(this,"wrap");v(this,"buffer",{output:new Map,bottom:new Map});v(this,"cache",{render:new Map,rendererOptions:new Map,rendererTaskOptions:new Map});this.tasks=e,this.options=t,this.events=n,this.options={...ve.rendererOptions,...this.options,icon:{...mi.icon,...t?.icon??{}},color:{...mi.color,...t?.color??{}}},this.spinner=this.options.spinner??new ql,this.logger=this.options.logger??new Pt({useIcons:!0,toStderr:[]}),this.logger.options.icon=this.options.icon,this.logger.options.color=this.options.color}async render(){const{createLogUpdate:e}=await import("./index2.mjs"),{default:t}=await import("./index3.mjs"),{default:n}=await import("./index4.mjs");this.updater=e(this.logger.process.stdout),this.truncate=t,this.wrap=n,this.logger.process.hijack(),this.options?.lazy||this.spinner.start(()=>{this.update()}),this.events.on("SHOUD_REFRESH_RENDER",()=>{this.update()})}update(){this.updater(this.create())}end(){this.spinner.stop(),this.updater.clear(),this.updater.done(),this.options.clearOutput||this.logger.process.toStdout(this.create({prompt:!1})),this.logger.process.release()}create(e){e={tasks:!0,bottomBar:!0,prompt:!0,...e};const t=[],n=this.renderer(this.tasks),r=this.renderBottomBar(),i=this.renderPrompt();return e.tasks&&n.length>0&&t.push(...n),e.bottomBar&&r.length>0&&(t.length>0&&t.push(""),t.push(...r)),e.prompt&&i.length>0&&(t.length>0&&t.push(""),t.push(...i)),t.join(Oe)}style(e,t=!1){const n=this.cache.rendererOptions.get(e.id);if(e.isSkipped()){if(t||n.collapseSkips)return this.logger.icon("SKIPPED_WITH_COLLAPSE");if(n.collapseSkips===!1)return this.logger.icon("SKIPPED_WITHOUT_COLLAPSE")}if(t)return this.shouldOutputToBottomBar(e)?this.logger.icon("OUTPUT_WITH_BOTTOMBAR"):this.logger.icon("OUTPUT");if(e.hasSubtasks()){if(e.isStarted()||e.isPrompt()&&n.showSubtasks!==!1&&!e.subtasks.every(r=>!r.hasTitle()))return this.logger.icon("PENDING");if(e.isCompleted()&&e.subtasks.some(r=>r.hasFailed()))return this.logger.icon("COMPLETED_WITH_FAILED_SUBTASKS");if(e.hasFailed())return this.logger.icon("FAILED_WITH_SUBTASKS")}return e.isStarted()||e.isPrompt()?this.logger.icon("PENDING",!this.options?.lazy&&this.spinner.fetch()):e.isCompleted()?this.logger.icon("COMPLETED"):e.isRetrying()?this.logger.icon("RETRY",!this.options?.lazy&&this.spinner.fetch()):e.isRollingBack()?this.logger.icon("ROLLING_BACK",!this.options?.lazy&&this.spinner.fetch()):e.hasRolledBack()?this.logger.icon("ROLLED_BACK"):e.hasFailed()?this.logger.icon("FAILED"):e.isPaused()?this.logger.icon("PAUSED"):this.logger.icon("WAITING")}format(e,t,n){if(e.trim()==="")return[];t&&(e=t+" "+e);let r;const i=(process.stdout.columns??80)-n*this.options.indentation-2;switch(this.options.formatOutput){case"truncate":r=e.split(Oe).map((o,a)=>this.truncate(this.indent(o,a),i));break;case"wrap":r=this.wrap(e,i,{hard:!0}).split(Oe).map((o,a)=>this.indent(o,a));break;default:throw new Si("Format option for the renderer is wrong.")}return this.options.removeEmptyLines&&(r=r.filter(Boolean)),r.map(o=>An(o,n*this.options.indentation))}shouldOutputToOutputBar(e){const t=this.cache.rendererTaskOptions.get(e.id).outputBar;return typeof t=="number"&&t!==0||typeof t=="boolean"&&t!==!1}shouldOutputToBottomBar(e){const t=this.cache.rendererTaskOptions.get(e.id).bottomBar;return typeof t=="number"&&t!==0||typeof t=="boolean"&&t!==!1||!e.hasTitle()}renderer(e,t=0){return e.flatMap(n=>{if(!n.isEnabled())return[];if(this.cache.render.has(n.id))return this.cache.render.get(n.id);this.calculate(n),this.setupBuffer(n);const r=this.cache.rendererOptions.get(n.id),i=this.cache.rendererTaskOptions.get(n.id),o=[];if(n.isPrompt()){if(this.activePrompt&&this.activePrompt!==n.id)throw new Si("Only one prompt can be active at the given time, please re-evaluate your task design.");this.activePrompt||(n.on("PROMPT",a=>{const l=at(a);l&&(this.prompt=l)}),n.on("STATE",a=>{(a==="PROMPT_COMPLETED"||n.hasFinalized()||n.hasReset())&&(this.prompt=null,this.activePrompt=null,n.off("PROMPT"))}),this.activePrompt=n.id)}if(n.hasTitle()&&(e.some(a=>a.hasFailed())&&!n.hasFailed()&&n.options.exitOnError!==!1&&!(n.isCompleted()||n.isSkipped())?o.push(...this.format(n.title,this.logger.icon("COMPLETED_WITH_SISTER_TASKS_FAILED"),t)):n.hasFailed()&&r.collapseErrors?o.push(...this.format(!n.hasSubtasks()&&n.message.error&&r.showErrorMessage?n.message.error:n.title,this.style(n),t)):n.isSkipped()&&r.collapseSkips?o.push(...this.format(this.logger.suffix(n.message.skip&&r.showSkipMessage?n.message.skip:n.title,{field:"SKIPPED",condition:r.suffixSkips,format:()=>K.dim}),this.style(n),t)):n.isRetrying()?o.push(...this.format(this.logger.suffix(n.title,{field:`RETRY:${n.message.retry.count}`,format:()=>K.yellow,condition:r.suffixRetries}),this.style(n),t)):n.isCompleted()&&n.hasTitle()&&qe(i.timer?.condition,n.message.duration)?o.push(...this.format(this.logger.suffix(n?.title,{...i.timer,args:[n.message.duration]}),this.style(n),t)):n.isPaused()?o.push(...this.format(this.logger.suffix(n.title,{...r.pausedTimer,args:[n.message.paused-Date.now()]}),this.style(n),t)):o.push(...this.format(n.title,this.style(n),t))),(!n.hasSubtasks()||!r.showSubtasks)&&(n.hasFailed()&&r.collapseErrors===!1&&(r.showErrorMessage||!r.showSubtasks)?o.push(...this.dump(n,t,"FAILED")):n.isSkipped()&&r.collapseSkips===!1&&(r.showSkipMessage||!r.showSubtasks)&&o.push(...this.dump(n,t,"SKIPPED"))),(n.isPending()||i.persistentOutput)&&o.push(...this.renderOutputBar(n,t)),r.showSubtasks!==!1&&n.hasSubtasks()&&(n.isPending()||n.hasFinalized()&&!n.hasTitle()||n.isCompleted()&&r.collapseSubtasks===!1&&!n.subtasks.some(a=>this.cache.rendererOptions.get(a.id)?.collapseSubtasks===!0)||n.subtasks.some(a=>this.cache.rendererOptions.get(a.id)?.collapseSubtasks===!1)||n.subtasks.some(a=>a.hasFailed())||n.subtasks.some(a=>a.hasRolledBack()))){const a=n.hasTitle()?t+1:t,l=this.renderer(n.subtasks,a);o.push(...l)}return n.hasFinalized()&&(i.persistentOutput||(this.buffer.bottom.delete(n.id),this.buffer.output.delete(n.id))),n.isClosed()&&(this.cache.render.set(n.id,o),this.reset(n)),o})}renderOutputBar(e,t){const n=this.buffer.output.get(e.id);return n?n.all.flatMap(r=>this.dump(e,t,"OUTPUT",r.entry)):[]}renderBottomBar(){return this.buffer.bottom.size===0?[]:Array.from(this.buffer.bottom.values()).flatMap(e=>e.all).sort((e,t)=>e.time-t.time).map(e=>e.entry)}renderPrompt(){return this.prompt?[this.prompt]:[]}calculate(e){if(this.cache.rendererOptions.has(e.id)&&this.cache.rendererTaskOptions.has(e.id))return;const t={...this.options,...e.rendererOptions};this.cache.rendererOptions.set(e.id,t),this.cache.rendererTaskOptions.set(e.id,{...ve.rendererTaskOptions,timer:t.timer,...e.rendererTaskOptions})}setupBuffer(e){if(this.buffer.bottom.has(e.id)||this.buffer.output.has(e.id))return;const t=this.cache.rendererTaskOptions.get(e.id);this.shouldOutputToBottomBar(e)&&!this.buffer.bottom.has(e.id)?(this.buffer.bottom.set(e.id,new On({limit:typeof t.bottomBar=="number"?t.bottomBar:1})),e.on("OUTPUT",n=>{const r=this.dump(e,-1,"OUTPUT",n);this.buffer.bottom.get(e.id).write(r.join(Oe))}),e.on("STATE",n=>{switch(n){case"RETRY":this.buffer.bottom.delete(e.id);break}})):this.shouldOutputToOutputBar(e)&&!this.buffer.output.has(e.id)&&(this.buffer.output.set(e.id,new On({limit:typeof t.outputBar=="number"?t.outputBar:1})),e.on("OUTPUT",n=>{this.buffer.output.get(e.id).write(n)}),e.on("STATE",n=>{switch(n){case"RETRY":this.buffer.output.delete(e.id);break}}))}reset(e){this.cache.rendererOptions.delete(e.id),this.cache.rendererTaskOptions.delete(e.id),this.buffer.output.delete(e.id)}dump(e,t,n="OUTPUT",r){if(!r)switch(n){case"OUTPUT":r=e.output;break;case"SKIPPED":r=e.message.skip;break;case"FAILED":r=e.message.error;break}return e.hasTitle()&&n==="FAILED"&&r===e.title||typeof r!="string"?[]:(n==="OUTPUT"&&(r=at(r)),this.format(r,this.style(e,!0),t+1))}indent(e,t){return t>0?An(e.trim(),this.options.indentation):e.trim()}},B(ve,"DefaultRenderer"),v(ve,"nonTTY",!1),v(ve,"rendererOptions",{indentation:2,clearOutput:!1,showSubtasks:!0,collapseSubtasks:!0,collapseSkips:!0,showSkipMessage:!0,suffixSkips:!1,collapseErrors:!0,showErrorMessage:!0,suffixRetries:!0,lazy:!1,removeEmptyLines:!0,formatOutput:"wrap",pausedTimer:{...Cn,format:()=>K.yellowBright}}),v(ve,"rendererTaskOptions",{outputBar:!0}),ve),Vl=(Ge=class{constructor(e,t){this.tasks=e,this.options=t}render(){}end(){}},B(Ge,"SilentRenderer"),v(Ge,"nonTTY",!0),v(Ge,"rendererOptions"),v(Ge,"rendererTaskOptions"),Ge),zl=(Le=class{constructor(e,t){v(this,"logger");v(this,"cache",{rendererOptions:new Map,rendererTaskOptions:new Map});this.tasks=e,this.options=t,this.options={...Le.rendererOptions,...t,icon:{...Os.icon,...t?.icon??{}},color:{...Os.color,...t?.color??{}}},this.logger=this.options.logger??new Pt({useIcons:!0,toStderr:hi}),this.logger.options.icon=this.options.icon,this.logger.options.color=this.options.color,this.options.timestamp&&this.logger.options.fields.prefix.unshift(this.options.timestamp)}end(){this.logger.process.release()}render(){this.renderer(this.tasks)}renderer(e){e.forEach(t=>{this.calculate(t),t.once("CLOSED",()=>{this.reset(t)});const n=this.cache.rendererOptions.get(t.id),r=this.cache.rendererTaskOptions.get(t.id);t.on("SUBTASK",i=>{this.renderer(i)}),t.on("STATE",i=>{if(t.hasTitle())if(i==="STARTED")this.logger.log("STARTED",t.title);else if(i==="COMPLETED"){const o=r?.timer;this.logger.log("COMPLETED",t.title,o&&{suffix:{...o,condition:!!t.message?.duration&&o.condition,args:[t.message.duration]}})}else i==="PROMPT"?(this.logger.process.hijack(),t.on("PROMPT",o=>{this.logger.process.toStderr(o,!1)})):i==="PROMPT_COMPLETED"&&(t.off("PROMPT"),this.logger.process.release())}),t.on("OUTPUT",i=>{this.logger.log("OUTPUT",i)}),t.on("MESSAGE",i=>{if(i.error)this.logger.log("FAILED",t.title,{suffix:{field:`FAILED: ${i.error}`,format:()=>K.red}});else if(i.skip)this.logger.log("SKIPPED",t.title,{suffix:{field:`SKIPPED: ${i.skip}`,format:()=>K.yellow}});else if(i.rollback)this.logger.log("ROLLBACK",t.title,{suffix:{field:`ROLLBACK: ${i.rollback}`,format:()=>K.red}});else if(i.retry)this.logger.log("RETRY",t.title,{suffix:{field:`RETRY:${i.retry.count}`,format:()=>K.red}});else if(i.paused){const o=n?.pausedTimer;this.logger.log("PAUSED",t.title,o&&{suffix:{...o,condition:!!i?.paused&&o.condition,args:[i.paused-Date.now()]}})}})})}calculate(e){if(this.cache.rendererOptions.has(e.id)&&this.cache.rendererTaskOptions.has(e.id))return;const t={...this.options,...e.rendererOptions};this.cache.rendererOptions.set(e.id,t),this.cache.rendererTaskOptions.set(e.id,{...Le.rendererTaskOptions,timer:t.timer,...e.rendererTaskOptions})}reset(e){this.cache.rendererOptions.delete(e.id),this.cache.rendererTaskOptions.delete(e.id)}},B(Le,"SimpleRenderer"),v(Le,"nonTTY",!0),v(Le,"rendererOptions",{pausedTimer:{...Cn,field:e=>`PAUSED:${e}`,format:()=>K.yellowBright}}),v(Le,"rendererTaskOptions",{}),Le),Ql=(as=class{constructor(e){this.options=e}serialize(e,t,n){return JSON.stringify(this.generate(e,t,n))}generate(e,t,n){const r={event:e,data:t};if(typeof this.options?.task!="boolean"){const i=Object.fromEntries(this.options.task.map(o=>{const a=n[o];return typeof a=="function"?[o,a.call(n)]:[o,a]}));Object.keys(n).length>0&&(r.task=i)}return r}},B(as,"TestRendererSerializer"),as),Xl=(Me=class{constructor(e,t){v(this,"logger");v(this,"serializer");this.tasks=e,this.options=t,this.options={...Me.rendererOptions,...this.options},this.logger=this.options.logger??new Pt({useIcons:!1}),this.serializer=new Ql(this.options)}render(){this.renderer(this.tasks)}end(){}renderer(e){e.forEach(t=>{this.options.subtasks&&t.on("SUBTASK",n=>{this.renderer(n)}),this.options.state&&t.on("STATE",n=>{this.logger.toStdout(this.serializer.serialize("STATE",n,t))}),this.options.output&&t.on("OUTPUT",n=>{this.logger.toStdout(this.serializer.serialize("OUTPUT",n,t))}),this.options.prompt&&t.on("PROMPT",n=>{this.logger.toStdout(this.serializer.serialize("PROMPT",n,t))}),this.options.title&&t.on("TITLE",n=>{this.logger.toStdout(this.serializer.serialize("TITLE",n,t))}),t.on("MESSAGE",n=>{const r=Object.fromEntries(Object.entries(n).map(([i,o])=>{if(this.options.messages.includes(i))return[i,o]}).filter(Boolean));if(Object.keys(r).length>0){const i=this.serializer.serialize("MESSAGE",r,t);this.options.messagesToStderr.some(o=>Object.keys(r).includes(o))?this.logger.toStderr(i):this.logger.toStdout(i)}})})}},B(Me,"TestRenderer"),v(Me,"nonTTY",!0),v(Me,"rendererOptions",{subtasks:!0,state:Object.values(li),output:!0,prompt:!0,title:!0,messages:["skip","error","retry","rollback","paused"],messagesToStderr:["error","rollback","retry"],task:["hasRolledBack","isRollingBack","isCompleted","isSkipped","hasFinalized","hasSubtasks","title","hasReset","hasTitle","isPrompt","isPaused","isPending","isSkipped","isStarted","hasFailed","isEnabled","isRetrying","path"]}),v(Me,"rendererTaskOptions"),Me),Jl=(ke=class{constructor(e,t){v(this,"logger");v(this,"cache",{rendererOptions:new Map,rendererTaskOptions:new Map});this.tasks=e,this.options=t,this.options={...ke.rendererOptions,...this.options,icon:{...Os.icon,...t?.icon??{}},color:{...Os.color,...t?.color??{}}},this.logger=this.options.logger??new Pt({useIcons:!1,toStderr:hi}),this.logger.options.icon=this.options.icon,this.logger.options.color=this.options.color,this.options.timestamp&&this.logger.options.fields.prefix.unshift(this.options.timestamp)}render(){this.renderer(this.tasks)}end(){}renderer(e){e.forEach(t=>{this.calculate(t),t.once("CLOSED",()=>{this.reset(t)});const n=this.cache.rendererOptions.get(t.id),r=this.cache.rendererTaskOptions.get(t.id);t.on("SUBTASK",i=>{this.renderer(i)}),t.on("STATE",i=>{if(t.hasTitle()){if(i==="STARTED")this.logger.log("STARTED",t.title);else if(i==="COMPLETED"){const o=r.timer;this.logger.log("COMPLETED",t.title,o&&{suffix:{...o,condition:!!t.message?.duration&&o.condition,args:[t.message.duration]}})}}}),t.on("OUTPUT",i=>{this.logger.log("OUTPUT",i)}),t.on("PROMPT",i=>{const o=at(i);o&&this.logger.log("PROMPT",o)}),this.options?.logTitleChange!==!1&&t.on("TITLE",i=>{this.logger.log("TITLE",i)}),t.on("MESSAGE",i=>{if(i?.error)this.logger.log("FAILED",i.error);else if(i?.skip)this.logger.log("SKIPPED",i.skip);else if(i?.rollback)this.logger.log("ROLLBACK",i.rollback);else if(i?.retry)this.logger.log("RETRY",t.title,{suffix:i.retry.count.toString()});else if(i?.paused){const o=n?.pausedTimer;this.logger.log("PAUSED",t.title,o&&{suffix:{...o,condition:!!i?.paused&&o.condition,args:[i.paused-Date.now()]}})}})})}calculate(e){if(this.cache.rendererOptions.has(e.id)&&this.cache.rendererTaskOptions.has(e.id))return;const t={...this.options,...e.rendererOptions};this.cache.rendererOptions.set(e.id,t),this.cache.rendererTaskOptions.set(e.id,{...ke.rendererTaskOptions,timer:t.timer,...e.rendererTaskOptions})}reset(e){this.cache.rendererOptions.delete(e.id),this.cache.rendererTaskOptions.delete(e.id)}},B(ke,"VerboseRenderer"),v(ke,"nonTTY",!0),v(ke,"rendererOptions",{logTitleChange:!1,pausedTimer:{...Cn,format:()=>K.yellowBright}}),v(ke,"rendererTaskOptions"),ke),Rn={default:Yl,simple:zl,verbose:Jl,test:Xl,silent:Vl};function bi(s){return process.stdout.isTTY===!0||s.nonTTY===!0}B(bi,"isRendererSupported");function Bt(s){return typeof s=="string"?Rn[s]??Rn.default:typeof s=="function"?s:Rn.default}B(Bt,"getRendererClass");function wi(s){if(qe(s?.silentRendererCondition))return{renderer:Bt("silent"),selection:"SILENT"};const e={renderer:Bt(s.renderer),options:s.rendererOptions,selection:"PRIMARY"};return!bi(e.renderer)||qe(s?.fallbackRendererCondition)?{renderer:Bt(s.fallbackRenderer),options:s.fallbackRendererOptions,selection:"SECONDARY"}:e}B(wi,"getRenderer");function qe(s,...e){return typeof s=="function"?s(...e):s}B(qe,"assertFunctionOrSelf");var Zl=Hl({circles:!0});function Tn(s){return Zl(s)}B(Tn,"cloneObject");var ec=(ls=class{constructor(e){v(this,"concurrency");v(this,"count");v(this,"queue");this.concurrency=e.concurrency,this.count=0,this.queue=new Set}add(e){return this.count<this.concurrency?this.run(e):new Promise(t=>{const n=B(()=>t(this.run(e)),"callback");this.queue.add(n)})}flush(){for(const e of this.queue){if(this.count>=this.concurrency)break;this.queue.delete(e),e()}}run(e){this.count++;const t=e(),n=B(()=>{this.count--,this.flush()},"cleanup");return t.then(n,()=>{this.queue.clear()}),t}},B(ls,"Concurrency"),ls);function Ei(s){return new Promise(e=>{setTimeout(e,s)})}B(Ei,"delay");var tc=(cs=class extends Error{constructor(t,n,r){super(t.message);v(this,"path");v(this,"ctx");this.error=t,this.type=n,this.task=r,this.name="ListrError",this.path=r.path,r?.options.collectErrors==="full"&&(this.task=Tn(r),this.ctx=Tn(r.listr.ctx)),this.stack=t?.stack}},B(cs,"ListrError"),cs),Si=(us=class extends Error{},B(us,"ListrRendererError"),us),Ai=(fs=class extends Error{},B(fs,"PromptError"),fs),sc=(hs=class{constructor(e){this.task=e}get title(){return this.task.title}set title(e){e=Array.isArray(e)?e:[e],this.task.title$=lt(e.shift(),...e)}get output(){return this.task.output}set output(e){e=Array.isArray(e)?e:[e],this.task.output$=lt(e.shift(),...e)}set promptOutput(e){this.task.promptOutput$=e}newListr(e,t){let n;return typeof e=="function"?n=e(this):n=e,new _n(n,t,this.task)}report(e,t){this.task.options.collectErrors!==!1&&this.task.listr.errors.push(new tc(e,t,this.task)),this.task.message$={error:e.message??this.task?.title}}skip(e,...t){this.task.state$="SKIPPED",e&&(this.task.message$={skip:e?lt(e,...t):this.task?.title})}isRetrying(){return this.task.isRetrying()?this.task.retry:{count:0}}prompt(e){return this.task.prompt?this.task.prompt:new e(this.task,this)}stdout(e){return gi(t=>{switch(e){case"PROMPT":this.promptOutput=t;break;default:this.output=t}})}run(e){return this.task.run(e,this)}},B(hs,"TaskWrapper"),hs),nc=(ps=class extends ci{},B(ps,"ListrTaskEventManager"),ps),rc=(ds=class extends nc{constructor(t,n,r,i,o){super();v(this,"id",Za());v(this,"state","WAITING");v(this,"subtasks");v(this,"title");v(this,"initialTitle");v(this,"output");v(this,"retry");v(this,"message",{});v(this,"prompt");v(this,"parent");v(this,"enabled");v(this,"taskFn");v(this,"closed");if(this.listr=t,this.task=n,this.options=r,this.rendererOptions=i,this.rendererTaskOptions=o,n.title){const a=Array.isArray(n?.title)?n.title:[n.title];this.title=lt(a.shift(),...a),this.initialTitle=this.title}this.taskFn=n.task,this.parent=t.parentTask}set state$(t){if(this.state=t,this.emit("STATE",t),this.hasSubtasks()&&this.hasFailed())for(const n of this.subtasks)n.state==="STARTED"&&(n.state$="FAILED");this.listr.events.emit("SHOUD_REFRESH_RENDER")}set output$(t){this.output=t,this.emit("OUTPUT",t),this.listr.events.emit("SHOUD_REFRESH_RENDER")}set promptOutput$(t){this.emit("PROMPT",t),at(t)&&this.listr.events.emit("SHOUD_REFRESH_RENDER")}set message$(t){this.message={...this.message,...t},this.emit("MESSAGE",t),this.listr.events.emit("SHOUD_REFRESH_RENDER")}set title$(t){this.title=t,this.emit("TITLE",t),this.listr.events.emit("SHOUD_REFRESH_RENDER")}get path(){return[...this.listr.path,this.initialTitle]}async check(t){return this.state==="WAITING"&&(this.enabled=await qe(this.task?.enabled??!0,t),this.emit("ENABLED",this.enabled),this.listr.events.emit("SHOUD_REFRESH_RENDER")),this.enabled}hasSubtasks(){return this.subtasks?.length>0}hasFinalized(){return this.isCompleted()||this.hasFailed()||this.isSkipped()||this.hasRolledBack()}isPending(){return this.isStarted()||this.isPrompt()||this.hasReset()}isStarted(){return this.state==="STARTED"}isSkipped(){return this.state==="SKIPPED"}isCompleted(){return this.state==="COMPLETED"}hasFailed(){return this.state==="FAILED"}isRollingBack(){return this.state==="ROLLING_BACK"}hasRolledBack(){return this.state==="ROLLED_BACK"}isRetrying(){return this.state==="RETRY"}hasReset(){return this.state==="RETRY"||this.state==="ROLLING_BACK"}isEnabled(){return this.enabled}hasTitle(){return typeof this?.title=="string"}isPrompt(){return this.state==="PROMPT"||this.state==="PROMPT_COMPLETED"}isPaused(){return this.state==="PAUSED"}isClosed(){return this.closed}async pause(t){const n=this.state;this.state$="PAUSED",this.message$={paused:Date.now()+t},await Ei(t),this.state$=n,this.message$={paused:null}}async run(t,n){const r=B(a=>(a instanceof _n?(a.options={...this.options,...a.options},a.rendererClass=Bt("silent"),this.subtasks=a.tasks,a.errors=this.listr.errors,this.emit("SUBTASK",this.subtasks),a=a.run(t)):a instanceof Promise?a=a.then(r):a instanceof Ja?a=new Promise((l,c)=>{a.on("data",f=>{this.output$=f.toString()}),a.on("error",f=>c(f)),a.on("end",()=>l(null))}):ui(a)&&(a=new Promise((l,c)=>{a.subscribe({next:f=>{this.output$=f},error:c,complete:l})})),a),"handleResult"),i=Date.now();this.state$="STARTED";const o=await qe(this.task?.skip??!1,t);if(o){typeof o=="string"?this.message$={skip:o}:this.hasTitle()?this.message$={skip:this.title}:this.message$={skip:"Skipped task without a title."},this.state$="SKIPPED";return}try{const a=typeof this.task?.retry=="number"&&this.task.retry>0?this.task.retry+1:typeof this.task?.retry=="object"&&this.task.retry.tries>0?this.task.retry.tries+1:1,l=typeof this.task.retry=="object"&&this.task.retry.delay;for(let c=1;c<=a;c++)try{await r(this.taskFn(t,n));break}catch(f){if(c!==a)this.retry={count:c,error:f},this.message$={retry:this.retry},this.title$=this.initialTitle,this.output=void 0,n.report(f,"WILL_RETRY"),this.state$="RETRY",l&&await this.pause(l);else throw f}(this.isStarted()||this.isRetrying())&&(this.message$={duration:Date.now()-i},this.state$="COMPLETED")}catch(a){if(this.prompt instanceof Ai&&(a=this.prompt),this.task?.rollback){n.report(a,"WILL_ROLLBACK");try{this.state$="ROLLING_BACK",await this.task.rollback(t,n),this.message$={rollback:this.title},this.state$="ROLLED_BACK"}catch(l){throw this.state$="FAILED",n.report(l,"HAS_FAILED_TO_ROLLBACK"),this.close(),l}if(this.listr.options?.exitAfterRollback!==!1)throw this.close(),a}else{if(this.state$="FAILED",this.listr.options.exitOnError!==!1&&await qe(this.task?.exitOnError,t)!==!1)throw n.report(a,"HAS_FAILED"),this.close(),a;this.hasSubtasks()||n.report(a,"HAS_FAILED_WITHOUT_ERROR")}}finally{this.close()}}close(){this.emit("CLOSED"),this.listr.events.emit("SHOUD_REFRESH_RENDER"),this.complete()}},B(ds,"Task"),ds),Oi=(gs=class extends ci{},B(gs,"ListrEventManager"),gs),_n=(ms=class{constructor(e,t,n){v(this,"tasks",[]);v(this,"errors",[]);v(this,"ctx");v(this,"events");v(this,"path",[]);v(this,"rendererClass");v(this,"rendererClassOptions");v(this,"rendererSelection");v(this,"concurrency");v(this,"renderer");this.task=e,this.options=t,this.parentTask=n,this.options={concurrent:!1,renderer:"default",fallbackRenderer:"simple",exitOnError:!0,exitAfterRollback:!0,collectErrors:!1,registerSignalListeners:!0,...this.parentTask?.options??{},...t},this.options.concurrent===!0?this.options.concurrent=1/0:typeof this.options.concurrent!="number"&&(this.options.concurrent=1),this.concurrency=new ec({concurrency:this.options.concurrent}),n&&(this.path=[...n.listr.path,n.title],this.errors=n.listr.errors),this.parentTask?.listr.events instanceof Oi?this.events=this.parentTask.listr.events:this.events=new Oi;const r=wi({renderer:this.options.renderer,rendererOptions:this.options.rendererOptions,fallbackRenderer:this.options.fallbackRenderer,fallbackRendererOptions:this.options.fallbackRendererOptions,fallbackRendererCondition:this.options?.fallbackRendererCondition,silentRendererCondition:this.options?.silentRendererCondition});this.rendererClass=r.renderer,this.rendererClassOptions=r.options,this.rendererSelection=r.selection,this.add(e??[]),this.options.registerSignalListeners&&process.once("SIGINT",()=>{this.tasks.forEach(async i=>{i.isPending()&&(i.state$="FAILED")}),this.renderer.end(new Error("Interrupted.")),process.exit(127)}).setMaxListeners(0),(this.options?.forceTTY||process.env.LISTR_FORCE_TTY)&&(process.stdout.isTTY=!0,process.stderr.isTTY=!0),this.options?.forceUnicode&&(process.env.LISTR_FORCE_UNICODE="1")}add(e){this.tasks.push(...this.generate(e))}async run(e){this.renderer||(this.renderer=new this.rendererClass(this.tasks,this.rendererClassOptions,this.events)),await this.renderer.render(),this.ctx=this.options?.ctx??e??{},await Promise.all(this.tasks.map(t=>t.check(this.ctx)));try{await Promise.all(this.tasks.map(t=>this.concurrency.add(()=>this.runTask(t)))),this.renderer.end()}catch(t){if(this.options.exitOnError!==!1)throw this.renderer.end(t),t}return this.ctx}generate(e){return e=Array.isArray(e)?e:[e],e.map(t=>{let n;return this.rendererSelection==="PRIMARY"?n=t.rendererOptions:this.rendererSelection==="SECONDARY"&&(n=t.fallbackRendererOptions),new rc(this,t,this.options,this.rendererClassOptions,n)})}async runTask(e){if(await e.check(this.ctx))return new sc(e).run(this.ctx)}},B(ms,"Listr"),ms);const vn=q.blue(W.arrowRight),$e=q.redBright(W.cross),Mt=q.yellow(W.warning),Ln=(s,e,t)=>`${q.redBright(`${$e} Validation Error:`)}
|
|
10
10
|
|
|
11
|
-
Invalid value for '${q.bold(s)}': ${q.bold(
|
|
11
|
+
Invalid value for '${q.bold(s)}': ${q.bold(Fr(t))}
|
|
12
12
|
|
|
13
13
|
${e}`,ic=q.redBright(`${$e} Current directory is not a git directory!`),oc=q.redBright(`${$e} Failed to get staged files!`),ac=(s,e)=>q.yellow(`${Mt} Detected incorrect braces with only single value: \`${s}\`. Reformatted as: \`${e}\`
|
|
14
14
|
`),lc=`${$e} No valid configuration found.`,cc=`${vn} No staged files found.`,uc=`${vn} No staged files match any configured task.`,fc=(s,e)=>{const t=e!==void 0?"`--diff` was used":s?"`--no-stash` was used":"there\u2019s no initial commit yet";return q.yellow(`${Mt} Skipping backup because ${t}.
|
|
15
15
|
`)},hc=(s,e)=>{const t=e!==void 0?"`--diff` was used":s?"`--no-hide-partially-staged` was used":"`--no-stash` was used";return q.yellow(`${Mt} Skipping hiding unstaged changes from partially staged files because ${t}.
|
|
16
16
|
`)},pc=q.yellow(`${Mt} Some of your tasks use \`git add\` command. Please remove it from the config since all modifications made by tasks will be automatically added to the git commit index.
|
|
17
|
-
`),
|
|
18
|
-
${q.redBright(`${$e} lint-staged failed due to a git error.`)}`,
|
|
17
|
+
`),Ci="Skipped because of errors from tasks.",dc="Skipped because of previous git error.",ct=`
|
|
18
|
+
${q.redBright(`${$e} lint-staged failed due to a git error.`)}`,Ri=(s,e,t)=>`${q.redBright(`${$e} Validation Error:`)}
|
|
19
19
|
|
|
20
20
|
Invalid value for option '${q.bold(s)}': ${q.bold(e)}
|
|
21
21
|
|
|
@@ -29,7 +29,7 @@ See https://github.com/okonet/lint-staged#command-line-flags`,gc=`
|
|
|
29
29
|
> git stash list
|
|
30
30
|
stash@{0}: automatic lint-staged backup
|
|
31
31
|
> git stash apply --index stash@{0}
|
|
32
|
-
`;q.redBright(`${$e} Failed to read config from stdin.`);const
|
|
32
|
+
`;q.redBright(`${$e} Failed to read config from stdin.`);const Ti=(s={},e)=>{if(!Array.isArray(s.output))return;const t=s.errors?.size>0?e.error:e.log;for(const n of s.output)t(n)},yc="\\\\?\\",bc="\\\\.\\",ge=s=>{if(s===H.posix.sep||s===H.win32.sep)return H.posix.sep;let e=s.split(/[/\\]+/).join(H.posix.sep);return(s.startsWith(yc)||s.startsWith(bc))&&(e=e.replace(/^\/(\.|\?)/,"//$1")),e.endsWith(H.posix.sep)&&(e=e.slice(0,-1)),e},kn=oe("lint-staged:chunkFiles"),wc=(s,e)=>{if(e===1)return[s];const t=[];let n=0;for(let r=0;r<e;r++){const i=Math.ceil((s.length-n)/(e-r));t.push([]),t[r]=s.slice(n,i+n),n+=i}return t},_i=({files:s,baseDir:e,maxArgLength:t=null,relative:n=!1})=>{const r=s.map(a=>ge(n||!e?a:H.resolve(e,a)));if(!t)return kn("Skip chunking files because of undefined maxArgLength"),[r];const i=r.join(" ").length;kn(`Resolved an argument string length of ${i} characters from ${r.length} files`);const o=Math.min(Math.ceil(i/t),r.length);return kn(`Creating ${o} chunks for maxArgLength of ${t}`),wc(r,o)},Ec=oe("lint-staged:execGit"),Sc=["-c","submodule.recurse=false"],Ac=[...Sc],ut=async(s,e={})=>{Ec("Running git command",s);try{const{stdout:t}=await Dr("git",Ac.concat(s),{...e,all:!0,cwd:e.cwd||process.cwd()});return t}catch({all:t}){throw new Error(t)}};var Cs={};(function(s){s.isInteger=e=>typeof e=="number"?Number.isInteger(e):typeof e=="string"&&e.trim()!==""?Number.isInteger(Number(e)):!1,s.find=(e,t)=>e.nodes.find(n=>n.type===t),s.exceedsLimit=(e,t,n=1,r)=>r===!1||!s.isInteger(e)||!s.isInteger(t)?!1:(Number(t)-Number(e))/Number(n)>=r,s.escapeNode=(e,t=0,n)=>{let r=e.nodes[t];r&&(n&&r.type===n||r.type==="open"||r.type==="close")&&r.escaped!==!0&&(r.value="\\"+r.value,r.escaped=!0)},s.encloseBrace=e=>e.type!=="brace"||e.commas>>0+e.ranges>>0?!1:(e.invalid=!0,!0),s.isInvalidBrace=e=>e.type!=="brace"?!1:e.invalid===!0||e.dollar?!0:!(e.commas>>0+e.ranges>>0)||e.open!==!0||e.close!==!0?(e.invalid=!0,!0):!1,s.isOpenOrClose=e=>e.type==="open"||e.type==="close"?!0:e.open===!0||e.close===!0,s.reduce=e=>e.reduce((t,n)=>(n.type==="text"&&t.push(n.value),n.type==="range"&&(n.type="text"),t),[]),s.flatten=(...e)=>{const t=[],n=r=>{for(let i=0;i<r.length;i++){let o=r[i];Array.isArray(o)?n(o):o!==void 0&&t.push(o)}return t};return n(e),t}})(Cs);const vi=Cs;var $n=(s,e={})=>{let t=(n,r={})=>{let i=e.escapeInvalid&&vi.isInvalidBrace(r),o=n.invalid===!0&&e.escapeInvalid===!0,a="";if(n.value)return(i||o)&&vi.isOpenOrClose(n)?"\\"+n.value:n.value;if(n.value)return n.value;if(n.nodes)for(let l of n.nodes)a+=t(l);return a};return t(s)};/*!
|
|
33
33
|
* is-number <https://github.com/jonschlinkert/is-number>
|
|
34
34
|
*
|
|
35
35
|
* Copyright (c) 2014-present, Jon Schlinkert.
|
|
@@ -39,52 +39,52 @@ See https://github.com/okonet/lint-staged#command-line-flags`,gc=`
|
|
|
39
39
|
*
|
|
40
40
|
* Copyright (c) 2015-present, Jon Schlinkert.
|
|
41
41
|
* Released under the MIT License.
|
|
42
|
-
*/const
|
|
42
|
+
*/const Li=Oc,We=(s,e,t)=>{if(Li(s)===!1)throw new TypeError("toRegexRange: expected the first argument to be a number");if(e===void 0||s===e)return String(s);if(Li(e)===!1)throw new TypeError("toRegexRange: expected the second argument to be a number.");let n={relaxZeros:!0,...t};typeof n.strictZeros=="boolean"&&(n.relaxZeros=n.strictZeros===!1);let r=String(n.relaxZeros),i=String(n.shorthand),o=String(n.capture),a=String(n.wrap),l=s+":"+e+"="+r+i+o+a;if(We.cache.hasOwnProperty(l))return We.cache[l].result;let c=Math.min(s,e),f=Math.max(s,e);if(Math.abs(c-f)===1){let p=s+"|"+e;return n.capture?`(${p})`:n.wrap===!1?p:`(?:${p})`}let u=Bi(s)||Bi(e),h={min:s,max:e,a:c,b:f},d=[],m=[];if(u&&(h.isPadded=u,h.maxLen=String(h.max).length),c<0){let p=f<0?Math.abs(f):1;m=ki(p,Math.abs(c),h,n),c=h.a=0}return f>=0&&(d=ki(c,f,h,n)),h.negatives=m,h.positives=d,h.result=Cc(m,d),n.capture===!0?h.result=`(${h.result})`:n.wrap!==!1&&d.length+m.length>1&&(h.result=`(?:${h.result})`),We.cache[l]=h,h.result};function Cc(s,e,t){let n=In(s,e,"-",!1)||[],r=In(e,s,"",!1)||[],i=In(s,e,"-?",!0)||[];return n.concat(i).concat(r).join("|")}function Rc(s,e){let t=1,n=1,r=Ii(s,t),i=new Set([e]);for(;s<=r&&r<=e;)i.add(r),t+=1,r=Ii(s,t);for(r=Ni(e+1,n)-1;s<r&&r<=e;)i.add(r),n+=1,r=Ni(e+1,n)-1;return i=[...i],i.sort(vc),i}function Tc(s,e,t){if(s===e)return{pattern:s,count:[],digits:0};let n=_c(s,e),r=n.length,i="",o=0;for(let a=0;a<r;a++){let[l,c]=n[a];l===c?i+=l:l!=="0"||c!=="9"?i+=Lc(l,c):o++}return o&&(i+=t.shorthand===!0?"\\d":"[0-9]"),{pattern:i,count:[o],digits:r}}function ki(s,e,t,n){let r=Rc(s,e),i=[],o=s,a;for(let l=0;l<r.length;l++){let c=r[l],f=Tc(String(o),String(c),n),u="";if(!t.isPadded&&a&&a.pattern===f.pattern){a.count.length>1&&a.count.pop(),a.count.push(f.count[0]),a.string=a.pattern+Pi(a.count),o=c+1;continue}t.isPadded&&(u=kc(c,t,n)),f.string=u+f.pattern+Pi(f.count),i.push(f),o=c+1,a=f}return i}function In(s,e,t,n,r){let i=[];for(let o of s){let{string:a}=o;!n&&!$i(e,"string",a)&&i.push(t+a),n&&$i(e,"string",a)&&i.push(t+a)}return i}function _c(s,e){let t=[];for(let n=0;n<s.length;n++)t.push([s[n],e[n]]);return t}function vc(s,e){return s>e?1:e>s?-1:0}function $i(s,e,t){return s.some(n=>n[e]===t)}function Ii(s,e){return Number(String(s).slice(0,-e)+"9".repeat(e))}function Ni(s,e){return s-s%Math.pow(10,e)}function Pi(s){let[e=0,t=""]=s;return t||e>1?`{${e+(t?","+t:"")}}`:""}function Lc(s,e,t){return`[${s}${e-s===1?"":"-"}${e}]`}function Bi(s){return/^-?(0+)\d/.test(s)}function kc(s,e,t){if(!e.isPadded)return s;let n=Math.abs(e.maxLen-String(s).length),r=t.relaxZeros!==!1;switch(n){case 0:return"";case 1:return r?"0?":"0";case 2:return r?"0{0,2}":"00";default:return r?`0{0,${n}}`:`0{${n}}`}}We.cache={},We.clearCache=()=>We.cache={};var $c=We;/*!
|
|
43
43
|
* fill-range <https://github.com/jonschlinkert/fill-range>
|
|
44
44
|
*
|
|
45
45
|
* Copyright (c) 2014-present, Jon Schlinkert.
|
|
46
46
|
* Licensed under the MIT License.
|
|
47
|
-
*/const Ic=un,
|
|
48
|
-
`,CHAR_NO_BREAK_SPACE:"\xA0",CHAR_PERCENT:"%",CHAR_PLUS:"+",CHAR_QUESTION_MARK:"?",CHAR_RIGHT_ANGLE_BRACKET:">",CHAR_RIGHT_CURLY_BRACE:"}",CHAR_RIGHT_SQUARE_BRACKET:"]",CHAR_SEMICOLON:";",CHAR_SINGLE_QUOTE:"'",CHAR_SPACE:" ",CHAR_TAB:" ",CHAR_UNDERSCORE:"_",CHAR_VERTICAL_LINE:"|",CHAR_ZERO_WIDTH_NOBREAK_SPACE:"\uFEFF"};const Yc=$n,{MAX_LENGTH:qi,CHAR_BACKSLASH:Bn,CHAR_BACKTICK:Vc,CHAR_COMMA:zc,CHAR_DOT:Qc,CHAR_LEFT_PARENTHESES:Xc,CHAR_RIGHT_PARENTHESES:Jc,CHAR_LEFT_CURLY_BRACE:Zc,CHAR_RIGHT_CURLY_BRACE:eu,CHAR_LEFT_SQUARE_BRACKET:Wi,CHAR_RIGHT_SQUARE_BRACKET:Yi,CHAR_DOUBLE_QUOTE:tu,CHAR_SINGLE_QUOTE:su,CHAR_NO_BREAK_SPACE:nu,CHAR_ZERO_WIDTH_NOBREAK_SPACE:ru}=Wc,iu=(s,e={})=>{if(typeof s!="string")throw new TypeError("Expected a string");let t=e||{},n=typeof t.maxLength=="number"?Math.min(qi,t.maxLength):qi;if(s.length>n)throw new SyntaxError(`Input length (${s.length}), exceeds max characters (${n})`);let r={type:"root",input:s,nodes:[]},i=[r],o=r,a=r,l=0,c=s.length,h=0,u=0,f;const d=()=>s[h++],m=p=>{if(p.type==="text"&&a.type==="dot"&&(a.type="text"),a&&a.type==="text"&&p.type==="text"){a.value+=p.value;return}return o.nodes.push(p),p.parent=o,p.prev=a,a=p,p};for(m({type:"bos"});h<c;)if(o=i[i.length-1],f=d(),!(f===ru||f===nu)){if(f===Bn){m({type:"text",value:(e.keepEscaping?f:"")+d()});continue}if(f===Yi){m({type:"text",value:"\\"+f});continue}if(f===Wi){l++;let p;for(;h<c&&(p=d());){if(f+=p,p===Wi){l++;continue}if(p===Bn){f+=d();continue}if(p===Yi&&(l--,l===0))break}m({type:"text",value:f});continue}if(f===Xc){o=m({type:"paren",nodes:[]}),i.push(o),m({type:"text",value:f});continue}if(f===Jc){if(o.type!=="paren"){m({type:"text",value:f});continue}o=i.pop(),m({type:"text",value:f}),o=i[i.length-1];continue}if(f===tu||f===su||f===Vc){let p=f,g;for(e.keepQuotes!==!0&&(f="");h<c&&(g=d());){if(g===Bn){f+=g+d();continue}if(g===p){e.keepQuotes===!0&&(f+=g);break}f+=g}m({type:"text",value:f});continue}if(f===Zc){u++;let g={type:"brace",open:!0,close:!1,dollar:a.value&&a.value.slice(-1)==="$"||o.dollar===!0,depth:u,commas:0,ranges:0,nodes:[]};o=m(g),i.push(o),m({type:"open",value:f});continue}if(f===eu){if(o.type!=="brace"){m({type:"text",value:f});continue}let p="close";o=i.pop(),o.close=!0,m({type:p,value:f}),u--,o=i[i.length-1];continue}if(f===zc&&u>0){if(o.ranges>0){o.ranges=0;let p=o.nodes.shift();o.nodes=[p,{type:"text",value:Yc(o)}]}m({type:"comma",value:f}),o.commas++;continue}if(f===Qc&&u>0&&o.commas===0){let p=o.nodes;if(u===0||p.length===0){m({type:"text",value:f});continue}if(a.type==="dot"){if(o.range=[],a.value+=f,a.type="range",o.nodes.length!==3&&o.nodes.length!==5){o.invalid=!0,o.ranges=0,a.type="text";continue}o.ranges++,o.args=[];continue}if(a.type==="range"){p.pop();let g=p[p.length-1];g.value+=a.value+f,a=g,o.ranges--;continue}m({type:"dot",value:f});continue}m({type:"text",value:f})}do if(o=i.pop(),o.type!=="root"){o.nodes.forEach(y=>{y.nodes||(y.type==="open"&&(y.isOpen=!0),y.type==="close"&&(y.isClose=!0),y.nodes||(y.type="text"),y.invalid=!0)});let p=i[i.length-1],g=p.nodes.indexOf(o);p.nodes.splice(g,1,...o.nodes)}while(i.length>0);return m({type:"eos"}),r};var ou=iu;const Vi=$n,au=jc,lu=qc,cu=ou,fe=(s,e={})=>{let t=[];if(Array.isArray(s))for(let n of s){let r=fe.create(n,e);Array.isArray(r)?t.push(...r):t.push(r)}else t=[].concat(fe.create(s,e));return e&&e.expand===!0&&e.nodupes===!0&&(t=[...new Set(t)]),t};fe.parse=(s,e={})=>cu(s,e),fe.stringify=(s,e={})=>Vi(typeof s=="string"?fe.parse(s,e):s,e),fe.compile=(s,e={})=>(typeof s=="string"&&(s=fe.parse(s,e)),au(s,e)),fe.expand=(s,e={})=>{typeof s=="string"&&(s=fe.parse(s,e));let t=lu(s,e);return e.noempty===!0&&(t=t.filter(Boolean)),e.nodupes===!0&&(t=[...new Set(t)]),t},fe.create=(s,e={})=>s===""||s.length<3?[s]:e.expand!==!0?fe.compile(s,e):fe.expand(s,e);var uu=fe,Ft={};const fu=fn,Re="\\\\/",zi=`[^${Re}]`,Ie="\\.",hu="\\+",pu="\\?",Ts="\\/",du="(?=.)",Qi="[^/]",Mn=`(?:${Ts}|$)`,Xi=`(?:^|${Ts})`,Dn=`${Ie}{1,2}${Mn}`,gu=`(?!${Ie})`,mu=`(?!${Xi}${Dn})`,yu=`(?!${Ie}{0,1}${Mn})`,bu=`(?!${Dn})`,wu=`[^.${Ts}]`,Eu=`${Qi}*?`,Ji={DOT_LITERAL:Ie,PLUS_LITERAL:hu,QMARK_LITERAL:pu,SLASH_LITERAL:Ts,ONE_CHAR:du,QMARK:Qi,END_ANCHOR:Mn,DOTS_SLASH:Dn,NO_DOT:gu,NO_DOTS:mu,NO_DOT_SLASH:yu,NO_DOTS_SLASH:bu,QMARK_NO_DOT:wu,STAR:Eu,START_ANCHOR:Xi},Su={...Ji,SLASH_LITERAL:`[${Re}]`,QMARK:zi,STAR:`${zi}*?`,DOTS_SLASH:`${Ie}{1,2}(?:[${Re}]|$)`,NO_DOT:`(?!${Ie})`,NO_DOTS:`(?!(?:^|[${Re}])${Ie}{1,2}(?:[${Re}]|$))`,NO_DOT_SLASH:`(?!${Ie}{0,1}(?:[${Re}]|$))`,NO_DOTS_SLASH:`(?!${Ie}{1,2}(?:[${Re}]|$))`,QMARK_NO_DOT:`[^.${Re}]`,START_ANCHOR:`(?:^|[${Re}])`,END_ANCHOR:`(?:[${Re}]|$)`},Au={alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"};var _s={MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:Au,REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,SEP:fu.sep,extglobChars(s){return{"!":{type:"negate",open:"(?:(?!(?:",close:`))${s.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}},globChars(s){return s===!0?Su:Ji}};(function(s){const e=fn,t=process.platform==="win32",{REGEX_BACKSLASH:n,REGEX_REMOVE_BACKSLASH:r,REGEX_SPECIAL_CHARS:i,REGEX_SPECIAL_CHARS_GLOBAL:o}=_s;s.isObject=a=>a!==null&&typeof a=="object"&&!Array.isArray(a),s.hasRegexChars=a=>i.test(a),s.isRegexChar=a=>a.length===1&&s.hasRegexChars(a),s.escapeRegex=a=>a.replace(o,"\\$1"),s.toPosixSlashes=a=>a.replace(n,"/"),s.removeBackslashes=a=>a.replace(r,l=>l==="\\"?"":l),s.supportsLookbehinds=()=>{const a=process.version.slice(1).split(".").map(Number);return a.length===3&&a[0]>=9||a[0]===8&&a[1]>=10},s.isWindows=a=>a&&typeof a.windows=="boolean"?a.windows:t===!0||e.sep==="\\",s.escapeLast=(a,l,c)=>{const h=a.lastIndexOf(l,c);return h===-1?a:a[h-1]==="\\"?s.escapeLast(a,l,h-1):`${a.slice(0,h)}\\${a.slice(h)}`},s.removePrefix=(a,l={})=>{let c=a;return c.startsWith("./")&&(c=c.slice(2),l.prefix="./"),c},s.wrapOutput=(a,l={},c={})=>{const h=c.contains?"":"^",u=c.contains?"":"$";let f=`${h}(?:${a})${u}`;return l.negated===!0&&(f=`(?:^(?!${f}).*$)`),f}})(Ft);const Zi=Ft,{CHAR_ASTERISK:Fn,CHAR_AT:Ou,CHAR_BACKWARD_SLASH:xt,CHAR_COMMA:Cu,CHAR_DOT:xn,CHAR_EXCLAMATION_MARK:Hn,CHAR_FORWARD_SLASH:eo,CHAR_LEFT_CURLY_BRACE:Un,CHAR_LEFT_PARENTHESES:jn,CHAR_LEFT_SQUARE_BRACKET:Ru,CHAR_PLUS:Tu,CHAR_QUESTION_MARK:to,CHAR_RIGHT_CURLY_BRACE:_u,CHAR_RIGHT_PARENTHESES:so,CHAR_RIGHT_SQUARE_BRACKET:vu}=_s,no=s=>s===eo||s===xt,ro=s=>{s.isPrefix!==!0&&(s.depth=s.isGlobstar?1/0:1)},Lu=(s,e)=>{const t=e||{},n=s.length-1,r=t.parts===!0||t.scanToEnd===!0,i=[],o=[],a=[];let l=s,c=-1,h=0,u=0,f=!1,d=!1,m=!1,p=!1,g=!1,y=!1,S=!1,A=!1,L=!1,R=!1,O=0,I,_,k={value:"",depth:0,isGlob:!1};const j=()=>c>=n,E=()=>l.charCodeAt(c+1),$=()=>(I=_,l.charCodeAt(++c));for(;c<n;){_=$();let F;if(_===xt){S=k.backslashes=!0,_=$(),_===Un&&(y=!0);continue}if(y===!0||_===Un){for(O++;j()!==!0&&(_=$());){if(_===xt){S=k.backslashes=!0,$();continue}if(_===Un){O++;continue}if(y!==!0&&_===xn&&(_=$())===xn){if(f=k.isBrace=!0,m=k.isGlob=!0,R=!0,r===!0)continue;break}if(y!==!0&&_===Cu){if(f=k.isBrace=!0,m=k.isGlob=!0,R=!0,r===!0)continue;break}if(_===_u&&(O--,O===0)){y=!1,f=k.isBrace=!0,R=!0;break}}if(r===!0)continue;break}if(_===eo){if(i.push(c),o.push(k),k={value:"",depth:0,isGlob:!1},R===!0)continue;if(I===xn&&c===h+1){h+=2;continue}u=c+1;continue}if(t.noext!==!0&&(_===Tu||_===Ou||_===Fn||_===to||_===Hn)===!0&&E()===jn){if(m=k.isGlob=!0,p=k.isExtglob=!0,R=!0,_===Hn&&c===h&&(L=!0),r===!0){for(;j()!==!0&&(_=$());){if(_===xt){S=k.backslashes=!0,_=$();continue}if(_===so){m=k.isGlob=!0,R=!0;break}}continue}break}if(_===Fn){if(I===Fn&&(g=k.isGlobstar=!0),m=k.isGlob=!0,R=!0,r===!0)continue;break}if(_===to){if(m=k.isGlob=!0,R=!0,r===!0)continue;break}if(_===Ru){for(;j()!==!0&&(F=$());){if(F===xt){S=k.backslashes=!0,$();continue}if(F===vu){d=k.isBracket=!0,m=k.isGlob=!0,R=!0;break}}if(r===!0)continue;break}if(t.nonegate!==!0&&_===Hn&&c===h){A=k.negated=!0,h++;continue}if(t.noparen!==!0&&_===jn){if(m=k.isGlob=!0,r===!0){for(;j()!==!0&&(_=$());){if(_===jn){S=k.backslashes=!0,_=$();continue}if(_===so){R=!0;break}}continue}break}if(m===!0){if(R=!0,r===!0)continue;break}}t.noext===!0&&(p=!1,m=!1);let G=l,Ae="",b="";h>0&&(Ae=l.slice(0,h),l=l.slice(h),u-=h),G&&m===!0&&u>0?(G=l.slice(0,u),b=l.slice(u)):m===!0?(G="",b=l):G=l,G&&G!==""&&G!=="/"&&G!==l&&no(G.charCodeAt(G.length-1))&&(G=G.slice(0,-1)),t.unescape===!0&&(b&&(b=Zi.removeBackslashes(b)),G&&S===!0&&(G=Zi.removeBackslashes(G)));const w={prefix:Ae,input:s,start:h,base:G,glob:b,isBrace:f,isBracket:d,isGlob:m,isExtglob:p,isGlobstar:g,negated:A,negatedExtglob:L};if(t.tokens===!0&&(w.maxDepth=0,no(_)||o.push(k),w.tokens=o),t.parts===!0||t.tokens===!0){let F;for(let x=0;x<i.length;x++){const de=F?F+1:h,ue=i[x],ne=s.slice(de,ue);t.tokens&&(x===0&&h!==0?(o[x].isPrefix=!0,o[x].value=Ae):o[x].value=ne,ro(o[x]),w.maxDepth+=o[x].depth),(x!==0||ne!=="")&&a.push(ne),F=ue}if(F&&F+1<s.length){const x=s.slice(F+1);a.push(x),t.tokens&&(o[o.length-1].value=x,ro(o[o.length-1]),w.maxDepth+=o[o.length-1].depth)}w.slashes=i,w.parts=a}return w};var ku=Lu;const vs=_s,he=Ft,{MAX_LENGTH:Ls,POSIX_REGEX_SOURCE:$u,REGEX_NON_SPECIAL_CHARS:Iu,REGEX_SPECIAL_CHARS_BACKREF:Nu,REPLACEMENTS:io}=vs,Pu=(s,e)=>{if(typeof e.expandRange=="function")return e.expandRange(...s,e);s.sort();const t=`[${s.join("-")}]`;try{new RegExp(t)}catch{return s.map(r=>he.escapeRegex(r)).join("..")}return t},ht=(s,e)=>`Missing ${s}: "${e}" - use "\\\\${e}" to match literal characters`,Kn=(s,e)=>{if(typeof s!="string")throw new TypeError("Expected a string");s=io[s]||s;const t={...e},n=typeof t.maxLength=="number"?Math.min(Ls,t.maxLength):Ls;let r=s.length;if(r>n)throw new SyntaxError(`Input length: ${r}, exceeds maximum allowed length: ${n}`);const i={type:"bos",value:"",output:t.prepend||""},o=[i],a=t.capture?"":"?:",l=he.isWindows(e),c=vs.globChars(l),h=vs.extglobChars(c),{DOT_LITERAL:u,PLUS_LITERAL:f,SLASH_LITERAL:d,ONE_CHAR:m,DOTS_SLASH:p,NO_DOT:g,NO_DOT_SLASH:y,NO_DOTS_SLASH:S,QMARK:A,QMARK_NO_DOT:L,STAR:R,START_ANCHOR:O}=c,I=T=>`(${a}(?:(?!${O}${T.dot?p:u}).)*?)`,_=t.dot?"":g,k=t.dot?A:L;let j=t.bash===!0?I(t):R;t.capture&&(j=`(${j})`),typeof t.noext=="boolean"&&(t.noextglob=t.noext);const E={input:s,index:-1,start:0,dot:t.dot===!0,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:o};s=he.removePrefix(s,E),r=s.length;const $=[],G=[],Ae=[];let b=i,w;const F=()=>E.index===r-1,x=E.peek=(T=1)=>s[E.index+T],de=E.advance=()=>s[++E.index]||"",ue=()=>s.slice(E.index+1),ne=(T="",U=0)=>{E.consumed+=T,E.index+=U},De=T=>{E.output+=T.output!=null?T.output:T.value,ne(T.value)},et=()=>{let T=1;for(;x()==="!"&&(x(2)!=="("||x(3)==="?");)de(),E.start++,T++;return T%2===0?!1:(E.negated=!0,E.start++,!0)},tt=T=>{E[T]++,Ae.push(T)},we=T=>{E[T]--,Ae.pop()},M=T=>{if(b.type==="globstar"){const U=E.braces>0&&(T.type==="comma"||T.type==="brace"),C=T.extglob===!0||$.length&&(T.type==="pipe"||T.type==="paren");T.type!=="slash"&&T.type!=="paren"&&!U&&!C&&(E.output=E.output.slice(0,-b.output.length),b.type="star",b.value="*",b.output=j,E.output+=b.output)}if($.length&&T.type!=="paren"&&($[$.length-1].inner+=T.value),(T.value||T.output)&&De(T),b&&b.type==="text"&&T.type==="text"){b.value+=T.value,b.output=(b.output||"")+T.value;return}T.prev=b,o.push(T),b=T},le=(T,U)=>{const C={...h[U],conditions:1,inner:""};C.prev=b,C.parens=E.parens,C.output=E.output;const D=(t.capture?"(":"")+C.open;tt("parens"),M({type:T,value:U,output:E.output?"":m}),M({type:"paren",extglob:!0,value:de(),output:D}),$.push(C)},st=T=>{let U=T.close+(t.capture?")":""),C;if(T.type==="negate"){let D=j;if(T.inner&&T.inner.length>1&&T.inner.includes("/")&&(D=I(t)),(D!==j||F()||/^\)+$/.test(ue()))&&(U=T.close=`)$))${D}`),T.inner.includes("*")&&(C=ue())&&/^\.[^\\/.]+$/.test(C)){const J=Kn(C,{...e,fastpaths:!1}).output;U=T.close=`)${J})${D})`}T.prev.type==="bos"&&(E.negatedExtglob=!0)}M({type:"paren",extglob:!0,value:w,output:U}),we("parens")};if(t.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(s)){let T=!1,U=s.replace(Nu,(C,D,J,ie,se,ln)=>ie==="\\"?(T=!0,C):ie==="?"?D?D+ie+(se?A.repeat(se.length):""):ln===0?k+(se?A.repeat(se.length):""):A.repeat(J.length):ie==="."?u.repeat(J.length):ie==="*"?D?D+ie+(se?j:""):j:D?C:`\\${C}`);return T===!0&&(t.unescape===!0?U=U.replace(/\\/g,""):U=U.replace(/\\+/g,C=>C.length%2===0?"\\\\":C?"\\":"")),U===s&&t.contains===!0?(E.output=s,E):(E.output=he.wrapOutput(U,E,e),E)}for(;!F();){if(w=de(),w==="\0")continue;if(w==="\\"){const C=x();if(C==="/"&&t.bash!==!0||C==="."||C===";")continue;if(!C){w+="\\",M({type:"text",value:w});continue}const D=/^\\+/.exec(ue());let J=0;if(D&&D[0].length>2&&(J=D[0].length,E.index+=J,J%2!==0&&(w+="\\")),t.unescape===!0?w=de():w+=de(),E.brackets===0){M({type:"text",value:w});continue}}if(E.brackets>0&&(w!=="]"||b.value==="["||b.value==="[^")){if(t.posix!==!1&&w===":"){const C=b.value.slice(1);if(C.includes("[")&&(b.posix=!0,C.includes(":"))){const D=b.value.lastIndexOf("["),J=b.value.slice(0,D),ie=b.value.slice(D+2),se=$u[ie];if(se){b.value=J+se,E.backtrack=!0,de(),!i.output&&o.indexOf(b)===1&&(i.output=m);continue}}}(w==="["&&x()!==":"||w==="-"&&x()==="]")&&(w=`\\${w}`),w==="]"&&(b.value==="["||b.value==="[^")&&(w=`\\${w}`),t.posix===!0&&w==="!"&&b.value==="["&&(w="^"),b.value+=w,De({value:w});continue}if(E.quotes===1&&w!=='"'){w=he.escapeRegex(w),b.value+=w,De({value:w});continue}if(w==='"'){E.quotes=E.quotes===1?0:1,t.keepQuotes===!0&&M({type:"text",value:w});continue}if(w==="("){tt("parens"),M({type:"paren",value:w});continue}if(w===")"){if(E.parens===0&&t.strictBrackets===!0)throw new SyntaxError(ht("opening","("));const C=$[$.length-1];if(C&&E.parens===C.parens+1){st($.pop());continue}M({type:"paren",value:w,output:E.parens?")":"\\)"}),we("parens");continue}if(w==="["){if(t.nobracket===!0||!ue().includes("]")){if(t.nobracket!==!0&&t.strictBrackets===!0)throw new SyntaxError(ht("closing","]"));w=`\\${w}`}else tt("brackets");M({type:"bracket",value:w});continue}if(w==="]"){if(t.nobracket===!0||b&&b.type==="bracket"&&b.value.length===1){M({type:"text",value:w,output:`\\${w}`});continue}if(E.brackets===0){if(t.strictBrackets===!0)throw new SyntaxError(ht("opening","["));M({type:"text",value:w,output:`\\${w}`});continue}we("brackets");const C=b.value.slice(1);if(b.posix!==!0&&C[0]==="^"&&!C.includes("/")&&(w=`/${w}`),b.value+=w,De({value:w}),t.literalBrackets===!1||he.hasRegexChars(C))continue;const D=he.escapeRegex(b.value);if(E.output=E.output.slice(0,-b.value.length),t.literalBrackets===!0){E.output+=D,b.value=D;continue}b.value=`(${a}${D}|${b.value})`,E.output+=b.value;continue}if(w==="{"&&t.nobrace!==!0){tt("braces");const C={type:"brace",value:w,output:"(",outputIndex:E.output.length,tokensIndex:E.tokens.length};G.push(C),M(C);continue}if(w==="}"){const C=G[G.length-1];if(t.nobrace===!0||!C){M({type:"text",value:w,output:w});continue}let D=")";if(C.dots===!0){const J=o.slice(),ie=[];for(let se=J.length-1;se>=0&&(o.pop(),J[se].type!=="brace");se--)J[se].type!=="dots"&&ie.unshift(J[se].value);D=Pu(ie,t),E.backtrack=!0}if(C.comma!==!0&&C.dots!==!0){const J=E.output.slice(0,C.outputIndex),ie=E.tokens.slice(C.tokensIndex);C.value=C.output="\\{",w=D="\\}",E.output=J;for(const se of ie)E.output+=se.output||se.value}M({type:"brace",value:w,output:D}),we("braces"),G.pop();continue}if(w==="|"){$.length>0&&$[$.length-1].conditions++,M({type:"text",value:w});continue}if(w===","){let C=w;const D=G[G.length-1];D&&Ae[Ae.length-1]==="braces"&&(D.comma=!0,C="|"),M({type:"comma",value:w,output:C});continue}if(w==="/"){if(b.type==="dot"&&E.index===E.start+1){E.start=E.index+1,E.consumed="",E.output="",o.pop(),b=i;continue}M({type:"slash",value:w,output:d});continue}if(w==="."){if(E.braces>0&&b.type==="dot"){b.value==="."&&(b.output=u);const C=G[G.length-1];b.type="dots",b.output+=w,b.value+=w,C.dots=!0;continue}if(E.braces+E.parens===0&&b.type!=="bos"&&b.type!=="slash"){M({type:"text",value:w,output:u});continue}M({type:"dot",value:w,output:u});continue}if(w==="?"){if(!(b&&b.value==="(")&&t.noextglob!==!0&&x()==="("&&x(2)!=="?"){le("qmark",w);continue}if(b&&b.type==="paren"){const D=x();let J=w;if(D==="<"&&!he.supportsLookbehinds())throw new Error("Node.js v10 or higher is required for regex lookbehinds");(b.value==="("&&!/[!=<:]/.test(D)||D==="<"&&!/<([!=]|\w+>)/.test(ue()))&&(J=`\\${w}`),M({type:"text",value:w,output:J});continue}if(t.dot!==!0&&(b.type==="slash"||b.type==="bos")){M({type:"qmark",value:w,output:L});continue}M({type:"qmark",value:w,output:A});continue}if(w==="!"){if(t.noextglob!==!0&&x()==="("&&(x(2)!=="?"||!/[!=<:]/.test(x(3)))){le("negate",w);continue}if(t.nonegate!==!0&&E.index===0){et();continue}}if(w==="+"){if(t.noextglob!==!0&&x()==="("&&x(2)!=="?"){le("plus",w);continue}if(b&&b.value==="("||t.regex===!1){M({type:"plus",value:w,output:f});continue}if(b&&(b.type==="bracket"||b.type==="paren"||b.type==="brace")||E.parens>0){M({type:"plus",value:w});continue}M({type:"plus",value:f});continue}if(w==="@"){if(t.noextglob!==!0&&x()==="("&&x(2)!=="?"){M({type:"at",extglob:!0,value:w,output:""});continue}M({type:"text",value:w});continue}if(w!=="*"){(w==="$"||w==="^")&&(w=`\\${w}`);const C=Iu.exec(ue());C&&(w+=C[0],E.index+=C[0].length),M({type:"text",value:w});continue}if(b&&(b.type==="globstar"||b.star===!0)){b.type="star",b.star=!0,b.value+=w,b.output=j,E.backtrack=!0,E.globstar=!0,ne(w);continue}let T=ue();if(t.noextglob!==!0&&/^\([^?]/.test(T)){le("star",w);continue}if(b.type==="star"){if(t.noglobstar===!0){ne(w);continue}const C=b.prev,D=C.prev,J=C.type==="slash"||C.type==="bos",ie=D&&(D.type==="star"||D.type==="globstar");if(t.bash===!0&&(!J||T[0]&&T[0]!=="/")){M({type:"star",value:w,output:""});continue}const se=E.braces>0&&(C.type==="comma"||C.type==="brace"),ln=$.length&&(C.type==="pipe"||C.type==="paren");if(!J&&C.type!=="paren"&&!se&&!ln){M({type:"star",value:w,output:""});continue}for(;T.slice(0,3)==="/**";){const ys=s[E.index+4];if(ys&&ys!=="/")break;T=T.slice(3),ne("/**",3)}if(C.type==="bos"&&F()){b.type="globstar",b.value+=w,b.output=I(t),E.output=b.output,E.globstar=!0,ne(w);continue}if(C.type==="slash"&&C.prev.type!=="bos"&&!ie&&F()){E.output=E.output.slice(0,-(C.output+b.output).length),C.output=`(?:${C.output}`,b.type="globstar",b.output=I(t)+(t.strictSlashes?")":"|$)"),b.value+=w,E.globstar=!0,E.output+=C.output+b.output,ne(w);continue}if(C.type==="slash"&&C.prev.type!=="bos"&&T[0]==="/"){const ys=T[1]!==void 0?"|$":"";E.output=E.output.slice(0,-(C.output+b.output).length),C.output=`(?:${C.output}`,b.type="globstar",b.output=`${I(t)}${d}|${d}${ys})`,b.value+=w,E.output+=C.output+b.output,E.globstar=!0,ne(w+de()),M({type:"slash",value:"/",output:""});continue}if(C.type==="bos"&&T[0]==="/"){b.type="globstar",b.value+=w,b.output=`(?:^|${d}|${I(t)}${d})`,E.output=b.output,E.globstar=!0,ne(w+de()),M({type:"slash",value:"/",output:""});continue}E.output=E.output.slice(0,-b.output.length),b.type="globstar",b.output=I(t),b.value+=w,E.output+=b.output,E.globstar=!0,ne(w);continue}const U={type:"star",value:w,output:j};if(t.bash===!0){U.output=".*?",(b.type==="bos"||b.type==="slash")&&(U.output=_+U.output),M(U);continue}if(b&&(b.type==="bracket"||b.type==="paren")&&t.regex===!0){U.output=w,M(U);continue}(E.index===E.start||b.type==="slash"||b.type==="dot")&&(b.type==="dot"?(E.output+=y,b.output+=y):t.dot===!0?(E.output+=S,b.output+=S):(E.output+=_,b.output+=_),x()!=="*"&&(E.output+=m,b.output+=m)),M(U)}for(;E.brackets>0;){if(t.strictBrackets===!0)throw new SyntaxError(ht("closing","]"));E.output=he.escapeLast(E.output,"["),we("brackets")}for(;E.parens>0;){if(t.strictBrackets===!0)throw new SyntaxError(ht("closing",")"));E.output=he.escapeLast(E.output,"("),we("parens")}for(;E.braces>0;){if(t.strictBrackets===!0)throw new SyntaxError(ht("closing","}"));E.output=he.escapeLast(E.output,"{"),we("braces")}if(t.strictSlashes!==!0&&(b.type==="star"||b.type==="bracket")&&M({type:"maybe_slash",value:"",output:`${d}?`}),E.backtrack===!0){E.output="";for(const T of E.tokens)E.output+=T.output!=null?T.output:T.value,T.suffix&&(E.output+=T.suffix)}return E};Kn.fastpaths=(s,e)=>{const t={...e},n=typeof t.maxLength=="number"?Math.min(Ls,t.maxLength):Ls,r=s.length;if(r>n)throw new SyntaxError(`Input length: ${r}, exceeds maximum allowed length: ${n}`);s=io[s]||s;const i=he.isWindows(e),{DOT_LITERAL:o,SLASH_LITERAL:a,ONE_CHAR:l,DOTS_SLASH:c,NO_DOT:h,NO_DOTS:u,NO_DOTS_SLASH:f,STAR:d,START_ANCHOR:m}=vs.globChars(i),p=t.dot?u:h,g=t.dot?f:h,y=t.capture?"":"?:",S={negated:!1,prefix:""};let A=t.bash===!0?".*?":d;t.capture&&(A=`(${A})`);const L=_=>_.noglobstar===!0?A:`(${y}(?:(?!${m}${_.dot?c:o}).)*?)`,R=_=>{switch(_){case"*":return`${p}${l}${A}`;case".*":return`${o}${l}${A}`;case"*.*":return`${p}${A}${o}${l}${A}`;case"*/*":return`${p}${A}${a}${l}${g}${A}`;case"**":return p+L(t);case"**/*":return`(?:${p}${L(t)}${a})?${g}${l}${A}`;case"**/*.*":return`(?:${p}${L(t)}${a})?${g}${A}${o}${l}${A}`;case"**/.*":return`(?:${p}${L(t)}${a})?${o}${l}${A}`;default:{const k=/^(.*?)\.(\w+)$/.exec(_);if(!k)return;const j=R(k[1]);return j?j+o+k[2]:void 0}}},O=he.removePrefix(s,S);let I=R(O);return I&&t.strictSlashes!==!0&&(I+=`${a}?`),I};var Bu=Kn;const Mu=fn,Du=ku,Gn=Bu,qn=Ft,Fu=_s,xu=s=>s&&typeof s=="object"&&!Array.isArray(s),ee=(s,e,t=!1)=>{if(Array.isArray(s)){const h=s.map(f=>ee(f,e,t));return f=>{for(const d of h){const m=d(f);if(m)return m}return!1}}const n=xu(s)&&s.tokens&&s.input;if(s===""||typeof s!="string"&&!n)throw new TypeError("Expected pattern to be a non-empty string");const r=e||{},i=qn.isWindows(e),o=n?ee.compileRe(s,e):ee.makeRe(s,e,!1,!0),a=o.state;delete o.state;let l=()=>!1;if(r.ignore){const h={...e,ignore:null,onMatch:null,onResult:null};l=ee(r.ignore,h,t)}const c=(h,u=!1)=>{const{isMatch:f,match:d,output:m}=ee.test(h,o,e,{glob:s,posix:i}),p={glob:s,state:a,regex:o,posix:i,input:h,output:m,match:d,isMatch:f};return typeof r.onResult=="function"&&r.onResult(p),f===!1?(p.isMatch=!1,u?p:!1):l(h)?(typeof r.onIgnore=="function"&&r.onIgnore(p),p.isMatch=!1,u?p:!1):(typeof r.onMatch=="function"&&r.onMatch(p),u?p:!0)};return t&&(c.state=a),c};ee.test=(s,e,t,{glob:n,posix:r}={})=>{if(typeof s!="string")throw new TypeError("Expected input to be a string");if(s==="")return{isMatch:!1,output:""};const i=t||{},o=i.format||(r?qn.toPosixSlashes:null);let a=s===n,l=a&&o?o(s):s;return a===!1&&(l=o?o(s):s,a=l===n),(a===!1||i.capture===!0)&&(i.matchBase===!0||i.basename===!0?a=ee.matchBase(s,e,t,r):a=e.exec(l)),{isMatch:!!a,match:a,output:l}},ee.matchBase=(s,e,t,n=qn.isWindows(t))=>(e instanceof RegExp?e:ee.makeRe(e,t)).test(Mu.basename(s)),ee.isMatch=(s,e,t)=>ee(e,t)(s),ee.parse=(s,e)=>Array.isArray(s)?s.map(t=>ee.parse(t,e)):Gn(s,{...e,fastpaths:!1}),ee.scan=(s,e)=>Du(s,e),ee.compileRe=(s,e,t=!1,n=!1)=>{if(t===!0)return s.output;const r=e||{},i=r.contains?"":"^",o=r.contains?"":"$";let a=`${i}(?:${s.output})${o}`;s&&s.negated===!0&&(a=`^(?!${a}).*$`);const l=ee.toRegex(a,e);return n===!0&&(l.state=s),l},ee.makeRe=(s,e={},t=!1,n=!1)=>{if(!s||typeof s!="string")throw new TypeError("Expected a non-empty string");let r={negated:!1,fastpaths:!0};return e.fastpaths!==!1&&(s[0]==="."||s[0]==="*")&&(r.output=Gn.fastpaths(s,e)),r.output||(r=Gn(s,e)),ee.compileRe(r,e,t,n)},ee.toRegex=(s,e)=>{try{const t=e||{};return new RegExp(s,t.flags||(t.nocase?"i":""))}catch(t){if(e&&e.debug===!0)throw t;return/$^/}},ee.constants=Fu;var Hu=ee,Uu=Hu;const oo=un,ao=uu,Te=Uu,Wn=Ft,lo=s=>s===""||s==="./",z=(s,e,t)=>{e=[].concat(e),s=[].concat(s);let n=new Set,r=new Set,i=new Set,o=0,a=h=>{i.add(h.output),t&&t.onResult&&t.onResult(h)};for(let h=0;h<e.length;h++){let u=Te(String(e[h]),{...t,onResult:a},!0),f=u.state.negated||u.state.negatedExtglob;f&&o++;for(let d of s){let m=u(d,!0);(f?!m.isMatch:m.isMatch)&&(f?n.add(m.output):(n.delete(m.output),r.add(m.output)))}}let c=(o===e.length?[...i]:[...r]).filter(h=>!n.has(h));if(t&&c.length===0){if(t.failglob===!0)throw new Error(`No matches found for "${e.join(", ")}"`);if(t.nonull===!0||t.nullglob===!0)return t.unescape?e.map(h=>h.replace(/\\/g,"")):e}return c};z.match=z,z.matcher=(s,e)=>Te(s,e),z.isMatch=(s,e,t)=>Te(e,t)(s),z.any=z.isMatch,z.not=(s,e,t={})=>{e=[].concat(e).map(String);let n=new Set,r=[],i=a=>{t.onResult&&t.onResult(a),r.push(a.output)},o=new Set(z(s,e,{...t,onResult:i}));for(let a of r)o.has(a)||n.add(a);return[...n]},z.contains=(s,e,t)=>{if(typeof s!="string")throw new TypeError(`Expected a string: "${oo.inspect(s)}"`);if(Array.isArray(e))return e.some(n=>z.contains(s,n,t));if(typeof e=="string"){if(lo(s)||lo(e))return!1;if(s.includes(e)||s.startsWith("./")&&s.slice(2).includes(e))return!0}return z.isMatch(s,e,{...t,contains:!0})},z.matchKeys=(s,e,t)=>{if(!Wn.isObject(s))throw new TypeError("Expected the first argument to be an object");let n=z(Object.keys(s),e,t),r={};for(let i of n)r[i]=s[i];return r},z.some=(s,e,t)=>{let n=[].concat(s);for(let r of[].concat(e)){let i=Te(String(r),t);if(n.some(o=>i(o)))return!0}return!1},z.every=(s,e,t)=>{let n=[].concat(s);for(let r of[].concat(e)){let i=Te(String(r),t);if(!n.every(o=>i(o)))return!1}return!0},z.all=(s,e,t)=>{if(typeof s!="string")throw new TypeError(`Expected a string: "${oo.inspect(s)}"`);return[].concat(e).every(n=>Te(n,t)(s))},z.capture=(s,e,t)=>{let n=Wn.isWindows(t),i=Te.makeRe(String(s),{...t,capture:!0}).exec(n?Wn.toPosixSlashes(e):e);if(i)return i.slice(1).map(o=>o===void 0?"":o)},z.makeRe=(...s)=>Te.makeRe(...s),z.scan=(...s)=>Te.scan(...s),z.parse=(s,e)=>{let t=[];for(let n of[].concat(s||[]))for(let r of ao(String(n),e))t.push(Te.parse(r,e));return t},z.braces=(s,e)=>{if(typeof s!="string")throw new TypeError("Expected a string");return e&&e.nobrace===!0||!/\{.*\}/.test(s)?[s]:ao(s,e)},z.braceExpand=(s,e)=>{if(typeof s!="string")throw new TypeError("Expected a string");return z.braces(s,{...e,expand:!0})};var ju=z;const Ku=nt(ju),co=oe("lint-staged:generateTasks"),Gu=({config:s,cwd:e=process.cwd(),files:t,relative:n=!1})=>{co("Generating linter tasks");const r=t.map(i=>ge(H.relative(e,i)));return Object.entries(s).map(([i,o])=>{const a=i.startsWith("../"),l=r.filter(f=>a?!0:!f.startsWith("..")&&!H.isAbsolute(f)),h=Ku(l,i,{cwd:e,dot:!0,matchBase:!i.includes("/"),posixSlashes:!0,strictBrackets:!0}).map(f=>ge(n?f:H.resolve(e,f))),u={pattern:i,commands:o,fileList:h};return co(`Generated task:
|
|
49
|
-
%O`,u),u})},qu=new RegExp(tl+"$"),
|
|
50
|
-
`).findIndex(r=>r.includes(
|
|
51
|
-
`).filter(Boolean).map(n=>H.resolve(this.gitDir,n));return Q("Found deleted files:",t),t}async backupMergeStatus(){Q("Backing up merge state..."),await Promise.all([ks(this.mergeHeadFilename).then(e=>this.mergeHeadBuffer=e),ks(this.mergeModeFilename).then(e=>this.mergeModeBuffer=e),ks(this.mergeMsgFilename).then(e=>this.mergeMsgBuffer=e)]),Q("Done backing up merge state!")}async restoreMergeStatus(e){Q("Restoring merge state...");try{await Promise.all([this.mergeHeadBuffer&&Vn(this.mergeHeadFilename,this.mergeHeadBuffer),this.mergeModeBuffer&&Vn(this.mergeModeFilename,this.mergeModeBuffer),this.mergeMsgBuffer&&Vn(this.mergeMsgFilename,this.mergeMsgBuffer)]),Q("Done restoring merge state!")}catch(t){Q("Failed restoring merge state with error:"),Q(t),ze(new Error("Merge state could not be restored due to an error!"),e,tf)}}async getPartiallyStagedFiles(){Q("Getting partially staged files...");const t=(await this.execGit(["status","-z"])).split(/\x00(?=[ AMDRCU?!]{2} |$)/).filter(n=>{const[r,i]=n;return r!==" "&&i!==" "&&r!=="?"&&i!=="?"}).map(n=>n.substr(3)).filter(Boolean);return Q("Found partially staged files:",t),t.length?t:null}async prepare(e){try{if(Q("Backing up original state..."),this.partiallyStagedFiles=await this.getPartiallyStagedFiles(),this.partiallyStagedFiles){e.hasPartiallyStagedFiles=!0;const n=this.getHiddenFilepath(zn),r=
|
|
52
|
-
`))}else if(n){const a
|
|
53
|
-
${$e} ${s} failed without output (${a}).`);t.quiet||t.output.push(l)}},$f=async s=>{try{const e=await Cf(s.pid);for(const t of e)try{process.kill(t)}catch(n){Kt('Failed to kill process with pid "%d": %o',t,n)}}catch(e){Kt('Failed to kill process with pid "%d": %o',s.pid,e)}s.kill()},If=(s,e)=>{let t;const n=async()=>{t=$f(e),await t};return s.events.on(er,n,{once:!0}),async()=>{s.events.off(er,n),await t}},Nf=(s,e,t)=>{t.errors.add(jt),t.events.emit(er,jt),
|
|
54
|
-
`)}}ae.defaultYaml={explicit:!1,version:"1.2"},ae.defaultTags={"!!":"tag:yaml.org,2002:"};function
|
|
47
|
+
*/const Ic=un,Mi=$c,Fi=s=>s!==null&&typeof s=="object"&&!Array.isArray(s),Nc=s=>e=>s===!0?Number(e):String(e),Nn=s=>typeof s=="number"||typeof s=="string"&&s!=="",Ft=s=>Number.isInteger(+s),Pn=s=>{let e=`${s}`,t=-1;if(e[0]==="-"&&(e=e.slice(1)),e==="0")return!1;for(;e[++t]==="0";);return t>0},Pc=(s,e,t)=>typeof s=="string"||typeof e=="string"?!0:t.stringify===!0,Bc=(s,e,t)=>{if(e>0){let n=s[0]==="-"?"-":"";n&&(s=s.slice(1)),s=n+s.padStart(n?e-1:e,"0")}return t===!1?String(s):s},Di=(s,e)=>{let t=s[0]==="-"?"-":"";for(t&&(s=s.slice(1),e--);s.length<e;)s="0"+s;return t?"-"+s:s},Mc=(s,e)=>{s.negatives.sort((o,a)=>o<a?-1:o>a?1:0),s.positives.sort((o,a)=>o<a?-1:o>a?1:0);let t=e.capture?"":"?:",n="",r="",i;return s.positives.length&&(n=s.positives.join("|")),s.negatives.length&&(r=`-(${t}${s.negatives.join("|")})`),n&&r?i=`${n}|${r}`:i=n||r,e.wrap?`(${t}${i})`:i},xi=(s,e,t,n)=>{if(t)return Mi(s,e,{wrap:!1,...n});let r=String.fromCharCode(s);if(s===e)return r;let i=String.fromCharCode(e);return`[${r}-${i}]`},Hi=(s,e,t)=>{if(Array.isArray(s)){let n=t.wrap===!0,r=t.capture?"":"?:";return n?`(${r}${s.join("|")})`:s.join("|")}return Mi(s,e,t)},Ui=(...s)=>new RangeError("Invalid range arguments: "+Ic.inspect(...s)),ji=(s,e,t)=>{if(t.strictRanges===!0)throw Ui([s,e]);return[]},Fc=(s,e)=>{if(e.strictRanges===!0)throw new TypeError(`Expected step "${s}" to be a number`);return[]},Dc=(s,e,t=1,n={})=>{let r=Number(s),i=Number(e);if(!Number.isInteger(r)||!Number.isInteger(i)){if(n.strictRanges===!0)throw Ui([s,e]);return[]}r===0&&(r=0),i===0&&(i=0);let o=r>i,a=String(s),l=String(e),c=String(t);t=Math.max(Math.abs(t),1);let f=Pn(a)||Pn(l)||Pn(c),u=f?Math.max(a.length,l.length,c.length):0,h=f===!1&&Pc(s,e,n)===!1,d=n.transform||Nc(h);if(n.toRegex&&t===1)return xi(Di(s,u),Di(e,u),!0,n);let m={negatives:[],positives:[]},p=S=>m[S<0?"negatives":"positives"].push(Math.abs(S)),g=[],y=0;for(;o?r>=i:r<=i;)n.toRegex===!0&&t>1?p(r):g.push(Bc(d(r,y),u,h)),r=o?r-t:r+t,y++;return n.toRegex===!0?t>1?Mc(m,n):Hi(g,null,{wrap:!1,...n}):g},xc=(s,e,t=1,n={})=>{if(!Ft(s)&&s.length>1||!Ft(e)&&e.length>1)return ji(s,e,n);let r=n.transform||(h=>String.fromCharCode(h)),i=`${s}`.charCodeAt(0),o=`${e}`.charCodeAt(0),a=i>o,l=Math.min(i,o),c=Math.max(i,o);if(n.toRegex&&t===1)return xi(l,c,!1,n);let f=[],u=0;for(;a?i>=o:i<=o;)f.push(r(i,u)),i=a?i-t:i+t,u++;return n.toRegex===!0?Hi(f,null,{wrap:!1,options:n}):f},Rs=(s,e,t,n={})=>{if(e==null&&Nn(s))return[s];if(!Nn(s)||!Nn(e))return ji(s,e,n);if(typeof t=="function")return Rs(s,e,1,{transform:t});if(Fi(t))return Rs(s,e,0,t);let r={...n};return r.capture===!0&&(r.wrap=!0),t=t||r.step||1,Ft(t)?Ft(s)&&Ft(e)?Dc(s,e,t,r):xc(s,e,Math.max(Math.abs(t),1),r):t!=null&&!Fi(t)?Fc(t,r):Rs(s,e,1,t)};var Ki=Rs;const Hc=Ki,Gi=Cs,Uc=(s,e={})=>{let t=(n,r={})=>{let i=Gi.isInvalidBrace(r),o=n.invalid===!0&&e.escapeInvalid===!0,a=i===!0||o===!0,l=e.escapeInvalid===!0?"\\":"",c="";if(n.isOpen===!0||n.isClose===!0)return l+n.value;if(n.type==="open")return a?l+n.value:"(";if(n.type==="close")return a?l+n.value:")";if(n.type==="comma")return n.prev.type==="comma"?"":a?n.value:"|";if(n.value)return n.value;if(n.nodes&&n.ranges>0){let f=Gi.reduce(n.nodes),u=Hc(...f,{...e,wrap:!1,toRegex:!0});if(u.length!==0)return f.length>1&&u.length>1?`(${u})`:u}if(n.nodes)for(let f of n.nodes)c+=t(f,n);return c};return t(s)};var jc=Uc;const Kc=Ki,qi=$n,ft=Cs,Ye=(s="",e="",t=!1)=>{let n=[];if(s=[].concat(s),e=[].concat(e),!e.length)return s;if(!s.length)return t?ft.flatten(e).map(r=>`{${r}}`):e;for(let r of s)if(Array.isArray(r))for(let i of r)n.push(Ye(i,e,t));else for(let i of e)t===!0&&typeof i=="string"&&(i=`{${i}}`),n.push(Array.isArray(i)?Ye(r,i,t):r+i);return ft.flatten(n)},Gc=(s,e={})=>{let t=e.rangeLimit===void 0?1e3:e.rangeLimit,n=(r,i={})=>{r.queue=[];let o=i,a=i.queue;for(;o.type!=="brace"&&o.type!=="root"&&o.parent;)o=o.parent,a=o.queue;if(r.invalid||r.dollar){a.push(Ye(a.pop(),qi(r,e)));return}if(r.type==="brace"&&r.invalid!==!0&&r.nodes.length===2){a.push(Ye(a.pop(),["{}"]));return}if(r.nodes&&r.ranges>0){let u=ft.reduce(r.nodes);if(ft.exceedsLimit(...u,e.step,t))throw new RangeError("expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.");let h=Kc(...u,e);h.length===0&&(h=qi(r,e)),a.push(Ye(a.pop(),h)),r.nodes=[];return}let l=ft.encloseBrace(r),c=r.queue,f=r;for(;f.type!=="brace"&&f.type!=="root"&&f.parent;)f=f.parent,c=f.queue;for(let u=0;u<r.nodes.length;u++){let h=r.nodes[u];if(h.type==="comma"&&r.type==="brace"){u===1&&c.push(""),c.push("");continue}if(h.type==="close"){a.push(Ye(a.pop(),c,l));continue}if(h.value&&h.type!=="open"){c.push(Ye(c.pop(),h.value));continue}h.nodes&&n(h,r)}return c};return ft.flatten(n(s))};var qc=Gc,Wc={MAX_LENGTH:1024*64,CHAR_0:"0",CHAR_9:"9",CHAR_UPPERCASE_A:"A",CHAR_LOWERCASE_A:"a",CHAR_UPPERCASE_Z:"Z",CHAR_LOWERCASE_Z:"z",CHAR_LEFT_PARENTHESES:"(",CHAR_RIGHT_PARENTHESES:")",CHAR_ASTERISK:"*",CHAR_AMPERSAND:"&",CHAR_AT:"@",CHAR_BACKSLASH:"\\",CHAR_BACKTICK:"`",CHAR_CARRIAGE_RETURN:"\r",CHAR_CIRCUMFLEX_ACCENT:"^",CHAR_COLON:":",CHAR_COMMA:",",CHAR_DOLLAR:"$",CHAR_DOT:".",CHAR_DOUBLE_QUOTE:'"',CHAR_EQUAL:"=",CHAR_EXCLAMATION_MARK:"!",CHAR_FORM_FEED:"\f",CHAR_FORWARD_SLASH:"/",CHAR_HASH:"#",CHAR_HYPHEN_MINUS:"-",CHAR_LEFT_ANGLE_BRACKET:"<",CHAR_LEFT_CURLY_BRACE:"{",CHAR_LEFT_SQUARE_BRACKET:"[",CHAR_LINE_FEED:`
|
|
48
|
+
`,CHAR_NO_BREAK_SPACE:"\xA0",CHAR_PERCENT:"%",CHAR_PLUS:"+",CHAR_QUESTION_MARK:"?",CHAR_RIGHT_ANGLE_BRACKET:">",CHAR_RIGHT_CURLY_BRACE:"}",CHAR_RIGHT_SQUARE_BRACKET:"]",CHAR_SEMICOLON:";",CHAR_SINGLE_QUOTE:"'",CHAR_SPACE:" ",CHAR_TAB:" ",CHAR_UNDERSCORE:"_",CHAR_VERTICAL_LINE:"|",CHAR_ZERO_WIDTH_NOBREAK_SPACE:"\uFEFF"};const Yc=$n,{MAX_LENGTH:Wi,CHAR_BACKSLASH:Bn,CHAR_BACKTICK:Vc,CHAR_COMMA:zc,CHAR_DOT:Qc,CHAR_LEFT_PARENTHESES:Xc,CHAR_RIGHT_PARENTHESES:Jc,CHAR_LEFT_CURLY_BRACE:Zc,CHAR_RIGHT_CURLY_BRACE:eu,CHAR_LEFT_SQUARE_BRACKET:Yi,CHAR_RIGHT_SQUARE_BRACKET:Vi,CHAR_DOUBLE_QUOTE:tu,CHAR_SINGLE_QUOTE:su,CHAR_NO_BREAK_SPACE:nu,CHAR_ZERO_WIDTH_NOBREAK_SPACE:ru}=Wc,iu=(s,e={})=>{if(typeof s!="string")throw new TypeError("Expected a string");let t=e||{},n=typeof t.maxLength=="number"?Math.min(Wi,t.maxLength):Wi;if(s.length>n)throw new SyntaxError(`Input length (${s.length}), exceeds max characters (${n})`);let r={type:"root",input:s,nodes:[]},i=[r],o=r,a=r,l=0,c=s.length,f=0,u=0,h;const d=()=>s[f++],m=p=>{if(p.type==="text"&&a.type==="dot"&&(a.type="text"),a&&a.type==="text"&&p.type==="text"){a.value+=p.value;return}return o.nodes.push(p),p.parent=o,p.prev=a,a=p,p};for(m({type:"bos"});f<c;)if(o=i[i.length-1],h=d(),!(h===ru||h===nu)){if(h===Bn){m({type:"text",value:(e.keepEscaping?h:"")+d()});continue}if(h===Vi){m({type:"text",value:"\\"+h});continue}if(h===Yi){l++;let p;for(;f<c&&(p=d());){if(h+=p,p===Yi){l++;continue}if(p===Bn){h+=d();continue}if(p===Vi&&(l--,l===0))break}m({type:"text",value:h});continue}if(h===Xc){o=m({type:"paren",nodes:[]}),i.push(o),m({type:"text",value:h});continue}if(h===Jc){if(o.type!=="paren"){m({type:"text",value:h});continue}o=i.pop(),m({type:"text",value:h}),o=i[i.length-1];continue}if(h===tu||h===su||h===Vc){let p=h,g;for(e.keepQuotes!==!0&&(h="");f<c&&(g=d());){if(g===Bn){h+=g+d();continue}if(g===p){e.keepQuotes===!0&&(h+=g);break}h+=g}m({type:"text",value:h});continue}if(h===Zc){u++;let g={type:"brace",open:!0,close:!1,dollar:a.value&&a.value.slice(-1)==="$"||o.dollar===!0,depth:u,commas:0,ranges:0,nodes:[]};o=m(g),i.push(o),m({type:"open",value:h});continue}if(h===eu){if(o.type!=="brace"){m({type:"text",value:h});continue}let p="close";o=i.pop(),o.close=!0,m({type:p,value:h}),u--,o=i[i.length-1];continue}if(h===zc&&u>0){if(o.ranges>0){o.ranges=0;let p=o.nodes.shift();o.nodes=[p,{type:"text",value:Yc(o)}]}m({type:"comma",value:h}),o.commas++;continue}if(h===Qc&&u>0&&o.commas===0){let p=o.nodes;if(u===0||p.length===0){m({type:"text",value:h});continue}if(a.type==="dot"){if(o.range=[],a.value+=h,a.type="range",o.nodes.length!==3&&o.nodes.length!==5){o.invalid=!0,o.ranges=0,a.type="text";continue}o.ranges++,o.args=[];continue}if(a.type==="range"){p.pop();let g=p[p.length-1];g.value+=a.value+h,a=g,o.ranges--;continue}m({type:"dot",value:h});continue}m({type:"text",value:h})}do if(o=i.pop(),o.type!=="root"){o.nodes.forEach(y=>{y.nodes||(y.type==="open"&&(y.isOpen=!0),y.type==="close"&&(y.isClose=!0),y.nodes||(y.type="text"),y.invalid=!0)});let p=i[i.length-1],g=p.nodes.indexOf(o);p.nodes.splice(g,1,...o.nodes)}while(i.length>0);return m({type:"eos"}),r};var ou=iu;const zi=$n,au=jc,lu=qc,cu=ou,fe=(s,e={})=>{let t=[];if(Array.isArray(s))for(let n of s){let r=fe.create(n,e);Array.isArray(r)?t.push(...r):t.push(r)}else t=[].concat(fe.create(s,e));return e&&e.expand===!0&&e.nodupes===!0&&(t=[...new Set(t)]),t};fe.parse=(s,e={})=>cu(s,e),fe.stringify=(s,e={})=>zi(typeof s=="string"?fe.parse(s,e):s,e),fe.compile=(s,e={})=>(typeof s=="string"&&(s=fe.parse(s,e)),au(s,e)),fe.expand=(s,e={})=>{typeof s=="string"&&(s=fe.parse(s,e));let t=lu(s,e);return e.noempty===!0&&(t=t.filter(Boolean)),e.nodupes===!0&&(t=[...new Set(t)]),t},fe.create=(s,e={})=>s===""||s.length<3?[s]:e.expand!==!0?fe.compile(s,e):fe.expand(s,e);var uu=fe,Dt={};const fu=fn,Re="\\\\/",Qi=`[^${Re}]`,Ie="\\.",hu="\\+",pu="\\?",Ts="\\/",du="(?=.)",Xi="[^/]",Mn=`(?:${Ts}|$)`,Ji=`(?:^|${Ts})`,Fn=`${Ie}{1,2}${Mn}`,gu=`(?!${Ie})`,mu=`(?!${Ji}${Fn})`,yu=`(?!${Ie}{0,1}${Mn})`,bu=`(?!${Fn})`,wu=`[^.${Ts}]`,Eu=`${Xi}*?`,Zi={DOT_LITERAL:Ie,PLUS_LITERAL:hu,QMARK_LITERAL:pu,SLASH_LITERAL:Ts,ONE_CHAR:du,QMARK:Xi,END_ANCHOR:Mn,DOTS_SLASH:Fn,NO_DOT:gu,NO_DOTS:mu,NO_DOT_SLASH:yu,NO_DOTS_SLASH:bu,QMARK_NO_DOT:wu,STAR:Eu,START_ANCHOR:Ji},Su={...Zi,SLASH_LITERAL:`[${Re}]`,QMARK:Qi,STAR:`${Qi}*?`,DOTS_SLASH:`${Ie}{1,2}(?:[${Re}]|$)`,NO_DOT:`(?!${Ie})`,NO_DOTS:`(?!(?:^|[${Re}])${Ie}{1,2}(?:[${Re}]|$))`,NO_DOT_SLASH:`(?!${Ie}{0,1}(?:[${Re}]|$))`,NO_DOTS_SLASH:`(?!${Ie}{1,2}(?:[${Re}]|$))`,QMARK_NO_DOT:`[^.${Re}]`,START_ANCHOR:`(?:^|[${Re}])`,END_ANCHOR:`(?:[${Re}]|$)`},Au={alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"};var _s={MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:Au,REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,SEP:fu.sep,extglobChars(s){return{"!":{type:"negate",open:"(?:(?!(?:",close:`))${s.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}},globChars(s){return s===!0?Su:Zi}};(function(s){const e=fn,t=process.platform==="win32",{REGEX_BACKSLASH:n,REGEX_REMOVE_BACKSLASH:r,REGEX_SPECIAL_CHARS:i,REGEX_SPECIAL_CHARS_GLOBAL:o}=_s;s.isObject=a=>a!==null&&typeof a=="object"&&!Array.isArray(a),s.hasRegexChars=a=>i.test(a),s.isRegexChar=a=>a.length===1&&s.hasRegexChars(a),s.escapeRegex=a=>a.replace(o,"\\$1"),s.toPosixSlashes=a=>a.replace(n,"/"),s.removeBackslashes=a=>a.replace(r,l=>l==="\\"?"":l),s.supportsLookbehinds=()=>{const a=process.version.slice(1).split(".").map(Number);return a.length===3&&a[0]>=9||a[0]===8&&a[1]>=10},s.isWindows=a=>a&&typeof a.windows=="boolean"?a.windows:t===!0||e.sep==="\\",s.escapeLast=(a,l,c)=>{const f=a.lastIndexOf(l,c);return f===-1?a:a[f-1]==="\\"?s.escapeLast(a,l,f-1):`${a.slice(0,f)}\\${a.slice(f)}`},s.removePrefix=(a,l={})=>{let c=a;return c.startsWith("./")&&(c=c.slice(2),l.prefix="./"),c},s.wrapOutput=(a,l={},c={})=>{const f=c.contains?"":"^",u=c.contains?"":"$";let h=`${f}(?:${a})${u}`;return l.negated===!0&&(h=`(?:^(?!${h}).*$)`),h}})(Dt);const eo=Dt,{CHAR_ASTERISK:Dn,CHAR_AT:Ou,CHAR_BACKWARD_SLASH:xt,CHAR_COMMA:Cu,CHAR_DOT:xn,CHAR_EXCLAMATION_MARK:Hn,CHAR_FORWARD_SLASH:to,CHAR_LEFT_CURLY_BRACE:Un,CHAR_LEFT_PARENTHESES:jn,CHAR_LEFT_SQUARE_BRACKET:Ru,CHAR_PLUS:Tu,CHAR_QUESTION_MARK:so,CHAR_RIGHT_CURLY_BRACE:_u,CHAR_RIGHT_PARENTHESES:no,CHAR_RIGHT_SQUARE_BRACKET:vu}=_s,ro=s=>s===to||s===xt,io=s=>{s.isPrefix!==!0&&(s.depth=s.isGlobstar?1/0:1)},Lu=(s,e)=>{const t=e||{},n=s.length-1,r=t.parts===!0||t.scanToEnd===!0,i=[],o=[],a=[];let l=s,c=-1,f=0,u=0,h=!1,d=!1,m=!1,p=!1,g=!1,y=!1,S=!1,A=!1,L=!1,R=!1,O=0,I,_,k={value:"",depth:0,isGlob:!1};const j=()=>c>=n,E=()=>l.charCodeAt(c+1),$=()=>(I=_,l.charCodeAt(++c));for(;c<n;){_=$();let D;if(_===xt){S=k.backslashes=!0,_=$(),_===Un&&(y=!0);continue}if(y===!0||_===Un){for(O++;j()!==!0&&(_=$());){if(_===xt){S=k.backslashes=!0,$();continue}if(_===Un){O++;continue}if(y!==!0&&_===xn&&(_=$())===xn){if(h=k.isBrace=!0,m=k.isGlob=!0,R=!0,r===!0)continue;break}if(y!==!0&&_===Cu){if(h=k.isBrace=!0,m=k.isGlob=!0,R=!0,r===!0)continue;break}if(_===_u&&(O--,O===0)){y=!1,h=k.isBrace=!0,R=!0;break}}if(r===!0)continue;break}if(_===to){if(i.push(c),o.push(k),k={value:"",depth:0,isGlob:!1},R===!0)continue;if(I===xn&&c===f+1){f+=2;continue}u=c+1;continue}if(t.noext!==!0&&(_===Tu||_===Ou||_===Dn||_===so||_===Hn)===!0&&E()===jn){if(m=k.isGlob=!0,p=k.isExtglob=!0,R=!0,_===Hn&&c===f&&(L=!0),r===!0){for(;j()!==!0&&(_=$());){if(_===xt){S=k.backslashes=!0,_=$();continue}if(_===no){m=k.isGlob=!0,R=!0;break}}continue}break}if(_===Dn){if(I===Dn&&(g=k.isGlobstar=!0),m=k.isGlob=!0,R=!0,r===!0)continue;break}if(_===so){if(m=k.isGlob=!0,R=!0,r===!0)continue;break}if(_===Ru){for(;j()!==!0&&(D=$());){if(D===xt){S=k.backslashes=!0,$();continue}if(D===vu){d=k.isBracket=!0,m=k.isGlob=!0,R=!0;break}}if(r===!0)continue;break}if(t.nonegate!==!0&&_===Hn&&c===f){A=k.negated=!0,f++;continue}if(t.noparen!==!0&&_===jn){if(m=k.isGlob=!0,r===!0){for(;j()!==!0&&(_=$());){if(_===jn){S=k.backslashes=!0,_=$();continue}if(_===no){R=!0;break}}continue}break}if(m===!0){if(R=!0,r===!0)continue;break}}t.noext===!0&&(p=!1,m=!1);let G=l,Ae="",b="";f>0&&(Ae=l.slice(0,f),l=l.slice(f),u-=f),G&&m===!0&&u>0?(G=l.slice(0,u),b=l.slice(u)):m===!0?(G="",b=l):G=l,G&&G!==""&&G!=="/"&&G!==l&&ro(G.charCodeAt(G.length-1))&&(G=G.slice(0,-1)),t.unescape===!0&&(b&&(b=eo.removeBackslashes(b)),G&&S===!0&&(G=eo.removeBackslashes(G)));const w={prefix:Ae,input:s,start:f,base:G,glob:b,isBrace:h,isBracket:d,isGlob:m,isExtglob:p,isGlobstar:g,negated:A,negatedExtglob:L};if(t.tokens===!0&&(w.maxDepth=0,ro(_)||o.push(k),w.tokens=o),t.parts===!0||t.tokens===!0){let D;for(let x=0;x<i.length;x++){const de=D?D+1:f,ue=i[x],ne=s.slice(de,ue);t.tokens&&(x===0&&f!==0?(o[x].isPrefix=!0,o[x].value=Ae):o[x].value=ne,io(o[x]),w.maxDepth+=o[x].depth),(x!==0||ne!=="")&&a.push(ne),D=ue}if(D&&D+1<s.length){const x=s.slice(D+1);a.push(x),t.tokens&&(o[o.length-1].value=x,io(o[o.length-1]),w.maxDepth+=o[o.length-1].depth)}w.slashes=i,w.parts=a}return w};var ku=Lu;const vs=_s,he=Dt,{MAX_LENGTH:Ls,POSIX_REGEX_SOURCE:$u,REGEX_NON_SPECIAL_CHARS:Iu,REGEX_SPECIAL_CHARS_BACKREF:Nu,REPLACEMENTS:oo}=vs,Pu=(s,e)=>{if(typeof e.expandRange=="function")return e.expandRange(...s,e);s.sort();const t=`[${s.join("-")}]`;try{new RegExp(t)}catch{return s.map(r=>he.escapeRegex(r)).join("..")}return t},ht=(s,e)=>`Missing ${s}: "${e}" - use "\\\\${e}" to match literal characters`,Kn=(s,e)=>{if(typeof s!="string")throw new TypeError("Expected a string");s=oo[s]||s;const t={...e},n=typeof t.maxLength=="number"?Math.min(Ls,t.maxLength):Ls;let r=s.length;if(r>n)throw new SyntaxError(`Input length: ${r}, exceeds maximum allowed length: ${n}`);const i={type:"bos",value:"",output:t.prepend||""},o=[i],a=t.capture?"":"?:",l=he.isWindows(e),c=vs.globChars(l),f=vs.extglobChars(c),{DOT_LITERAL:u,PLUS_LITERAL:h,SLASH_LITERAL:d,ONE_CHAR:m,DOTS_SLASH:p,NO_DOT:g,NO_DOT_SLASH:y,NO_DOTS_SLASH:S,QMARK:A,QMARK_NO_DOT:L,STAR:R,START_ANCHOR:O}=c,I=T=>`(${a}(?:(?!${O}${T.dot?p:u}).)*?)`,_=t.dot?"":g,k=t.dot?A:L;let j=t.bash===!0?I(t):R;t.capture&&(j=`(${j})`),typeof t.noext=="boolean"&&(t.noextglob=t.noext);const E={input:s,index:-1,start:0,dot:t.dot===!0,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:o};s=he.removePrefix(s,E),r=s.length;const $=[],G=[],Ae=[];let b=i,w;const D=()=>E.index===r-1,x=E.peek=(T=1)=>s[E.index+T],de=E.advance=()=>s[++E.index]||"",ue=()=>s.slice(E.index+1),ne=(T="",U=0)=>{E.consumed+=T,E.index+=U},Fe=T=>{E.output+=T.output!=null?T.output:T.value,ne(T.value)},et=()=>{let T=1;for(;x()==="!"&&(x(2)!=="("||x(3)==="?");)de(),E.start++,T++;return T%2===0?!1:(E.negated=!0,E.start++,!0)},tt=T=>{E[T]++,Ae.push(T)},we=T=>{E[T]--,Ae.pop()},M=T=>{if(b.type==="globstar"){const U=E.braces>0&&(T.type==="comma"||T.type==="brace"),C=T.extglob===!0||$.length&&(T.type==="pipe"||T.type==="paren");T.type!=="slash"&&T.type!=="paren"&&!U&&!C&&(E.output=E.output.slice(0,-b.output.length),b.type="star",b.value="*",b.output=j,E.output+=b.output)}if($.length&&T.type!=="paren"&&($[$.length-1].inner+=T.value),(T.value||T.output)&&Fe(T),b&&b.type==="text"&&T.type==="text"){b.value+=T.value,b.output=(b.output||"")+T.value;return}T.prev=b,o.push(T),b=T},le=(T,U)=>{const C={...f[U],conditions:1,inner:""};C.prev=b,C.parens=E.parens,C.output=E.output;const F=(t.capture?"(":"")+C.open;tt("parens"),M({type:T,value:U,output:E.output?"":m}),M({type:"paren",extglob:!0,value:de(),output:F}),$.push(C)},st=T=>{let U=T.close+(t.capture?")":""),C;if(T.type==="negate"){let F=j;if(T.inner&&T.inner.length>1&&T.inner.includes("/")&&(F=I(t)),(F!==j||D()||/^\)+$/.test(ue()))&&(U=T.close=`)$))${F}`),T.inner.includes("*")&&(C=ue())&&/^\.[^\\/.]+$/.test(C)){const J=Kn(C,{...e,fastpaths:!1}).output;U=T.close=`)${J})${F})`}T.prev.type==="bos"&&(E.negatedExtglob=!0)}M({type:"paren",extglob:!0,value:w,output:U}),we("parens")};if(t.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(s)){let T=!1,U=s.replace(Nu,(C,F,J,ie,se,ln)=>ie==="\\"?(T=!0,C):ie==="?"?F?F+ie+(se?A.repeat(se.length):""):ln===0?k+(se?A.repeat(se.length):""):A.repeat(J.length):ie==="."?u.repeat(J.length):ie==="*"?F?F+ie+(se?j:""):j:F?C:`\\${C}`);return T===!0&&(t.unescape===!0?U=U.replace(/\\/g,""):U=U.replace(/\\+/g,C=>C.length%2===0?"\\\\":C?"\\":"")),U===s&&t.contains===!0?(E.output=s,E):(E.output=he.wrapOutput(U,E,e),E)}for(;!D();){if(w=de(),w==="\0")continue;if(w==="\\"){const C=x();if(C==="/"&&t.bash!==!0||C==="."||C===";")continue;if(!C){w+="\\",M({type:"text",value:w});continue}const F=/^\\+/.exec(ue());let J=0;if(F&&F[0].length>2&&(J=F[0].length,E.index+=J,J%2!==0&&(w+="\\")),t.unescape===!0?w=de():w+=de(),E.brackets===0){M({type:"text",value:w});continue}}if(E.brackets>0&&(w!=="]"||b.value==="["||b.value==="[^")){if(t.posix!==!1&&w===":"){const C=b.value.slice(1);if(C.includes("[")&&(b.posix=!0,C.includes(":"))){const F=b.value.lastIndexOf("["),J=b.value.slice(0,F),ie=b.value.slice(F+2),se=$u[ie];if(se){b.value=J+se,E.backtrack=!0,de(),!i.output&&o.indexOf(b)===1&&(i.output=m);continue}}}(w==="["&&x()!==":"||w==="-"&&x()==="]")&&(w=`\\${w}`),w==="]"&&(b.value==="["||b.value==="[^")&&(w=`\\${w}`),t.posix===!0&&w==="!"&&b.value==="["&&(w="^"),b.value+=w,Fe({value:w});continue}if(E.quotes===1&&w!=='"'){w=he.escapeRegex(w),b.value+=w,Fe({value:w});continue}if(w==='"'){E.quotes=E.quotes===1?0:1,t.keepQuotes===!0&&M({type:"text",value:w});continue}if(w==="("){tt("parens"),M({type:"paren",value:w});continue}if(w===")"){if(E.parens===0&&t.strictBrackets===!0)throw new SyntaxError(ht("opening","("));const C=$[$.length-1];if(C&&E.parens===C.parens+1){st($.pop());continue}M({type:"paren",value:w,output:E.parens?")":"\\)"}),we("parens");continue}if(w==="["){if(t.nobracket===!0||!ue().includes("]")){if(t.nobracket!==!0&&t.strictBrackets===!0)throw new SyntaxError(ht("closing","]"));w=`\\${w}`}else tt("brackets");M({type:"bracket",value:w});continue}if(w==="]"){if(t.nobracket===!0||b&&b.type==="bracket"&&b.value.length===1){M({type:"text",value:w,output:`\\${w}`});continue}if(E.brackets===0){if(t.strictBrackets===!0)throw new SyntaxError(ht("opening","["));M({type:"text",value:w,output:`\\${w}`});continue}we("brackets");const C=b.value.slice(1);if(b.posix!==!0&&C[0]==="^"&&!C.includes("/")&&(w=`/${w}`),b.value+=w,Fe({value:w}),t.literalBrackets===!1||he.hasRegexChars(C))continue;const F=he.escapeRegex(b.value);if(E.output=E.output.slice(0,-b.value.length),t.literalBrackets===!0){E.output+=F,b.value=F;continue}b.value=`(${a}${F}|${b.value})`,E.output+=b.value;continue}if(w==="{"&&t.nobrace!==!0){tt("braces");const C={type:"brace",value:w,output:"(",outputIndex:E.output.length,tokensIndex:E.tokens.length};G.push(C),M(C);continue}if(w==="}"){const C=G[G.length-1];if(t.nobrace===!0||!C){M({type:"text",value:w,output:w});continue}let F=")";if(C.dots===!0){const J=o.slice(),ie=[];for(let se=J.length-1;se>=0&&(o.pop(),J[se].type!=="brace");se--)J[se].type!=="dots"&&ie.unshift(J[se].value);F=Pu(ie,t),E.backtrack=!0}if(C.comma!==!0&&C.dots!==!0){const J=E.output.slice(0,C.outputIndex),ie=E.tokens.slice(C.tokensIndex);C.value=C.output="\\{",w=F="\\}",E.output=J;for(const se of ie)E.output+=se.output||se.value}M({type:"brace",value:w,output:F}),we("braces"),G.pop();continue}if(w==="|"){$.length>0&&$[$.length-1].conditions++,M({type:"text",value:w});continue}if(w===","){let C=w;const F=G[G.length-1];F&&Ae[Ae.length-1]==="braces"&&(F.comma=!0,C="|"),M({type:"comma",value:w,output:C});continue}if(w==="/"){if(b.type==="dot"&&E.index===E.start+1){E.start=E.index+1,E.consumed="",E.output="",o.pop(),b=i;continue}M({type:"slash",value:w,output:d});continue}if(w==="."){if(E.braces>0&&b.type==="dot"){b.value==="."&&(b.output=u);const C=G[G.length-1];b.type="dots",b.output+=w,b.value+=w,C.dots=!0;continue}if(E.braces+E.parens===0&&b.type!=="bos"&&b.type!=="slash"){M({type:"text",value:w,output:u});continue}M({type:"dot",value:w,output:u});continue}if(w==="?"){if(!(b&&b.value==="(")&&t.noextglob!==!0&&x()==="("&&x(2)!=="?"){le("qmark",w);continue}if(b&&b.type==="paren"){const F=x();let J=w;if(F==="<"&&!he.supportsLookbehinds())throw new Error("Node.js v10 or higher is required for regex lookbehinds");(b.value==="("&&!/[!=<:]/.test(F)||F==="<"&&!/<([!=]|\w+>)/.test(ue()))&&(J=`\\${w}`),M({type:"text",value:w,output:J});continue}if(t.dot!==!0&&(b.type==="slash"||b.type==="bos")){M({type:"qmark",value:w,output:L});continue}M({type:"qmark",value:w,output:A});continue}if(w==="!"){if(t.noextglob!==!0&&x()==="("&&(x(2)!=="?"||!/[!=<:]/.test(x(3)))){le("negate",w);continue}if(t.nonegate!==!0&&E.index===0){et();continue}}if(w==="+"){if(t.noextglob!==!0&&x()==="("&&x(2)!=="?"){le("plus",w);continue}if(b&&b.value==="("||t.regex===!1){M({type:"plus",value:w,output:h});continue}if(b&&(b.type==="bracket"||b.type==="paren"||b.type==="brace")||E.parens>0){M({type:"plus",value:w});continue}M({type:"plus",value:h});continue}if(w==="@"){if(t.noextglob!==!0&&x()==="("&&x(2)!=="?"){M({type:"at",extglob:!0,value:w,output:""});continue}M({type:"text",value:w});continue}if(w!=="*"){(w==="$"||w==="^")&&(w=`\\${w}`);const C=Iu.exec(ue());C&&(w+=C[0],E.index+=C[0].length),M({type:"text",value:w});continue}if(b&&(b.type==="globstar"||b.star===!0)){b.type="star",b.star=!0,b.value+=w,b.output=j,E.backtrack=!0,E.globstar=!0,ne(w);continue}let T=ue();if(t.noextglob!==!0&&/^\([^?]/.test(T)){le("star",w);continue}if(b.type==="star"){if(t.noglobstar===!0){ne(w);continue}const C=b.prev,F=C.prev,J=C.type==="slash"||C.type==="bos",ie=F&&(F.type==="star"||F.type==="globstar");if(t.bash===!0&&(!J||T[0]&&T[0]!=="/")){M({type:"star",value:w,output:""});continue}const se=E.braces>0&&(C.type==="comma"||C.type==="brace"),ln=$.length&&(C.type==="pipe"||C.type==="paren");if(!J&&C.type!=="paren"&&!se&&!ln){M({type:"star",value:w,output:""});continue}for(;T.slice(0,3)==="/**";){const ys=s[E.index+4];if(ys&&ys!=="/")break;T=T.slice(3),ne("/**",3)}if(C.type==="bos"&&D()){b.type="globstar",b.value+=w,b.output=I(t),E.output=b.output,E.globstar=!0,ne(w);continue}if(C.type==="slash"&&C.prev.type!=="bos"&&!ie&&D()){E.output=E.output.slice(0,-(C.output+b.output).length),C.output=`(?:${C.output}`,b.type="globstar",b.output=I(t)+(t.strictSlashes?")":"|$)"),b.value+=w,E.globstar=!0,E.output+=C.output+b.output,ne(w);continue}if(C.type==="slash"&&C.prev.type!=="bos"&&T[0]==="/"){const ys=T[1]!==void 0?"|$":"";E.output=E.output.slice(0,-(C.output+b.output).length),C.output=`(?:${C.output}`,b.type="globstar",b.output=`${I(t)}${d}|${d}${ys})`,b.value+=w,E.output+=C.output+b.output,E.globstar=!0,ne(w+de()),M({type:"slash",value:"/",output:""});continue}if(C.type==="bos"&&T[0]==="/"){b.type="globstar",b.value+=w,b.output=`(?:^|${d}|${I(t)}${d})`,E.output=b.output,E.globstar=!0,ne(w+de()),M({type:"slash",value:"/",output:""});continue}E.output=E.output.slice(0,-b.output.length),b.type="globstar",b.output=I(t),b.value+=w,E.output+=b.output,E.globstar=!0,ne(w);continue}const U={type:"star",value:w,output:j};if(t.bash===!0){U.output=".*?",(b.type==="bos"||b.type==="slash")&&(U.output=_+U.output),M(U);continue}if(b&&(b.type==="bracket"||b.type==="paren")&&t.regex===!0){U.output=w,M(U);continue}(E.index===E.start||b.type==="slash"||b.type==="dot")&&(b.type==="dot"?(E.output+=y,b.output+=y):t.dot===!0?(E.output+=S,b.output+=S):(E.output+=_,b.output+=_),x()!=="*"&&(E.output+=m,b.output+=m)),M(U)}for(;E.brackets>0;){if(t.strictBrackets===!0)throw new SyntaxError(ht("closing","]"));E.output=he.escapeLast(E.output,"["),we("brackets")}for(;E.parens>0;){if(t.strictBrackets===!0)throw new SyntaxError(ht("closing",")"));E.output=he.escapeLast(E.output,"("),we("parens")}for(;E.braces>0;){if(t.strictBrackets===!0)throw new SyntaxError(ht("closing","}"));E.output=he.escapeLast(E.output,"{"),we("braces")}if(t.strictSlashes!==!0&&(b.type==="star"||b.type==="bracket")&&M({type:"maybe_slash",value:"",output:`${d}?`}),E.backtrack===!0){E.output="";for(const T of E.tokens)E.output+=T.output!=null?T.output:T.value,T.suffix&&(E.output+=T.suffix)}return E};Kn.fastpaths=(s,e)=>{const t={...e},n=typeof t.maxLength=="number"?Math.min(Ls,t.maxLength):Ls,r=s.length;if(r>n)throw new SyntaxError(`Input length: ${r}, exceeds maximum allowed length: ${n}`);s=oo[s]||s;const i=he.isWindows(e),{DOT_LITERAL:o,SLASH_LITERAL:a,ONE_CHAR:l,DOTS_SLASH:c,NO_DOT:f,NO_DOTS:u,NO_DOTS_SLASH:h,STAR:d,START_ANCHOR:m}=vs.globChars(i),p=t.dot?u:f,g=t.dot?h:f,y=t.capture?"":"?:",S={negated:!1,prefix:""};let A=t.bash===!0?".*?":d;t.capture&&(A=`(${A})`);const L=_=>_.noglobstar===!0?A:`(${y}(?:(?!${m}${_.dot?c:o}).)*?)`,R=_=>{switch(_){case"*":return`${p}${l}${A}`;case".*":return`${o}${l}${A}`;case"*.*":return`${p}${A}${o}${l}${A}`;case"*/*":return`${p}${A}${a}${l}${g}${A}`;case"**":return p+L(t);case"**/*":return`(?:${p}${L(t)}${a})?${g}${l}${A}`;case"**/*.*":return`(?:${p}${L(t)}${a})?${g}${A}${o}${l}${A}`;case"**/.*":return`(?:${p}${L(t)}${a})?${o}${l}${A}`;default:{const k=/^(.*?)\.(\w+)$/.exec(_);if(!k)return;const j=R(k[1]);return j?j+o+k[2]:void 0}}},O=he.removePrefix(s,S);let I=R(O);return I&&t.strictSlashes!==!0&&(I+=`${a}?`),I};var Bu=Kn;const Mu=fn,Fu=ku,Gn=Bu,qn=Dt,Du=_s,xu=s=>s&&typeof s=="object"&&!Array.isArray(s),ee=(s,e,t=!1)=>{if(Array.isArray(s)){const f=s.map(h=>ee(h,e,t));return h=>{for(const d of f){const m=d(h);if(m)return m}return!1}}const n=xu(s)&&s.tokens&&s.input;if(s===""||typeof s!="string"&&!n)throw new TypeError("Expected pattern to be a non-empty string");const r=e||{},i=qn.isWindows(e),o=n?ee.compileRe(s,e):ee.makeRe(s,e,!1,!0),a=o.state;delete o.state;let l=()=>!1;if(r.ignore){const f={...e,ignore:null,onMatch:null,onResult:null};l=ee(r.ignore,f,t)}const c=(f,u=!1)=>{const{isMatch:h,match:d,output:m}=ee.test(f,o,e,{glob:s,posix:i}),p={glob:s,state:a,regex:o,posix:i,input:f,output:m,match:d,isMatch:h};return typeof r.onResult=="function"&&r.onResult(p),h===!1?(p.isMatch=!1,u?p:!1):l(f)?(typeof r.onIgnore=="function"&&r.onIgnore(p),p.isMatch=!1,u?p:!1):(typeof r.onMatch=="function"&&r.onMatch(p),u?p:!0)};return t&&(c.state=a),c};ee.test=(s,e,t,{glob:n,posix:r}={})=>{if(typeof s!="string")throw new TypeError("Expected input to be a string");if(s==="")return{isMatch:!1,output:""};const i=t||{},o=i.format||(r?qn.toPosixSlashes:null);let a=s===n,l=a&&o?o(s):s;return a===!1&&(l=o?o(s):s,a=l===n),(a===!1||i.capture===!0)&&(i.matchBase===!0||i.basename===!0?a=ee.matchBase(s,e,t,r):a=e.exec(l)),{isMatch:!!a,match:a,output:l}},ee.matchBase=(s,e,t,n=qn.isWindows(t))=>(e instanceof RegExp?e:ee.makeRe(e,t)).test(Mu.basename(s)),ee.isMatch=(s,e,t)=>ee(e,t)(s),ee.parse=(s,e)=>Array.isArray(s)?s.map(t=>ee.parse(t,e)):Gn(s,{...e,fastpaths:!1}),ee.scan=(s,e)=>Fu(s,e),ee.compileRe=(s,e,t=!1,n=!1)=>{if(t===!0)return s.output;const r=e||{},i=r.contains?"":"^",o=r.contains?"":"$";let a=`${i}(?:${s.output})${o}`;s&&s.negated===!0&&(a=`^(?!${a}).*$`);const l=ee.toRegex(a,e);return n===!0&&(l.state=s),l},ee.makeRe=(s,e={},t=!1,n=!1)=>{if(!s||typeof s!="string")throw new TypeError("Expected a non-empty string");let r={negated:!1,fastpaths:!0};return e.fastpaths!==!1&&(s[0]==="."||s[0]==="*")&&(r.output=Gn.fastpaths(s,e)),r.output||(r=Gn(s,e)),ee.compileRe(r,e,t,n)},ee.toRegex=(s,e)=>{try{const t=e||{};return new RegExp(s,t.flags||(t.nocase?"i":""))}catch(t){if(e&&e.debug===!0)throw t;return/$^/}},ee.constants=Du;var Hu=ee,Uu=Hu;const ao=un,lo=uu,Te=Uu,Wn=Dt,co=s=>s===""||s==="./",z=(s,e,t)=>{e=[].concat(e),s=[].concat(s);let n=new Set,r=new Set,i=new Set,o=0,a=f=>{i.add(f.output),t&&t.onResult&&t.onResult(f)};for(let f=0;f<e.length;f++){let u=Te(String(e[f]),{...t,onResult:a},!0),h=u.state.negated||u.state.negatedExtglob;h&&o++;for(let d of s){let m=u(d,!0);(h?!m.isMatch:m.isMatch)&&(h?n.add(m.output):(n.delete(m.output),r.add(m.output)))}}let c=(o===e.length?[...i]:[...r]).filter(f=>!n.has(f));if(t&&c.length===0){if(t.failglob===!0)throw new Error(`No matches found for "${e.join(", ")}"`);if(t.nonull===!0||t.nullglob===!0)return t.unescape?e.map(f=>f.replace(/\\/g,"")):e}return c};z.match=z,z.matcher=(s,e)=>Te(s,e),z.isMatch=(s,e,t)=>Te(e,t)(s),z.any=z.isMatch,z.not=(s,e,t={})=>{e=[].concat(e).map(String);let n=new Set,r=[],i=a=>{t.onResult&&t.onResult(a),r.push(a.output)},o=new Set(z(s,e,{...t,onResult:i}));for(let a of r)o.has(a)||n.add(a);return[...n]},z.contains=(s,e,t)=>{if(typeof s!="string")throw new TypeError(`Expected a string: "${ao.inspect(s)}"`);if(Array.isArray(e))return e.some(n=>z.contains(s,n,t));if(typeof e=="string"){if(co(s)||co(e))return!1;if(s.includes(e)||s.startsWith("./")&&s.slice(2).includes(e))return!0}return z.isMatch(s,e,{...t,contains:!0})},z.matchKeys=(s,e,t)=>{if(!Wn.isObject(s))throw new TypeError("Expected the first argument to be an object");let n=z(Object.keys(s),e,t),r={};for(let i of n)r[i]=s[i];return r},z.some=(s,e,t)=>{let n=[].concat(s);for(let r of[].concat(e)){let i=Te(String(r),t);if(n.some(o=>i(o)))return!0}return!1},z.every=(s,e,t)=>{let n=[].concat(s);for(let r of[].concat(e)){let i=Te(String(r),t);if(!n.every(o=>i(o)))return!1}return!0},z.all=(s,e,t)=>{if(typeof s!="string")throw new TypeError(`Expected a string: "${ao.inspect(s)}"`);return[].concat(e).every(n=>Te(n,t)(s))},z.capture=(s,e,t)=>{let n=Wn.isWindows(t),i=Te.makeRe(String(s),{...t,capture:!0}).exec(n?Wn.toPosixSlashes(e):e);if(i)return i.slice(1).map(o=>o===void 0?"":o)},z.makeRe=(...s)=>Te.makeRe(...s),z.scan=(...s)=>Te.scan(...s),z.parse=(s,e)=>{let t=[];for(let n of[].concat(s||[]))for(let r of lo(String(n),e))t.push(Te.parse(r,e));return t},z.braces=(s,e)=>{if(typeof s!="string")throw new TypeError("Expected a string");return e&&e.nobrace===!0||!/\{.*\}/.test(s)?[s]:lo(s,e)},z.braceExpand=(s,e)=>{if(typeof s!="string")throw new TypeError("Expected a string");return z.braces(s,{...e,expand:!0})};var ju=z;const Ku=nt(ju),uo=oe("lint-staged:generateTasks"),Gu=({config:s,cwd:e=process.cwd(),files:t,relative:n=!1})=>{uo("Generating linter tasks");const r=t.map(i=>ge(H.relative(e,i)));return Object.entries(s).map(([i,o])=>{const a=i.startsWith("../"),l=r.filter(h=>a?!0:!h.startsWith("..")&&!H.isAbsolute(h)),f=Ku(l,i,{cwd:e,dot:!0,matchBase:!i.includes("/"),posixSlashes:!0,strictBrackets:!0}).map(h=>ge(n?h:H.resolve(e,h))),u={pattern:i,commands:o,fileList:f};return uo(`Generated task:
|
|
49
|
+
%O`,u),u})},qu=new RegExp(tl+"$"),fo=s=>new sl({write:function(e,t,n){s(e.toString().replace(qu,"")),n()}}),Wu=({debug:s,quiet:e},t,n)=>e?{renderer:"silent"}:n.NODE_ENV==="test"?{renderer:"test",rendererOptions:{logger:new Pt({processOutput:new di(fo(t.log),fo(t.error))})}}:s||n.TERM==="dumb"?{renderer:"verbose"}:{renderer:"update",rendererOptions:{formatOutput:"truncate"}},Yu=({renderer:s},{FORCE_COLOR:e})=>s==="silent"||s==="test"||Number(e)>0?s:"verbose",Vu=(s,e,t=process.env)=>{const n=Wu(s,e,t);return{...n,fallbackRenderer:Yu(n,t)}};function ho(s,e){const t=e!==void 0?e.trim():"ACMR",n=s!==void 0?s.trim().split(" "):["--staged"];return["diff","--name-only","-z",`--diff-filter=${t}`,...n]}const Yn=s=>s?s.replace(/\u0000$/,"").split("\0"):[],zu=async({cwd:s=process.cwd(),diff:e,diffFilter:t}={})=>{try{const n=await ut(ho(e,t),{cwd:s});return n?Yn(n).map(r=>ge(H.resolve(s,r))):[]}catch{return null}},Ht=oe("lint-staged:file"),ks=async(s,e=!0)=>{Ht("Reading file `%s`",s);try{return await De.readFile(s)}catch(t){if(e&&t.code==="ENOENT")return Ht("File `%s` doesn't exist, ignoring...",s),null;throw t}},po=async(s,e=!0)=>{Ht("Removing file `%s`",s);try{await De.unlink(s)}catch(t){if(e&&t.code==="ENOENT")Ht("File `%s` doesn't exist, ignoring...",s);else throw t}},Vn=async(s,e)=>{Ht("Writing file `%s`",s),await De.writeFile(s,e)},Ut=Symbol("ApplyEmptyCommitError"),go=new Error("Configuration could not be found"),Qu=new Error("Configuration should be an object or a function"),Xu=new Error("Configuration should not be empty"),mo=Symbol("GetBackupStashError"),Ju=Symbol("GetStagedFilesError"),Ve=Symbol("GitError"),Zu=Symbol("GitRepoError"),ef=Symbol("HideUnstagedChangesError"),yo=new Error("Invalid Options"),tf=Symbol("RestoreMergeStatusError"),bo=Symbol("RestoreOriginalStateError"),$s=Symbol("RestoreUnstagedChangesError"),jt=Symbol("TaskError"),Q=oe("lint-staged:GitWorkflow"),sf="MERGE_HEAD",nf="MERGE_MODE",rf="MERGE_MSG",wo=/\x00/,Eo=(s,e=!0)=>s.reduce((t,n)=>{if(wo.test(n)){const[r,i]=n.split(wo);e&&t.push(i),t.push(r)}else t.push(n);return t},[]),So="lint-staged automatic backup",zn="lint-staged_unstaged.patch",of=["--binary","--unified=0","--no-color","--no-ext-diff","--src-prefix=a/","--dst-prefix=b/","--patch","--submodule=short"],Ao=["-v","--whitespace=nowarn","--recount","--unidiff-zero"],ze=(s,e,t)=>{throw e.errors.add(Ve),t&&e.errors.add(t),s};class af{constructor({allowEmpty:e,gitConfigDir:t,gitDir:n,matchedFileChunks:r,diff:i,diffFilter:o}){this.execGit=(a,l={})=>ut(a,{...l,cwd:n}),this.deletedFiles=[],this.gitConfigDir=t,this.gitDir=n,this.diff=i,this.diffFilter=o,this.allowEmpty=e,this.matchedFileChunks=r,this.mergeHeadFilename=H.resolve(t,sf),this.mergeModeFilename=H.resolve(t,nf),this.mergeMsgFilename=H.resolve(t,rf)}getHiddenFilepath(e){return H.resolve(this.gitConfigDir,`./${e}`)}async getBackupStash(e){const n=(await this.execGit(["stash","list"])).split(`
|
|
50
|
+
`).findIndex(r=>r.includes(So));if(n===-1)throw e.errors.add(mo),new Error("lint-staged automatic backup is missing!");return String(n)}async getDeletedFiles(){Q("Getting deleted files...");const t=(await this.execGit(["ls-files","--deleted"])).split(`
|
|
51
|
+
`).filter(Boolean).map(n=>H.resolve(this.gitDir,n));return Q("Found deleted files:",t),t}async backupMergeStatus(){Q("Backing up merge state..."),await Promise.all([ks(this.mergeHeadFilename).then(e=>this.mergeHeadBuffer=e),ks(this.mergeModeFilename).then(e=>this.mergeModeBuffer=e),ks(this.mergeMsgFilename).then(e=>this.mergeMsgBuffer=e)]),Q("Done backing up merge state!")}async restoreMergeStatus(e){Q("Restoring merge state...");try{await Promise.all([this.mergeHeadBuffer&&Vn(this.mergeHeadFilename,this.mergeHeadBuffer),this.mergeModeBuffer&&Vn(this.mergeModeFilename,this.mergeModeBuffer),this.mergeMsgBuffer&&Vn(this.mergeMsgFilename,this.mergeMsgBuffer)]),Q("Done restoring merge state!")}catch(t){Q("Failed restoring merge state with error:"),Q(t),ze(new Error("Merge state could not be restored due to an error!"),e,tf)}}async getPartiallyStagedFiles(){Q("Getting partially staged files...");const t=(await this.execGit(["status","-z"])).split(/\x00(?=[ AMDRCU?!]{2} |$)/).filter(n=>{const[r,i]=n;return r!==" "&&i!==" "&&r!=="?"&&i!=="?"}).map(n=>n.substr(3)).filter(Boolean);return Q("Found partially staged files:",t),t.length?t:null}async prepare(e){try{if(Q("Backing up original state..."),this.partiallyStagedFiles=await this.getPartiallyStagedFiles(),this.partiallyStagedFiles){e.hasPartiallyStagedFiles=!0;const n=this.getHiddenFilepath(zn),r=Eo(this.partiallyStagedFiles);await this.execGit(["diff",...of,"--output",n,"--",...r])}else e.hasPartiallyStagedFiles=!1;if(!e.shouldBackup)return;await this.backupMergeStatus(),this.deletedFiles=await this.getDeletedFiles();const t=await this.execGit(["stash","create"]);await this.execGit(["stash","store","--quiet","--message",So,t]),Q("Done backing up original state!")}catch(t){ze(t,e)}}async hideUnstagedChanges(e){try{const t=Eo(this.partiallyStagedFiles,!1);await this.execGit(["checkout","--force","--",...t])}catch(t){ze(t,e,ef)}}async applyModifications(e){Q("Adding task modifications to index...");for(const n of this.matchedFileChunks)await this.execGit(["add","--",...n]);Q("Done adding task modifications to index!"),!await this.execGit(ho(this.diff,this.diffFilter))&&!this.allowEmpty&&ze(new Error("Prevented an empty git commit!"),e,Ut)}async restoreUnstagedChanges(e){Q("Restoring unstaged changes...");const t=this.getHiddenFilepath(zn);try{await this.execGit(["apply",...Ao,t])}catch(n){Q("Error while restoring changes:"),Q(n),Q("Retrying with 3-way merge");try{await this.execGit(["apply",...Ao,"--3way",t])}catch(r){Q("Error while restoring unstaged changes using 3-way merge:"),Q(r),ze(new Error("Unstaged changes could not be restored due to a merge conflict!"),e,$s)}}}async restoreOriginalState(e){try{Q("Restoring original state..."),await this.execGit(["reset","--hard","HEAD"]),await this.execGit(["stash","apply","--quiet","--index",await this.getBackupStash(e)]),await this.restoreMergeStatus(e),await Promise.all(this.deletedFiles.map(t=>po(t))),await po(this.getHiddenFilepath(zn)),Q("Done restoring original state!")}catch(t){ze(t,e,bo)}}async cleanup(e){try{Q("Dropping backup stash..."),await this.execGit(["stash","drop","--quiet",await this.getBackupStash(e)]),Q("Done dropping backup stash!")}catch(t){ze(t,e)}}}const lf=oe("lint-staged:groupFilesByConfig"),cf=async({configs:s,files:e,singleConfigMode:t})=>{lf("Grouping %d files by %d configurations",e.length,Object.keys(s).length);const n=new Set(e),r={};for(const[i,o]of Object.entries(s)){if(t){r[i]={config:o,files:e};break}const a=H.normalize(H.dirname(i)),l=u=>{const h=H.relative(a,u);return h&&!h.startsWith("..")&&!H.isAbsolute(h)},c=Object.keys(o).some(u=>u.startsWith("..")),f=new Set(c?n:void 0);c||n.forEach(u=>{l(u)&&f.add(u)}),f.forEach(u=>{n.delete(u)}),r[i]={config:o,files:Array.from(f)}}return r};function uf(s,e,t){var n=/([^\s'"]([^\s'"]*(['"])([^\3]*?)\3)+[^\s'"]*)|[^\s'"]+|(['"])([^\5]*?)\5/gi,r=s,i=[];e&&i.push(e),t&&i.push(t);var o;do o=n.exec(r),o!==null&&i.push(ff(o[1],o[6],o[0]));while(o!==null);return i}function ff(){for(var s=[],e=0;e<arguments.length;e++)s[e]=arguments[e];for(var t=0;t<s.length;t++){var n=s[t];if(typeof n=="string")return n}}var Qn,Oo;function Co(){if(Oo)return Qn;Oo=1;var s=nl.spawn;function e(n){if(n){n=n.trim();var r=/your \d+x\d+ screen size is bogus\. expect trouble/gi;return n=n.replace(r,""),n.trim()}}function t(n,r,i,o){typeof i=="function"&&(o=i,i=void 0);var a=!1,l=s(n,r,i),c="",f="";l.stdout.on("data",function(u){c+=u.toString()}),l.stderr.on("data",function(u){f+=u.toString()}),l.on("error",function(u){a||(a=!0,o(new Error(u)))}),l.on("close",function(u){if(!a){if(a=!0,f=e(f),f)return o(new Error(f));o(null,c,u)}})}return Qn=t,Qn}var Xn,Ro;function hf(){if(Ro)return Xn;Ro=1;var s=bs,e=Co();function t(n){var r=["-A","-o","ppid,pid"];e("ps",r,function(i,o,a){if(i)return n(i);if(a!==0)return n(new Error("pidtree ps command exited with code "+a));try{o=o.split(s.EOL);for(var l=[],c=1;c<o.length;c++)o[c]=o[c].trim(),o[c]&&(o[c]=o[c].split(/\s+/),o[c][0]=parseInt(o[c][0],10),o[c][1]=parseInt(o[c][1],10),l.push(o[c]));n(null,l)}catch(f){n(f)}})}return Xn=t,Xn}var Jn,To;function pf(){if(To)return Jn;To=1;var s=bs,e=Co();function t(n){var r=["PROCESS","get","ParentProcessId,ProcessId"],i={windowsHide:!0,windowsVerbatimArguments:!0};e("wmic",r,i,function(o,a,l){if(o){n(o);return}if(l!==0){n(new Error("pidtree wmic command exited with code "+l));return}try{a=a.split(s.EOL);for(var c=[],f=1;f<a.length;f++)a[f]=a[f].trim(),a[f]&&(a[f]=a[f].split(/\s+/),a[f][0]=parseInt(a[f][0],10),a[f][1]=parseInt(a[f][1],10),c.push(a[f]));n(null,c)}catch(u){n(u)}})}return Jn=t,Jn}var _o=bs,df={darwin:"ps",sunos:"ps",freebsd:"ps",netbsd:"ps",win:"wmic",linux:"ps",aix:"ps"},gf={ps:()=>hf(),wmic:()=>pf()},Zn=_o.platform();Zn.startsWith("win")&&(Zn="win");var vo=df[Zn];function mf(s){vo===void 0&&s(new Error(_o.platform()+" is not supported yet, please open an issue (https://github.com/simonepri/pidtree)"));var e=gf[vo]();e(s)}var yf=mf,bf=yf;function wf(s,e,t){if(typeof e=="function"&&(t=e,e={}),typeof e!="object"&&(e={}),s=parseInt(s,10),isNaN(s)||s<-1){t(new TypeError("The pid provided is invalid"));return}bf(function(n,r){if(n){t(n);return}if(s===-1){for(var i=0;i<r.length;i++)r[i]=e.advanced?{ppid:r[i][0],pid:r[i][1]}:r[i]=r[i][1];t(null,r);return}for(var o,a=0;a<r.length;a++){if(r[a][1]===s){o=e.advanced?{ppid:r[a][0],pid:s}:s;break}r[a][0]===s&&(o=e.advanced?{pid:s}:s)}if(!o){t(new Error("No matching pid found"));return}for(var l={};r.length>0;){var c=r.pop();l[c[0]]?l[c[0]].push(c[1]):l[c[0]]=[c[1]]}for(var f=0,u=[o];f<u.length;){var h=e.advanced?u[f++].pid:u[f++];if(l[h]){for(var d=l[h].length,m=0;m<d;m++)u.push(e.advanced?{ppid:h,pid:l[h][m]}:l[h][m]);delete l[h]}}e.root||u.shift(),t(null,u)})}var Ef=wf;function Sf(s,e,t){return new Promise(function(n,r){s(e,t,function(i,o){if(i)return r(i);n(o)})})}String.prototype.startsWith||(String.prototype.startsWith=function(s){return this.substring(0,s.length)===s});var Lo=Ef;function Af(s,e,t){if(typeof e=="function"&&(t=e,e=void 0),typeof t=="function"){Lo(s,e,t);return}return Sf(Lo,s,e)}var Of=Af;const Cf=nt(Of),ko=({quiet:s=!1}={})=>({hasPartiallyStagedFiles:null,shouldBackup:null,shouldHidePartiallyStaged:!0,errors:new Set([]),events:new rl,output:[],quiet:s}),$o=s=>s.hasPartiallyStagedFiles&&s.shouldHidePartiallyStaged,Rf=s=>{if(!s.shouldBackup)return!1;if(s.errors.has(Ve))return ct;if(s.errors.has(jt))return Ci},Tf=s=>{if(s.errors.has(Ve))return ct;if(s.errors.has(jt))return Ci},_f=s=>s.shouldBackup&&(s.errors.has(jt)||s.errors.has(Ut)||s.errors.has($s)),vf=s=>{if(s.errors.has(Ve)&&!s.errors.has(Ut)&&!s.errors.has($s))return ct},Lf=s=>s.shouldBackup,kf=s=>{if(s.errors.has(Ve)&&!s.errors.has(Ut)&&!s.errors.has($s)||s.errors.has(bo))return ct},er="lint-staged:taskError",Kt=oe("lint-staged:resolveTaskFn"),Io=({code:s,killed:e,signal:t})=>e&&"KILLED"||t||s||"FAILED",No=(s,e,t,n=!1)=>{const{stderr:r,stdout:i}=e;if(!!r||!!i){const a=n?q.redBright(`${$e} ${s}:`):`${vn} ${s}:`,l=[].concat(t.quiet?[]:["",a]).concat(r||[]).concat(i||[]);t.output.push(l.join(`
|
|
52
|
+
`))}else if(n){const a=Io(e),l=q.redBright(`
|
|
53
|
+
${$e} ${s} failed without output (${a}).`);t.quiet||t.output.push(l)}},$f=async s=>{try{const e=await Cf(s.pid);for(const t of e)try{process.kill(t)}catch(n){Kt('Failed to kill process with pid "%d": %o',t,n)}}catch(e){Kt('Failed to kill process with pid "%d": %o',s.pid,e)}s.kill()},If=(s,e)=>{let t;const n=async()=>{t=$f(e),await t};return s.events.on(er,n,{once:!0}),async()=>{s.events.off(er,n),await t}},Nf=(s,e,t)=>{t.errors.add(jt),t.events.emit(er,jt),No(s,e,t,!0);const n=Io(e);return new Error(`${q.redBright(s)} ${q.dim(`[${n}]`)}`)},Pf=({command:s,cwd:e=process.cwd(),files:t,gitDir:n,isFn:r,shell:i=!1,verbose:o=!1})=>{const[a,...l]=uf(s);Kt("cmd:",a),Kt("args:",l);const c={cwd:/^git(\.exe)?/i.test(a)?n:e,preferLocal:!0,reject:!1,shell:i};return Kt("execaOptions:",c),async(f=ko())=>{const u=i?el(r?s:`${s} ${t.join(" ")}`,c):Dr(a,r?l:l.concat(t),c),h=If(f,u),d=await u;if(await h(),d.failed||d.killed||d.signal!=null)throw Nf(s,d,f);o&&No(s,d,f)}},Bf=oe("lint-staged:makeCmdTasks"),Mf=async({commands:s,cwd:e,files:t,gitDir:n,shell:r,verbose:i})=>{Bf("Creating listr tasks for commands %o",s);const o=Array.isArray(s)?s:[s],a=[];for(const l of o){const c=typeof l=="function",f=c?await l([...t]):l,u=Array.isArray(f)?f:[f];for(const h of u){if(c&&typeof h!="string")throw new Error(Ln("[Function]","Function task should return a string or an array of strings",f));const d=Pf({command:h,cwd:e,files:t,gitDir:n,isFn:c,shell:r,verbose:i});a.push({title:h,command:h,task:d})}}return a},pt=oe("lint-staged:resolveGitRepo"),Ff=async s=>{const e=H.join(s,".git"),t=await De.lstat(e);if(t.isDirectory())return e;if(t.isSymbolicLink())return await De.realpath(s);const n=(await ks(e)).toString();return H.resolve(s,n.replace(/^gitdir: /,"")).trim()},Df=(s,e)=>(e&&e.endsWith(H.sep)&&(e=e.slice(0,-1)),e?s.substring(0,s.lastIndexOf(e)):s),xf=async(s=process.cwd())=>{try{pt("Resolving git repo from `%s`",s),pt("Unset GIT_DIR (was `%s`)",process.env.GIT_DIR),delete process.env.GIT_DIR,pt("Unset GIT_WORK_TREE (was `%s`)",process.env.GIT_WORK_TREE),delete process.env.GIT_WORK_TREE;const e=ge(await ut(["rev-parse","--show-prefix"],{cwd:s})),t=ge(Df(ge(s),e)),n=ge(await Ff(t));return pt("Resolved git directory to be `%s`",t),pt("Resolved git config directory to be `%s`",n),{gitDir:t,gitConfigDir:n}}catch(e){return pt("Failed to resolve git repo with error:",e),{error:e,gitDir:null,gitConfigDir:null}}},tr=Symbol.for("yaml.alias"),sr=Symbol.for("yaml.document"),He=Symbol.for("yaml.map"),Po=Symbol.for("yaml.pair"),Ne=Symbol.for("yaml.scalar"),dt=Symbol.for("yaml.seq"),me=Symbol.for("yaml.node.type"),Qe=s=>!!s&&typeof s=="object"&&s[me]===tr,gt=s=>!!s&&typeof s=="object"&&s[me]===sr,mt=s=>!!s&&typeof s=="object"&&s[me]===He,X=s=>!!s&&typeof s=="object"&&s[me]===Po,Y=s=>!!s&&typeof s=="object"&&s[me]===Ne,yt=s=>!!s&&typeof s=="object"&&s[me]===dt;function Z(s){if(s&&typeof s=="object")switch(s[me]){case He:case dt:return!0}return!1}function te(s){if(s&&typeof s=="object")switch(s[me]){case tr:case He:case Ne:case dt:return!0}return!1}const Hf=s=>(Y(s)||Z(s))&&!!s.anchor,ce=Symbol("break visit"),Bo=Symbol("skip children"),_e=Symbol("remove node");function Ue(s,e){const t=Mo(e);gt(s)?bt(null,s.contents,t,Object.freeze([s]))===_e&&(s.contents=null):bt(null,s,t,Object.freeze([]))}Ue.BREAK=ce,Ue.SKIP=Bo,Ue.REMOVE=_e;function bt(s,e,t,n){const r=Fo(s,e,t,n);if(te(r)||X(r))return Do(s,n,r),bt(s,r,t,n);if(typeof r!="symbol"){if(Z(e)){n=Object.freeze(n.concat(e));for(let i=0;i<e.items.length;++i){const o=bt(i,e.items[i],t,n);if(typeof o=="number")i=o-1;else{if(o===ce)return ce;o===_e&&(e.items.splice(i,1),i-=1)}}}else if(X(e)){n=Object.freeze(n.concat(e));const i=bt("key",e.key,t,n);if(i===ce)return ce;i===_e&&(e.key=null);const o=bt("value",e.value,t,n);if(o===ce)return ce;o===_e&&(e.value=null)}}return r}async function Is(s,e){const t=Mo(e);gt(s)?await wt(null,s.contents,t,Object.freeze([s]))===_e&&(s.contents=null):await wt(null,s,t,Object.freeze([]))}Is.BREAK=ce,Is.SKIP=Bo,Is.REMOVE=_e;async function wt(s,e,t,n){const r=await Fo(s,e,t,n);if(te(r)||X(r))return Do(s,n,r),wt(s,r,t,n);if(typeof r!="symbol"){if(Z(e)){n=Object.freeze(n.concat(e));for(let i=0;i<e.items.length;++i){const o=await wt(i,e.items[i],t,n);if(typeof o=="number")i=o-1;else{if(o===ce)return ce;o===_e&&(e.items.splice(i,1),i-=1)}}}else if(X(e)){n=Object.freeze(n.concat(e));const i=await wt("key",e.key,t,n);if(i===ce)return ce;i===_e&&(e.key=null);const o=await wt("value",e.value,t,n);if(o===ce)return ce;o===_e&&(e.value=null)}}return r}function Mo(s){return typeof s=="object"&&(s.Collection||s.Node||s.Value)?Object.assign({Alias:s.Node,Map:s.Node,Scalar:s.Node,Seq:s.Node},s.Value&&{Map:s.Value,Scalar:s.Value,Seq:s.Value},s.Collection&&{Map:s.Collection,Seq:s.Collection},s):s}function Fo(s,e,t,n){if(typeof t=="function")return t(s,e,n);if(mt(e))return t.Map?.(s,e,n);if(yt(e))return t.Seq?.(s,e,n);if(X(e))return t.Pair?.(s,e,n);if(Y(e))return t.Scalar?.(s,e,n);if(Qe(e))return t.Alias?.(s,e,n)}function Do(s,e,t){const n=e[e.length-1];if(Z(n))n.items[s]=t;else if(X(n))s==="key"?n.key=t:n.value=t;else if(gt(n))n.contents=t;else{const r=Qe(n)?"alias":"scalar";throw new Error(`Cannot replace node with ${r} parent`)}}const Uf={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},jf=s=>s.replace(/[!,[\]{}]/g,e=>Uf[e]);class ae{constructor(e,t){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},ae.defaultYaml,e),this.tags=Object.assign({},ae.defaultTags,t)}clone(){const e=new ae(this.yaml,this.tags);return e.docStart=this.docStart,e}atDocument(){const e=new ae(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:ae.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},ae.defaultTags);break}return e}add(e,t){this.atNextDocument&&(this.yaml={explicit:ae.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},ae.defaultTags),this.atNextDocument=!1);const n=e.trim().split(/[ \t]+/),r=n.shift();switch(r){case"%TAG":{if(n.length!==2&&(t(0,"%TAG directive should contain exactly two parts"),n.length<2))return!1;const[i,o]=n;return this.tags[i]=o,!0}case"%YAML":{if(this.yaml.explicit=!0,n.length!==1)return t(0,"%YAML directive should contain exactly one part"),!1;const[i]=n;if(i==="1.1"||i==="1.2")return this.yaml.version=i,!0;{const o=/^\d+\.\d+$/.test(i);return t(6,`Unsupported YAML version ${i}`,o),!1}}default:return t(0,`Unknown directive ${r}`,!0),!1}}tagName(e,t){if(e==="!")return"!";if(e[0]!=="!")return t(`Not a valid tag: ${e}`),null;if(e[1]==="<"){const o=e.slice(2,-1);return o==="!"||o==="!!"?(t(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==">"&&t("Verbatim tags must end with a >"),o)}const[,n,r]=e.match(/^(.*!)([^!]*)$/s);r||t(`The ${e} tag has no suffix`);const i=this.tags[n];if(i)try{return i+decodeURIComponent(r)}catch(o){return t(String(o)),null}return n==="!"?e:(t(`Could not resolve tag: ${e}`),null)}tagString(e){for(const[t,n]of Object.entries(this.tags))if(e.startsWith(n))return t+jf(e.substring(n.length));return e[0]==="!"?e:`!<${e}>`}toString(e){const t=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],n=Object.entries(this.tags);let r;if(e&&n.length>0&&te(e.contents)){const i={};Ue(e.contents,(o,a)=>{te(a)&&a.tag&&(i[a.tag]=!0)}),r=Object.keys(i)}else r=[];for(const[i,o]of n)i==="!!"&&o==="tag:yaml.org,2002:"||(!e||r.some(a=>a.startsWith(o)))&&t.push(`%TAG ${i} ${o}`);return t.join(`
|
|
54
|
+
`)}}ae.defaultYaml={explicit:!1,version:"1.2"},ae.defaultTags={"!!":"tag:yaml.org,2002:"};function xo(s){if(/[\x00-\x19\s,[\]{}]/.test(s)){const t=`Anchor must not contain whitespace or control characters: ${JSON.stringify(s)}`;throw new Error(t)}return!0}function Ho(s){const e=new Set;return Ue(s,{Value(t,n){n.anchor&&e.add(n.anchor)}}),e}function Uo(s,e){for(let t=1;;++t){const n=`${s}${t}`;if(!e.has(n))return n}}function Kf(s,e){const t=[],n=new Map;let r=null;return{onAnchor:i=>{t.push(i),r||(r=Ho(s));const o=Uo(e,r);return r.add(o),o},setAnchors:()=>{for(const i of t){const o=n.get(i);if(typeof o=="object"&&o.anchor&&(Y(o.node)||Z(o.node)))o.node.anchor=o.anchor;else{const a=new Error("Failed to resolve repeated object (this should not happen)");throw a.source=i,a}}},sourceObjects:n}}function Et(s,e,t,n){if(n&&typeof n=="object")if(Array.isArray(n))for(let r=0,i=n.length;r<i;++r){const o=n[r],a=Et(s,n,String(r),o);a===void 0?delete n[r]:a!==o&&(n[r]=a)}else if(n instanceof Map)for(const r of Array.from(n.keys())){const i=n.get(r),o=Et(s,n,r,i);o===void 0?n.delete(r):o!==i&&n.set(r,o)}else if(n instanceof Set)for(const r of Array.from(n)){const i=Et(s,n,r,r);i===void 0?n.delete(r):i!==r&&(n.delete(r),n.add(i))}else for(const[r,i]of Object.entries(n)){const o=Et(s,n,r,i);o===void 0?delete n[r]:o!==i&&(n[r]=o)}return s.call(e,t,n)}function ye(s,e,t){if(Array.isArray(s))return s.map((n,r)=>ye(n,String(r),t));if(s&&typeof s.toJSON=="function"){if(!t||!Hf(s))return s.toJSON(e,t);const n={aliasCount:0,count:1,res:void 0};t.anchors.set(s,n),t.onCreate=i=>{n.res=i,delete t.onCreate};const r=s.toJSON(e,t);return t.onCreate&&t.onCreate(r),r}return typeof s=="bigint"&&!t?.keep?Number(s):s}class nr{constructor(e){Object.defineProperty(this,me,{value:e})}clone(){const e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:t,maxAliasCount:n,onAnchor:r,reviver:i}={}){if(!gt(e))throw new TypeError("A document argument is required");const o={anchors:new Map,doc:e,keep:!0,mapAsMap:t===!0,mapKeyWarned:!1,maxAliasCount:typeof n=="number"?n:100},a=ye(this,"",o);if(typeof r=="function")for(const{count:l,res:c}of o.anchors.values())r(c,l);return typeof i=="function"?Et(i,{"":a},"",a):a}}class Ns extends nr{constructor(e){super(tr),this.source=e,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(e){let t;return Ue(e,{Node:(n,r)=>{if(r===this)return Ue.BREAK;r.anchor===this.source&&(t=r)}}),t}toJSON(e,t){if(!t)return{source:this.source};const{anchors:n,doc:r,maxAliasCount:i}=t,o=this.resolve(r);if(!o){const l=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(l)}let a=n.get(o);if(a||(ye(o,null,t),a=n.get(o)),!a||a.res===void 0){const l="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(l)}if(i>=0&&(a.count+=1,a.aliasCount===0&&(a.aliasCount=Ps(r,o,n)),a.count*a.aliasCount>i)){const l="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(l)}return a.res}toString(e,t,n){const r=`*${this.source}`;if(e){if(xo(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){const i=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(i)}if(e.implicitKey)return`${r} `}return r}}function Ps(s,e,t){if(Qe(e)){const n=e.resolve(s),r=t&&n&&t.get(n);return r?r.count*r.aliasCount:0}else if(Z(e)){let n=0;for(const r of e.items){const i=Ps(s,r,t);i>n&&(n=i)}return n}else if(X(e)){const n=Ps(s,e.key,t),r=Ps(s,e.value,t);return Math.max(n,r)}return 1}const jo=s=>!s||typeof s!="function"&&typeof s!="object";class N extends nr{constructor(e){super(Ne),this.value=e}toJSON(e,t){return t?.keep?this.value:ye(this.value,e,t)}toString(){return String(this.value)}}N.BLOCK_FOLDED="BLOCK_FOLDED",N.BLOCK_LITERAL="BLOCK_LITERAL",N.PLAIN="PLAIN",N.QUOTE_DOUBLE="QUOTE_DOUBLE",N.QUOTE_SINGLE="QUOTE_SINGLE";const Gf="tag:yaml.org,2002:";function qf(s,e,t){if(e){const n=t.filter(i=>i.tag===e),r=n.find(i=>!i.format)??n[0];if(!r)throw new Error(`Tag ${e} not found`);return r}return t.find(n=>n.identify?.(s)&&!n.format)}function Gt(s,e,t){if(gt(s)&&(s=s.contents),te(s))return s;if(X(s)){const u=t.schema[He].createNode?.(t.schema,null,t);return u.items.push(s),u}(s instanceof String||s instanceof Number||s instanceof Boolean||typeof BigInt<"u"&&s instanceof BigInt)&&(s=s.valueOf());const{aliasDuplicateObjects:n,onAnchor:r,onTagObj:i,schema:o,sourceObjects:a}=t;let l;if(n&&s&&typeof s=="object"){if(l=a.get(s),l)return l.anchor||(l.anchor=r(s)),new Ns(l.anchor);l={anchor:null,node:null},a.set(s,l)}e?.startsWith("!!")&&(e=Gf+e.slice(2));let c=qf(s,e,o.tags);if(!c){if(s&&typeof s.toJSON=="function"&&(s=s.toJSON()),!s||typeof s!="object"){const u=new N(s);return l&&(l.node=u),u}c=s instanceof Map?o[He]:Symbol.iterator in Object(s)?o[dt]:o[He]}i&&(i(c),delete t.onTagObj);const f=c?.createNode?c.createNode(t.schema,s,t):typeof c?.nodeClass?.from=="function"?c.nodeClass.from(t.schema,s,t):new N(s);return e?f.tag=e:c.default||(f.tag=c.tag),l&&(l.node=f),f}function Bs(s,e,t){let n=t;for(let r=e.length-1;r>=0;--r){const i=e[r];if(typeof i=="number"&&Number.isInteger(i)&&i>=0){const o=[];o[i]=n,n=o}else n=new Map([[i,n]])}return Gt(n,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:s,sourceObjects:new Map})}const qt=s=>s==null||typeof s=="object"&&!!s[Symbol.iterator]().next().done;class Ms extends nr{constructor(e,t){super(e),Object.defineProperty(this,"schema",{value:t,configurable:!0,enumerable:!1,writable:!0})}clone(e){const t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(t.schema=e),t.items=t.items.map(n=>te(n)||X(n)?n.clone(e):n),this.range&&(t.range=this.range.slice()),t}addIn(e,t){if(qt(e))this.add(t);else{const[n,...r]=e,i=this.get(n,!0);if(Z(i))i.addIn(r,t);else if(i===void 0&&this.schema)this.set(n,Bs(this.schema,r,t));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}}deleteIn(e){const[t,...n]=e;if(n.length===0)return this.delete(t);const r=this.get(t,!0);if(Z(r))return r.deleteIn(n);throw new Error(`Expected YAML collection at ${t}. Remaining path: ${n}`)}getIn(e,t){const[n,...r]=e,i=this.get(n,!0);return r.length===0?!t&&Y(i)?i.value:i:Z(i)?i.getIn(r,t):void 0}hasAllNullValues(e){return this.items.every(t=>{if(!X(t))return!1;const n=t.value;return n==null||e&&Y(n)&&n.value==null&&!n.commentBefore&&!n.comment&&!n.tag})}hasIn(e){const[t,...n]=e;if(n.length===0)return this.has(t);const r=this.get(t,!0);return Z(r)?r.hasIn(n):!1}setIn(e,t){const[n,...r]=e;if(r.length===0)this.set(n,t);else{const i=this.get(n,!0);if(Z(i))i.setIn(r,t);else if(i===void 0&&this.schema)this.set(n,Bs(this.schema,r,t));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}}}Ms.maxFlowStringSingleLineLength=60;const Wf=s=>s.replace(/^(?!$)(?: $)?/gm,"#");function Pe(s,e){return/^\n+$/.test(s)?s.substring(1):e?s.replace(/^(?! *$)/gm,e):s}const je=(s,e,t)=>s.endsWith(`
|
|
55
55
|
`)?Pe(t,e):t.includes(`
|
|
56
56
|
`)?`
|
|
57
|
-
`+Pe(t,e):(s.endsWith(" ")?"":" ")+t,
|
|
58
|
-
`)t===rr&&(p=
|
|
57
|
+
`+Pe(t,e):(s.endsWith(" ")?"":" ")+t,Ko="flow",rr="block",Fs="quoted";function Ds(s,e,t="flow",{indentAtStart:n,lineWidth:r=80,minContentWidth:i=20,onFold:o,onOverflow:a}={}){if(!r||r<0)return s;const l=Math.max(1+i,1+r-e.length);if(s.length<=l)return s;const c=[],f={};let u=r-e.length;typeof n=="number"&&(n>r-Math.max(2,i)?c.push(0):u=r-n);let h,d,m=!1,p=-1,g=-1,y=-1;t===rr&&(p=Go(s,p),p!==-1&&(u=p+l));for(let A;A=s[p+=1];){if(t===Fs&&A==="\\"){switch(g=p,s[p+1]){case"x":p+=3;break;case"u":p+=5;break;case"U":p+=9;break;default:p+=1}y=p}if(A===`
|
|
58
|
+
`)t===rr&&(p=Go(s,p)),u=p+l,h=void 0;else{if(A===" "&&d&&d!==" "&&d!==`
|
|
59
59
|
`&&d!==" "){const L=s[p+1];L&&L!==" "&&L!==`
|
|
60
|
-
`&&L!==" "&&(
|
|
61
|
-
${e}${s.slice(0,R)}`:(t===
|
|
62
|
-
${e}${s.slice(L+1,R)}`)}return S}function
|
|
60
|
+
`&&L!==" "&&(h=p)}if(p>=u)if(h)c.push(h),u=h+l,h=void 0;else if(t===Fs){for(;d===" "||d===" ";)d=A,A=s[p+=1],m=!0;const L=p>y+1?p-2:g-1;if(f[L])return s;c.push(L),f[L]=!0,u=L+l,h=void 0}else m=!0}d=A}if(m&&a&&a(),c.length===0)return s;o&&o();let S=s.slice(0,c[0]);for(let A=0;A<c.length;++A){const L=c[A],R=c[A+1]||s.length;L===0?S=`
|
|
61
|
+
${e}${s.slice(0,R)}`:(t===Fs&&f[L]&&(S+=`${s[L]}\\`),S+=`
|
|
62
|
+
${e}${s.slice(L+1,R)}`)}return S}function Go(s,e){let t=s[e+1];for(;t===" "||t===" ";){do t=s[e+=1];while(t&&t!==`
|
|
63
63
|
`);t=s[e+1]}return e}const xs=(s,e)=>({indentAtStart:e?s.indent.length:s.indentAtStart,lineWidth:s.options.lineWidth,minContentWidth:s.options.minContentWidth}),Hs=s=>/^(%|---|\.\.\.)/m.test(s);function Yf(s,e,t){if(!e||e<0)return!1;const n=e-t,r=s.length;if(r<=n)return!1;for(let i=0,o=0;i<r;++i)if(s[i]===`
|
|
64
|
-
`){if(i-o>n)return!0;if(o=i+1,r-o<=n)return!1}return!0}function Wt(s,e){const t=JSON.stringify(s);if(e.options.doubleQuotedAsJSON)return t;const{implicitKey:n}=e,r=e.options.doubleQuotedMinMultiLineLength,i=e.indent||(Hs(s)?" ":"");let o="",a=0;for(let l=0,c=t[l];c;c=t[++l])if(c===" "&&t[l+1]==="\\"&&t[l+2]==="n"&&(o+=t.slice(a,l)+"\\ ",l+=1,a=l,c="\\"),c==="\\")switch(t[l+1]){case"u":{o+=t.slice(a,l);const
|
|
64
|
+
`){if(i-o>n)return!0;if(o=i+1,r-o<=n)return!1}return!0}function Wt(s,e){const t=JSON.stringify(s);if(e.options.doubleQuotedAsJSON)return t;const{implicitKey:n}=e,r=e.options.doubleQuotedMinMultiLineLength,i=e.indent||(Hs(s)?" ":"");let o="",a=0;for(let l=0,c=t[l];c;c=t[++l])if(c===" "&&t[l+1]==="\\"&&t[l+2]==="n"&&(o+=t.slice(a,l)+"\\ ",l+=1,a=l,c="\\"),c==="\\")switch(t[l+1]){case"u":{o+=t.slice(a,l);const f=t.substr(l+2,4);switch(f){case"0000":o+="\\0";break;case"0007":o+="\\a";break;case"000b":o+="\\v";break;case"001b":o+="\\e";break;case"0085":o+="\\N";break;case"00a0":o+="\\_";break;case"2028":o+="\\L";break;case"2029":o+="\\P";break;default:f.substr(0,2)==="00"?o+="\\x"+f.substr(2):o+=t.substr(l,6)}l+=5,a=l+1}break;case"n":if(n||t[l+2]==='"'||t.length<r)l+=1;else{for(o+=t.slice(a,l)+`
|
|
65
65
|
|
|
66
66
|
`;t[l+2]==="\\"&&t[l+3]==="n"&&t[l+4]!=='"';)o+=`
|
|
67
|
-
`,l+=2;o+=i,t[l+2]===" "&&(o+="\\"),l+=1,a=l+1}break;default:l+=1}return o=a?o+t.slice(a):t,n?o:
|
|
67
|
+
`,l+=2;o+=i,t[l+2]===" "&&(o+="\\"),l+=1,a=l+1}break;default:l+=1}return o=a?o+t.slice(a):t,n?o:Ds(o,i,Fs,xs(e,!1))}function ir(s,e){if(e.options.singleQuote===!1||e.implicitKey&&s.includes(`
|
|
68
68
|
`)||/[ \t]\n|\n[ \t]/.test(s))return Wt(s,e);const t=e.indent||(Hs(s)?" ":""),n="'"+s.replace(/'/g,"''").replace(/\n+/g,`$&
|
|
69
|
-
${t}`)+"'";return e.implicitKey?n:
|
|
69
|
+
${t}`)+"'";return e.implicitKey?n:Ds(n,t,Ko,xs(e,!1))}function St(s,e){const{singleQuote:t}=e.options;let n;if(t===!1)n=Wt;else{const r=s.includes('"'),i=s.includes("'");r&&!i?n=ir:i&&!r?n=Wt:n=t?ir:Wt}return n(s,e)}let or;try{or=new RegExp(`(^|(?<!
|
|
70
70
|
))
|
|
71
71
|
+(?!
|
|
72
|
-
|$)`,"g")}catch{or=/\n+(?!\n|$)/g}function Us({comment:s,type:e,value:t},n,r,i){const{blockQuote:o,commentString:a,lineWidth:l}=n.options;if(!o||/\n[\t ]+$/.test(t)||/^\s*$/.test(t))return St(t,n);const c=n.indent||(n.forceBlockIndent||Hs(t)?" ":""),
|
|
72
|
+
|$)`,"g")}catch{or=/\n+(?!\n|$)/g}function Us({comment:s,type:e,value:t},n,r,i){const{blockQuote:o,commentString:a,lineWidth:l}=n.options;if(!o||/\n[\t ]+$/.test(t)||/^\s*$/.test(t))return St(t,n);const c=n.indent||(n.forceBlockIndent||Hs(t)?" ":""),f=o==="literal"?!0:o==="folded"||e===N.BLOCK_FOLDED?!1:e===N.BLOCK_LITERAL?!0:!Yf(t,l,c.length);if(!t)return f?`|
|
|
73
73
|
`:`>
|
|
74
|
-
`;let u,
|
|
75
|
-
`&&O!==" "&&O!==" ")break}let d=t.substring(
|
|
74
|
+
`;let u,h;for(h=t.length;h>0;--h){const O=t[h-1];if(O!==`
|
|
75
|
+
`&&O!==" "&&O!==" ")break}let d=t.substring(h);const m=d.indexOf(`
|
|
76
76
|
`);m===-1?u="-":t===d||m!==d.length-1?(u="+",i&&i()):u="",d&&(t=t.slice(0,-d.length),d[d.length-1]===`
|
|
77
77
|
`&&(d=d.slice(0,-1)),d=d.replace(or,`$&${c}`));let p=!1,g,y=-1;for(g=0;g<t.length;++g){const O=t[g];if(O===" ")p=!0;else if(O===`
|
|
78
|
-
`)y=g;else break}let S=t.substring(0,y<g?y+1:g);S&&(t=t.substring(S.length),S=S.replace(/\n+/g,`$&${c}`));let L=(
|
|
78
|
+
`)y=g;else break}let S=t.substring(0,y<g?y+1:g);S&&(t=t.substring(S.length),S=S.replace(/\n+/g,`$&${c}`));let L=(f?"|":">")+(p?c?"2":"1":"")+u;if(s&&(L+=" "+a(s.replace(/ ?[\r\n]+/g," ")),r&&r()),f)return t=t.replace(/\n+/g,`$&${c}`),`${L}
|
|
79
79
|
${c}${S}${t}${d}`;t=t.replace(/\n+/g,`
|
|
80
|
-
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${c}`);const R=
|
|
81
|
-
${c}${R}`}function Vf(s,e,t,n){const{type:r,value:i}=s,{actualString:o,implicitKey:a,indent:l,indentStep:c,inFlow:
|
|
82
|
-
`)||
|
|
83
|
-
`)?St(i,e):Us(s,e,t,n);if(!a&&!
|
|
80
|
+
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${c}`);const R=Ds(`${S}${t}${d}`,c,rr,xs(n,!0));return`${L}
|
|
81
|
+
${c}${R}`}function Vf(s,e,t,n){const{type:r,value:i}=s,{actualString:o,implicitKey:a,indent:l,indentStep:c,inFlow:f}=e;if(a&&i.includes(`
|
|
82
|
+
`)||f&&/[[\]{},]/.test(i))return St(i,e);if(!i||/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(i))return a||f||!i.includes(`
|
|
83
|
+
`)?St(i,e):Us(s,e,t,n);if(!a&&!f&&r!==N.PLAIN&&i.includes(`
|
|
84
84
|
`))return Us(s,e,t,n);if(Hs(i)){if(l==="")return e.forceBlockIndent=!0,Us(s,e,t,n);if(a&&l===c)return St(i,e)}const u=i.replace(/\n+/g,`$&
|
|
85
|
-
${l}`);if(o){const
|
|
86
|
-
${e.indent}${a}`:a}function Xf({key:s,value:e},t,n,r){const{allNullValues:i,doc:o,indent:a,indentStep:l,options:{commentString:c,indentSeq:
|
|
87
|
-
${a}:`):(g=`${g}:`,
|
|
85
|
+
${l}`);if(o){const h=p=>p.default&&p.tag!=="tag:yaml.org,2002:str"&&p.test?.test(u),{compat:d,tags:m}=e.doc.schema;if(m.some(h)||d?.some(h))return St(i,e)}return a?u:Ds(u,l,Ko,xs(e,!1))}function Yt(s,e,t,n){const{implicitKey:r,inFlow:i}=e,o=typeof s.value=="string"?s:Object.assign({},s,{value:String(s.value)});let{type:a}=s;a!==N.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value)&&(a=N.QUOTE_DOUBLE);const l=f=>{switch(f){case N.BLOCK_FOLDED:case N.BLOCK_LITERAL:return r||i?St(o.value,e):Us(o,e,t,n);case N.QUOTE_DOUBLE:return Wt(o.value,e);case N.QUOTE_SINGLE:return ir(o.value,e);case N.PLAIN:return Vf(o,e,t,n);default:return null}};let c=l(a);if(c===null){const{defaultKeyType:f,defaultStringType:u}=e.options,h=r&&f||u;if(c=l(h),c===null)throw new Error(`Unsupported default string type ${h}`)}return c}function qo(s,e){const t=Object.assign({blockQuote:!0,commentString:Wf,defaultKeyType:null,defaultStringType:"PLAIN",directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:"false",flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:"null",simpleKeys:!1,singleQuote:null,trueStr:"true",verifyAliasOrder:!0},s.schema.toStringOptions,e);let n;switch(t.collectionStyle){case"block":n=!1;break;case"flow":n=!0;break;default:n=null}return{anchors:new Set,doc:s,flowCollectionPadding:t.flowCollectionPadding?" ":"",indent:"",indentStep:typeof t.indent=="number"?" ".repeat(t.indent):" ",inFlow:n,options:t}}function zf(s,e){if(e.tag){const r=s.filter(i=>i.tag===e.tag);if(r.length>0)return r.find(i=>i.format===e.format)??r[0]}let t,n;if(Y(e)){n=e.value;const r=s.filter(i=>i.identify?.(n));t=r.find(i=>i.format===e.format)??r.find(i=>!i.format)}else n=e,t=s.find(r=>r.nodeClass&&n instanceof r.nodeClass);if(!t){const r=n?.constructor?.name??typeof n;throw new Error(`Tag not resolved for ${r} value`)}return t}function Qf(s,e,{anchors:t,doc:n}){if(!n.directives)return"";const r=[],i=(Y(s)||Z(s))&&s.anchor;i&&xo(i)&&(t.add(i),r.push(`&${i}`));const o=s.tag?s.tag:e.default?null:e.tag;return o&&r.push(n.directives.tagString(o)),r.join(" ")}function At(s,e,t,n){if(X(s))return s.toString(e,t,n);if(Qe(s)){if(e.doc.directives)return s.toString(e);if(e.resolvedAliases?.has(s))throw new TypeError("Cannot stringify circular structure without alias nodes");e.resolvedAliases?e.resolvedAliases.add(s):e.resolvedAliases=new Set([s]),s=s.resolve(e.doc)}let r;const i=te(s)?s:e.doc.createNode(s,{onTagObj:l=>r=l});r||(r=zf(e.doc.schema.tags,i));const o=Qf(i,r,e);o.length>0&&(e.indentAtStart=(e.indentAtStart??0)+o.length+1);const a=typeof r.stringify=="function"?r.stringify(i,e,t,n):Y(i)?Yt(i,e,t,n):i.toString(e,t,n);return o?Y(i)||a[0]==="{"||a[0]==="["?`${o} ${a}`:`${o}
|
|
86
|
+
${e.indent}${a}`:a}function Xf({key:s,value:e},t,n,r){const{allNullValues:i,doc:o,indent:a,indentStep:l,options:{commentString:c,indentSeq:f,simpleKeys:u}}=t;let h=te(s)&&s.comment||null;if(u){if(h)throw new Error("With simple keys, key nodes cannot have comments");if(Z(s)){const I="With simple keys, collection cannot be used as a key value";throw new Error(I)}}let d=!u&&(!s||h&&e==null&&!t.inFlow||Z(s)||(Y(s)?s.type===N.BLOCK_FOLDED||s.type===N.BLOCK_LITERAL:typeof s=="object"));t=Object.assign({},t,{allNullValues:!1,implicitKey:!d&&(u||!i),indent:a+l});let m=!1,p=!1,g=At(s,t,()=>m=!0,()=>p=!0);if(!d&&!t.inFlow&&g.length>1024){if(u)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");d=!0}if(t.inFlow){if(i||e==null)return m&&n&&n(),g===""?"?":d?`? ${g}`:g}else if(i&&!u||e==null&&d)return g=`? ${g}`,h&&!m?g+=je(g,t.indent,c(h)):p&&r&&r(),g;m&&(h=null),d?(h&&(g+=je(g,t.indent,c(h))),g=`? ${g}
|
|
87
|
+
${a}:`):(g=`${g}:`,h&&(g+=je(g,t.indent,c(h))));let y,S,A;te(e)?(y=!!e.spaceBefore,S=e.commentBefore,A=e.comment):(y=!1,S=null,A=null,e&&typeof e=="object"&&(e=o.createNode(e))),t.implicitKey=!1,!d&&!h&&Y(e)&&(t.indentAtStart=g.length+1),p=!1,!f&&l.length>=2&&!t.inFlow&&!d&&yt(e)&&!e.flow&&!e.tag&&!e.anchor&&(t.indent=t.indent.substring(2));let L=!1;const R=At(e,t,()=>L=!0,()=>p=!0);let O=" ";if(h||y||S){if(O=y?`
|
|
88
88
|
`:"",S){const I=c(S);O+=`
|
|
89
89
|
${Pe(I,t.indent)}`}R===""&&!t.inFlow?O===`
|
|
90
90
|
`&&(O=`
|
|
@@ -93,47 +93,47 @@ ${Pe(I,t.indent)}`}R===""&&!t.inFlow?O===`
|
|
|
93
93
|
${t.indent}`}else if(!d&&Z(e)){const I=R[0],_=R.indexOf(`
|
|
94
94
|
`),k=_!==-1,j=t.inFlow??e.flow??e.items.length===0;if(k||!j){let E=!1;if(k&&(I==="&"||I==="!")){let $=R.indexOf(" ");I==="&"&&$!==-1&&$<_&&R[$+1]==="!"&&($=R.indexOf(" ",$+1)),($===-1||_<$)&&(E=!0)}E||(O=`
|
|
95
95
|
${t.indent}`)}}else(R===""||R[0]===`
|
|
96
|
-
`)&&(O="");return g+=O+R,t.inFlow?L&&n&&n():A&&!L?g+=je(g,t.indent,c(A)):p&&r&&r(),g}function
|
|
96
|
+
`)&&(O="");return g+=O+R,t.inFlow?L&&n&&n():A&&!L?g+=je(g,t.indent,c(A)):p&&r&&r(),g}function Wo(s,e){(s==="debug"||s==="warn")&&(typeof process<"u"&&process.emitWarning?process.emitWarning(e):console.warn(e))}const Yo="<<";function Vo(s,e,{key:t,value:n}){if(s?.doc.schema.merge&&Jf(t))if(n=Qe(n)?n.resolve(s.doc):n,yt(n))for(const r of n.items)ar(s,e,r);else if(Array.isArray(n))for(const r of n)ar(s,e,r);else ar(s,e,n);else{const r=ye(t,"",s);if(e instanceof Map)e.set(r,ye(n,r,s));else if(e instanceof Set)e.add(r);else{const i=Zf(t,r,s),o=ye(n,i,s);i in e?Object.defineProperty(e,i,{value:o,writable:!0,enumerable:!0,configurable:!0}):e[i]=o}}return e}const Jf=s=>s===Yo||Y(s)&&s.value===Yo&&(!s.type||s.type===N.PLAIN);function ar(s,e,t){const n=s&&Qe(t)?t.resolve(s.doc):t;if(!mt(n))throw new Error("Merge sources must be maps or map aliases");const r=n.toJSON(null,s,Map);for(const[i,o]of r)e instanceof Map?e.has(i)||e.set(i,o):e instanceof Set?e.add(i):Object.prototype.hasOwnProperty.call(e,i)||Object.defineProperty(e,i,{value:o,writable:!0,enumerable:!0,configurable:!0});return e}function Zf(s,e,t){if(e===null)return"";if(typeof e!="object")return String(e);if(te(s)&&t?.doc){const n=qo(t.doc,{});n.anchors=new Set;for(const i of t.anchors.keys())n.anchors.add(i.anchor);n.inFlow=!0,n.inStringifyKey=!0;const r=s.toString(n);if(!t.mapKeyWarned){let i=JSON.stringify(r);i.length>40&&(i=i.substring(0,36)+'..."'),Wo(t.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${i}. Set mapAsMap: true to use object keys.`),t.mapKeyWarned=!0}return r}return JSON.stringify(e)}function lr(s,e,t){const n=Gt(s,void 0,t),r=Gt(e,void 0,t);return new re(n,r)}class re{constructor(e,t=null){Object.defineProperty(this,me,{value:Po}),this.key=e,this.value=t}clone(e){let{key:t,value:n}=this;return te(t)&&(t=t.clone(e)),te(n)&&(n=n.clone(e)),new re(t,n)}toJSON(e,t){const n=t?.mapAsMap?new Map:{};return Vo(t,n,this)}toString(e,t,n){return e?.doc?Xf(this,e,t,n):JSON.stringify(this)}}function zo(s,e,t){return(e.inFlow??s.flow?th:eh)(s,e,t)}function eh({comment:s,items:e},t,{blockItemPrefix:n,flowChars:r,itemIndent:i,onChompKeep:o,onComment:a}){const{indent:l,options:{commentString:c}}=t,f=Object.assign({},t,{indent:i,type:null});let u=!1;const h=[];for(let m=0;m<e.length;++m){const p=e[m];let g=null;if(te(p))!u&&p.spaceBefore&&h.push(""),js(t,h,p.commentBefore,u),p.comment&&(g=p.comment);else if(X(p)){const S=te(p.key)?p.key:null;S&&(!u&&S.spaceBefore&&h.push(""),js(t,h,S.commentBefore,u))}u=!1;let y=At(p,f,()=>g=null,()=>u=!0);g&&(y+=je(y,i,c(g))),u&&g&&(u=!1),h.push(n+y)}let d;if(h.length===0)d=r.start+r.end;else{d=h[0];for(let m=1;m<h.length;++m){const p=h[m];d+=p?`
|
|
97
97
|
${l}${p}`:`
|
|
98
98
|
`}}return s?(d+=`
|
|
99
|
-
`+Pe(c(s),l),a&&a()):u&&o&&o(),d}function th({comment:s,items:e},t,{flowChars:n,itemIndent:r,onComment:i}){const{indent:o,indentStep:a,flowCollectionPadding:l,options:{commentString:c}}=t;r+=a;const
|
|
100
|
-
`))&&(u=!0),d.push(L),
|
|
99
|
+
`+Pe(c(s),l),a&&a()):u&&o&&o(),d}function th({comment:s,items:e},t,{flowChars:n,itemIndent:r,onComment:i}){const{indent:o,indentStep:a,flowCollectionPadding:l,options:{commentString:c}}=t;r+=a;const f=Object.assign({},t,{indent:r,inFlow:!0,type:null});let u=!1,h=0;const d=[];for(let y=0;y<e.length;++y){const S=e[y];let A=null;if(te(S))S.spaceBefore&&d.push(""),js(t,d,S.commentBefore,!1),S.comment&&(A=S.comment);else if(X(S)){const R=te(S.key)?S.key:null;R&&(R.spaceBefore&&d.push(""),js(t,d,R.commentBefore,!1),R.comment&&(u=!0));const O=te(S.value)?S.value:null;O?(O.comment&&(A=O.comment),O.commentBefore&&(u=!0)):S.value==null&&R?.comment&&(A=R.comment)}A&&(u=!0);let L=At(S,f,()=>A=null);y<e.length-1&&(L+=","),A&&(L+=je(L,r,c(A))),!u&&(d.length>h||L.includes(`
|
|
100
|
+
`))&&(u=!0),d.push(L),h=d.length}let m;const{start:p,end:g}=n;if(d.length===0)m=p+g;else if(u||(u=d.reduce((S,A)=>S+A.length+2,2)>Ms.maxFlowStringSingleLineLength),u){m=p;for(const y of d)m+=y?`
|
|
101
101
|
${a}${o}${y}`:`
|
|
102
102
|
`;m+=`
|
|
103
|
-
${o}${g}`}else m=`${p}${l}${d.join(" ")}${l}${g}`;return s&&(m+=je(m,o,c(s)),i&&i()),m}function js({indent:s,options:{commentString:e}},t,n,r){if(n&&r&&(n=n.replace(/^\n+/,"")),n){const i=Pe(e(n),s);t.push(i.trimStart())}}function Xe(s,e){const t=Y(e)?e.value:e;for(const n of s)if(X(n)&&(n.key===e||n.key===t||Y(n.key)&&n.key.value===t))return n}class pe extends Ms{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(He,e),this.items=[]}static from(e,t,n){const{keepUndefined:r,replacer:i}=n,o=new this(e),a=(l,c)=>{if(typeof i=="function")c=i.call(t,l,c);else if(Array.isArray(i)&&!i.includes(l))return;(c!==void 0||r)&&o.items.push(lr(l,c,n))};if(t instanceof Map)for(const[l,c]of t)a(l,c);else if(t&&typeof t=="object")for(const l of Object.keys(t))a(l,t[l]);return typeof e.sortMapEntries=="function"&&o.items.sort(e.sortMapEntries),o}add(e,t){let n;X(e)?n=e:!e||typeof e!="object"||!("key"in e)?n=new re(e,e?.value):n=new re(e.key,e.value);const r=Xe(this.items,n.key),i=this.schema?.sortMapEntries;if(r){if(!t)throw new Error(`Key ${n.key} already set`);Y(r.value)&&
|
|
104
|
-
`:" ")}return Yt({comment:s,type:e,value:a},n,r,i)}};function
|
|
103
|
+
${o}${g}`}else m=`${p}${l}${d.join(" ")}${l}${g}`;return s&&(m+=je(m,o,c(s)),i&&i()),m}function js({indent:s,options:{commentString:e}},t,n,r){if(n&&r&&(n=n.replace(/^\n+/,"")),n){const i=Pe(e(n),s);t.push(i.trimStart())}}function Xe(s,e){const t=Y(e)?e.value:e;for(const n of s)if(X(n)&&(n.key===e||n.key===t||Y(n.key)&&n.key.value===t))return n}class pe extends Ms{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(He,e),this.items=[]}static from(e,t,n){const{keepUndefined:r,replacer:i}=n,o=new this(e),a=(l,c)=>{if(typeof i=="function")c=i.call(t,l,c);else if(Array.isArray(i)&&!i.includes(l))return;(c!==void 0||r)&&o.items.push(lr(l,c,n))};if(t instanceof Map)for(const[l,c]of t)a(l,c);else if(t&&typeof t=="object")for(const l of Object.keys(t))a(l,t[l]);return typeof e.sortMapEntries=="function"&&o.items.sort(e.sortMapEntries),o}add(e,t){let n;X(e)?n=e:!e||typeof e!="object"||!("key"in e)?n=new re(e,e?.value):n=new re(e.key,e.value);const r=Xe(this.items,n.key),i=this.schema?.sortMapEntries;if(r){if(!t)throw new Error(`Key ${n.key} already set`);Y(r.value)&&jo(n.value)?r.value.value=n.value:r.value=n.value}else if(i){const o=this.items.findIndex(a=>i(n,a)<0);o===-1?this.items.push(n):this.items.splice(o,0,n)}else this.items.push(n)}delete(e){const t=Xe(this.items,e);return t?this.items.splice(this.items.indexOf(t),1).length>0:!1}get(e,t){const r=Xe(this.items,e)?.value;return(!t&&Y(r)?r.value:r)??void 0}has(e){return!!Xe(this.items,e)}set(e,t){this.add(new re(e,t),!0)}toJSON(e,t,n){const r=n?new n:t?.mapAsMap?new Map:{};t?.onCreate&&t.onCreate(r);for(const i of this.items)Vo(t,r,i);return r}toString(e,t,n){if(!e)return JSON.stringify(this);for(const r of this.items)if(!X(r))throw new Error(`Map items must all be pairs; found ${JSON.stringify(r)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),zo(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:n,onComment:t})}}const Ot={collection:"map",default:!0,nodeClass:pe,tag:"tag:yaml.org,2002:map",resolve(s,e){return mt(s)||e("Expected a mapping for this tag"),s},createNode:(s,e,t)=>pe.from(s,e,t)};class Ke extends Ms{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(dt,e),this.items=[]}add(e){this.items.push(e)}delete(e){const t=Ks(e);return typeof t!="number"?!1:this.items.splice(t,1).length>0}get(e,t){const n=Ks(e);if(typeof n!="number")return;const r=this.items[n];return!t&&Y(r)?r.value:r}has(e){const t=Ks(e);return typeof t=="number"&&t<this.items.length}set(e,t){const n=Ks(e);if(typeof n!="number")throw new Error(`Expected a valid index, not ${e}.`);const r=this.items[n];Y(r)&&jo(t)?r.value=t:this.items[n]=t}toJSON(e,t){const n=[];t?.onCreate&&t.onCreate(n);let r=0;for(const i of this.items)n.push(ye(i,String(r++),t));return n}toString(e,t,n){return e?zo(this,e,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:(e.indent||"")+" ",onChompKeep:n,onComment:t}):JSON.stringify(this)}static from(e,t,n){const{replacer:r}=n,i=new this(e);if(t&&Symbol.iterator in Object(t)){let o=0;for(let a of t){if(typeof r=="function"){const l=t instanceof Set?a:String(o++);a=r.call(t,l,a)}i.items.push(Gt(a,void 0,n))}}return i}}function Ks(s){let e=Y(s)?s.value:s;return e&&typeof e=="string"&&(e=Number(e)),typeof e=="number"&&Number.isInteger(e)&&e>=0?e:null}const Ct={collection:"seq",default:!0,nodeClass:Ke,tag:"tag:yaml.org,2002:seq",resolve(s,e){return yt(s)||e("Expected a sequence for this tag"),s},createNode:(s,e,t)=>Ke.from(s,e,t)},Gs={identify:s=>typeof s=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:s=>s,stringify(s,e,t,n){return e=Object.assign({actualString:!0},e),Yt(s,e,t,n)}},qs={identify:s=>s==null,createNode:()=>new N(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new N(null),stringify:({source:s},e)=>typeof s=="string"&&qs.test.test(s)?s:e.options.nullStr},cr={identify:s=>typeof s=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:s=>new N(s[0]==="t"||s[0]==="T"),stringify({source:s,value:e},t){if(s&&cr.test.test(s)){const n=s[0]==="t"||s[0]==="T";if(e===n)return s}return e?t.options.trueStr:t.options.falseStr}};function Ee({format:s,minFractionDigits:e,tag:t,value:n}){if(typeof n=="bigint")return String(n);const r=typeof n=="number"?n:Number(n);if(!isFinite(r))return isNaN(r)?".nan":r<0?"-.inf":".inf";let i=JSON.stringify(n);if(!s&&e&&(!t||t==="tag:yaml.org,2002:float")&&/^\d/.test(i)){let o=i.indexOf(".");o<0&&(o=i.length,i+=".");let a=e-(i.length-o-1);for(;a-- >0;)i+="0"}return i}const Qo={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF|nan|NaN|NAN))$/,resolve:s=>s.slice(-3).toLowerCase()==="nan"?NaN:s[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:Ee},Xo={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:s=>parseFloat(s),stringify(s){const e=Number(s.value);return isFinite(e)?e.toExponential():Ee(s)}},Jo={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(s){const e=new N(parseFloat(s)),t=s.indexOf(".");return t!==-1&&s[s.length-1]==="0"&&(e.minFractionDigits=s.length-t-1),e},stringify:Ee},Ws=s=>typeof s=="bigint"||Number.isInteger(s),ur=(s,e,t,{intAsBigInt:n})=>n?BigInt(s):parseInt(s.substring(e),t);function Zo(s,e,t){const{value:n}=s;return Ws(n)&&n>=0?t+n.toString(e):Ee(s)}const ea={identify:s=>Ws(s)&&s>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(s,e,t)=>ur(s,2,8,t),stringify:s=>Zo(s,8,"0o")},ta={identify:Ws,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(s,e,t)=>ur(s,0,10,t),stringify:Ee},sa={identify:s=>Ws(s)&&s>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(s,e,t)=>ur(s,2,16,t),stringify:s=>Zo(s,16,"0x")},sh=[Ot,Ct,Gs,qs,cr,ea,ta,sa,Qo,Xo,Jo];function na(s){return typeof s=="bigint"||Number.isInteger(s)}const Ys=({value:s})=>JSON.stringify(s),nh=[{identify:s=>typeof s=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:s=>s,stringify:Ys},{identify:s=>s==null,createNode:()=>new N(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:Ys},{identify:s=>typeof s=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true|false$/,resolve:s=>s==="true",stringify:Ys},{identify:na,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(s,e,{intAsBigInt:t})=>t?BigInt(s):parseInt(s,10),stringify:({value:s})=>na(s)?s.toString():JSON.stringify(s)},{identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:s=>parseFloat(s),stringify:Ys}],rh={default:!0,tag:"",test:/^/,resolve(s,e){return e(`Unresolved plain scalar ${JSON.stringify(s)}`),s}},ih=[Ot,Ct].concat(nh,rh),fr={identify:s=>s instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(s,e){if(typeof Buffer=="function")return Buffer.from(s,"base64");if(typeof atob=="function"){const t=atob(s.replace(/[\n\r]/g,"")),n=new Uint8Array(t.length);for(let r=0;r<t.length;++r)n[r]=t.charCodeAt(r);return n}else return e("This environment does not support reading binary tags; either Buffer or atob is required"),s},stringify({comment:s,type:e,value:t},n,r,i){const o=t;let a;if(typeof Buffer=="function")a=o instanceof Buffer?o.toString("base64"):Buffer.from(o.buffer).toString("base64");else if(typeof btoa=="function"){let l="";for(let c=0;c<o.length;++c)l+=String.fromCharCode(o[c]);a=btoa(l)}else throw new Error("This environment does not support writing binary tags; either Buffer or btoa is required");if(e||(e=N.BLOCK_LITERAL),e!==N.QUOTE_DOUBLE){const l=Math.max(n.options.lineWidth-n.indent.length,n.options.minContentWidth),c=Math.ceil(a.length/l),f=new Array(c);for(let u=0,h=0;u<c;++u,h+=l)f[u]=a.substr(h,l);a=f.join(e===N.BLOCK_LITERAL?`
|
|
104
|
+
`:" ")}return Yt({comment:s,type:e,value:a},n,r,i)}};function ra(s,e){if(yt(s))for(let t=0;t<s.items.length;++t){let n=s.items[t];if(!X(n)){if(mt(n)){n.items.length>1&&e("Each pair must have its own sequence indicator");const r=n.items[0]||new re(new N(null));if(n.commentBefore&&(r.key.commentBefore=r.key.commentBefore?`${n.commentBefore}
|
|
105
105
|
${r.key.commentBefore}`:n.commentBefore),n.comment){const i=r.value??r.key;i.comment=i.comment?`${n.comment}
|
|
106
|
-
${i.comment}`:n.comment}n=r}s.items[t]=X(n)?n:new re(n)}}else e("Expected a sequence for this tag");return s}function
|
|
106
|
+
${i.comment}`:n.comment}n=r}s.items[t]=X(n)?n:new re(n)}}else e("Expected a sequence for this tag");return s}function ia(s,e,t){const{replacer:n}=t,r=new Ke(s);r.tag="tag:yaml.org,2002:pairs";let i=0;if(e&&Symbol.iterator in Object(e))for(let o of e){typeof n=="function"&&(o=n.call(e,String(i++),o));let a,l;if(Array.isArray(o))if(o.length===2)a=o[0],l=o[1];else throw new TypeError(`Expected [key, value] tuple: ${o}`);else if(o&&o instanceof Object){const c=Object.keys(o);if(c.length===1)a=c[0],l=o[a];else throw new TypeError(`Expected tuple with one key, not ${c.length} keys`)}else a=o;r.items.push(lr(a,l,t))}return r}const hr={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:ra,createNode:ia};class Lt extends Ke{constructor(){super(),this.add=pe.prototype.add.bind(this),this.delete=pe.prototype.delete.bind(this),this.get=pe.prototype.get.bind(this),this.has=pe.prototype.has.bind(this),this.set=pe.prototype.set.bind(this),this.tag=Lt.tag}toJSON(e,t){if(!t)return super.toJSON(e);const n=new Map;t?.onCreate&&t.onCreate(n);for(const r of this.items){let i,o;if(X(r)?(i=ye(r.key,"",t),o=ye(r.value,i,t)):i=ye(r,"",t),n.has(i))throw new Error("Ordered maps must not include duplicate keys");n.set(i,o)}return n}static from(e,t,n){const r=ia(e,t,n),i=new this;return i.items=r.items,i}}Lt.tag="tag:yaml.org,2002:omap";const pr={collection:"seq",identify:s=>s instanceof Map,nodeClass:Lt,default:!1,tag:"tag:yaml.org,2002:omap",resolve(s,e){const t=ra(s,e),n=[];for(const{key:r}of t.items)Y(r)&&(n.includes(r.value)?e(`Ordered maps must not include duplicate keys: ${r.value}`):n.push(r.value));return Object.assign(new Lt,t)},createNode:(s,e,t)=>Lt.from(s,e,t)};function oa({value:s,source:e},t){return e&&(s?aa:la).test.test(e)?e:s?t.options.trueStr:t.options.falseStr}const aa={identify:s=>s===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new N(!0),stringify:oa},la={identify:s=>s===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/i,resolve:()=>new N(!1),stringify:oa},oh={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?\.(?:inf|Inf|INF|nan|NaN|NAN)$/,resolve:s=>s.slice(-3).toLowerCase()==="nan"?NaN:s[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:Ee},ah={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:s=>parseFloat(s.replace(/_/g,"")),stringify(s){const e=Number(s.value);return isFinite(e)?e.toExponential():Ee(s)}},lh={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(s){const e=new N(parseFloat(s.replace(/_/g,""))),t=s.indexOf(".");if(t!==-1){const n=s.substring(t+1).replace(/_/g,"");n[n.length-1]==="0"&&(e.minFractionDigits=n.length)}return e},stringify:Ee},Vt=s=>typeof s=="bigint"||Number.isInteger(s);function Vs(s,e,t,{intAsBigInt:n}){const r=s[0];if((r==="-"||r==="+")&&(e+=1),s=s.substring(e).replace(/_/g,""),n){switch(t){case 2:s=`0b${s}`;break;case 8:s=`0o${s}`;break;case 16:s=`0x${s}`;break}const o=BigInt(s);return r==="-"?BigInt(-1)*o:o}const i=parseInt(s,t);return r==="-"?-1*i:i}function dr(s,e,t){const{value:n}=s;if(Vt(n)){const r=n.toString(e);return n<0?"-"+t+r.substr(1):t+r}return Ee(s)}const ch={identify:Vt,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(s,e,t)=>Vs(s,2,2,t),stringify:s=>dr(s,2,"0b")},uh={identify:Vt,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(s,e,t)=>Vs(s,1,8,t),stringify:s=>dr(s,8,"0")},fh={identify:Vt,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(s,e,t)=>Vs(s,0,10,t),stringify:Ee},hh={identify:Vt,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(s,e,t)=>Vs(s,2,16,t),stringify:s=>dr(s,16,"0x")};class kt extends pe{constructor(e){super(e),this.tag=kt.tag}add(e){let t;X(e)?t=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?t=new re(e.key,null):t=new re(e,null),Xe(this.items,t.key)||this.items.push(t)}get(e,t){const n=Xe(this.items,e);return!t&&X(n)?Y(n.key)?n.key.value:n.key:n}set(e,t){if(typeof t!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof t}`);const n=Xe(this.items,e);n&&!t?this.items.splice(this.items.indexOf(n),1):!n&&t&&this.items.push(new re(e))}toJSON(e,t){return super.toJSON(e,t,Set)}toString(e,t,n){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),t,n);throw new Error("Set items must all have null values")}static from(e,t,n){const{replacer:r}=n,i=new this(e);if(t&&Symbol.iterator in Object(t))for(let o of t)typeof r=="function"&&(o=r.call(t,o,o)),i.items.push(lr(o,null,n));return i}}kt.tag="tag:yaml.org,2002:set";const gr={collection:"map",identify:s=>s instanceof Set,nodeClass:kt,default:!1,tag:"tag:yaml.org,2002:set",createNode:(s,e,t)=>kt.from(s,e,t),resolve(s,e){if(mt(s)){if(s.hasAllNullValues(!0))return Object.assign(new kt,s);e("Set items must all have null values")}else e("Expected a mapping for this tag");return s}};function mr(s,e){const t=s[0],n=t==="-"||t==="+"?s.substring(1):s,r=o=>e?BigInt(o):Number(o),i=n.replace(/_/g,"").split(":").reduce((o,a)=>o*r(60)+r(a),r(0));return t==="-"?r(-1)*i:i}function ca(s){let{value:e}=s,t=o=>o;if(typeof e=="bigint")t=o=>BigInt(o);else if(isNaN(e)||!isFinite(e))return Ee(s);let n="";e<0&&(n="-",e*=t(-1));const r=t(60),i=[e%r];return e<60?i.unshift(0):(e=(e-i[0])/r,i.unshift(e%r),e>=60&&(e=(e-i[0])/r,i.unshift(e))),n+i.map(o=>String(o).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}const ua={identify:s=>typeof s=="bigint"||Number.isInteger(s),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(s,e,{intAsBigInt:t})=>mr(s,t),stringify:ca},fa={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:s=>mr(s,!1),stringify:ca},zs={identify:s=>s instanceof Date,default:!0,tag:"tag:yaml.org,2002:timestamp",test:RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),resolve(s){const e=s.match(zs.test);if(!e)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");const[,t,n,r,i,o,a]=e.map(Number),l=e[7]?Number((e[7]+"00").substr(1,3)):0;let c=Date.UTC(t,n-1,r,i||0,o||0,a||0,l);const f=e[8];if(f&&f!=="Z"){let u=mr(f,!1);Math.abs(u)<30&&(u*=60),c-=6e4*u}return new Date(c)},stringify:({value:s})=>s.toISOString().replace(/((T00:00)?:00)?\.000Z$/,"")},ha=[Ot,Ct,Gs,qs,aa,la,ch,uh,fh,hh,oh,ah,lh,fr,pr,hr,gr,ua,fa,zs],pa=new Map([["core",sh],["failsafe",[Ot,Ct,Gs]],["json",ih],["yaml11",ha],["yaml-1.1",ha]]),da={binary:fr,bool:cr,float:Jo,floatExp:Xo,floatNaN:Qo,floatTime:fa,int:ta,intHex:sa,intOct:ea,intTime:ua,map:Ot,null:qs,omap:pr,pairs:hr,seq:Ct,set:gr,timestamp:zs},ph={"tag:yaml.org,2002:binary":fr,"tag:yaml.org,2002:omap":pr,"tag:yaml.org,2002:pairs":hr,"tag:yaml.org,2002:set":gr,"tag:yaml.org,2002:timestamp":zs};function yr(s,e){let t=pa.get(e);if(!t)if(Array.isArray(s))t=[];else{const n=Array.from(pa.keys()).filter(r=>r!=="yaml11").map(r=>JSON.stringify(r)).join(", ");throw new Error(`Unknown schema "${e}"; use one of ${n} or define customTags array`)}if(Array.isArray(s))for(const n of s)t=t.concat(n);else typeof s=="function"&&(t=s(t.slice()));return t.map(n=>{if(typeof n!="string")return n;const r=da[n];if(r)return r;const i=Object.keys(da).map(o=>JSON.stringify(o)).join(", ");throw new Error(`Unknown custom tag "${n}"; use one of ${i}`)})}const dh=(s,e)=>s.key<e.key?-1:s.key>e.key?1:0;class an{constructor({compat:e,customTags:t,merge:n,resolveKnownTags:r,schema:i,sortMapEntries:o,toStringDefaults:a}){this.compat=Array.isArray(e)?yr(e,"compat"):e?yr(null,e):null,this.merge=!!n,this.name=typeof i=="string"&&i||"core",this.knownTags=r?ph:{},this.tags=yr(t,this.name),this.toStringOptions=a??null,Object.defineProperty(this,He,{value:Ot}),Object.defineProperty(this,Ne,{value:Gs}),Object.defineProperty(this,dt,{value:Ct}),this.sortMapEntries=typeof o=="function"?o:o===!0?dh:null}clone(){const e=Object.create(an.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}}function gh(s,e){const t=[];let n=e.directives===!0;if(e.directives!==!1&&s.directives){const l=s.directives.toString(s);l?(t.push(l),n=!0):s.directives.docStart&&(n=!0)}n&&t.push("---");const r=qo(s,e),{commentString:i}=r.options;if(s.commentBefore){t.length!==1&&t.unshift("");const l=i(s.commentBefore);t.unshift(Pe(l,""))}let o=!1,a=null;if(s.contents){if(te(s.contents)){if(s.contents.spaceBefore&&n&&t.push(""),s.contents.commentBefore){const f=i(s.contents.commentBefore);t.push(Pe(f,""))}r.forceBlockIndent=!!s.comment,a=s.contents.comment}const l=a?void 0:()=>o=!0;let c=At(s.contents,r,()=>a=null,l);a&&(c+=je(c,"",i(a))),(c[0]==="|"||c[0]===">")&&t[t.length-1]==="---"?t[t.length-1]=`--- ${c}`:t.push(c)}else t.push(At(s.contents,r));if(s.directives?.docEnd)if(s.comment){const l=i(s.comment);l.includes(`
|
|
107
107
|
`)?(t.push("..."),t.push(Pe(l,""))):t.push(`... ${l}`)}else t.push("...");else{let l=s.comment;l&&o&&(l=l.replace(/^\n+/,"")),l&&((!o||a)&&t[t.length-1]!==""&&t.push(""),t.push(Pe(i(l),"")))}return t.join(`
|
|
108
108
|
`)+`
|
|
109
|
-
`}class $t{constructor(e,t,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,me,{value:sr});let r=null;typeof t=="function"||Array.isArray(t)?r=t:n===void 0&&t&&(n=t,t=void 0);const i=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,uniqueKeys:!0,version:"1.2"},n);this.options=i;let{version:o}=i;n?._directives?(this.directives=n._directives.atDocument(),this.directives.yaml.explicit&&(o=this.directives.yaml.version)):this.directives=new ae({version:o}),this.setSchema(o,n),this.contents=e===void 0?null:this.createNode(e,r,n)}clone(){const e=Object.create($t.prototype,{[me]:{value:sr}});return e.commentBefore=this.commentBefore,e.comment=this.comment,e.errors=this.errors.slice(),e.warnings=this.warnings.slice(),e.options=Object.assign({},this.options),this.directives&&(e.directives=this.directives.clone()),e.schema=this.schema.clone(),e.contents=te(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){Rt(this.contents)&&this.contents.add(e)}addIn(e,t){Rt(this.contents)&&this.contents.addIn(e,t)}createAlias(e,t){if(!e.anchor){const n=
|
|
109
|
+
`}class $t{constructor(e,t,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,me,{value:sr});let r=null;typeof t=="function"||Array.isArray(t)?r=t:n===void 0&&t&&(n=t,t=void 0);const i=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,uniqueKeys:!0,version:"1.2"},n);this.options=i;let{version:o}=i;n?._directives?(this.directives=n._directives.atDocument(),this.directives.yaml.explicit&&(o=this.directives.yaml.version)):this.directives=new ae({version:o}),this.setSchema(o,n),this.contents=e===void 0?null:this.createNode(e,r,n)}clone(){const e=Object.create($t.prototype,{[me]:{value:sr}});return e.commentBefore=this.commentBefore,e.comment=this.comment,e.errors=this.errors.slice(),e.warnings=this.warnings.slice(),e.options=Object.assign({},this.options),this.directives&&(e.directives=this.directives.clone()),e.schema=this.schema.clone(),e.contents=te(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){Rt(this.contents)&&this.contents.add(e)}addIn(e,t){Rt(this.contents)&&this.contents.addIn(e,t)}createAlias(e,t){if(!e.anchor){const n=Ho(this);e.anchor=!t||n.has(t)?Uo(t||"a",n):t}return new Ns(e.anchor)}createNode(e,t,n){let r;if(typeof t=="function")e=t.call({"":e},"",e),r=t;else if(Array.isArray(t)){const g=S=>typeof S=="number"||S instanceof String||S instanceof Number,y=t.filter(g).map(String);y.length>0&&(t=t.concat(y)),r=t}else n===void 0&&t&&(n=t,t=void 0);const{aliasDuplicateObjects:i,anchorPrefix:o,flow:a,keepUndefined:l,onTagObj:c,tag:f}=n??{},{onAnchor:u,setAnchors:h,sourceObjects:d}=Kf(this,o||"a"),m={aliasDuplicateObjects:i??!0,keepUndefined:l??!1,onAnchor:u,onTagObj:c,replacer:r,schema:this.schema,sourceObjects:d},p=Gt(e,f,m);return a&&Z(p)&&(p.flow=!0),h(),p}createPair(e,t,n={}){const r=this.createNode(e,null,n),i=this.createNode(t,null,n);return new re(r,i)}delete(e){return Rt(this.contents)?this.contents.delete(e):!1}deleteIn(e){return qt(e)?this.contents==null?!1:(this.contents=null,!0):Rt(this.contents)?this.contents.deleteIn(e):!1}get(e,t){return Z(this.contents)?this.contents.get(e,t):void 0}getIn(e,t){return qt(e)?!t&&Y(this.contents)?this.contents.value:this.contents:Z(this.contents)?this.contents.getIn(e,t):void 0}has(e){return Z(this.contents)?this.contents.has(e):!1}hasIn(e){return qt(e)?this.contents!==void 0:Z(this.contents)?this.contents.hasIn(e):!1}set(e,t){this.contents==null?this.contents=Bs(this.schema,[e],t):Rt(this.contents)&&this.contents.set(e,t)}setIn(e,t){qt(e)?this.contents=t:this.contents==null?this.contents=Bs(this.schema,Array.from(e),t):Rt(this.contents)&&this.contents.setIn(e,t)}setSchema(e,t={}){typeof e=="number"&&(e=String(e));let n;switch(e){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new ae({version:"1.1"}),n={merge:!0,resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=e:this.directives=new ae({version:e}),n={merge:!1,resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,n=null;break;default:{const r=JSON.stringify(e);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${r}`)}}if(t.schema instanceof Object)this.schema=t.schema;else if(n)this.schema=new an(Object.assign(n,t));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:e,jsonArg:t,mapAsMap:n,maxAliasCount:r,onAnchor:i,reviver:o}={}){const a={anchors:new Map,doc:this,keep:!e,mapAsMap:n===!0,mapKeyWarned:!1,maxAliasCount:typeof r=="number"?r:100},l=ye(this.contents,t??"",a);if(typeof i=="function")for(const{count:c,res:f}of a.anchors.values())i(f,c);return typeof o=="function"?Et(o,{"":l},"",l):l}toJSON(e,t){return this.toJS({json:!0,jsonArg:e,mapAsMap:!1,onAnchor:t})}toString(e={}){if(this.errors.length>0)throw new Error("Document with errors cannot be stringified");if("indent"in e&&(!Number.isInteger(e.indent)||Number(e.indent)<=0)){const t=JSON.stringify(e.indent);throw new Error(`"indent" option must be a positive integer, not ${t}`)}return gh(this,e)}}function Rt(s){if(Z(s))return!0;throw new Error("Expected a YAML collection as document contents")}class br extends Error{constructor(e,t,n,r){super(),this.name=e,this.code=n,this.message=r,this.pos=t}}class Je extends br{constructor(e,t,n){super("YAMLParseError",e,t,n)}}class ga extends br{constructor(e,t,n){super("YAMLWarning",e,t,n)}}const Qs=(s,e)=>t=>{if(t.pos[0]===-1)return;t.linePos=t.pos.map(a=>e.linePos(a));const{line:n,col:r}=t.linePos[0];t.message+=` at line ${n}, column ${r}`;let i=r-1,o=s.substring(e.lineStarts[n-1],e.lineStarts[n]).replace(/[\n\r]+$/,"");if(i>=60&&o.length>80){const a=Math.min(i-39,o.length-79);o="\u2026"+o.substring(a),i-=a-1}if(o.length>80&&(o=o.substring(0,79)+"\u2026"),n>1&&/^ *$/.test(o.substring(0,i))){let a=s.substring(e.lineStarts[n-2],e.lineStarts[n-1]);a.length>80&&(a=a.substring(0,79)+`\u2026
|
|
110
110
|
`),o=a+o}if(/[^ ]/.test(o)){let a=1;const l=t.linePos[1];l&&l.line===n&&l.col>r&&(a=Math.max(1,Math.min(l.col-r,80-i)));const c=" ".repeat(i)+"^".repeat(a);t.message+=`:
|
|
111
111
|
|
|
112
112
|
${o}
|
|
113
113
|
${c}
|
|
114
|
-
`}};function Tt(s,{flow:e,indicator:t,next:n,offset:r,onError:i,startOnNewline:o}){let a=!1,l=o,c=o,
|
|
115
|
-
`))return!0;if(s.end){for(const e of s.end)if(e.type==="newline")return!0}return!1;case"flow-collection":for(const e of s.items){for(const t of e.start)if(t.type==="newline")return!0;if(e.sep){for(const t of e.sep)if(t.type==="newline")return!0}if(zt(e.key)||zt(e.value))return!0}return!1;default:return!0}}function wr(s,e,t){if(e?.type==="flow-collection"){const n=e.end[0];n.indent===s&&(n.source==="]"||n.source==="}")&&zt(e)&&t(n,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}function
|
|
116
|
-
`+p.comment:a.comment=p.comment);continue}(p.hasNewlineAfterProp||zt(
|
|
117
|
-
`+A.comment:S.comment=A.comment);const L=new re(S);t.options.keepSourceTokens&&(L.srcToken=
|
|
114
|
+
`}};function Tt(s,{flow:e,indicator:t,next:n,offset:r,onError:i,startOnNewline:o}){let a=!1,l=o,c=o,f="",u="",h=!1,d=!1,m=!1,p=null,g=null,y=null,S=null,A=null;for(const O of s)switch(m&&(O.type!=="space"&&O.type!=="newline"&&O.type!=="comma"&&i(O.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),m=!1),O.type){case"space":!e&&l&&t!=="doc-start"&&O.source[0]===" "&&i(O,"TAB_AS_INDENT","Tabs are not allowed as indentation"),c=!0;break;case"comment":{c||i(O,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");const I=O.source.substring(1)||" ";f?f+=u+I:f=I,u="",l=!1;break}case"newline":l?f?f+=O.source:a=!0:u+=O.source,l=!0,h=!0,(p||g)&&(d=!0),c=!0;break;case"anchor":p&&i(O,"MULTIPLE_ANCHORS","A node can have at most one anchor"),O.source.endsWith(":")&&i(O.offset+O.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),p=O,A===null&&(A=O.offset),l=!1,c=!1,m=!0;break;case"tag":{g&&i(O,"MULTIPLE_TAGS","A node can have at most one tag"),g=O,A===null&&(A=O.offset),l=!1,c=!1,m=!0;break}case t:(p||g)&&i(O,"BAD_PROP_ORDER",`Anchors and tags must be after the ${O.source} indicator`),S&&i(O,"UNEXPECTED_TOKEN",`Unexpected ${O.source} in ${e??"collection"}`),S=O,l=!1,c=!1;break;case"comma":if(e){y&&i(O,"UNEXPECTED_TOKEN",`Unexpected , in ${e}`),y=O,l=!1,c=!1;break}default:i(O,"UNEXPECTED_TOKEN",`Unexpected ${O.type} token`),l=!1,c=!1}const L=s[s.length-1],R=L?L.offset+L.source.length:r;return m&&n&&n.type!=="space"&&n.type!=="newline"&&n.type!=="comma"&&(n.type!=="scalar"||n.source!=="")&&i(n.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),{comma:y,found:S,spaceBefore:a,comment:f,hasNewline:h,hasNewlineAfterProp:d,anchor:p,tag:g,end:R,start:A??R}}function zt(s){if(!s)return null;switch(s.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(s.source.includes(`
|
|
115
|
+
`))return!0;if(s.end){for(const e of s.end)if(e.type==="newline")return!0}return!1;case"flow-collection":for(const e of s.items){for(const t of e.start)if(t.type==="newline")return!0;if(e.sep){for(const t of e.sep)if(t.type==="newline")return!0}if(zt(e.key)||zt(e.value))return!0}return!1;default:return!0}}function wr(s,e,t){if(e?.type==="flow-collection"){const n=e.end[0];n.indent===s&&(n.source==="]"||n.source==="}")&&zt(e)&&t(n,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}function ma(s,e,t){const{uniqueKeys:n}=s.options;if(n===!1)return!1;const r=typeof n=="function"?n:(i,o)=>i===o||Y(i)&&Y(o)&&i.value===o.value&&!(i.value==="<<"&&s.schema.merge);return e.some(i=>r(i.key,t))}const ya="All mapping items must start at the same column";function mh({composeNode:s,composeEmptyNode:e},t,n,r,i){const o=i?.nodeClass??pe,a=new o(t.schema);t.atRoot&&(t.atRoot=!1);let l=n.offset,c=null;for(const f of n.items){const{start:u,key:h,sep:d,value:m}=f,p=Tt(u,{indicator:"explicit-key-ind",next:h??d?.[0],offset:l,onError:r,startOnNewline:!0}),g=!p.found;if(g){if(h&&(h.type==="block-seq"?r(l,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in h&&h.indent!==n.indent&&r(l,"BAD_INDENT",ya)),!p.anchor&&!p.tag&&!d){c=p.end,p.comment&&(a.comment?a.comment+=`
|
|
116
|
+
`+p.comment:a.comment=p.comment);continue}(p.hasNewlineAfterProp||zt(h))&&r(h??u[u.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else p.found?.indent!==n.indent&&r(l,"BAD_INDENT",ya);const y=p.end,S=h?s(t,h,p,r):e(t,y,u,null,p,r);t.schema.compat&&wr(n.indent,h,r),ma(t,a.items,S)&&r(y,"DUPLICATE_KEY","Map keys must be unique");const A=Tt(d??[],{indicator:"map-value-ind",next:m,offset:S.range[2],onError:r,startOnNewline:!h||h.type==="block-scalar"});if(l=A.end,A.found){g&&(m?.type==="block-map"&&!A.hasNewline&&r(l,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),t.options.strict&&p.start<A.found.offset-1024&&r(S.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));const L=m?s(t,m,A,r):e(t,l,d,null,A,r);t.schema.compat&&wr(n.indent,m,r),l=L.range[2];const R=new re(S,L);t.options.keepSourceTokens&&(R.srcToken=f),a.items.push(R)}else{g&&r(S.range,"MISSING_CHAR","Implicit map keys need to be followed by map values"),A.comment&&(S.comment?S.comment+=`
|
|
117
|
+
`+A.comment:S.comment=A.comment);const L=new re(S);t.options.keepSourceTokens&&(L.srcToken=f),a.items.push(L)}}return c&&c<l&&r(c,"IMPOSSIBLE","Map comment with trailing content"),a.range=[n.offset,l,c??l],a}function yh({composeNode:s,composeEmptyNode:e},t,n,r,i){const o=i?.nodeClass??Ke,a=new o(t.schema);t.atRoot&&(t.atRoot=!1);let l=n.offset,c=null;for(const{start:f,value:u}of n.items){const h=Tt(f,{indicator:"seq-item-ind",next:u,offset:l,onError:r,startOnNewline:!0});if(!h.found)if(h.anchor||h.tag||u)u&&u.type==="block-seq"?r(h.end,"BAD_INDENT","All sequence items must start at the same column"):r(l,"MISSING_CHAR","Sequence item without - indicator");else{c=h.end,h.comment&&(a.comment=h.comment);continue}const d=u?s(t,u,h,r):e(t,h.end,f,null,h,r);t.schema.compat&&wr(n.indent,u,r),l=d.range[2],a.items.push(d)}return a.range=[n.offset,l,c??l],a}function Qt(s,e,t,n){let r="";if(s){let i=!1,o="";for(const a of s){const{source:l,type:c}=a;switch(c){case"space":i=!0;break;case"comment":{t&&!i&&n(a,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");const f=l.substring(1)||" ";r?r+=o+f:r=f,o="";break}case"newline":r&&(o+=l),i=!0;break;default:n(a,"UNEXPECTED_TOKEN",`Unexpected ${c} at node end`)}e+=l.length}}return{comment:r,offset:e}}const Er="Block collections are not allowed within flow collections",Sr=s=>s&&(s.type==="block-map"||s.type==="block-seq");function bh({composeNode:s,composeEmptyNode:e},t,n,r,i){const o=n.start.source==="{",a=o?"flow map":"flow sequence",l=i?.nodeClass??(o?pe:Ke),c=new l(t.schema);c.flow=!0;const f=t.atRoot;f&&(t.atRoot=!1);let u=n.offset+n.start.source.length;for(let g=0;g<n.items.length;++g){const y=n.items[g],{start:S,key:A,sep:L,value:R}=y,O=Tt(S,{flow:a,indicator:"explicit-key-ind",next:A??L?.[0],offset:u,onError:r,startOnNewline:!1});if(!O.found){if(!O.anchor&&!O.tag&&!L&&!R){g===0&&O.comma?r(O.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`):g<n.items.length-1&&r(O.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${a}`),O.comment&&(c.comment?c.comment+=`
|
|
118
118
|
`+O.comment:c.comment=O.comment),u=O.end;continue}!o&&t.options.strict&&zt(A)&&r(A,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(g===0)O.comma&&r(O.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`);else if(O.comma||r(O.start,"MISSING_CHAR",`Missing , between ${a} items`),O.comment){let I="";e:for(const _ of S)switch(_.type){case"comma":case"space":break;case"comment":I=_.source.substring(1);break e;default:break e}if(I){let _=c.items[c.items.length-1];X(_)&&(_=_.value??_.key),_.comment?_.comment+=`
|
|
119
119
|
`+I:_.comment=I,O.comment=O.comment.substring(I.length+1)}}if(!o&&!L&&!O.found){const I=R?s(t,R,O,r):e(t,O.end,L,null,O,r);c.items.push(I),u=I.range[2],Sr(R)&&r(I.range,"BLOCK_IN_FLOW",Er)}else{const I=O.end,_=A?s(t,A,O,r):e(t,I,S,null,O,r);Sr(A)&&r(_.range,"BLOCK_IN_FLOW",Er);const k=Tt(L??[],{flow:a,indicator:"map-value-ind",next:R,offset:_.range[2],onError:r,startOnNewline:!1});if(k.found){if(!o&&!O.found&&t.options.strict){if(L)for(const $ of L){if($===k.found)break;if($.type==="newline"){r($,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}O.start<k.found.offset-1024&&r(k.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else R&&("source"in R&&R.source&&R.source[0]===":"?r(R,"MISSING_CHAR",`Missing space after : in ${a}`):r(k.start,"MISSING_CHAR",`Missing , or : between ${a} items`));const j=R?s(t,R,k,r):k.found?e(t,k.end,L,null,k,r):null;j?Sr(R)&&r(j.range,"BLOCK_IN_FLOW",Er):k.comment&&(_.comment?_.comment+=`
|
|
120
|
-
`+k.comment:_.comment=k.comment);const E=new re(_,j);if(t.options.keepSourceTokens&&(E.srcToken=y),o){const $=c;
|
|
121
|
-
`+g.comment:c.comment=g.comment),c.range=[n.offset,p,g.offset]}else c.range=[n.offset,p,p];return c}function Ar(s,e,t,n,r,i){const o=t.type==="block-map"?mh(s,e,t,n,i):t.type==="block-seq"?yh(s,e,t,n,i):bh(s,e,t,n,i),a=o.constructor;return r==="!"||r===a.tagName?(o.tag=a.tagName,o):(r&&(o.tag=r),o)}function wh(s,e,t,n,r){const i=n?e.directives.tagName(n.source,u=>r(n,"TAG_RESOLVE_FAILED",u)):null,o=t.type==="block-map"?"map":t.type==="block-seq"?"seq":t.start.source==="{"?"map":"seq";if(!n||!i||i==="!"||i===pe.tagName&&o==="map"||i===Ke.tagName&&o==="seq"||!o)return Ar(s,e,t,r,i);let a=e.schema.tags.find(u=>u.tag===i&&u.collection===o);if(!a){const u=e.schema.knownTags[i];if(u&&u.collection===o)e.schema.tags.push(Object.assign({},u,{default:!1})),a=u;else return u?.collection?r(n,"BAD_COLLECTION_TYPE",`${u.tag} used for ${o} collection, but expects ${u.collection}`,!0):r(n,"TAG_RESOLVE_FAILED",`Unresolved tag: ${i}`,!0),Ar(s,e,t,r,i)}const l=Ar(s,e,t,r,i,a),c=a.resolve?.(l,u=>r(n,"TAG_RESOLVE_FAILED",u),e.options)??l,
|
|
122
|
-
`.repeat(Math.max(1,o.length-1)):"";let g=n+r.length;return s.source&&(g+=s.source.length),{value:p,type:i,comment:r.comment,range:[n,g,g]}}let l=s.indent+r.indent,c=s.offset+r.length,
|
|
123
|
-
`;for(let p=
|
|
124
|
-
`):g.length>l||y[0]===" "?(
|
|
125
|
-
`:!d&&
|
|
126
|
-
`&&(
|
|
120
|
+
`+k.comment:_.comment=k.comment);const E=new re(_,j);if(t.options.keepSourceTokens&&(E.srcToken=y),o){const $=c;ma(t,$.items,_)&&r(I,"DUPLICATE_KEY","Map keys must be unique"),$.items.push(E)}else{const $=new pe(t.schema);$.flow=!0,$.items.push(E),c.items.push($)}u=j?j.range[2]:k.end}}const h=o?"}":"]",[d,...m]=n.end;let p=u;if(d&&d.source===h)p=d.offset+d.source.length;else{const g=a[0].toUpperCase()+a.substring(1),y=f?`${g} must end with a ${h}`:`${g} in block collection must be sufficiently indented and end with a ${h}`;r(u,f?"MISSING_CHAR":"BAD_INDENT",y),d&&d.source.length!==1&&m.unshift(d)}if(m.length>0){const g=Qt(m,p,t.options.strict,r);g.comment&&(c.comment?c.comment+=`
|
|
121
|
+
`+g.comment:c.comment=g.comment),c.range=[n.offset,p,g.offset]}else c.range=[n.offset,p,p];return c}function Ar(s,e,t,n,r,i){const o=t.type==="block-map"?mh(s,e,t,n,i):t.type==="block-seq"?yh(s,e,t,n,i):bh(s,e,t,n,i),a=o.constructor;return r==="!"||r===a.tagName?(o.tag=a.tagName,o):(r&&(o.tag=r),o)}function wh(s,e,t,n,r){const i=n?e.directives.tagName(n.source,u=>r(n,"TAG_RESOLVE_FAILED",u)):null,o=t.type==="block-map"?"map":t.type==="block-seq"?"seq":t.start.source==="{"?"map":"seq";if(!n||!i||i==="!"||i===pe.tagName&&o==="map"||i===Ke.tagName&&o==="seq"||!o)return Ar(s,e,t,r,i);let a=e.schema.tags.find(u=>u.tag===i&&u.collection===o);if(!a){const u=e.schema.knownTags[i];if(u&&u.collection===o)e.schema.tags.push(Object.assign({},u,{default:!1})),a=u;else return u?.collection?r(n,"BAD_COLLECTION_TYPE",`${u.tag} used for ${o} collection, but expects ${u.collection}`,!0):r(n,"TAG_RESOLVE_FAILED",`Unresolved tag: ${i}`,!0),Ar(s,e,t,r,i)}const l=Ar(s,e,t,r,i,a),c=a.resolve?.(l,u=>r(n,"TAG_RESOLVE_FAILED",u),e.options)??l,f=te(c)?c:new N(c);return f.range=l.range,f.tag=i,a?.format&&(f.format=a.format),f}function ba(s,e,t){const n=s.offset,r=Eh(s,e,t);if(!r)return{value:"",type:null,comment:"",range:[n,n,n]};const i=r.mode===">"?N.BLOCK_FOLDED:N.BLOCK_LITERAL,o=s.source?Sh(s.source):[];let a=o.length;for(let p=o.length-1;p>=0;--p){const g=o[p][1];if(g===""||g==="\r")a=p;else break}if(a===0){const p=r.chomp==="+"&&o.length>0?`
|
|
122
|
+
`.repeat(Math.max(1,o.length-1)):"";let g=n+r.length;return s.source&&(g+=s.source.length),{value:p,type:i,comment:r.comment,range:[n,g,g]}}let l=s.indent+r.indent,c=s.offset+r.length,f=0;for(let p=0;p<a;++p){const[g,y]=o[p];if(y===""||y==="\r")r.indent===0&&g.length>l&&(l=g.length);else{if(g.length<l){const S="Block scalars with more-indented leading empty lines must use an explicit indentation indicator";t(c+g.length,"MISSING_CHAR",S)}r.indent===0&&(l=g.length),f=p;break}c+=g.length+y.length+1}for(let p=o.length-1;p>=a;--p)o[p][0].length>l&&(a=p+1);let u="",h="",d=!1;for(let p=0;p<f;++p)u+=o[p][0].slice(l)+`
|
|
123
|
+
`;for(let p=f;p<a;++p){let[g,y]=o[p];c+=g.length+y.length+1;const S=y[y.length-1]==="\r";if(S&&(y=y.slice(0,-1)),y&&g.length<l){const L=`Block scalar lines must not be less indented than their ${r.indent?"explicit indentation indicator":"first line"}`;t(c-y.length-(S?2:1),"BAD_INDENT",L),g=""}i===N.BLOCK_LITERAL?(u+=h+g.slice(l)+y,h=`
|
|
124
|
+
`):g.length>l||y[0]===" "?(h===" "?h=`
|
|
125
|
+
`:!d&&h===`
|
|
126
|
+
`&&(h=`
|
|
127
127
|
|
|
128
|
-
`),u+=
|
|
129
|
-
`,d=!0):y===""?
|
|
128
|
+
`),u+=h+g.slice(l)+y,h=`
|
|
129
|
+
`,d=!0):y===""?h===`
|
|
130
130
|
`?u+=`
|
|
131
|
-
`:
|
|
132
|
-
`:(u+=
|
|
131
|
+
`:h=`
|
|
132
|
+
`:(u+=h+y,h=" ",d=!1)}switch(r.chomp){case"-":break;case"+":for(let p=a;p<o.length;++p)u+=`
|
|
133
133
|
`+o[p][0].slice(l);u[u.length-1]!==`
|
|
134
134
|
`&&(u+=`
|
|
135
135
|
`);break;default:u+=`
|
|
136
|
-
`}const m=n+r.length+s.source.length;return{value:u,type:i,comment:r.comment,range:[n,m,m]}}function Eh({offset:s,props:e},t,n){if(e[0].type!=="block-scalar-header")return n(e[0],"IMPOSSIBLE","Block scalar header not found"),null;const{source:r}=e[0],i=r[0];let o=0,a="",l=-1;for(let
|
|
136
|
+
`}const m=n+r.length+s.source.length;return{value:u,type:i,comment:r.comment,range:[n,m,m]}}function Eh({offset:s,props:e},t,n){if(e[0].type!=="block-scalar-header")return n(e[0],"IMPOSSIBLE","Block scalar header not found"),null;const{source:r}=e[0],i=r[0];let o=0,a="",l=-1;for(let h=1;h<r.length;++h){const d=r[h];if(!a&&(d==="-"||d==="+"))a=d;else{const m=Number(d);!o&&m?o=m:l===-1&&(l=s+h)}}l!==-1&&n(l,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${r}`);let c=!1,f="",u=r.length;for(let h=1;h<e.length;++h){const d=e[h];switch(d.type){case"space":c=!0;case"newline":u+=d.source.length;break;case"comment":t&&!c&&n(d,"MISSING_CHAR","Comments must be separated from other tokens by white space characters"),u+=d.source.length,f=d.source.substring(1);break;case"error":n(d,"UNEXPECTED_TOKEN",d.message),u+=d.source.length;break;default:{const m=`Unexpected token in block scalar header: ${d.type}`;n(d,"UNEXPECTED_TOKEN",m);const p=d.source;p&&typeof p=="string"&&(u+=p.length)}}}return{mode:i,indent:o,chomp:a,comment:f,length:u}}function Sh(s){const e=s.split(/\n( *)/),t=e[0],n=t.match(/^( *)/),i=[n?.[1]?[n[1],t.slice(n[1].length)]:["",t]];for(let o=1;o<e.length;o+=2)i.push([e[o],e[o+1]]);return i}function wa(s,e,t){const{offset:n,type:r,source:i,end:o}=s;let a,l;const c=(h,d,m)=>t(n+h,d,m);switch(r){case"scalar":a=N.PLAIN,l=Ah(i,c);break;case"single-quoted-scalar":a=N.QUOTE_SINGLE,l=Oh(i,c);break;case"double-quoted-scalar":a=N.QUOTE_DOUBLE,l=Ch(i,c);break;default:return t(s,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${r}`),{value:"",type:null,comment:"",range:[n,n+i.length,n+i.length]}}const f=n+i.length,u=Qt(o,f,e,t);return{value:l,type:a,comment:u.comment,range:[n,f,u.offset]}}function Ah(s,e){let t="";switch(s[0]){case" ":t="a tab character";break;case",":t="flow indicator character ,";break;case"%":t="directive indicator character %";break;case"|":case">":{t=`block scalar indicator ${s[0]}`;break}case"@":case"`":{t=`reserved character ${s[0]}`;break}}return t&&e(0,"BAD_SCALAR_START",`Plain value cannot start with ${t}`),Ea(s)}function Oh(s,e){return(s[s.length-1]!=="'"||s.length===1)&&e(s.length,"MISSING_CHAR","Missing closing 'quote"),Ea(s.slice(1,-1)).replace(/''/g,"'")}function Ea(s){let e,t;try{e=new RegExp(`(.*?)(?<![ ])[ ]*\r?
|
|
137
137
|
`,"sy"),t=new RegExp(`[ ]*(.*?)(?:(?<![ ])[ ]*)?\r?
|
|
138
138
|
`,"sy")}catch{e=/(.*?)[ \t]*\r?\n/sy,t=/[ \t]*(.*?)[ \t]*\r?\n/sy}let n=e.exec(s);if(!n)return s;let r=n[1],i=" ",o=e.lastIndex;for(t.lastIndex=o;n=t.exec(s);)n[1]===""?i===`
|
|
139
139
|
`?r+=i:i=`
|
|
@@ -148,26 +148,26 @@ ${c}
|
|
|
148
148
|
`);)n===`
|
|
149
149
|
`&&(t+=`
|
|
150
150
|
`),e+=1,n=s[e+1];return t||(t=" "),{fold:t,offset:e}}const Th={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:`
|
|
151
|
-
`,r:"\r",t:" ",v:"\v",N:"\x85",_:"\xA0",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function _h(s,e,t,n){const r=s.substr(e,t),o=r.length===t&&/^[0-9a-fA-F]+$/.test(r)?parseInt(r,16):NaN;if(isNaN(o)){const a=s.substr(e-2,t+2);return n(e-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),a}return String.fromCodePoint(o)}function
|
|
151
|
+
`,r:"\r",t:" ",v:"\v",N:"\x85",_:"\xA0",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function _h(s,e,t,n){const r=s.substr(e,t),o=r.length===t&&/^[0-9a-fA-F]+$/.test(r)?parseInt(r,16):NaN;if(isNaN(o)){const a=s.substr(e-2,t+2);return n(e-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),a}return String.fromCodePoint(o)}function Sa(s,e,t,n){const{value:r,type:i,comment:o,range:a}=e.type==="block-scalar"?ba(e,s.options.strict,n):wa(e,s.options.strict,n),l=t?s.directives.tagName(t.source,u=>n(t,"TAG_RESOLVE_FAILED",u)):null,c=t&&l?vh(s.schema,r,l,t,n):e.type==="scalar"?Lh(s,r,e,n):s.schema[Ne];let f;try{const u=c.resolve(r,h=>n(t??e,"TAG_RESOLVE_FAILED",h),s.options);f=Y(u)?u:new N(u)}catch(u){const h=u instanceof Error?u.message:String(u);n(t??e,"TAG_RESOLVE_FAILED",h),f=new N(r)}return f.range=a,f.source=r,i&&(f.type=i),l&&(f.tag=l),c.format&&(f.format=c.format),o&&(f.comment=o),f}function vh(s,e,t,n,r){if(t==="!")return s[Ne];const i=[];for(const a of s.tags)if(!a.collection&&a.tag===t)if(a.default&&a.test)i.push(a);else return a;for(const a of i)if(a.test?.test(e))return a;const o=s.knownTags[t];return o&&!o.collection?(s.tags.push(Object.assign({},o,{default:!1,test:void 0})),o):(r(n,"TAG_RESOLVE_FAILED",`Unresolved tag: ${t}`,t!=="tag:yaml.org,2002:str"),s[Ne])}function Lh({directives:s,schema:e},t,n,r){const i=e.tags.find(o=>o.default&&o.test?.test(t))||e[Ne];if(e.compat){const o=e.compat.find(a=>a.default&&a.test?.test(t))??e[Ne];if(i.tag!==o.tag){const a=s.tagString(i.tag),l=s.tagString(o.tag),c=`Value may be parsed as either ${a} or ${l}`;r(n,"TAG_RESOLVE_FAILED",c,!0)}}return i}function kh(s,e,t){if(e){t===null&&(t=e.length);for(let n=t-1;n>=0;--n){let r=e[n];switch(r.type){case"space":case"comment":case"newline":s-=r.source.length;continue}for(r=e[++n];r?.type==="space";)s+=r.source.length,r=e[++n];break}}return s}const $h={composeNode:Aa,composeEmptyNode:Or};function Aa(s,e,t,n){const{spaceBefore:r,comment:i,anchor:o,tag:a}=t;let l,c=!0;switch(e.type){case"alias":l=Ih(s,e,n),(o||a)&&n(e,"ALIAS_PROPS","An alias node must not specify any properties");break;case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"block-scalar":l=Sa(s,e,a,n),o&&(l.anchor=o.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":l=wh($h,s,e,a,n),o&&(l.anchor=o.source.substring(1));break;default:{const f=e.type==="error"?e.message:`Unsupported token (type: ${e.type})`;n(e,"UNEXPECTED_TOKEN",f),l=Or(s,e.offset,void 0,null,t,n),c=!1}}return o&&l.anchor===""&&n(o,"BAD_ALIAS","Anchor cannot be an empty string"),r&&(l.spaceBefore=!0),i&&(e.type==="scalar"&&e.source===""?l.comment=i:l.commentBefore=i),s.options.keepSourceTokens&&c&&(l.srcToken=e),l}function Or(s,e,t,n,{spaceBefore:r,comment:i,anchor:o,tag:a,end:l},c){const f={type:"scalar",offset:kh(e,t,n),indent:-1,source:""},u=Sa(s,f,a,c);return o&&(u.anchor=o.source.substring(1),u.anchor===""&&c(o,"BAD_ALIAS","Anchor cannot be an empty string")),r&&(u.spaceBefore=!0),i&&(u.comment=i,u.range[2]=l),u}function Ih({options:s},{offset:e,source:t,end:n},r){const i=new Ns(t.substring(1));i.source===""&&r(e,"BAD_ALIAS","Alias cannot be an empty string"),i.source.endsWith(":")&&r(e+t.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);const o=e+t.length,a=Qt(n,o,s.strict,r);return i.range=[e,o,a.offset],a.comment&&(i.comment=a.comment),i}function Nh(s,e,{offset:t,start:n,value:r,end:i},o){const a=Object.assign({_directives:e},s),l=new $t(void 0,a),c={atRoot:!0,directives:l.directives,options:l.options,schema:l.schema},f=Tt(n,{indicator:"doc-start",next:r??i?.[0],offset:t,onError:o,startOnNewline:!0});f.found&&(l.directives.docStart=!0,r&&(r.type==="block-map"||r.type==="block-seq")&&!f.hasNewline&&o(f.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),l.contents=r?Aa(c,r,f,o):Or(c,f.end,n,null,f,o);const u=l.contents.range[2],h=Qt(i,u,!1,o);return h.comment&&(l.comment=h.comment),l.range=[t,u,h.offset],l}function Xt(s){if(typeof s=="number")return[s,s+1];if(Array.isArray(s))return s.length===2?s:[s[0],s[1]];const{offset:e,source:t}=s;return[e,e+(typeof t=="string"?t.length:1)]}function Oa(s){let e="",t=!1,n=!1;for(let r=0;r<s.length;++r){const i=s[r];switch(i[0]){case"#":e+=(e===""?"":n?`
|
|
152
152
|
|
|
153
153
|
`:`
|
|
154
|
-
`)+(i.substring(1)||" "),t=!0,n=!1;break;case"%":s[r+1]?.[0]!=="#"&&(r+=1),t=!1;break;default:t||(n=!0),t=!1}}return{comment:e,afterEmptyLine:n}}class Cr{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(t,n,r,i)=>{const o=Xt(t);i?this.warnings.push(new
|
|
154
|
+
`)+(i.substring(1)||" "),t=!0,n=!1;break;case"%":s[r+1]?.[0]!=="#"&&(r+=1),t=!1;break;default:t||(n=!0),t=!1}}return{comment:e,afterEmptyLine:n}}class Cr{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(t,n,r,i)=>{const o=Xt(t);i?this.warnings.push(new ga(o,n,r)):this.errors.push(new Je(o,n,r))},this.directives=new ae({version:e.version||"1.2"}),this.options=e}decorate(e,t){const{comment:n,afterEmptyLine:r}=Oa(this.prelude);if(n){const i=e.contents;if(t)e.comment=e.comment?`${e.comment}
|
|
155
155
|
${n}`:n;else if(r||e.directives.docStart||!i)e.commentBefore=n;else if(Z(i)&&!i.flow&&i.items.length>0){let o=i.items[0];X(o)&&(o=o.key);const a=o.commentBefore;o.commentBefore=a?`${n}
|
|
156
156
|
${a}`:n}else{const o=i.commentBefore;i.commentBefore=o?`${n}
|
|
157
|
-
${o}`:n}}t?(Array.prototype.push.apply(e.errors,this.errors),Array.prototype.push.apply(e.warnings,this.warnings)):(e.errors=this.errors,e.warnings=this.warnings),this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:
|
|
158
|
-
${t.comment}`:t.comment}this.doc.range[2]=t.offset;break}default:this.errors.push(new Je(Xt(e),"UNEXPECTED_TOKEN",`Unsupported token ${e.type}`))}}*end(e=!1,t=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(e){const n=Object.assign({_directives:this.directives},this.options),r=new $t(void 0,n);this.atDirectives&&this.onError(t,"MISSING_CHAR","Missing directives-end indicator line"),r.range=[0,t,t],this.decorate(r,!1),yield r}}}function Ph(s,e=!0,t){if(s){const n=(r,i,o)=>{const a=typeof r=="number"?r:Array.isArray(r)?r[0]:r.offset;if(t)t(a,i,o);else throw new Je([a,a+1],i,o)};switch(s.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return
|
|
157
|
+
${o}`:n}}t?(Array.prototype.push.apply(e.errors,this.errors),Array.prototype.push.apply(e.warnings,this.warnings)):(e.errors=this.errors,e.warnings=this.warnings),this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:Oa(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(e,t=!1,n=-1){for(const r of e)yield*this.next(r);yield*this.end(t,n)}*next(e){switch(e.type){case"directive":this.directives.add(e.source,(t,n,r)=>{const i=Xt(e);i[0]+=t,this.onError(i,"BAD_DIRECTIVE",n,r)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{const t=Nh(this.options,this.directives,e,this.onError);this.atDirectives&&!t.directives.docStart&&this.onError(e,"MISSING_CHAR","Missing directives-end/doc-start indicator line"),this.decorate(t,!1),this.doc&&(yield this.doc),this.doc=t,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(e.source);break;case"error":{const t=e.source?`${e.message}: ${JSON.stringify(e.source)}`:e.message,n=new Je(Xt(e),"UNEXPECTED_TOKEN",t);this.atDirectives||!this.doc?this.errors.push(n):this.doc.errors.push(n);break}case"doc-end":{if(!this.doc){const n="Unexpected doc-end without preceding document";this.errors.push(new Je(Xt(e),"UNEXPECTED_TOKEN",n));break}this.doc.directives.docEnd=!0;const t=Qt(e.end,e.offset+e.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),t.comment){const n=this.doc.comment;this.doc.comment=n?`${n}
|
|
158
|
+
${t.comment}`:t.comment}this.doc.range[2]=t.offset;break}default:this.errors.push(new Je(Xt(e),"UNEXPECTED_TOKEN",`Unsupported token ${e.type}`))}}*end(e=!1,t=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(e){const n=Object.assign({_directives:this.directives},this.options),r=new $t(void 0,n);this.atDirectives&&this.onError(t,"MISSING_CHAR","Missing directives-end indicator line"),r.range=[0,t,t],this.decorate(r,!1),yield r}}}function Ph(s,e=!0,t){if(s){const n=(r,i,o)=>{const a=typeof r=="number"?r:Array.isArray(r)?r[0]:r.offset;if(t)t(a,i,o);else throw new Je([a,a+1],i,o)};switch(s.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return wa(s,e,n);case"block-scalar":return ba(s,e,n)}}return null}function Bh(s,e){const{implicitKey:t=!1,indent:n,inFlow:r=!1,offset:i=-1,type:o="PLAIN"}=e,a=Yt({type:o,value:s},{implicitKey:t,indent:n>0?" ".repeat(n):"",inFlow:r,options:{blockQuote:!0,lineWidth:-1}}),l=e.end??[{type:"newline",offset:-1,indent:n,source:`
|
|
159
159
|
`}];switch(a[0]){case"|":case">":{const c=a.indexOf(`
|
|
160
|
-
`),
|
|
161
|
-
`,
|
|
162
|
-
`}),{type:"block-scalar",offset:i,indent:n,props:
|
|
160
|
+
`),f=a.substring(0,c),u=a.substring(c+1)+`
|
|
161
|
+
`,h=[{type:"block-scalar-header",offset:i,indent:n,source:f}];return Ca(h,l)||h.push({type:"newline",offset:-1,indent:n,source:`
|
|
162
|
+
`}),{type:"block-scalar",offset:i,indent:n,props:h,source:u}}case'"':return{type:"double-quoted-scalar",offset:i,indent:n,source:a,end:l};case"'":return{type:"single-quoted-scalar",offset:i,indent:n,source:a,end:l};default:return{type:"scalar",offset:i,indent:n,source:a,end:l}}}function Mh(s,e,t={}){let{afterKey:n=!1,implicitKey:r=!1,inFlow:i=!1,type:o}=t,a="indent"in s?s.indent:null;if(n&&typeof a=="number"&&(a+=2),!o)switch(s.type){case"single-quoted-scalar":o="QUOTE_SINGLE";break;case"double-quoted-scalar":o="QUOTE_DOUBLE";break;case"block-scalar":{const c=s.props[0];if(c.type!=="block-scalar-header")throw new Error("Invalid block scalar header");o=c.source[0]===">"?"BLOCK_FOLDED":"BLOCK_LITERAL";break}default:o="PLAIN"}const l=Yt({type:o,value:e},{implicitKey:r||a===null,indent:a!==null&&a>0?" ".repeat(a):"",inFlow:i,options:{blockQuote:!0,lineWidth:-1}});switch(l[0]){case"|":case">":Fh(s,l);break;case'"':Rr(s,l,"double-quoted-scalar");break;case"'":Rr(s,l,"single-quoted-scalar");break;default:Rr(s,l,"scalar")}}function Fh(s,e){const t=e.indexOf(`
|
|
163
163
|
`),n=e.substring(0,t),r=e.substring(t+1)+`
|
|
164
|
-
`;if(s.type==="block-scalar"){const i=s.props[0];if(i.type!=="block-scalar-header")throw new Error("Invalid block scalar header");i.source=n,s.source=r}else{const{offset:i}=s,o="indent"in s?s.indent:-1,a=[{type:"block-scalar-header",offset:i,indent:o,source:n}];
|
|
165
|
-
`});for(const l of Object.keys(s))l!=="type"&&l!=="offset"&&delete s[l];Object.assign(s,{type:"block-scalar",indent:o,props:a,source:r})}}function
|
|
166
|
-
`};delete s.items,Object.assign(s,{type:t,source:e,end:[r]});break}default:{const n="indent"in s?s.indent:-1,r="end"in s&&Array.isArray(s.end)?s.end.filter(i=>i.type==="space"||i.type==="comment"||i.type==="newline"):[];for(const i of Object.keys(s))i!=="type"&&i!=="offset"&&delete s[i];Object.assign(s,{type:t,indent:n,source:e,end:r})}}}const
|
|
164
|
+
`;if(s.type==="block-scalar"){const i=s.props[0];if(i.type!=="block-scalar-header")throw new Error("Invalid block scalar header");i.source=n,s.source=r}else{const{offset:i}=s,o="indent"in s?s.indent:-1,a=[{type:"block-scalar-header",offset:i,indent:o,source:n}];Ca(a,"end"in s?s.end:void 0)||a.push({type:"newline",offset:-1,indent:o,source:`
|
|
165
|
+
`});for(const l of Object.keys(s))l!=="type"&&l!=="offset"&&delete s[l];Object.assign(s,{type:"block-scalar",indent:o,props:a,source:r})}}function Ca(s,e){if(e)for(const t of e)switch(t.type){case"space":case"comment":s.push(t);break;case"newline":return s.push(t),!0}return!1}function Rr(s,e,t){switch(s.type){case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":s.type=t,s.source=e;break;case"block-scalar":{const n=s.props.slice(1);let r=e.length;s.props[0].type==="block-scalar-header"&&(r-=s.props[0].source.length);for(const i of n)i.offset+=r;delete s.props,Object.assign(s,{type:t,source:e,end:n});break}case"block-map":case"block-seq":{const r={type:"newline",offset:s.offset+e.length,indent:s.indent,source:`
|
|
166
|
+
`};delete s.items,Object.assign(s,{type:t,source:e,end:[r]});break}default:{const n="indent"in s?s.indent:-1,r="end"in s&&Array.isArray(s.end)?s.end.filter(i=>i.type==="space"||i.type==="comment"||i.type==="newline"):[];for(const i of Object.keys(s))i!=="type"&&i!=="offset"&&delete s[i];Object.assign(s,{type:t,indent:n,source:e,end:r})}}}const Dh=s=>"type"in s?Xs(s):Js(s);function Xs(s){switch(s.type){case"block-scalar":{let e="";for(const t of s.props)e+=Xs(t);return e+s.source}case"block-map":case"block-seq":{let e="";for(const t of s.items)e+=Js(t);return e}case"flow-collection":{let e=s.start.source;for(const t of s.items)e+=Js(t);for(const t of s.end)e+=t.source;return e}case"document":{let e=Js(s);if(s.end)for(const t of s.end)e+=t.source;return e}default:{let e=s.source;if("end"in s&&s.end)for(const t of s.end)e+=t.source;return e}}}function Js({start:s,key:e,sep:t,value:n}){let r="";for(const i of s)r+=i.source;if(e&&(r+=Xs(e)),t)for(const i of t)r+=i.source;return n&&(r+=Xs(n)),r}const Tr=Symbol("break visit"),xh=Symbol("skip children"),Ra=Symbol("remove item");function Ze(s,e){"type"in s&&s.type==="document"&&(s={start:s.start,value:s.value}),Ta(Object.freeze([]),s,e)}Ze.BREAK=Tr,Ze.SKIP=xh,Ze.REMOVE=Ra,Ze.itemAtPath=(s,e)=>{let t=s;for(const[n,r]of e){const i=t?.[n];if(i&&"items"in i)t=i.items[r];else return}return t},Ze.parentCollection=(s,e)=>{const t=Ze.itemAtPath(s,e.slice(0,-1)),n=e[e.length-1][0],r=t?.[n];if(r&&"items"in r)return r;throw new Error("Parent collection not found")};function Ta(s,e,t){let n=t(e,s);if(typeof n=="symbol")return n;for(const r of["key","value"]){const i=e[r];if(i&&"items"in i){for(let o=0;o<i.items.length;++o){const a=Ta(Object.freeze(s.concat([[r,o]])),i.items[o],t);if(typeof a=="number")o=a-1;else{if(a===Tr)return Tr;a===Ra&&(i.items.splice(o,1),o-=1)}}typeof n=="function"&&r==="key"&&(n=n(e,s))}}return typeof n=="function"?n(e,s):n}const Zs="\uFEFF",en="",tn="",Jt="",Hh=s=>!!s&&"items"in s,Uh=s=>!!s&&(s.type==="scalar"||s.type==="single-quoted-scalar"||s.type==="double-quoted-scalar"||s.type==="block-scalar");function jh(s){switch(s){case Zs:return"<BOM>";case en:return"<DOC>";case tn:return"<FLOW_END>";case Jt:return"<SCALAR>";default:return JSON.stringify(s)}}function _a(s){switch(s){case Zs:return"byte-order-mark";case en:return"doc-mode";case tn:return"flow-error-end";case Jt:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case`
|
|
167
167
|
`:case`\r
|
|
168
|
-
`:return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch(s[0]){case" ":case" ":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}const Kh={__proto__:null,BOM:Zs,DOCUMENT:en,FLOW_END:tn,SCALAR:Jt,createScalarToken:Bh,isCollection:Hh,isScalar:Uh,prettyToken:jh,resolveAsScalar:Ph,setScalarValue:Mh,stringify:
|
|
169
|
-
`:case"\r":case" ":return!0;default:return!1}}const
|
|
170
|
-
\r `.split(""),vr=s=>!s||qh.includes(s);class
|
|
168
|
+
`:return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch(s[0]){case" ":case" ":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}const Kh={__proto__:null,BOM:Zs,DOCUMENT:en,FLOW_END:tn,SCALAR:Jt,createScalarToken:Bh,isCollection:Hh,isScalar:Uh,prettyToken:jh,resolveAsScalar:Ph,setScalarValue:Mh,stringify:Dh,tokenType:_a,visit:Ze};function be(s){switch(s){case void 0:case" ":case`
|
|
169
|
+
`:case"\r":case" ":return!0;default:return!1}}const va="0123456789ABCDEFabcdef".split(""),Gh="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()".split(""),_r=",[]{}".split(""),qh=` ,[]{}
|
|
170
|
+
\r `.split(""),vr=s=>!s||qh.includes(s);class La{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer="",this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(e,t=!1){e&&(this.buffer=this.buffer?this.buffer+e:e,this.lineEndPos=null),this.atEnd=!t;let n=this.next??"stream";for(;n&&(t||this.hasChars(1));)n=yield*this.parseNext(n)}atLineEnd(){let e=this.pos,t=this.buffer[e];for(;t===" "||t===" ";)t=this.buffer[++e];return!t||t==="#"||t===`
|
|
171
171
|
`?!0:t==="\r"?this.buffer[e+1]===`
|
|
172
172
|
`:!1}charAt(e){return this.buffer[this.pos+e]}continueScalar(e){let t=this.buffer[e];if(this.indentNext>0){let n=0;for(;t===" ";)t=this.buffer[++n+e];if(t==="\r"){const r=this.buffer[n+e+1];if(r===`
|
|
173
173
|
`||!r&&!this.atEnd)return e+n+1}return t===`
|
|
@@ -181,17 +181,17 @@ ${t.comment}`:t.comment}this.doc.range[2]=t.offset;break}default:this.errors.pus
|
|
|
181
181
|
`&&r>=this.pos&&r+1+t>o)e=r;else break}while(!0);return yield Jt,yield*this.pushToIndex(e+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){const e=this.flowLevel>0;let t=this.pos-1,n=this.pos-1,r;for(;r=this.buffer[++n];)if(r===":"){const i=this.buffer[n+1];if(be(i)||e&&i===",")break;t=n}else if(be(r)){let i=this.buffer[n+1];if(r==="\r"&&(i===`
|
|
182
182
|
`?(n+=1,r=`
|
|
183
183
|
`,i=this.buffer[n+1]):t=n),i==="#"||e&&_r.includes(i))break;if(r===`
|
|
184
|
-
`){const o=this.continueScalar(n+1);if(o===-1)break;n=Math.max(n,o-2)}}else{if(e&&_r.includes(r))break;t=n}return!r&&!this.atEnd?this.setNext("plain-scalar"):(yield Jt,yield*this.pushToIndex(t+1,!0),e?"flow":"doc")}*pushCount(e){return e>0?(yield this.buffer.substr(this.pos,e),this.pos+=e,e):0}*pushToIndex(e,t){const n=this.buffer.slice(this.pos,e);return n?(yield n,this.pos+=n.length,n.length):(t&&(yield""),0)}*pushIndicators(){switch(this.charAt(0)){case"!":return(yield*this.pushTag())+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators());case"&":return(yield*this.pushUntil(vr))+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators());case"-":case"?":case":":{const e=this.flowLevel>0,t=this.charAt(1);if(be(t)||e&&_r.includes(t))return e?this.flowKey&&(this.flowKey=!1):this.indentNext=this.indentValue+1,(yield*this.pushCount(1))+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators())}}return 0}*pushTag(){if(this.charAt(1)==="<"){let e=this.pos+2,t=this.buffer[e];for(;!be(t)&&t!==">";)t=this.buffer[++e];return yield*this.pushToIndex(t===">"?e+1:e,!1)}else{let e=this.pos+1,t=this.buffer[e];for(;t;)if(Gh.includes(t))t=this.buffer[++e];else if(t==="%"&&
|
|
184
|
+
`){const o=this.continueScalar(n+1);if(o===-1)break;n=Math.max(n,o-2)}}else{if(e&&_r.includes(r))break;t=n}return!r&&!this.atEnd?this.setNext("plain-scalar"):(yield Jt,yield*this.pushToIndex(t+1,!0),e?"flow":"doc")}*pushCount(e){return e>0?(yield this.buffer.substr(this.pos,e),this.pos+=e,e):0}*pushToIndex(e,t){const n=this.buffer.slice(this.pos,e);return n?(yield n,this.pos+=n.length,n.length):(t&&(yield""),0)}*pushIndicators(){switch(this.charAt(0)){case"!":return(yield*this.pushTag())+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators());case"&":return(yield*this.pushUntil(vr))+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators());case"-":case"?":case":":{const e=this.flowLevel>0,t=this.charAt(1);if(be(t)||e&&_r.includes(t))return e?this.flowKey&&(this.flowKey=!1):this.indentNext=this.indentValue+1,(yield*this.pushCount(1))+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators())}}return 0}*pushTag(){if(this.charAt(1)==="<"){let e=this.pos+2,t=this.buffer[e];for(;!be(t)&&t!==">";)t=this.buffer[++e];return yield*this.pushToIndex(t===">"?e+1:e,!1)}else{let e=this.pos+1,t=this.buffer[e];for(;t;)if(Gh.includes(t))t=this.buffer[++e];else if(t==="%"&&va.includes(this.buffer[e+1])&&va.includes(this.buffer[e+2]))t=this.buffer[e+=3];else break;return yield*this.pushToIndex(e,!1)}}*pushNewline(){const e=this.buffer[this.pos];return e===`
|
|
185
185
|
`?yield*this.pushCount(1):e==="\r"&&this.charAt(1)===`
|
|
186
|
-
`?yield*this.pushCount(2):0}*pushSpaces(e){let t=this.pos-1,n;do n=this.buffer[++t];while(n===" "||e&&n===" ");const r=t-this.pos;return r>0&&(yield this.buffer.substr(this.pos,r),this.pos=t),r}*pushUntil(e){let t=this.pos,n=this.buffer[t];for(;!e(n);)n=this.buffer[++t];return yield*this.pushToIndex(t,!1)}}class
|
|
186
|
+
`?yield*this.pushCount(2):0}*pushSpaces(e){let t=this.pos-1,n;do n=this.buffer[++t];while(n===" "||e&&n===" ");const r=t-this.pos;return r>0&&(yield this.buffer.substr(this.pos,r),this.pos=t),r}*pushUntil(e){let t=this.pos,n=this.buffer[t];for(;!e(n);)n=this.buffer[++t];return yield*this.pushToIndex(t,!1)}}class ka{constructor(){this.lineStarts=[],this.addNewLine=e=>this.lineStarts.push(e),this.linePos=e=>{let t=0,n=this.lineStarts.length;for(;t<n;){const i=t+n>>1;this.lineStarts[i]<e?t=i+1:n=i}if(this.lineStarts[t]===e)return{line:t+1,col:1};if(t===0)return{line:0,col:e};const r=this.lineStarts[t-1];return{line:t,col:e-r+1}}}}function Se(s,e){for(let t=0;t<s.length;++t)if(s[t].type===e)return!0;return!1}function $a(s){for(let e=0;e<s.length;++e)switch(s[e].type){case"space":case"comment":case"newline":break;default:return e}return-1}function Ia(s){switch(s?.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"flow-collection":return!0;default:return!1}}function sn(s){switch(s.type){case"document":return s.start;case"block-map":{const e=s.items[s.items.length-1];return e.sep??e.start}case"block-seq":return s.items[s.items.length-1].start;default:return[]}}function _t(s){if(s.length===0)return[];let e=s.length;e:for(;--e>=0;)switch(s[e].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break e}for(;s[++e]?.type==="space";);return s.splice(e,s.length)}function Na(s){if(s.start.type==="flow-seq-start")for(const e of s.items)e.sep&&!e.value&&!Se(e.start,"explicit-key-ind")&&!Se(e.sep,"map-value-ind")&&(e.key&&(e.value=e.key),delete e.key,Ia(e.value)?e.value.end?Array.prototype.push.apply(e.value.end,e.sep):e.value.end=e.sep:Array.prototype.push.apply(e.start,e.sep),delete e.sep)}class Lr{constructor(e){this.atNewLine=!0,this.atScalar=!1,this.indent=0,this.offset=0,this.onKeyLine=!1,this.stack=[],this.source="",this.type="",this.lexer=new La,this.onNewLine=e}*parse(e,t=!1){this.onNewLine&&this.offset===0&&this.onNewLine(0);for(const n of this.lexer.lex(e,t))yield*this.next(n);t||(yield*this.end())}*next(e){if(this.source=e,this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=e.length;return}const t=_a(e);if(t)if(t==="scalar")this.atNewLine=!1,this.atScalar=!0,this.type="scalar";else{switch(this.type=t,yield*this.step(),t){case"newline":this.atNewLine=!0,this.indent=0,this.onNewLine&&this.onNewLine(this.offset+e.length);break;case"space":this.atNewLine&&e[0]===" "&&(this.indent+=e.length);break;case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":this.atNewLine&&(this.indent+=e.length);break;case"doc-mode":case"flow-error-end":return;default:this.atNewLine=!1}this.offset+=e.length}else{const n=`Not a YAML token: ${e}`;yield*this.pop({type:"error",offset:this.offset,message:n,source:e}),this.offset+=e.length}}*end(){for(;this.stack.length>0;)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){const e=this.peek(1);if(this.type==="doc-end"&&(!e||e.type!=="doc-end")){for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:"doc-end",offset:this.offset,source:this.source});return}if(!e)return yield*this.stream();switch(e.type){case"document":return yield*this.document(e);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar(e);case"block-scalar":return yield*this.blockScalar(e);case"block-map":return yield*this.blockMap(e);case"block-seq":return yield*this.blockSequence(e);case"flow-collection":return yield*this.flowCollection(e);case"doc-end":return yield*this.documentEnd(e)}yield*this.pop()}peek(e){return this.stack[this.stack.length-e]}*pop(e){const t=e??this.stack.pop();if(t)if(this.stack.length===0)yield t;else{const n=this.peek(1);switch(t.type==="block-scalar"?t.indent="indent"in n?n.indent:0:t.type==="flow-collection"&&n.type==="document"&&(t.indent=0),t.type==="flow-collection"&&Na(t),n.type){case"document":n.value=t;break;case"block-scalar":n.props.push(t);break;case"block-map":{const r=n.items[n.items.length-1];if(r.value){n.items.push({start:[],key:t,sep:[]}),this.onKeyLine=!0;return}else if(r.sep)r.value=t;else{Object.assign(r,{key:t,sep:[]}),this.onKeyLine=!Se(r.start,"explicit-key-ind");return}break}case"block-seq":{const r=n.items[n.items.length-1];r.value?n.items.push({start:[],value:t}):r.value=t;break}case"flow-collection":{const r=n.items[n.items.length-1];!r||r.value?n.items.push({start:[],key:t,sep:[]}):r.sep?r.value=t:Object.assign(r,{key:t,sep:[]});return}default:yield*this.pop(),yield*this.pop(t)}if((n.type==="document"||n.type==="block-map"||n.type==="block-seq")&&(t.type==="block-map"||t.type==="block-seq")){const r=t.items[t.items.length-1];r&&!r.sep&&!r.value&&r.start.length>0&&$a(r.start)===-1&&(t.indent===0||r.start.every(i=>i.type!=="comment"||i.indent<t.indent))&&(n.type==="document"?n.end=r.start:n.items.push({start:r.start}),t.items.splice(-1,1))}}else{const n="Tried to pop an empty stack";yield{type:"error",offset:this.offset,source:"",message:n}}}*stream(){switch(this.type){case"directive-line":yield{type:"directive",offset:this.offset,source:this.source};return;case"byte-order-mark":case"space":case"comment":case"newline":yield this.sourceToken;return;case"doc-mode":case"doc-start":{const e={type:"document",offset:this.offset,start:[]};this.type==="doc-start"&&e.start.push(this.sourceToken),this.stack.push(e);return}}yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML stream`,source:this.source}}*document(e){if(e.value)return yield*this.lineEnd(e);switch(this.type){case"doc-start":{$a(e.start)!==-1?(yield*this.pop(),yield*this.step()):e.start.push(this.sourceToken);return}case"anchor":case"tag":case"space":case"comment":case"newline":e.start.push(this.sourceToken);return}const t=this.startBlockValue(e);t?this.stack.push(t):yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML document`,source:this.source}}*scalar(e){if(this.type==="map-value-ind"){const t=sn(this.peek(2)),n=_t(t);let r;e.end?(r=e.end,r.push(this.sourceToken),delete e.end):r=[this.sourceToken];const i={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:n,key:e,sep:r}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=i}else yield*this.lineEnd(e)}*blockScalar(e){switch(this.type){case"space":case"comment":case"newline":e.props.push(this.sourceToken);return;case"scalar":if(e.source=this.source,this.atNewLine=!0,this.indent=0,this.onNewLine){let t=this.source.indexOf(`
|
|
187
187
|
`)+1;for(;t!==0;)this.onNewLine(this.offset+t),t=this.source.indexOf(`
|
|
188
|
-
`,t)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){const t=e.items[e.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,t.value){const n="end"in t.value?t.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type==="comment"?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case"space":case"comment":if(t.value)e.items.push({start:[this.sourceToken]});else if(t.sep)t.sep.push(this.sourceToken);else{if(this.atIndentedComment(t.start,e.indent)){const r=e.items[e.items.length-2]?.value?.end;if(Array.isArray(r)){Array.prototype.push.apply(r,t.start),r.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return}if(this.indent>=e.indent){const n=!this.onKeyLine&&this.indent===e.indent&&t.sep;let r=[];if(n&&t.sep&&!t.value){const i=[];for(let o=0;o<t.sep.length;++o){const a=t.sep[o];switch(a.type){case"newline":i.push(o);break;case"space":break;case"comment":a.indent>e.indent&&(i.length=0);break;default:i.length=0}}i.length>=2&&(r=t.sep.splice(i[1]))}switch(this.type){case"anchor":case"tag":n||t.value?(r.push(this.sourceToken),e.items.push({start:r}),this.onKeyLine=!0):t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case"explicit-key-ind":!t.sep&&!Se(t.start,"explicit-key-ind")?t.start.push(this.sourceToken):n||t.value?(r.push(this.sourceToken),e.items.push({start:r})):this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]}),this.onKeyLine=!0;return;case"map-value-ind":if(Se(t.start,"explicit-key-ind"))if(t.sep)if(t.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(Se(t.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,key:null,sep:[this.sourceToken]}]});else if(
|
|
188
|
+
`,t)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){const t=e.items[e.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,t.value){const n="end"in t.value?t.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type==="comment"?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case"space":case"comment":if(t.value)e.items.push({start:[this.sourceToken]});else if(t.sep)t.sep.push(this.sourceToken);else{if(this.atIndentedComment(t.start,e.indent)){const r=e.items[e.items.length-2]?.value?.end;if(Array.isArray(r)){Array.prototype.push.apply(r,t.start),r.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return}if(this.indent>=e.indent){const n=!this.onKeyLine&&this.indent===e.indent&&t.sep;let r=[];if(n&&t.sep&&!t.value){const i=[];for(let o=0;o<t.sep.length;++o){const a=t.sep[o];switch(a.type){case"newline":i.push(o);break;case"space":break;case"comment":a.indent>e.indent&&(i.length=0);break;default:i.length=0}}i.length>=2&&(r=t.sep.splice(i[1]))}switch(this.type){case"anchor":case"tag":n||t.value?(r.push(this.sourceToken),e.items.push({start:r}),this.onKeyLine=!0):t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case"explicit-key-ind":!t.sep&&!Se(t.start,"explicit-key-ind")?t.start.push(this.sourceToken):n||t.value?(r.push(this.sourceToken),e.items.push({start:r})):this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]}),this.onKeyLine=!0;return;case"map-value-ind":if(Se(t.start,"explicit-key-ind"))if(t.sep)if(t.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(Se(t.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,key:null,sep:[this.sourceToken]}]});else if(Ia(t.key)&&!Se(t.sep,"newline")){const i=_t(t.start),o=t.key,a=t.sep;a.push(this.sourceToken),delete t.key,delete t.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:i,key:o,sep:a}]})}else r.length>0?t.sep=t.sep.concat(r,this.sourceToken):t.sep.push(this.sourceToken);else if(Se(t.start,"newline"))Object.assign(t,{key:null,sep:[this.sourceToken]});else{const i=_t(t.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:i,key:null,sep:[this.sourceToken]}]})}else t.sep?t.value||n?e.items.push({start:r,key:null,sep:[this.sourceToken]}):Se(t.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):t.sep.push(this.sourceToken):Object.assign(t,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{const i=this.flowScalar(this.type);n||t.value?(e.items.push({start:r,key:i,sep:[]}),this.onKeyLine=!0):t.sep?this.stack.push(i):(Object.assign(t,{key:i,sep:[]}),this.onKeyLine=!0);return}default:{const i=this.startBlockValue(e);if(i){n&&i.type!=="block-seq"&&Se(t.start,"explicit-key-ind")&&e.items.push({start:r}),this.stack.push(i);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){const t=e.items[e.items.length-1];switch(this.type){case"newline":if(t.value){const n="end"in t.value?t.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type==="comment"?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else t.start.push(this.sourceToken);return;case"space":case"comment":if(t.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(t.start,e.indent)){const r=e.items[e.items.length-2]?.value?.end;if(Array.isArray(r)){Array.prototype.push.apply(r,t.start),r.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return;case"anchor":case"tag":if(t.value||this.indent<=e.indent)break;t.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==e.indent)break;t.value||Se(t.start,"seq-item-ind")?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken);return}if(this.indent>e.indent){const n=this.startBlockValue(e);if(n){this.stack.push(n);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){const t=e.items[e.items.length-1];if(this.type==="flow-error-end"){let n;do yield*this.pop(),n=this.peek(1);while(n&&n.type==="flow-collection")}else if(e.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!t||t.sep?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken);return;case"map-value-ind":!t||t.value?e.items.push({start:[],key:null,sep:[this.sourceToken]}):t.sep?t.sep.push(this.sourceToken):Object.assign(t,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!t||t.value?e.items.push({start:[this.sourceToken]}):t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{const r=this.flowScalar(this.type);!t||t.value?e.items.push({start:[],key:r,sep:[]}):t.sep?this.stack.push(r):Object.assign(t,{key:r,sep:[]});return}case"flow-map-end":case"flow-seq-end":e.end.push(this.sourceToken);return}const n=this.startBlockValue(e);n?this.stack.push(n):(yield*this.pop(),yield*this.step())}else{const n=this.peek(2);if(n.type==="block-map"&&(this.type==="map-value-ind"&&n.indent===e.indent||this.type==="newline"&&!n.items[n.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&n.type!=="flow-collection"){const r=sn(n),i=_t(r);Na(e);const o=e.end.splice(1,e.end.length);o.push(this.sourceToken);const a={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:i,key:e,sep:o}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=a}else yield*this.lineEnd(e)}}flowScalar(e){if(this.onNewLine){let t=this.source.indexOf(`
|
|
189
189
|
`)+1;for(;t!==0;)this.onNewLine(this.offset+t),t=this.source.indexOf(`
|
|
190
|
-
`,t)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;const t=sn(e),n=_t(t);return n.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n}]}}case"map-value-ind":{this.onKeyLine=!0;const t=sn(e),n=_t(t);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,t){return this.type!=="comment"||this.indent<=t?!1:e.every(n=>n.type==="newline"||n.type==="space")}*documentEnd(e){this.type!=="doc-mode"&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;case"space":case"comment":default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}}function
|
|
190
|
+
`,t)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;const t=sn(e),n=_t(t);return n.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n}]}}case"map-value-ind":{this.onKeyLine=!0;const t=sn(e),n=_t(t);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,t){return this.type!=="comment"||this.indent<=t?!1:e.every(n=>n.type==="newline"||n.type==="space")}*documentEnd(e){this.type!=="doc-mode"&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;case"space":case"comment":default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}}function Pa(s){const e=s.prettyErrors!==!1;return{lineCounter:s.lineCounter||e&&new ka||null,prettyErrors:e}}function Wh(s,e={}){const{lineCounter:t,prettyErrors:n}=Pa(e),r=new Lr(t?.addNewLine),i=new Cr(e),o=Array.from(i.compose(r.parse(s)));if(n&&t)for(const a of o)a.errors.forEach(Qs(s,t)),a.warnings.forEach(Qs(s,t));return o.length>0?o:Object.assign([],{empty:!0},i.streamInfo())}function Ba(s,e={}){const{lineCounter:t,prettyErrors:n}=Pa(e),r=new Lr(t?.addNewLine),i=new Cr(e);let o=null;for(const a of i.compose(r.parse(s),!0,s.length))if(!o)o=a;else if(o.options.logLevel!=="silent"){o.errors.push(new Je(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return n&&t&&(o.errors.forEach(Qs(s,t)),o.warnings.forEach(Qs(s,t))),o}function Yh(s,e,t){let n;typeof e=="function"?n=e:t===void 0&&e&&typeof e=="object"&&(t=e);const r=Ba(s,t);if(!r)return null;if(r.warnings.forEach(i=>Wo(r.options.logLevel,i)),r.errors.length>0){if(r.options.logLevel!=="silent")throw r.errors[0];r.errors=[]}return r.toJS(Object.assign({reviver:n},t))}function Vh(s,e,t){let n=null;if(typeof e=="function"||Array.isArray(e)?n=e:t===void 0&&e&&(t=e),typeof t=="string"&&(t=t.length),typeof t=="number"){const r=Math.round(t);t=r<1?void 0:r>8?{indent:8}:{indent:r}}if(s===void 0){const{keepUndefined:r}=t??e??{};if(!r)return}return new $t(s,n,t).toString(t)}const zh={__proto__:null,Alias:Ns,CST:Kh,Composer:Cr,Document:$t,Lexer:La,LineCounter:ka,Pair:re,Parser:Lr,Scalar:N,Schema:an,YAMLError:br,YAMLMap:pe,YAMLParseError:Je,YAMLSeq:Ke,YAMLWarning:ga,isAlias:Qe,isCollection:Z,isDocument:gt,isMap:mt,isNode:te,isPair:X,isScalar:Y,isSeq:yt,parse:Yh,parseAllDocuments:Wh,parseDocument:Ba,stringify:Vh,visit:Ue,visitAsync:Is},kr=s=>import(il(s)).then(e=>e.default),Qh=ol(import.meta.url);function Xh(s){try{return Qh.resolve(s)}catch{return s}}const $r="lint-staged",Ir="package.json",Ma=["package.yaml","package.yml"],Fa=[Ir,...Ma,".lintstagedrc",".lintstagedrc.json",".lintstagedrc.yaml",".lintstagedrc.yml",".lintstagedrc.mjs",".lintstagedrc.js",".lintstagedrc.cjs","lint-staged.config.mjs","lint-staged.config.js","lint-staged.config.cjs"],vt=oe("lint-staged:loadConfig"),Jh=(s,e)=>{const t=Ir.includes(H.basename(s));try{const n=JSON.parse(e);return t?n[$r]:n}catch(n){if(H.basename(s)===Ir){vt("Ignoring invalid package file `%s` with content:\n%s",s,e);return}throw n}},Nr=(s,e)=>{const t=Ma.includes(H.basename(s));try{const n=zh.parse(e);return t?n[$r]:n}catch(n){if(t){vt("Ignoring invalid package file `%s` with content:\n%s",s,e);return}throw n}},Da="noExt",xa={".js":kr,".json":Jh,".mjs":kr,".cjs":kr,".yaml":Nr,".yml":Nr,[Da]:Nr},Zh=async s=>{const e=H.resolve(s);return await(await De.readFile(e)).toString()},ep=async s=>{s=H.resolve(s);const e=H.extname(s)||Da,t=xa[e],n=t.length>1?await Zh(s):void 0;return{config:await t(s,n),filepath:s}},Pr=async({configPath:s,cwd:e},t)=>{try{let n;if(s)vt("Loading configuration from `%s`...",s),n=await ep(Xh(s));else{vt("Searching for configuration from `%s`...",e);const{lilconfig:o}=await import("./index5.mjs").then(function(l){return l.i});n=await o($r,{searchPlaces:Fa,loaders:xa}).search(e)}if(!n)return{};const r=await n.config??null,i=n.filepath;return vt("Successfully loaded config from `%s`:\n%O",i,r),{config:r,filepath:i}}catch(n){return vt("Failed to load configuration!"),t.error(n),{}}},tp=/(?<![\\$])({)(?:(?!(?<!\\),|\.\.|\{|\}).)*?(?<!\\)(})/g,sp=s=>{let e=`${s}`,t=null;for(;t=tp.exec(s);){const n=t[0],r=n.replace(/{/,"").replace(/}/,"");e=e.replace(n,r)}return e},np=/{{[^}{]*}}/,rp=s=>{let e=`${s}`;const t=np.exec(s)?.[0];if(t){const n=t.replace("{{","{").replace("}}","}");e=e.replace(t,n)}return e},ip=(s,e)=>{const t=rp(sp(s));return t!==s&&e.warn(ac(s,t)),t},Br=oe("lint-staged:validateConfig"),Ha=s=>s&&typeof s=="object"&&!Array.isArray(s),Ua=new Map([["concurrent",s=>typeof s=="boolean"],["chunkSize",s=>typeof s=="number"],["globOptions",Ha],["linters",Ha],["ignore",s=>Array.isArray(s)],["subTaskConcurrency",s=>typeof s=="number"],["renderer",s=>typeof s=="string"],["relative",s=>typeof s=="boolean"]]),nn=(s,e,t)=>{if(Br("Validating config from `%s`...",e),!s||typeof s!="object"&&typeof s!="function")throw Qu;if(typeof s=="function")return{"*":s};if(Object.entries(s).length===0)throw Xu;const n=[],r=Object.entries(s).reduce((i,[o,a])=>{if(Ua.has(o))return Ua.get(o)(a)&&n.push(Ln(o,"Advanced configuration has been deprecated.",a)),i;(!Array.isArray(a)||a.some(c=>typeof c!="string"&&typeof c!="function"))&&typeof a!="string"&&typeof a!="function"&&n.push(Ln(o,"Should be a string, a function, or an array of strings and functions.",a));const l=ip(o,t);return{...i,[l]:a}},{});if(n.length){const i=n.join(`
|
|
191
191
|
|
|
192
192
|
`);throw t.error(`Could not parse lint-staged config.
|
|
193
193
|
|
|
194
194
|
${i}
|
|
195
195
|
|
|
196
|
-
See https://github.com/okonet/lint-staged#configuration.`),new Error(i)}return Br("Validated config from `%s`:",e),Br(
|
|
197
|
-
%O`,R),R.length===0)return c||y.output.push(cc),y;const O=await lp({configObject:t,configPath:n,cwd:r,gitDir:S},p),I=Object.keys(O).length;if(I===0)throw y.errors.add(
|
|
196
|
+
See https://github.com/okonet/lint-staged#configuration.`),new Error(i)}return Br("Validated config from `%s`:",e),Br(Fr(s,{compact:!1})),r},Be=oe("lint-staged:searchConfigs"),ja=["ls-files","-z","--full-name"],Ka=s=>s.filter(e=>Fa.includes(H.basename(e))),Ga=s=>s.split("/").length,op=(s,e)=>Ga(s)>Ga(e)?-1:1,ap=s=>e=>e.startsWith(ge(s)),lp=async({configObject:s,configPath:e,cwd:t=process.cwd(),gitDir:n=t},r)=>{if(Be("Searching for configuration files..."),s)return Be("Using single direct configuration object..."),{"":nn(s,"config object",r)};if(e){Be("Using single configuration path...");const{config:f,filepath:u}=await Pr({configPath:e},r);return f?{[e]:nn(f,u,r)}:{}}const[i,o]=await Promise.all([ut(ja,{cwd:n}).then(Yn).then(Ka),ut([...ja,"--others","--exclude-standard"],{cwd:n}).then(Yn).then(Ka)]),a=[...i,...o].map(f=>ge(H.join(n,f))).filter(ap(t)).sort(op);Be("Found possible config files:",a);const l=a.reduce((f,u)=>Object.assign(f,{[u]:null}),{});await Promise.all(Object.keys(l).map(f=>Pr({configPath:f},r).then(({config:u,filepath:h})=>{u&&(f!==h&&Be('Config file "%s" resolved to "%s"',f,h),l[f]=nn(u,h,r))})));const c=Object.entries(l).filter(([,f])=>!!f).reduce((f,[u,h])=>({...f,[u]:h}),{});if(!Object.keys(c).length){Be('Could not find config files inside "%s"',t);const{config:f,filepath:u}=await Pr({cwd:t},r);f?(Be('Found parent configuration file from "%s"',u),c[u]=nn(f,u,r)):Be('Could not find parent configuration files from "%s"',t)}return Be("Found %d config files",Object.keys(c).length),c},rn=oe("lint-staged:runAll"),on=s=>Object.assign(new Error("lint-staged failed"),{ctx:s}),cp=async({allowEmpty:s=!1,concurrent:e=!0,configObject:t,configPath:n,cwd:r,debug:i=!1,diff:o,diffFilter:a,maxArgLength:l,quiet:c=!1,relative:f=!1,shell:u=!1,stash:h=o===void 0,hidePartiallyStaged:d=h,verbose:m=!1},p=console)=>{rn("Running all linter scripts...");const g=!!r;r=g?H.resolve(r):process.cwd(),rn("Using working directory `%s`",r);const y=ko({quiet:c}),{gitDir:S,gitConfigDir:A}=await xf(r);if(!S)throw c||y.output.push(ic),y.errors.add(Zu),on(y);const L=await ut(["log","-1"],{cwd:S}).then(()=>!0).catch(()=>!1);y.shouldBackup=L&&h,!y.shouldBackup&&!c&&p.warn(fc(L,o)),y.shouldHidePartiallyStaged=d,!y.shouldHidePartiallyStaged&&!c&&p.warn(hc(L&&h,o));const R=await zu({cwd:S,diff:o,diffFilter:a});if(!R)throw c||y.output.push(oc),y.errors.add(Ju),on(y);if(rn(`Loaded list of staged files in git:
|
|
197
|
+
%O`,R),R.length===0)return c||y.output.push(cc),y;const O=await lp({configObject:t,configPath:n,cwd:r,gitDir:S},p),I=Object.keys(O).length;if(I===0)throw y.errors.add(go),on(y);const _=await cf({configs:O,files:R,singleConfigMode:t||n!==void 0}),k=I>1;let j=!1;const E={ctx:y,exitOnError:!1,registerSignalListeners:!1,...Vu({debug:i,quiet:c},p)},$=[],G=new Set;for(const[D,{config:x,files:de}]of Object.entries(_)){const ue=D?ge(H.relative(r,D)):"Config object",ne=_i({baseDir:S,files:de,maxArgLength:l,relative:f}),Fe=k&&!g?H.dirname(D):r,et=ne.length;et>1&&rn("Chunked staged files from `%s` into %d part",D,et);for(const[tt,we]of ne.entries()){const M=await Promise.all(Gu({config:x,cwd:Fe,files:we,relative:f}).map(le=>Mf({commands:le.commands,cwd:Fe,files:le.fileList,gitDir:S,shell:u,verbose:m}).then(st=>{le.fileList.forEach(U=>{const C=H.isAbsolute(U)?U:ge(H.join(Fe,U));G.add(C)}),j=j||st.some(U=>U.command==="git add");const T=le.fileList.length;return{title:`${le.pattern}${q.dim(` \u2014 ${T} ${T===1?"file":"files"}`)}`,task:async(U,C)=>C.newListr(st,{concurrent:!1,exitOnError:!0}),skip:()=>T===0?`${le.pattern}${q.dim(" \u2014 no files")}`:!1}})));$.push({title:`${ue}${q.dim(` \u2014 ${we.length} ${we.length>1?"files":"file"}`)}`+(et>1?q.dim(` (chunk ${tt+1}/${et})...`):""),task:(le,st)=>st.newListr(M,{concurrent:e,exitOnError:!0}),skip:()=>y.errors.has(Ve)?dc:M.every(le=>le.skip())?`${ue}${q.dim(" \u2014 no tasks to run")}`:!1})}}if(j&&!c&&p.warn(pc),$.every(D=>D.skip()))return c||y.output.push(uc),y;const Ae=_i({baseDir:r,files:Array.from(G),maxArgLength:l,relative:!1}),b=new af({allowEmpty:s,gitConfigDir:A,gitDir:S,matchedFileChunks:Ae,diff:o,diffFilter:a});if(await new _n([{title:"Preparing lint-staged...",task:D=>b.prepare(D)},{title:"Hiding unstaged changes to partially staged files...",task:D=>b.hideUnstagedChanges(D),enabled:$o},{title:`Running tasks for ${o?"changed":"staged"} files...`,task:(D,x)=>x.newListr($,{concurrent:e}),skip:()=>$.every(D=>D.skip())},{title:"Applying modifications from tasks...",task:D=>b.applyModifications(D),skip:Rf},{title:"Restoring unstaged changes to partially staged files...",task:D=>b.restoreUnstagedChanges(D),enabled:$o,skip:Tf},{title:"Reverting to original state because of errors...",task:D=>b.restoreOriginalState(D),enabled:_f,skip:vf},{title:"Cleaning up temporary files...",task:D=>b.cleanup(D),enabled:Lf,skip:kf}],E).run(),y.errors.size>0)throw on(y);return y},qa=oe("lint-staged:validateOptions"),up=async(s={},e)=>{if(qa("Validating options..."),typeof s.cwd=="string")try{const t=H.resolve(s.cwd);await De.access(t,xr.F_OK)}catch(t){throw e.error(Ri("cwd",s.cwd,t.message)),yo}if(typeof s.shell=="string")try{await De.access(s.shell,xr.X_OK)}catch(t){throw e.error(Ri("shell",s.shell,t.message)),yo}qa("Validated options!")},Wa=oe("lint-staged"),fp=()=>{switch(process.platform){case"darwin":return 262144;case"win32":return 8191;default:return 131072}},hp=async({allowEmpty:s=!1,concurrent:e=!0,config:t,configPath:n,cwd:r,debug:i=!1,diff:o,diffFilter:a,maxArgLength:l=fp()/2,quiet:c=!1,relative:f=!1,shell:u=!1,stash:h=o===void 0,hidePartiallyStaged:d=h,verbose:m=!1}={},p=console)=>{await up({cwd:r,shell:u},p),Wa("Unset GIT_LITERAL_PATHSPECS (was `%s`)",process.env.GIT_LITERAL_PATHSPECS),delete process.env.GIT_LITERAL_PATHSPECS;const g={allowEmpty:s,concurrent:e,configObject:t,configPath:n,cwd:r,debug:i,diff:o,diffFilter:a,maxArgLength:l,quiet:c,relative:f,shell:u,stash:h,hidePartiallyStaged:d,verbose:m};try{const y=await cp(g,p);return Wa("Tasks were executed successfully!"),Ti(y,p),!0}catch(y){if(y?.ctx?.errors){const{ctx:S}=y;return S.errors.has(go)?p.error(lc):S.errors.has(Ut)?p.warn(gc):S.errors.has(Ve)&&!S.errors.has(mo)&&(p.error(ct),S.shouldBackup&&p.error(mc)),Ti(S,p),!1}throw y}},pp={__proto__:null,default:hp};export{al as c,nt as g,pp as i};
|