@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.
@@ -1,12 +1,12 @@
1
- "use strict";var Ce=Object.defineProperty;var Re=(s,e,t)=>e in s?Ce(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t;var v=(s,e,t)=>(Re(s,typeof e!="symbol"?e+"":e,t),t);var re,ie,oe,ae,le,ce,ue,fe,z,ee,Q,he,J,X,pe,de,ge,me,ye,be,we,Ee,Se;const tty=require("tty"),require$$0$1=require("util"),require$$0=require("os"),node_util=require("node:util"),string_decoder=require("string_decoder"),stream=require("stream"),crypto=require("crypto"),path$2=require("node:path"),execa=require("execa"),require$$0$2=require("path"),node_os=require("node:os"),node_stream=require("node:stream"),fs=require("node:fs/promises"),require$$0$3=require("child_process"),EventEmitter$1=require("events"),node_url=require("node:url"),node_module=require("node:module"),node_fs=require("node:fs");var _documentCurrentScript=typeof document<"u"?document.currentScript:null;function _interopDefaultCompat(s){return s&&typeof s=="object"&&"default"in s?s.default:s}function _interopNamespaceCompat(s){if(s&&typeof s=="object"&&"default"in s)return s;const e=Object.create(null);if(s)for(const t in s)e[t]=s[t];return e.default=s,e}const tty__default=_interopDefaultCompat(tty),tty__namespace=_interopNamespaceCompat(tty),require$$0__default$1=_interopDefaultCompat(require$$0$1),require$$0__default=_interopDefaultCompat(require$$0),path__default=_interopDefaultCompat(path$2),require$$0__default$2=_interopDefaultCompat(require$$0$2),fs__default=_interopDefaultCompat(fs),require$$0__default$3=_interopDefaultCompat(require$$0$3),EventEmitter__default=_interopDefaultCompat(EventEmitter$1);var commonjsGlobal=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function getDefaultExportFromCjs(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}var src={exports:{}},browser={exports:{}},ms,hasRequiredMs;function requireMs(){if(hasRequiredMs)return ms;hasRequiredMs=1;var s=1e3,e=s*60,t=e*60,n=t*24,r=n*7,i=n*365.25;ms=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 ms}var common,hasRequiredCommon;function requireCommon(){if(hasRequiredCommon)return common;hasRequiredCommon=1;function s(e){n.debug=n,n.default=n,n.coerce=c,n.disable=o,n.enable=i,n.enabled=a,n.humanize=requireMs(),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 F=y[R];I=k.call(S,F),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 common=s,common}var hasRequiredBrowser;function requireBrowser(){return hasRequiredBrowser||(hasRequiredBrowser=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=requireCommon()(e);const{formatters:a}=s.exports;a.j=function(l){try{return JSON.stringify(l)}catch(c){return"[UnexpectedJSONParseError]: "+c.message}}}(browser,browser.exports)),browser.exports}var node={exports:{}},hasFlag,hasRequiredHasFlag;function requireHasFlag(){return hasRequiredHasFlag||(hasRequiredHasFlag=1,hasFlag=(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)}),hasFlag}var supportsColor_1,hasRequiredSupportsColor;function requireSupportsColor(){if(hasRequiredSupportsColor)return supportsColor_1;hasRequiredSupportsColor=1;const s=require$$0__default,e=requireHasFlag(),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 supportsColor_1={supportsColor:o,stdout:o(process.stdout),stderr:o(process.stderr)},supportsColor_1}var hasRequiredNode;function requireNode(){return hasRequiredNode||(hasRequiredNode=1,function(s,e){const t=tty__default,n=require$$0__default$1;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=requireSupportsColor();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
+ "use strict";var Ce=Object.defineProperty;var Re=(s,e,t)=>e in s?Ce(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t;var v=(s,e,t)=>(Re(s,typeof e!="symbol"?e+"":e,t),t);var re,ie,oe,ae,le,ce,ue,fe,z,ee,Q,he,J,X,pe,de,ge,me,ye,be,we,Ee,Se;const tty=require("tty"),require$$0$1=require("util"),require$$0=require("os"),node_util=require("node:util"),string_decoder=require("string_decoder"),stream=require("stream"),crypto=require("crypto"),path$2=require("node:path"),execa=require("execa"),require$$0$2=require("path"),node_os=require("node:os"),node_stream=require("node:stream"),fs=require("node:fs/promises"),require$$0$3=require("child_process"),EventEmitter$1=require("events"),node_url=require("node:url"),node_module=require("node:module"),node_fs=require("node:fs");var _documentCurrentScript=typeof document<"u"?document.currentScript:null;function _interopDefaultCompat(s){return s&&typeof s=="object"&&"default"in s?s.default:s}function _interopNamespaceCompat(s){if(s&&typeof s=="object"&&"default"in s)return s;const e=Object.create(null);if(s)for(const t in s)e[t]=s[t];return e.default=s,e}const tty__default=_interopDefaultCompat(tty),tty__namespace=_interopNamespaceCompat(tty),require$$0__default$1=_interopDefaultCompat(require$$0$1),require$$0__default=_interopDefaultCompat(require$$0),path__default=_interopDefaultCompat(path$2),require$$0__default$2=_interopDefaultCompat(require$$0$2),fs__default=_interopDefaultCompat(fs),require$$0__default$3=_interopDefaultCompat(require$$0$3),EventEmitter__default=_interopDefaultCompat(EventEmitter$1);var commonjsGlobal=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function getDefaultExportFromCjs(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}var src={exports:{}},browser={exports:{}},ms,hasRequiredMs;function requireMs(){if(hasRequiredMs)return ms;hasRequiredMs=1;var s=1e3,e=s*60,t=e*60,n=t*24,r=n*7,i=n*365.25;ms=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 ms}var common,hasRequiredCommon;function requireCommon(){if(hasRequiredCommon)return common;hasRequiredCommon=1;function s(e){n.debug=n,n.default=n,n.coerce=c,n.disable=o,n.enable=i,n.enabled=a,n.humanize=requireMs(),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 D=y[R];I=k.call(S,D),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 common=s,common}var hasRequiredBrowser;function requireBrowser(){return hasRequiredBrowser||(hasRequiredBrowser=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=requireCommon()(e);const{formatters:a}=s.exports;a.j=function(l){try{return JSON.stringify(l)}catch(c){return"[UnexpectedJSONParseError]: "+c.message}}}(browser,browser.exports)),browser.exports}var node={exports:{}},hasFlag,hasRequiredHasFlag;function requireHasFlag(){return hasRequiredHasFlag||(hasRequiredHasFlag=1,hasFlag=(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)}),hasFlag}var supportsColor_1,hasRequiredSupportsColor;function requireSupportsColor(){if(hasRequiredSupportsColor)return supportsColor_1;hasRequiredSupportsColor=1;const s=require$$0__default,e=tty__default,t=requireHasFlag(),{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 supportsColor_1={supportsColor:a,stdout:i(o(!0,e.isatty(1))),stderr:i(o(!0,e.isatty(2)))},supportsColor_1}var hasRequiredNode;function requireNode(){return hasRequiredNode||(hasRequiredNode=1,function(s,e){const t=tty__default,n=require$$0__default$1;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=requireSupportsColor();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),f.push(g+"m+"+s.exports.humanize(this.diff)+"\x1B[0m")}else f[0]=o()+d+" "+f[0]}function o(){return e.inspectOpts.hideDate?"":new Date().toISOString()+" "}function a(...f){return process.stderr.write(n.format(...f)+`
4
- `)}function l(f){f?process.env.DEBUG=f:delete process.env.DEBUG}function c(){return process.env.DEBUG}function h(f){f.inspectOpts={};const d=Object.keys(e.inspectOpts);for(let m=0;m<d.length;m++)f.inspectOpts[d[m]]=e.inspectOpts[d[m]]}s.exports=requireCommon()(e);const{formatters:u}=s.exports;u.o=function(f){return this.inspectOpts.colors=this.useColors,n.inspect(f,this.inspectOpts).split(`
5
- `).map(d=>d.trim()).join(" ")},u.O=function(f){return this.inspectOpts.colors=this.useColors,n.inspect(f,this.inspectOpts)}}(node,node.exports)),node.exports}typeof process>"u"||process.type==="renderer"||process.browser===!0||process.__nwjs?src.exports=requireBrowser():src.exports=requireNode();var srcExports=src.exports;const debug=getDefaultExportFromCjs(srcExports),ANSI_BACKGROUND_OFFSET=10,wrapAnsi16=(s=0)=>e=>`\x1B[${e+s}m`,wrapAnsi256=(s=0)=>e=>`\x1B[${38+s};5;${e}m`,wrapAnsi16m=(s=0)=>(e,t,n)=>`\x1B[${38+s};2;${e};${t};${n}m`,styles$1={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(styles$1.modifier);const foregroundColorNames=Object.keys(styles$1.color),backgroundColorNames=Object.keys(styles$1.bgColor);[...foregroundColorNames,...backgroundColorNames];function assembleStyles(){const s=new Map;for(const[e,t]of Object.entries(styles$1)){for(const[n,r]of Object.entries(t))styles$1[n]={open:`\x1B[${r[0]}m`,close:`\x1B[${r[1]}m`},t[n]=styles$1[n],s.set(r[0],r[1]);Object.defineProperty(styles$1,e,{value:t,enumerable:!1})}return Object.defineProperty(styles$1,"codes",{value:s,enumerable:!1}),styles$1.color.close="\x1B[39m",styles$1.bgColor.close="\x1B[49m",styles$1.color.ansi=wrapAnsi16(),styles$1.color.ansi256=wrapAnsi256(),styles$1.color.ansi16m=wrapAnsi16m(),styles$1.bgColor.ansi=wrapAnsi16(ANSI_BACKGROUND_OFFSET),styles$1.bgColor.ansi256=wrapAnsi256(ANSI_BACKGROUND_OFFSET),styles$1.bgColor.ansi16m=wrapAnsi16m(ANSI_BACKGROUND_OFFSET),Object.defineProperties(styles$1,{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=>styles$1.rgbToAnsi256(...styles$1.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)=>styles$1.ansi256ToAnsi(styles$1.rgbToAnsi256(e,t,n)),enumerable:!1},hexToAnsi:{value:e=>styles$1.ansi256ToAnsi(styles$1.hexToAnsi256(e)),enumerable:!1}}),styles$1}const ansiStyles=assembleStyles(),level=(()=>{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})(),colorSupport=level!==0&&{level,hasBasic:!0,has256:level>=2,has16m:level>=3},supportsColor={stdout:colorSupport,stderr:colorSupport};function stringReplaceAll(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 stringEncaseCRLFWithFirstIndex(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
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=requireCommon()(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)}}(node,node.exports)),node.exports}typeof process>"u"||process.type==="renderer"||process.browser===!0||process.__nwjs?src.exports=requireBrowser():src.exports=requireNode();var srcExports=src.exports;const debug=getDefaultExportFromCjs(srcExports),ANSI_BACKGROUND_OFFSET=10,wrapAnsi16=(s=0)=>e=>`\x1B[${e+s}m`,wrapAnsi256=(s=0)=>e=>`\x1B[${38+s};5;${e}m`,wrapAnsi16m=(s=0)=>(e,t,n)=>`\x1B[${38+s};2;${e};${t};${n}m`,styles$1={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(styles$1.modifier);const foregroundColorNames=Object.keys(styles$1.color),backgroundColorNames=Object.keys(styles$1.bgColor);[...foregroundColorNames,...backgroundColorNames];function assembleStyles(){const s=new Map;for(const[e,t]of Object.entries(styles$1)){for(const[n,r]of Object.entries(t))styles$1[n]={open:`\x1B[${r[0]}m`,close:`\x1B[${r[1]}m`},t[n]=styles$1[n],s.set(r[0],r[1]);Object.defineProperty(styles$1,e,{value:t,enumerable:!1})}return Object.defineProperty(styles$1,"codes",{value:s,enumerable:!1}),styles$1.color.close="\x1B[39m",styles$1.bgColor.close="\x1B[49m",styles$1.color.ansi=wrapAnsi16(),styles$1.color.ansi256=wrapAnsi256(),styles$1.color.ansi16m=wrapAnsi16m(),styles$1.bgColor.ansi=wrapAnsi16(ANSI_BACKGROUND_OFFSET),styles$1.bgColor.ansi256=wrapAnsi256(ANSI_BACKGROUND_OFFSET),styles$1.bgColor.ansi16m=wrapAnsi16m(ANSI_BACKGROUND_OFFSET),Object.defineProperties(styles$1,{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=>styles$1.rgbToAnsi256(...styles$1.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)=>styles$1.ansi256ToAnsi(styles$1.rgbToAnsi256(e,t,n)),enumerable:!1},hexToAnsi:{value:e=>styles$1.ansi256ToAnsi(styles$1.hexToAnsi256(e)),enumerable:!1}}),styles$1}const ansiStyles=assembleStyles(),level=(()=>{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})(),colorSupport=level!==0&&{level,hasBasic:!0,has256:level>=2,has16m:level>=3},supportsColor={stdout:colorSupport,stderr:colorSupport};function stringReplaceAll(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 stringEncaseCRLFWithFirstIndex(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
8
  `,r)}while(n!==-1);return i+=s.slice(r),i}const{stdout:stdoutColor,stderr:stderrColor}=supportsColor,GENERATOR=Symbol("GENERATOR"),STYLER=Symbol("STYLER"),IS_EMPTY=Symbol("IS_EMPTY"),levelMapping=["ansi","ansi","ansi256","ansi16m"],styles=Object.create(null),applyOptions=(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=stdoutColor?stdoutColor.level:0;s.level=e.level===void 0?t:e.level},chalkFactory=s=>{const e=(...t)=>t.join(" ");return applyOptions(e,s),Object.setPrototypeOf(e,createChalk.prototype),e};function createChalk(s){return chalkFactory(s)}Object.setPrototypeOf(createChalk.prototype,Function.prototype);for(const[s,e]of Object.entries(ansiStyles))styles[s]={get(){const t=createBuilder(this,createStyler(e.open,e.close,this[STYLER]),this[IS_EMPTY]);return Object.defineProperty(this,s,{value:t}),t}};styles.visible={get(){const s=createBuilder(this,this[STYLER],!0);return Object.defineProperty(this,"visible",{value:s}),s}};const getModelAnsi=(s,e,t,...n)=>s==="rgb"?e==="ansi16m"?ansiStyles[t].ansi16m(...n):e==="ansi256"?ansiStyles[t].ansi256(ansiStyles.rgbToAnsi256(...n)):ansiStyles[t].ansi(ansiStyles.rgbToAnsi(...n)):s==="hex"?getModelAnsi("rgb",e,t,...ansiStyles.hexToRgb(...n)):ansiStyles[t][s](...n),usedModels=["rgb","hex","ansi256"];for(const s of usedModels){styles[s]={get(){const{level:t}=this;return function(...n){const r=createStyler(getModelAnsi(s,levelMapping[t],"color",...n),ansiStyles.color.close,this[STYLER]);return createBuilder(this,r,this[IS_EMPTY])}}};const e="bg"+s[0].toUpperCase()+s.slice(1);styles[e]={get(){const{level:t}=this;return function(...n){const r=createStyler(getModelAnsi(s,levelMapping[t],"bgColor",...n),ansiStyles.bgColor.close,this[STYLER]);return createBuilder(this,r,this[IS_EMPTY])}}}}const proto=Object.defineProperties(()=>{},{...styles,level:{enumerable:!0,get(){return this[GENERATOR].level},set(s){this[GENERATOR].level=s}}}),createStyler=(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}},createBuilder=(s,e,t)=>{const n=(...r)=>applyStyle(n,r.length===1?""+r[0]:r.join(" "));return Object.setPrototypeOf(n,proto),n[GENERATOR]=s,n[STYLER]=e,n[IS_EMPTY]=t,n},applyStyle=(s,e)=>{if(s.level<=0||!e)return s[IS_EMPTY]?"":e;let t=s[STYLER];if(t===void 0)return e;const{openAll:n,closeAll:r}=t;if(e.includes("\x1B"))for(;t!==void 0;)e=stringReplaceAll(e,t.close,t.open),t=t.parent;const i=e.indexOf(`
9
- `);return i!==-1&&(e=stringEncaseCRLFWithFirstIndex(e,r,n,i)),n+e+r};Object.defineProperties(createChalk.prototype,styles);const chalk=createChalk();createChalk({level:stderrColor?stderrColor.level:0});const chalk$1=chalk;var eventemitter3={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})(eventemitter3);var eventemitter3Exports=eventemitter3.exports;const EventEmitter=getDefaultExportFromCjs(eventemitter3Exports),{env={},argv=[],platform:platform$1=""}=typeof process>"u"?{}:process,isDisabled="NO_COLOR"in env||argv.includes("--no-color"),isForced="FORCE_COLOR"in env||argv.includes("--color"),isWindows=platform$1==="win32",isDumbTerminal=env.TERM==="dumb",isCompatibleTerminal=tty__namespace&&tty__namespace.isatty&&tty__namespace.isatty(1)&&env.TERM&&!isDumbTerminal,isCI="CI"in env&&("GITHUB_ACTIONS"in env||"GITLAB_CI"in env||"CIRCLECI"in env),isColorSupported=!isDisabled&&(isForced||isWindows&&!isDumbTerminal||isCompatibleTerminal||isCI),replaceClose=(s,e,t,n,r=e.substring(0,s)+n,i=e.substring(s+t.length),o=i.indexOf(t))=>r+(o<0?i:replaceClose(o,i,t,n)),clearBleed=(s,e,t,n,r)=>s<0?t+e+n:t+replaceClose(s,e,n,r)+n,filterEmpty=(s,e,t=s,n=s.length+1)=>r=>r||!(r===""||r===void 0)?clearBleed((""+r).indexOf(e,n),r,s,e,t):"",init=(s,e,t)=>filterEmpty(`\x1B[${s}m`,`\x1B[${e}m`,t),colors={reset:init(0,0),bold:init(1,22,"\x1B[22m\x1B[1m"),dim:init(2,22,"\x1B[22m\x1B[2m"),italic:init(3,23),underline:init(4,24),inverse:init(7,27),hidden:init(8,28),strikethrough:init(9,29),black:init(30,39),red:init(31,39),green:init(32,39),yellow:init(33,39),blue:init(34,39),magenta:init(35,39),cyan:init(36,39),white:init(37,39),gray:init(90,39),bgBlack:init(40,49),bgRed:init(41,49),bgGreen:init(42,49),bgYellow:init(43,49),bgBlue:init(44,49),bgMagenta:init(45,49),bgCyan:init(46,49),bgWhite:init(47,49),blackBright:init(90,39),redBright:init(91,39),greenBright:init(92,39),yellowBright:init(93,39),blueBright:init(94,39),magentaBright:init(95,39),cyanBright:init(96,39),whiteBright:init(97,39),bgBlackBright:init(100,49),bgRedBright:init(101,49),bgGreenBright:init(102,49),bgYellowBright:init(103,49),bgBlueBright:init(104,49),bgMagentaBright:init(105,49),bgCyanBright:init(106,49),bgWhiteBright:init(107,49)},createColors=({useColor:s=isColorSupported}={})=>s?colors:Object.keys(colors).reduce((e,t)=>({...e,[t]:String}),{});createColors();var rfdc_1=rfdc;function copyBuffer(s){return s instanceof Buffer?Buffer.from(s):new s.constructor(s.buffer.slice(),s.byteOffset,s.length)}function rfdc(s){if(s=s||{},s.circles)return rfdcCircles(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]=copyBuffer(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]=copyBuffer(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]=copyBuffer(a):i[o]=n(a)}return i}}function rfdcCircles(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]=copyBuffer(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]=copyBuffer(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]=copyBuffer(c);else{var h=e.indexOf(c);h!==-1?a[l]=t[h]:a[l]=i(c)}}return e.pop(),t.pop(),a}}const rfdc$1=getDefaultExportFromCjs(rfdc_1);var __defProp=Object.defineProperty,__name=(s,e)=>__defProp(s,"name",{value:e,configurable:!0}),ANSI_ESCAPE="\x1B[",ANSI_ESCAPE_CODES={CURSOR_HIDE:ANSI_ESCAPE+"?25l",CURSOR_SHOW:ANSI_ESCAPE+"?25h"},ListrTaskState=(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))(ListrTaskState||{}),EventManager=(re=class{constructor(){v(this,"emitter",new EventEmitter)}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()}},__name(re,"EventManager"),re);ie=class{},__name(ie,"BaseEventMap");function isObservable(s){return!!s&&typeof s.lift=="function"&&typeof s.subscribe=="function"}__name(isObservable,"isObservable");function isUnicodeSupported(){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"}__name(isUnicodeSupported,"isUnicodeSupported");var CLEAR_LINE_REGEX="(?:\\u001b|\\u009b)\\[[\\=><~/#&.:=?%@~_-]*[0-9]*[\\a-ln-tqyz=><~/#&.:=?%@~_-]+",BELL_REGEX=/\u0007/;function cleanseAnsi(s){return String(s).replace(new RegExp(CLEAR_LINE_REGEX,"gmi"),"").replace(new RegExp(BELL_REGEX,"gmi"),"").trim()}__name(cleanseAnsi,"cleanseAnsi");var color=createColors();function indent(s,e){return s.replace(/^(?!\s*$)/gm," ".repeat(e))}__name(indent,"indent");var FIGURES_MAIN={warning:"\u26A0",cross:"\u2716",arrowDown:"\u2193",tick:"\u2714",arrowRight:"\u2192",pointer:"\u276F",checkboxOn:"\u2612",arrowLeft:"\u2190",squareSmallFilled:"\u25FC",pointerSmall:"\u203A"},FIGURES_FALLBACK={...FIGURES_MAIN,warning:"\u203C",cross:"\xD7",tick:"\u221A",pointer:">",checkboxOn:"[\xD7]",squareSmallFilled:"\u25A0"},figures=isUnicodeSupported()?FIGURES_MAIN:FIGURES_FALLBACK;function splat(s,...e){return require$$0$1.format(String(s),...e)}__name(splat,"splat");var LISTR_LOGGER_STYLE={icon:{STARTED:figures.pointer,FAILED:figures.cross,SKIPPED:figures.arrowDown,COMPLETED:figures.tick,OUTPUT:figures.pointerSmall,TITLE:figures.arrowRight,RETRY:figures.warning,ROLLBACK:figures.arrowLeft,PAUSED:figures.squareSmallFilled},color:{STARTED:color.yellow,FAILED:color.red,SKIPPED:color.yellow,COMPLETED:color.green,RETRY:color.yellowBright,ROLLBACK:color.redBright,PAUSED:color.yellowBright}},LISTR_LOGGER_STDERR_LEVELS=["RETRY","ROLLBACK","FAILED"],ListrLogger=(oe=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 ProcessOutput}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:splat(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(require$$0.EOL).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(require$$0.EOL),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()===""?"":" "}},__name(oe,"ListrLogger"),oe),ProcessOutputBuffer=(ae=class{constructor(e){v(this,"buffer",[]);v(this,"decoder",new string_decoder.StringDecoder);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=[]}},__name(ae,"ProcessOutputBuffer"),ae),ProcessOutputStream=(le=class{constructor(e){v(this,"method");v(this,"buffer");this.stream=e,this.method=e.write,this.buffer=new ProcessOutputBuffer({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)}},__name(le,"ProcessOutputStream"),le),ProcessOutput=(ce=class{constructor(e,t,n){v(this,"stream");v(this,"active");this.options=n,this.stream={stdout:new ProcessOutputStream(e??process.stdout),stderr:new ProcessOutputStream(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(ANSI_ESCAPE_CODES.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:cleanseAnsi(t.entry)})).filter(t=>t.entry);e.length>0&&(this.options.leaveEmptyLine&&this.stdout.write(require$$0.EOL),e.forEach(t=>{(t.stream??this.stdout).write(t.entry+require$$0.EOL)})),this.stream.stdout.write(ANSI_ESCAPE_CODES.CURSOR_SHOW),this.active=!1}toStdout(e,t=!0){return t&&(e=e+require$$0.EOL),this.stream.stdout.write(e)}toStderr(e,t=!0){return t&&(e=e+require$$0.EOL),this.stream.stderr.write(e)}},__name(ce,"ProcessOutput"),ce);function createWritable(s){const e=new stream.Writable;return e.write=t=>(s(t.toString()),!0),e}__name(createWritable,"createWritable"),ue=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 PromptError("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)}},__name(ue,"ListrPromptAdapter");var Spinner=(fe=class{constructor(){v(this,"spinner",isUnicodeSupported()?["\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)}},__name(fe,"Spinner"),fe),LISTR_DEFAULT_RENDERER_STYLE={icon:{SKIPPED_WITH_COLLAPSE:figures.arrowDown,SKIPPED_WITHOUT_COLLAPSE:figures.warning,OUTPUT:figures.pointerSmall,OUTPUT_WITH_BOTTOMBAR:figures.pointerSmall,PENDING:figures.pointer,COMPLETED:figures.tick,COMPLETED_WITH_FAILED_SUBTASKS:figures.warning,COMPLETED_WITH_SISTER_TASKS_FAILED:figures.squareSmallFilled,RETRY:figures.warning,ROLLING_BACK:figures.warning,ROLLED_BACK:figures.arrowLeft,FAILED:figures.cross,FAILED_WITH_SUBTASKS:figures.pointer,WAITING:figures.squareSmallFilled,PAUSED:figures.squareSmallFilled},color:{SKIPPED_WITH_COLLAPSE:color.yellow,SKIPPED_WITHOUT_COLLAPSE:color.yellow,PENDING:color.yellow,COMPLETED:color.green,COMPLETED_WITH_FAILED_SUBTASKS:color.yellow,COMPLETED_WITH_SISTER_TASKS_FAILED:color.red,RETRY:color.yellowBright,ROLLING_BACK:color.redBright,ROLLED_BACK:color.redBright,FAILED:color.red,FAILED_WITH_SUBTASKS:color.red,WAITING:color.dim,PAUSED:color.yellowBright}};function parseTimer(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}__name(parseTimer,"parseTimer");var PRESET_TIMER={condition:!0,field:parseTimer,format:()=>color.dim};function parseTimestamp(){const s=new Date;return String(s.getHours()).padStart(2,"0")+":"+String(s.getMinutes()).padStart(2,"0")+":"+String(s.getSeconds()).padStart(2,"0")}__name(parseTimestamp,"parseTimestamp");var DefaultRenderer=(z=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={...z.rendererOptions,...this.options,icon:{...LISTR_DEFAULT_RENDERER_STYLE.icon,...t?.icon??{}},color:{...LISTR_DEFAULT_RENDERER_STYLE.color,...t?.color??{}}},this.spinner=this.options.spinner??new Spinner,this.logger=this.options.logger??new ListrLogger({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.cjs"),{default:t}=await import("./index3.cjs"),{default:n}=await import("./index4.cjs");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(require$$0.EOL)}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(require$$0.EOL).map((o,a)=>this.truncate(this.indent(o,a),i));break;case"wrap":r=this.wrap(e,i,{hard:!0}).split(require$$0.EOL).map((o,a)=>this.indent(o,a));break;default:throw new ListrRendererError("Format option for the renderer is wrong.")}return this.options.removeEmptyLines&&(r=r.filter(Boolean)),r.map(o=>indent(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 ListrRendererError("Only one prompt can be active at the given time, please re-evaluate your task design.");this.activePrompt||(n.on("PROMPT",a=>{const l=cleanseAnsi(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:()=>color.dim}),this.style(n),t)):n.isRetrying()?o.push(...this.format(this.logger.suffix(n.title,{field:`RETRY:${n.message.retry.count}`,format:()=>color.yellow,condition:r.suffixRetries}),this.style(n),t)):n.isCompleted()&&n.hasTitle()&&assertFunctionOrSelf(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,{...z.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 ProcessOutputBuffer({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(require$$0.EOL))}),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 ProcessOutputBuffer({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=cleanseAnsi(r)),this.format(r,this.style(e,!0),t+1))}indent(e,t){return t>0?indent(e.trim(),this.options.indentation):e.trim()}},__name(z,"DefaultRenderer"),v(z,"nonTTY",!1),v(z,"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:{...PRESET_TIMER,format:()=>color.yellowBright}}),v(z,"rendererTaskOptions",{outputBar:!0}),z),SilentRenderer=(ee=class{constructor(e,t){this.tasks=e,this.options=t}render(){}end(){}},__name(ee,"SilentRenderer"),v(ee,"nonTTY",!0),v(ee,"rendererOptions"),v(ee,"rendererTaskOptions"),ee),SimpleRenderer=(Q=class{constructor(e,t){v(this,"logger");v(this,"cache",{rendererOptions:new Map,rendererTaskOptions:new Map});this.tasks=e,this.options=t,this.options={...Q.rendererOptions,...t,icon:{...LISTR_LOGGER_STYLE.icon,...t?.icon??{}},color:{...LISTR_LOGGER_STYLE.color,...t?.color??{}}},this.logger=this.options.logger??new ListrLogger({useIcons:!0,toStderr:LISTR_LOGGER_STDERR_LEVELS}),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:()=>color.red}});else if(i.skip)this.logger.log("SKIPPED",t.title,{suffix:{field:`SKIPPED: ${i.skip}`,format:()=>color.yellow}});else if(i.rollback)this.logger.log("ROLLBACK",t.title,{suffix:{field:`ROLLBACK: ${i.rollback}`,format:()=>color.red}});else if(i.retry)this.logger.log("RETRY",t.title,{suffix:{field:`RETRY:${i.retry.count}`,format:()=>color.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,{...Q.rendererTaskOptions,timer:t.timer,...e.rendererTaskOptions})}reset(e){this.cache.rendererOptions.delete(e.id),this.cache.rendererTaskOptions.delete(e.id)}},__name(Q,"SimpleRenderer"),v(Q,"nonTTY",!0),v(Q,"rendererOptions",{pausedTimer:{...PRESET_TIMER,field:e=>`PAUSED:${e}`,format:()=>color.yellowBright}}),v(Q,"rendererTaskOptions",{}),Q),TestRendererSerializer=(he=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}},__name(he,"TestRendererSerializer"),he),TestRenderer=(J=class{constructor(e,t){v(this,"logger");v(this,"serializer");this.tasks=e,this.options=t,this.options={...J.rendererOptions,...this.options},this.logger=this.options.logger??new ListrLogger({useIcons:!1}),this.serializer=new TestRendererSerializer(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)}})})}},__name(J,"TestRenderer"),v(J,"nonTTY",!0),v(J,"rendererOptions",{subtasks:!0,state:Object.values(ListrTaskState),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(J,"rendererTaskOptions"),J),VerboseRenderer=(X=class{constructor(e,t){v(this,"logger");v(this,"cache",{rendererOptions:new Map,rendererTaskOptions:new Map});this.tasks=e,this.options=t,this.options={...X.rendererOptions,...this.options,icon:{...LISTR_LOGGER_STYLE.icon,...t?.icon??{}},color:{...LISTR_LOGGER_STYLE.color,...t?.color??{}}},this.logger=this.options.logger??new ListrLogger({useIcons:!1,toStderr:LISTR_LOGGER_STDERR_LEVELS}),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=cleanseAnsi(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,{...X.rendererTaskOptions,timer:t.timer,...e.rendererTaskOptions})}reset(e){this.cache.rendererOptions.delete(e.id),this.cache.rendererTaskOptions.delete(e.id)}},__name(X,"VerboseRenderer"),v(X,"nonTTY",!0),v(X,"rendererOptions",{logTitleChange:!1,pausedTimer:{...PRESET_TIMER,format:()=>color.yellowBright}}),v(X,"rendererTaskOptions"),X),RENDERERS={default:DefaultRenderer,simple:SimpleRenderer,verbose:VerboseRenderer,test:TestRenderer,silent:SilentRenderer};function isRendererSupported(s){return process.stdout.isTTY===!0||s.nonTTY===!0}__name(isRendererSupported,"isRendererSupported");function getRendererClass(s){return typeof s=="string"?RENDERERS[s]??RENDERERS.default:typeof s=="function"?s:RENDERERS.default}__name(getRendererClass,"getRendererClass");function getRenderer$1(s){if(assertFunctionOrSelf(s?.silentRendererCondition))return{renderer:getRendererClass("silent"),selection:"SILENT"};const e={renderer:getRendererClass(s.renderer),options:s.rendererOptions,selection:"PRIMARY"};return!isRendererSupported(e.renderer)||assertFunctionOrSelf(s?.fallbackRendererCondition)?{renderer:getRendererClass(s.fallbackRenderer),options:s.fallbackRendererOptions,selection:"SECONDARY"}:e}__name(getRenderer$1,"getRenderer");function assertFunctionOrSelf(s,...e){return typeof s=="function"?s(...e):s}__name(assertFunctionOrSelf,"assertFunctionOrSelf");var clone=rfdc$1({circles:!0});function cloneObject(s){return clone(s)}__name(cloneObject,"cloneObject");var Concurrency=(pe=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=__name(()=>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=__name(()=>{this.count--,this.flush()},"cleanup");return t.then(n,()=>{this.queue.clear()}),t}},__name(pe,"Concurrency"),pe);function delay(s){return new Promise(e=>{setTimeout(e,s)})}__name(delay,"delay");var ListrError=(de=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=cloneObject(r),this.ctx=cloneObject(r.listr.ctx)),this.stack=t?.stack}},__name(de,"ListrError"),de),ListrRendererError=(ge=class extends Error{},__name(ge,"ListrRendererError"),ge),PromptError=(me=class extends Error{},__name(me,"PromptError"),me),TaskWrapper=(ye=class{constructor(e){this.task=e}get title(){return this.task.title}set title(e){e=Array.isArray(e)?e:[e],this.task.title$=splat(e.shift(),...e)}get output(){return this.task.output}set output(e){e=Array.isArray(e)?e:[e],this.task.output$=splat(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 Listr(n,t,this.task)}report(e,t){this.task.options.collectErrors!==!1&&this.task.listr.errors.push(new ListrError(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?splat(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 createWritable(t=>{switch(e){case"PROMPT":this.promptOutput=t;break;default:this.output=t}})}run(e){return this.task.run(e,this)}},__name(ye,"TaskWrapper"),ye),ListrTaskEventManager=(be=class extends EventManager{},__name(be,"ListrTaskEventManager"),be),Task=(we=class extends ListrTaskEventManager{constructor(t,n,r,i,o){super();v(this,"id",crypto.randomUUID());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=splat(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),cleanseAnsi(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 assertFunctionOrSelf(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 delay(t),this.state$=n,this.message$={paused:null}}async run(t,n){const r=__name(a=>(a instanceof Listr?(a.options={...this.options,...a.options},a.rendererClass=getRendererClass("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 stream.Readable?a=new Promise((l,c)=>{a.on("data",h=>{this.output$=h.toString()}),a.on("error",h=>c(h)),a.on("end",()=>l(null))}):isObservable(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 assertFunctionOrSelf(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 PromptError&&(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 assertFunctionOrSelf(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()}},__name(we,"Task"),we),ListrEventManager=(Ee=class extends EventManager{},__name(Ee,"ListrEventManager"),Ee),Listr=(Se=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 Concurrency({concurrency:this.options.concurrent}),n&&(this.path=[...n.listr.path,n.title],this.errors=n.listr.errors),this.parentTask?.listr.events instanceof ListrEventManager?this.events=this.parentTask.listr.events:this.events=new ListrEventManager;const r=getRenderer$1({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 Task(this,t,this.options,this.rendererClassOptions,n)})}async runTask(e){if(await e.check(this.ctx))return new TaskWrapper(e).run(this.ctx)}},__name(Se,"Listr"),Se);const info=chalk$1.blue(figures.arrowRight),error=chalk$1.redBright(figures.cross),warning=chalk$1.yellow(figures.warning),configurationError=(s,e,t)=>`${chalk$1.redBright(`${error} Validation Error:`)}
9
+ `);return i!==-1&&(e=stringEncaseCRLFWithFirstIndex(e,r,n,i)),n+e+r};Object.defineProperties(createChalk.prototype,styles);const chalk=createChalk();createChalk({level:stderrColor?stderrColor.level:0});const chalk$1=chalk;var eventemitter3={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})(eventemitter3);var eventemitter3Exports=eventemitter3.exports;const EventEmitter=getDefaultExportFromCjs(eventemitter3Exports),{env={},argv=[],platform:platform$1=""}=typeof process>"u"?{}:process,isDisabled="NO_COLOR"in env||argv.includes("--no-color"),isForced="FORCE_COLOR"in env||argv.includes("--color"),isWindows=platform$1==="win32",isDumbTerminal=env.TERM==="dumb",isCompatibleTerminal=tty__namespace&&tty__namespace.isatty&&tty__namespace.isatty(1)&&env.TERM&&!isDumbTerminal,isCI="CI"in env&&("GITHUB_ACTIONS"in env||"GITLAB_CI"in env||"CIRCLECI"in env),isColorSupported=!isDisabled&&(isForced||isWindows&&!isDumbTerminal||isCompatibleTerminal||isCI),replaceClose=(s,e,t,n,r=e.substring(0,s)+n,i=e.substring(s+t.length),o=i.indexOf(t))=>r+(o<0?i:replaceClose(o,i,t,n)),clearBleed=(s,e,t,n,r)=>s<0?t+e+n:t+replaceClose(s,e,n,r)+n,filterEmpty=(s,e,t=s,n=s.length+1)=>r=>r||!(r===""||r===void 0)?clearBleed((""+r).indexOf(e,n),r,s,e,t):"",init=(s,e,t)=>filterEmpty(`\x1B[${s}m`,`\x1B[${e}m`,t),colors={reset:init(0,0),bold:init(1,22,"\x1B[22m\x1B[1m"),dim:init(2,22,"\x1B[22m\x1B[2m"),italic:init(3,23),underline:init(4,24),inverse:init(7,27),hidden:init(8,28),strikethrough:init(9,29),black:init(30,39),red:init(31,39),green:init(32,39),yellow:init(33,39),blue:init(34,39),magenta:init(35,39),cyan:init(36,39),white:init(37,39),gray:init(90,39),bgBlack:init(40,49),bgRed:init(41,49),bgGreen:init(42,49),bgYellow:init(43,49),bgBlue:init(44,49),bgMagenta:init(45,49),bgCyan:init(46,49),bgWhite:init(47,49),blackBright:init(90,39),redBright:init(91,39),greenBright:init(92,39),yellowBright:init(93,39),blueBright:init(94,39),magentaBright:init(95,39),cyanBright:init(96,39),whiteBright:init(97,39),bgBlackBright:init(100,49),bgRedBright:init(101,49),bgGreenBright:init(102,49),bgYellowBright:init(103,49),bgBlueBright:init(104,49),bgMagentaBright:init(105,49),bgCyanBright:init(106,49),bgWhiteBright:init(107,49)},createColors=({useColor:s=isColorSupported}={})=>s?colors:Object.keys(colors).reduce((e,t)=>({...e,[t]:String}),{});createColors();var rfdc_1=rfdc;function copyBuffer(s){return s instanceof Buffer?Buffer.from(s):new s.constructor(s.buffer.slice(),s.byteOffset,s.length)}function rfdc(s){if(s=s||{},s.circles)return rfdcCircles(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]=copyBuffer(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]=copyBuffer(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]=copyBuffer(a):i[o]=n(a)}return i}}function rfdcCircles(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]=copyBuffer(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]=copyBuffer(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]=copyBuffer(c);else{var f=e.indexOf(c);f!==-1?a[l]=t[f]:a[l]=i(c)}}return e.pop(),t.pop(),a}}const rfdc$1=getDefaultExportFromCjs(rfdc_1);var __defProp=Object.defineProperty,__name=(s,e)=>__defProp(s,"name",{value:e,configurable:!0}),ANSI_ESCAPE="\x1B[",ANSI_ESCAPE_CODES={CURSOR_HIDE:ANSI_ESCAPE+"?25l",CURSOR_SHOW:ANSI_ESCAPE+"?25h"},ListrTaskState=(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))(ListrTaskState||{}),EventManager=(re=class{constructor(){v(this,"emitter",new EventEmitter)}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()}},__name(re,"EventManager"),re);ie=class{},__name(ie,"BaseEventMap");function isObservable(s){return!!s&&typeof s.lift=="function"&&typeof s.subscribe=="function"}__name(isObservable,"isObservable");function isUnicodeSupported(){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"}__name(isUnicodeSupported,"isUnicodeSupported");var CLEAR_LINE_REGEX="(?:\\u001b|\\u009b)\\[[\\=><~/#&.:=?%@~_-]*[0-9]*[\\a-ln-tqyz=><~/#&.:=?%@~_-]+",BELL_REGEX=/\u0007/;function cleanseAnsi(s){return String(s).replace(new RegExp(CLEAR_LINE_REGEX,"gmi"),"").replace(new RegExp(BELL_REGEX,"gmi"),"").trim()}__name(cleanseAnsi,"cleanseAnsi");var color=createColors();function indent(s,e){return s.replace(/^(?!\s*$)/gm," ".repeat(e))}__name(indent,"indent");var FIGURES_MAIN={warning:"\u26A0",cross:"\u2716",arrowDown:"\u2193",tick:"\u2714",arrowRight:"\u2192",pointer:"\u276F",checkboxOn:"\u2612",arrowLeft:"\u2190",squareSmallFilled:"\u25FC",pointerSmall:"\u203A"},FIGURES_FALLBACK={...FIGURES_MAIN,warning:"\u203C",cross:"\xD7",tick:"\u221A",pointer:">",checkboxOn:"[\xD7]",squareSmallFilled:"\u25A0"},figures=isUnicodeSupported()?FIGURES_MAIN:FIGURES_FALLBACK;function splat(s,...e){return require$$0$1.format(String(s),...e)}__name(splat,"splat");var LISTR_LOGGER_STYLE={icon:{STARTED:figures.pointer,FAILED:figures.cross,SKIPPED:figures.arrowDown,COMPLETED:figures.tick,OUTPUT:figures.pointerSmall,TITLE:figures.arrowRight,RETRY:figures.warning,ROLLBACK:figures.arrowLeft,PAUSED:figures.squareSmallFilled},color:{STARTED:color.yellow,FAILED:color.red,SKIPPED:color.yellow,COMPLETED:color.green,RETRY:color.yellowBright,ROLLBACK:color.redBright,PAUSED:color.yellowBright}},LISTR_LOGGER_STDERR_LEVELS=["RETRY","ROLLBACK","FAILED"],ListrLogger=(oe=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 ProcessOutput}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:splat(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(require$$0.EOL).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(require$$0.EOL),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()===""?"":" "}},__name(oe,"ListrLogger"),oe),ProcessOutputBuffer=(ae=class{constructor(e){v(this,"buffer",[]);v(this,"decoder",new string_decoder.StringDecoder);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=[]}},__name(ae,"ProcessOutputBuffer"),ae),ProcessOutputStream=(le=class{constructor(e){v(this,"method");v(this,"buffer");this.stream=e,this.method=e.write,this.buffer=new ProcessOutputBuffer({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)}},__name(le,"ProcessOutputStream"),le),ProcessOutput=(ce=class{constructor(e,t,n){v(this,"stream");v(this,"active");this.options=n,this.stream={stdout:new ProcessOutputStream(e??process.stdout),stderr:new ProcessOutputStream(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(ANSI_ESCAPE_CODES.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:cleanseAnsi(t.entry)})).filter(t=>t.entry);e.length>0&&(this.options.leaveEmptyLine&&this.stdout.write(require$$0.EOL),e.forEach(t=>{(t.stream??this.stdout).write(t.entry+require$$0.EOL)})),this.stream.stdout.write(ANSI_ESCAPE_CODES.CURSOR_SHOW),this.active=!1}toStdout(e,t=!0){return t&&(e=e+require$$0.EOL),this.stream.stdout.write(e)}toStderr(e,t=!0){return t&&(e=e+require$$0.EOL),this.stream.stderr.write(e)}},__name(ce,"ProcessOutput"),ce);function createWritable(s){const e=new stream.Writable;return e.write=t=>(s(t.toString()),!0),e}__name(createWritable,"createWritable"),ue=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 PromptError("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)}},__name(ue,"ListrPromptAdapter");var Spinner=(fe=class{constructor(){v(this,"spinner",isUnicodeSupported()?["\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)}},__name(fe,"Spinner"),fe),LISTR_DEFAULT_RENDERER_STYLE={icon:{SKIPPED_WITH_COLLAPSE:figures.arrowDown,SKIPPED_WITHOUT_COLLAPSE:figures.warning,OUTPUT:figures.pointerSmall,OUTPUT_WITH_BOTTOMBAR:figures.pointerSmall,PENDING:figures.pointer,COMPLETED:figures.tick,COMPLETED_WITH_FAILED_SUBTASKS:figures.warning,COMPLETED_WITH_SISTER_TASKS_FAILED:figures.squareSmallFilled,RETRY:figures.warning,ROLLING_BACK:figures.warning,ROLLED_BACK:figures.arrowLeft,FAILED:figures.cross,FAILED_WITH_SUBTASKS:figures.pointer,WAITING:figures.squareSmallFilled,PAUSED:figures.squareSmallFilled},color:{SKIPPED_WITH_COLLAPSE:color.yellow,SKIPPED_WITHOUT_COLLAPSE:color.yellow,PENDING:color.yellow,COMPLETED:color.green,COMPLETED_WITH_FAILED_SUBTASKS:color.yellow,COMPLETED_WITH_SISTER_TASKS_FAILED:color.red,RETRY:color.yellowBright,ROLLING_BACK:color.redBright,ROLLED_BACK:color.redBright,FAILED:color.red,FAILED_WITH_SUBTASKS:color.red,WAITING:color.dim,PAUSED:color.yellowBright}};function parseTimer(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}__name(parseTimer,"parseTimer");var PRESET_TIMER={condition:!0,field:parseTimer,format:()=>color.dim};function parseTimestamp(){const s=new Date;return String(s.getHours()).padStart(2,"0")+":"+String(s.getMinutes()).padStart(2,"0")+":"+String(s.getSeconds()).padStart(2,"0")}__name(parseTimestamp,"parseTimestamp");var DefaultRenderer=(z=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={...z.rendererOptions,...this.options,icon:{...LISTR_DEFAULT_RENDERER_STYLE.icon,...t?.icon??{}},color:{...LISTR_DEFAULT_RENDERER_STYLE.color,...t?.color??{}}},this.spinner=this.options.spinner??new Spinner,this.logger=this.options.logger??new ListrLogger({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.cjs"),{default:t}=await import("./index3.cjs"),{default:n}=await import("./index4.cjs");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(require$$0.EOL)}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(require$$0.EOL).map((o,a)=>this.truncate(this.indent(o,a),i));break;case"wrap":r=this.wrap(e,i,{hard:!0}).split(require$$0.EOL).map((o,a)=>this.indent(o,a));break;default:throw new ListrRendererError("Format option for the renderer is wrong.")}return this.options.removeEmptyLines&&(r=r.filter(Boolean)),r.map(o=>indent(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 ListrRendererError("Only one prompt can be active at the given time, please re-evaluate your task design.");this.activePrompt||(n.on("PROMPT",a=>{const l=cleanseAnsi(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:()=>color.dim}),this.style(n),t)):n.isRetrying()?o.push(...this.format(this.logger.suffix(n.title,{field:`RETRY:${n.message.retry.count}`,format:()=>color.yellow,condition:r.suffixRetries}),this.style(n),t)):n.isCompleted()&&n.hasTitle()&&assertFunctionOrSelf(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,{...z.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 ProcessOutputBuffer({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(require$$0.EOL))}),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 ProcessOutputBuffer({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=cleanseAnsi(r)),this.format(r,this.style(e,!0),t+1))}indent(e,t){return t>0?indent(e.trim(),this.options.indentation):e.trim()}},__name(z,"DefaultRenderer"),v(z,"nonTTY",!1),v(z,"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:{...PRESET_TIMER,format:()=>color.yellowBright}}),v(z,"rendererTaskOptions",{outputBar:!0}),z),SilentRenderer=(ee=class{constructor(e,t){this.tasks=e,this.options=t}render(){}end(){}},__name(ee,"SilentRenderer"),v(ee,"nonTTY",!0),v(ee,"rendererOptions"),v(ee,"rendererTaskOptions"),ee),SimpleRenderer=(Q=class{constructor(e,t){v(this,"logger");v(this,"cache",{rendererOptions:new Map,rendererTaskOptions:new Map});this.tasks=e,this.options=t,this.options={...Q.rendererOptions,...t,icon:{...LISTR_LOGGER_STYLE.icon,...t?.icon??{}},color:{...LISTR_LOGGER_STYLE.color,...t?.color??{}}},this.logger=this.options.logger??new ListrLogger({useIcons:!0,toStderr:LISTR_LOGGER_STDERR_LEVELS}),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:()=>color.red}});else if(i.skip)this.logger.log("SKIPPED",t.title,{suffix:{field:`SKIPPED: ${i.skip}`,format:()=>color.yellow}});else if(i.rollback)this.logger.log("ROLLBACK",t.title,{suffix:{field:`ROLLBACK: ${i.rollback}`,format:()=>color.red}});else if(i.retry)this.logger.log("RETRY",t.title,{suffix:{field:`RETRY:${i.retry.count}`,format:()=>color.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,{...Q.rendererTaskOptions,timer:t.timer,...e.rendererTaskOptions})}reset(e){this.cache.rendererOptions.delete(e.id),this.cache.rendererTaskOptions.delete(e.id)}},__name(Q,"SimpleRenderer"),v(Q,"nonTTY",!0),v(Q,"rendererOptions",{pausedTimer:{...PRESET_TIMER,field:e=>`PAUSED:${e}`,format:()=>color.yellowBright}}),v(Q,"rendererTaskOptions",{}),Q),TestRendererSerializer=(he=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}},__name(he,"TestRendererSerializer"),he),TestRenderer=(J=class{constructor(e,t){v(this,"logger");v(this,"serializer");this.tasks=e,this.options=t,this.options={...J.rendererOptions,...this.options},this.logger=this.options.logger??new ListrLogger({useIcons:!1}),this.serializer=new TestRendererSerializer(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)}})})}},__name(J,"TestRenderer"),v(J,"nonTTY",!0),v(J,"rendererOptions",{subtasks:!0,state:Object.values(ListrTaskState),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(J,"rendererTaskOptions"),J),VerboseRenderer=(X=class{constructor(e,t){v(this,"logger");v(this,"cache",{rendererOptions:new Map,rendererTaskOptions:new Map});this.tasks=e,this.options=t,this.options={...X.rendererOptions,...this.options,icon:{...LISTR_LOGGER_STYLE.icon,...t?.icon??{}},color:{...LISTR_LOGGER_STYLE.color,...t?.color??{}}},this.logger=this.options.logger??new ListrLogger({useIcons:!1,toStderr:LISTR_LOGGER_STDERR_LEVELS}),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=cleanseAnsi(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,{...X.rendererTaskOptions,timer:t.timer,...e.rendererTaskOptions})}reset(e){this.cache.rendererOptions.delete(e.id),this.cache.rendererTaskOptions.delete(e.id)}},__name(X,"VerboseRenderer"),v(X,"nonTTY",!0),v(X,"rendererOptions",{logTitleChange:!1,pausedTimer:{...PRESET_TIMER,format:()=>color.yellowBright}}),v(X,"rendererTaskOptions"),X),RENDERERS={default:DefaultRenderer,simple:SimpleRenderer,verbose:VerboseRenderer,test:TestRenderer,silent:SilentRenderer};function isRendererSupported(s){return process.stdout.isTTY===!0||s.nonTTY===!0}__name(isRendererSupported,"isRendererSupported");function getRendererClass(s){return typeof s=="string"?RENDERERS[s]??RENDERERS.default:typeof s=="function"?s:RENDERERS.default}__name(getRendererClass,"getRendererClass");function getRenderer$1(s){if(assertFunctionOrSelf(s?.silentRendererCondition))return{renderer:getRendererClass("silent"),selection:"SILENT"};const e={renderer:getRendererClass(s.renderer),options:s.rendererOptions,selection:"PRIMARY"};return!isRendererSupported(e.renderer)||assertFunctionOrSelf(s?.fallbackRendererCondition)?{renderer:getRendererClass(s.fallbackRenderer),options:s.fallbackRendererOptions,selection:"SECONDARY"}:e}__name(getRenderer$1,"getRenderer");function assertFunctionOrSelf(s,...e){return typeof s=="function"?s(...e):s}__name(assertFunctionOrSelf,"assertFunctionOrSelf");var clone=rfdc$1({circles:!0});function cloneObject(s){return clone(s)}__name(cloneObject,"cloneObject");var Concurrency=(pe=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=__name(()=>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=__name(()=>{this.count--,this.flush()},"cleanup");return t.then(n,()=>{this.queue.clear()}),t}},__name(pe,"Concurrency"),pe);function delay(s){return new Promise(e=>{setTimeout(e,s)})}__name(delay,"delay");var ListrError=(de=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=cloneObject(r),this.ctx=cloneObject(r.listr.ctx)),this.stack=t?.stack}},__name(de,"ListrError"),de),ListrRendererError=(ge=class extends Error{},__name(ge,"ListrRendererError"),ge),PromptError=(me=class extends Error{},__name(me,"PromptError"),me),TaskWrapper=(ye=class{constructor(e){this.task=e}get title(){return this.task.title}set title(e){e=Array.isArray(e)?e:[e],this.task.title$=splat(e.shift(),...e)}get output(){return this.task.output}set output(e){e=Array.isArray(e)?e:[e],this.task.output$=splat(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 Listr(n,t,this.task)}report(e,t){this.task.options.collectErrors!==!1&&this.task.listr.errors.push(new ListrError(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?splat(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 createWritable(t=>{switch(e){case"PROMPT":this.promptOutput=t;break;default:this.output=t}})}run(e){return this.task.run(e,this)}},__name(ye,"TaskWrapper"),ye),ListrTaskEventManager=(be=class extends EventManager{},__name(be,"ListrTaskEventManager"),be),Task=(we=class extends ListrTaskEventManager{constructor(t,n,r,i,o){super();v(this,"id",crypto.randomUUID());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=splat(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),cleanseAnsi(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 assertFunctionOrSelf(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 delay(t),this.state$=n,this.message$={paused:null}}async run(t,n){const r=__name(a=>(a instanceof Listr?(a.options={...this.options,...a.options},a.rendererClass=getRendererClass("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 stream.Readable?a=new Promise((l,c)=>{a.on("data",f=>{this.output$=f.toString()}),a.on("error",f=>c(f)),a.on("end",()=>l(null))}):isObservable(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 assertFunctionOrSelf(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 PromptError&&(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 assertFunctionOrSelf(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()}},__name(we,"Task"),we),ListrEventManager=(Ee=class extends EventManager{},__name(Ee,"ListrEventManager"),Ee),Listr=(Se=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 Concurrency({concurrency:this.options.concurrent}),n&&(this.path=[...n.listr.path,n.title],this.errors=n.listr.errors),this.parentTask?.listr.events instanceof ListrEventManager?this.events=this.parentTask.listr.events:this.events=new ListrEventManager;const r=getRenderer$1({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 Task(this,t,this.options,this.rendererClassOptions,n)})}async runTask(e){if(await e.check(this.ctx))return new TaskWrapper(e).run(this.ctx)}},__name(Se,"Listr"),Se);const info=chalk$1.blue(figures.arrowRight),error=chalk$1.redBright(figures.cross),warning=chalk$1.yellow(figures.warning),configurationError=(s,e,t)=>`${chalk$1.redBright(`${error} Validation Error:`)}
10
10
 
11
11
  Invalid value for '${chalk$1.bold(s)}': ${chalk$1.bold(node_util.inspect(t))}
12
12
 
@@ -39,29 +39,29 @@ See https://github.com/okonet/lint-staged#command-line-flags`,PREVENTED_EMPTY_CO
39
39
  *
40
40
  * Copyright (c) 2015-present, Jon Schlinkert.
41
41
  * Released under the MIT License.
42
- */const isNumber$1=isNumber$2,toRegexRange$1=(s,e,t)=>{if(isNumber$1(s)===!1)throw new TypeError("toRegexRange: expected the first argument to be a number");if(e===void 0||s===e)return String(s);if(isNumber$1(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(toRegexRange$1.cache.hasOwnProperty(l))return toRegexRange$1.cache[l].result;let c=Math.min(s,e),h=Math.max(s,e);if(Math.abs(c-h)===1){let p=s+"|"+e;return n.capture?`(${p})`:n.wrap===!1?p:`(?:${p})`}let u=hasPadding(s)||hasPadding(e),f={min:s,max:e,a:c,b:h},d=[],m=[];if(u&&(f.isPadded=u,f.maxLen=String(f.max).length),c<0){let p=h<0?Math.abs(h):1;m=splitToPatterns(p,Math.abs(c),f,n),c=f.a=0}return h>=0&&(d=splitToPatterns(c,h,f,n)),f.negatives=m,f.positives=d,f.result=collatePatterns(m,d),n.capture===!0?f.result=`(${f.result})`:n.wrap!==!1&&d.length+m.length>1&&(f.result=`(?:${f.result})`),toRegexRange$1.cache[l]=f,f.result};function collatePatterns(s,e,t){let n=filterPatterns(s,e,"-",!1)||[],r=filterPatterns(e,s,"",!1)||[],i=filterPatterns(s,e,"-?",!0)||[];return n.concat(i).concat(r).join("|")}function splitToRanges(s,e){let t=1,n=1,r=countNines(s,t),i=new Set([e]);for(;s<=r&&r<=e;)i.add(r),t+=1,r=countNines(s,t);for(r=countZeros(e+1,n)-1;s<r&&r<=e;)i.add(r),n+=1,r=countZeros(e+1,n)-1;return i=[...i],i.sort(compare),i}function rangeToPattern(s,e,t){if(s===e)return{pattern:s,count:[],digits:0};let n=zip(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+=toCharacterClass(l,c):o++}return o&&(i+=t.shorthand===!0?"\\d":"[0-9]"),{pattern:i,count:[o],digits:r}}function splitToPatterns(s,e,t,n){let r=splitToRanges(s,e),i=[],o=s,a;for(let l=0;l<r.length;l++){let c=r[l],h=rangeToPattern(String(o),String(c),n),u="";if(!t.isPadded&&a&&a.pattern===h.pattern){a.count.length>1&&a.count.pop(),a.count.push(h.count[0]),a.string=a.pattern+toQuantifier(a.count),o=c+1;continue}t.isPadded&&(u=padZeros(c,t,n)),h.string=u+h.pattern+toQuantifier(h.count),i.push(h),o=c+1,a=h}return i}function filterPatterns(s,e,t,n,r){let i=[];for(let o of s){let{string:a}=o;!n&&!contains(e,"string",a)&&i.push(t+a),n&&contains(e,"string",a)&&i.push(t+a)}return i}function zip(s,e){let t=[];for(let n=0;n<s.length;n++)t.push([s[n],e[n]]);return t}function compare(s,e){return s>e?1:e>s?-1:0}function contains(s,e,t){return s.some(n=>n[e]===t)}function countNines(s,e){return Number(String(s).slice(0,-e)+"9".repeat(e))}function countZeros(s,e){return s-s%Math.pow(10,e)}function toQuantifier(s){let[e=0,t=""]=s;return t||e>1?`{${e+(t?","+t:"")}}`:""}function toCharacterClass(s,e,t){return`[${s}${e-s===1?"":"-"}${e}]`}function hasPadding(s){return/^-?(0+)\d/.test(s)}function padZeros(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}}`}}toRegexRange$1.cache={},toRegexRange$1.clearCache=()=>toRegexRange$1.cache={};var toRegexRange_1=toRegexRange$1;/*!
42
+ */const isNumber$1=isNumber$2,toRegexRange$1=(s,e,t)=>{if(isNumber$1(s)===!1)throw new TypeError("toRegexRange: expected the first argument to be a number");if(e===void 0||s===e)return String(s);if(isNumber$1(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(toRegexRange$1.cache.hasOwnProperty(l))return toRegexRange$1.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=hasPadding(s)||hasPadding(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=splitToPatterns(p,Math.abs(c),h,n),c=h.a=0}return f>=0&&(d=splitToPatterns(c,f,h,n)),h.negatives=m,h.positives=d,h.result=collatePatterns(m,d),n.capture===!0?h.result=`(${h.result})`:n.wrap!==!1&&d.length+m.length>1&&(h.result=`(?:${h.result})`),toRegexRange$1.cache[l]=h,h.result};function collatePatterns(s,e,t){let n=filterPatterns(s,e,"-",!1)||[],r=filterPatterns(e,s,"",!1)||[],i=filterPatterns(s,e,"-?",!0)||[];return n.concat(i).concat(r).join("|")}function splitToRanges(s,e){let t=1,n=1,r=countNines(s,t),i=new Set([e]);for(;s<=r&&r<=e;)i.add(r),t+=1,r=countNines(s,t);for(r=countZeros(e+1,n)-1;s<r&&r<=e;)i.add(r),n+=1,r=countZeros(e+1,n)-1;return i=[...i],i.sort(compare),i}function rangeToPattern(s,e,t){if(s===e)return{pattern:s,count:[],digits:0};let n=zip(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+=toCharacterClass(l,c):o++}return o&&(i+=t.shorthand===!0?"\\d":"[0-9]"),{pattern:i,count:[o],digits:r}}function splitToPatterns(s,e,t,n){let r=splitToRanges(s,e),i=[],o=s,a;for(let l=0;l<r.length;l++){let c=r[l],f=rangeToPattern(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+toQuantifier(a.count),o=c+1;continue}t.isPadded&&(u=padZeros(c,t,n)),f.string=u+f.pattern+toQuantifier(f.count),i.push(f),o=c+1,a=f}return i}function filterPatterns(s,e,t,n,r){let i=[];for(let o of s){let{string:a}=o;!n&&!contains(e,"string",a)&&i.push(t+a),n&&contains(e,"string",a)&&i.push(t+a)}return i}function zip(s,e){let t=[];for(let n=0;n<s.length;n++)t.push([s[n],e[n]]);return t}function compare(s,e){return s>e?1:e>s?-1:0}function contains(s,e,t){return s.some(n=>n[e]===t)}function countNines(s,e){return Number(String(s).slice(0,-e)+"9".repeat(e))}function countZeros(s,e){return s-s%Math.pow(10,e)}function toQuantifier(s){let[e=0,t=""]=s;return t||e>1?`{${e+(t?","+t:"")}}`:""}function toCharacterClass(s,e,t){return`[${s}${e-s===1?"":"-"}${e}]`}function hasPadding(s){return/^-?(0+)\d/.test(s)}function padZeros(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}}`}}toRegexRange$1.cache={},toRegexRange$1.clearCache=()=>toRegexRange$1.cache={};var toRegexRange_1=toRegexRange$1;/*!
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 util$1=require$$0__default$1,toRegexRange=toRegexRange_1,isObject$2=s=>s!==null&&typeof s=="object"&&!Array.isArray(s),transform=s=>e=>s===!0?Number(e):String(e),isValidValue=s=>typeof s=="number"||typeof s=="string"&&s!=="",isNumber=s=>Number.isInteger(+s),zeros=s=>{let e=`${s}`,t=-1;if(e[0]==="-"&&(e=e.slice(1)),e==="0")return!1;for(;e[++t]==="0";);return t>0},stringify$6=(s,e,t)=>typeof s=="string"||typeof e=="string"?!0:t.stringify===!0,pad=(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},toMaxLen=(s,e)=>{let t=s[0]==="-"?"-":"";for(t&&(s=s.slice(1),e--);s.length<e;)s="0"+s;return t?"-"+s:s},toSequence=(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},toRange=(s,e,t,n)=>{if(t)return toRegexRange(s,e,{wrap:!1,...n});let r=String.fromCharCode(s);if(s===e)return r;let i=String.fromCharCode(e);return`[${r}-${i}]`},toRegex=(s,e,t)=>{if(Array.isArray(s)){let n=t.wrap===!0,r=t.capture?"":"?:";return n?`(${r}${s.join("|")})`:s.join("|")}return toRegexRange(s,e,t)},rangeError=(...s)=>new RangeError("Invalid range arguments: "+util$1.inspect(...s)),invalidRange=(s,e,t)=>{if(t.strictRanges===!0)throw rangeError([s,e]);return[]},invalidStep=(s,e)=>{if(e.strictRanges===!0)throw new TypeError(`Expected step "${s}" to be a number`);return[]},fillNumbers=(s,e,t=1,n={})=>{let r=Number(s),i=Number(e);if(!Number.isInteger(r)||!Number.isInteger(i)){if(n.strictRanges===!0)throw rangeError([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 h=zeros(a)||zeros(l)||zeros(c),u=h?Math.max(a.length,l.length,c.length):0,f=h===!1&&stringify$6(s,e,n)===!1,d=n.transform||transform(f);if(n.toRegex&&t===1)return toRange(toMaxLen(s,u),toMaxLen(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(pad(d(r,y),u,f)),r=o?r-t:r+t,y++;return n.toRegex===!0?t>1?toSequence(m,n):toRegex(g,null,{wrap:!1,...n}):g},fillLetters=(s,e,t=1,n={})=>{if(!isNumber(s)&&s.length>1||!isNumber(e)&&e.length>1)return invalidRange(s,e,n);let r=n.transform||(f=>String.fromCharCode(f)),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 toRange(l,c,!1,n);let h=[],u=0;for(;a?i>=o:i<=o;)h.push(r(i,u)),i=a?i-t:i+t,u++;return n.toRegex===!0?toRegex(h,null,{wrap:!1,options:n}):h},fill$2=(s,e,t,n={})=>{if(e==null&&isValidValue(s))return[s];if(!isValidValue(s)||!isValidValue(e))return invalidRange(s,e,n);if(typeof t=="function")return fill$2(s,e,1,{transform:t});if(isObject$2(t))return fill$2(s,e,0,t);let r={...n};return r.capture===!0&&(r.wrap=!0),t=t||r.step||1,isNumber(t)?isNumber(s)&&isNumber(e)?fillNumbers(s,e,t,r):fillLetters(s,e,Math.max(Math.abs(t),1),r):t!=null&&!isObject$2(t)?invalidStep(t,r):fill$2(s,e,1,t)};var fillRange=fill$2;const fill$1=fillRange,utils$6=utils$8,compile$1=(s,e={})=>{let t=(n,r={})=>{let i=utils$6.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 h=utils$6.reduce(n.nodes),u=fill$1(...h,{...e,wrap:!1,toRegex:!0});if(u.length!==0)return h.length>1&&u.length>1?`(${u})`:u}if(n.nodes)for(let h of n.nodes)c+=t(h,n);return c};return t(s)};var compile_1=compile$1;const fill=fillRange,stringify$5=stringify$7,utils$5=utils$8,append=(s="",e="",t=!1)=>{let n=[];if(s=[].concat(s),e=[].concat(e),!e.length)return s;if(!s.length)return t?utils$5.flatten(e).map(r=>`{${r}}`):e;for(let r of s)if(Array.isArray(r))for(let i of r)n.push(append(i,e,t));else for(let i of e)t===!0&&typeof i=="string"&&(i=`{${i}}`),n.push(Array.isArray(i)?append(r,i,t):r+i);return utils$5.flatten(n)},expand$1=(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(append(a.pop(),stringify$5(r,e)));return}if(r.type==="brace"&&r.invalid!==!0&&r.nodes.length===2){a.push(append(a.pop(),["{}"]));return}if(r.nodes&&r.ranges>0){let u=utils$5.reduce(r.nodes);if(utils$5.exceedsLimit(...u,e.step,t))throw new RangeError("expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.");let f=fill(...u,e);f.length===0&&(f=stringify$5(r,e)),a.push(append(a.pop(),f)),r.nodes=[];return}let l=utils$5.encloseBrace(r),c=r.queue,h=r;for(;h.type!=="brace"&&h.type!=="root"&&h.parent;)h=h.parent,c=h.queue;for(let u=0;u<r.nodes.length;u++){let f=r.nodes[u];if(f.type==="comma"&&r.type==="brace"){u===1&&c.push(""),c.push("");continue}if(f.type==="close"){a.push(append(a.pop(),c,l));continue}if(f.value&&f.type!=="open"){c.push(append(c.pop(),f.value));continue}f.nodes&&n(f,r)}return c};return utils$5.flatten(n(s))};var expand_1=expand$1,constants$3={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 stringify$4=stringify$7,{MAX_LENGTH:MAX_LENGTH$1,CHAR_BACKSLASH,CHAR_BACKTICK,CHAR_COMMA:CHAR_COMMA$1,CHAR_DOT:CHAR_DOT$1,CHAR_LEFT_PARENTHESES:CHAR_LEFT_PARENTHESES$1,CHAR_RIGHT_PARENTHESES:CHAR_RIGHT_PARENTHESES$1,CHAR_LEFT_CURLY_BRACE:CHAR_LEFT_CURLY_BRACE$1,CHAR_RIGHT_CURLY_BRACE:CHAR_RIGHT_CURLY_BRACE$1,CHAR_LEFT_SQUARE_BRACKET:CHAR_LEFT_SQUARE_BRACKET$1,CHAR_RIGHT_SQUARE_BRACKET:CHAR_RIGHT_SQUARE_BRACKET$1,CHAR_DOUBLE_QUOTE,CHAR_SINGLE_QUOTE,CHAR_NO_BREAK_SPACE,CHAR_ZERO_WIDTH_NOBREAK_SPACE}=constants$3,parse$4=(s,e={})=>{if(typeof s!="string")throw new TypeError("Expected a string");let t=e||{},n=typeof t.maxLength=="number"?Math.min(MAX_LENGTH$1,t.maxLength):MAX_LENGTH$1;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===CHAR_ZERO_WIDTH_NOBREAK_SPACE||f===CHAR_NO_BREAK_SPACE)){if(f===CHAR_BACKSLASH){m({type:"text",value:(e.keepEscaping?f:"")+d()});continue}if(f===CHAR_RIGHT_SQUARE_BRACKET$1){m({type:"text",value:"\\"+f});continue}if(f===CHAR_LEFT_SQUARE_BRACKET$1){l++;let p;for(;h<c&&(p=d());){if(f+=p,p===CHAR_LEFT_SQUARE_BRACKET$1){l++;continue}if(p===CHAR_BACKSLASH){f+=d();continue}if(p===CHAR_RIGHT_SQUARE_BRACKET$1&&(l--,l===0))break}m({type:"text",value:f});continue}if(f===CHAR_LEFT_PARENTHESES$1){o=m({type:"paren",nodes:[]}),i.push(o),m({type:"text",value:f});continue}if(f===CHAR_RIGHT_PARENTHESES$1){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===CHAR_DOUBLE_QUOTE||f===CHAR_SINGLE_QUOTE||f===CHAR_BACKTICK){let p=f,g;for(e.keepQuotes!==!0&&(f="");h<c&&(g=d());){if(g===CHAR_BACKSLASH){f+=g+d();continue}if(g===p){e.keepQuotes===!0&&(f+=g);break}f+=g}m({type:"text",value:f});continue}if(f===CHAR_LEFT_CURLY_BRACE$1){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===CHAR_RIGHT_CURLY_BRACE$1){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===CHAR_COMMA$1&&u>0){if(o.ranges>0){o.ranges=0;let p=o.nodes.shift();o.nodes=[p,{type:"text",value:stringify$4(o)}]}m({type:"comma",value:f}),o.commas++;continue}if(f===CHAR_DOT$1&&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 parse_1$1=parse$4;const stringify$3=stringify$7,compile=compile_1,expand=expand_1,parse$3=parse_1$1,braces$1=(s,e={})=>{let t=[];if(Array.isArray(s))for(let n of s){let r=braces$1.create(n,e);Array.isArray(r)?t.push(...r):t.push(r)}else t=[].concat(braces$1.create(s,e));return e&&e.expand===!0&&e.nodupes===!0&&(t=[...new Set(t)]),t};braces$1.parse=(s,e={})=>parse$3(s,e),braces$1.stringify=(s,e={})=>stringify$3(typeof s=="string"?braces$1.parse(s,e):s,e),braces$1.compile=(s,e={})=>(typeof s=="string"&&(s=braces$1.parse(s,e)),compile(s,e)),braces$1.expand=(s,e={})=>{typeof s=="string"&&(s=braces$1.parse(s,e));let t=expand(s,e);return e.noempty===!0&&(t=t.filter(Boolean)),e.nodupes===!0&&(t=[...new Set(t)]),t},braces$1.create=(s,e={})=>s===""||s.length<3?[s]:e.expand!==!0?braces$1.compile(s,e):braces$1.expand(s,e);var braces_1=braces$1,utils$4={};const path$1=require$$0__default$2,WIN_SLASH="\\\\/",WIN_NO_SLASH=`[^${WIN_SLASH}]`,DOT_LITERAL="\\.",PLUS_LITERAL="\\+",QMARK_LITERAL="\\?",SLASH_LITERAL="\\/",ONE_CHAR="(?=.)",QMARK="[^/]",END_ANCHOR=`(?:${SLASH_LITERAL}|$)`,START_ANCHOR=`(?:^|${SLASH_LITERAL})`,DOTS_SLASH=`${DOT_LITERAL}{1,2}${END_ANCHOR}`,NO_DOT=`(?!${DOT_LITERAL})`,NO_DOTS=`(?!${START_ANCHOR}${DOTS_SLASH})`,NO_DOT_SLASH=`(?!${DOT_LITERAL}{0,1}${END_ANCHOR})`,NO_DOTS_SLASH=`(?!${DOTS_SLASH})`,QMARK_NO_DOT=`[^.${SLASH_LITERAL}]`,STAR=`${QMARK}*?`,POSIX_CHARS={DOT_LITERAL,PLUS_LITERAL,QMARK_LITERAL,SLASH_LITERAL,ONE_CHAR,QMARK,END_ANCHOR,DOTS_SLASH,NO_DOT,NO_DOTS,NO_DOT_SLASH,NO_DOTS_SLASH,QMARK_NO_DOT,STAR,START_ANCHOR},WINDOWS_CHARS={...POSIX_CHARS,SLASH_LITERAL:`[${WIN_SLASH}]`,QMARK:WIN_NO_SLASH,STAR:`${WIN_NO_SLASH}*?`,DOTS_SLASH:`${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$)`,NO_DOT:`(?!${DOT_LITERAL})`,NO_DOTS:`(?!(?:^|[${WIN_SLASH}])${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,NO_DOT_SLASH:`(?!${DOT_LITERAL}{0,1}(?:[${WIN_SLASH}]|$))`,NO_DOTS_SLASH:`(?!${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,QMARK_NO_DOT:`[^.${WIN_SLASH}]`,START_ANCHOR:`(?:^|[${WIN_SLASH}])`,END_ANCHOR:`(?:[${WIN_SLASH}]|$)`},POSIX_REGEX_SOURCE$1={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 constants$2={MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:POSIX_REGEX_SOURCE$1,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:path$1.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?WINDOWS_CHARS:POSIX_CHARS}};(function(s){const e=require$$0__default$2,t=process.platform==="win32",{REGEX_BACKSLASH:n,REGEX_REMOVE_BACKSLASH:r,REGEX_SPECIAL_CHARS:i,REGEX_SPECIAL_CHARS_GLOBAL:o}=constants$2;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}})(utils$4);const utils$3=utils$4,{CHAR_ASTERISK,CHAR_AT,CHAR_BACKWARD_SLASH,CHAR_COMMA,CHAR_DOT,CHAR_EXCLAMATION_MARK,CHAR_FORWARD_SLASH,CHAR_LEFT_CURLY_BRACE,CHAR_LEFT_PARENTHESES,CHAR_LEFT_SQUARE_BRACKET,CHAR_PLUS,CHAR_QUESTION_MARK,CHAR_RIGHT_CURLY_BRACE,CHAR_RIGHT_PARENTHESES,CHAR_RIGHT_SQUARE_BRACKET}=constants$2,isPathSeparator=s=>s===CHAR_FORWARD_SLASH||s===CHAR_BACKWARD_SLASH,depth=s=>{s.isPrefix!==!0&&(s.depth=s.isGlobstar?1/0:1)},scan$1=(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 F=()=>c>=n,E=()=>l.charCodeAt(c+1),$=()=>(I=_,l.charCodeAt(++c));for(;c<n;){_=$();let B;if(_===CHAR_BACKWARD_SLASH){S=k.backslashes=!0,_=$(),_===CHAR_LEFT_CURLY_BRACE&&(y=!0);continue}if(y===!0||_===CHAR_LEFT_CURLY_BRACE){for(O++;F()!==!0&&(_=$());){if(_===CHAR_BACKWARD_SLASH){S=k.backslashes=!0,$();continue}if(_===CHAR_LEFT_CURLY_BRACE){O++;continue}if(y!==!0&&_===CHAR_DOT&&(_=$())===CHAR_DOT){if(f=k.isBrace=!0,m=k.isGlob=!0,R=!0,r===!0)continue;break}if(y!==!0&&_===CHAR_COMMA){if(f=k.isBrace=!0,m=k.isGlob=!0,R=!0,r===!0)continue;break}if(_===CHAR_RIGHT_CURLY_BRACE&&(O--,O===0)){y=!1,f=k.isBrace=!0,R=!0;break}}if(r===!0)continue;break}if(_===CHAR_FORWARD_SLASH){if(i.push(c),o.push(k),k={value:"",depth:0,isGlob:!1},R===!0)continue;if(I===CHAR_DOT&&c===h+1){h+=2;continue}u=c+1;continue}if(t.noext!==!0&&(_===CHAR_PLUS||_===CHAR_AT||_===CHAR_ASTERISK||_===CHAR_QUESTION_MARK||_===CHAR_EXCLAMATION_MARK)===!0&&E()===CHAR_LEFT_PARENTHESES){if(m=k.isGlob=!0,p=k.isExtglob=!0,R=!0,_===CHAR_EXCLAMATION_MARK&&c===h&&(L=!0),r===!0){for(;F()!==!0&&(_=$());){if(_===CHAR_BACKWARD_SLASH){S=k.backslashes=!0,_=$();continue}if(_===CHAR_RIGHT_PARENTHESES){m=k.isGlob=!0,R=!0;break}}continue}break}if(_===CHAR_ASTERISK){if(I===CHAR_ASTERISK&&(g=k.isGlobstar=!0),m=k.isGlob=!0,R=!0,r===!0)continue;break}if(_===CHAR_QUESTION_MARK){if(m=k.isGlob=!0,R=!0,r===!0)continue;break}if(_===CHAR_LEFT_SQUARE_BRACKET){for(;F()!==!0&&(B=$());){if(B===CHAR_BACKWARD_SLASH){S=k.backslashes=!0,$();continue}if(B===CHAR_RIGHT_SQUARE_BRACKET){d=k.isBracket=!0,m=k.isGlob=!0,R=!0;break}}if(r===!0)continue;break}if(t.nonegate!==!0&&_===CHAR_EXCLAMATION_MARK&&c===h){A=k.negated=!0,h++;continue}if(t.noparen!==!0&&_===CHAR_LEFT_PARENTHESES){if(m=k.isGlob=!0,r===!0){for(;F()!==!0&&(_=$());){if(_===CHAR_LEFT_PARENTHESES){S=k.backslashes=!0,_=$();continue}if(_===CHAR_RIGHT_PARENTHESES){R=!0;break}}continue}break}if(m===!0){if(R=!0,r===!0)continue;break}}t.noext===!0&&(p=!1,m=!1);let x=l,V="",b="";h>0&&(V=l.slice(0,h),l=l.slice(h),u-=h),x&&m===!0&&u>0?(x=l.slice(0,u),b=l.slice(u)):m===!0?(x="",b=l):x=l,x&&x!==""&&x!=="/"&&x!==l&&isPathSeparator(x.charCodeAt(x.length-1))&&(x=x.slice(0,-1)),t.unescape===!0&&(b&&(b=utils$3.removeBackslashes(b)),x&&S===!0&&(x=utils$3.removeBackslashes(x)));const w={prefix:V,input:s,start:h,base:x,glob:b,isBrace:f,isBracket:d,isGlob:m,isExtglob:p,isGlobstar:g,negated:A,negatedExtglob:L};if(t.tokens===!0&&(w.maxDepth=0,isPathSeparator(_)||o.push(k),w.tokens=o),t.parts===!0||t.tokens===!0){let B;for(let M=0;M<i.length;M++){const W=B?B+1:h,q=i[M],j=s.slice(W,q);t.tokens&&(M===0&&h!==0?(o[M].isPrefix=!0,o[M].value=V):o[M].value=j,depth(o[M]),w.maxDepth+=o[M].depth),(M!==0||j!=="")&&a.push(j),B=q}if(B&&B+1<s.length){const M=s.slice(B+1);a.push(M),t.tokens&&(o[o.length-1].value=M,depth(o[o.length-1]),w.maxDepth+=o[o.length-1].depth)}w.slashes=i,w.parts=a}return w};var scan_1=scan$1;const constants$1=constants$2,utils$2=utils$4,{MAX_LENGTH,POSIX_REGEX_SOURCE,REGEX_NON_SPECIAL_CHARS,REGEX_SPECIAL_CHARS_BACKREF,REPLACEMENTS}=constants$1,expandRange=(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=>utils$2.escapeRegex(r)).join("..")}return t},syntaxError=(s,e)=>`Missing ${s}: "${e}" - use "\\\\${e}" to match literal characters`,parse$2=(s,e)=>{if(typeof s!="string")throw new TypeError("Expected a string");s=REPLACEMENTS[s]||s;const t={...e},n=typeof t.maxLength=="number"?Math.min(MAX_LENGTH,t.maxLength):MAX_LENGTH;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=utils$2.isWindows(e),c=constants$1.globChars(l),h=constants$1.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 F=t.bash===!0?I(t):R;t.capture&&(F=`(${F})`),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=utils$2.removePrefix(s,E),r=s.length;const $=[],x=[],V=[];let b=i,w;const B=()=>E.index===r-1,M=E.peek=(T=1)=>s[E.index+T],W=E.advance=()=>s[++E.index]||"",q=()=>s.slice(E.index+1),j=(T="",D=0)=>{E.consumed+=T,E.index+=D},Z=T=>{E.output+=T.output!=null?T.output:T.value,j(T.value)},te=()=>{let T=1;for(;M()==="!"&&(M(2)!=="("||M(3)==="?");)W(),E.start++,T++;return T%2===0?!1:(E.negated=!0,E.start++,!0)},se=T=>{E[T]++,V.push(T)},Y=T=>{E[T]--,V.pop()},N=T=>{if(b.type==="globstar"){const D=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"&&!D&&!C&&(E.output=E.output.slice(0,-b.output.length),b.type="star",b.value="*",b.output=F,E.output+=b.output)}if($.length&&T.type!=="paren"&&($[$.length-1].inner+=T.value),(T.value||T.output)&&Z(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},G=(T,D)=>{const C={...h[D],conditions:1,inner:""};C.prev=b,C.parens=E.parens,C.output=E.output;const P=(t.capture?"(":"")+C.open;se("parens"),N({type:T,value:D,output:E.output?"":m}),N({type:"paren",extglob:!0,value:W(),output:P}),$.push(C)},ne=T=>{let D=T.close+(t.capture?")":""),C;if(T.type==="negate"){let P=F;if(T.inner&&T.inner.length>1&&T.inner.includes("/")&&(P=I(t)),(P!==F||B()||/^\)+$/.test(q()))&&(D=T.close=`)$))${P}`),T.inner.includes("*")&&(C=q())&&/^\.[^\\/.]+$/.test(C)){const H=parse$2(C,{...e,fastpaths:!1}).output;D=T.close=`)${H})${P})`}T.prev.type==="bos"&&(E.negatedExtglob=!0)}N({type:"paren",extglob:!0,value:w,output:D}),Y("parens")};if(t.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(s)){let T=!1,D=s.replace(REGEX_SPECIAL_CHARS_BACKREF,(C,P,H,K,U,Oe)=>K==="\\"?(T=!0,C):K==="?"?P?P+K+(U?A.repeat(U.length):""):Oe===0?k+(U?A.repeat(U.length):""):A.repeat(H.length):K==="."?u.repeat(H.length):K==="*"?P?P+K+(U?F:""):F:P?C:`\\${C}`);return T===!0&&(t.unescape===!0?D=D.replace(/\\/g,""):D=D.replace(/\\+/g,C=>C.length%2===0?"\\\\":C?"\\":"")),D===s&&t.contains===!0?(E.output=s,E):(E.output=utils$2.wrapOutput(D,E,e),E)}for(;!B();){if(w=W(),w==="\0")continue;if(w==="\\"){const C=M();if(C==="/"&&t.bash!==!0||C==="."||C===";")continue;if(!C){w+="\\",N({type:"text",value:w});continue}const P=/^\\+/.exec(q());let H=0;if(P&&P[0].length>2&&(H=P[0].length,E.index+=H,H%2!==0&&(w+="\\")),t.unescape===!0?w=W():w+=W(),E.brackets===0){N({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 P=b.value.lastIndexOf("["),H=b.value.slice(0,P),K=b.value.slice(P+2),U=POSIX_REGEX_SOURCE[K];if(U){b.value=H+U,E.backtrack=!0,W(),!i.output&&o.indexOf(b)===1&&(i.output=m);continue}}}(w==="["&&M()!==":"||w==="-"&&M()==="]")&&(w=`\\${w}`),w==="]"&&(b.value==="["||b.value==="[^")&&(w=`\\${w}`),t.posix===!0&&w==="!"&&b.value==="["&&(w="^"),b.value+=w,Z({value:w});continue}if(E.quotes===1&&w!=='"'){w=utils$2.escapeRegex(w),b.value+=w,Z({value:w});continue}if(w==='"'){E.quotes=E.quotes===1?0:1,t.keepQuotes===!0&&N({type:"text",value:w});continue}if(w==="("){se("parens"),N({type:"paren",value:w});continue}if(w===")"){if(E.parens===0&&t.strictBrackets===!0)throw new SyntaxError(syntaxError("opening","("));const C=$[$.length-1];if(C&&E.parens===C.parens+1){ne($.pop());continue}N({type:"paren",value:w,output:E.parens?")":"\\)"}),Y("parens");continue}if(w==="["){if(t.nobracket===!0||!q().includes("]")){if(t.nobracket!==!0&&t.strictBrackets===!0)throw new SyntaxError(syntaxError("closing","]"));w=`\\${w}`}else se("brackets");N({type:"bracket",value:w});continue}if(w==="]"){if(t.nobracket===!0||b&&b.type==="bracket"&&b.value.length===1){N({type:"text",value:w,output:`\\${w}`});continue}if(E.brackets===0){if(t.strictBrackets===!0)throw new SyntaxError(syntaxError("opening","["));N({type:"text",value:w,output:`\\${w}`});continue}Y("brackets");const C=b.value.slice(1);if(b.posix!==!0&&C[0]==="^"&&!C.includes("/")&&(w=`/${w}`),b.value+=w,Z({value:w}),t.literalBrackets===!1||utils$2.hasRegexChars(C))continue;const P=utils$2.escapeRegex(b.value);if(E.output=E.output.slice(0,-b.value.length),t.literalBrackets===!0){E.output+=P,b.value=P;continue}b.value=`(${a}${P}|${b.value})`,E.output+=b.value;continue}if(w==="{"&&t.nobrace!==!0){se("braces");const C={type:"brace",value:w,output:"(",outputIndex:E.output.length,tokensIndex:E.tokens.length};x.push(C),N(C);continue}if(w==="}"){const C=x[x.length-1];if(t.nobrace===!0||!C){N({type:"text",value:w,output:w});continue}let P=")";if(C.dots===!0){const H=o.slice(),K=[];for(let U=H.length-1;U>=0&&(o.pop(),H[U].type!=="brace");U--)H[U].type!=="dots"&&K.unshift(H[U].value);P=expandRange(K,t),E.backtrack=!0}if(C.comma!==!0&&C.dots!==!0){const H=E.output.slice(0,C.outputIndex),K=E.tokens.slice(C.tokensIndex);C.value=C.output="\\{",w=P="\\}",E.output=H;for(const U of K)E.output+=U.output||U.value}N({type:"brace",value:w,output:P}),Y("braces"),x.pop();continue}if(w==="|"){$.length>0&&$[$.length-1].conditions++,N({type:"text",value:w});continue}if(w===","){let C=w;const P=x[x.length-1];P&&V[V.length-1]==="braces"&&(P.comma=!0,C="|"),N({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}N({type:"slash",value:w,output:d});continue}if(w==="."){if(E.braces>0&&b.type==="dot"){b.value==="."&&(b.output=u);const C=x[x.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"){N({type:"text",value:w,output:u});continue}N({type:"dot",value:w,output:u});continue}if(w==="?"){if(!(b&&b.value==="(")&&t.noextglob!==!0&&M()==="("&&M(2)!=="?"){G("qmark",w);continue}if(b&&b.type==="paren"){const P=M();let H=w;if(P==="<"&&!utils$2.supportsLookbehinds())throw new Error("Node.js v10 or higher is required for regex lookbehinds");(b.value==="("&&!/[!=<:]/.test(P)||P==="<"&&!/<([!=]|\w+>)/.test(q()))&&(H=`\\${w}`),N({type:"text",value:w,output:H});continue}if(t.dot!==!0&&(b.type==="slash"||b.type==="bos")){N({type:"qmark",value:w,output:L});continue}N({type:"qmark",value:w,output:A});continue}if(w==="!"){if(t.noextglob!==!0&&M()==="("&&(M(2)!=="?"||!/[!=<:]/.test(M(3)))){G("negate",w);continue}if(t.nonegate!==!0&&E.index===0){te();continue}}if(w==="+"){if(t.noextglob!==!0&&M()==="("&&M(2)!=="?"){G("plus",w);continue}if(b&&b.value==="("||t.regex===!1){N({type:"plus",value:w,output:f});continue}if(b&&(b.type==="bracket"||b.type==="paren"||b.type==="brace")||E.parens>0){N({type:"plus",value:w});continue}N({type:"plus",value:f});continue}if(w==="@"){if(t.noextglob!==!0&&M()==="("&&M(2)!=="?"){N({type:"at",extglob:!0,value:w,output:""});continue}N({type:"text",value:w});continue}if(w!=="*"){(w==="$"||w==="^")&&(w=`\\${w}`);const C=REGEX_NON_SPECIAL_CHARS.exec(q());C&&(w+=C[0],E.index+=C[0].length),N({type:"text",value:w});continue}if(b&&(b.type==="globstar"||b.star===!0)){b.type="star",b.star=!0,b.value+=w,b.output=F,E.backtrack=!0,E.globstar=!0,j(w);continue}let T=q();if(t.noextglob!==!0&&/^\([^?]/.test(T)){G("star",w);continue}if(b.type==="star"){if(t.noglobstar===!0){j(w);continue}const C=b.prev,P=C.prev,H=C.type==="slash"||C.type==="bos",K=P&&(P.type==="star"||P.type==="globstar");if(t.bash===!0&&(!H||T[0]&&T[0]!=="/")){N({type:"star",value:w,output:""});continue}const U=E.braces>0&&(C.type==="comma"||C.type==="brace"),Oe=$.length&&(C.type==="pipe"||C.type==="paren");if(!H&&C.type!=="paren"&&!U&&!Oe){N({type:"star",value:w,output:""});continue}for(;T.slice(0,3)==="/**";){const Ae=s[E.index+4];if(Ae&&Ae!=="/")break;T=T.slice(3),j("/**",3)}if(C.type==="bos"&&B()){b.type="globstar",b.value+=w,b.output=I(t),E.output=b.output,E.globstar=!0,j(w);continue}if(C.type==="slash"&&C.prev.type!=="bos"&&!K&&B()){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,j(w);continue}if(C.type==="slash"&&C.prev.type!=="bos"&&T[0]==="/"){const Ae=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}${Ae})`,b.value+=w,E.output+=C.output+b.output,E.globstar=!0,j(w+W()),N({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,j(w+W()),N({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,j(w);continue}const D={type:"star",value:w,output:F};if(t.bash===!0){D.output=".*?",(b.type==="bos"||b.type==="slash")&&(D.output=_+D.output),N(D);continue}if(b&&(b.type==="bracket"||b.type==="paren")&&t.regex===!0){D.output=w,N(D);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+=_),M()!=="*"&&(E.output+=m,b.output+=m)),N(D)}for(;E.brackets>0;){if(t.strictBrackets===!0)throw new SyntaxError(syntaxError("closing","]"));E.output=utils$2.escapeLast(E.output,"["),Y("brackets")}for(;E.parens>0;){if(t.strictBrackets===!0)throw new SyntaxError(syntaxError("closing",")"));E.output=utils$2.escapeLast(E.output,"("),Y("parens")}for(;E.braces>0;){if(t.strictBrackets===!0)throw new SyntaxError(syntaxError("closing","}"));E.output=utils$2.escapeLast(E.output,"{"),Y("braces")}if(t.strictSlashes!==!0&&(b.type==="star"||b.type==="bracket")&&N({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};parse$2.fastpaths=(s,e)=>{const t={...e},n=typeof t.maxLength=="number"?Math.min(MAX_LENGTH,t.maxLength):MAX_LENGTH,r=s.length;if(r>n)throw new SyntaxError(`Input length: ${r}, exceeds maximum allowed length: ${n}`);s=REPLACEMENTS[s]||s;const i=utils$2.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}=constants$1.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 F=R(k[1]);return F?F+o+k[2]:void 0}}},O=utils$2.removePrefix(s,S);let I=R(O);return I&&t.strictSlashes!==!0&&(I+=`${a}?`),I};var parse_1=parse$2;const path=require$$0__default$2,scan=scan_1,parse$1=parse_1,utils$1=utils$4,constants=constants$2,isObject$1=s=>s&&typeof s=="object"&&!Array.isArray(s),picomatch$2=(s,e,t=!1)=>{if(Array.isArray(s)){const h=s.map(f=>picomatch$2(f,e,t));return f=>{for(const d of h){const m=d(f);if(m)return m}return!1}}const n=isObject$1(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=utils$1.isWindows(e),o=n?picomatch$2.compileRe(s,e):picomatch$2.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=picomatch$2(r.ignore,h,t)}const c=(h,u=!1)=>{const{isMatch:f,match:d,output:m}=picomatch$2.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};picomatch$2.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?utils$1.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=picomatch$2.matchBase(s,e,t,r):a=e.exec(l)),{isMatch:!!a,match:a,output:l}},picomatch$2.matchBase=(s,e,t,n=utils$1.isWindows(t))=>(e instanceof RegExp?e:picomatch$2.makeRe(e,t)).test(path.basename(s)),picomatch$2.isMatch=(s,e,t)=>picomatch$2(e,t)(s),picomatch$2.parse=(s,e)=>Array.isArray(s)?s.map(t=>picomatch$2.parse(t,e)):parse$1(s,{...e,fastpaths:!1}),picomatch$2.scan=(s,e)=>scan(s,e),picomatch$2.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=picomatch$2.toRegex(a,e);return n===!0&&(l.state=s),l},picomatch$2.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=parse$1.fastpaths(s,e)),r.output||(r=parse$1(s,e)),picomatch$2.compileRe(r,e,t,n)},picomatch$2.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/$^/}},picomatch$2.constants=constants;var picomatch_1=picomatch$2,picomatch$1=picomatch_1;const util=require$$0__default$1,braces=braces_1,picomatch=picomatch$1,utils=utils$4,isEmptyString=s=>s===""||s==="./",micromatch=(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=picomatch(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};micromatch.match=micromatch,micromatch.matcher=(s,e)=>picomatch(s,e),micromatch.isMatch=(s,e,t)=>picomatch(e,t)(s),micromatch.any=micromatch.isMatch,micromatch.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(micromatch(s,e,{...t,onResult:i}));for(let a of r)o.has(a)||n.add(a);return[...n]},micromatch.contains=(s,e,t)=>{if(typeof s!="string")throw new TypeError(`Expected a string: "${util.inspect(s)}"`);if(Array.isArray(e))return e.some(n=>micromatch.contains(s,n,t));if(typeof e=="string"){if(isEmptyString(s)||isEmptyString(e))return!1;if(s.includes(e)||s.startsWith("./")&&s.slice(2).includes(e))return!0}return micromatch.isMatch(s,e,{...t,contains:!0})},micromatch.matchKeys=(s,e,t)=>{if(!utils.isObject(s))throw new TypeError("Expected the first argument to be an object");let n=micromatch(Object.keys(s),e,t),r={};for(let i of n)r[i]=s[i];return r},micromatch.some=(s,e,t)=>{let n=[].concat(s);for(let r of[].concat(e)){let i=picomatch(String(r),t);if(n.some(o=>i(o)))return!0}return!1},micromatch.every=(s,e,t)=>{let n=[].concat(s);for(let r of[].concat(e)){let i=picomatch(String(r),t);if(!n.every(o=>i(o)))return!1}return!0},micromatch.all=(s,e,t)=>{if(typeof s!="string")throw new TypeError(`Expected a string: "${util.inspect(s)}"`);return[].concat(e).every(n=>picomatch(n,t)(s))},micromatch.capture=(s,e,t)=>{let n=utils.isWindows(t),i=picomatch.makeRe(String(s),{...t,capture:!0}).exec(n?utils.toPosixSlashes(e):e);if(i)return i.slice(1).map(o=>o===void 0?"":o)},micromatch.makeRe=(...s)=>picomatch.makeRe(...s),micromatch.scan=(...s)=>picomatch.scan(...s),micromatch.parse=(s,e)=>{let t=[];for(let n of[].concat(s||[]))for(let r of braces(String(n),e))t.push(picomatch.parse(r,e));return t},micromatch.braces=(s,e)=>{if(typeof s!="string")throw new TypeError("Expected a string");return e&&e.nobrace===!0||!/\{.*\}/.test(s)?[s]:braces(s,e)},micromatch.braceExpand=(s,e)=>{if(typeof s!="string")throw new TypeError("Expected a string");return micromatch.braces(s,{...e,expand:!0})};var micromatch_1=micromatch;const micromatch$1=getDefaultExportFromCjs(micromatch_1),debugLog$c=debug("lint-staged:generateTasks"),generateTasks=({config:s,cwd:e=process.cwd(),files:t,relative:n=!1})=>{debugLog$c("Generating linter tasks");const r=t.map(i=>normalizePath(path__default.relative(e,i)));return Object.entries(s).map(([i,o])=>{const a=i.startsWith("../"),l=r.filter(f=>a?!0:!f.startsWith("..")&&!path__default.isAbsolute(f)),h=micromatch$1(l,i,{cwd:e,dot:!0,matchBase:!i.includes("/"),posixSlashes:!0,strictBrackets:!0}).map(f=>normalizePath(n?f:path__default.resolve(e,f))),u={pattern:i,commands:o,fileList:h};return debugLog$c(`Generated task:
47
+ */const util$1=require$$0__default$1,toRegexRange=toRegexRange_1,isObject$2=s=>s!==null&&typeof s=="object"&&!Array.isArray(s),transform=s=>e=>s===!0?Number(e):String(e),isValidValue=s=>typeof s=="number"||typeof s=="string"&&s!=="",isNumber=s=>Number.isInteger(+s),zeros=s=>{let e=`${s}`,t=-1;if(e[0]==="-"&&(e=e.slice(1)),e==="0")return!1;for(;e[++t]==="0";);return t>0},stringify$6=(s,e,t)=>typeof s=="string"||typeof e=="string"?!0:t.stringify===!0,pad=(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},toMaxLen=(s,e)=>{let t=s[0]==="-"?"-":"";for(t&&(s=s.slice(1),e--);s.length<e;)s="0"+s;return t?"-"+s:s},toSequence=(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},toRange=(s,e,t,n)=>{if(t)return toRegexRange(s,e,{wrap:!1,...n});let r=String.fromCharCode(s);if(s===e)return r;let i=String.fromCharCode(e);return`[${r}-${i}]`},toRegex=(s,e,t)=>{if(Array.isArray(s)){let n=t.wrap===!0,r=t.capture?"":"?:";return n?`(${r}${s.join("|")})`:s.join("|")}return toRegexRange(s,e,t)},rangeError=(...s)=>new RangeError("Invalid range arguments: "+util$1.inspect(...s)),invalidRange=(s,e,t)=>{if(t.strictRanges===!0)throw rangeError([s,e]);return[]},invalidStep=(s,e)=>{if(e.strictRanges===!0)throw new TypeError(`Expected step "${s}" to be a number`);return[]},fillNumbers=(s,e,t=1,n={})=>{let r=Number(s),i=Number(e);if(!Number.isInteger(r)||!Number.isInteger(i)){if(n.strictRanges===!0)throw rangeError([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=zeros(a)||zeros(l)||zeros(c),u=f?Math.max(a.length,l.length,c.length):0,h=f===!1&&stringify$6(s,e,n)===!1,d=n.transform||transform(h);if(n.toRegex&&t===1)return toRange(toMaxLen(s,u),toMaxLen(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(pad(d(r,y),u,h)),r=o?r-t:r+t,y++;return n.toRegex===!0?t>1?toSequence(m,n):toRegex(g,null,{wrap:!1,...n}):g},fillLetters=(s,e,t=1,n={})=>{if(!isNumber(s)&&s.length>1||!isNumber(e)&&e.length>1)return invalidRange(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 toRange(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?toRegex(f,null,{wrap:!1,options:n}):f},fill$2=(s,e,t,n={})=>{if(e==null&&isValidValue(s))return[s];if(!isValidValue(s)||!isValidValue(e))return invalidRange(s,e,n);if(typeof t=="function")return fill$2(s,e,1,{transform:t});if(isObject$2(t))return fill$2(s,e,0,t);let r={...n};return r.capture===!0&&(r.wrap=!0),t=t||r.step||1,isNumber(t)?isNumber(s)&&isNumber(e)?fillNumbers(s,e,t,r):fillLetters(s,e,Math.max(Math.abs(t),1),r):t!=null&&!isObject$2(t)?invalidStep(t,r):fill$2(s,e,1,t)};var fillRange=fill$2;const fill$1=fillRange,utils$6=utils$8,compile$1=(s,e={})=>{let t=(n,r={})=>{let i=utils$6.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=utils$6.reduce(n.nodes),u=fill$1(...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 compile_1=compile$1;const fill=fillRange,stringify$5=stringify$7,utils$5=utils$8,append=(s="",e="",t=!1)=>{let n=[];if(s=[].concat(s),e=[].concat(e),!e.length)return s;if(!s.length)return t?utils$5.flatten(e).map(r=>`{${r}}`):e;for(let r of s)if(Array.isArray(r))for(let i of r)n.push(append(i,e,t));else for(let i of e)t===!0&&typeof i=="string"&&(i=`{${i}}`),n.push(Array.isArray(i)?append(r,i,t):r+i);return utils$5.flatten(n)},expand$1=(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(append(a.pop(),stringify$5(r,e)));return}if(r.type==="brace"&&r.invalid!==!0&&r.nodes.length===2){a.push(append(a.pop(),["{}"]));return}if(r.nodes&&r.ranges>0){let u=utils$5.reduce(r.nodes);if(utils$5.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=fill(...u,e);h.length===0&&(h=stringify$5(r,e)),a.push(append(a.pop(),h)),r.nodes=[];return}let l=utils$5.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(append(a.pop(),c,l));continue}if(h.value&&h.type!=="open"){c.push(append(c.pop(),h.value));continue}h.nodes&&n(h,r)}return c};return utils$5.flatten(n(s))};var expand_1=expand$1,constants$3={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 stringify$4=stringify$7,{MAX_LENGTH:MAX_LENGTH$1,CHAR_BACKSLASH,CHAR_BACKTICK,CHAR_COMMA:CHAR_COMMA$1,CHAR_DOT:CHAR_DOT$1,CHAR_LEFT_PARENTHESES:CHAR_LEFT_PARENTHESES$1,CHAR_RIGHT_PARENTHESES:CHAR_RIGHT_PARENTHESES$1,CHAR_LEFT_CURLY_BRACE:CHAR_LEFT_CURLY_BRACE$1,CHAR_RIGHT_CURLY_BRACE:CHAR_RIGHT_CURLY_BRACE$1,CHAR_LEFT_SQUARE_BRACKET:CHAR_LEFT_SQUARE_BRACKET$1,CHAR_RIGHT_SQUARE_BRACKET:CHAR_RIGHT_SQUARE_BRACKET$1,CHAR_DOUBLE_QUOTE,CHAR_SINGLE_QUOTE,CHAR_NO_BREAK_SPACE,CHAR_ZERO_WIDTH_NOBREAK_SPACE}=constants$3,parse$4=(s,e={})=>{if(typeof s!="string")throw new TypeError("Expected a string");let t=e||{},n=typeof t.maxLength=="number"?Math.min(MAX_LENGTH$1,t.maxLength):MAX_LENGTH$1;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===CHAR_ZERO_WIDTH_NOBREAK_SPACE||h===CHAR_NO_BREAK_SPACE)){if(h===CHAR_BACKSLASH){m({type:"text",value:(e.keepEscaping?h:"")+d()});continue}if(h===CHAR_RIGHT_SQUARE_BRACKET$1){m({type:"text",value:"\\"+h});continue}if(h===CHAR_LEFT_SQUARE_BRACKET$1){l++;let p;for(;f<c&&(p=d());){if(h+=p,p===CHAR_LEFT_SQUARE_BRACKET$1){l++;continue}if(p===CHAR_BACKSLASH){h+=d();continue}if(p===CHAR_RIGHT_SQUARE_BRACKET$1&&(l--,l===0))break}m({type:"text",value:h});continue}if(h===CHAR_LEFT_PARENTHESES$1){o=m({type:"paren",nodes:[]}),i.push(o),m({type:"text",value:h});continue}if(h===CHAR_RIGHT_PARENTHESES$1){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===CHAR_DOUBLE_QUOTE||h===CHAR_SINGLE_QUOTE||h===CHAR_BACKTICK){let p=h,g;for(e.keepQuotes!==!0&&(h="");f<c&&(g=d());){if(g===CHAR_BACKSLASH){h+=g+d();continue}if(g===p){e.keepQuotes===!0&&(h+=g);break}h+=g}m({type:"text",value:h});continue}if(h===CHAR_LEFT_CURLY_BRACE$1){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===CHAR_RIGHT_CURLY_BRACE$1){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===CHAR_COMMA$1&&u>0){if(o.ranges>0){o.ranges=0;let p=o.nodes.shift();o.nodes=[p,{type:"text",value:stringify$4(o)}]}m({type:"comma",value:h}),o.commas++;continue}if(h===CHAR_DOT$1&&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 parse_1$1=parse$4;const stringify$3=stringify$7,compile=compile_1,expand=expand_1,parse$3=parse_1$1,braces$1=(s,e={})=>{let t=[];if(Array.isArray(s))for(let n of s){let r=braces$1.create(n,e);Array.isArray(r)?t.push(...r):t.push(r)}else t=[].concat(braces$1.create(s,e));return e&&e.expand===!0&&e.nodupes===!0&&(t=[...new Set(t)]),t};braces$1.parse=(s,e={})=>parse$3(s,e),braces$1.stringify=(s,e={})=>stringify$3(typeof s=="string"?braces$1.parse(s,e):s,e),braces$1.compile=(s,e={})=>(typeof s=="string"&&(s=braces$1.parse(s,e)),compile(s,e)),braces$1.expand=(s,e={})=>{typeof s=="string"&&(s=braces$1.parse(s,e));let t=expand(s,e);return e.noempty===!0&&(t=t.filter(Boolean)),e.nodupes===!0&&(t=[...new Set(t)]),t},braces$1.create=(s,e={})=>s===""||s.length<3?[s]:e.expand!==!0?braces$1.compile(s,e):braces$1.expand(s,e);var braces_1=braces$1,utils$4={};const path$1=require$$0__default$2,WIN_SLASH="\\\\/",WIN_NO_SLASH=`[^${WIN_SLASH}]`,DOT_LITERAL="\\.",PLUS_LITERAL="\\+",QMARK_LITERAL="\\?",SLASH_LITERAL="\\/",ONE_CHAR="(?=.)",QMARK="[^/]",END_ANCHOR=`(?:${SLASH_LITERAL}|$)`,START_ANCHOR=`(?:^|${SLASH_LITERAL})`,DOTS_SLASH=`${DOT_LITERAL}{1,2}${END_ANCHOR}`,NO_DOT=`(?!${DOT_LITERAL})`,NO_DOTS=`(?!${START_ANCHOR}${DOTS_SLASH})`,NO_DOT_SLASH=`(?!${DOT_LITERAL}{0,1}${END_ANCHOR})`,NO_DOTS_SLASH=`(?!${DOTS_SLASH})`,QMARK_NO_DOT=`[^.${SLASH_LITERAL}]`,STAR=`${QMARK}*?`,POSIX_CHARS={DOT_LITERAL,PLUS_LITERAL,QMARK_LITERAL,SLASH_LITERAL,ONE_CHAR,QMARK,END_ANCHOR,DOTS_SLASH,NO_DOT,NO_DOTS,NO_DOT_SLASH,NO_DOTS_SLASH,QMARK_NO_DOT,STAR,START_ANCHOR},WINDOWS_CHARS={...POSIX_CHARS,SLASH_LITERAL:`[${WIN_SLASH}]`,QMARK:WIN_NO_SLASH,STAR:`${WIN_NO_SLASH}*?`,DOTS_SLASH:`${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$)`,NO_DOT:`(?!${DOT_LITERAL})`,NO_DOTS:`(?!(?:^|[${WIN_SLASH}])${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,NO_DOT_SLASH:`(?!${DOT_LITERAL}{0,1}(?:[${WIN_SLASH}]|$))`,NO_DOTS_SLASH:`(?!${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,QMARK_NO_DOT:`[^.${WIN_SLASH}]`,START_ANCHOR:`(?:^|[${WIN_SLASH}])`,END_ANCHOR:`(?:[${WIN_SLASH}]|$)`},POSIX_REGEX_SOURCE$1={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 constants$2={MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:POSIX_REGEX_SOURCE$1,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:path$1.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?WINDOWS_CHARS:POSIX_CHARS}};(function(s){const e=require$$0__default$2,t=process.platform==="win32",{REGEX_BACKSLASH:n,REGEX_REMOVE_BACKSLASH:r,REGEX_SPECIAL_CHARS:i,REGEX_SPECIAL_CHARS_GLOBAL:o}=constants$2;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}})(utils$4);const utils$3=utils$4,{CHAR_ASTERISK,CHAR_AT,CHAR_BACKWARD_SLASH,CHAR_COMMA,CHAR_DOT,CHAR_EXCLAMATION_MARK,CHAR_FORWARD_SLASH,CHAR_LEFT_CURLY_BRACE,CHAR_LEFT_PARENTHESES,CHAR_LEFT_SQUARE_BRACKET,CHAR_PLUS,CHAR_QUESTION_MARK,CHAR_RIGHT_CURLY_BRACE,CHAR_RIGHT_PARENTHESES,CHAR_RIGHT_SQUARE_BRACKET}=constants$2,isPathSeparator=s=>s===CHAR_FORWARD_SLASH||s===CHAR_BACKWARD_SLASH,depth=s=>{s.isPrefix!==!0&&(s.depth=s.isGlobstar?1/0:1)},scan$1=(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 D=()=>c>=n,E=()=>l.charCodeAt(c+1),$=()=>(I=_,l.charCodeAt(++c));for(;c<n;){_=$();let B;if(_===CHAR_BACKWARD_SLASH){S=k.backslashes=!0,_=$(),_===CHAR_LEFT_CURLY_BRACE&&(y=!0);continue}if(y===!0||_===CHAR_LEFT_CURLY_BRACE){for(O++;D()!==!0&&(_=$());){if(_===CHAR_BACKWARD_SLASH){S=k.backslashes=!0,$();continue}if(_===CHAR_LEFT_CURLY_BRACE){O++;continue}if(y!==!0&&_===CHAR_DOT&&(_=$())===CHAR_DOT){if(h=k.isBrace=!0,m=k.isGlob=!0,R=!0,r===!0)continue;break}if(y!==!0&&_===CHAR_COMMA){if(h=k.isBrace=!0,m=k.isGlob=!0,R=!0,r===!0)continue;break}if(_===CHAR_RIGHT_CURLY_BRACE&&(O--,O===0)){y=!1,h=k.isBrace=!0,R=!0;break}}if(r===!0)continue;break}if(_===CHAR_FORWARD_SLASH){if(i.push(c),o.push(k),k={value:"",depth:0,isGlob:!1},R===!0)continue;if(I===CHAR_DOT&&c===f+1){f+=2;continue}u=c+1;continue}if(t.noext!==!0&&(_===CHAR_PLUS||_===CHAR_AT||_===CHAR_ASTERISK||_===CHAR_QUESTION_MARK||_===CHAR_EXCLAMATION_MARK)===!0&&E()===CHAR_LEFT_PARENTHESES){if(m=k.isGlob=!0,p=k.isExtglob=!0,R=!0,_===CHAR_EXCLAMATION_MARK&&c===f&&(L=!0),r===!0){for(;D()!==!0&&(_=$());){if(_===CHAR_BACKWARD_SLASH){S=k.backslashes=!0,_=$();continue}if(_===CHAR_RIGHT_PARENTHESES){m=k.isGlob=!0,R=!0;break}}continue}break}if(_===CHAR_ASTERISK){if(I===CHAR_ASTERISK&&(g=k.isGlobstar=!0),m=k.isGlob=!0,R=!0,r===!0)continue;break}if(_===CHAR_QUESTION_MARK){if(m=k.isGlob=!0,R=!0,r===!0)continue;break}if(_===CHAR_LEFT_SQUARE_BRACKET){for(;D()!==!0&&(B=$());){if(B===CHAR_BACKWARD_SLASH){S=k.backslashes=!0,$();continue}if(B===CHAR_RIGHT_SQUARE_BRACKET){d=k.isBracket=!0,m=k.isGlob=!0,R=!0;break}}if(r===!0)continue;break}if(t.nonegate!==!0&&_===CHAR_EXCLAMATION_MARK&&c===f){A=k.negated=!0,f++;continue}if(t.noparen!==!0&&_===CHAR_LEFT_PARENTHESES){if(m=k.isGlob=!0,r===!0){for(;D()!==!0&&(_=$());){if(_===CHAR_LEFT_PARENTHESES){S=k.backslashes=!0,_=$();continue}if(_===CHAR_RIGHT_PARENTHESES){R=!0;break}}continue}break}if(m===!0){if(R=!0,r===!0)continue;break}}t.noext===!0&&(p=!1,m=!1);let x=l,V="",b="";f>0&&(V=l.slice(0,f),l=l.slice(f),u-=f),x&&m===!0&&u>0?(x=l.slice(0,u),b=l.slice(u)):m===!0?(x="",b=l):x=l,x&&x!==""&&x!=="/"&&x!==l&&isPathSeparator(x.charCodeAt(x.length-1))&&(x=x.slice(0,-1)),t.unescape===!0&&(b&&(b=utils$3.removeBackslashes(b)),x&&S===!0&&(x=utils$3.removeBackslashes(x)));const w={prefix:V,input:s,start:f,base:x,glob:b,isBrace:h,isBracket:d,isGlob:m,isExtglob:p,isGlobstar:g,negated:A,negatedExtglob:L};if(t.tokens===!0&&(w.maxDepth=0,isPathSeparator(_)||o.push(k),w.tokens=o),t.parts===!0||t.tokens===!0){let B;for(let M=0;M<i.length;M++){const W=B?B+1:f,q=i[M],j=s.slice(W,q);t.tokens&&(M===0&&f!==0?(o[M].isPrefix=!0,o[M].value=V):o[M].value=j,depth(o[M]),w.maxDepth+=o[M].depth),(M!==0||j!=="")&&a.push(j),B=q}if(B&&B+1<s.length){const M=s.slice(B+1);a.push(M),t.tokens&&(o[o.length-1].value=M,depth(o[o.length-1]),w.maxDepth+=o[o.length-1].depth)}w.slashes=i,w.parts=a}return w};var scan_1=scan$1;const constants$1=constants$2,utils$2=utils$4,{MAX_LENGTH,POSIX_REGEX_SOURCE,REGEX_NON_SPECIAL_CHARS,REGEX_SPECIAL_CHARS_BACKREF,REPLACEMENTS}=constants$1,expandRange=(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=>utils$2.escapeRegex(r)).join("..")}return t},syntaxError=(s,e)=>`Missing ${s}: "${e}" - use "\\\\${e}" to match literal characters`,parse$2=(s,e)=>{if(typeof s!="string")throw new TypeError("Expected a string");s=REPLACEMENTS[s]||s;const t={...e},n=typeof t.maxLength=="number"?Math.min(MAX_LENGTH,t.maxLength):MAX_LENGTH;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=utils$2.isWindows(e),c=constants$1.globChars(l),f=constants$1.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 D=t.bash===!0?I(t):R;t.capture&&(D=`(${D})`),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=utils$2.removePrefix(s,E),r=s.length;const $=[],x=[],V=[];let b=i,w;const B=()=>E.index===r-1,M=E.peek=(T=1)=>s[E.index+T],W=E.advance=()=>s[++E.index]||"",q=()=>s.slice(E.index+1),j=(T="",F=0)=>{E.consumed+=T,E.index+=F},Z=T=>{E.output+=T.output!=null?T.output:T.value,j(T.value)},te=()=>{let T=1;for(;M()==="!"&&(M(2)!=="("||M(3)==="?");)W(),E.start++,T++;return T%2===0?!1:(E.negated=!0,E.start++,!0)},se=T=>{E[T]++,V.push(T)},Y=T=>{E[T]--,V.pop()},N=T=>{if(b.type==="globstar"){const F=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"&&!F&&!C&&(E.output=E.output.slice(0,-b.output.length),b.type="star",b.value="*",b.output=D,E.output+=b.output)}if($.length&&T.type!=="paren"&&($[$.length-1].inner+=T.value),(T.value||T.output)&&Z(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},G=(T,F)=>{const C={...f[F],conditions:1,inner:""};C.prev=b,C.parens=E.parens,C.output=E.output;const P=(t.capture?"(":"")+C.open;se("parens"),N({type:T,value:F,output:E.output?"":m}),N({type:"paren",extglob:!0,value:W(),output:P}),$.push(C)},ne=T=>{let F=T.close+(t.capture?")":""),C;if(T.type==="negate"){let P=D;if(T.inner&&T.inner.length>1&&T.inner.includes("/")&&(P=I(t)),(P!==D||B()||/^\)+$/.test(q()))&&(F=T.close=`)$))${P}`),T.inner.includes("*")&&(C=q())&&/^\.[^\\/.]+$/.test(C)){const H=parse$2(C,{...e,fastpaths:!1}).output;F=T.close=`)${H})${P})`}T.prev.type==="bos"&&(E.negatedExtglob=!0)}N({type:"paren",extglob:!0,value:w,output:F}),Y("parens")};if(t.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(s)){let T=!1,F=s.replace(REGEX_SPECIAL_CHARS_BACKREF,(C,P,H,K,U,Oe)=>K==="\\"?(T=!0,C):K==="?"?P?P+K+(U?A.repeat(U.length):""):Oe===0?k+(U?A.repeat(U.length):""):A.repeat(H.length):K==="."?u.repeat(H.length):K==="*"?P?P+K+(U?D:""):D:P?C:`\\${C}`);return T===!0&&(t.unescape===!0?F=F.replace(/\\/g,""):F=F.replace(/\\+/g,C=>C.length%2===0?"\\\\":C?"\\":"")),F===s&&t.contains===!0?(E.output=s,E):(E.output=utils$2.wrapOutput(F,E,e),E)}for(;!B();){if(w=W(),w==="\0")continue;if(w==="\\"){const C=M();if(C==="/"&&t.bash!==!0||C==="."||C===";")continue;if(!C){w+="\\",N({type:"text",value:w});continue}const P=/^\\+/.exec(q());let H=0;if(P&&P[0].length>2&&(H=P[0].length,E.index+=H,H%2!==0&&(w+="\\")),t.unescape===!0?w=W():w+=W(),E.brackets===0){N({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 P=b.value.lastIndexOf("["),H=b.value.slice(0,P),K=b.value.slice(P+2),U=POSIX_REGEX_SOURCE[K];if(U){b.value=H+U,E.backtrack=!0,W(),!i.output&&o.indexOf(b)===1&&(i.output=m);continue}}}(w==="["&&M()!==":"||w==="-"&&M()==="]")&&(w=`\\${w}`),w==="]"&&(b.value==="["||b.value==="[^")&&(w=`\\${w}`),t.posix===!0&&w==="!"&&b.value==="["&&(w="^"),b.value+=w,Z({value:w});continue}if(E.quotes===1&&w!=='"'){w=utils$2.escapeRegex(w),b.value+=w,Z({value:w});continue}if(w==='"'){E.quotes=E.quotes===1?0:1,t.keepQuotes===!0&&N({type:"text",value:w});continue}if(w==="("){se("parens"),N({type:"paren",value:w});continue}if(w===")"){if(E.parens===0&&t.strictBrackets===!0)throw new SyntaxError(syntaxError("opening","("));const C=$[$.length-1];if(C&&E.parens===C.parens+1){ne($.pop());continue}N({type:"paren",value:w,output:E.parens?")":"\\)"}),Y("parens");continue}if(w==="["){if(t.nobracket===!0||!q().includes("]")){if(t.nobracket!==!0&&t.strictBrackets===!0)throw new SyntaxError(syntaxError("closing","]"));w=`\\${w}`}else se("brackets");N({type:"bracket",value:w});continue}if(w==="]"){if(t.nobracket===!0||b&&b.type==="bracket"&&b.value.length===1){N({type:"text",value:w,output:`\\${w}`});continue}if(E.brackets===0){if(t.strictBrackets===!0)throw new SyntaxError(syntaxError("opening","["));N({type:"text",value:w,output:`\\${w}`});continue}Y("brackets");const C=b.value.slice(1);if(b.posix!==!0&&C[0]==="^"&&!C.includes("/")&&(w=`/${w}`),b.value+=w,Z({value:w}),t.literalBrackets===!1||utils$2.hasRegexChars(C))continue;const P=utils$2.escapeRegex(b.value);if(E.output=E.output.slice(0,-b.value.length),t.literalBrackets===!0){E.output+=P,b.value=P;continue}b.value=`(${a}${P}|${b.value})`,E.output+=b.value;continue}if(w==="{"&&t.nobrace!==!0){se("braces");const C={type:"brace",value:w,output:"(",outputIndex:E.output.length,tokensIndex:E.tokens.length};x.push(C),N(C);continue}if(w==="}"){const C=x[x.length-1];if(t.nobrace===!0||!C){N({type:"text",value:w,output:w});continue}let P=")";if(C.dots===!0){const H=o.slice(),K=[];for(let U=H.length-1;U>=0&&(o.pop(),H[U].type!=="brace");U--)H[U].type!=="dots"&&K.unshift(H[U].value);P=expandRange(K,t),E.backtrack=!0}if(C.comma!==!0&&C.dots!==!0){const H=E.output.slice(0,C.outputIndex),K=E.tokens.slice(C.tokensIndex);C.value=C.output="\\{",w=P="\\}",E.output=H;for(const U of K)E.output+=U.output||U.value}N({type:"brace",value:w,output:P}),Y("braces"),x.pop();continue}if(w==="|"){$.length>0&&$[$.length-1].conditions++,N({type:"text",value:w});continue}if(w===","){let C=w;const P=x[x.length-1];P&&V[V.length-1]==="braces"&&(P.comma=!0,C="|"),N({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}N({type:"slash",value:w,output:d});continue}if(w==="."){if(E.braces>0&&b.type==="dot"){b.value==="."&&(b.output=u);const C=x[x.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"){N({type:"text",value:w,output:u});continue}N({type:"dot",value:w,output:u});continue}if(w==="?"){if(!(b&&b.value==="(")&&t.noextglob!==!0&&M()==="("&&M(2)!=="?"){G("qmark",w);continue}if(b&&b.type==="paren"){const P=M();let H=w;if(P==="<"&&!utils$2.supportsLookbehinds())throw new Error("Node.js v10 or higher is required for regex lookbehinds");(b.value==="("&&!/[!=<:]/.test(P)||P==="<"&&!/<([!=]|\w+>)/.test(q()))&&(H=`\\${w}`),N({type:"text",value:w,output:H});continue}if(t.dot!==!0&&(b.type==="slash"||b.type==="bos")){N({type:"qmark",value:w,output:L});continue}N({type:"qmark",value:w,output:A});continue}if(w==="!"){if(t.noextglob!==!0&&M()==="("&&(M(2)!=="?"||!/[!=<:]/.test(M(3)))){G("negate",w);continue}if(t.nonegate!==!0&&E.index===0){te();continue}}if(w==="+"){if(t.noextglob!==!0&&M()==="("&&M(2)!=="?"){G("plus",w);continue}if(b&&b.value==="("||t.regex===!1){N({type:"plus",value:w,output:h});continue}if(b&&(b.type==="bracket"||b.type==="paren"||b.type==="brace")||E.parens>0){N({type:"plus",value:w});continue}N({type:"plus",value:h});continue}if(w==="@"){if(t.noextglob!==!0&&M()==="("&&M(2)!=="?"){N({type:"at",extglob:!0,value:w,output:""});continue}N({type:"text",value:w});continue}if(w!=="*"){(w==="$"||w==="^")&&(w=`\\${w}`);const C=REGEX_NON_SPECIAL_CHARS.exec(q());C&&(w+=C[0],E.index+=C[0].length),N({type:"text",value:w});continue}if(b&&(b.type==="globstar"||b.star===!0)){b.type="star",b.star=!0,b.value+=w,b.output=D,E.backtrack=!0,E.globstar=!0,j(w);continue}let T=q();if(t.noextglob!==!0&&/^\([^?]/.test(T)){G("star",w);continue}if(b.type==="star"){if(t.noglobstar===!0){j(w);continue}const C=b.prev,P=C.prev,H=C.type==="slash"||C.type==="bos",K=P&&(P.type==="star"||P.type==="globstar");if(t.bash===!0&&(!H||T[0]&&T[0]!=="/")){N({type:"star",value:w,output:""});continue}const U=E.braces>0&&(C.type==="comma"||C.type==="brace"),Oe=$.length&&(C.type==="pipe"||C.type==="paren");if(!H&&C.type!=="paren"&&!U&&!Oe){N({type:"star",value:w,output:""});continue}for(;T.slice(0,3)==="/**";){const Ae=s[E.index+4];if(Ae&&Ae!=="/")break;T=T.slice(3),j("/**",3)}if(C.type==="bos"&&B()){b.type="globstar",b.value+=w,b.output=I(t),E.output=b.output,E.globstar=!0,j(w);continue}if(C.type==="slash"&&C.prev.type!=="bos"&&!K&&B()){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,j(w);continue}if(C.type==="slash"&&C.prev.type!=="bos"&&T[0]==="/"){const Ae=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}${Ae})`,b.value+=w,E.output+=C.output+b.output,E.globstar=!0,j(w+W()),N({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,j(w+W()),N({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,j(w);continue}const F={type:"star",value:w,output:D};if(t.bash===!0){F.output=".*?",(b.type==="bos"||b.type==="slash")&&(F.output=_+F.output),N(F);continue}if(b&&(b.type==="bracket"||b.type==="paren")&&t.regex===!0){F.output=w,N(F);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+=_),M()!=="*"&&(E.output+=m,b.output+=m)),N(F)}for(;E.brackets>0;){if(t.strictBrackets===!0)throw new SyntaxError(syntaxError("closing","]"));E.output=utils$2.escapeLast(E.output,"["),Y("brackets")}for(;E.parens>0;){if(t.strictBrackets===!0)throw new SyntaxError(syntaxError("closing",")"));E.output=utils$2.escapeLast(E.output,"("),Y("parens")}for(;E.braces>0;){if(t.strictBrackets===!0)throw new SyntaxError(syntaxError("closing","}"));E.output=utils$2.escapeLast(E.output,"{"),Y("braces")}if(t.strictSlashes!==!0&&(b.type==="star"||b.type==="bracket")&&N({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};parse$2.fastpaths=(s,e)=>{const t={...e},n=typeof t.maxLength=="number"?Math.min(MAX_LENGTH,t.maxLength):MAX_LENGTH,r=s.length;if(r>n)throw new SyntaxError(`Input length: ${r}, exceeds maximum allowed length: ${n}`);s=REPLACEMENTS[s]||s;const i=utils$2.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}=constants$1.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 D=R(k[1]);return D?D+o+k[2]:void 0}}},O=utils$2.removePrefix(s,S);let I=R(O);return I&&t.strictSlashes!==!0&&(I+=`${a}?`),I};var parse_1=parse$2;const path=require$$0__default$2,scan=scan_1,parse$1=parse_1,utils$1=utils$4,constants=constants$2,isObject$1=s=>s&&typeof s=="object"&&!Array.isArray(s),picomatch$2=(s,e,t=!1)=>{if(Array.isArray(s)){const f=s.map(h=>picomatch$2(h,e,t));return h=>{for(const d of f){const m=d(h);if(m)return m}return!1}}const n=isObject$1(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=utils$1.isWindows(e),o=n?picomatch$2.compileRe(s,e):picomatch$2.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=picomatch$2(r.ignore,f,t)}const c=(f,u=!1)=>{const{isMatch:h,match:d,output:m}=picomatch$2.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};picomatch$2.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?utils$1.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=picomatch$2.matchBase(s,e,t,r):a=e.exec(l)),{isMatch:!!a,match:a,output:l}},picomatch$2.matchBase=(s,e,t,n=utils$1.isWindows(t))=>(e instanceof RegExp?e:picomatch$2.makeRe(e,t)).test(path.basename(s)),picomatch$2.isMatch=(s,e,t)=>picomatch$2(e,t)(s),picomatch$2.parse=(s,e)=>Array.isArray(s)?s.map(t=>picomatch$2.parse(t,e)):parse$1(s,{...e,fastpaths:!1}),picomatch$2.scan=(s,e)=>scan(s,e),picomatch$2.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=picomatch$2.toRegex(a,e);return n===!0&&(l.state=s),l},picomatch$2.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=parse$1.fastpaths(s,e)),r.output||(r=parse$1(s,e)),picomatch$2.compileRe(r,e,t,n)},picomatch$2.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/$^/}},picomatch$2.constants=constants;var picomatch_1=picomatch$2,picomatch$1=picomatch_1;const util=require$$0__default$1,braces=braces_1,picomatch=picomatch$1,utils=utils$4,isEmptyString=s=>s===""||s==="./",micromatch=(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=picomatch(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};micromatch.match=micromatch,micromatch.matcher=(s,e)=>picomatch(s,e),micromatch.isMatch=(s,e,t)=>picomatch(e,t)(s),micromatch.any=micromatch.isMatch,micromatch.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(micromatch(s,e,{...t,onResult:i}));for(let a of r)o.has(a)||n.add(a);return[...n]},micromatch.contains=(s,e,t)=>{if(typeof s!="string")throw new TypeError(`Expected a string: "${util.inspect(s)}"`);if(Array.isArray(e))return e.some(n=>micromatch.contains(s,n,t));if(typeof e=="string"){if(isEmptyString(s)||isEmptyString(e))return!1;if(s.includes(e)||s.startsWith("./")&&s.slice(2).includes(e))return!0}return micromatch.isMatch(s,e,{...t,contains:!0})},micromatch.matchKeys=(s,e,t)=>{if(!utils.isObject(s))throw new TypeError("Expected the first argument to be an object");let n=micromatch(Object.keys(s),e,t),r={};for(let i of n)r[i]=s[i];return r},micromatch.some=(s,e,t)=>{let n=[].concat(s);for(let r of[].concat(e)){let i=picomatch(String(r),t);if(n.some(o=>i(o)))return!0}return!1},micromatch.every=(s,e,t)=>{let n=[].concat(s);for(let r of[].concat(e)){let i=picomatch(String(r),t);if(!n.every(o=>i(o)))return!1}return!0},micromatch.all=(s,e,t)=>{if(typeof s!="string")throw new TypeError(`Expected a string: "${util.inspect(s)}"`);return[].concat(e).every(n=>picomatch(n,t)(s))},micromatch.capture=(s,e,t)=>{let n=utils.isWindows(t),i=picomatch.makeRe(String(s),{...t,capture:!0}).exec(n?utils.toPosixSlashes(e):e);if(i)return i.slice(1).map(o=>o===void 0?"":o)},micromatch.makeRe=(...s)=>picomatch.makeRe(...s),micromatch.scan=(...s)=>picomatch.scan(...s),micromatch.parse=(s,e)=>{let t=[];for(let n of[].concat(s||[]))for(let r of braces(String(n),e))t.push(picomatch.parse(r,e));return t},micromatch.braces=(s,e)=>{if(typeof s!="string")throw new TypeError("Expected a string");return e&&e.nobrace===!0||!/\{.*\}/.test(s)?[s]:braces(s,e)},micromatch.braceExpand=(s,e)=>{if(typeof s!="string")throw new TypeError("Expected a string");return micromatch.braces(s,{...e,expand:!0})};var micromatch_1=micromatch;const micromatch$1=getDefaultExportFromCjs(micromatch_1),debugLog$c=debug("lint-staged:generateTasks"),generateTasks=({config:s,cwd:e=process.cwd(),files:t,relative:n=!1})=>{debugLog$c("Generating linter tasks");const r=t.map(i=>normalizePath(path__default.relative(e,i)));return Object.entries(s).map(([i,o])=>{const a=i.startsWith("../"),l=r.filter(h=>a?!0:!h.startsWith("..")&&!path__default.isAbsolute(h)),f=micromatch$1(l,i,{cwd:e,dot:!0,matchBase:!i.includes("/"),posixSlashes:!0,strictBrackets:!0}).map(h=>normalizePath(n?h:path__default.resolve(e,h))),u={pattern:i,commands:o,fileList:f};return debugLog$c(`Generated task:
49
49
  %O`,u),u})},EOLRegex=new RegExp(node_os.EOL+"$"),bindLogger=s=>new node_stream.Writable({write:function(e,t,n){s(e.toString().replace(EOLRegex,"")),n()}}),getMainRendererOptions=({debug:s,quiet:e},t,n)=>e?{renderer:"silent"}:n.NODE_ENV==="test"?{renderer:"test",rendererOptions:{logger:new ListrLogger({processOutput:new ProcessOutput(bindLogger(t.log),bindLogger(t.error))})}}:s||n.TERM==="dumb"?{renderer:"verbose"}:{renderer:"update",rendererOptions:{formatOutput:"truncate"}},getFallbackRenderer=({renderer:s},{FORCE_COLOR:e})=>s==="silent"||s==="test"||Number(e)>0?s:"verbose",getRenderer=(s,e,t=process.env)=>{const n=getMainRendererOptions(s,e,t);return{...n,fallbackRenderer:getFallbackRenderer(n,t)}};function getDiffCommand(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 parseGitZOutput=s=>s?s.replace(/\u0000$/,"").split("\0"):[],getStagedFiles=async({cwd:s=process.cwd(),diff:e,diffFilter:t}={})=>{try{const n=await execGit(getDiffCommand(e,t),{cwd:s});return n?parseGitZOutput(n).map(r=>normalizePath(path__default.resolve(s,r))):[]}catch{return null}},debugLog$b=debug("lint-staged:file"),readFile$1=async(s,e=!0)=>{debugLog$b("Reading file `%s`",s);try{return await fs__default.readFile(s)}catch(t){if(e&&t.code==="ENOENT")return debugLog$b("File `%s` doesn't exist, ignoring...",s),null;throw t}},unlink=async(s,e=!0)=>{debugLog$b("Removing file `%s`",s);try{await fs__default.unlink(s)}catch(t){if(e&&t.code==="ENOENT")debugLog$b("File `%s` doesn't exist, ignoring...",s);else throw t}},writeFile=async(s,e)=>{debugLog$b("Writing file `%s`",s),await fs__default.writeFile(s,e)},ApplyEmptyCommitError=Symbol("ApplyEmptyCommitError"),ConfigNotFoundError=new Error("Configuration could not be found"),ConfigFormatError=new Error("Configuration should be an object or a function"),ConfigEmptyError=new Error("Configuration should not be empty"),GetBackupStashError=Symbol("GetBackupStashError"),GetStagedFilesError=Symbol("GetStagedFilesError"),GitError=Symbol("GitError"),GitRepoError=Symbol("GitRepoError"),HideUnstagedChangesError=Symbol("HideUnstagedChangesError"),InvalidOptionsError=new Error("Invalid Options"),RestoreMergeStatusError=Symbol("RestoreMergeStatusError"),RestoreOriginalStateError=Symbol("RestoreOriginalStateError"),RestoreUnstagedChangesError=Symbol("RestoreUnstagedChangesError"),TaskError=Symbol("TaskError"),debugLog$a=debug("lint-staged:GitWorkflow"),MERGE_HEAD="MERGE_HEAD",MERGE_MODE="MERGE_MODE",MERGE_MSG="MERGE_MSG",RENAME=/\x00/,processRenames=(s,e=!0)=>s.reduce((t,n)=>{if(RENAME.test(n)){const[r,i]=n.split(RENAME);e&&t.push(i),t.push(r)}else t.push(n);return t},[]),STASH="lint-staged automatic backup",PATCH_UNSTAGED="lint-staged_unstaged.patch",GIT_DIFF_ARGS=["--binary","--unified=0","--no-color","--no-ext-diff","--src-prefix=a/","--dst-prefix=b/","--patch","--submodule=short"],GIT_APPLY_ARGS=["-v","--whitespace=nowarn","--recount","--unidiff-zero"],handleError=(s,e,t)=>{throw e.errors.add(GitError),t&&e.errors.add(t),s};class GitWorkflow{constructor({allowEmpty:e,gitConfigDir:t,gitDir:n,matchedFileChunks:r,diff:i,diffFilter:o}){this.execGit=(a,l={})=>execGit(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=path__default.resolve(t,MERGE_HEAD),this.mergeModeFilename=path__default.resolve(t,MERGE_MODE),this.mergeMsgFilename=path__default.resolve(t,MERGE_MSG)}getHiddenFilepath(e){return path__default.resolve(this.gitConfigDir,`./${e}`)}async getBackupStash(e){const n=(await this.execGit(["stash","list"])).split(`
50
50
  `).findIndex(r=>r.includes(STASH));if(n===-1)throw e.errors.add(GetBackupStashError),new Error("lint-staged automatic backup is missing!");return String(n)}async getDeletedFiles(){debugLog$a("Getting deleted files...");const t=(await this.execGit(["ls-files","--deleted"])).split(`
51
- `).filter(Boolean).map(n=>path__default.resolve(this.gitDir,n));return debugLog$a("Found deleted files:",t),t}async backupMergeStatus(){debugLog$a("Backing up merge state..."),await Promise.all([readFile$1(this.mergeHeadFilename).then(e=>this.mergeHeadBuffer=e),readFile$1(this.mergeModeFilename).then(e=>this.mergeModeBuffer=e),readFile$1(this.mergeMsgFilename).then(e=>this.mergeMsgBuffer=e)]),debugLog$a("Done backing up merge state!")}async restoreMergeStatus(e){debugLog$a("Restoring merge state...");try{await Promise.all([this.mergeHeadBuffer&&writeFile(this.mergeHeadFilename,this.mergeHeadBuffer),this.mergeModeBuffer&&writeFile(this.mergeModeFilename,this.mergeModeBuffer),this.mergeMsgBuffer&&writeFile(this.mergeMsgFilename,this.mergeMsgBuffer)]),debugLog$a("Done restoring merge state!")}catch(t){debugLog$a("Failed restoring merge state with error:"),debugLog$a(t),handleError(new Error("Merge state could not be restored due to an error!"),e,RestoreMergeStatusError)}}async getPartiallyStagedFiles(){debugLog$a("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 debugLog$a("Found partially staged files:",t),t.length?t:null}async prepare(e){try{if(debugLog$a("Backing up original state..."),this.partiallyStagedFiles=await this.getPartiallyStagedFiles(),this.partiallyStagedFiles){e.hasPartiallyStagedFiles=!0;const n=this.getHiddenFilepath(PATCH_UNSTAGED),r=processRenames(this.partiallyStagedFiles);await this.execGit(["diff",...GIT_DIFF_ARGS,"--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",STASH,t]),debugLog$a("Done backing up original state!")}catch(t){handleError(t,e)}}async hideUnstagedChanges(e){try{const t=processRenames(this.partiallyStagedFiles,!1);await this.execGit(["checkout","--force","--",...t])}catch(t){handleError(t,e,HideUnstagedChangesError)}}async applyModifications(e){debugLog$a("Adding task modifications to index...");for(const n of this.matchedFileChunks)await this.execGit(["add","--",...n]);debugLog$a("Done adding task modifications to index!"),!await this.execGit(getDiffCommand(this.diff,this.diffFilter))&&!this.allowEmpty&&handleError(new Error("Prevented an empty git commit!"),e,ApplyEmptyCommitError)}async restoreUnstagedChanges(e){debugLog$a("Restoring unstaged changes...");const t=this.getHiddenFilepath(PATCH_UNSTAGED);try{await this.execGit(["apply",...GIT_APPLY_ARGS,t])}catch(n){debugLog$a("Error while restoring changes:"),debugLog$a(n),debugLog$a("Retrying with 3-way merge");try{await this.execGit(["apply",...GIT_APPLY_ARGS,"--3way",t])}catch(r){debugLog$a("Error while restoring unstaged changes using 3-way merge:"),debugLog$a(r),handleError(new Error("Unstaged changes could not be restored due to a merge conflict!"),e,RestoreUnstagedChangesError)}}}async restoreOriginalState(e){try{debugLog$a("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=>unlink(t))),await unlink(this.getHiddenFilepath(PATCH_UNSTAGED)),debugLog$a("Done restoring original state!")}catch(t){handleError(t,e,RestoreOriginalStateError)}}async cleanup(e){try{debugLog$a("Dropping backup stash..."),await this.execGit(["stash","drop","--quiet",await this.getBackupStash(e)]),debugLog$a("Done dropping backup stash!")}catch(t){handleError(t,e)}}}const debugLog$9=debug("lint-staged:groupFilesByConfig"),groupFilesByConfig=async({configs:s,files:e,singleConfigMode:t})=>{debugLog$9("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=path__default.normalize(path__default.dirname(i)),l=u=>{const f=path__default.relative(a,u);return f&&!f.startsWith("..")&&!path__default.isAbsolute(f)},c=Object.keys(o).some(u=>u.startsWith("..")),h=new Set(c?n:void 0);c||n.forEach(u=>{l(u)&&h.add(u)}),h.forEach(u=>{n.delete(u)}),r[i]={config:o,files:Array.from(h)}}return r};function parseArgsStringToArgv(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(firstString(o[1],o[6],o[0]));while(o!==null);return i}function firstString(){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 bin,hasRequiredBin;function requireBin(){if(hasRequiredBin)return bin;hasRequiredBin=1;var s=require$$0__default$3.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="",h="";l.stdout.on("data",function(u){c+=u.toString()}),l.stderr.on("data",function(u){h+=u.toString()}),l.on("error",function(u){a||(a=!0,o(new Error(u)))}),l.on("close",function(u){if(!a){if(a=!0,h=e(h),h)return o(new Error(h));o(null,c,u)}})}return bin=t,bin}var ps_1,hasRequiredPs;function requirePs(){if(hasRequiredPs)return ps_1;hasRequiredPs=1;var s=require$$0__default,e=requireBin();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(h){n(h)}})}return ps_1=t,ps_1}var wmic_1,hasRequiredWmic;function requireWmic(){if(hasRequiredWmic)return wmic_1;hasRequiredWmic=1;var s=require$$0__default,e=requireBin();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=[],h=1;h<a.length;h++)a[h]=a[h].trim(),a[h]&&(a[h]=a[h].split(/\s+/),a[h][0]=parseInt(a[h][0],10),a[h][1]=parseInt(a[h][1],10),c.push(a[h]));n(null,c)}catch(u){n(u)}})}return wmic_1=t,wmic_1}var os=require$$0__default,platformToMethod={darwin:"ps",sunos:"ps",freebsd:"ps",netbsd:"ps",win:"wmic",linux:"ps",aix:"ps"},methodToRequireFn={ps:()=>requirePs(),wmic:()=>requireWmic()},platform=os.platform();platform.startsWith("win")&&(platform="win");var method=platformToMethod[platform];function get(s){method===void 0&&s(new Error(os.platform()+" is not supported yet, please open an issue (https://github.com/simonepri/pidtree)"));var e=methodToRequireFn[method]();e(s)}var get_1=get,getAll=get_1;function list$1(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}getAll(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 h=0,u=[o];h<u.length;){var f=e.advanced?u[h++].pid:u[h++];if(l[f]){for(var d=l[f].length,m=0;m<d;m++)u.push(e.advanced?{ppid:f,pid:l[f][m]}:l[f][m]);delete l[f]}}e.root||u.shift(),t(null,u)})}var pidtree$1=list$1;function pify(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 pidtree=pidtree$1;function list(s,e,t){if(typeof e=="function"&&(t=e,e=void 0),typeof t=="function"){pidtree(s,e,t);return}return pify(pidtree,s,e)}var pidtree_1=list;const pidTree=getDefaultExportFromCjs(pidtree_1),getInitialState=({quiet:s=!1}={})=>({hasPartiallyStagedFiles:null,shouldBackup:null,shouldHidePartiallyStaged:!0,errors:new Set([]),events:new EventEmitter__default,output:[],quiet:s}),shouldHidePartiallyStagedFiles=s=>s.hasPartiallyStagedFiles&&s.shouldHidePartiallyStaged,applyModificationsSkipped=s=>{if(!s.shouldBackup)return!1;if(s.errors.has(GitError))return GIT_ERROR;if(s.errors.has(TaskError))return TASK_ERROR$1},restoreUnstagedChangesSkipped=s=>{if(s.errors.has(GitError))return GIT_ERROR;if(s.errors.has(TaskError))return TASK_ERROR$1},restoreOriginalStateEnabled=s=>s.shouldBackup&&(s.errors.has(TaskError)||s.errors.has(ApplyEmptyCommitError)||s.errors.has(RestoreUnstagedChangesError)),restoreOriginalStateSkipped=s=>{if(s.errors.has(GitError)&&!s.errors.has(ApplyEmptyCommitError)&&!s.errors.has(RestoreUnstagedChangesError))return GIT_ERROR},cleanupEnabled=s=>s.shouldBackup,cleanupSkipped=s=>{if(s.errors.has(GitError)&&!s.errors.has(ApplyEmptyCommitError)&&!s.errors.has(RestoreUnstagedChangesError)||s.errors.has(RestoreOriginalStateError))return GIT_ERROR},TASK_ERROR="lint-staged:taskError",debugLog$8=debug("lint-staged:resolveTaskFn"),getTag=({code:s,killed:e,signal:t})=>e&&"KILLED"||t||s||"FAILED",handleOutput=(s,e,t,n=!1)=>{const{stderr:r,stdout:i}=e;if(!!r||!!i){const a=n?chalk$1.redBright(`${error} ${s}:`):`${info} ${s}:`,l=[].concat(t.quiet?[]:["",a]).concat(r||[]).concat(i||[]);t.output.push(l.join(`
51
+ `).filter(Boolean).map(n=>path__default.resolve(this.gitDir,n));return debugLog$a("Found deleted files:",t),t}async backupMergeStatus(){debugLog$a("Backing up merge state..."),await Promise.all([readFile$1(this.mergeHeadFilename).then(e=>this.mergeHeadBuffer=e),readFile$1(this.mergeModeFilename).then(e=>this.mergeModeBuffer=e),readFile$1(this.mergeMsgFilename).then(e=>this.mergeMsgBuffer=e)]),debugLog$a("Done backing up merge state!")}async restoreMergeStatus(e){debugLog$a("Restoring merge state...");try{await Promise.all([this.mergeHeadBuffer&&writeFile(this.mergeHeadFilename,this.mergeHeadBuffer),this.mergeModeBuffer&&writeFile(this.mergeModeFilename,this.mergeModeBuffer),this.mergeMsgBuffer&&writeFile(this.mergeMsgFilename,this.mergeMsgBuffer)]),debugLog$a("Done restoring merge state!")}catch(t){debugLog$a("Failed restoring merge state with error:"),debugLog$a(t),handleError(new Error("Merge state could not be restored due to an error!"),e,RestoreMergeStatusError)}}async getPartiallyStagedFiles(){debugLog$a("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 debugLog$a("Found partially staged files:",t),t.length?t:null}async prepare(e){try{if(debugLog$a("Backing up original state..."),this.partiallyStagedFiles=await this.getPartiallyStagedFiles(),this.partiallyStagedFiles){e.hasPartiallyStagedFiles=!0;const n=this.getHiddenFilepath(PATCH_UNSTAGED),r=processRenames(this.partiallyStagedFiles);await this.execGit(["diff",...GIT_DIFF_ARGS,"--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",STASH,t]),debugLog$a("Done backing up original state!")}catch(t){handleError(t,e)}}async hideUnstagedChanges(e){try{const t=processRenames(this.partiallyStagedFiles,!1);await this.execGit(["checkout","--force","--",...t])}catch(t){handleError(t,e,HideUnstagedChangesError)}}async applyModifications(e){debugLog$a("Adding task modifications to index...");for(const n of this.matchedFileChunks)await this.execGit(["add","--",...n]);debugLog$a("Done adding task modifications to index!"),!await this.execGit(getDiffCommand(this.diff,this.diffFilter))&&!this.allowEmpty&&handleError(new Error("Prevented an empty git commit!"),e,ApplyEmptyCommitError)}async restoreUnstagedChanges(e){debugLog$a("Restoring unstaged changes...");const t=this.getHiddenFilepath(PATCH_UNSTAGED);try{await this.execGit(["apply",...GIT_APPLY_ARGS,t])}catch(n){debugLog$a("Error while restoring changes:"),debugLog$a(n),debugLog$a("Retrying with 3-way merge");try{await this.execGit(["apply",...GIT_APPLY_ARGS,"--3way",t])}catch(r){debugLog$a("Error while restoring unstaged changes using 3-way merge:"),debugLog$a(r),handleError(new Error("Unstaged changes could not be restored due to a merge conflict!"),e,RestoreUnstagedChangesError)}}}async restoreOriginalState(e){try{debugLog$a("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=>unlink(t))),await unlink(this.getHiddenFilepath(PATCH_UNSTAGED)),debugLog$a("Done restoring original state!")}catch(t){handleError(t,e,RestoreOriginalStateError)}}async cleanup(e){try{debugLog$a("Dropping backup stash..."),await this.execGit(["stash","drop","--quiet",await this.getBackupStash(e)]),debugLog$a("Done dropping backup stash!")}catch(t){handleError(t,e)}}}const debugLog$9=debug("lint-staged:groupFilesByConfig"),groupFilesByConfig=async({configs:s,files:e,singleConfigMode:t})=>{debugLog$9("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=path__default.normalize(path__default.dirname(i)),l=u=>{const h=path__default.relative(a,u);return h&&!h.startsWith("..")&&!path__default.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 parseArgsStringToArgv(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(firstString(o[1],o[6],o[0]));while(o!==null);return i}function firstString(){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 bin,hasRequiredBin;function requireBin(){if(hasRequiredBin)return bin;hasRequiredBin=1;var s=require$$0__default$3.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 bin=t,bin}var ps_1,hasRequiredPs;function requirePs(){if(hasRequiredPs)return ps_1;hasRequiredPs=1;var s=require$$0__default,e=requireBin();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 ps_1=t,ps_1}var wmic_1,hasRequiredWmic;function requireWmic(){if(hasRequiredWmic)return wmic_1;hasRequiredWmic=1;var s=require$$0__default,e=requireBin();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 wmic_1=t,wmic_1}var os=require$$0__default,platformToMethod={darwin:"ps",sunos:"ps",freebsd:"ps",netbsd:"ps",win:"wmic",linux:"ps",aix:"ps"},methodToRequireFn={ps:()=>requirePs(),wmic:()=>requireWmic()},platform=os.platform();platform.startsWith("win")&&(platform="win");var method=platformToMethod[platform];function get(s){method===void 0&&s(new Error(os.platform()+" is not supported yet, please open an issue (https://github.com/simonepri/pidtree)"));var e=methodToRequireFn[method]();e(s)}var get_1=get,getAll=get_1;function list$1(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}getAll(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 pidtree$1=list$1;function pify(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 pidtree=pidtree$1;function list(s,e,t){if(typeof e=="function"&&(t=e,e=void 0),typeof t=="function"){pidtree(s,e,t);return}return pify(pidtree,s,e)}var pidtree_1=list;const pidTree=getDefaultExportFromCjs(pidtree_1),getInitialState=({quiet:s=!1}={})=>({hasPartiallyStagedFiles:null,shouldBackup:null,shouldHidePartiallyStaged:!0,errors:new Set([]),events:new EventEmitter__default,output:[],quiet:s}),shouldHidePartiallyStagedFiles=s=>s.hasPartiallyStagedFiles&&s.shouldHidePartiallyStaged,applyModificationsSkipped=s=>{if(!s.shouldBackup)return!1;if(s.errors.has(GitError))return GIT_ERROR;if(s.errors.has(TaskError))return TASK_ERROR$1},restoreUnstagedChangesSkipped=s=>{if(s.errors.has(GitError))return GIT_ERROR;if(s.errors.has(TaskError))return TASK_ERROR$1},restoreOriginalStateEnabled=s=>s.shouldBackup&&(s.errors.has(TaskError)||s.errors.has(ApplyEmptyCommitError)||s.errors.has(RestoreUnstagedChangesError)),restoreOriginalStateSkipped=s=>{if(s.errors.has(GitError)&&!s.errors.has(ApplyEmptyCommitError)&&!s.errors.has(RestoreUnstagedChangesError))return GIT_ERROR},cleanupEnabled=s=>s.shouldBackup,cleanupSkipped=s=>{if(s.errors.has(GitError)&&!s.errors.has(ApplyEmptyCommitError)&&!s.errors.has(RestoreUnstagedChangesError)||s.errors.has(RestoreOriginalStateError))return GIT_ERROR},TASK_ERROR="lint-staged:taskError",debugLog$8=debug("lint-staged:resolveTaskFn"),getTag=({code:s,killed:e,signal:t})=>e&&"KILLED"||t||s||"FAILED",handleOutput=(s,e,t,n=!1)=>{const{stderr:r,stdout:i}=e;if(!!r||!!i){const a=n?chalk$1.redBright(`${error} ${s}:`):`${info} ${s}:`,l=[].concat(t.quiet?[]:["",a]).concat(r||[]).concat(i||[]);t.output.push(l.join(`
52
52
  `))}else if(n){const a=getTag(e),l=chalk$1.redBright(`
53
- ${error} ${s} failed without output (${a}).`);t.quiet||t.output.push(l)}},killExecaProcess=async s=>{try{const e=await pidTree(s.pid);for(const t of e)try{process.kill(t)}catch(n){debugLog$8('Failed to kill process with pid "%d": %o',t,n)}}catch(e){debugLog$8('Failed to kill process with pid "%d": %o',s.pid,e)}s.kill()},interruptExecutionOnError=(s,e)=>{let t;const n=async()=>{t=killExecaProcess(e),await t};return s.events.on(TASK_ERROR,n,{once:!0}),async()=>{s.events.off(TASK_ERROR,n),await t}},makeErr=(s,e,t)=>{t.errors.add(TaskError),t.events.emit(TASK_ERROR,TaskError),handleOutput(s,e,t,!0);const n=getTag(e);return new Error(`${chalk$1.redBright(s)} ${chalk$1.dim(`[${n}]`)}`)},resolveTaskFn=({command:s,cwd:e=process.cwd(),files:t,gitDir:n,isFn:r,shell:i=!1,verbose:o=!1})=>{const[a,...l]=parseArgsStringToArgv(s);debugLog$8("cmd:",a),debugLog$8("args:",l);const c={cwd:/^git(\.exe)?/i.test(a)?n:e,preferLocal:!0,reject:!1,shell:i};return debugLog$8("execaOptions:",c),async(h=getInitialState())=>{const u=i?execa.execaCommand(r?s:`${s} ${t.join(" ")}`,c):execa.execa(a,r?l:l.concat(t),c),f=interruptExecutionOnError(h,u),d=await u;if(await f(),d.failed||d.killed||d.signal!=null)throw makeErr(s,d,h);o&&handleOutput(s,d,h)}},debugLog$7=debug("lint-staged:makeCmdTasks"),makeCmdTasks=async({commands:s,cwd:e,files:t,gitDir:n,shell:r,verbose:i})=>{debugLog$7("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",h=c?await l([...t]):l,u=Array.isArray(h)?h:[h];for(const f of u){if(c&&typeof f!="string")throw new Error(configurationError("[Function]","Function task should return a string or an array of strings",h));const d=resolveTaskFn({command:f,cwd:e,files:t,gitDir:n,isFn:c,shell:r,verbose:i});a.push({title:f,command:f,task:d})}}return a},debugLog$6=debug("lint-staged:resolveGitRepo"),resolveGitConfigDir=async s=>{const e=path__default.join(s,".git"),t=await fs__default.lstat(e);if(t.isDirectory())return e;if(t.isSymbolicLink())return await fs__default.realpath(s);const n=(await readFile$1(e)).toString();return path__default.resolve(s,n.replace(/^gitdir: /,"")).trim()},determineGitDir=(s,e)=>(e&&e.endsWith(path__default.sep)&&(e=e.slice(0,-1)),e?s.substring(0,s.lastIndexOf(e)):s),resolveGitRepo=async(s=process.cwd())=>{try{debugLog$6("Resolving git repo from `%s`",s),debugLog$6("Unset GIT_DIR (was `%s`)",process.env.GIT_DIR),delete process.env.GIT_DIR,debugLog$6("Unset GIT_WORK_TREE (was `%s`)",process.env.GIT_WORK_TREE),delete process.env.GIT_WORK_TREE;const e=normalizePath(await execGit(["rev-parse","--show-prefix"],{cwd:s})),t=normalizePath(determineGitDir(normalizePath(s),e)),n=normalizePath(await resolveGitConfigDir(t));return debugLog$6("Resolved git directory to be `%s`",t),debugLog$6("Resolved git config directory to be `%s`",n),{gitDir:t,gitConfigDir:n}}catch(e){return debugLog$6("Failed to resolve git repo with error:",e),{error:e,gitDir:null,gitConfigDir:null}}},ALIAS=Symbol.for("yaml.alias"),DOC=Symbol.for("yaml.document"),MAP=Symbol.for("yaml.map"),PAIR=Symbol.for("yaml.pair"),SCALAR$1=Symbol.for("yaml.scalar"),SEQ=Symbol.for("yaml.seq"),NODE_TYPE=Symbol.for("yaml.node.type"),isAlias=s=>!!s&&typeof s=="object"&&s[NODE_TYPE]===ALIAS,isDocument=s=>!!s&&typeof s=="object"&&s[NODE_TYPE]===DOC,isMap=s=>!!s&&typeof s=="object"&&s[NODE_TYPE]===MAP,isPair=s=>!!s&&typeof s=="object"&&s[NODE_TYPE]===PAIR,isScalar$1=s=>!!s&&typeof s=="object"&&s[NODE_TYPE]===SCALAR$1,isSeq=s=>!!s&&typeof s=="object"&&s[NODE_TYPE]===SEQ;function isCollection$1(s){if(s&&typeof s=="object")switch(s[NODE_TYPE]){case MAP:case SEQ:return!0}return!1}function isNode(s){if(s&&typeof s=="object")switch(s[NODE_TYPE]){case ALIAS:case MAP:case SCALAR$1:case SEQ:return!0}return!1}const hasAnchor=s=>(isScalar$1(s)||isCollection$1(s))&&!!s.anchor,BREAK$1=Symbol("break visit"),SKIP$1=Symbol("skip children"),REMOVE$1=Symbol("remove node");function visit$1(s,e){const t=initVisitor(e);isDocument(s)?visit_(null,s.contents,t,Object.freeze([s]))===REMOVE$1&&(s.contents=null):visit_(null,s,t,Object.freeze([]))}visit$1.BREAK=BREAK$1,visit$1.SKIP=SKIP$1,visit$1.REMOVE=REMOVE$1;function visit_(s,e,t,n){const r=callVisitor(s,e,t,n);if(isNode(r)||isPair(r))return replaceNode(s,n,r),visit_(s,r,t,n);if(typeof r!="symbol"){if(isCollection$1(e)){n=Object.freeze(n.concat(e));for(let i=0;i<e.items.length;++i){const o=visit_(i,e.items[i],t,n);if(typeof o=="number")i=o-1;else{if(o===BREAK$1)return BREAK$1;o===REMOVE$1&&(e.items.splice(i,1),i-=1)}}}else if(isPair(e)){n=Object.freeze(n.concat(e));const i=visit_("key",e.key,t,n);if(i===BREAK$1)return BREAK$1;i===REMOVE$1&&(e.key=null);const o=visit_("value",e.value,t,n);if(o===BREAK$1)return BREAK$1;o===REMOVE$1&&(e.value=null)}}return r}async function visitAsync(s,e){const t=initVisitor(e);isDocument(s)?await visitAsync_(null,s.contents,t,Object.freeze([s]))===REMOVE$1&&(s.contents=null):await visitAsync_(null,s,t,Object.freeze([]))}visitAsync.BREAK=BREAK$1,visitAsync.SKIP=SKIP$1,visitAsync.REMOVE=REMOVE$1;async function visitAsync_(s,e,t,n){const r=await callVisitor(s,e,t,n);if(isNode(r)||isPair(r))return replaceNode(s,n,r),visitAsync_(s,r,t,n);if(typeof r!="symbol"){if(isCollection$1(e)){n=Object.freeze(n.concat(e));for(let i=0;i<e.items.length;++i){const o=await visitAsync_(i,e.items[i],t,n);if(typeof o=="number")i=o-1;else{if(o===BREAK$1)return BREAK$1;o===REMOVE$1&&(e.items.splice(i,1),i-=1)}}}else if(isPair(e)){n=Object.freeze(n.concat(e));const i=await visitAsync_("key",e.key,t,n);if(i===BREAK$1)return BREAK$1;i===REMOVE$1&&(e.key=null);const o=await visitAsync_("value",e.value,t,n);if(o===BREAK$1)return BREAK$1;o===REMOVE$1&&(e.value=null)}}return r}function initVisitor(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 callVisitor(s,e,t,n){if(typeof t=="function")return t(s,e,n);if(isMap(e))return t.Map?.(s,e,n);if(isSeq(e))return t.Seq?.(s,e,n);if(isPair(e))return t.Pair?.(s,e,n);if(isScalar$1(e))return t.Scalar?.(s,e,n);if(isAlias(e))return t.Alias?.(s,e,n)}function replaceNode(s,e,t){const n=e[e.length-1];if(isCollection$1(n))n.items[s]=t;else if(isPair(n))s==="key"?n.key=t:n.value=t;else if(isDocument(n))n.contents=t;else{const r=isAlias(n)?"alias":"scalar";throw new Error(`Cannot replace node with ${r} parent`)}}const escapeChars={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},escapeTagName=s=>s.replace(/[!,[\]{}]/g,e=>escapeChars[e]);class Directives{constructor(e,t){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},Directives.defaultYaml,e),this.tags=Object.assign({},Directives.defaultTags,t)}clone(){const e=new Directives(this.yaml,this.tags);return e.docStart=this.docStart,e}atDocument(){const e=new Directives(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:Directives.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},Directives.defaultTags);break}return e}add(e,t){this.atNextDocument&&(this.yaml={explicit:Directives.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},Directives.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+escapeTagName(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&&isNode(e.contents)){const i={};visit$1(e.contents,(o,a)=>{isNode(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
- `)}}Directives.defaultYaml={explicit:!1,version:"1.2"},Directives.defaultTags={"!!":"tag:yaml.org,2002:"};function anchorIsValid(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 anchorNames(s){const e=new Set;return visit$1(s,{Value(t,n){n.anchor&&e.add(n.anchor)}}),e}function findNewAnchor(s,e){for(let t=1;;++t){const n=`${s}${t}`;if(!e.has(n))return n}}function createNodeAnchors(s,e){const t=[],n=new Map;let r=null;return{onAnchor:i=>{t.push(i),r||(r=anchorNames(s));const o=findNewAnchor(e,r);return r.add(o),o},setAnchors:()=>{for(const i of t){const o=n.get(i);if(typeof o=="object"&&o.anchor&&(isScalar$1(o.node)||isCollection$1(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 applyReviver(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=applyReviver(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=applyReviver(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=applyReviver(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=applyReviver(s,n,r,i);o===void 0?delete n[r]:o!==i&&(n[r]=o)}return s.call(e,t,n)}function toJS(s,e,t){if(Array.isArray(s))return s.map((n,r)=>toJS(n,String(r),t));if(s&&typeof s.toJSON=="function"){if(!t||!hasAnchor(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 NodeBase{constructor(e){Object.defineProperty(this,NODE_TYPE,{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(!isDocument(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=toJS(this,"",o);if(typeof r=="function")for(const{count:l,res:c}of o.anchors.values())r(c,l);return typeof i=="function"?applyReviver(i,{"":a},"",a):a}}class Alias extends NodeBase{constructor(e){super(ALIAS),this.source=e,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(e){let t;return visit$1(e,{Node:(n,r)=>{if(r===this)return visit$1.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||(toJS(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=getAliasCount(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(anchorIsValid(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 getAliasCount(s,e,t){if(isAlias(e)){const n=e.resolve(s),r=t&&n&&t.get(n);return r?r.count*r.aliasCount:0}else if(isCollection$1(e)){let n=0;for(const r of e.items){const i=getAliasCount(s,r,t);i>n&&(n=i)}return n}else if(isPair(e)){const n=getAliasCount(s,e.key,t),r=getAliasCount(s,e.value,t);return Math.max(n,r)}return 1}const isScalarValue=s=>!s||typeof s!="function"&&typeof s!="object";class Scalar extends NodeBase{constructor(e){super(SCALAR$1),this.value=e}toJSON(e,t){return t?.keep?this.value:toJS(this.value,e,t)}toString(){return String(this.value)}}Scalar.BLOCK_FOLDED="BLOCK_FOLDED",Scalar.BLOCK_LITERAL="BLOCK_LITERAL",Scalar.PLAIN="PLAIN",Scalar.QUOTE_DOUBLE="QUOTE_DOUBLE",Scalar.QUOTE_SINGLE="QUOTE_SINGLE";const defaultTagPrefix="tag:yaml.org,2002:";function findTagObject(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 createNode(s,e,t){if(isDocument(s)&&(s=s.contents),isNode(s))return s;if(isPair(s)){const u=t.schema[MAP].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 Alias(l.anchor);l={anchor:null,node:null},a.set(s,l)}e?.startsWith("!!")&&(e=defaultTagPrefix+e.slice(2));let c=findTagObject(s,e,o.tags);if(!c){if(s&&typeof s.toJSON=="function"&&(s=s.toJSON()),!s||typeof s!="object"){const u=new Scalar(s);return l&&(l.node=u),u}c=s instanceof Map?o[MAP]:Symbol.iterator in Object(s)?o[SEQ]:o[MAP]}i&&(i(c),delete t.onTagObj);const h=c?.createNode?c.createNode(t.schema,s,t):typeof c?.nodeClass?.from=="function"?c.nodeClass.from(t.schema,s,t):new Scalar(s);return e?h.tag=e:c.default||(h.tag=c.tag),l&&(l.node=h),h}function collectionFromPath(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 createNode(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 isEmptyPath=s=>s==null||typeof s=="object"&&!!s[Symbol.iterator]().next().done;class Collection extends NodeBase{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=>isNode(n)||isPair(n)?n.clone(e):n),this.range&&(t.range=this.range.slice()),t}addIn(e,t){if(isEmptyPath(e))this.add(t);else{const[n,...r]=e,i=this.get(n,!0);if(isCollection$1(i))i.addIn(r,t);else if(i===void 0&&this.schema)this.set(n,collectionFromPath(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(isCollection$1(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&&isScalar$1(i)?i.value:i:isCollection$1(i)?i.getIn(r,t):void 0}hasAllNullValues(e){return this.items.every(t=>{if(!isPair(t))return!1;const n=t.value;return n==null||e&&isScalar$1(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 isCollection$1(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(isCollection$1(i))i.setIn(r,t);else if(i===void 0&&this.schema)this.set(n,collectionFromPath(this.schema,r,t));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}}}Collection.maxFlowStringSingleLineLength=60;const stringifyComment=s=>s.replace(/^(?!$)(?: $)?/gm,"#");function indentComment(s,e){return/^\n+$/.test(s)?s.substring(1):e?s.replace(/^(?! *$)/gm,e):s}const lineComment=(s,e,t)=>s.endsWith(`
53
+ ${error} ${s} failed without output (${a}).`);t.quiet||t.output.push(l)}},killExecaProcess=async s=>{try{const e=await pidTree(s.pid);for(const t of e)try{process.kill(t)}catch(n){debugLog$8('Failed to kill process with pid "%d": %o',t,n)}}catch(e){debugLog$8('Failed to kill process with pid "%d": %o',s.pid,e)}s.kill()},interruptExecutionOnError=(s,e)=>{let t;const n=async()=>{t=killExecaProcess(e),await t};return s.events.on(TASK_ERROR,n,{once:!0}),async()=>{s.events.off(TASK_ERROR,n),await t}},makeErr=(s,e,t)=>{t.errors.add(TaskError),t.events.emit(TASK_ERROR,TaskError),handleOutput(s,e,t,!0);const n=getTag(e);return new Error(`${chalk$1.redBright(s)} ${chalk$1.dim(`[${n}]`)}`)},resolveTaskFn=({command:s,cwd:e=process.cwd(),files:t,gitDir:n,isFn:r,shell:i=!1,verbose:o=!1})=>{const[a,...l]=parseArgsStringToArgv(s);debugLog$8("cmd:",a),debugLog$8("args:",l);const c={cwd:/^git(\.exe)?/i.test(a)?n:e,preferLocal:!0,reject:!1,shell:i};return debugLog$8("execaOptions:",c),async(f=getInitialState())=>{const u=i?execa.execaCommand(r?s:`${s} ${t.join(" ")}`,c):execa.execa(a,r?l:l.concat(t),c),h=interruptExecutionOnError(f,u),d=await u;if(await h(),d.failed||d.killed||d.signal!=null)throw makeErr(s,d,f);o&&handleOutput(s,d,f)}},debugLog$7=debug("lint-staged:makeCmdTasks"),makeCmdTasks=async({commands:s,cwd:e,files:t,gitDir:n,shell:r,verbose:i})=>{debugLog$7("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(configurationError("[Function]","Function task should return a string or an array of strings",f));const d=resolveTaskFn({command:h,cwd:e,files:t,gitDir:n,isFn:c,shell:r,verbose:i});a.push({title:h,command:h,task:d})}}return a},debugLog$6=debug("lint-staged:resolveGitRepo"),resolveGitConfigDir=async s=>{const e=path__default.join(s,".git"),t=await fs__default.lstat(e);if(t.isDirectory())return e;if(t.isSymbolicLink())return await fs__default.realpath(s);const n=(await readFile$1(e)).toString();return path__default.resolve(s,n.replace(/^gitdir: /,"")).trim()},determineGitDir=(s,e)=>(e&&e.endsWith(path__default.sep)&&(e=e.slice(0,-1)),e?s.substring(0,s.lastIndexOf(e)):s),resolveGitRepo=async(s=process.cwd())=>{try{debugLog$6("Resolving git repo from `%s`",s),debugLog$6("Unset GIT_DIR (was `%s`)",process.env.GIT_DIR),delete process.env.GIT_DIR,debugLog$6("Unset GIT_WORK_TREE (was `%s`)",process.env.GIT_WORK_TREE),delete process.env.GIT_WORK_TREE;const e=normalizePath(await execGit(["rev-parse","--show-prefix"],{cwd:s})),t=normalizePath(determineGitDir(normalizePath(s),e)),n=normalizePath(await resolveGitConfigDir(t));return debugLog$6("Resolved git directory to be `%s`",t),debugLog$6("Resolved git config directory to be `%s`",n),{gitDir:t,gitConfigDir:n}}catch(e){return debugLog$6("Failed to resolve git repo with error:",e),{error:e,gitDir:null,gitConfigDir:null}}},ALIAS=Symbol.for("yaml.alias"),DOC=Symbol.for("yaml.document"),MAP=Symbol.for("yaml.map"),PAIR=Symbol.for("yaml.pair"),SCALAR$1=Symbol.for("yaml.scalar"),SEQ=Symbol.for("yaml.seq"),NODE_TYPE=Symbol.for("yaml.node.type"),isAlias=s=>!!s&&typeof s=="object"&&s[NODE_TYPE]===ALIAS,isDocument=s=>!!s&&typeof s=="object"&&s[NODE_TYPE]===DOC,isMap=s=>!!s&&typeof s=="object"&&s[NODE_TYPE]===MAP,isPair=s=>!!s&&typeof s=="object"&&s[NODE_TYPE]===PAIR,isScalar$1=s=>!!s&&typeof s=="object"&&s[NODE_TYPE]===SCALAR$1,isSeq=s=>!!s&&typeof s=="object"&&s[NODE_TYPE]===SEQ;function isCollection$1(s){if(s&&typeof s=="object")switch(s[NODE_TYPE]){case MAP:case SEQ:return!0}return!1}function isNode(s){if(s&&typeof s=="object")switch(s[NODE_TYPE]){case ALIAS:case MAP:case SCALAR$1:case SEQ:return!0}return!1}const hasAnchor=s=>(isScalar$1(s)||isCollection$1(s))&&!!s.anchor,BREAK$1=Symbol("break visit"),SKIP$1=Symbol("skip children"),REMOVE$1=Symbol("remove node");function visit$1(s,e){const t=initVisitor(e);isDocument(s)?visit_(null,s.contents,t,Object.freeze([s]))===REMOVE$1&&(s.contents=null):visit_(null,s,t,Object.freeze([]))}visit$1.BREAK=BREAK$1,visit$1.SKIP=SKIP$1,visit$1.REMOVE=REMOVE$1;function visit_(s,e,t,n){const r=callVisitor(s,e,t,n);if(isNode(r)||isPair(r))return replaceNode(s,n,r),visit_(s,r,t,n);if(typeof r!="symbol"){if(isCollection$1(e)){n=Object.freeze(n.concat(e));for(let i=0;i<e.items.length;++i){const o=visit_(i,e.items[i],t,n);if(typeof o=="number")i=o-1;else{if(o===BREAK$1)return BREAK$1;o===REMOVE$1&&(e.items.splice(i,1),i-=1)}}}else if(isPair(e)){n=Object.freeze(n.concat(e));const i=visit_("key",e.key,t,n);if(i===BREAK$1)return BREAK$1;i===REMOVE$1&&(e.key=null);const o=visit_("value",e.value,t,n);if(o===BREAK$1)return BREAK$1;o===REMOVE$1&&(e.value=null)}}return r}async function visitAsync(s,e){const t=initVisitor(e);isDocument(s)?await visitAsync_(null,s.contents,t,Object.freeze([s]))===REMOVE$1&&(s.contents=null):await visitAsync_(null,s,t,Object.freeze([]))}visitAsync.BREAK=BREAK$1,visitAsync.SKIP=SKIP$1,visitAsync.REMOVE=REMOVE$1;async function visitAsync_(s,e,t,n){const r=await callVisitor(s,e,t,n);if(isNode(r)||isPair(r))return replaceNode(s,n,r),visitAsync_(s,r,t,n);if(typeof r!="symbol"){if(isCollection$1(e)){n=Object.freeze(n.concat(e));for(let i=0;i<e.items.length;++i){const o=await visitAsync_(i,e.items[i],t,n);if(typeof o=="number")i=o-1;else{if(o===BREAK$1)return BREAK$1;o===REMOVE$1&&(e.items.splice(i,1),i-=1)}}}else if(isPair(e)){n=Object.freeze(n.concat(e));const i=await visitAsync_("key",e.key,t,n);if(i===BREAK$1)return BREAK$1;i===REMOVE$1&&(e.key=null);const o=await visitAsync_("value",e.value,t,n);if(o===BREAK$1)return BREAK$1;o===REMOVE$1&&(e.value=null)}}return r}function initVisitor(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 callVisitor(s,e,t,n){if(typeof t=="function")return t(s,e,n);if(isMap(e))return t.Map?.(s,e,n);if(isSeq(e))return t.Seq?.(s,e,n);if(isPair(e))return t.Pair?.(s,e,n);if(isScalar$1(e))return t.Scalar?.(s,e,n);if(isAlias(e))return t.Alias?.(s,e,n)}function replaceNode(s,e,t){const n=e[e.length-1];if(isCollection$1(n))n.items[s]=t;else if(isPair(n))s==="key"?n.key=t:n.value=t;else if(isDocument(n))n.contents=t;else{const r=isAlias(n)?"alias":"scalar";throw new Error(`Cannot replace node with ${r} parent`)}}const escapeChars={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},escapeTagName=s=>s.replace(/[!,[\]{}]/g,e=>escapeChars[e]);class Directives{constructor(e,t){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},Directives.defaultYaml,e),this.tags=Object.assign({},Directives.defaultTags,t)}clone(){const e=new Directives(this.yaml,this.tags);return e.docStart=this.docStart,e}atDocument(){const e=new Directives(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:Directives.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},Directives.defaultTags);break}return e}add(e,t){this.atNextDocument&&(this.yaml={explicit:Directives.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},Directives.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+escapeTagName(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&&isNode(e.contents)){const i={};visit$1(e.contents,(o,a)=>{isNode(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
+ `)}}Directives.defaultYaml={explicit:!1,version:"1.2"},Directives.defaultTags={"!!":"tag:yaml.org,2002:"};function anchorIsValid(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 anchorNames(s){const e=new Set;return visit$1(s,{Value(t,n){n.anchor&&e.add(n.anchor)}}),e}function findNewAnchor(s,e){for(let t=1;;++t){const n=`${s}${t}`;if(!e.has(n))return n}}function createNodeAnchors(s,e){const t=[],n=new Map;let r=null;return{onAnchor:i=>{t.push(i),r||(r=anchorNames(s));const o=findNewAnchor(e,r);return r.add(o),o},setAnchors:()=>{for(const i of t){const o=n.get(i);if(typeof o=="object"&&o.anchor&&(isScalar$1(o.node)||isCollection$1(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 applyReviver(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=applyReviver(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=applyReviver(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=applyReviver(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=applyReviver(s,n,r,i);o===void 0?delete n[r]:o!==i&&(n[r]=o)}return s.call(e,t,n)}function toJS(s,e,t){if(Array.isArray(s))return s.map((n,r)=>toJS(n,String(r),t));if(s&&typeof s.toJSON=="function"){if(!t||!hasAnchor(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 NodeBase{constructor(e){Object.defineProperty(this,NODE_TYPE,{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(!isDocument(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=toJS(this,"",o);if(typeof r=="function")for(const{count:l,res:c}of o.anchors.values())r(c,l);return typeof i=="function"?applyReviver(i,{"":a},"",a):a}}class Alias extends NodeBase{constructor(e){super(ALIAS),this.source=e,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(e){let t;return visit$1(e,{Node:(n,r)=>{if(r===this)return visit$1.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||(toJS(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=getAliasCount(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(anchorIsValid(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 getAliasCount(s,e,t){if(isAlias(e)){const n=e.resolve(s),r=t&&n&&t.get(n);return r?r.count*r.aliasCount:0}else if(isCollection$1(e)){let n=0;for(const r of e.items){const i=getAliasCount(s,r,t);i>n&&(n=i)}return n}else if(isPair(e)){const n=getAliasCount(s,e.key,t),r=getAliasCount(s,e.value,t);return Math.max(n,r)}return 1}const isScalarValue=s=>!s||typeof s!="function"&&typeof s!="object";class Scalar extends NodeBase{constructor(e){super(SCALAR$1),this.value=e}toJSON(e,t){return t?.keep?this.value:toJS(this.value,e,t)}toString(){return String(this.value)}}Scalar.BLOCK_FOLDED="BLOCK_FOLDED",Scalar.BLOCK_LITERAL="BLOCK_LITERAL",Scalar.PLAIN="PLAIN",Scalar.QUOTE_DOUBLE="QUOTE_DOUBLE",Scalar.QUOTE_SINGLE="QUOTE_SINGLE";const defaultTagPrefix="tag:yaml.org,2002:";function findTagObject(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 createNode(s,e,t){if(isDocument(s)&&(s=s.contents),isNode(s))return s;if(isPair(s)){const u=t.schema[MAP].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 Alias(l.anchor);l={anchor:null,node:null},a.set(s,l)}e?.startsWith("!!")&&(e=defaultTagPrefix+e.slice(2));let c=findTagObject(s,e,o.tags);if(!c){if(s&&typeof s.toJSON=="function"&&(s=s.toJSON()),!s||typeof s!="object"){const u=new Scalar(s);return l&&(l.node=u),u}c=s instanceof Map?o[MAP]:Symbol.iterator in Object(s)?o[SEQ]:o[MAP]}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 Scalar(s);return e?f.tag=e:c.default||(f.tag=c.tag),l&&(l.node=f),f}function collectionFromPath(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 createNode(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 isEmptyPath=s=>s==null||typeof s=="object"&&!!s[Symbol.iterator]().next().done;class Collection extends NodeBase{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=>isNode(n)||isPair(n)?n.clone(e):n),this.range&&(t.range=this.range.slice()),t}addIn(e,t){if(isEmptyPath(e))this.add(t);else{const[n,...r]=e,i=this.get(n,!0);if(isCollection$1(i))i.addIn(r,t);else if(i===void 0&&this.schema)this.set(n,collectionFromPath(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(isCollection$1(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&&isScalar$1(i)?i.value:i:isCollection$1(i)?i.getIn(r,t):void 0}hasAllNullValues(e){return this.items.every(t=>{if(!isPair(t))return!1;const n=t.value;return n==null||e&&isScalar$1(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 isCollection$1(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(isCollection$1(i))i.setIn(r,t);else if(i===void 0&&this.schema)this.set(n,collectionFromPath(this.schema,r,t));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}}}Collection.maxFlowStringSingleLineLength=60;const stringifyComment=s=>s.replace(/^(?!$)(?: $)?/gm,"#");function indentComment(s,e){return/^\n+$/.test(s)?s.substring(1):e?s.replace(/^(?! *$)/gm,e):s}const lineComment=(s,e,t)=>s.endsWith(`
55
55
  `)?indentComment(t,e):t.includes(`
56
56
  `)?`
57
- `+indentComment(t,e):(s.endsWith(" ")?"":" ")+t,FOLD_FLOW="flow",FOLD_BLOCK="block",FOLD_QUOTED="quoted";function foldFlowLines(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=[],h={};let u=r-e.length;typeof n=="number"&&(n>r-Math.max(2,i)?c.push(0):u=r-n);let f,d,m=!1,p=-1,g=-1,y=-1;t===FOLD_BLOCK&&(p=consumeMoreIndentedLines(s,p),p!==-1&&(u=p+l));for(let A;A=s[p+=1];){if(t===FOLD_QUOTED&&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===FOLD_BLOCK&&(p=consumeMoreIndentedLines(s,p)),u=p+l,f=void 0;else{if(A===" "&&d&&d!==" "&&d!==`
57
+ `+indentComment(t,e):(s.endsWith(" ")?"":" ")+t,FOLD_FLOW="flow",FOLD_BLOCK="block",FOLD_QUOTED="quoted";function foldFlowLines(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===FOLD_BLOCK&&(p=consumeMoreIndentedLines(s,p),p!==-1&&(u=p+l));for(let A;A=s[p+=1];){if(t===FOLD_QUOTED&&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===FOLD_BLOCK&&(p=consumeMoreIndentedLines(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!==" "&&(f=p)}if(p>=u)if(f)c.push(f),u=f+l,f=void 0;else if(t===FOLD_QUOTED){for(;d===" "||d===" ";)d=A,A=s[p+=1],m=!0;const L=p>y+1?p-2:g-1;if(h[L])return s;c.push(L),h[L]=!0,u=L+l,f=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===FOLD_QUOTED&&h[L]&&(S+=`${s[L]}\\`),S+=`
60
+ `&&L!==" "&&(h=p)}if(p>=u)if(h)c.push(h),u=h+l,h=void 0;else if(t===FOLD_QUOTED){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===FOLD_QUOTED&&f[L]&&(S+=`${s[L]}\\`),S+=`
62
62
  ${e}${s.slice(L+1,R)}`)}return S}function consumeMoreIndentedLines(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 getFoldOptions=(s,e)=>({indentAtStart:e?s.indent.length:s.indentAtStart,lineWidth:s.options.lineWidth,minContentWidth:s.options.minContentWidth}),containsDocumentMarker=s=>/^(%|---|\.\.\.)/m.test(s);function lineLengthOverLimit(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 doubleQuotedString(s,e){const t=JSON.stringify(s);if(e.options.doubleQuotedAsJSON)return t;const{implicitKey:n}=e,r=e.options.doubleQuotedMinMultiLineLength,i=e.indent||(containsDocumentMarker(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 h=t.substr(l+2,4);switch(h){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:h.substr(0,2)==="00"?o+="\\x"+h.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)+`
64
+ `){if(i-o>n)return!0;if(o=i+1,r-o<=n)return!1}return!0}function doubleQuotedString(s,e){const t=JSON.stringify(s);if(e.options.doubleQuotedAsJSON)return t;const{implicitKey:n}=e,r=e.options.doubleQuotedMinMultiLineLength,i=e.indent||(containsDocumentMarker(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
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:foldFlowLines(o,i,FOLD_QUOTED,getFoldOptions(e,!1))}function singleQuotedString(s,e){if(e.options.singleQuote===!1||e.implicitKey&&s.includes(`
@@ -69,71 +69,71 @@ ${e}${s.slice(L+1,R)}`)}return S}function consumeMoreIndentedLines(s,e){let t=s[
69
69
  ${t}`)+"'";return e.implicitKey?n:foldFlowLines(n,t,FOLD_FLOW,getFoldOptions(e,!1))}function quotedString(s,e){const{singleQuote:t}=e.options;let n;if(t===!1)n=doubleQuotedString;else{const r=s.includes('"'),i=s.includes("'");r&&!i?n=singleQuotedString:i&&!r?n=doubleQuotedString:n=t?singleQuotedString:doubleQuotedString}return n(s,e)}let blockEndNewlines;try{blockEndNewlines=new RegExp(`(^|(?<!
70
70
  ))
71
71
  +(?!
72
- |$)`,"g")}catch{blockEndNewlines=/\n+(?!\n|$)/g}function blockString({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 quotedString(t,n);const c=n.indent||(n.forceBlockIndent||containsDocumentMarker(t)?" ":""),h=o==="literal"?!0:o==="folded"||e===Scalar.BLOCK_FOLDED?!1:e===Scalar.BLOCK_LITERAL?!0:!lineLengthOverLimit(t,l,c.length);if(!t)return h?`|
72
+ |$)`,"g")}catch{blockEndNewlines=/\n+(?!\n|$)/g}function blockString({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 quotedString(t,n);const c=n.indent||(n.forceBlockIndent||containsDocumentMarker(t)?" ":""),f=o==="literal"?!0:o==="folded"||e===Scalar.BLOCK_FOLDED?!1:e===Scalar.BLOCK_LITERAL?!0:!lineLengthOverLimit(t,l,c.length);if(!t)return f?`|
73
73
  `:`>
74
- `;let u,f;for(f=t.length;f>0;--f){const O=t[f-1];if(O!==`
75
- `&&O!==" "&&O!==" ")break}let d=t.substring(f);const m=d.indexOf(`
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(blockEndNewlines,`$&${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=(h?"|":">")+(p?c?"2":"1":"")+u;if(s&&(L+=" "+a(s.replace(/ ?[\r\n]+/g," ")),r&&r()),h)return t=t.replace(/\n+/g,`$&${c}`),`${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
80
  $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${c}`);const R=foldFlowLines(`${S}${t}${d}`,c,FOLD_BLOCK,getFoldOptions(n,!0));return`${L}
81
- ${c}${R}`}function plainString(s,e,t,n){const{type:r,value:i}=s,{actualString:o,implicitKey:a,indent:l,indentStep:c,inFlow:h}=e;if(a&&i.includes(`
82
- `)||h&&/[[\]{},]/.test(i))return quotedString(i,e);if(!i||/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(i))return a||h||!i.includes(`
83
- `)?quotedString(i,e):blockString(s,e,t,n);if(!a&&!h&&r!==Scalar.PLAIN&&i.includes(`
81
+ ${c}${R}`}function plainString(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 quotedString(i,e);if(!i||/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(i))return a||f||!i.includes(`
83
+ `)?quotedString(i,e):blockString(s,e,t,n);if(!a&&!f&&r!==Scalar.PLAIN&&i.includes(`
84
84
  `))return blockString(s,e,t,n);if(containsDocumentMarker(i)){if(l==="")return e.forceBlockIndent=!0,blockString(s,e,t,n);if(a&&l===c)return quotedString(i,e)}const u=i.replace(/\n+/g,`$&
85
- ${l}`);if(o){const f=p=>p.default&&p.tag!=="tag:yaml.org,2002:str"&&p.test?.test(u),{compat:d,tags:m}=e.doc.schema;if(m.some(f)||d?.some(f))return quotedString(i,e)}return a?u:foldFlowLines(u,l,FOLD_FLOW,getFoldOptions(e,!1))}function stringifyString(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!==Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value)&&(a=Scalar.QUOTE_DOUBLE);const l=h=>{switch(h){case Scalar.BLOCK_FOLDED:case Scalar.BLOCK_LITERAL:return r||i?quotedString(o.value,e):blockString(o,e,t,n);case Scalar.QUOTE_DOUBLE:return doubleQuotedString(o.value,e);case Scalar.QUOTE_SINGLE:return singleQuotedString(o.value,e);case Scalar.PLAIN:return plainString(o,e,t,n);default:return null}};let c=l(a);if(c===null){const{defaultKeyType:h,defaultStringType:u}=e.options,f=r&&h||u;if(c=l(f),c===null)throw new Error(`Unsupported default string type ${f}`)}return c}function createStringifyContext(s,e){const t=Object.assign({blockQuote:!0,commentString:stringifyComment,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 getTagObject(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(isScalar$1(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 stringifyProps(s,e,{anchors:t,doc:n}){if(!n.directives)return"";const r=[],i=(isScalar$1(s)||isCollection$1(s))&&s.anchor;i&&anchorIsValid(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 stringify$2(s,e,t,n){if(isPair(s))return s.toString(e,t,n);if(isAlias(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=isNode(s)?s:e.doc.createNode(s,{onTagObj:l=>r=l});r||(r=getTagObject(e.doc.schema.tags,i));const o=stringifyProps(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):isScalar$1(i)?stringifyString(i,e,t,n):i.toString(e,t,n);return o?isScalar$1(i)||a[0]==="{"||a[0]==="["?`${o} ${a}`:`${o}
86
- ${e.indent}${a}`:a}function stringifyPair({key:s,value:e},t,n,r){const{allNullValues:i,doc:o,indent:a,indentStep:l,options:{commentString:c,indentSeq:h,simpleKeys:u}}=t;let f=isNode(s)&&s.comment||null;if(u){if(f)throw new Error("With simple keys, key nodes cannot have comments");if(isCollection$1(s)){const I="With simple keys, collection cannot be used as a key value";throw new Error(I)}}let d=!u&&(!s||f&&e==null&&!t.inFlow||isCollection$1(s)||(isScalar$1(s)?s.type===Scalar.BLOCK_FOLDED||s.type===Scalar.BLOCK_LITERAL:typeof s=="object"));t=Object.assign({},t,{allNullValues:!1,implicitKey:!d&&(u||!i),indent:a+l});let m=!1,p=!1,g=stringify$2(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}`,f&&!m?g+=lineComment(g,t.indent,c(f)):p&&r&&r(),g;m&&(f=null),d?(f&&(g+=lineComment(g,t.indent,c(f))),g=`? ${g}
87
- ${a}:`):(g=`${g}:`,f&&(g+=lineComment(g,t.indent,c(f))));let y,S,A;isNode(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&&!f&&isScalar$1(e)&&(t.indentAtStart=g.length+1),p=!1,!h&&l.length>=2&&!t.inFlow&&!d&&isSeq(e)&&!e.flow&&!e.tag&&!e.anchor&&(t.indent=t.indent.substring(2));let L=!1;const R=stringify$2(e,t,()=>L=!0,()=>p=!0);let O=" ";if(f||y||S){if(O=y?`
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 quotedString(i,e)}return a?u:foldFlowLines(u,l,FOLD_FLOW,getFoldOptions(e,!1))}function stringifyString(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!==Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value)&&(a=Scalar.QUOTE_DOUBLE);const l=f=>{switch(f){case Scalar.BLOCK_FOLDED:case Scalar.BLOCK_LITERAL:return r||i?quotedString(o.value,e):blockString(o,e,t,n);case Scalar.QUOTE_DOUBLE:return doubleQuotedString(o.value,e);case Scalar.QUOTE_SINGLE:return singleQuotedString(o.value,e);case Scalar.PLAIN:return plainString(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 createStringifyContext(s,e){const t=Object.assign({blockQuote:!0,commentString:stringifyComment,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 getTagObject(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(isScalar$1(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 stringifyProps(s,e,{anchors:t,doc:n}){if(!n.directives)return"";const r=[],i=(isScalar$1(s)||isCollection$1(s))&&s.anchor;i&&anchorIsValid(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 stringify$2(s,e,t,n){if(isPair(s))return s.toString(e,t,n);if(isAlias(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=isNode(s)?s:e.doc.createNode(s,{onTagObj:l=>r=l});r||(r=getTagObject(e.doc.schema.tags,i));const o=stringifyProps(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):isScalar$1(i)?stringifyString(i,e,t,n):i.toString(e,t,n);return o?isScalar$1(i)||a[0]==="{"||a[0]==="["?`${o} ${a}`:`${o}
86
+ ${e.indent}${a}`:a}function stringifyPair({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=isNode(s)&&s.comment||null;if(u){if(h)throw new Error("With simple keys, key nodes cannot have comments");if(isCollection$1(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||isCollection$1(s)||(isScalar$1(s)?s.type===Scalar.BLOCK_FOLDED||s.type===Scalar.BLOCK_LITERAL:typeof s=="object"));t=Object.assign({},t,{allNullValues:!1,implicitKey:!d&&(u||!i),indent:a+l});let m=!1,p=!1,g=stringify$2(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+=lineComment(g,t.indent,c(h)):p&&r&&r(),g;m&&(h=null),d?(h&&(g+=lineComment(g,t.indent,c(h))),g=`? ${g}
87
+ ${a}:`):(g=`${g}:`,h&&(g+=lineComment(g,t.indent,c(h))));let y,S,A;isNode(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&&isScalar$1(e)&&(t.indentAtStart=g.length+1),p=!1,!f&&l.length>=2&&!t.inFlow&&!d&&isSeq(e)&&!e.flow&&!e.tag&&!e.anchor&&(t.indent=t.indent.substring(2));let L=!1;const R=stringify$2(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
  ${indentComment(I,t.indent)}`}R===""&&!t.inFlow?O===`
90
90
  `&&(O=`
91
91
 
92
92
  `):O+=`
93
93
  ${t.indent}`}else if(!d&&isCollection$1(e)){const I=R[0],_=R.indexOf(`
94
- `),k=_!==-1,F=t.inFlow??e.flow??e.items.length===0;if(k||!F){let E=!1;if(k&&(I==="&"||I==="!")){let $=R.indexOf(" ");I==="&"&&$!==-1&&$<_&&R[$+1]==="!"&&($=R.indexOf(" ",$+1)),($===-1||_<$)&&(E=!0)}E||(O=`
94
+ `),k=_!==-1,D=t.inFlow??e.flow??e.items.length===0;if(k||!D){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+=lineComment(g,t.indent,c(A)):p&&r&&r(),g}function warn(s,e){(s==="debug"||s==="warn")&&(typeof process<"u"&&process.emitWarning?process.emitWarning(e):console.warn(e))}const MERGE_KEY="<<";function addPairToJSMap(s,e,{key:t,value:n}){if(s?.doc.schema.merge&&isMergeKey(t))if(n=isAlias(n)?n.resolve(s.doc):n,isSeq(n))for(const r of n.items)mergeToJSMap(s,e,r);else if(Array.isArray(n))for(const r of n)mergeToJSMap(s,e,r);else mergeToJSMap(s,e,n);else{const r=toJS(t,"",s);if(e instanceof Map)e.set(r,toJS(n,r,s));else if(e instanceof Set)e.add(r);else{const i=stringifyKey(t,r,s),o=toJS(n,i,s);i in e?Object.defineProperty(e,i,{value:o,writable:!0,enumerable:!0,configurable:!0}):e[i]=o}}return e}const isMergeKey=s=>s===MERGE_KEY||isScalar$1(s)&&s.value===MERGE_KEY&&(!s.type||s.type===Scalar.PLAIN);function mergeToJSMap(s,e,t){const n=s&&isAlias(t)?t.resolve(s.doc):t;if(!isMap(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 stringifyKey(s,e,t){if(e===null)return"";if(typeof e!="object")return String(e);if(isNode(s)&&t?.doc){const n=createStringifyContext(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)+'..."'),warn(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 createPair(s,e,t){const n=createNode(s,void 0,t),r=createNode(e,void 0,t);return new Pair(n,r)}class Pair{constructor(e,t=null){Object.defineProperty(this,NODE_TYPE,{value:PAIR}),this.key=e,this.value=t}clone(e){let{key:t,value:n}=this;return isNode(t)&&(t=t.clone(e)),isNode(n)&&(n=n.clone(e)),new Pair(t,n)}toJSON(e,t){const n=t?.mapAsMap?new Map:{};return addPairToJSMap(t,n,this)}toString(e,t,n){return e?.doc?stringifyPair(this,e,t,n):JSON.stringify(this)}}function stringifyCollection(s,e,t){return(e.inFlow??s.flow?stringifyFlowCollection:stringifyBlockCollection)(s,e,t)}function stringifyBlockCollection({comment:s,items:e},t,{blockItemPrefix:n,flowChars:r,itemIndent:i,onChompKeep:o,onComment:a}){const{indent:l,options:{commentString:c}}=t,h=Object.assign({},t,{indent:i,type:null});let u=!1;const f=[];for(let m=0;m<e.length;++m){const p=e[m];let g=null;if(isNode(p))!u&&p.spaceBefore&&f.push(""),addCommentBefore(t,f,p.commentBefore,u),p.comment&&(g=p.comment);else if(isPair(p)){const S=isNode(p.key)?p.key:null;S&&(!u&&S.spaceBefore&&f.push(""),addCommentBefore(t,f,S.commentBefore,u))}u=!1;let y=stringify$2(p,h,()=>g=null,()=>u=!0);g&&(y+=lineComment(y,i,c(g))),u&&g&&(u=!1),f.push(n+y)}let d;if(f.length===0)d=r.start+r.end;else{d=f[0];for(let m=1;m<f.length;++m){const p=f[m];d+=p?`
96
+ `)&&(O="");return g+=O+R,t.inFlow?L&&n&&n():A&&!L?g+=lineComment(g,t.indent,c(A)):p&&r&&r(),g}function warn(s,e){(s==="debug"||s==="warn")&&(typeof process<"u"&&process.emitWarning?process.emitWarning(e):console.warn(e))}const MERGE_KEY="<<";function addPairToJSMap(s,e,{key:t,value:n}){if(s?.doc.schema.merge&&isMergeKey(t))if(n=isAlias(n)?n.resolve(s.doc):n,isSeq(n))for(const r of n.items)mergeToJSMap(s,e,r);else if(Array.isArray(n))for(const r of n)mergeToJSMap(s,e,r);else mergeToJSMap(s,e,n);else{const r=toJS(t,"",s);if(e instanceof Map)e.set(r,toJS(n,r,s));else if(e instanceof Set)e.add(r);else{const i=stringifyKey(t,r,s),o=toJS(n,i,s);i in e?Object.defineProperty(e,i,{value:o,writable:!0,enumerable:!0,configurable:!0}):e[i]=o}}return e}const isMergeKey=s=>s===MERGE_KEY||isScalar$1(s)&&s.value===MERGE_KEY&&(!s.type||s.type===Scalar.PLAIN);function mergeToJSMap(s,e,t){const n=s&&isAlias(t)?t.resolve(s.doc):t;if(!isMap(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 stringifyKey(s,e,t){if(e===null)return"";if(typeof e!="object")return String(e);if(isNode(s)&&t?.doc){const n=createStringifyContext(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)+'..."'),warn(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 createPair(s,e,t){const n=createNode(s,void 0,t),r=createNode(e,void 0,t);return new Pair(n,r)}class Pair{constructor(e,t=null){Object.defineProperty(this,NODE_TYPE,{value:PAIR}),this.key=e,this.value=t}clone(e){let{key:t,value:n}=this;return isNode(t)&&(t=t.clone(e)),isNode(n)&&(n=n.clone(e)),new Pair(t,n)}toJSON(e,t){const n=t?.mapAsMap?new Map:{};return addPairToJSMap(t,n,this)}toString(e,t,n){return e?.doc?stringifyPair(this,e,t,n):JSON.stringify(this)}}function stringifyCollection(s,e,t){return(e.inFlow??s.flow?stringifyFlowCollection:stringifyBlockCollection)(s,e,t)}function stringifyBlockCollection({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(isNode(p))!u&&p.spaceBefore&&h.push(""),addCommentBefore(t,h,p.commentBefore,u),p.comment&&(g=p.comment);else if(isPair(p)){const S=isNode(p.key)?p.key:null;S&&(!u&&S.spaceBefore&&h.push(""),addCommentBefore(t,h,S.commentBefore,u))}u=!1;let y=stringify$2(p,f,()=>g=null,()=>u=!0);g&&(y+=lineComment(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
- `+indentComment(c(s),l),a&&a()):u&&o&&o(),d}function stringifyFlowCollection({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 h=Object.assign({},t,{indent:r,inFlow:!0,type:null});let u=!1,f=0;const d=[];for(let y=0;y<e.length;++y){const S=e[y];let A=null;if(isNode(S))S.spaceBefore&&d.push(""),addCommentBefore(t,d,S.commentBefore,!1),S.comment&&(A=S.comment);else if(isPair(S)){const R=isNode(S.key)?S.key:null;R&&(R.spaceBefore&&d.push(""),addCommentBefore(t,d,R.commentBefore,!1),R.comment&&(u=!0));const O=isNode(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=stringify$2(S,h,()=>A=null);y<e.length-1&&(L+=","),A&&(L+=lineComment(L,r,c(A))),!u&&(d.length>f||L.includes(`
100
- `))&&(u=!0),d.push(L),f=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)>Collection.maxFlowStringSingleLineLength),u){m=p;for(const y of d)m+=y?`
99
+ `+indentComment(c(s),l),a&&a()):u&&o&&o(),d}function stringifyFlowCollection({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(isNode(S))S.spaceBefore&&d.push(""),addCommentBefore(t,d,S.commentBefore,!1),S.comment&&(A=S.comment);else if(isPair(S)){const R=isNode(S.key)?S.key:null;R&&(R.spaceBefore&&d.push(""),addCommentBefore(t,d,R.commentBefore,!1),R.comment&&(u=!0));const O=isNode(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=stringify$2(S,f,()=>A=null);y<e.length-1&&(L+=","),A&&(L+=lineComment(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)>Collection.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+=lineComment(m,o,c(s)),i&&i()),m}function addCommentBefore({indent:s,options:{commentString:e}},t,n,r){if(n&&r&&(n=n.replace(/^\n+/,"")),n){const i=indentComment(e(n),s);t.push(i.trimStart())}}function findPair(s,e){const t=isScalar$1(e)?e.value:e;for(const n of s)if(isPair(n)&&(n.key===e||n.key===t||isScalar$1(n.key)&&n.key.value===t))return n}class YAMLMap extends Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(MAP,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(createPair(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;isPair(e)?n=e:!e||typeof e!="object"||!("key"in e)?n=new Pair(e,e?.value):n=new Pair(e.key,e.value);const r=findPair(this.items,n.key),i=this.schema?.sortMapEntries;if(r){if(!t)throw new Error(`Key ${n.key} already set`);isScalar$1(r.value)&&isScalarValue(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=findPair(this.items,e);return t?this.items.splice(this.items.indexOf(t),1).length>0:!1}get(e,t){const r=findPair(this.items,e)?.value;return(!t&&isScalar$1(r)?r.value:r)??void 0}has(e){return!!findPair(this.items,e)}set(e,t){this.add(new Pair(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)addPairToJSMap(t,r,i);return r}toString(e,t,n){if(!e)return JSON.stringify(this);for(const r of this.items)if(!isPair(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})),stringifyCollection(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:n,onComment:t})}}const map={collection:"map",default:!0,nodeClass:YAMLMap,tag:"tag:yaml.org,2002:map",resolve(s,e){return isMap(s)||e("Expected a mapping for this tag"),s},createNode:(s,e,t)=>YAMLMap.from(s,e,t)};class YAMLSeq extends Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(SEQ,e),this.items=[]}add(e){this.items.push(e)}delete(e){const t=asItemIndex(e);return typeof t!="number"?!1:this.items.splice(t,1).length>0}get(e,t){const n=asItemIndex(e);if(typeof n!="number")return;const r=this.items[n];return!t&&isScalar$1(r)?r.value:r}has(e){const t=asItemIndex(e);return typeof t=="number"&&t<this.items.length}set(e,t){const n=asItemIndex(e);if(typeof n!="number")throw new Error(`Expected a valid index, not ${e}.`);const r=this.items[n];isScalar$1(r)&&isScalarValue(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(toJS(i,String(r++),t));return n}toString(e,t,n){return e?stringifyCollection(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(createNode(a,void 0,n))}}return i}}function asItemIndex(s){let e=isScalar$1(s)?s.value:s;return e&&typeof e=="string"&&(e=Number(e)),typeof e=="number"&&Number.isInteger(e)&&e>=0?e:null}const seq={collection:"seq",default:!0,nodeClass:YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(s,e){return isSeq(s)||e("Expected a sequence for this tag"),s},createNode:(s,e,t)=>YAMLSeq.from(s,e,t)},string={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),stringifyString(s,e,t,n)}},nullTag={identify:s=>s==null,createNode:()=>new Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new Scalar(null),stringify:({source:s},e)=>typeof s=="string"&&nullTag.test.test(s)?s:e.options.nullStr},boolTag={identify:s=>typeof s=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:s=>new Scalar(s[0]==="t"||s[0]==="T"),stringify({source:s,value:e},t){if(s&&boolTag.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 stringifyNumber({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 floatNaN$1={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:stringifyNumber},floatExp$1={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():stringifyNumber(s)}},float$1={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 Scalar(parseFloat(s)),t=s.indexOf(".");return t!==-1&&s[s.length-1]==="0"&&(e.minFractionDigits=s.length-t-1),e},stringify:stringifyNumber},intIdentify$2=s=>typeof s=="bigint"||Number.isInteger(s),intResolve$1=(s,e,t,{intAsBigInt:n})=>n?BigInt(s):parseInt(s.substring(e),t);function intStringify$1(s,e,t){const{value:n}=s;return intIdentify$2(n)&&n>=0?t+n.toString(e):stringifyNumber(s)}const intOct$1={identify:s=>intIdentify$2(s)&&s>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(s,e,t)=>intResolve$1(s,2,8,t),stringify:s=>intStringify$1(s,8,"0o")},int$1={identify:intIdentify$2,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(s,e,t)=>intResolve$1(s,0,10,t),stringify:stringifyNumber},intHex$1={identify:s=>intIdentify$2(s)&&s>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(s,e,t)=>intResolve$1(s,2,16,t),stringify:s=>intStringify$1(s,16,"0x")},schema$2=[map,seq,string,nullTag,boolTag,intOct$1,int$1,intHex$1,floatNaN$1,floatExp$1,float$1];function intIdentify$1(s){return typeof s=="bigint"||Number.isInteger(s)}const stringifyJSON=({value:s})=>JSON.stringify(s),jsonScalars=[{identify:s=>typeof s=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:s=>s,stringify:stringifyJSON},{identify:s=>s==null,createNode:()=>new Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:stringifyJSON},{identify:s=>typeof s=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true|false$/,resolve:s=>s==="true",stringify:stringifyJSON},{identify:intIdentify$1,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})=>intIdentify$1(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:stringifyJSON}],jsonError={default:!0,tag:"",test:/^/,resolve(s,e){return e(`Unresolved plain scalar ${JSON.stringify(s)}`),s}},schema$1=[map,seq].concat(jsonScalars,jsonError),binary={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=Scalar.BLOCK_LITERAL),e!==Scalar.QUOTE_DOUBLE){const l=Math.max(n.options.lineWidth-n.indent.length,n.options.minContentWidth),c=Math.ceil(a.length/l),h=new Array(c);for(let u=0,f=0;u<c;++u,f+=l)h[u]=a.substr(f,l);a=h.join(e===Scalar.BLOCK_LITERAL?`
103
+ ${o}${g}`}else m=`${p}${l}${d.join(" ")}${l}${g}`;return s&&(m+=lineComment(m,o,c(s)),i&&i()),m}function addCommentBefore({indent:s,options:{commentString:e}},t,n,r){if(n&&r&&(n=n.replace(/^\n+/,"")),n){const i=indentComment(e(n),s);t.push(i.trimStart())}}function findPair(s,e){const t=isScalar$1(e)?e.value:e;for(const n of s)if(isPair(n)&&(n.key===e||n.key===t||isScalar$1(n.key)&&n.key.value===t))return n}class YAMLMap extends Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(MAP,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(createPair(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;isPair(e)?n=e:!e||typeof e!="object"||!("key"in e)?n=new Pair(e,e?.value):n=new Pair(e.key,e.value);const r=findPair(this.items,n.key),i=this.schema?.sortMapEntries;if(r){if(!t)throw new Error(`Key ${n.key} already set`);isScalar$1(r.value)&&isScalarValue(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=findPair(this.items,e);return t?this.items.splice(this.items.indexOf(t),1).length>0:!1}get(e,t){const r=findPair(this.items,e)?.value;return(!t&&isScalar$1(r)?r.value:r)??void 0}has(e){return!!findPair(this.items,e)}set(e,t){this.add(new Pair(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)addPairToJSMap(t,r,i);return r}toString(e,t,n){if(!e)return JSON.stringify(this);for(const r of this.items)if(!isPair(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})),stringifyCollection(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:n,onComment:t})}}const map={collection:"map",default:!0,nodeClass:YAMLMap,tag:"tag:yaml.org,2002:map",resolve(s,e){return isMap(s)||e("Expected a mapping for this tag"),s},createNode:(s,e,t)=>YAMLMap.from(s,e,t)};class YAMLSeq extends Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(SEQ,e),this.items=[]}add(e){this.items.push(e)}delete(e){const t=asItemIndex(e);return typeof t!="number"?!1:this.items.splice(t,1).length>0}get(e,t){const n=asItemIndex(e);if(typeof n!="number")return;const r=this.items[n];return!t&&isScalar$1(r)?r.value:r}has(e){const t=asItemIndex(e);return typeof t=="number"&&t<this.items.length}set(e,t){const n=asItemIndex(e);if(typeof n!="number")throw new Error(`Expected a valid index, not ${e}.`);const r=this.items[n];isScalar$1(r)&&isScalarValue(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(toJS(i,String(r++),t));return n}toString(e,t,n){return e?stringifyCollection(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(createNode(a,void 0,n))}}return i}}function asItemIndex(s){let e=isScalar$1(s)?s.value:s;return e&&typeof e=="string"&&(e=Number(e)),typeof e=="number"&&Number.isInteger(e)&&e>=0?e:null}const seq={collection:"seq",default:!0,nodeClass:YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(s,e){return isSeq(s)||e("Expected a sequence for this tag"),s},createNode:(s,e,t)=>YAMLSeq.from(s,e,t)},string={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),stringifyString(s,e,t,n)}},nullTag={identify:s=>s==null,createNode:()=>new Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new Scalar(null),stringify:({source:s},e)=>typeof s=="string"&&nullTag.test.test(s)?s:e.options.nullStr},boolTag={identify:s=>typeof s=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:s=>new Scalar(s[0]==="t"||s[0]==="T"),stringify({source:s,value:e},t){if(s&&boolTag.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 stringifyNumber({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 floatNaN$1={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:stringifyNumber},floatExp$1={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():stringifyNumber(s)}},float$1={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 Scalar(parseFloat(s)),t=s.indexOf(".");return t!==-1&&s[s.length-1]==="0"&&(e.minFractionDigits=s.length-t-1),e},stringify:stringifyNumber},intIdentify$2=s=>typeof s=="bigint"||Number.isInteger(s),intResolve$1=(s,e,t,{intAsBigInt:n})=>n?BigInt(s):parseInt(s.substring(e),t);function intStringify$1(s,e,t){const{value:n}=s;return intIdentify$2(n)&&n>=0?t+n.toString(e):stringifyNumber(s)}const intOct$1={identify:s=>intIdentify$2(s)&&s>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(s,e,t)=>intResolve$1(s,2,8,t),stringify:s=>intStringify$1(s,8,"0o")},int$1={identify:intIdentify$2,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(s,e,t)=>intResolve$1(s,0,10,t),stringify:stringifyNumber},intHex$1={identify:s=>intIdentify$2(s)&&s>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(s,e,t)=>intResolve$1(s,2,16,t),stringify:s=>intStringify$1(s,16,"0x")},schema$2=[map,seq,string,nullTag,boolTag,intOct$1,int$1,intHex$1,floatNaN$1,floatExp$1,float$1];function intIdentify$1(s){return typeof s=="bigint"||Number.isInteger(s)}const stringifyJSON=({value:s})=>JSON.stringify(s),jsonScalars=[{identify:s=>typeof s=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:s=>s,stringify:stringifyJSON},{identify:s=>s==null,createNode:()=>new Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:stringifyJSON},{identify:s=>typeof s=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true|false$/,resolve:s=>s==="true",stringify:stringifyJSON},{identify:intIdentify$1,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})=>intIdentify$1(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:stringifyJSON}],jsonError={default:!0,tag:"",test:/^/,resolve(s,e){return e(`Unresolved plain scalar ${JSON.stringify(s)}`),s}},schema$1=[map,seq].concat(jsonScalars,jsonError),binary={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=Scalar.BLOCK_LITERAL),e!==Scalar.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===Scalar.BLOCK_LITERAL?`
104
104
  `:" ")}return stringifyString({comment:s,type:e,value:a},n,r,i)}};function resolvePairs(s,e){if(isSeq(s))for(let t=0;t<s.items.length;++t){let n=s.items[t];if(!isPair(n)){if(isMap(n)){n.items.length>1&&e("Each pair must have its own sequence indicator");const r=n.items[0]||new Pair(new Scalar(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]=isPair(n)?n:new Pair(n)}}else e("Expected a sequence for this tag");return s}function createPairs(s,e,t){const{replacer:n}=t,r=new YAMLSeq(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(createPair(a,l,t))}return r}const pairs={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:resolvePairs,createNode:createPairs};class YAMLOMap extends YAMLSeq{constructor(){super(),this.add=YAMLMap.prototype.add.bind(this),this.delete=YAMLMap.prototype.delete.bind(this),this.get=YAMLMap.prototype.get.bind(this),this.has=YAMLMap.prototype.has.bind(this),this.set=YAMLMap.prototype.set.bind(this),this.tag=YAMLOMap.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(isPair(r)?(i=toJS(r.key,"",t),o=toJS(r.value,i,t)):i=toJS(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=createPairs(e,t,n),i=new this;return i.items=r.items,i}}YAMLOMap.tag="tag:yaml.org,2002:omap";const omap={collection:"seq",identify:s=>s instanceof Map,nodeClass:YAMLOMap,default:!1,tag:"tag:yaml.org,2002:omap",resolve(s,e){const t=resolvePairs(s,e),n=[];for(const{key:r}of t.items)isScalar$1(r)&&(n.includes(r.value)?e(`Ordered maps must not include duplicate keys: ${r.value}`):n.push(r.value));return Object.assign(new YAMLOMap,t)},createNode:(s,e,t)=>YAMLOMap.from(s,e,t)};function boolStringify({value:s,source:e},t){return e&&(s?trueTag:falseTag).test.test(e)?e:s?t.options.trueStr:t.options.falseStr}const trueTag={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 Scalar(!0),stringify:boolStringify},falseTag={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 Scalar(!1),stringify:boolStringify},floatNaN={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:stringifyNumber},floatExp={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():stringifyNumber(s)}},float={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 Scalar(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:stringifyNumber},intIdentify=s=>typeof s=="bigint"||Number.isInteger(s);function intResolve(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 intStringify(s,e,t){const{value:n}=s;if(intIdentify(n)){const r=n.toString(e);return n<0?"-"+t+r.substr(1):t+r}return stringifyNumber(s)}const intBin={identify:intIdentify,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(s,e,t)=>intResolve(s,2,2,t),stringify:s=>intStringify(s,2,"0b")},intOct={identify:intIdentify,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(s,e,t)=>intResolve(s,1,8,t),stringify:s=>intStringify(s,8,"0")},int={identify:intIdentify,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(s,e,t)=>intResolve(s,0,10,t),stringify:stringifyNumber},intHex={identify:intIdentify,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(s,e,t)=>intResolve(s,2,16,t),stringify:s=>intStringify(s,16,"0x")};class YAMLSet extends YAMLMap{constructor(e){super(e),this.tag=YAMLSet.tag}add(e){let t;isPair(e)?t=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?t=new Pair(e.key,null):t=new Pair(e,null),findPair(this.items,t.key)||this.items.push(t)}get(e,t){const n=findPair(this.items,e);return!t&&isPair(n)?isScalar$1(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=findPair(this.items,e);n&&!t?this.items.splice(this.items.indexOf(n),1):!n&&t&&this.items.push(new Pair(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(createPair(o,null,n));return i}}YAMLSet.tag="tag:yaml.org,2002:set";const set={collection:"map",identify:s=>s instanceof Set,nodeClass:YAMLSet,default:!1,tag:"tag:yaml.org,2002:set",createNode:(s,e,t)=>YAMLSet.from(s,e,t),resolve(s,e){if(isMap(s)){if(s.hasAllNullValues(!0))return Object.assign(new YAMLSet,s);e("Set items must all have null values")}else e("Expected a mapping for this tag");return s}};function parseSexagesimal(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 stringifySexagesimal(s){let{value:e}=s,t=o=>o;if(typeof e=="bigint")t=o=>BigInt(o);else if(isNaN(e)||!isFinite(e))return stringifyNumber(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 intTime={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})=>parseSexagesimal(s,t),stringify:stringifySexagesimal},floatTime={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=>parseSexagesimal(s,!1),stringify:stringifySexagesimal},timestamp={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(timestamp.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 h=e[8];if(h&&h!=="Z"){let u=parseSexagesimal(h,!1);Math.abs(u)<30&&(u*=60),c-=6e4*u}return new Date(c)},stringify:({value:s})=>s.toISOString().replace(/((T00:00)?:00)?\.000Z$/,"")},schema=[map,seq,string,nullTag,trueTag,falseTag,intBin,intOct,int,intHex,floatNaN,floatExp,float,binary,omap,pairs,set,intTime,floatTime,timestamp],schemas=new Map([["core",schema$2],["failsafe",[map,seq,string]],["json",schema$1],["yaml11",schema],["yaml-1.1",schema]]),tagsByName={binary,bool:boolTag,float:float$1,floatExp:floatExp$1,floatNaN:floatNaN$1,floatTime,int:int$1,intHex:intHex$1,intOct:intOct$1,intTime,map,null:nullTag,omap,pairs,seq,set,timestamp},coreKnownTags={"tag:yaml.org,2002:binary":binary,"tag:yaml.org,2002:omap":omap,"tag:yaml.org,2002:pairs":pairs,"tag:yaml.org,2002:set":set,"tag:yaml.org,2002:timestamp":timestamp};function getTags(s,e){let t=schemas.get(e);if(!t)if(Array.isArray(s))t=[];else{const n=Array.from(schemas.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=tagsByName[n];if(r)return r;const i=Object.keys(tagsByName).map(o=>JSON.stringify(o)).join(", ");throw new Error(`Unknown custom tag "${n}"; use one of ${i}`)})}const sortMapEntriesByKey=(s,e)=>s.key<e.key?-1:s.key>e.key?1:0;class Schema{constructor({compat:e,customTags:t,merge:n,resolveKnownTags:r,schema:i,sortMapEntries:o,toStringDefaults:a}){this.compat=Array.isArray(e)?getTags(e,"compat"):e?getTags(null,e):null,this.merge=!!n,this.name=typeof i=="string"&&i||"core",this.knownTags=r?coreKnownTags:{},this.tags=getTags(t,this.name),this.toStringOptions=a??null,Object.defineProperty(this,MAP,{value:map}),Object.defineProperty(this,SCALAR$1,{value:string}),Object.defineProperty(this,SEQ,{value:seq}),this.sortMapEntries=typeof o=="function"?o:o===!0?sortMapEntriesByKey:null}clone(){const e=Object.create(Schema.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}}function stringifyDocument(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=createStringifyContext(s,e),{commentString:i}=r.options;if(s.commentBefore){t.length!==1&&t.unshift("");const l=i(s.commentBefore);t.unshift(indentComment(l,""))}let o=!1,a=null;if(s.contents){if(isNode(s.contents)){if(s.contents.spaceBefore&&n&&t.push(""),s.contents.commentBefore){const h=i(s.contents.commentBefore);t.push(indentComment(h,""))}r.forceBlockIndent=!!s.comment,a=s.contents.comment}const l=a?void 0:()=>o=!0;let c=stringify$2(s.contents,r,()=>a=null,l);a&&(c+=lineComment(c,"",i(a))),(c[0]==="|"||c[0]===">")&&t[t.length-1]==="---"?t[t.length-1]=`--- ${c}`:t.push(c)}else t.push(stringify$2(s.contents,r));if(s.directives?.docEnd)if(s.comment){const l=i(s.comment);l.includes(`
106
+ ${i.comment}`:n.comment}n=r}s.items[t]=isPair(n)?n:new Pair(n)}}else e("Expected a sequence for this tag");return s}function createPairs(s,e,t){const{replacer:n}=t,r=new YAMLSeq(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(createPair(a,l,t))}return r}const pairs={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:resolvePairs,createNode:createPairs};class YAMLOMap extends YAMLSeq{constructor(){super(),this.add=YAMLMap.prototype.add.bind(this),this.delete=YAMLMap.prototype.delete.bind(this),this.get=YAMLMap.prototype.get.bind(this),this.has=YAMLMap.prototype.has.bind(this),this.set=YAMLMap.prototype.set.bind(this),this.tag=YAMLOMap.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(isPair(r)?(i=toJS(r.key,"",t),o=toJS(r.value,i,t)):i=toJS(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=createPairs(e,t,n),i=new this;return i.items=r.items,i}}YAMLOMap.tag="tag:yaml.org,2002:omap";const omap={collection:"seq",identify:s=>s instanceof Map,nodeClass:YAMLOMap,default:!1,tag:"tag:yaml.org,2002:omap",resolve(s,e){const t=resolvePairs(s,e),n=[];for(const{key:r}of t.items)isScalar$1(r)&&(n.includes(r.value)?e(`Ordered maps must not include duplicate keys: ${r.value}`):n.push(r.value));return Object.assign(new YAMLOMap,t)},createNode:(s,e,t)=>YAMLOMap.from(s,e,t)};function boolStringify({value:s,source:e},t){return e&&(s?trueTag:falseTag).test.test(e)?e:s?t.options.trueStr:t.options.falseStr}const trueTag={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 Scalar(!0),stringify:boolStringify},falseTag={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 Scalar(!1),stringify:boolStringify},floatNaN={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:stringifyNumber},floatExp={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():stringifyNumber(s)}},float={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 Scalar(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:stringifyNumber},intIdentify=s=>typeof s=="bigint"||Number.isInteger(s);function intResolve(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 intStringify(s,e,t){const{value:n}=s;if(intIdentify(n)){const r=n.toString(e);return n<0?"-"+t+r.substr(1):t+r}return stringifyNumber(s)}const intBin={identify:intIdentify,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(s,e,t)=>intResolve(s,2,2,t),stringify:s=>intStringify(s,2,"0b")},intOct={identify:intIdentify,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(s,e,t)=>intResolve(s,1,8,t),stringify:s=>intStringify(s,8,"0")},int={identify:intIdentify,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(s,e,t)=>intResolve(s,0,10,t),stringify:stringifyNumber},intHex={identify:intIdentify,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(s,e,t)=>intResolve(s,2,16,t),stringify:s=>intStringify(s,16,"0x")};class YAMLSet extends YAMLMap{constructor(e){super(e),this.tag=YAMLSet.tag}add(e){let t;isPair(e)?t=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?t=new Pair(e.key,null):t=new Pair(e,null),findPair(this.items,t.key)||this.items.push(t)}get(e,t){const n=findPair(this.items,e);return!t&&isPair(n)?isScalar$1(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=findPair(this.items,e);n&&!t?this.items.splice(this.items.indexOf(n),1):!n&&t&&this.items.push(new Pair(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(createPair(o,null,n));return i}}YAMLSet.tag="tag:yaml.org,2002:set";const set={collection:"map",identify:s=>s instanceof Set,nodeClass:YAMLSet,default:!1,tag:"tag:yaml.org,2002:set",createNode:(s,e,t)=>YAMLSet.from(s,e,t),resolve(s,e){if(isMap(s)){if(s.hasAllNullValues(!0))return Object.assign(new YAMLSet,s);e("Set items must all have null values")}else e("Expected a mapping for this tag");return s}};function parseSexagesimal(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 stringifySexagesimal(s){let{value:e}=s,t=o=>o;if(typeof e=="bigint")t=o=>BigInt(o);else if(isNaN(e)||!isFinite(e))return stringifyNumber(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 intTime={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})=>parseSexagesimal(s,t),stringify:stringifySexagesimal},floatTime={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=>parseSexagesimal(s,!1),stringify:stringifySexagesimal},timestamp={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(timestamp.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=parseSexagesimal(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$/,"")},schema=[map,seq,string,nullTag,trueTag,falseTag,intBin,intOct,int,intHex,floatNaN,floatExp,float,binary,omap,pairs,set,intTime,floatTime,timestamp],schemas=new Map([["core",schema$2],["failsafe",[map,seq,string]],["json",schema$1],["yaml11",schema],["yaml-1.1",schema]]),tagsByName={binary,bool:boolTag,float:float$1,floatExp:floatExp$1,floatNaN:floatNaN$1,floatTime,int:int$1,intHex:intHex$1,intOct:intOct$1,intTime,map,null:nullTag,omap,pairs,seq,set,timestamp},coreKnownTags={"tag:yaml.org,2002:binary":binary,"tag:yaml.org,2002:omap":omap,"tag:yaml.org,2002:pairs":pairs,"tag:yaml.org,2002:set":set,"tag:yaml.org,2002:timestamp":timestamp};function getTags(s,e){let t=schemas.get(e);if(!t)if(Array.isArray(s))t=[];else{const n=Array.from(schemas.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=tagsByName[n];if(r)return r;const i=Object.keys(tagsByName).map(o=>JSON.stringify(o)).join(", ");throw new Error(`Unknown custom tag "${n}"; use one of ${i}`)})}const sortMapEntriesByKey=(s,e)=>s.key<e.key?-1:s.key>e.key?1:0;class Schema{constructor({compat:e,customTags:t,merge:n,resolveKnownTags:r,schema:i,sortMapEntries:o,toStringDefaults:a}){this.compat=Array.isArray(e)?getTags(e,"compat"):e?getTags(null,e):null,this.merge=!!n,this.name=typeof i=="string"&&i||"core",this.knownTags=r?coreKnownTags:{},this.tags=getTags(t,this.name),this.toStringOptions=a??null,Object.defineProperty(this,MAP,{value:map}),Object.defineProperty(this,SCALAR$1,{value:string}),Object.defineProperty(this,SEQ,{value:seq}),this.sortMapEntries=typeof o=="function"?o:o===!0?sortMapEntriesByKey:null}clone(){const e=Object.create(Schema.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}}function stringifyDocument(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=createStringifyContext(s,e),{commentString:i}=r.options;if(s.commentBefore){t.length!==1&&t.unshift("");const l=i(s.commentBefore);t.unshift(indentComment(l,""))}let o=!1,a=null;if(s.contents){if(isNode(s.contents)){if(s.contents.spaceBefore&&n&&t.push(""),s.contents.commentBefore){const f=i(s.contents.commentBefore);t.push(indentComment(f,""))}r.forceBlockIndent=!!s.comment,a=s.contents.comment}const l=a?void 0:()=>o=!0;let c=stringify$2(s.contents,r,()=>a=null,l);a&&(c+=lineComment(c,"",i(a))),(c[0]==="|"||c[0]===">")&&t[t.length-1]==="---"?t[t.length-1]=`--- ${c}`:t.push(c)}else t.push(stringify$2(s.contents,r));if(s.directives?.docEnd)if(s.comment){const l=i(s.comment);l.includes(`
107
107
  `)?(t.push("..."),t.push(indentComment(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(indentComment(i(l),"")))}return t.join(`
108
108
  `)+`
109
- `}class Document{constructor(e,t,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,NODE_TYPE,{value:DOC});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 Directives({version:o}),this.setSchema(o,n),this.contents=e===void 0?null:this.createNode(e,r,n)}clone(){const e=Object.create(Document.prototype,{[NODE_TYPE]:{value:DOC}});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=isNode(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){assertCollection(this.contents)&&this.contents.add(e)}addIn(e,t){assertCollection(this.contents)&&this.contents.addIn(e,t)}createAlias(e,t){if(!e.anchor){const n=anchorNames(this);e.anchor=!t||n.has(t)?findNewAnchor(t||"a",n):t}return new Alias(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:h}=n??{},{onAnchor:u,setAnchors:f,sourceObjects:d}=createNodeAnchors(this,o||"a"),m={aliasDuplicateObjects:i??!0,keepUndefined:l??!1,onAnchor:u,onTagObj:c,replacer:r,schema:this.schema,sourceObjects:d},p=createNode(e,h,m);return a&&isCollection$1(p)&&(p.flow=!0),f(),p}createPair(e,t,n={}){const r=this.createNode(e,null,n),i=this.createNode(t,null,n);return new Pair(r,i)}delete(e){return assertCollection(this.contents)?this.contents.delete(e):!1}deleteIn(e){return isEmptyPath(e)?this.contents==null?!1:(this.contents=null,!0):assertCollection(this.contents)?this.contents.deleteIn(e):!1}get(e,t){return isCollection$1(this.contents)?this.contents.get(e,t):void 0}getIn(e,t){return isEmptyPath(e)?!t&&isScalar$1(this.contents)?this.contents.value:this.contents:isCollection$1(this.contents)?this.contents.getIn(e,t):void 0}has(e){return isCollection$1(this.contents)?this.contents.has(e):!1}hasIn(e){return isEmptyPath(e)?this.contents!==void 0:isCollection$1(this.contents)?this.contents.hasIn(e):!1}set(e,t){this.contents==null?this.contents=collectionFromPath(this.schema,[e],t):assertCollection(this.contents)&&this.contents.set(e,t)}setIn(e,t){isEmptyPath(e)?this.contents=t:this.contents==null?this.contents=collectionFromPath(this.schema,Array.from(e),t):assertCollection(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 Directives({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 Directives({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 Schema(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=toJS(this.contents,t??"",a);if(typeof i=="function")for(const{count:c,res:h}of a.anchors.values())i(h,c);return typeof o=="function"?applyReviver(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 stringifyDocument(this,e)}}function assertCollection(s){if(isCollection$1(s))return!0;throw new Error("Expected a YAML collection as document contents")}class YAMLError extends Error{constructor(e,t,n,r){super(),this.name=e,this.code=n,this.message=r,this.pos=t}}class YAMLParseError extends YAMLError{constructor(e,t,n){super("YAMLParseError",e,t,n)}}class YAMLWarning extends YAMLError{constructor(e,t,n){super("YAMLWarning",e,t,n)}}const prettifyError=(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
109
+ `}class Document{constructor(e,t,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,NODE_TYPE,{value:DOC});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 Directives({version:o}),this.setSchema(o,n),this.contents=e===void 0?null:this.createNode(e,r,n)}clone(){const e=Object.create(Document.prototype,{[NODE_TYPE]:{value:DOC}});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=isNode(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){assertCollection(this.contents)&&this.contents.add(e)}addIn(e,t){assertCollection(this.contents)&&this.contents.addIn(e,t)}createAlias(e,t){if(!e.anchor){const n=anchorNames(this);e.anchor=!t||n.has(t)?findNewAnchor(t||"a",n):t}return new Alias(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}=createNodeAnchors(this,o||"a"),m={aliasDuplicateObjects:i??!0,keepUndefined:l??!1,onAnchor:u,onTagObj:c,replacer:r,schema:this.schema,sourceObjects:d},p=createNode(e,f,m);return a&&isCollection$1(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 Pair(r,i)}delete(e){return assertCollection(this.contents)?this.contents.delete(e):!1}deleteIn(e){return isEmptyPath(e)?this.contents==null?!1:(this.contents=null,!0):assertCollection(this.contents)?this.contents.deleteIn(e):!1}get(e,t){return isCollection$1(this.contents)?this.contents.get(e,t):void 0}getIn(e,t){return isEmptyPath(e)?!t&&isScalar$1(this.contents)?this.contents.value:this.contents:isCollection$1(this.contents)?this.contents.getIn(e,t):void 0}has(e){return isCollection$1(this.contents)?this.contents.has(e):!1}hasIn(e){return isEmptyPath(e)?this.contents!==void 0:isCollection$1(this.contents)?this.contents.hasIn(e):!1}set(e,t){this.contents==null?this.contents=collectionFromPath(this.schema,[e],t):assertCollection(this.contents)&&this.contents.set(e,t)}setIn(e,t){isEmptyPath(e)?this.contents=t:this.contents==null?this.contents=collectionFromPath(this.schema,Array.from(e),t):assertCollection(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 Directives({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 Directives({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 Schema(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=toJS(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"?applyReviver(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 stringifyDocument(this,e)}}function assertCollection(s){if(isCollection$1(s))return!0;throw new Error("Expected a YAML collection as document contents")}class YAMLError extends Error{constructor(e,t,n,r){super(),this.name=e,this.code=n,this.message=r,this.pos=t}}class YAMLParseError extends YAMLError{constructor(e,t,n){super("YAMLParseError",e,t,n)}}class YAMLWarning extends YAMLError{constructor(e,t,n){super("YAMLWarning",e,t,n)}}const prettifyError=(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 resolveProps(s,{flow:e,indicator:t,next:n,offset:r,onError:i,startOnNewline:o}){let a=!1,l=o,c=o,h="",u="",f=!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)||" ";h?h+=u+I:h=I,u="",l=!1;break}case"newline":l?h?h+=O.source:a=!0:u+=O.source,l=!0,f=!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:h,hasNewline:f,hasNewlineAfterProp:d,anchor:p,tag:g,end:R,start:A??R}}function containsNewline(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(containsNewline(e.key)||containsNewline(e.value))return!0}return!1;default:return!0}}function flowIndentCheck(s,e,t){if(e?.type==="flow-collection"){const n=e.end[0];n.indent===s&&(n.source==="]"||n.source==="}")&&containsNewline(e)&&t(n,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}function mapIncludes(s,e,t){const{uniqueKeys:n}=s.options;if(n===!1)return!1;const r=typeof n=="function"?n:(i,o)=>i===o||isScalar$1(i)&&isScalar$1(o)&&i.value===o.value&&!(i.value==="<<"&&s.schema.merge);return e.some(i=>r(i.key,t))}const startColMsg="All mapping items must start at the same column";function resolveBlockMap({composeNode:s,composeEmptyNode:e},t,n,r,i){const o=i?.nodeClass??YAMLMap,a=new o(t.schema);t.atRoot&&(t.atRoot=!1);let l=n.offset,c=null;for(const h of n.items){const{start:u,key:f,sep:d,value:m}=h,p=resolveProps(u,{indicator:"explicit-key-ind",next:f??d?.[0],offset:l,onError:r,startOnNewline:!0}),g=!p.found;if(g){if(f&&(f.type==="block-seq"?r(l,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in f&&f.indent!==n.indent&&r(l,"BAD_INDENT",startColMsg)),!p.anchor&&!p.tag&&!d){c=p.end,p.comment&&(a.comment?a.comment+=`
116
- `+p.comment:a.comment=p.comment);continue}(p.hasNewlineAfterProp||containsNewline(f))&&r(f??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",startColMsg);const y=p.end,S=f?s(t,f,p,r):e(t,y,u,null,p,r);t.schema.compat&&flowIndentCheck(n.indent,f,r),mapIncludes(t,a.items,S)&&r(y,"DUPLICATE_KEY","Map keys must be unique");const A=resolveProps(d??[],{indicator:"map-value-ind",next:m,offset:S.range[2],onError:r,startOnNewline:!f||f.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&&flowIndentCheck(n.indent,m,r),l=L.range[2];const R=new Pair(S,L);t.options.keepSourceTokens&&(R.srcToken=h),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 Pair(S);t.options.keepSourceTokens&&(L.srcToken=h),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 resolveBlockSeq({composeNode:s,composeEmptyNode:e},t,n,r,i){const o=i?.nodeClass??YAMLSeq,a=new o(t.schema);t.atRoot&&(t.atRoot=!1);let l=n.offset,c=null;for(const{start:h,value:u}of n.items){const f=resolveProps(h,{indicator:"seq-item-ind",next:u,offset:l,onError:r,startOnNewline:!0});if(!f.found)if(f.anchor||f.tag||u)u&&u.type==="block-seq"?r(f.end,"BAD_INDENT","All sequence items must start at the same column"):r(l,"MISSING_CHAR","Sequence item without - indicator");else{c=f.end,f.comment&&(a.comment=f.comment);continue}const d=u?s(t,u,f,r):e(t,f.end,h,null,f,r);t.schema.compat&&flowIndentCheck(n.indent,u,r),l=d.range[2],a.items.push(d)}return a.range=[n.offset,l,c??l],a}function resolveEnd(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 h=l.substring(1)||" ";r?r+=o+h:r=h,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 blockMsg="Block collections are not allowed within flow collections",isBlock=s=>s&&(s.type==="block-map"||s.type==="block-seq");function resolveFlowCollection({composeNode:s,composeEmptyNode:e},t,n,r,i){const o=n.start.source==="{",a=o?"flow map":"flow sequence",l=i?.nodeClass??(o?YAMLMap:YAMLSeq),c=new l(t.schema);c.flow=!0;const h=t.atRoot;h&&(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=resolveProps(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+=`
114
+ `}};function resolveProps(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 containsNewline(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(containsNewline(e.key)||containsNewline(e.value))return!0}return!1;default:return!0}}function flowIndentCheck(s,e,t){if(e?.type==="flow-collection"){const n=e.end[0];n.indent===s&&(n.source==="]"||n.source==="}")&&containsNewline(e)&&t(n,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}function mapIncludes(s,e,t){const{uniqueKeys:n}=s.options;if(n===!1)return!1;const r=typeof n=="function"?n:(i,o)=>i===o||isScalar$1(i)&&isScalar$1(o)&&i.value===o.value&&!(i.value==="<<"&&s.schema.merge);return e.some(i=>r(i.key,t))}const startColMsg="All mapping items must start at the same column";function resolveBlockMap({composeNode:s,composeEmptyNode:e},t,n,r,i){const o=i?.nodeClass??YAMLMap,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=resolveProps(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",startColMsg)),!p.anchor&&!p.tag&&!d){c=p.end,p.comment&&(a.comment?a.comment+=`
116
+ `+p.comment:a.comment=p.comment);continue}(p.hasNewlineAfterProp||containsNewline(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",startColMsg);const y=p.end,S=h?s(t,h,p,r):e(t,y,u,null,p,r);t.schema.compat&&flowIndentCheck(n.indent,h,r),mapIncludes(t,a.items,S)&&r(y,"DUPLICATE_KEY","Map keys must be unique");const A=resolveProps(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&&flowIndentCheck(n.indent,m,r),l=L.range[2];const R=new Pair(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 Pair(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 resolveBlockSeq({composeNode:s,composeEmptyNode:e},t,n,r,i){const o=i?.nodeClass??YAMLSeq,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=resolveProps(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&&flowIndentCheck(n.indent,u,r),l=d.range[2],a.items.push(d)}return a.range=[n.offset,l,c??l],a}function resolveEnd(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 blockMsg="Block collections are not allowed within flow collections",isBlock=s=>s&&(s.type==="block-map"||s.type==="block-seq");function resolveFlowCollection({composeNode:s,composeEmptyNode:e},t,n,r,i){const o=n.start.source==="{",a=o?"flow map":"flow sequence",l=i?.nodeClass??(o?YAMLMap:YAMLSeq),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=resolveProps(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&&containsNewline(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];isPair(_)&&(_=_.value??_.key),_.comment?_.comment+=`
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],isBlock(R)&&r(I.range,"BLOCK_IN_FLOW",blockMsg)}else{const I=O.end,_=A?s(t,A,O,r):e(t,I,S,null,O,r);isBlock(A)&&r(_.range,"BLOCK_IN_FLOW",blockMsg);const k=resolveProps(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 F=R?s(t,R,k,r):k.found?e(t,k.end,L,null,k,r):null;F?isBlock(R)&&r(F.range,"BLOCK_IN_FLOW",blockMsg):k.comment&&(_.comment?_.comment+=`
120
- `+k.comment:_.comment=k.comment);const E=new Pair(_,F);if(t.options.keepSourceTokens&&(E.srcToken=y),o){const $=c;mapIncludes(t,$.items,_)&&r(I,"DUPLICATE_KEY","Map keys must be unique"),$.items.push(E)}else{const $=new YAMLMap(t.schema);$.flow=!0,$.items.push(E),c.items.push($)}u=F?F.range[2]:k.end}}const f=o?"}":"]",[d,...m]=n.end;let p=u;if(d&&d.source===f)p=d.offset+d.source.length;else{const g=a[0].toUpperCase()+a.substring(1),y=h?`${g} must end with a ${f}`:`${g} in block collection must be sufficiently indented and end with a ${f}`;r(u,h?"MISSING_CHAR":"BAD_INDENT",y),d&&d.source.length!==1&&m.unshift(d)}if(m.length>0){const g=resolveEnd(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 resolveCollection(s,e,t,n,r,i){const o=t.type==="block-map"?resolveBlockMap(s,e,t,n,i):t.type==="block-seq"?resolveBlockSeq(s,e,t,n,i):resolveFlowCollection(s,e,t,n,i),a=o.constructor;return r==="!"||r===a.tagName?(o.tag=a.tagName,o):(r&&(o.tag=r),o)}function composeCollection(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===YAMLMap.tagName&&o==="map"||i===YAMLSeq.tagName&&o==="seq"||!o)return resolveCollection(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),resolveCollection(s,e,t,r,i)}const l=resolveCollection(s,e,t,r,i,a),c=a.resolve?.(l,u=>r(n,"TAG_RESOLVE_FAILED",u),e.options)??l,h=isNode(c)?c:new Scalar(c);return h.range=l.range,h.tag=i,a?.format&&(h.format=a.format),h}function resolveBlockScalar(s,e,t){const n=s.offset,r=parseBlockScalarHeader(s,e,t);if(!r)return{value:"",type:null,comment:"",range:[n,n,n]};const i=r.mode===">"?Scalar.BLOCK_FOLDED:Scalar.BLOCK_LITERAL,o=s.source?splitLines(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,h=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),h=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="",f="",d=!1;for(let p=0;p<h;++p)u+=o[p][0].slice(l)+`
123
- `;for(let p=h;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===Scalar.BLOCK_LITERAL?(u+=f+g.slice(l)+y,f=`
124
- `):g.length>l||y[0]===" "?(f===" "?f=`
125
- `:!d&&f===`
126
- `&&(f=`
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],isBlock(R)&&r(I.range,"BLOCK_IN_FLOW",blockMsg)}else{const I=O.end,_=A?s(t,A,O,r):e(t,I,S,null,O,r);isBlock(A)&&r(_.range,"BLOCK_IN_FLOW",blockMsg);const k=resolveProps(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 D=R?s(t,R,k,r):k.found?e(t,k.end,L,null,k,r):null;D?isBlock(R)&&r(D.range,"BLOCK_IN_FLOW",blockMsg):k.comment&&(_.comment?_.comment+=`
120
+ `+k.comment:_.comment=k.comment);const E=new Pair(_,D);if(t.options.keepSourceTokens&&(E.srcToken=y),o){const $=c;mapIncludes(t,$.items,_)&&r(I,"DUPLICATE_KEY","Map keys must be unique"),$.items.push(E)}else{const $=new YAMLMap(t.schema);$.flow=!0,$.items.push(E),c.items.push($)}u=D?D.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=resolveEnd(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 resolveCollection(s,e,t,n,r,i){const o=t.type==="block-map"?resolveBlockMap(s,e,t,n,i):t.type==="block-seq"?resolveBlockSeq(s,e,t,n,i):resolveFlowCollection(s,e,t,n,i),a=o.constructor;return r==="!"||r===a.tagName?(o.tag=a.tagName,o):(r&&(o.tag=r),o)}function composeCollection(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===YAMLMap.tagName&&o==="map"||i===YAMLSeq.tagName&&o==="seq"||!o)return resolveCollection(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),resolveCollection(s,e,t,r,i)}const l=resolveCollection(s,e,t,r,i,a),c=a.resolve?.(l,u=>r(n,"TAG_RESOLVE_FAILED",u),e.options)??l,f=isNode(c)?c:new Scalar(c);return f.range=l.range,f.tag=i,a?.format&&(f.format=a.format),f}function resolveBlockScalar(s,e,t){const n=s.offset,r=parseBlockScalarHeader(s,e,t);if(!r)return{value:"",type:null,comment:"",range:[n,n,n]};const i=r.mode===">"?Scalar.BLOCK_FOLDED:Scalar.BLOCK_LITERAL,o=s.source?splitLines(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===Scalar.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+=f+g.slice(l)+y,f=`
129
- `,d=!0):y===""?f===`
128
+ `),u+=h+g.slice(l)+y,h=`
129
+ `,d=!0):y===""?h===`
130
130
  `?u+=`
131
- `:f=`
132
- `:(u+=f+y,f=" ",d=!1)}switch(r.chomp){case"-":break;case"+":for(let p=a;p<o.length;++p)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 parseBlockScalarHeader({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 f=1;f<r.length;++f){const d=r[f];if(!a&&(d==="-"||d==="+"))a=d;else{const m=Number(d);!o&&m?o=m:l===-1&&(l=s+f)}}l!==-1&&n(l,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${r}`);let c=!1,h="",u=r.length;for(let f=1;f<e.length;++f){const d=e[f];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,h=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:h,length:u}}function splitLines(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 resolveFlowScalar(s,e,t){const{offset:n,type:r,source:i,end:o}=s;let a,l;const c=(f,d,m)=>t(n+f,d,m);switch(r){case"scalar":a=Scalar.PLAIN,l=plainValue(i,c);break;case"single-quoted-scalar":a=Scalar.QUOTE_SINGLE,l=singleQuotedValue(i,c);break;case"double-quoted-scalar":a=Scalar.QUOTE_DOUBLE,l=doubleQuotedValue(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 h=n+i.length,u=resolveEnd(o,h,e,t);return{value:l,type:a,comment:u.comment,range:[n,h,u.offset]}}function plainValue(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}`),foldLines(s)}function singleQuotedValue(s,e){return(s[s.length-1]!=="'"||s.length===1)&&e(s.length,"MISSING_CHAR","Missing closing 'quote"),foldLines(s.slice(1,-1)).replace(/''/g,"'")}function foldLines(s){let e,t;try{e=new RegExp(`(.*?)(?<![ ])[ ]*\r?
136
+ `}const m=n+r.length+s.source.length;return{value:u,type:i,comment:r.comment,range:[n,m,m]}}function parseBlockScalarHeader({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 splitLines(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 resolveFlowScalar(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=Scalar.PLAIN,l=plainValue(i,c);break;case"single-quoted-scalar":a=Scalar.QUOTE_SINGLE,l=singleQuotedValue(i,c);break;case"double-quoted-scalar":a=Scalar.QUOTE_DOUBLE,l=doubleQuotedValue(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=resolveEnd(o,f,e,t);return{value:l,type:a,comment:u.comment,range:[n,f,u.offset]}}function plainValue(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}`),foldLines(s)}function singleQuotedValue(s,e){return(s[s.length-1]!=="'"||s.length===1)&&e(s.length,"MISSING_CHAR","Missing closing 'quote"),foldLines(s.slice(1,-1)).replace(/''/g,"'")}function foldLines(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,7 +148,7 @@ ${c}
148
148
  `);)n===`
149
149
  `&&(t+=`
150
150
  `),e+=1,n=s[e+1];return t||(t=" "),{fold:t,offset:e}}const escapeCodes={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 parseCharCode(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 composeScalar(s,e,t,n){const{value:r,type:i,comment:o,range:a}=e.type==="block-scalar"?resolveBlockScalar(e,s.options.strict,n):resolveFlowScalar(e,s.options.strict,n),l=t?s.directives.tagName(t.source,u=>n(t,"TAG_RESOLVE_FAILED",u)):null,c=t&&l?findScalarTagByName(s.schema,r,l,t,n):e.type==="scalar"?findScalarTagByTest(s,r,e,n):s.schema[SCALAR$1];let h;try{const u=c.resolve(r,f=>n(t??e,"TAG_RESOLVE_FAILED",f),s.options);h=isScalar$1(u)?u:new Scalar(u)}catch(u){const f=u instanceof Error?u.message:String(u);n(t??e,"TAG_RESOLVE_FAILED",f),h=new Scalar(r)}return h.range=a,h.source=r,i&&(h.type=i),l&&(h.tag=l),c.format&&(h.format=c.format),o&&(h.comment=o),h}function findScalarTagByName(s,e,t,n,r){if(t==="!")return s[SCALAR$1];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[SCALAR$1])}function findScalarTagByTest({directives:s,schema:e},t,n,r){const i=e.tags.find(o=>o.default&&o.test?.test(t))||e[SCALAR$1];if(e.compat){const o=e.compat.find(a=>a.default&&a.test?.test(t))??e[SCALAR$1];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 emptyScalarPosition(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 CN={composeNode,composeEmptyNode};function composeNode(s,e,t,n){const{spaceBefore:r,comment:i,anchor:o,tag:a}=t;let l,c=!0;switch(e.type){case"alias":l=composeAlias(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=composeScalar(s,e,a,n),o&&(l.anchor=o.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":l=composeCollection(CN,s,e,a,n),o&&(l.anchor=o.source.substring(1));break;default:{const h=e.type==="error"?e.message:`Unsupported token (type: ${e.type})`;n(e,"UNEXPECTED_TOKEN",h),l=composeEmptyNode(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 composeEmptyNode(s,e,t,n,{spaceBefore:r,comment:i,anchor:o,tag:a,end:l},c){const h={type:"scalar",offset:emptyScalarPosition(e,t,n),indent:-1,source:""},u=composeScalar(s,h,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 composeAlias({options:s},{offset:e,source:t,end:n},r){const i=new Alias(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=resolveEnd(n,o,s.strict,r);return i.range=[e,o,a.offset],a.comment&&(i.comment=a.comment),i}function composeDoc(s,e,{offset:t,start:n,value:r,end:i},o){const a=Object.assign({_directives:e},s),l=new Document(void 0,a),c={atRoot:!0,directives:l.directives,options:l.options,schema:l.schema},h=resolveProps(n,{indicator:"doc-start",next:r??i?.[0],offset:t,onError:o,startOnNewline:!0});h.found&&(l.directives.docStart=!0,r&&(r.type==="block-map"||r.type==="block-seq")&&!h.hasNewline&&o(h.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),l.contents=r?composeNode(c,r,h,o):composeEmptyNode(c,h.end,n,null,h,o);const u=l.contents.range[2],f=resolveEnd(i,u,!1,o);return f.comment&&(l.comment=f.comment),l.range=[t,u,f.offset],l}function getErrorPos(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 parsePrelude(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?`
151
+ `,r:"\r",t:" ",v:"\v",N:"\x85",_:"\xA0",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function parseCharCode(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 composeScalar(s,e,t,n){const{value:r,type:i,comment:o,range:a}=e.type==="block-scalar"?resolveBlockScalar(e,s.options.strict,n):resolveFlowScalar(e,s.options.strict,n),l=t?s.directives.tagName(t.source,u=>n(t,"TAG_RESOLVE_FAILED",u)):null,c=t&&l?findScalarTagByName(s.schema,r,l,t,n):e.type==="scalar"?findScalarTagByTest(s,r,e,n):s.schema[SCALAR$1];let f;try{const u=c.resolve(r,h=>n(t??e,"TAG_RESOLVE_FAILED",h),s.options);f=isScalar$1(u)?u:new Scalar(u)}catch(u){const h=u instanceof Error?u.message:String(u);n(t??e,"TAG_RESOLVE_FAILED",h),f=new Scalar(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 findScalarTagByName(s,e,t,n,r){if(t==="!")return s[SCALAR$1];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[SCALAR$1])}function findScalarTagByTest({directives:s,schema:e},t,n,r){const i=e.tags.find(o=>o.default&&o.test?.test(t))||e[SCALAR$1];if(e.compat){const o=e.compat.find(a=>a.default&&a.test?.test(t))??e[SCALAR$1];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 emptyScalarPosition(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 CN={composeNode,composeEmptyNode};function composeNode(s,e,t,n){const{spaceBefore:r,comment:i,anchor:o,tag:a}=t;let l,c=!0;switch(e.type){case"alias":l=composeAlias(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=composeScalar(s,e,a,n),o&&(l.anchor=o.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":l=composeCollection(CN,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=composeEmptyNode(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 composeEmptyNode(s,e,t,n,{spaceBefore:r,comment:i,anchor:o,tag:a,end:l},c){const f={type:"scalar",offset:emptyScalarPosition(e,t,n),indent:-1,source:""},u=composeScalar(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 composeAlias({options:s},{offset:e,source:t,end:n},r){const i=new Alias(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=resolveEnd(n,o,s.strict,r);return i.range=[e,o,a.offset],a.comment&&(i.comment=a.comment),i}function composeDoc(s,e,{offset:t,start:n,value:r,end:i},o){const a=Object.assign({_directives:e},s),l=new Document(void 0,a),c={atRoot:!0,directives:l.directives,options:l.options,schema:l.schema},f=resolveProps(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?composeNode(c,r,f,o):composeEmptyNode(c,f.end,n,null,f,o);const u=l.contents.range[2],h=resolveEnd(i,u,!1,o);return h.comment&&(l.comment=h.comment),l.range=[t,u,h.offset],l}function getErrorPos(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 parsePrelude(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
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 Composer{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(t,n,r,i)=>{const o=getErrorPos(t);i?this.warnings.push(new YAMLWarning(o,n,r)):this.errors.push(new YAMLParseError(o,n,r))},this.directives=new Directives({version:e.version||"1.2"}),this.options=e}decorate(e,t){const{comment:n,afterEmptyLine:r}=parsePrelude(this.prelude);if(n){const i=e.contents;if(t)e.comment=e.comment?`${e.comment}
@@ -157,9 +157,9 @@ ${a}`:n}else{const o=i.commentBefore;i.commentBefore=o?`${n}
157
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:parsePrelude(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=getErrorPos(e);i[0]+=t,this.onError(i,"BAD_DIRECTIVE",n,r)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{const t=composeDoc(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 YAMLParseError(getErrorPos(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 YAMLParseError(getErrorPos(e),"UNEXPECTED_TOKEN",n));break}this.doc.directives.docEnd=!0;const t=resolveEnd(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
158
  ${t.comment}`:t.comment}this.doc.range[2]=t.offset;break}default:this.errors.push(new YAMLParseError(getErrorPos(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 Document(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 resolveAsScalar(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 YAMLParseError([a,a+1],i,o)};switch(s.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return resolveFlowScalar(s,e,n);case"block-scalar":return resolveBlockScalar(s,e,n)}}return null}function createScalarToken(s,e){const{implicitKey:t=!1,indent:n,inFlow:r=!1,offset:i=-1,type:o="PLAIN"}=e,a=stringifyString({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
- `),h=a.substring(0,c),u=a.substring(c+1)+`
161
- `,f=[{type:"block-scalar-header",offset:i,indent:n,source:h}];return addEndtoBlockProps(f,l)||f.push({type:"newline",offset:-1,indent:n,source:`
162
- `}),{type:"block-scalar",offset:i,indent:n,props:f,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 setScalarValue(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=stringifyString({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">":setBlockScalarValue(s,l);break;case'"':setFlowScalarValue(s,l,"double-quoted-scalar");break;case"'":setFlowScalarValue(s,l,"single-quoted-scalar");break;default:setFlowScalarValue(s,l,"scalar")}}function setBlockScalarValue(s,e){const t=e.indexOf(`
160
+ `),f=a.substring(0,c),u=a.substring(c+1)+`
161
+ `,h=[{type:"block-scalar-header",offset:i,indent:n,source:f}];return addEndtoBlockProps(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 setScalarValue(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=stringifyString({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">":setBlockScalarValue(s,l);break;case'"':setFlowScalarValue(s,l,"double-quoted-scalar");break;case"'":setFlowScalarValue(s,l,"single-quoted-scalar");break;default:setFlowScalarValue(s,l,"scalar")}}function setBlockScalarValue(s,e){const t=e.indexOf(`
163
163
  `),n=e.substring(0,t),r=e.substring(t+1)+`
164
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}];addEndtoBlockProps(a,"end"in s?s.end:void 0)||a.push({type:"newline",offset:-1,indent:o,source:`
165
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 addEndtoBlockProps(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 setFlowScalarValue(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:`
@@ -193,5 +193,5 @@ ${t.comment}`:t.comment}this.doc.range[2]=t.offset;break}default:this.errors.pus
193
193
 
194
194
  ${i}
195
195
 
196
- See https://github.com/okonet/lint-staged#configuration.`),new Error(i)}return debugLog$4("Validated config from `%s`:",e),debugLog$4(node_util.inspect(s,{compact:!1})),r},debugLog$3=debug("lint-staged:searchConfigs"),EXEC_GIT=["ls-files","-z","--full-name"],filterPossibleConfigFiles=s=>s.filter(e=>CONFIG_FILE_NAMES.includes(path__default.basename(e))),numberOfLevels=s=>s.split("/").length,sortDeepestParth=(s,e)=>numberOfLevels(s)>numberOfLevels(e)?-1:1,isInsideDirectory=s=>e=>e.startsWith(normalizePath(s)),searchConfigs=async({configObject:s,configPath:e,cwd:t=process.cwd(),gitDir:n=t},r)=>{if(debugLog$3("Searching for configuration files..."),s)return debugLog$3("Using single direct configuration object..."),{"":validateConfig(s,"config object",r)};if(e){debugLog$3("Using single configuration path...");const{config:h,filepath:u}=await loadConfig({configPath:e},r);return h?{[e]:validateConfig(h,u,r)}:{}}const[i,o]=await Promise.all([execGit(EXEC_GIT,{cwd:n}).then(parseGitZOutput).then(filterPossibleConfigFiles),execGit([...EXEC_GIT,"--others","--exclude-standard"],{cwd:n}).then(parseGitZOutput).then(filterPossibleConfigFiles)]),a=[...i,...o].map(h=>normalizePath(path__default.join(n,h))).filter(isInsideDirectory(t)).sort(sortDeepestParth);debugLog$3("Found possible config files:",a);const l=a.reduce((h,u)=>Object.assign(h,{[u]:null}),{});await Promise.all(Object.keys(l).map(h=>loadConfig({configPath:h},r).then(({config:u,filepath:f})=>{u&&(h!==f&&debugLog$3('Config file "%s" resolved to "%s"',h,f),l[h]=validateConfig(u,f,r))})));const c=Object.entries(l).filter(([,h])=>!!h).reduce((h,[u,f])=>({...h,[u]:f}),{});if(!Object.keys(c).length){debugLog$3('Could not find config files inside "%s"',t);const{config:h,filepath:u}=await loadConfig({cwd:t},r);h?(debugLog$3('Found parent configuration file from "%s"',u),c[u]=validateConfig(h,u,r)):debugLog$3('Could not find parent configuration files from "%s"',t)}return debugLog$3("Found %d config files",Object.keys(c).length),c},debugLog$2=debug("lint-staged:runAll"),createError=s=>Object.assign(new Error("lint-staged failed"),{ctx:s}),runAll=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:h=!1,shell:u=!1,stash:f=o===void 0,hidePartiallyStaged:d=f,verbose:m=!1},p=console)=>{debugLog$2("Running all linter scripts...");const g=!!r;r=g?path__default.resolve(r):process.cwd(),debugLog$2("Using working directory `%s`",r);const y=getInitialState({quiet:c}),{gitDir:S,gitConfigDir:A}=await resolveGitRepo(r);if(!S)throw c||y.output.push(NOT_GIT_REPO),y.errors.add(GitRepoError),createError(y);const L=await execGit(["log","-1"],{cwd:S}).then(()=>!0).catch(()=>!1);y.shouldBackup=L&&f,!y.shouldBackup&&!c&&p.warn(skippingBackup(L,o)),y.shouldHidePartiallyStaged=d,!y.shouldHidePartiallyStaged&&!c&&p.warn(skippingHidePartiallyStaged(L&&f,o));const R=await getStagedFiles({cwd:S,diff:o,diffFilter:a});if(!R)throw c||y.output.push(FAILED_GET_STAGED_FILES),y.errors.add(GetStagedFilesError),createError(y);if(debugLog$2(`Loaded list of staged files in git:
197
- %O`,R),R.length===0)return c||y.output.push(NO_STAGED_FILES),y;const O=await searchConfigs({configObject:t,configPath:n,cwd:r,gitDir:S},p),I=Object.keys(O).length;if(I===0)throw y.errors.add(ConfigNotFoundError),createError(y);const _=await groupFilesByConfig({configs:O,files:R,singleConfigMode:t||n!==void 0}),k=I>1;let F=!1;const E={ctx:y,exitOnError:!1,registerSignalListeners:!1,...getRenderer({debug:i,quiet:c},p)},$=[],x=new Set;for(const[B,{config:M,files:W}]of Object.entries(_)){const q=B?normalizePath(path__default.relative(r,B)):"Config object",j=chunkFiles({baseDir:S,files:W,maxArgLength:l,relative:h}),Z=k&&!g?path__default.dirname(B):r,te=j.length;te>1&&debugLog$2("Chunked staged files from `%s` into %d part",B,te);for(const[se,Y]of j.entries()){const N=await Promise.all(generateTasks({config:M,cwd:Z,files:Y,relative:h}).map(G=>makeCmdTasks({commands:G.commands,cwd:Z,files:G.fileList,gitDir:S,shell:u,verbose:m}).then(ne=>{G.fileList.forEach(D=>{const C=path__default.isAbsolute(D)?D:normalizePath(path__default.join(Z,D));x.add(C)}),F=F||ne.some(D=>D.command==="git add");const T=G.fileList.length;return{title:`${G.pattern}${chalk$1.dim(` \u2014 ${T} ${T===1?"file":"files"}`)}`,task:async(D,C)=>C.newListr(ne,{concurrent:!1,exitOnError:!0}),skip:()=>T===0?`${G.pattern}${chalk$1.dim(" \u2014 no files")}`:!1}})));$.push({title:`${q}${chalk$1.dim(` \u2014 ${Y.length} ${Y.length>1?"files":"file"}`)}`+(te>1?chalk$1.dim(` (chunk ${se+1}/${te})...`):""),task:(G,ne)=>ne.newListr(N,{concurrent:e,exitOnError:!0}),skip:()=>y.errors.has(GitError)?SKIPPED_GIT_ERROR:N.every(G=>G.skip())?`${q}${chalk$1.dim(" \u2014 no tasks to run")}`:!1})}}if(F&&!c&&p.warn(DEPRECATED_GIT_ADD),$.every(B=>B.skip()))return c||y.output.push(NO_TASKS),y;const V=chunkFiles({baseDir:r,files:Array.from(x),maxArgLength:l,relative:!1}),b=new GitWorkflow({allowEmpty:s,gitConfigDir:A,gitDir:S,matchedFileChunks:V,diff:o,diffFilter:a});if(await new Listr([{title:"Preparing lint-staged...",task:B=>b.prepare(B)},{title:"Hiding unstaged changes to partially staged files...",task:B=>b.hideUnstagedChanges(B),enabled:shouldHidePartiallyStagedFiles},{title:`Running tasks for ${o?"changed":"staged"} files...`,task:(B,M)=>M.newListr($,{concurrent:e}),skip:()=>$.every(B=>B.skip())},{title:"Applying modifications from tasks...",task:B=>b.applyModifications(B),skip:applyModificationsSkipped},{title:"Restoring unstaged changes to partially staged files...",task:B=>b.restoreUnstagedChanges(B),enabled:shouldHidePartiallyStagedFiles,skip:restoreUnstagedChangesSkipped},{title:"Reverting to original state because of errors...",task:B=>b.restoreOriginalState(B),enabled:restoreOriginalStateEnabled,skip:restoreOriginalStateSkipped},{title:"Cleaning up temporary files...",task:B=>b.cleanup(B),enabled:cleanupEnabled,skip:cleanupSkipped}],E).run(),y.errors.size>0)throw createError(y);return y},debugLog$1=debug("lint-staged:validateOptions"),validateOptions=async(s={},e)=>{if(debugLog$1("Validating options..."),typeof s.cwd=="string")try{const t=path__default.resolve(s.cwd);await fs__default.access(t,node_fs.constants.F_OK)}catch(t){throw e.error(invalidOption("cwd",s.cwd,t.message)),InvalidOptionsError}if(typeof s.shell=="string")try{await fs__default.access(s.shell,node_fs.constants.X_OK)}catch(t){throw e.error(invalidOption("shell",s.shell,t.message)),InvalidOptionsError}debugLog$1("Validated options!")},debugLog=debug("lint-staged"),getMaxArgLength=()=>{switch(process.platform){case"darwin":return 262144;case"win32":return 8191;default:return 131072}},lintStaged=async({allowEmpty:s=!1,concurrent:e=!0,config:t,configPath:n,cwd:r,debug:i=!1,diff:o,diffFilter:a,maxArgLength:l=getMaxArgLength()/2,quiet:c=!1,relative:h=!1,shell:u=!1,stash:f=o===void 0,hidePartiallyStaged:d=f,verbose:m=!1}={},p=console)=>{await validateOptions({cwd:r,shell:u},p),debugLog("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:h,shell:u,stash:f,hidePartiallyStaged:d,verbose:m};try{const y=await runAll(g,p);return debugLog("Tasks were executed successfully!"),printTaskOutput(y,p),!0}catch(y){if(y?.ctx?.errors){const{ctx:S}=y;return S.errors.has(ConfigNotFoundError)?p.error(NO_CONFIGURATION):S.errors.has(ApplyEmptyCommitError)?p.warn(PREVENTED_EMPTY_COMMIT):S.errors.has(GitError)&&!S.errors.has(GetBackupStashError)&&(p.error(GIT_ERROR),S.shouldBackup&&p.error(RESTORE_STASH_EXAMPLE)),printTaskOutput(S,p),!1}throw y}},index={__proto__:null,default:lintStaged};exports.commonjsGlobal=commonjsGlobal,exports.getDefaultExportFromCjs=getDefaultExportFromCjs,exports.index=index;
196
+ See https://github.com/okonet/lint-staged#configuration.`),new Error(i)}return debugLog$4("Validated config from `%s`:",e),debugLog$4(node_util.inspect(s,{compact:!1})),r},debugLog$3=debug("lint-staged:searchConfigs"),EXEC_GIT=["ls-files","-z","--full-name"],filterPossibleConfigFiles=s=>s.filter(e=>CONFIG_FILE_NAMES.includes(path__default.basename(e))),numberOfLevels=s=>s.split("/").length,sortDeepestParth=(s,e)=>numberOfLevels(s)>numberOfLevels(e)?-1:1,isInsideDirectory=s=>e=>e.startsWith(normalizePath(s)),searchConfigs=async({configObject:s,configPath:e,cwd:t=process.cwd(),gitDir:n=t},r)=>{if(debugLog$3("Searching for configuration files..."),s)return debugLog$3("Using single direct configuration object..."),{"":validateConfig(s,"config object",r)};if(e){debugLog$3("Using single configuration path...");const{config:f,filepath:u}=await loadConfig({configPath:e},r);return f?{[e]:validateConfig(f,u,r)}:{}}const[i,o]=await Promise.all([execGit(EXEC_GIT,{cwd:n}).then(parseGitZOutput).then(filterPossibleConfigFiles),execGit([...EXEC_GIT,"--others","--exclude-standard"],{cwd:n}).then(parseGitZOutput).then(filterPossibleConfigFiles)]),a=[...i,...o].map(f=>normalizePath(path__default.join(n,f))).filter(isInsideDirectory(t)).sort(sortDeepestParth);debugLog$3("Found possible config files:",a);const l=a.reduce((f,u)=>Object.assign(f,{[u]:null}),{});await Promise.all(Object.keys(l).map(f=>loadConfig({configPath:f},r).then(({config:u,filepath:h})=>{u&&(f!==h&&debugLog$3('Config file "%s" resolved to "%s"',f,h),l[f]=validateConfig(u,h,r))})));const c=Object.entries(l).filter(([,f])=>!!f).reduce((f,[u,h])=>({...f,[u]:h}),{});if(!Object.keys(c).length){debugLog$3('Could not find config files inside "%s"',t);const{config:f,filepath:u}=await loadConfig({cwd:t},r);f?(debugLog$3('Found parent configuration file from "%s"',u),c[u]=validateConfig(f,u,r)):debugLog$3('Could not find parent configuration files from "%s"',t)}return debugLog$3("Found %d config files",Object.keys(c).length),c},debugLog$2=debug("lint-staged:runAll"),createError=s=>Object.assign(new Error("lint-staged failed"),{ctx:s}),runAll=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)=>{debugLog$2("Running all linter scripts...");const g=!!r;r=g?path__default.resolve(r):process.cwd(),debugLog$2("Using working directory `%s`",r);const y=getInitialState({quiet:c}),{gitDir:S,gitConfigDir:A}=await resolveGitRepo(r);if(!S)throw c||y.output.push(NOT_GIT_REPO),y.errors.add(GitRepoError),createError(y);const L=await execGit(["log","-1"],{cwd:S}).then(()=>!0).catch(()=>!1);y.shouldBackup=L&&h,!y.shouldBackup&&!c&&p.warn(skippingBackup(L,o)),y.shouldHidePartiallyStaged=d,!y.shouldHidePartiallyStaged&&!c&&p.warn(skippingHidePartiallyStaged(L&&h,o));const R=await getStagedFiles({cwd:S,diff:o,diffFilter:a});if(!R)throw c||y.output.push(FAILED_GET_STAGED_FILES),y.errors.add(GetStagedFilesError),createError(y);if(debugLog$2(`Loaded list of staged files in git:
197
+ %O`,R),R.length===0)return c||y.output.push(NO_STAGED_FILES),y;const O=await searchConfigs({configObject:t,configPath:n,cwd:r,gitDir:S},p),I=Object.keys(O).length;if(I===0)throw y.errors.add(ConfigNotFoundError),createError(y);const _=await groupFilesByConfig({configs:O,files:R,singleConfigMode:t||n!==void 0}),k=I>1;let D=!1;const E={ctx:y,exitOnError:!1,registerSignalListeners:!1,...getRenderer({debug:i,quiet:c},p)},$=[],x=new Set;for(const[B,{config:M,files:W}]of Object.entries(_)){const q=B?normalizePath(path__default.relative(r,B)):"Config object",j=chunkFiles({baseDir:S,files:W,maxArgLength:l,relative:f}),Z=k&&!g?path__default.dirname(B):r,te=j.length;te>1&&debugLog$2("Chunked staged files from `%s` into %d part",B,te);for(const[se,Y]of j.entries()){const N=await Promise.all(generateTasks({config:M,cwd:Z,files:Y,relative:f}).map(G=>makeCmdTasks({commands:G.commands,cwd:Z,files:G.fileList,gitDir:S,shell:u,verbose:m}).then(ne=>{G.fileList.forEach(F=>{const C=path__default.isAbsolute(F)?F:normalizePath(path__default.join(Z,F));x.add(C)}),D=D||ne.some(F=>F.command==="git add");const T=G.fileList.length;return{title:`${G.pattern}${chalk$1.dim(` \u2014 ${T} ${T===1?"file":"files"}`)}`,task:async(F,C)=>C.newListr(ne,{concurrent:!1,exitOnError:!0}),skip:()=>T===0?`${G.pattern}${chalk$1.dim(" \u2014 no files")}`:!1}})));$.push({title:`${q}${chalk$1.dim(` \u2014 ${Y.length} ${Y.length>1?"files":"file"}`)}`+(te>1?chalk$1.dim(` (chunk ${se+1}/${te})...`):""),task:(G,ne)=>ne.newListr(N,{concurrent:e,exitOnError:!0}),skip:()=>y.errors.has(GitError)?SKIPPED_GIT_ERROR:N.every(G=>G.skip())?`${q}${chalk$1.dim(" \u2014 no tasks to run")}`:!1})}}if(D&&!c&&p.warn(DEPRECATED_GIT_ADD),$.every(B=>B.skip()))return c||y.output.push(NO_TASKS),y;const V=chunkFiles({baseDir:r,files:Array.from(x),maxArgLength:l,relative:!1}),b=new GitWorkflow({allowEmpty:s,gitConfigDir:A,gitDir:S,matchedFileChunks:V,diff:o,diffFilter:a});if(await new Listr([{title:"Preparing lint-staged...",task:B=>b.prepare(B)},{title:"Hiding unstaged changes to partially staged files...",task:B=>b.hideUnstagedChanges(B),enabled:shouldHidePartiallyStagedFiles},{title:`Running tasks for ${o?"changed":"staged"} files...`,task:(B,M)=>M.newListr($,{concurrent:e}),skip:()=>$.every(B=>B.skip())},{title:"Applying modifications from tasks...",task:B=>b.applyModifications(B),skip:applyModificationsSkipped},{title:"Restoring unstaged changes to partially staged files...",task:B=>b.restoreUnstagedChanges(B),enabled:shouldHidePartiallyStagedFiles,skip:restoreUnstagedChangesSkipped},{title:"Reverting to original state because of errors...",task:B=>b.restoreOriginalState(B),enabled:restoreOriginalStateEnabled,skip:restoreOriginalStateSkipped},{title:"Cleaning up temporary files...",task:B=>b.cleanup(B),enabled:cleanupEnabled,skip:cleanupSkipped}],E).run(),y.errors.size>0)throw createError(y);return y},debugLog$1=debug("lint-staged:validateOptions"),validateOptions=async(s={},e)=>{if(debugLog$1("Validating options..."),typeof s.cwd=="string")try{const t=path__default.resolve(s.cwd);await fs__default.access(t,node_fs.constants.F_OK)}catch(t){throw e.error(invalidOption("cwd",s.cwd,t.message)),InvalidOptionsError}if(typeof s.shell=="string")try{await fs__default.access(s.shell,node_fs.constants.X_OK)}catch(t){throw e.error(invalidOption("shell",s.shell,t.message)),InvalidOptionsError}debugLog$1("Validated options!")},debugLog=debug("lint-staged"),getMaxArgLength=()=>{switch(process.platform){case"darwin":return 262144;case"win32":return 8191;default:return 131072}},lintStaged=async({allowEmpty:s=!1,concurrent:e=!0,config:t,configPath:n,cwd:r,debug:i=!1,diff:o,diffFilter:a,maxArgLength:l=getMaxArgLength()/2,quiet:c=!1,relative:f=!1,shell:u=!1,stash:h=o===void 0,hidePartiallyStaged:d=h,verbose:m=!1}={},p=console)=>{await validateOptions({cwd:r,shell:u},p),debugLog("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 runAll(g,p);return debugLog("Tasks were executed successfully!"),printTaskOutput(y,p),!0}catch(y){if(y?.ctx?.errors){const{ctx:S}=y;return S.errors.has(ConfigNotFoundError)?p.error(NO_CONFIGURATION):S.errors.has(ApplyEmptyCommitError)?p.warn(PREVENTED_EMPTY_COMMIT):S.errors.has(GitError)&&!S.errors.has(GetBackupStashError)&&(p.error(GIT_ERROR),S.shouldBackup&&p.error(RESTORE_STASH_EXAMPLE)),printTaskOutput(S,p),!1}throw y}},index={__proto__:null,default:lintStaged};exports.commonjsGlobal=commonjsGlobal,exports.getDefaultExportFromCjs=getDefaultExportFromCjs,exports.index=index;