@holdyourvoice/hyv 0.7.6 → 0.7.8

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.
Files changed (2) hide show
  1. package/dist/index.js +221 -216
  2. package/package.json +4 -4
package/dist/index.js CHANGED
@@ -1,199 +1,74 @@
1
- "use strict";var Vo=Object.create;var Rs=Object.defineProperty;var qo=Object.getOwnPropertyDescriptor;var Uo=Object.getOwnPropertyNames;var zo=Object.getPrototypeOf,Go=Object.prototype.hasOwnProperty;var Ki=(n,e)=>()=>(n&&(e=n(n=0)),e);var O=(n,e)=>()=>(e||n((e={exports:{}}).exports,e),e.exports),Yo=(n,e)=>{for(var t in e)Rs(n,t,{get:e[t],enumerable:!0})},Jo=(n,e,t,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Uo(e))!Go.call(n,i)&&i!==t&&Rs(n,i,{get:()=>e[i],enumerable:!(s=qo(e,i))||s.enumerable});return n};var C=(n,e,t)=>(t=n!=null?Vo(zo(n)):{},Jo(e||!n||!n.__esModule?Rs(t,"default",{value:n,enumerable:!0}):t,n));var ut=O(Ms=>{var Nt=class extends Error{constructor(e,t,s){super(s),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=t,this.exitCode=e,this.nestedError=void 0}},Ts=class extends Nt{constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};Ms.CommanderError=Nt;Ms.InvalidArgumentError=Ts});var It=O(Ds=>{var{InvalidArgumentError:Ko}=ut(),js=class{constructor(e,t){switch(this.description=t||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,e[0]){case"<":this.required=!0,this._name=e.slice(1,-1);break;case"[":this.required=!1,this._name=e.slice(1,-1);break;default:this.required=!0,this._name=e;break}this._name.length>3&&this._name.slice(-3)==="..."&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_concatValue(e,t){return t===this.defaultValue||!Array.isArray(t)?[e]:t.concat(e)}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}argParser(e){return this.parseArg=e,this}choices(e){return this.argChoices=e.slice(),this.parseArg=(t,s)=>{if(!this.argChoices.includes(t))throw new Ko(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(t,s):t},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function Xo(n){let e=n.name()+(n.variadic===!0?"...":"");return n.required?"<"+e+">":"["+e+"]"}Ds.Argument=js;Ds.humanReadableArgName=Xo});var Is=O(Xi=>{var{humanReadableArgName:Qo}=It(),Ns=class{constructor(){this.helpWidth=void 0,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}visibleCommands(e){let t=e.commands.filter(i=>!i._hidden),s=e._getHelpCommand();return s&&!s._hidden&&t.push(s),this.sortSubcommands&&t.sort((i,r)=>i.name().localeCompare(r.name())),t}compareOptions(e,t){let s=i=>i.short?i.short.replace(/^-/,""):i.long.replace(/^--/,"");return s(e).localeCompare(s(t))}visibleOptions(e){let t=e.options.filter(i=>!i.hidden),s=e._getHelpOption();if(s&&!s.hidden){let i=s.short&&e._findOption(s.short),r=s.long&&e._findOption(s.long);!i&&!r?t.push(s):s.long&&!r?t.push(e.createOption(s.long,s.description)):s.short&&!i&&t.push(e.createOption(s.short,s.description))}return this.sortOptions&&t.sort(this.compareOptions),t}visibleGlobalOptions(e){if(!this.showGlobalOptions)return[];let t=[];for(let s=e.parent;s;s=s.parent){let i=s.options.filter(r=>!r.hidden);t.push(...i)}return this.sortOptions&&t.sort(this.compareOptions),t}visibleArguments(e){return e._argsDescription&&e.registeredArguments.forEach(t=>{t.description=t.description||e._argsDescription[t.name()]||""}),e.registeredArguments.find(t=>t.description)?e.registeredArguments:[]}subcommandTerm(e){let t=e.registeredArguments.map(s=>Qo(s)).join(" ");return e._name+(e._aliases[0]?"|"+e._aliases[0]:"")+(e.options.length?" [options]":"")+(t?" "+t:"")}optionTerm(e){return e.flags}argumentTerm(e){return e.name()}longestSubcommandTermLength(e,t){return t.visibleCommands(e).reduce((s,i)=>Math.max(s,t.subcommandTerm(i).length),0)}longestOptionTermLength(e,t){return t.visibleOptions(e).reduce((s,i)=>Math.max(s,t.optionTerm(i).length),0)}longestGlobalOptionTermLength(e,t){return t.visibleGlobalOptions(e).reduce((s,i)=>Math.max(s,t.optionTerm(i).length),0)}longestArgumentTermLength(e,t){return t.visibleArguments(e).reduce((s,i)=>Math.max(s,t.argumentTerm(i).length),0)}commandUsage(e){let t=e._name;e._aliases[0]&&(t=t+"|"+e._aliases[0]);let s="";for(let i=e.parent;i;i=i.parent)s=i.name()+" "+s;return s+t+" "+e.usage()}commandDescription(e){return e.description()}subcommandDescription(e){return e.summary()||e.description()}optionDescription(e){let t=[];return e.argChoices&&t.push(`choices: ${e.argChoices.map(s=>JSON.stringify(s)).join(", ")}`),e.defaultValue!==void 0&&(e.required||e.optional||e.isBoolean()&&typeof e.defaultValue=="boolean")&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),e.presetArg!==void 0&&e.optional&&t.push(`preset: ${JSON.stringify(e.presetArg)}`),e.envVar!==void 0&&t.push(`env: ${e.envVar}`),t.length>0?`${e.description} (${t.join(", ")})`:e.description}argumentDescription(e){let t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(s=>JSON.stringify(s)).join(", ")}`),e.defaultValue!==void 0&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),t.length>0){let s=`(${t.join(", ")})`;return e.description?`${e.description} ${s}`:s}return e.description}formatHelp(e,t){let s=t.padWidth(e,t),i=t.helpWidth||80,r=2,o=2;function a(g,p){if(p){let y=`${g.padEnd(s+o)}${p}`;return t.wrap(y,i-r,s+o)}return g}function l(g){return g.join(`
2
- `).replace(/^/gm," ".repeat(r))}let c=[`Usage: ${t.commandUsage(e)}`,""],u=t.commandDescription(e);u.length>0&&(c=c.concat([t.wrap(u,i,0),""]));let h=t.visibleArguments(e).map(g=>a(t.argumentTerm(g),t.argumentDescription(g)));h.length>0&&(c=c.concat(["Arguments:",l(h),""]));let f=t.visibleOptions(e).map(g=>a(t.optionTerm(g),t.optionDescription(g)));if(f.length>0&&(c=c.concat(["Options:",l(f),""])),this.showGlobalOptions){let g=t.visibleGlobalOptions(e).map(p=>a(t.optionTerm(p),t.optionDescription(p)));g.length>0&&(c=c.concat(["Global Options:",l(g),""]))}let d=t.visibleCommands(e).map(g=>a(t.subcommandTerm(g),t.subcommandDescription(g)));return d.length>0&&(c=c.concat(["Commands:",l(d),""])),c.join(`
1
+ #!/usr/bin/env node
2
+ "use strict";var ta=Object.create;var Ns=Object.defineProperty;var sa=Object.getOwnPropertyDescriptor;var ia=Object.getOwnPropertyNames;var na=Object.getPrototypeOf,ra=Object.prototype.hasOwnProperty;var bt=(n,e)=>()=>(n&&(e=n(n=0)),e);var A=(n,e)=>()=>(e||n((e={exports:{}}).exports,e),e.exports),on=(n,e)=>{for(var t in e)Ns(n,t,{get:e[t],enumerable:!0})},oa=(n,e,t,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of ia(e))!ra.call(n,i)&&i!==t&&Ns(n,i,{get:()=>e[i],enumerable:!(s=sa(e,i))||s.enumerable});return n};var C=(n,e,t)=>(t=n!=null?ta(na(n)):{},oa(e||!n||!n.__esModule?Ns(t,"default",{value:n,enumerable:!0}):t,n));var vt=A(Hs=>{var zt=class extends Error{constructor(e,t,s){super(s),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=t,this.exitCode=e,this.nestedError=void 0}},Ws=class extends zt{constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};Hs.CommanderError=zt;Hs.InvalidArgumentError=Ws});var Gt=A(qs=>{var{InvalidArgumentError:aa}=vt(),Vs=class{constructor(e,t){switch(this.description=t||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,e[0]){case"<":this.required=!0,this._name=e.slice(1,-1);break;case"[":this.required=!1,this._name=e.slice(1,-1);break;default:this.required=!0,this._name=e;break}this._name.length>3&&this._name.slice(-3)==="..."&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_concatValue(e,t){return t===this.defaultValue||!Array.isArray(t)?[e]:t.concat(e)}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}argParser(e){return this.parseArg=e,this}choices(e){return this.argChoices=e.slice(),this.parseArg=(t,s)=>{if(!this.argChoices.includes(t))throw new aa(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(t,s):t},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function la(n){let e=n.name()+(n.variadic===!0?"...":"");return n.required?"<"+e+">":"["+e+"]"}qs.Argument=Vs;qs.humanReadableArgName=la});var Us=A(an=>{var{humanReadableArgName:ca}=Gt(),Bs=class{constructor(){this.helpWidth=void 0,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}visibleCommands(e){let t=e.commands.filter(i=>!i._hidden),s=e._getHelpCommand();return s&&!s._hidden&&t.push(s),this.sortSubcommands&&t.sort((i,r)=>i.name().localeCompare(r.name())),t}compareOptions(e,t){let s=i=>i.short?i.short.replace(/^-/,""):i.long.replace(/^--/,"");return s(e).localeCompare(s(t))}visibleOptions(e){let t=e.options.filter(i=>!i.hidden),s=e._getHelpOption();if(s&&!s.hidden){let i=s.short&&e._findOption(s.short),r=s.long&&e._findOption(s.long);!i&&!r?t.push(s):s.long&&!r?t.push(e.createOption(s.long,s.description)):s.short&&!i&&t.push(e.createOption(s.short,s.description))}return this.sortOptions&&t.sort(this.compareOptions),t}visibleGlobalOptions(e){if(!this.showGlobalOptions)return[];let t=[];for(let s=e.parent;s;s=s.parent){let i=s.options.filter(r=>!r.hidden);t.push(...i)}return this.sortOptions&&t.sort(this.compareOptions),t}visibleArguments(e){return e._argsDescription&&e.registeredArguments.forEach(t=>{t.description=t.description||e._argsDescription[t.name()]||""}),e.registeredArguments.find(t=>t.description)?e.registeredArguments:[]}subcommandTerm(e){let t=e.registeredArguments.map(s=>ca(s)).join(" ");return e._name+(e._aliases[0]?"|"+e._aliases[0]:"")+(e.options.length?" [options]":"")+(t?" "+t:"")}optionTerm(e){return e.flags}argumentTerm(e){return e.name()}longestSubcommandTermLength(e,t){return t.visibleCommands(e).reduce((s,i)=>Math.max(s,t.subcommandTerm(i).length),0)}longestOptionTermLength(e,t){return t.visibleOptions(e).reduce((s,i)=>Math.max(s,t.optionTerm(i).length),0)}longestGlobalOptionTermLength(e,t){return t.visibleGlobalOptions(e).reduce((s,i)=>Math.max(s,t.optionTerm(i).length),0)}longestArgumentTermLength(e,t){return t.visibleArguments(e).reduce((s,i)=>Math.max(s,t.argumentTerm(i).length),0)}commandUsage(e){let t=e._name;e._aliases[0]&&(t=t+"|"+e._aliases[0]);let s="";for(let i=e.parent;i;i=i.parent)s=i.name()+" "+s;return s+t+" "+e.usage()}commandDescription(e){return e.description()}subcommandDescription(e){return e.summary()||e.description()}optionDescription(e){let t=[];return e.argChoices&&t.push(`choices: ${e.argChoices.map(s=>JSON.stringify(s)).join(", ")}`),e.defaultValue!==void 0&&(e.required||e.optional||e.isBoolean()&&typeof e.defaultValue=="boolean")&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),e.presetArg!==void 0&&e.optional&&t.push(`preset: ${JSON.stringify(e.presetArg)}`),e.envVar!==void 0&&t.push(`env: ${e.envVar}`),t.length>0?`${e.description} (${t.join(", ")})`:e.description}argumentDescription(e){let t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(s=>JSON.stringify(s)).join(", ")}`),e.defaultValue!==void 0&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),t.length>0){let s=`(${t.join(", ")})`;return e.description?`${e.description} ${s}`:s}return e.description}formatHelp(e,t){let s=t.padWidth(e,t),i=t.helpWidth||80,r=2,o=2;function a(g,p){if(p){let y=`${g.padEnd(s+o)}${p}`;return t.wrap(y,i-r,s+o)}return g}function l(g){return g.join(`
3
+ `).replace(/^/gm," ".repeat(r))}let c=[`Usage: ${t.commandUsage(e)}`,""],h=t.commandDescription(e);h.length>0&&(c=c.concat([t.wrap(h,i,0),""]));let u=t.visibleArguments(e).map(g=>a(t.argumentTerm(g),t.argumentDescription(g)));u.length>0&&(c=c.concat(["Arguments:",l(u),""]));let f=t.visibleOptions(e).map(g=>a(t.optionTerm(g),t.optionDescription(g)));if(f.length>0&&(c=c.concat(["Options:",l(f),""])),this.showGlobalOptions){let g=t.visibleGlobalOptions(e).map(p=>a(t.optionTerm(p),t.optionDescription(p)));g.length>0&&(c=c.concat(["Global Options:",l(g),""]))}let d=t.visibleCommands(e).map(g=>a(t.subcommandTerm(g),t.subcommandDescription(g)));return d.length>0&&(c=c.concat(["Commands:",l(d),""])),c.join(`
3
4
  `)}padWidth(e,t){return Math.max(t.longestOptionTermLength(e,t),t.longestGlobalOptionTermLength(e,t),t.longestSubcommandTermLength(e,t),t.longestArgumentTermLength(e,t))}wrap(e,t,s,i=40){let r=" \\f\\t\\v\xA0\u1680\u2000-\u200A\u202F\u205F\u3000\uFEFF",o=new RegExp(`[\\n][${r}]+`);if(e.match(o))return e;let a=t-s;if(a<i)return e;let l=e.slice(0,s),c=e.slice(s).replace(`\r
4
5
  `,`
5
- `),u=" ".repeat(s),f="\\s\u200B",d=new RegExp(`
6
+ `),h=" ".repeat(s),f="\\s\u200B",d=new RegExp(`
6
7
  |.{1,${a-1}}([${f}]|$)|[^${f}]+?([${f}]|$)`,"g"),g=c.match(d)||[];return l+g.map((p,y)=>p===`
7
- `?"":(y>0?u:"")+p.trimEnd()).join(`
8
- `)}};Xi.Help=Ns});var Bs=O(Hs=>{var{InvalidArgumentError:Zo}=ut(),Ls=class{constructor(e,t){this.flags=e,this.description=t||"",this.required=e.includes("<"),this.optional=e.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test(e),this.mandatory=!1;let s=ta(e);this.short=s.shortFlag,this.long=s.longFlag,this.negate=!1,this.long&&(this.negate=this.long.startsWith("--no-")),this.defaultValue=void 0,this.defaultValueDescription=void 0,this.presetArg=void 0,this.envVar=void 0,this.parseArg=void 0,this.hidden=!1,this.argChoices=void 0,this.conflictsWith=[],this.implied=void 0}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}preset(e){return this.presetArg=e,this}conflicts(e){return this.conflictsWith=this.conflictsWith.concat(e),this}implies(e){let t=e;return typeof e=="string"&&(t={[e]:!0}),this.implied=Object.assign(this.implied||{},t),this}env(e){return this.envVar=e,this}argParser(e){return this.parseArg=e,this}makeOptionMandatory(e=!0){return this.mandatory=!!e,this}hideHelp(e=!0){return this.hidden=!!e,this}_concatValue(e,t){return t===this.defaultValue||!Array.isArray(t)?[e]:t.concat(e)}choices(e){return this.argChoices=e.slice(),this.parseArg=(t,s)=>{if(!this.argChoices.includes(t))throw new Zo(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(t,s):t},this}name(){return this.long?this.long.replace(/^--/,""):this.short.replace(/^-/,"")}attributeName(){return ea(this.name().replace(/^no-/,""))}is(e){return this.short===e||this.long===e}isBoolean(){return!this.required&&!this.optional&&!this.negate}},Ws=class{constructor(e){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,e.forEach(t=>{t.negate?this.negativeOptions.set(t.attributeName(),t):this.positiveOptions.set(t.attributeName(),t)}),this.negativeOptions.forEach((t,s)=>{this.positiveOptions.has(s)&&this.dualOptions.add(s)})}valueFromOption(e,t){let s=t.attributeName();if(!this.dualOptions.has(s))return!0;let i=this.negativeOptions.get(s).presetArg,r=i!==void 0?i:!1;return t.negate===(r===e)}};function ea(n){return n.split("-").reduce((e,t)=>e+t[0].toUpperCase()+t.slice(1))}function ta(n){let e,t,s=n.split(/[ |,]+/);return s.length>1&&!/^[[<]/.test(s[1])&&(e=s.shift()),t=s.shift(),!e&&/^-[^-]$/.test(t)&&(e=t,t=void 0),{shortFlag:e,longFlag:t}}Hs.Option=Ls;Hs.DualOptions=Ws});var Zi=O(Qi=>{function sa(n,e){if(Math.abs(n.length-e.length)>3)return Math.max(n.length,e.length);let t=[];for(let s=0;s<=n.length;s++)t[s]=[s];for(let s=0;s<=e.length;s++)t[0][s]=s;for(let s=1;s<=e.length;s++)for(let i=1;i<=n.length;i++){let r=1;n[i-1]===e[s-1]?r=0:r=1,t[i][s]=Math.min(t[i-1][s]+1,t[i][s-1]+1,t[i-1][s-1]+r),i>1&&s>1&&n[i-1]===e[s-2]&&n[i-2]===e[s-1]&&(t[i][s]=Math.min(t[i][s],t[i-2][s-2]+1))}return t[n.length][e.length]}function ia(n,e){if(!e||e.length===0)return"";e=Array.from(new Set(e));let t=n.startsWith("--");t&&(n=n.slice(2),e=e.map(o=>o.slice(2)));let s=[],i=3,r=.4;return e.forEach(o=>{if(o.length<=1)return;let a=sa(n,o),l=Math.max(n.length,o.length);(l-a)/l>r&&(a<i?(i=a,s=[o]):a===i&&s.push(o))}),s.sort((o,a)=>o.localeCompare(a)),t&&(s=s.map(o=>`--${o}`)),s.length>1?`
8
+ `?"":(y>0?h:"")+p.trimEnd()).join(`
9
+ `)}};an.Help=Bs});var Js=A(Ys=>{var{InvalidArgumentError:ha}=vt(),zs=class{constructor(e,t){this.flags=e,this.description=t||"",this.required=e.includes("<"),this.optional=e.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test(e),this.mandatory=!1;let s=fa(e);this.short=s.shortFlag,this.long=s.longFlag,this.negate=!1,this.long&&(this.negate=this.long.startsWith("--no-")),this.defaultValue=void 0,this.defaultValueDescription=void 0,this.presetArg=void 0,this.envVar=void 0,this.parseArg=void 0,this.hidden=!1,this.argChoices=void 0,this.conflictsWith=[],this.implied=void 0}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}preset(e){return this.presetArg=e,this}conflicts(e){return this.conflictsWith=this.conflictsWith.concat(e),this}implies(e){let t=e;return typeof e=="string"&&(t={[e]:!0}),this.implied=Object.assign(this.implied||{},t),this}env(e){return this.envVar=e,this}argParser(e){return this.parseArg=e,this}makeOptionMandatory(e=!0){return this.mandatory=!!e,this}hideHelp(e=!0){return this.hidden=!!e,this}_concatValue(e,t){return t===this.defaultValue||!Array.isArray(t)?[e]:t.concat(e)}choices(e){return this.argChoices=e.slice(),this.parseArg=(t,s)=>{if(!this.argChoices.includes(t))throw new ha(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(t,s):t},this}name(){return this.long?this.long.replace(/^--/,""):this.short.replace(/^-/,"")}attributeName(){return ua(this.name().replace(/^no-/,""))}is(e){return this.short===e||this.long===e}isBoolean(){return!this.required&&!this.optional&&!this.negate}},Gs=class{constructor(e){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,e.forEach(t=>{t.negate?this.negativeOptions.set(t.attributeName(),t):this.positiveOptions.set(t.attributeName(),t)}),this.negativeOptions.forEach((t,s)=>{this.positiveOptions.has(s)&&this.dualOptions.add(s)})}valueFromOption(e,t){let s=t.attributeName();if(!this.dualOptions.has(s))return!0;let i=this.negativeOptions.get(s).presetArg,r=i!==void 0?i:!1;return t.negate===(r===e)}};function ua(n){return n.split("-").reduce((e,t)=>e+t[0].toUpperCase()+t.slice(1))}function fa(n){let e,t,s=n.split(/[ |,]+/);return s.length>1&&!/^[[<]/.test(s[1])&&(e=s.shift()),t=s.shift(),!e&&/^-[^-]$/.test(t)&&(e=t,t=void 0),{shortFlag:e,longFlag:t}}Ys.Option=zs;Ys.DualOptions=Gs});var cn=A(ln=>{function da(n,e){if(Math.abs(n.length-e.length)>3)return Math.max(n.length,e.length);let t=[];for(let s=0;s<=n.length;s++)t[s]=[s];for(let s=0;s<=e.length;s++)t[0][s]=s;for(let s=1;s<=e.length;s++)for(let i=1;i<=n.length;i++){let r=1;n[i-1]===e[s-1]?r=0:r=1,t[i][s]=Math.min(t[i-1][s]+1,t[i][s-1]+1,t[i-1][s-1]+r),i>1&&s>1&&n[i-1]===e[s-2]&&n[i-2]===e[s-1]&&(t[i][s]=Math.min(t[i][s],t[i-2][s-2]+1))}return t[n.length][e.length]}function pa(n,e){if(!e||e.length===0)return"";e=Array.from(new Set(e));let t=n.startsWith("--");t&&(n=n.slice(2),e=e.map(o=>o.slice(2)));let s=[],i=3,r=.4;return e.forEach(o=>{if(o.length<=1)return;let a=da(n,o),l=Math.max(n.length,o.length);(l-a)/l>r&&(a<i?(i=a,s=[o]):a===i&&s.push(o))}),s.sort((o,a)=>o.localeCompare(a)),t&&(s=s.map(o=>`--${o}`)),s.length>1?`
9
10
  (Did you mean one of ${s.join(", ")}?)`:s.length===1?`
10
- (Did you mean ${s[0]}?)`:""}Qi.suggestSimilar=ia});var rn=O(nn=>{var na=require("node:events").EventEmitter,Vs=require("node:child_process"),Se=require("node:path"),qs=require("node:fs"),E=require("node:process"),{Argument:ra,humanReadableArgName:oa}=It(),{CommanderError:Us}=ut(),{Help:aa}=Is(),{Option:en,DualOptions:la}=Bs(),{suggestSimilar:tn}=Zi(),zs=class n extends na{constructor(e){super(),this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=!1,this._allowExcessArguments=!0,this.registeredArguments=[],this._args=this.registeredArguments,this.args=[],this.rawArgs=[],this.processedArgs=[],this._scriptPath=null,this._name=e||"",this._optionValues={},this._optionValueSources={},this._storeOptionsAsProperties=!1,this._actionHandler=null,this._executableHandler=!1,this._executableFile=null,this._executableDir=null,this._defaultCommandName=null,this._exitCallback=null,this._aliases=[],this._combineFlagAndOptionalValue=!0,this._description="",this._summary="",this._argsDescription=void 0,this._enablePositionalOptions=!1,this._passThroughOptions=!1,this._lifeCycleHooks={},this._showHelpAfterError=!1,this._showSuggestionAfterError=!0,this._outputConfiguration={writeOut:t=>E.stdout.write(t),writeErr:t=>E.stderr.write(t),getOutHelpWidth:()=>E.stdout.isTTY?E.stdout.columns:void 0,getErrHelpWidth:()=>E.stderr.isTTY?E.stderr.columns:void 0,outputError:(t,s)=>s(t)},this._hidden=!1,this._helpOption=void 0,this._addImplicitHelpCommand=void 0,this._helpCommand=void 0,this._helpConfiguration={}}copyInheritedSettings(e){return this._outputConfiguration=e._outputConfiguration,this._helpOption=e._helpOption,this._helpCommand=e._helpCommand,this._helpConfiguration=e._helpConfiguration,this._exitCallback=e._exitCallback,this._storeOptionsAsProperties=e._storeOptionsAsProperties,this._combineFlagAndOptionalValue=e._combineFlagAndOptionalValue,this._allowExcessArguments=e._allowExcessArguments,this._enablePositionalOptions=e._enablePositionalOptions,this._showHelpAfterError=e._showHelpAfterError,this._showSuggestionAfterError=e._showSuggestionAfterError,this}_getCommandAndAncestors(){let e=[];for(let t=this;t;t=t.parent)e.push(t);return e}command(e,t,s){let i=t,r=s;typeof i=="object"&&i!==null&&(r=i,i=null),r=r||{};let[,o,a]=e.match(/([^ ]+) *(.*)/),l=this.createCommand(o);return i&&(l.description(i),l._executableHandler=!0),r.isDefault&&(this._defaultCommandName=l._name),l._hidden=!!(r.noHelp||r.hidden),l._executableFile=r.executableFile||null,a&&l.arguments(a),this._registerCommand(l),l.parent=this,l.copyInheritedSettings(this),i?this:l}createCommand(e){return new n(e)}createHelp(){return Object.assign(new aa,this.configureHelp())}configureHelp(e){return e===void 0?this._helpConfiguration:(this._helpConfiguration=e,this)}configureOutput(e){return e===void 0?this._outputConfiguration:(Object.assign(this._outputConfiguration,e),this)}showHelpAfterError(e=!0){return typeof e!="string"&&(e=!!e),this._showHelpAfterError=e,this}showSuggestionAfterError(e=!0){return this._showSuggestionAfterError=!!e,this}addCommand(e,t){if(!e._name)throw new Error(`Command passed to .addCommand() must have a name
11
- - specify the name in Command constructor or using .name()`);return t=t||{},t.isDefault&&(this._defaultCommandName=e._name),(t.noHelp||t.hidden)&&(e._hidden=!0),this._registerCommand(e),e.parent=this,e._checkForBrokenPassThrough(),this}createArgument(e,t){return new ra(e,t)}argument(e,t,s,i){let r=this.createArgument(e,t);return typeof s=="function"?r.default(i).argParser(s):r.default(s),this.addArgument(r),this}arguments(e){return e.trim().split(/ +/).forEach(t=>{this.argument(t)}),this}addArgument(e){let t=this.registeredArguments.slice(-1)[0];if(t&&t.variadic)throw new Error(`only the last argument can be variadic '${t.name()}'`);if(e.required&&e.defaultValue!==void 0&&e.parseArg===void 0)throw new Error(`a default value for a required argument is never used: '${e.name()}'`);return this.registeredArguments.push(e),this}helpCommand(e,t){if(typeof e=="boolean")return this._addImplicitHelpCommand=e,this;e=e??"help [command]";let[,s,i]=e.match(/([^ ]+) *(.*)/),r=t??"display help for command",o=this.createCommand(s);return o.helpOption(!1),i&&o.arguments(i),r&&o.description(r),this._addImplicitHelpCommand=!0,this._helpCommand=o,this}addHelpCommand(e,t){return typeof e!="object"?(this.helpCommand(e,t),this):(this._addImplicitHelpCommand=!0,this._helpCommand=e,this)}_getHelpCommand(){return this._addImplicitHelpCommand??(this.commands.length&&!this._actionHandler&&!this._findCommand("help"))?(this._helpCommand===void 0&&this.helpCommand(void 0,void 0),this._helpCommand):null}hook(e,t){let s=["preSubcommand","preAction","postAction"];if(!s.includes(e))throw new Error(`Unexpected value for event passed to hook : '${e}'.
12
- Expecting one of '${s.join("', '")}'`);return this._lifeCycleHooks[e]?this._lifeCycleHooks[e].push(t):this._lifeCycleHooks[e]=[t],this}exitOverride(e){return e?this._exitCallback=e:this._exitCallback=t=>{if(t.code!=="commander.executeSubCommandAsync")throw t},this}_exit(e,t,s){this._exitCallback&&this._exitCallback(new Us(e,t,s)),E.exit(e)}action(e){let t=s=>{let i=this.registeredArguments.length,r=s.slice(0,i);return this._storeOptionsAsProperties?r[i]=this:r[i]=this.opts(),r.push(this),e.apply(this,r)};return this._actionHandler=t,this}createOption(e,t){return new en(e,t)}_callParseArg(e,t,s,i){try{return e.parseArg(t,s)}catch(r){if(r.code==="commander.invalidArgument"){let o=`${i} ${r.message}`;this.error(o,{exitCode:r.exitCode,code:r.code})}throw r}}_registerOption(e){let t=e.short&&this._findOption(e.short)||e.long&&this._findOption(e.long);if(t){let s=e.long&&this._findOption(e.long)?e.long:e.short;throw new Error(`Cannot add option '${e.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${s}'
13
- - already used by option '${t.flags}'`)}this.options.push(e)}_registerCommand(e){let t=i=>[i.name()].concat(i.aliases()),s=t(e).find(i=>this._findCommand(i));if(s){let i=t(this._findCommand(s)).join("|"),r=t(e).join("|");throw new Error(`cannot add command '${r}' as already have command '${i}'`)}this.commands.push(e)}addOption(e){this._registerOption(e);let t=e.name(),s=e.attributeName();if(e.negate){let r=e.long.replace(/^--no-/,"--");this._findOption(r)||this.setOptionValueWithSource(s,e.defaultValue===void 0?!0:e.defaultValue,"default")}else e.defaultValue!==void 0&&this.setOptionValueWithSource(s,e.defaultValue,"default");let i=(r,o,a)=>{r==null&&e.presetArg!==void 0&&(r=e.presetArg);let l=this.getOptionValue(s);r!==null&&e.parseArg?r=this._callParseArg(e,r,l,o):r!==null&&e.variadic&&(r=e._concatValue(r,l)),r==null&&(e.negate?r=!1:e.isBoolean()||e.optional?r=!0:r=""),this.setOptionValueWithSource(s,r,a)};return this.on("option:"+t,r=>{let o=`error: option '${e.flags}' argument '${r}' is invalid.`;i(r,o,"cli")}),e.envVar&&this.on("optionEnv:"+t,r=>{let o=`error: option '${e.flags}' value '${r}' from env '${e.envVar}' is invalid.`;i(r,o,"env")}),this}_optionEx(e,t,s,i,r){if(typeof t=="object"&&t instanceof en)throw new Error("To add an Option object use addOption() instead of option() or requiredOption()");let o=this.createOption(t,s);if(o.makeOptionMandatory(!!e.mandatory),typeof i=="function")o.default(r).argParser(i);else if(i instanceof RegExp){let a=i;i=(l,c)=>{let u=a.exec(l);return u?u[0]:c},o.default(r).argParser(i)}else o.default(i);return this.addOption(o)}option(e,t,s,i){return this._optionEx({},e,t,s,i)}requiredOption(e,t,s,i){return this._optionEx({mandatory:!0},e,t,s,i)}combineFlagAndOptionalValue(e=!0){return this._combineFlagAndOptionalValue=!!e,this}allowUnknownOption(e=!0){return this._allowUnknownOption=!!e,this}allowExcessArguments(e=!0){return this._allowExcessArguments=!!e,this}enablePositionalOptions(e=!0){return this._enablePositionalOptions=!!e,this}passThroughOptions(e=!0){return this._passThroughOptions=!!e,this._checkForBrokenPassThrough(),this}_checkForBrokenPassThrough(){if(this.parent&&this._passThroughOptions&&!this.parent._enablePositionalOptions)throw new Error(`passThroughOptions cannot be used for '${this._name}' without turning on enablePositionalOptions for parent command(s)`)}storeOptionsAsProperties(e=!0){if(this.options.length)throw new Error("call .storeOptionsAsProperties() before adding options");if(Object.keys(this._optionValues).length)throw new Error("call .storeOptionsAsProperties() before setting option values");return this._storeOptionsAsProperties=!!e,this}getOptionValue(e){return this._storeOptionsAsProperties?this[e]:this._optionValues[e]}setOptionValue(e,t){return this.setOptionValueWithSource(e,t,void 0)}setOptionValueWithSource(e,t,s){return this._storeOptionsAsProperties?this[e]=t:this._optionValues[e]=t,this._optionValueSources[e]=s,this}getOptionValueSource(e){return this._optionValueSources[e]}getOptionValueSourceWithGlobals(e){let t;return this._getCommandAndAncestors().forEach(s=>{s.getOptionValueSource(e)!==void 0&&(t=s.getOptionValueSource(e))}),t}_prepareUserArgs(e,t){if(e!==void 0&&!Array.isArray(e))throw new Error("first parameter to parse must be array or undefined");if(t=t||{},e===void 0&&t.from===void 0){E.versions?.electron&&(t.from="electron");let i=E.execArgv??[];(i.includes("-e")||i.includes("--eval")||i.includes("-p")||i.includes("--print"))&&(t.from="eval")}e===void 0&&(e=E.argv),this.rawArgs=e.slice();let s;switch(t.from){case void 0:case"node":this._scriptPath=e[1],s=e.slice(2);break;case"electron":E.defaultApp?(this._scriptPath=e[1],s=e.slice(2)):s=e.slice(1);break;case"user":s=e.slice(0);break;case"eval":s=e.slice(1);break;default:throw new Error(`unexpected parse option { from: '${t.from}' }`)}return!this._name&&this._scriptPath&&this.nameFromFilename(this._scriptPath),this._name=this._name||"program",s}parse(e,t){let s=this._prepareUserArgs(e,t);return this._parseCommand([],s),this}async parseAsync(e,t){let s=this._prepareUserArgs(e,t);return await this._parseCommand([],s),this}_executeSubCommand(e,t){t=t.slice();let s=!1,i=[".js",".ts",".tsx",".mjs",".cjs"];function r(u,h){let f=Se.resolve(u,h);if(qs.existsSync(f))return f;if(i.includes(Se.extname(h)))return;let d=i.find(g=>qs.existsSync(`${f}${g}`));if(d)return`${f}${d}`}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let o=e._executableFile||`${this._name}-${e._name}`,a=this._executableDir||"";if(this._scriptPath){let u;try{u=qs.realpathSync(this._scriptPath)}catch{u=this._scriptPath}a=Se.resolve(Se.dirname(u),a)}if(a){let u=r(a,o);if(!u&&!e._executableFile&&this._scriptPath){let h=Se.basename(this._scriptPath,Se.extname(this._scriptPath));h!==this._name&&(u=r(a,`${h}-${e._name}`))}o=u||o}s=i.includes(Se.extname(o));let l;E.platform!=="win32"?s?(t.unshift(o),t=sn(E.execArgv).concat(t),l=Vs.spawn(E.argv[0],t,{stdio:"inherit"})):l=Vs.spawn(o,t,{stdio:"inherit"}):(t.unshift(o),t=sn(E.execArgv).concat(t),l=Vs.spawn(E.execPath,t,{stdio:"inherit"})),l.killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(h=>{E.on(h,()=>{l.killed===!1&&l.exitCode===null&&l.kill(h)})});let c=this._exitCallback;l.on("close",u=>{u=u??1,c?c(new Us(u,"commander.executeSubCommandAsync","(close)")):E.exit(u)}),l.on("error",u=>{if(u.code==="ENOENT"){let h=a?`searched for local subcommand relative to directory '${a}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",f=`'${o}' does not exist
11
+ (Did you mean ${s[0]}?)`:""}ln.suggestSimilar=pa});var pn=A(dn=>{var ga=require("node:events").EventEmitter,Ks=require("node:child_process"),Oe=require("node:path"),Xs=require("node:fs"),O=require("node:process"),{Argument:ma,humanReadableArgName:ya}=Gt(),{CommanderError:Qs}=vt(),{Help:wa}=Us(),{Option:hn,DualOptions:ba}=Js(),{suggestSimilar:un}=cn(),Zs=class n extends ga{constructor(e){super(),this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=!1,this._allowExcessArguments=!0,this.registeredArguments=[],this._args=this.registeredArguments,this.args=[],this.rawArgs=[],this.processedArgs=[],this._scriptPath=null,this._name=e||"",this._optionValues={},this._optionValueSources={},this._storeOptionsAsProperties=!1,this._actionHandler=null,this._executableHandler=!1,this._executableFile=null,this._executableDir=null,this._defaultCommandName=null,this._exitCallback=null,this._aliases=[],this._combineFlagAndOptionalValue=!0,this._description="",this._summary="",this._argsDescription=void 0,this._enablePositionalOptions=!1,this._passThroughOptions=!1,this._lifeCycleHooks={},this._showHelpAfterError=!1,this._showSuggestionAfterError=!0,this._outputConfiguration={writeOut:t=>O.stdout.write(t),writeErr:t=>O.stderr.write(t),getOutHelpWidth:()=>O.stdout.isTTY?O.stdout.columns:void 0,getErrHelpWidth:()=>O.stderr.isTTY?O.stderr.columns:void 0,outputError:(t,s)=>s(t)},this._hidden=!1,this._helpOption=void 0,this._addImplicitHelpCommand=void 0,this._helpCommand=void 0,this._helpConfiguration={}}copyInheritedSettings(e){return this._outputConfiguration=e._outputConfiguration,this._helpOption=e._helpOption,this._helpCommand=e._helpCommand,this._helpConfiguration=e._helpConfiguration,this._exitCallback=e._exitCallback,this._storeOptionsAsProperties=e._storeOptionsAsProperties,this._combineFlagAndOptionalValue=e._combineFlagAndOptionalValue,this._allowExcessArguments=e._allowExcessArguments,this._enablePositionalOptions=e._enablePositionalOptions,this._showHelpAfterError=e._showHelpAfterError,this._showSuggestionAfterError=e._showSuggestionAfterError,this}_getCommandAndAncestors(){let e=[];for(let t=this;t;t=t.parent)e.push(t);return e}command(e,t,s){let i=t,r=s;typeof i=="object"&&i!==null&&(r=i,i=null),r=r||{};let[,o,a]=e.match(/([^ ]+) *(.*)/),l=this.createCommand(o);return i&&(l.description(i),l._executableHandler=!0),r.isDefault&&(this._defaultCommandName=l._name),l._hidden=!!(r.noHelp||r.hidden),l._executableFile=r.executableFile||null,a&&l.arguments(a),this._registerCommand(l),l.parent=this,l.copyInheritedSettings(this),i?this:l}createCommand(e){return new n(e)}createHelp(){return Object.assign(new wa,this.configureHelp())}configureHelp(e){return e===void 0?this._helpConfiguration:(this._helpConfiguration=e,this)}configureOutput(e){return e===void 0?this._outputConfiguration:(Object.assign(this._outputConfiguration,e),this)}showHelpAfterError(e=!0){return typeof e!="string"&&(e=!!e),this._showHelpAfterError=e,this}showSuggestionAfterError(e=!0){return this._showSuggestionAfterError=!!e,this}addCommand(e,t){if(!e._name)throw new Error(`Command passed to .addCommand() must have a name
12
+ - specify the name in Command constructor or using .name()`);return t=t||{},t.isDefault&&(this._defaultCommandName=e._name),(t.noHelp||t.hidden)&&(e._hidden=!0),this._registerCommand(e),e.parent=this,e._checkForBrokenPassThrough(),this}createArgument(e,t){return new ma(e,t)}argument(e,t,s,i){let r=this.createArgument(e,t);return typeof s=="function"?r.default(i).argParser(s):r.default(s),this.addArgument(r),this}arguments(e){return e.trim().split(/ +/).forEach(t=>{this.argument(t)}),this}addArgument(e){let t=this.registeredArguments.slice(-1)[0];if(t&&t.variadic)throw new Error(`only the last argument can be variadic '${t.name()}'`);if(e.required&&e.defaultValue!==void 0&&e.parseArg===void 0)throw new Error(`a default value for a required argument is never used: '${e.name()}'`);return this.registeredArguments.push(e),this}helpCommand(e,t){if(typeof e=="boolean")return this._addImplicitHelpCommand=e,this;e=e??"help [command]";let[,s,i]=e.match(/([^ ]+) *(.*)/),r=t??"display help for command",o=this.createCommand(s);return o.helpOption(!1),i&&o.arguments(i),r&&o.description(r),this._addImplicitHelpCommand=!0,this._helpCommand=o,this}addHelpCommand(e,t){return typeof e!="object"?(this.helpCommand(e,t),this):(this._addImplicitHelpCommand=!0,this._helpCommand=e,this)}_getHelpCommand(){return this._addImplicitHelpCommand??(this.commands.length&&!this._actionHandler&&!this._findCommand("help"))?(this._helpCommand===void 0&&this.helpCommand(void 0,void 0),this._helpCommand):null}hook(e,t){let s=["preSubcommand","preAction","postAction"];if(!s.includes(e))throw new Error(`Unexpected value for event passed to hook : '${e}'.
13
+ Expecting one of '${s.join("', '")}'`);return this._lifeCycleHooks[e]?this._lifeCycleHooks[e].push(t):this._lifeCycleHooks[e]=[t],this}exitOverride(e){return e?this._exitCallback=e:this._exitCallback=t=>{if(t.code!=="commander.executeSubCommandAsync")throw t},this}_exit(e,t,s){this._exitCallback&&this._exitCallback(new Qs(e,t,s)),O.exit(e)}action(e){let t=s=>{let i=this.registeredArguments.length,r=s.slice(0,i);return this._storeOptionsAsProperties?r[i]=this:r[i]=this.opts(),r.push(this),e.apply(this,r)};return this._actionHandler=t,this}createOption(e,t){return new hn(e,t)}_callParseArg(e,t,s,i){try{return e.parseArg(t,s)}catch(r){if(r.code==="commander.invalidArgument"){let o=`${i} ${r.message}`;this.error(o,{exitCode:r.exitCode,code:r.code})}throw r}}_registerOption(e){let t=e.short&&this._findOption(e.short)||e.long&&this._findOption(e.long);if(t){let s=e.long&&this._findOption(e.long)?e.long:e.short;throw new Error(`Cannot add option '${e.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${s}'
14
+ - already used by option '${t.flags}'`)}this.options.push(e)}_registerCommand(e){let t=i=>[i.name()].concat(i.aliases()),s=t(e).find(i=>this._findCommand(i));if(s){let i=t(this._findCommand(s)).join("|"),r=t(e).join("|");throw new Error(`cannot add command '${r}' as already have command '${i}'`)}this.commands.push(e)}addOption(e){this._registerOption(e);let t=e.name(),s=e.attributeName();if(e.negate){let r=e.long.replace(/^--no-/,"--");this._findOption(r)||this.setOptionValueWithSource(s,e.defaultValue===void 0?!0:e.defaultValue,"default")}else e.defaultValue!==void 0&&this.setOptionValueWithSource(s,e.defaultValue,"default");let i=(r,o,a)=>{r==null&&e.presetArg!==void 0&&(r=e.presetArg);let l=this.getOptionValue(s);r!==null&&e.parseArg?r=this._callParseArg(e,r,l,o):r!==null&&e.variadic&&(r=e._concatValue(r,l)),r==null&&(e.negate?r=!1:e.isBoolean()||e.optional?r=!0:r=""),this.setOptionValueWithSource(s,r,a)};return this.on("option:"+t,r=>{let o=`error: option '${e.flags}' argument '${r}' is invalid.`;i(r,o,"cli")}),e.envVar&&this.on("optionEnv:"+t,r=>{let o=`error: option '${e.flags}' value '${r}' from env '${e.envVar}' is invalid.`;i(r,o,"env")}),this}_optionEx(e,t,s,i,r){if(typeof t=="object"&&t instanceof hn)throw new Error("To add an Option object use addOption() instead of option() or requiredOption()");let o=this.createOption(t,s);if(o.makeOptionMandatory(!!e.mandatory),typeof i=="function")o.default(r).argParser(i);else if(i instanceof RegExp){let a=i;i=(l,c)=>{let h=a.exec(l);return h?h[0]:c},o.default(r).argParser(i)}else o.default(i);return this.addOption(o)}option(e,t,s,i){return this._optionEx({},e,t,s,i)}requiredOption(e,t,s,i){return this._optionEx({mandatory:!0},e,t,s,i)}combineFlagAndOptionalValue(e=!0){return this._combineFlagAndOptionalValue=!!e,this}allowUnknownOption(e=!0){return this._allowUnknownOption=!!e,this}allowExcessArguments(e=!0){return this._allowExcessArguments=!!e,this}enablePositionalOptions(e=!0){return this._enablePositionalOptions=!!e,this}passThroughOptions(e=!0){return this._passThroughOptions=!!e,this._checkForBrokenPassThrough(),this}_checkForBrokenPassThrough(){if(this.parent&&this._passThroughOptions&&!this.parent._enablePositionalOptions)throw new Error(`passThroughOptions cannot be used for '${this._name}' without turning on enablePositionalOptions for parent command(s)`)}storeOptionsAsProperties(e=!0){if(this.options.length)throw new Error("call .storeOptionsAsProperties() before adding options");if(Object.keys(this._optionValues).length)throw new Error("call .storeOptionsAsProperties() before setting option values");return this._storeOptionsAsProperties=!!e,this}getOptionValue(e){return this._storeOptionsAsProperties?this[e]:this._optionValues[e]}setOptionValue(e,t){return this.setOptionValueWithSource(e,t,void 0)}setOptionValueWithSource(e,t,s){return this._storeOptionsAsProperties?this[e]=t:this._optionValues[e]=t,this._optionValueSources[e]=s,this}getOptionValueSource(e){return this._optionValueSources[e]}getOptionValueSourceWithGlobals(e){let t;return this._getCommandAndAncestors().forEach(s=>{s.getOptionValueSource(e)!==void 0&&(t=s.getOptionValueSource(e))}),t}_prepareUserArgs(e,t){if(e!==void 0&&!Array.isArray(e))throw new Error("first parameter to parse must be array or undefined");if(t=t||{},e===void 0&&t.from===void 0){O.versions?.electron&&(t.from="electron");let i=O.execArgv??[];(i.includes("-e")||i.includes("--eval")||i.includes("-p")||i.includes("--print"))&&(t.from="eval")}e===void 0&&(e=O.argv),this.rawArgs=e.slice();let s;switch(t.from){case void 0:case"node":this._scriptPath=e[1],s=e.slice(2);break;case"electron":O.defaultApp?(this._scriptPath=e[1],s=e.slice(2)):s=e.slice(1);break;case"user":s=e.slice(0);break;case"eval":s=e.slice(1);break;default:throw new Error(`unexpected parse option { from: '${t.from}' }`)}return!this._name&&this._scriptPath&&this.nameFromFilename(this._scriptPath),this._name=this._name||"program",s}parse(e,t){let s=this._prepareUserArgs(e,t);return this._parseCommand([],s),this}async parseAsync(e,t){let s=this._prepareUserArgs(e,t);return await this._parseCommand([],s),this}_executeSubCommand(e,t){t=t.slice();let s=!1,i=[".js",".ts",".tsx",".mjs",".cjs"];function r(h,u){let f=Oe.resolve(h,u);if(Xs.existsSync(f))return f;if(i.includes(Oe.extname(u)))return;let d=i.find(g=>Xs.existsSync(`${f}${g}`));if(d)return`${f}${d}`}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let o=e._executableFile||`${this._name}-${e._name}`,a=this._executableDir||"";if(this._scriptPath){let h;try{h=Xs.realpathSync(this._scriptPath)}catch{h=this._scriptPath}a=Oe.resolve(Oe.dirname(h),a)}if(a){let h=r(a,o);if(!h&&!e._executableFile&&this._scriptPath){let u=Oe.basename(this._scriptPath,Oe.extname(this._scriptPath));u!==this._name&&(h=r(a,`${u}-${e._name}`))}o=h||o}s=i.includes(Oe.extname(o));let l;O.platform!=="win32"?s?(t.unshift(o),t=fn(O.execArgv).concat(t),l=Ks.spawn(O.argv[0],t,{stdio:"inherit"})):l=Ks.spawn(o,t,{stdio:"inherit"}):(t.unshift(o),t=fn(O.execArgv).concat(t),l=Ks.spawn(O.execPath,t,{stdio:"inherit"})),l.killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(u=>{O.on(u,()=>{l.killed===!1&&l.exitCode===null&&l.kill(u)})});let c=this._exitCallback;l.on("close",h=>{h=h??1,c?c(new Qs(h,"commander.executeSubCommandAsync","(close)")):O.exit(h)}),l.on("error",h=>{if(h.code==="ENOENT"){let u=a?`searched for local subcommand relative to directory '${a}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",f=`'${o}' does not exist
14
15
  - if '${e._name}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
15
16
  - if the default executable name is not suitable, use the executableFile option to supply a custom name or path
16
- - ${h}`;throw new Error(f)}else if(u.code==="EACCES")throw new Error(`'${o}' not executable`);if(!c)E.exit(1);else{let h=new Us(1,"commander.executeSubCommandAsync","(error)");h.nestedError=u,c(h)}}),this.runningCommand=l}_dispatchSubcommand(e,t,s){let i=this._findCommand(e);i||this.help({error:!0});let r;return r=this._chainOrCallSubCommandHook(r,i,"preSubcommand"),r=this._chainOrCall(r,()=>{if(i._executableHandler)this._executeSubCommand(i,t.concat(s));else return i._parseCommand(t,s)}),r}_dispatchHelpCommand(e){e||this.help();let t=this._findCommand(e);return t&&!t._executableHandler&&t.help(),this._dispatchSubcommand(e,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){this.registeredArguments.forEach((e,t)=>{e.required&&this.args[t]==null&&this.missingArgument(e.name())}),!(this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic)&&this.args.length>this.registeredArguments.length&&this._excessArguments(this.args)}_processArguments(){let e=(s,i,r)=>{let o=i;if(i!==null&&s.parseArg){let a=`error: command-argument value '${i}' is invalid for argument '${s.name()}'.`;o=this._callParseArg(s,i,r,a)}return o};this._checkNumberOfArguments();let t=[];this.registeredArguments.forEach((s,i)=>{let r=s.defaultValue;s.variadic?i<this.args.length?(r=this.args.slice(i),s.parseArg&&(r=r.reduce((o,a)=>e(s,a,o),s.defaultValue))):r===void 0&&(r=[]):i<this.args.length&&(r=this.args[i],s.parseArg&&(r=e(s,r,s.defaultValue))),t[i]=r}),this.processedArgs=t}_chainOrCall(e,t){return e&&e.then&&typeof e.then=="function"?e.then(()=>t()):t()}_chainOrCallHooks(e,t){let s=e,i=[];return this._getCommandAndAncestors().reverse().filter(r=>r._lifeCycleHooks[t]!==void 0).forEach(r=>{r._lifeCycleHooks[t].forEach(o=>{i.push({hookedCommand:r,callback:o})})}),t==="postAction"&&i.reverse(),i.forEach(r=>{s=this._chainOrCall(s,()=>r.callback(r.hookedCommand,this))}),s}_chainOrCallSubCommandHook(e,t,s){let i=e;return this._lifeCycleHooks[s]!==void 0&&this._lifeCycleHooks[s].forEach(r=>{i=this._chainOrCall(i,()=>r(this,t))}),i}_parseCommand(e,t){let s=this.parseOptions(t);if(this._parseOptionsEnv(),this._parseOptionsImplied(),e=e.concat(s.operands),t=s.unknown,this.args=e.concat(t),e&&this._findCommand(e[0]))return this._dispatchSubcommand(e[0],e.slice(1),t);if(this._getHelpCommand()&&e[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(e[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(t),this._dispatchSubcommand(this._defaultCommandName,e,t);this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName&&this.help({error:!0}),this._outputHelpIfRequested(s.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let i=()=>{s.unknown.length>0&&this.unknownOption(s.unknown[0])},r=`command:${this.name()}`;if(this._actionHandler){i(),this._processArguments();let o;return o=this._chainOrCallHooks(o,"preAction"),o=this._chainOrCall(o,()=>this._actionHandler(this.processedArgs)),this.parent&&(o=this._chainOrCall(o,()=>{this.parent.emit(r,e,t)})),o=this._chainOrCallHooks(o,"postAction"),o}if(this.parent&&this.parent.listenerCount(r))i(),this._processArguments(),this.parent.emit(r,e,t);else if(e.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",e,t);this.listenerCount("command:*")?this.emit("command:*",e,t):this.commands.length?this.unknownCommand():(i(),this._processArguments())}else this.commands.length?(i(),this.help({error:!0})):(i(),this._processArguments())}_findCommand(e){if(e)return this.commands.find(t=>t._name===e||t._aliases.includes(e))}_findOption(e){return this.options.find(t=>t.is(e))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach(e=>{e.options.forEach(t=>{t.mandatory&&e.getOptionValue(t.attributeName())===void 0&&e.missingMandatoryOptionValue(t)})})}_checkForConflictingLocalOptions(){let e=this.options.filter(s=>{let i=s.attributeName();return this.getOptionValue(i)===void 0?!1:this.getOptionValueSource(i)!=="default"});e.filter(s=>s.conflictsWith.length>0).forEach(s=>{let i=e.find(r=>s.conflictsWith.includes(r.attributeName()));i&&this._conflictingOption(s,i)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(e=>{e._checkForConflictingLocalOptions()})}parseOptions(e){let t=[],s=[],i=t,r=e.slice();function o(l){return l.length>1&&l[0]==="-"}let a=null;for(;r.length;){let l=r.shift();if(l==="--"){i===s&&i.push(l),i.push(...r);break}if(a&&!o(l)){this.emit(`option:${a.name()}`,l);continue}if(a=null,o(l)){let c=this._findOption(l);if(c){if(c.required){let u=r.shift();u===void 0&&this.optionMissingArgument(c),this.emit(`option:${c.name()}`,u)}else if(c.optional){let u=null;r.length>0&&!o(r[0])&&(u=r.shift()),this.emit(`option:${c.name()}`,u)}else this.emit(`option:${c.name()}`);a=c.variadic?c:null;continue}}if(l.length>2&&l[0]==="-"&&l[1]!=="-"){let c=this._findOption(`-${l[1]}`);if(c){c.required||c.optional&&this._combineFlagAndOptionalValue?this.emit(`option:${c.name()}`,l.slice(2)):(this.emit(`option:${c.name()}`),r.unshift(`-${l.slice(2)}`));continue}}if(/^--[^=]+=/.test(l)){let c=l.indexOf("="),u=this._findOption(l.slice(0,c));if(u&&(u.required||u.optional)){this.emit(`option:${u.name()}`,l.slice(c+1));continue}}if(o(l)&&(i=s),(this._enablePositionalOptions||this._passThroughOptions)&&t.length===0&&s.length===0){if(this._findCommand(l)){t.push(l),r.length>0&&s.push(...r);break}else if(this._getHelpCommand()&&l===this._getHelpCommand().name()){t.push(l),r.length>0&&t.push(...r);break}else if(this._defaultCommandName){s.push(l),r.length>0&&s.push(...r);break}}if(this._passThroughOptions){i.push(l),r.length>0&&i.push(...r);break}i.push(l)}return{operands:t,unknown:s}}opts(){if(this._storeOptionsAsProperties){let e={},t=this.options.length;for(let s=0;s<t;s++){let i=this.options[s].attributeName();e[i]=i===this._versionOptionName?this._version:this[i]}return e}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce((e,t)=>Object.assign(e,t.opts()),{})}error(e,t){this._outputConfiguration.outputError(`${e}
17
+ - ${u}`;throw new Error(f)}else if(h.code==="EACCES")throw new Error(`'${o}' not executable`);if(!c)O.exit(1);else{let u=new Qs(1,"commander.executeSubCommandAsync","(error)");u.nestedError=h,c(u)}}),this.runningCommand=l}_dispatchSubcommand(e,t,s){let i=this._findCommand(e);i||this.help({error:!0});let r;return r=this._chainOrCallSubCommandHook(r,i,"preSubcommand"),r=this._chainOrCall(r,()=>{if(i._executableHandler)this._executeSubCommand(i,t.concat(s));else return i._parseCommand(t,s)}),r}_dispatchHelpCommand(e){e||this.help();let t=this._findCommand(e);return t&&!t._executableHandler&&t.help(),this._dispatchSubcommand(e,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){this.registeredArguments.forEach((e,t)=>{e.required&&this.args[t]==null&&this.missingArgument(e.name())}),!(this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic)&&this.args.length>this.registeredArguments.length&&this._excessArguments(this.args)}_processArguments(){let e=(s,i,r)=>{let o=i;if(i!==null&&s.parseArg){let a=`error: command-argument value '${i}' is invalid for argument '${s.name()}'.`;o=this._callParseArg(s,i,r,a)}return o};this._checkNumberOfArguments();let t=[];this.registeredArguments.forEach((s,i)=>{let r=s.defaultValue;s.variadic?i<this.args.length?(r=this.args.slice(i),s.parseArg&&(r=r.reduce((o,a)=>e(s,a,o),s.defaultValue))):r===void 0&&(r=[]):i<this.args.length&&(r=this.args[i],s.parseArg&&(r=e(s,r,s.defaultValue))),t[i]=r}),this.processedArgs=t}_chainOrCall(e,t){return e&&e.then&&typeof e.then=="function"?e.then(()=>t()):t()}_chainOrCallHooks(e,t){let s=e,i=[];return this._getCommandAndAncestors().reverse().filter(r=>r._lifeCycleHooks[t]!==void 0).forEach(r=>{r._lifeCycleHooks[t].forEach(o=>{i.push({hookedCommand:r,callback:o})})}),t==="postAction"&&i.reverse(),i.forEach(r=>{s=this._chainOrCall(s,()=>r.callback(r.hookedCommand,this))}),s}_chainOrCallSubCommandHook(e,t,s){let i=e;return this._lifeCycleHooks[s]!==void 0&&this._lifeCycleHooks[s].forEach(r=>{i=this._chainOrCall(i,()=>r(this,t))}),i}_parseCommand(e,t){let s=this.parseOptions(t);if(this._parseOptionsEnv(),this._parseOptionsImplied(),e=e.concat(s.operands),t=s.unknown,this.args=e.concat(t),e&&this._findCommand(e[0]))return this._dispatchSubcommand(e[0],e.slice(1),t);if(this._getHelpCommand()&&e[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(e[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(t),this._dispatchSubcommand(this._defaultCommandName,e,t);this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName&&this.help({error:!0}),this._outputHelpIfRequested(s.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let i=()=>{s.unknown.length>0&&this.unknownOption(s.unknown[0])},r=`command:${this.name()}`;if(this._actionHandler){i(),this._processArguments();let o;return o=this._chainOrCallHooks(o,"preAction"),o=this._chainOrCall(o,()=>this._actionHandler(this.processedArgs)),this.parent&&(o=this._chainOrCall(o,()=>{this.parent.emit(r,e,t)})),o=this._chainOrCallHooks(o,"postAction"),o}if(this.parent&&this.parent.listenerCount(r))i(),this._processArguments(),this.parent.emit(r,e,t);else if(e.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",e,t);this.listenerCount("command:*")?this.emit("command:*",e,t):this.commands.length?this.unknownCommand():(i(),this._processArguments())}else this.commands.length?(i(),this.help({error:!0})):(i(),this._processArguments())}_findCommand(e){if(e)return this.commands.find(t=>t._name===e||t._aliases.includes(e))}_findOption(e){return this.options.find(t=>t.is(e))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach(e=>{e.options.forEach(t=>{t.mandatory&&e.getOptionValue(t.attributeName())===void 0&&e.missingMandatoryOptionValue(t)})})}_checkForConflictingLocalOptions(){let e=this.options.filter(s=>{let i=s.attributeName();return this.getOptionValue(i)===void 0?!1:this.getOptionValueSource(i)!=="default"});e.filter(s=>s.conflictsWith.length>0).forEach(s=>{let i=e.find(r=>s.conflictsWith.includes(r.attributeName()));i&&this._conflictingOption(s,i)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(e=>{e._checkForConflictingLocalOptions()})}parseOptions(e){let t=[],s=[],i=t,r=e.slice();function o(l){return l.length>1&&l[0]==="-"}let a=null;for(;r.length;){let l=r.shift();if(l==="--"){i===s&&i.push(l),i.push(...r);break}if(a&&!o(l)){this.emit(`option:${a.name()}`,l);continue}if(a=null,o(l)){let c=this._findOption(l);if(c){if(c.required){let h=r.shift();h===void 0&&this.optionMissingArgument(c),this.emit(`option:${c.name()}`,h)}else if(c.optional){let h=null;r.length>0&&!o(r[0])&&(h=r.shift()),this.emit(`option:${c.name()}`,h)}else this.emit(`option:${c.name()}`);a=c.variadic?c:null;continue}}if(l.length>2&&l[0]==="-"&&l[1]!=="-"){let c=this._findOption(`-${l[1]}`);if(c){c.required||c.optional&&this._combineFlagAndOptionalValue?this.emit(`option:${c.name()}`,l.slice(2)):(this.emit(`option:${c.name()}`),r.unshift(`-${l.slice(2)}`));continue}}if(/^--[^=]+=/.test(l)){let c=l.indexOf("="),h=this._findOption(l.slice(0,c));if(h&&(h.required||h.optional)){this.emit(`option:${h.name()}`,l.slice(c+1));continue}}if(o(l)&&(i=s),(this._enablePositionalOptions||this._passThroughOptions)&&t.length===0&&s.length===0){if(this._findCommand(l)){t.push(l),r.length>0&&s.push(...r);break}else if(this._getHelpCommand()&&l===this._getHelpCommand().name()){t.push(l),r.length>0&&t.push(...r);break}else if(this._defaultCommandName){s.push(l),r.length>0&&s.push(...r);break}}if(this._passThroughOptions){i.push(l),r.length>0&&i.push(...r);break}i.push(l)}return{operands:t,unknown:s}}opts(){if(this._storeOptionsAsProperties){let e={},t=this.options.length;for(let s=0;s<t;s++){let i=this.options[s].attributeName();e[i]=i===this._versionOptionName?this._version:this[i]}return e}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce((e,t)=>Object.assign(e,t.opts()),{})}error(e,t){this._outputConfiguration.outputError(`${e}
17
18
  `,this._outputConfiguration.writeErr),typeof this._showHelpAfterError=="string"?this._outputConfiguration.writeErr(`${this._showHelpAfterError}
18
19
  `):this._showHelpAfterError&&(this._outputConfiguration.writeErr(`
19
- `),this.outputHelp({error:!0}));let s=t||{},i=s.exitCode||1,r=s.code||"commander.error";this._exit(i,r,e)}_parseOptionsEnv(){this.options.forEach(e=>{if(e.envVar&&e.envVar in E.env){let t=e.attributeName();(this.getOptionValue(t)===void 0||["default","config","env"].includes(this.getOptionValueSource(t)))&&(e.required||e.optional?this.emit(`optionEnv:${e.name()}`,E.env[e.envVar]):this.emit(`optionEnv:${e.name()}`))}})}_parseOptionsImplied(){let e=new la(this.options),t=s=>this.getOptionValue(s)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(s));this.options.filter(s=>s.implied!==void 0&&t(s.attributeName())&&e.valueFromOption(this.getOptionValue(s.attributeName()),s)).forEach(s=>{Object.keys(s.implied).filter(i=>!t(i)).forEach(i=>{this.setOptionValueWithSource(i,s.implied[i],"implied")})})}missingArgument(e){let t=`error: missing required argument '${e}'`;this.error(t,{code:"commander.missingArgument"})}optionMissingArgument(e){let t=`error: option '${e.flags}' argument missing`;this.error(t,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(e){let t=`error: required option '${e.flags}' not specified`;this.error(t,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(e,t){let s=o=>{let a=o.attributeName(),l=this.getOptionValue(a),c=this.options.find(h=>h.negate&&a===h.attributeName()),u=this.options.find(h=>!h.negate&&a===h.attributeName());return c&&(c.presetArg===void 0&&l===!1||c.presetArg!==void 0&&l===c.presetArg)?c:u||o},i=o=>{let a=s(o),l=a.attributeName();return this.getOptionValueSource(l)==="env"?`environment variable '${a.envVar}'`:`option '${a.flags}'`},r=`error: ${i(e)} cannot be used with ${i(t)}`;this.error(r,{code:"commander.conflictingOption"})}unknownOption(e){if(this._allowUnknownOption)return;let t="";if(e.startsWith("--")&&this._showSuggestionAfterError){let i=[],r=this;do{let o=r.createHelp().visibleOptions(r).filter(a=>a.long).map(a=>a.long);i=i.concat(o),r=r.parent}while(r&&!r._enablePositionalOptions);t=tn(e,i)}let s=`error: unknown option '${e}'${t}`;this.error(s,{code:"commander.unknownOption"})}_excessArguments(e){if(this._allowExcessArguments)return;let t=this.registeredArguments.length,s=t===1?"":"s",r=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${t} argument${s} but got ${e.length}.`;this.error(r,{code:"commander.excessArguments"})}unknownCommand(){let e=this.args[0],t="";if(this._showSuggestionAfterError){let i=[];this.createHelp().visibleCommands(this).forEach(r=>{i.push(r.name()),r.alias()&&i.push(r.alias())}),t=tn(e,i)}let s=`error: unknown command '${e}'${t}`;this.error(s,{code:"commander.unknownCommand"})}version(e,t,s){if(e===void 0)return this._version;this._version=e,t=t||"-V, --version",s=s||"output the version number";let i=this.createOption(t,s);return this._versionOptionName=i.attributeName(),this._registerOption(i),this.on("option:"+i.name(),()=>{this._outputConfiguration.writeOut(`${e}
20
- `),this._exit(0,"commander.version",e)}),this}description(e,t){return e===void 0&&t===void 0?this._description:(this._description=e,t&&(this._argsDescription=t),this)}summary(e){return e===void 0?this._summary:(this._summary=e,this)}alias(e){if(e===void 0)return this._aliases[0];let t=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler&&(t=this.commands[this.commands.length-1]),e===t._name)throw new Error("Command alias can't be the same as its name");let s=this.parent?._findCommand(e);if(s){let i=[s.name()].concat(s.aliases()).join("|");throw new Error(`cannot add alias '${e}' to command '${this.name()}' as already have command '${i}'`)}return t._aliases.push(e),this}aliases(e){return e===void 0?this._aliases:(e.forEach(t=>this.alias(t)),this)}usage(e){if(e===void 0){if(this._usage)return this._usage;let t=this.registeredArguments.map(s=>oa(s));return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?t:[]).join(" ")}return this._usage=e,this}name(e){return e===void 0?this._name:(this._name=e,this)}nameFromFilename(e){return this._name=Se.basename(e,Se.extname(e)),this}executableDir(e){return e===void 0?this._executableDir:(this._executableDir=e,this)}helpInformation(e){let t=this.createHelp();return t.helpWidth===void 0&&(t.helpWidth=e&&e.error?this._outputConfiguration.getErrHelpWidth():this._outputConfiguration.getOutHelpWidth()),t.formatHelp(this,t)}_getHelpContext(e){e=e||{};let t={error:!!e.error},s;return t.error?s=i=>this._outputConfiguration.writeErr(i):s=i=>this._outputConfiguration.writeOut(i),t.write=e.write||s,t.command=this,t}outputHelp(e){let t;typeof e=="function"&&(t=e,e=void 0);let s=this._getHelpContext(e);this._getCommandAndAncestors().reverse().forEach(r=>r.emit("beforeAllHelp",s)),this.emit("beforeHelp",s);let i=this.helpInformation(s);if(t&&(i=t(i),typeof i!="string"&&!Buffer.isBuffer(i)))throw new Error("outputHelp callback must return a string or a Buffer");s.write(i),this._getHelpOption()?.long&&this.emit(this._getHelpOption().long),this.emit("afterHelp",s),this._getCommandAndAncestors().forEach(r=>r.emit("afterAllHelp",s))}helpOption(e,t){return typeof e=="boolean"?(e?this._helpOption=this._helpOption??void 0:this._helpOption=null,this):(e=e??"-h, --help",t=t??"display help for command",this._helpOption=this.createOption(e,t),this)}_getHelpOption(){return this._helpOption===void 0&&this.helpOption(void 0,void 0),this._helpOption}addHelpOption(e){return this._helpOption=e,this}help(e){this.outputHelp(e);let t=E.exitCode||0;t===0&&e&&typeof e!="function"&&e.error&&(t=1),this._exit(t,"commander.help","(outputHelp)")}addHelpText(e,t){let s=["beforeAll","before","after","afterAll"];if(!s.includes(e))throw new Error(`Unexpected value for position to addHelpText.
20
+ `),this.outputHelp({error:!0}));let s=t||{},i=s.exitCode||1,r=s.code||"commander.error";this._exit(i,r,e)}_parseOptionsEnv(){this.options.forEach(e=>{if(e.envVar&&e.envVar in O.env){let t=e.attributeName();(this.getOptionValue(t)===void 0||["default","config","env"].includes(this.getOptionValueSource(t)))&&(e.required||e.optional?this.emit(`optionEnv:${e.name()}`,O.env[e.envVar]):this.emit(`optionEnv:${e.name()}`))}})}_parseOptionsImplied(){let e=new ba(this.options),t=s=>this.getOptionValue(s)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(s));this.options.filter(s=>s.implied!==void 0&&t(s.attributeName())&&e.valueFromOption(this.getOptionValue(s.attributeName()),s)).forEach(s=>{Object.keys(s.implied).filter(i=>!t(i)).forEach(i=>{this.setOptionValueWithSource(i,s.implied[i],"implied")})})}missingArgument(e){let t=`error: missing required argument '${e}'`;this.error(t,{code:"commander.missingArgument"})}optionMissingArgument(e){let t=`error: option '${e.flags}' argument missing`;this.error(t,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(e){let t=`error: required option '${e.flags}' not specified`;this.error(t,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(e,t){let s=o=>{let a=o.attributeName(),l=this.getOptionValue(a),c=this.options.find(u=>u.negate&&a===u.attributeName()),h=this.options.find(u=>!u.negate&&a===u.attributeName());return c&&(c.presetArg===void 0&&l===!1||c.presetArg!==void 0&&l===c.presetArg)?c:h||o},i=o=>{let a=s(o),l=a.attributeName();return this.getOptionValueSource(l)==="env"?`environment variable '${a.envVar}'`:`option '${a.flags}'`},r=`error: ${i(e)} cannot be used with ${i(t)}`;this.error(r,{code:"commander.conflictingOption"})}unknownOption(e){if(this._allowUnknownOption)return;let t="";if(e.startsWith("--")&&this._showSuggestionAfterError){let i=[],r=this;do{let o=r.createHelp().visibleOptions(r).filter(a=>a.long).map(a=>a.long);i=i.concat(o),r=r.parent}while(r&&!r._enablePositionalOptions);t=un(e,i)}let s=`error: unknown option '${e}'${t}`;this.error(s,{code:"commander.unknownOption"})}_excessArguments(e){if(this._allowExcessArguments)return;let t=this.registeredArguments.length,s=t===1?"":"s",r=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${t} argument${s} but got ${e.length}.`;this.error(r,{code:"commander.excessArguments"})}unknownCommand(){let e=this.args[0],t="";if(this._showSuggestionAfterError){let i=[];this.createHelp().visibleCommands(this).forEach(r=>{i.push(r.name()),r.alias()&&i.push(r.alias())}),t=un(e,i)}let s=`error: unknown command '${e}'${t}`;this.error(s,{code:"commander.unknownCommand"})}version(e,t,s){if(e===void 0)return this._version;this._version=e,t=t||"-V, --version",s=s||"output the version number";let i=this.createOption(t,s);return this._versionOptionName=i.attributeName(),this._registerOption(i),this.on("option:"+i.name(),()=>{this._outputConfiguration.writeOut(`${e}
21
+ `),this._exit(0,"commander.version",e)}),this}description(e,t){return e===void 0&&t===void 0?this._description:(this._description=e,t&&(this._argsDescription=t),this)}summary(e){return e===void 0?this._summary:(this._summary=e,this)}alias(e){if(e===void 0)return this._aliases[0];let t=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler&&(t=this.commands[this.commands.length-1]),e===t._name)throw new Error("Command alias can't be the same as its name");let s=this.parent?._findCommand(e);if(s){let i=[s.name()].concat(s.aliases()).join("|");throw new Error(`cannot add alias '${e}' to command '${this.name()}' as already have command '${i}'`)}return t._aliases.push(e),this}aliases(e){return e===void 0?this._aliases:(e.forEach(t=>this.alias(t)),this)}usage(e){if(e===void 0){if(this._usage)return this._usage;let t=this.registeredArguments.map(s=>ya(s));return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?t:[]).join(" ")}return this._usage=e,this}name(e){return e===void 0?this._name:(this._name=e,this)}nameFromFilename(e){return this._name=Oe.basename(e,Oe.extname(e)),this}executableDir(e){return e===void 0?this._executableDir:(this._executableDir=e,this)}helpInformation(e){let t=this.createHelp();return t.helpWidth===void 0&&(t.helpWidth=e&&e.error?this._outputConfiguration.getErrHelpWidth():this._outputConfiguration.getOutHelpWidth()),t.formatHelp(this,t)}_getHelpContext(e){e=e||{};let t={error:!!e.error},s;return t.error?s=i=>this._outputConfiguration.writeErr(i):s=i=>this._outputConfiguration.writeOut(i),t.write=e.write||s,t.command=this,t}outputHelp(e){let t;typeof e=="function"&&(t=e,e=void 0);let s=this._getHelpContext(e);this._getCommandAndAncestors().reverse().forEach(r=>r.emit("beforeAllHelp",s)),this.emit("beforeHelp",s);let i=this.helpInformation(s);if(t&&(i=t(i),typeof i!="string"&&!Buffer.isBuffer(i)))throw new Error("outputHelp callback must return a string or a Buffer");s.write(i),this._getHelpOption()?.long&&this.emit(this._getHelpOption().long),this.emit("afterHelp",s),this._getCommandAndAncestors().forEach(r=>r.emit("afterAllHelp",s))}helpOption(e,t){return typeof e=="boolean"?(e?this._helpOption=this._helpOption??void 0:this._helpOption=null,this):(e=e??"-h, --help",t=t??"display help for command",this._helpOption=this.createOption(e,t),this)}_getHelpOption(){return this._helpOption===void 0&&this.helpOption(void 0,void 0),this._helpOption}addHelpOption(e){return this._helpOption=e,this}help(e){this.outputHelp(e);let t=O.exitCode||0;t===0&&e&&typeof e!="function"&&e.error&&(t=1),this._exit(t,"commander.help","(outputHelp)")}addHelpText(e,t){let s=["beforeAll","before","after","afterAll"];if(!s.includes(e))throw new Error(`Unexpected value for position to addHelpText.
21
22
  Expecting one of '${s.join("', '")}'`);let i=`${e}Help`;return this.on(i,r=>{let o;typeof t=="function"?o=t({error:r.error,command:r.command}):o=t,o&&r.write(`${o}
22
- `)}),this}_outputHelpIfRequested(e){let t=this._getHelpOption();t&&e.find(i=>t.is(i))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}};function sn(n){return n.map(e=>{if(!e.startsWith("--inspect"))return e;let t,s="127.0.0.1",i="9229",r;return(r=e.match(/^(--inspect(-brk)?)$/))!==null?t=r[1]:(r=e.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null?(t=r[1],/^\d+$/.test(r[3])?i=r[3]:s=r[3]):(r=e.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(t=r[1],s=r[3],i=r[4]),t&&i!=="0"?`${t}=${s}:${parseInt(i)+1}`:e})}nn.Command=zs});var cn=O(ie=>{var{Argument:on}=It(),{Command:Gs}=rn(),{CommanderError:ca,InvalidArgumentError:an}=ut(),{Help:ha}=Is(),{Option:ln}=Bs();ie.program=new Gs;ie.createCommand=n=>new Gs(n);ie.createOption=(n,e)=>new ln(n,e);ie.createArgument=(n,e)=>new on(n,e);ie.Command=Gs;ie.Option=ln;ie.Argument=on;ie.Help=ha;ie.CommanderError=ca;ie.InvalidArgumentError=an;ie.InvalidOptionArgumentError=an});var dn=O((ru,fn)=>{"use strict";fn.exports={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}});var Ys=O((ou,gn)=>{var ft=dn(),pn={};for(let n of Object.keys(ft))pn[ft[n]]=n;var v={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},lch:{channels:3,labels:"lch"},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}};gn.exports=v;for(let n of Object.keys(v)){if(!("channels"in v[n]))throw new Error("missing channels property: "+n);if(!("labels"in v[n]))throw new Error("missing channel labels property: "+n);if(v[n].labels.length!==v[n].channels)throw new Error("channel and label counts mismatch: "+n);let{channels:e,labels:t}=v[n];delete v[n].channels,delete v[n].labels,Object.defineProperty(v[n],"channels",{value:e}),Object.defineProperty(v[n],"labels",{value:t})}v.rgb.hsl=function(n){let e=n[0]/255,t=n[1]/255,s=n[2]/255,i=Math.min(e,t,s),r=Math.max(e,t,s),o=r-i,a,l;r===i?a=0:e===r?a=(t-s)/o:t===r?a=2+(s-e)/o:s===r&&(a=4+(e-t)/o),a=Math.min(a*60,360),a<0&&(a+=360);let c=(i+r)/2;return r===i?l=0:c<=.5?l=o/(r+i):l=o/(2-r-i),[a,l*100,c*100]};v.rgb.hsv=function(n){let e,t,s,i,r,o=n[0]/255,a=n[1]/255,l=n[2]/255,c=Math.max(o,a,l),u=c-Math.min(o,a,l),h=function(f){return(c-f)/6/u+1/2};return u===0?(i=0,r=0):(r=u/c,e=h(o),t=h(a),s=h(l),o===c?i=s-t:a===c?i=1/3+e-s:l===c&&(i=2/3+t-e),i<0?i+=1:i>1&&(i-=1)),[i*360,r*100,c*100]};v.rgb.hwb=function(n){let e=n[0],t=n[1],s=n[2],i=v.rgb.hsl(n)[0],r=1/255*Math.min(e,Math.min(t,s));return s=1-1/255*Math.max(e,Math.max(t,s)),[i,r*100,s*100]};v.rgb.cmyk=function(n){let e=n[0]/255,t=n[1]/255,s=n[2]/255,i=Math.min(1-e,1-t,1-s),r=(1-e-i)/(1-i)||0,o=(1-t-i)/(1-i)||0,a=(1-s-i)/(1-i)||0;return[r*100,o*100,a*100,i*100]};function ua(n,e){return(n[0]-e[0])**2+(n[1]-e[1])**2+(n[2]-e[2])**2}v.rgb.keyword=function(n){let e=pn[n];if(e)return e;let t=1/0,s;for(let i of Object.keys(ft)){let r=ft[i],o=ua(n,r);o<t&&(t=o,s=i)}return s};v.keyword.rgb=function(n){return ft[n]};v.rgb.xyz=function(n){let e=n[0]/255,t=n[1]/255,s=n[2]/255;e=e>.04045?((e+.055)/1.055)**2.4:e/12.92,t=t>.04045?((t+.055)/1.055)**2.4:t/12.92,s=s>.04045?((s+.055)/1.055)**2.4:s/12.92;let i=e*.4124+t*.3576+s*.1805,r=e*.2126+t*.7152+s*.0722,o=e*.0193+t*.1192+s*.9505;return[i*100,r*100,o*100]};v.rgb.lab=function(n){let e=v.rgb.xyz(n),t=e[0],s=e[1],i=e[2];t/=95.047,s/=100,i/=108.883,t=t>.008856?t**(1/3):7.787*t+16/116,s=s>.008856?s**(1/3):7.787*s+16/116,i=i>.008856?i**(1/3):7.787*i+16/116;let r=116*s-16,o=500*(t-s),a=200*(s-i);return[r,o,a]};v.hsl.rgb=function(n){let e=n[0]/360,t=n[1]/100,s=n[2]/100,i,r,o;if(t===0)return o=s*255,[o,o,o];s<.5?i=s*(1+t):i=s+t-s*t;let a=2*s-i,l=[0,0,0];for(let c=0;c<3;c++)r=e+1/3*-(c-1),r<0&&r++,r>1&&r--,6*r<1?o=a+(i-a)*6*r:2*r<1?o=i:3*r<2?o=a+(i-a)*(2/3-r)*6:o=a,l[c]=o*255;return l};v.hsl.hsv=function(n){let e=n[0],t=n[1]/100,s=n[2]/100,i=t,r=Math.max(s,.01);s*=2,t*=s<=1?s:2-s,i*=r<=1?r:2-r;let o=(s+t)/2,a=s===0?2*i/(r+i):2*t/(s+t);return[e,a*100,o*100]};v.hsv.rgb=function(n){let e=n[0]/60,t=n[1]/100,s=n[2]/100,i=Math.floor(e)%6,r=e-Math.floor(e),o=255*s*(1-t),a=255*s*(1-t*r),l=255*s*(1-t*(1-r));switch(s*=255,i){case 0:return[s,l,o];case 1:return[a,s,o];case 2:return[o,s,l];case 3:return[o,a,s];case 4:return[l,o,s];case 5:return[s,o,a]}};v.hsv.hsl=function(n){let e=n[0],t=n[1]/100,s=n[2]/100,i=Math.max(s,.01),r,o;o=(2-t)*s;let a=(2-t)*i;return r=t*i,r/=a<=1?a:2-a,r=r||0,o/=2,[e,r*100,o*100]};v.hwb.rgb=function(n){let e=n[0]/360,t=n[1]/100,s=n[2]/100,i=t+s,r;i>1&&(t/=i,s/=i);let o=Math.floor(6*e),a=1-s;r=6*e-o,o&1&&(r=1-r);let l=t+r*(a-t),c,u,h;switch(o){default:case 6:case 0:c=a,u=l,h=t;break;case 1:c=l,u=a,h=t;break;case 2:c=t,u=a,h=l;break;case 3:c=t,u=l,h=a;break;case 4:c=l,u=t,h=a;break;case 5:c=a,u=t,h=l;break}return[c*255,u*255,h*255]};v.cmyk.rgb=function(n){let e=n[0]/100,t=n[1]/100,s=n[2]/100,i=n[3]/100,r=1-Math.min(1,e*(1-i)+i),o=1-Math.min(1,t*(1-i)+i),a=1-Math.min(1,s*(1-i)+i);return[r*255,o*255,a*255]};v.xyz.rgb=function(n){let e=n[0]/100,t=n[1]/100,s=n[2]/100,i,r,o;return i=e*3.2406+t*-1.5372+s*-.4986,r=e*-.9689+t*1.8758+s*.0415,o=e*.0557+t*-.204+s*1.057,i=i>.0031308?1.055*i**(1/2.4)-.055:i*12.92,r=r>.0031308?1.055*r**(1/2.4)-.055:r*12.92,o=o>.0031308?1.055*o**(1/2.4)-.055:o*12.92,i=Math.min(Math.max(0,i),1),r=Math.min(Math.max(0,r),1),o=Math.min(Math.max(0,o),1),[i*255,r*255,o*255]};v.xyz.lab=function(n){let e=n[0],t=n[1],s=n[2];e/=95.047,t/=100,s/=108.883,e=e>.008856?e**(1/3):7.787*e+16/116,t=t>.008856?t**(1/3):7.787*t+16/116,s=s>.008856?s**(1/3):7.787*s+16/116;let i=116*t-16,r=500*(e-t),o=200*(t-s);return[i,r,o]};v.lab.xyz=function(n){let e=n[0],t=n[1],s=n[2],i,r,o;r=(e+16)/116,i=t/500+r,o=r-s/200;let a=r**3,l=i**3,c=o**3;return r=a>.008856?a:(r-16/116)/7.787,i=l>.008856?l:(i-16/116)/7.787,o=c>.008856?c:(o-16/116)/7.787,i*=95.047,r*=100,o*=108.883,[i,r,o]};v.lab.lch=function(n){let e=n[0],t=n[1],s=n[2],i;i=Math.atan2(s,t)*360/2/Math.PI,i<0&&(i+=360);let o=Math.sqrt(t*t+s*s);return[e,o,i]};v.lch.lab=function(n){let e=n[0],t=n[1],i=n[2]/360*2*Math.PI,r=t*Math.cos(i),o=t*Math.sin(i);return[e,r,o]};v.rgb.ansi16=function(n,e=null){let[t,s,i]=n,r=e===null?v.rgb.hsv(n)[2]:e;if(r=Math.round(r/50),r===0)return 30;let o=30+(Math.round(i/255)<<2|Math.round(s/255)<<1|Math.round(t/255));return r===2&&(o+=60),o};v.hsv.ansi16=function(n){return v.rgb.ansi16(v.hsv.rgb(n),n[2])};v.rgb.ansi256=function(n){let e=n[0],t=n[1],s=n[2];return e===t&&t===s?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(s/255*5)};v.ansi16.rgb=function(n){let e=n%10;if(e===0||e===7)return n>50&&(e+=3.5),e=e/10.5*255,[e,e,e];let t=(~~(n>50)+1)*.5,s=(e&1)*t*255,i=(e>>1&1)*t*255,r=(e>>2&1)*t*255;return[s,i,r]};v.ansi256.rgb=function(n){if(n>=232){let r=(n-232)*10+8;return[r,r,r]}n-=16;let e,t=Math.floor(n/36)/5*255,s=Math.floor((e=n%36)/6)/5*255,i=e%6/5*255;return[t,s,i]};v.rgb.hex=function(n){let t=(((Math.round(n[0])&255)<<16)+((Math.round(n[1])&255)<<8)+(Math.round(n[2])&255)).toString(16).toUpperCase();return"000000".substring(t.length)+t};v.hex.rgb=function(n){let e=n.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!e)return[0,0,0];let t=e[0];e[0].length===3&&(t=t.split("").map(a=>a+a).join(""));let s=parseInt(t,16),i=s>>16&255,r=s>>8&255,o=s&255;return[i,r,o]};v.rgb.hcg=function(n){let e=n[0]/255,t=n[1]/255,s=n[2]/255,i=Math.max(Math.max(e,t),s),r=Math.min(Math.min(e,t),s),o=i-r,a,l;return o<1?a=r/(1-o):a=0,o<=0?l=0:i===e?l=(t-s)/o%6:i===t?l=2+(s-e)/o:l=4+(e-t)/o,l/=6,l%=1,[l*360,o*100,a*100]};v.hsl.hcg=function(n){let e=n[1]/100,t=n[2]/100,s=t<.5?2*e*t:2*e*(1-t),i=0;return s<1&&(i=(t-.5*s)/(1-s)),[n[0],s*100,i*100]};v.hsv.hcg=function(n){let e=n[1]/100,t=n[2]/100,s=e*t,i=0;return s<1&&(i=(t-s)/(1-s)),[n[0],s*100,i*100]};v.hcg.rgb=function(n){let e=n[0]/360,t=n[1]/100,s=n[2]/100;if(t===0)return[s*255,s*255,s*255];let i=[0,0,0],r=e%1*6,o=r%1,a=1-o,l=0;switch(Math.floor(r)){case 0:i[0]=1,i[1]=o,i[2]=0;break;case 1:i[0]=a,i[1]=1,i[2]=0;break;case 2:i[0]=0,i[1]=1,i[2]=o;break;case 3:i[0]=0,i[1]=a,i[2]=1;break;case 4:i[0]=o,i[1]=0,i[2]=1;break;default:i[0]=1,i[1]=0,i[2]=a}return l=(1-t)*s,[(t*i[0]+l)*255,(t*i[1]+l)*255,(t*i[2]+l)*255]};v.hcg.hsv=function(n){let e=n[1]/100,t=n[2]/100,s=e+t*(1-e),i=0;return s>0&&(i=e/s),[n[0],i*100,s*100]};v.hcg.hsl=function(n){let e=n[1]/100,s=n[2]/100*(1-e)+.5*e,i=0;return s>0&&s<.5?i=e/(2*s):s>=.5&&s<1&&(i=e/(2*(1-s))),[n[0],i*100,s*100]};v.hcg.hwb=function(n){let e=n[1]/100,t=n[2]/100,s=e+t*(1-e);return[n[0],(s-e)*100,(1-s)*100]};v.hwb.hcg=function(n){let e=n[1]/100,s=1-n[2]/100,i=s-e,r=0;return i<1&&(r=(s-i)/(1-i)),[n[0],i*100,r*100]};v.apple.rgb=function(n){return[n[0]/65535*255,n[1]/65535*255,n[2]/65535*255]};v.rgb.apple=function(n){return[n[0]/255*65535,n[1]/255*65535,n[2]/255*65535]};v.gray.rgb=function(n){return[n[0]/100*255,n[0]/100*255,n[0]/100*255]};v.gray.hsl=function(n){return[0,0,n[0]]};v.gray.hsv=v.gray.hsl;v.gray.hwb=function(n){return[0,100,n[0]]};v.gray.cmyk=function(n){return[0,0,0,n[0]]};v.gray.lab=function(n){return[n[0],0,0]};v.gray.hex=function(n){let e=Math.round(n[0]/100*255)&255,s=((e<<16)+(e<<8)+e).toString(16).toUpperCase();return"000000".substring(s.length)+s};v.rgb.gray=function(n){return[(n[0]+n[1]+n[2])/3/255*100]}});var yn=O((au,mn)=>{var Lt=Ys();function fa(){let n={},e=Object.keys(Lt);for(let t=e.length,s=0;s<t;s++)n[e[s]]={distance:-1,parent:null};return n}function da(n){let e=fa(),t=[n];for(e[n].distance=0;t.length;){let s=t.pop(),i=Object.keys(Lt[s]);for(let r=i.length,o=0;o<r;o++){let a=i[o],l=e[a];l.distance===-1&&(l.distance=e[s].distance+1,l.parent=s,t.unshift(a))}}return e}function pa(n,e){return function(t){return e(n(t))}}function ga(n,e){let t=[e[n].parent,n],s=Lt[e[n].parent][n],i=e[n].parent;for(;e[i].parent;)t.unshift(e[i].parent),s=pa(Lt[e[i].parent][i],s),i=e[i].parent;return s.conversion=t,s}mn.exports=function(n){let e=da(n),t={},s=Object.keys(e);for(let i=s.length,r=0;r<i;r++){let o=s[r];e[o].parent!==null&&(t[o]=ga(o,e))}return t}});var wn=O((lu,bn)=>{var Js=Ys(),ma=yn(),qe={},ya=Object.keys(Js);function ba(n){let e=function(...t){let s=t[0];return s==null?s:(s.length>1&&(t=s),n(t))};return"conversion"in n&&(e.conversion=n.conversion),e}function wa(n){let e=function(...t){let s=t[0];if(s==null)return s;s.length>1&&(t=s);let i=n(t);if(typeof i=="object")for(let r=i.length,o=0;o<r;o++)i[o]=Math.round(i[o]);return i};return"conversion"in n&&(e.conversion=n.conversion),e}ya.forEach(n=>{qe[n]={},Object.defineProperty(qe[n],"channels",{value:Js[n].channels}),Object.defineProperty(qe[n],"labels",{value:Js[n].labels});let e=ma(n);Object.keys(e).forEach(s=>{let i=e[s];qe[n][s]=wa(i),qe[n][s].raw=ba(i)})});bn.exports=qe});var kn=O((cu,Cn)=>{"use strict";var vn=(n,e)=>(...t)=>`\x1B[${n(...t)+e}m`,xn=(n,e)=>(...t)=>{let s=n(...t);return`\x1B[${38+e};5;${s}m`},Sn=(n,e)=>(...t)=>{let s=n(...t);return`\x1B[${38+e};2;${s[0]};${s[1]};${s[2]}m`},Wt=n=>n,_n=(n,e,t)=>[n,e,t],Ue=(n,e,t)=>{Object.defineProperty(n,e,{get:()=>{let s=t();return Object.defineProperty(n,e,{value:s,enumerable:!0,configurable:!0}),s},enumerable:!0,configurable:!0})},Ks,ze=(n,e,t,s)=>{Ks===void 0&&(Ks=wn());let i=s?10:0,r={};for(let[o,a]of Object.entries(Ks)){let l=o==="ansi16"?"ansi":o;o===e?r[l]=n(t,i):typeof a=="object"&&(r[l]=n(a[e],i))}return r};function va(){let n=new Map,e={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};e.color.gray=e.color.blackBright,e.bgColor.bgGray=e.bgColor.bgBlackBright,e.color.grey=e.color.blackBright,e.bgColor.bgGrey=e.bgColor.bgBlackBright;for(let[t,s]of Object.entries(e)){for(let[i,r]of Object.entries(s))e[i]={open:`\x1B[${r[0]}m`,close:`\x1B[${r[1]}m`},s[i]=e[i],n.set(r[0],r[1]);Object.defineProperty(e,t,{value:s,enumerable:!1})}return Object.defineProperty(e,"codes",{value:n,enumerable:!1}),e.color.close="\x1B[39m",e.bgColor.close="\x1B[49m",Ue(e.color,"ansi",()=>ze(vn,"ansi16",Wt,!1)),Ue(e.color,"ansi256",()=>ze(xn,"ansi256",Wt,!1)),Ue(e.color,"ansi16m",()=>ze(Sn,"rgb",_n,!1)),Ue(e.bgColor,"ansi",()=>ze(vn,"ansi16",Wt,!0)),Ue(e.bgColor,"ansi256",()=>ze(xn,"ansi256",Wt,!0)),Ue(e.bgColor,"ansi16m",()=>ze(Sn,"rgb",_n,!0)),e}Object.defineProperty(Cn,"exports",{enumerable:!0,get:va})});var On=O((hu,En)=>{"use strict";En.exports=(n,e=process.argv)=>{let t=n.startsWith("-")?"":n.length===1?"-":"--",s=e.indexOf(t+n),i=e.indexOf("--");return s!==-1&&(i===-1||s<i)}});var $n=O((uu,Fn)=>{"use strict";var xa=require("os"),An=require("tty"),ne=On(),{env:M}=process,Oe;ne("no-color")||ne("no-colors")||ne("color=false")||ne("color=never")?Oe=0:(ne("color")||ne("colors")||ne("color=true")||ne("color=always"))&&(Oe=1);"FORCE_COLOR"in M&&(M.FORCE_COLOR==="true"?Oe=1:M.FORCE_COLOR==="false"?Oe=0:Oe=M.FORCE_COLOR.length===0?1:Math.min(parseInt(M.FORCE_COLOR,10),3));function Xs(n){return n===0?!1:{level:n,hasBasic:!0,has256:n>=2,has16m:n>=3}}function Qs(n,e){if(Oe===0)return 0;if(ne("color=16m")||ne("color=full")||ne("color=truecolor"))return 3;if(ne("color=256"))return 2;if(n&&!e&&Oe===void 0)return 0;let t=Oe||0;if(M.TERM==="dumb")return t;if(process.platform==="win32"){let s=xa.release().split(".");return Number(s[0])>=10&&Number(s[2])>=10586?Number(s[2])>=14931?3:2:1}if("CI"in M)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some(s=>s in M)||M.CI_NAME==="codeship"?1:t;if("TEAMCITY_VERSION"in M)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(M.TEAMCITY_VERSION)?1:0;if(M.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in M){let s=parseInt((M.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(M.TERM_PROGRAM){case"iTerm.app":return s>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(M.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(M.TERM)||"COLORTERM"in M?1:t}function Sa(n){let e=Qs(n,n&&n.isTTY);return Xs(e)}Fn.exports={supportsColor:Sa,stdout:Xs(Qs(!0,An.isatty(1))),stderr:Xs(Qs(!0,An.isatty(2)))}});var Rn=O((fu,Pn)=>{"use strict";var _a=(n,e,t)=>{let s=n.indexOf(e);if(s===-1)return n;let i=e.length,r=0,o="";do o+=n.substr(r,s-r)+e+t,r=s+i,s=n.indexOf(e,r);while(s!==-1);return o+=n.substr(r),o},Ca=(n,e,t,s)=>{let i=0,r="";do{let o=n[s-1]==="\r";r+=n.substr(i,(o?s-1:s)-i)+e+(o?`\r
23
+ `)}),this}_outputHelpIfRequested(e){let t=this._getHelpOption();t&&e.find(i=>t.is(i))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}};function fn(n){return n.map(e=>{if(!e.startsWith("--inspect"))return e;let t,s="127.0.0.1",i="9229",r;return(r=e.match(/^(--inspect(-brk)?)$/))!==null?t=r[1]:(r=e.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null?(t=r[1],/^\d+$/.test(r[3])?i=r[3]:s=r[3]):(r=e.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(t=r[1],s=r[3],i=r[4]),t&&i!=="0"?`${t}=${s}:${parseInt(i)+1}`:e})}dn.Command=Zs});var wn=A(le=>{var{Argument:gn}=Gt(),{Command:ei}=pn(),{CommanderError:va,InvalidArgumentError:mn}=vt(),{Help:xa}=Us(),{Option:yn}=Js();le.program=new ei;le.createCommand=n=>new ei(n);le.createOption=(n,e)=>new yn(n,e);le.createArgument=(n,e)=>new gn(n,e);le.Command=ei;le.Option=yn;le.Argument=gn;le.Help=xa;le.CommanderError=va;le.InvalidArgumentError=mn;le.InvalidOptionArgumentError=mn});var Sn=A((wu,xn)=>{"use strict";xn.exports={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}});var ti=A((bu,Cn)=>{var xt=Sn(),_n={};for(let n of Object.keys(xt))_n[xt[n]]=n;var v={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},lch:{channels:3,labels:"lch"},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}};Cn.exports=v;for(let n of Object.keys(v)){if(!("channels"in v[n]))throw new Error("missing channels property: "+n);if(!("labels"in v[n]))throw new Error("missing channel labels property: "+n);if(v[n].labels.length!==v[n].channels)throw new Error("channel and label counts mismatch: "+n);let{channels:e,labels:t}=v[n];delete v[n].channels,delete v[n].labels,Object.defineProperty(v[n],"channels",{value:e}),Object.defineProperty(v[n],"labels",{value:t})}v.rgb.hsl=function(n){let e=n[0]/255,t=n[1]/255,s=n[2]/255,i=Math.min(e,t,s),r=Math.max(e,t,s),o=r-i,a,l;r===i?a=0:e===r?a=(t-s)/o:t===r?a=2+(s-e)/o:s===r&&(a=4+(e-t)/o),a=Math.min(a*60,360),a<0&&(a+=360);let c=(i+r)/2;return r===i?l=0:c<=.5?l=o/(r+i):l=o/(2-r-i),[a,l*100,c*100]};v.rgb.hsv=function(n){let e,t,s,i,r,o=n[0]/255,a=n[1]/255,l=n[2]/255,c=Math.max(o,a,l),h=c-Math.min(o,a,l),u=function(f){return(c-f)/6/h+1/2};return h===0?(i=0,r=0):(r=h/c,e=u(o),t=u(a),s=u(l),o===c?i=s-t:a===c?i=1/3+e-s:l===c&&(i=2/3+t-e),i<0?i+=1:i>1&&(i-=1)),[i*360,r*100,c*100]};v.rgb.hwb=function(n){let e=n[0],t=n[1],s=n[2],i=v.rgb.hsl(n)[0],r=1/255*Math.min(e,Math.min(t,s));return s=1-1/255*Math.max(e,Math.max(t,s)),[i,r*100,s*100]};v.rgb.cmyk=function(n){let e=n[0]/255,t=n[1]/255,s=n[2]/255,i=Math.min(1-e,1-t,1-s),r=(1-e-i)/(1-i)||0,o=(1-t-i)/(1-i)||0,a=(1-s-i)/(1-i)||0;return[r*100,o*100,a*100,i*100]};function Sa(n,e){return(n[0]-e[0])**2+(n[1]-e[1])**2+(n[2]-e[2])**2}v.rgb.keyword=function(n){let e=_n[n];if(e)return e;let t=1/0,s;for(let i of Object.keys(xt)){let r=xt[i],o=Sa(n,r);o<t&&(t=o,s=i)}return s};v.keyword.rgb=function(n){return xt[n]};v.rgb.xyz=function(n){let e=n[0]/255,t=n[1]/255,s=n[2]/255;e=e>.04045?((e+.055)/1.055)**2.4:e/12.92,t=t>.04045?((t+.055)/1.055)**2.4:t/12.92,s=s>.04045?((s+.055)/1.055)**2.4:s/12.92;let i=e*.4124+t*.3576+s*.1805,r=e*.2126+t*.7152+s*.0722,o=e*.0193+t*.1192+s*.9505;return[i*100,r*100,o*100]};v.rgb.lab=function(n){let e=v.rgb.xyz(n),t=e[0],s=e[1],i=e[2];t/=95.047,s/=100,i/=108.883,t=t>.008856?t**(1/3):7.787*t+16/116,s=s>.008856?s**(1/3):7.787*s+16/116,i=i>.008856?i**(1/3):7.787*i+16/116;let r=116*s-16,o=500*(t-s),a=200*(s-i);return[r,o,a]};v.hsl.rgb=function(n){let e=n[0]/360,t=n[1]/100,s=n[2]/100,i,r,o;if(t===0)return o=s*255,[o,o,o];s<.5?i=s*(1+t):i=s+t-s*t;let a=2*s-i,l=[0,0,0];for(let c=0;c<3;c++)r=e+1/3*-(c-1),r<0&&r++,r>1&&r--,6*r<1?o=a+(i-a)*6*r:2*r<1?o=i:3*r<2?o=a+(i-a)*(2/3-r)*6:o=a,l[c]=o*255;return l};v.hsl.hsv=function(n){let e=n[0],t=n[1]/100,s=n[2]/100,i=t,r=Math.max(s,.01);s*=2,t*=s<=1?s:2-s,i*=r<=1?r:2-r;let o=(s+t)/2,a=s===0?2*i/(r+i):2*t/(s+t);return[e,a*100,o*100]};v.hsv.rgb=function(n){let e=n[0]/60,t=n[1]/100,s=n[2]/100,i=Math.floor(e)%6,r=e-Math.floor(e),o=255*s*(1-t),a=255*s*(1-t*r),l=255*s*(1-t*(1-r));switch(s*=255,i){case 0:return[s,l,o];case 1:return[a,s,o];case 2:return[o,s,l];case 3:return[o,a,s];case 4:return[l,o,s];case 5:return[s,o,a]}};v.hsv.hsl=function(n){let e=n[0],t=n[1]/100,s=n[2]/100,i=Math.max(s,.01),r,o;o=(2-t)*s;let a=(2-t)*i;return r=t*i,r/=a<=1?a:2-a,r=r||0,o/=2,[e,r*100,o*100]};v.hwb.rgb=function(n){let e=n[0]/360,t=n[1]/100,s=n[2]/100,i=t+s,r;i>1&&(t/=i,s/=i);let o=Math.floor(6*e),a=1-s;r=6*e-o,o&1&&(r=1-r);let l=t+r*(a-t),c,h,u;switch(o){default:case 6:case 0:c=a,h=l,u=t;break;case 1:c=l,h=a,u=t;break;case 2:c=t,h=a,u=l;break;case 3:c=t,h=l,u=a;break;case 4:c=l,h=t,u=a;break;case 5:c=a,h=t,u=l;break}return[c*255,h*255,u*255]};v.cmyk.rgb=function(n){let e=n[0]/100,t=n[1]/100,s=n[2]/100,i=n[3]/100,r=1-Math.min(1,e*(1-i)+i),o=1-Math.min(1,t*(1-i)+i),a=1-Math.min(1,s*(1-i)+i);return[r*255,o*255,a*255]};v.xyz.rgb=function(n){let e=n[0]/100,t=n[1]/100,s=n[2]/100,i,r,o;return i=e*3.2406+t*-1.5372+s*-.4986,r=e*-.9689+t*1.8758+s*.0415,o=e*.0557+t*-.204+s*1.057,i=i>.0031308?1.055*i**(1/2.4)-.055:i*12.92,r=r>.0031308?1.055*r**(1/2.4)-.055:r*12.92,o=o>.0031308?1.055*o**(1/2.4)-.055:o*12.92,i=Math.min(Math.max(0,i),1),r=Math.min(Math.max(0,r),1),o=Math.min(Math.max(0,o),1),[i*255,r*255,o*255]};v.xyz.lab=function(n){let e=n[0],t=n[1],s=n[2];e/=95.047,t/=100,s/=108.883,e=e>.008856?e**(1/3):7.787*e+16/116,t=t>.008856?t**(1/3):7.787*t+16/116,s=s>.008856?s**(1/3):7.787*s+16/116;let i=116*t-16,r=500*(e-t),o=200*(t-s);return[i,r,o]};v.lab.xyz=function(n){let e=n[0],t=n[1],s=n[2],i,r,o;r=(e+16)/116,i=t/500+r,o=r-s/200;let a=r**3,l=i**3,c=o**3;return r=a>.008856?a:(r-16/116)/7.787,i=l>.008856?l:(i-16/116)/7.787,o=c>.008856?c:(o-16/116)/7.787,i*=95.047,r*=100,o*=108.883,[i,r,o]};v.lab.lch=function(n){let e=n[0],t=n[1],s=n[2],i;i=Math.atan2(s,t)*360/2/Math.PI,i<0&&(i+=360);let o=Math.sqrt(t*t+s*s);return[e,o,i]};v.lch.lab=function(n){let e=n[0],t=n[1],i=n[2]/360*2*Math.PI,r=t*Math.cos(i),o=t*Math.sin(i);return[e,r,o]};v.rgb.ansi16=function(n,e=null){let[t,s,i]=n,r=e===null?v.rgb.hsv(n)[2]:e;if(r=Math.round(r/50),r===0)return 30;let o=30+(Math.round(i/255)<<2|Math.round(s/255)<<1|Math.round(t/255));return r===2&&(o+=60),o};v.hsv.ansi16=function(n){return v.rgb.ansi16(v.hsv.rgb(n),n[2])};v.rgb.ansi256=function(n){let e=n[0],t=n[1],s=n[2];return e===t&&t===s?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(s/255*5)};v.ansi16.rgb=function(n){let e=n%10;if(e===0||e===7)return n>50&&(e+=3.5),e=e/10.5*255,[e,e,e];let t=(~~(n>50)+1)*.5,s=(e&1)*t*255,i=(e>>1&1)*t*255,r=(e>>2&1)*t*255;return[s,i,r]};v.ansi256.rgb=function(n){if(n>=232){let r=(n-232)*10+8;return[r,r,r]}n-=16;let e,t=Math.floor(n/36)/5*255,s=Math.floor((e=n%36)/6)/5*255,i=e%6/5*255;return[t,s,i]};v.rgb.hex=function(n){let t=(((Math.round(n[0])&255)<<16)+((Math.round(n[1])&255)<<8)+(Math.round(n[2])&255)).toString(16).toUpperCase();return"000000".substring(t.length)+t};v.hex.rgb=function(n){let e=n.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!e)return[0,0,0];let t=e[0];e[0].length===3&&(t=t.split("").map(a=>a+a).join(""));let s=parseInt(t,16),i=s>>16&255,r=s>>8&255,o=s&255;return[i,r,o]};v.rgb.hcg=function(n){let e=n[0]/255,t=n[1]/255,s=n[2]/255,i=Math.max(Math.max(e,t),s),r=Math.min(Math.min(e,t),s),o=i-r,a,l;return o<1?a=r/(1-o):a=0,o<=0?l=0:i===e?l=(t-s)/o%6:i===t?l=2+(s-e)/o:l=4+(e-t)/o,l/=6,l%=1,[l*360,o*100,a*100]};v.hsl.hcg=function(n){let e=n[1]/100,t=n[2]/100,s=t<.5?2*e*t:2*e*(1-t),i=0;return s<1&&(i=(t-.5*s)/(1-s)),[n[0],s*100,i*100]};v.hsv.hcg=function(n){let e=n[1]/100,t=n[2]/100,s=e*t,i=0;return s<1&&(i=(t-s)/(1-s)),[n[0],s*100,i*100]};v.hcg.rgb=function(n){let e=n[0]/360,t=n[1]/100,s=n[2]/100;if(t===0)return[s*255,s*255,s*255];let i=[0,0,0],r=e%1*6,o=r%1,a=1-o,l=0;switch(Math.floor(r)){case 0:i[0]=1,i[1]=o,i[2]=0;break;case 1:i[0]=a,i[1]=1,i[2]=0;break;case 2:i[0]=0,i[1]=1,i[2]=o;break;case 3:i[0]=0,i[1]=a,i[2]=1;break;case 4:i[0]=o,i[1]=0,i[2]=1;break;default:i[0]=1,i[1]=0,i[2]=a}return l=(1-t)*s,[(t*i[0]+l)*255,(t*i[1]+l)*255,(t*i[2]+l)*255]};v.hcg.hsv=function(n){let e=n[1]/100,t=n[2]/100,s=e+t*(1-e),i=0;return s>0&&(i=e/s),[n[0],i*100,s*100]};v.hcg.hsl=function(n){let e=n[1]/100,s=n[2]/100*(1-e)+.5*e,i=0;return s>0&&s<.5?i=e/(2*s):s>=.5&&s<1&&(i=e/(2*(1-s))),[n[0],i*100,s*100]};v.hcg.hwb=function(n){let e=n[1]/100,t=n[2]/100,s=e+t*(1-e);return[n[0],(s-e)*100,(1-s)*100]};v.hwb.hcg=function(n){let e=n[1]/100,s=1-n[2]/100,i=s-e,r=0;return i<1&&(r=(s-i)/(1-i)),[n[0],i*100,r*100]};v.apple.rgb=function(n){return[n[0]/65535*255,n[1]/65535*255,n[2]/65535*255]};v.rgb.apple=function(n){return[n[0]/255*65535,n[1]/255*65535,n[2]/255*65535]};v.gray.rgb=function(n){return[n[0]/100*255,n[0]/100*255,n[0]/100*255]};v.gray.hsl=function(n){return[0,0,n[0]]};v.gray.hsv=v.gray.hsl;v.gray.hwb=function(n){return[0,100,n[0]]};v.gray.cmyk=function(n){return[0,0,0,n[0]]};v.gray.lab=function(n){return[n[0],0,0]};v.gray.hex=function(n){let e=Math.round(n[0]/100*255)&255,s=((e<<16)+(e<<8)+e).toString(16).toUpperCase();return"000000".substring(s.length)+s};v.rgb.gray=function(n){return[(n[0]+n[1]+n[2])/3/255*100]}});var En=A((vu,kn)=>{var Yt=ti();function _a(){let n={},e=Object.keys(Yt);for(let t=e.length,s=0;s<t;s++)n[e[s]]={distance:-1,parent:null};return n}function Ca(n){let e=_a(),t=[n];for(e[n].distance=0;t.length;){let s=t.pop(),i=Object.keys(Yt[s]);for(let r=i.length,o=0;o<r;o++){let a=i[o],l=e[a];l.distance===-1&&(l.distance=e[s].distance+1,l.parent=s,t.unshift(a))}}return e}function ka(n,e){return function(t){return e(n(t))}}function Ea(n,e){let t=[e[n].parent,n],s=Yt[e[n].parent][n],i=e[n].parent;for(;e[i].parent;)t.unshift(e[i].parent),s=ka(Yt[e[i].parent][i],s),i=e[i].parent;return s.conversion=t,s}kn.exports=function(n){let e=Ca(n),t={},s=Object.keys(e);for(let i=s.length,r=0;r<i;r++){let o=s[r];e[o].parent!==null&&(t[o]=Ea(o,e))}return t}});var An=A((xu,On)=>{var si=ti(),Oa=En(),Xe={},Aa=Object.keys(si);function Fa(n){let e=function(...t){let s=t[0];return s==null?s:(s.length>1&&(t=s),n(t))};return"conversion"in n&&(e.conversion=n.conversion),e}function $a(n){let e=function(...t){let s=t[0];if(s==null)return s;s.length>1&&(t=s);let i=n(t);if(typeof i=="object")for(let r=i.length,o=0;o<r;o++)i[o]=Math.round(i[o]);return i};return"conversion"in n&&(e.conversion=n.conversion),e}Aa.forEach(n=>{Xe[n]={},Object.defineProperty(Xe[n],"channels",{value:si[n].channels}),Object.defineProperty(Xe[n],"labels",{value:si[n].labels});let e=Oa(n);Object.keys(e).forEach(s=>{let i=e[s];Xe[n][s]=$a(i),Xe[n][s].raw=Fa(i)})});On.exports=Xe});var Mn=A((Su,Tn)=>{"use strict";var Fn=(n,e)=>(...t)=>`\x1B[${n(...t)+e}m`,$n=(n,e)=>(...t)=>{let s=n(...t);return`\x1B[${38+e};5;${s}m`},Rn=(n,e)=>(...t)=>{let s=n(...t);return`\x1B[${38+e};2;${s[0]};${s[1]};${s[2]}m`},Jt=n=>n,Pn=(n,e,t)=>[n,e,t],Qe=(n,e,t)=>{Object.defineProperty(n,e,{get:()=>{let s=t();return Object.defineProperty(n,e,{value:s,enumerable:!0,configurable:!0}),s},enumerable:!0,configurable:!0})},ii,Ze=(n,e,t,s)=>{ii===void 0&&(ii=An());let i=s?10:0,r={};for(let[o,a]of Object.entries(ii)){let l=o==="ansi16"?"ansi":o;o===e?r[l]=n(t,i):typeof a=="object"&&(r[l]=n(a[e],i))}return r};function Ra(){let n=new Map,e={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};e.color.gray=e.color.blackBright,e.bgColor.bgGray=e.bgColor.bgBlackBright,e.color.grey=e.color.blackBright,e.bgColor.bgGrey=e.bgColor.bgBlackBright;for(let[t,s]of Object.entries(e)){for(let[i,r]of Object.entries(s))e[i]={open:`\x1B[${r[0]}m`,close:`\x1B[${r[1]}m`},s[i]=e[i],n.set(r[0],r[1]);Object.defineProperty(e,t,{value:s,enumerable:!1})}return Object.defineProperty(e,"codes",{value:n,enumerable:!1}),e.color.close="\x1B[39m",e.bgColor.close="\x1B[49m",Qe(e.color,"ansi",()=>Ze(Fn,"ansi16",Jt,!1)),Qe(e.color,"ansi256",()=>Ze($n,"ansi256",Jt,!1)),Qe(e.color,"ansi16m",()=>Ze(Rn,"rgb",Pn,!1)),Qe(e.bgColor,"ansi",()=>Ze(Fn,"ansi16",Jt,!0)),Qe(e.bgColor,"ansi256",()=>Ze($n,"ansi256",Jt,!0)),Qe(e.bgColor,"ansi16m",()=>Ze(Rn,"rgb",Pn,!0)),e}Object.defineProperty(Tn,"exports",{enumerable:!0,get:Ra})});var Dn=A((_u,jn)=>{"use strict";jn.exports=(n,e=process.argv)=>{let t=n.startsWith("-")?"":n.length===1?"-":"--",s=e.indexOf(t+n),i=e.indexOf("--");return s!==-1&&(i===-1||s<i)}});var Nn=A((Cu,Ln)=>{"use strict";var Pa=require("os"),In=require("tty"),ce=Dn(),{env:D}=process,je;ce("no-color")||ce("no-colors")||ce("color=false")||ce("color=never")?je=0:(ce("color")||ce("colors")||ce("color=true")||ce("color=always"))&&(je=1);"FORCE_COLOR"in D&&(D.FORCE_COLOR==="true"?je=1:D.FORCE_COLOR==="false"?je=0:je=D.FORCE_COLOR.length===0?1:Math.min(parseInt(D.FORCE_COLOR,10),3));function ni(n){return n===0?!1:{level:n,hasBasic:!0,has256:n>=2,has16m:n>=3}}function ri(n,e){if(je===0)return 0;if(ce("color=16m")||ce("color=full")||ce("color=truecolor"))return 3;if(ce("color=256"))return 2;if(n&&!e&&je===void 0)return 0;let t=je||0;if(D.TERM==="dumb")return t;if(process.platform==="win32"){let s=Pa.release().split(".");return Number(s[0])>=10&&Number(s[2])>=10586?Number(s[2])>=14931?3:2:1}if("CI"in D)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some(s=>s in D)||D.CI_NAME==="codeship"?1:t;if("TEAMCITY_VERSION"in D)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(D.TEAMCITY_VERSION)?1:0;if(D.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in D){let s=parseInt((D.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(D.TERM_PROGRAM){case"iTerm.app":return s>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(D.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(D.TERM)||"COLORTERM"in D?1:t}function Ta(n){let e=ri(n,n&&n.isTTY);return ni(e)}Ln.exports={supportsColor:Ta,stdout:ni(ri(!0,In.isatty(1))),stderr:ni(ri(!0,In.isatty(2)))}});var Hn=A((ku,Wn)=>{"use strict";var Ma=(n,e,t)=>{let s=n.indexOf(e);if(s===-1)return n;let i=e.length,r=0,o="";do o+=n.substr(r,s-r)+e+t,r=s+i,s=n.indexOf(e,r);while(s!==-1);return o+=n.substr(r),o},ja=(n,e,t,s)=>{let i=0,r="";do{let o=n[s-1]==="\r";r+=n.substr(i,(o?s-1:s)-i)+e+(o?`\r
23
24
  `:`
24
25
  `)+t,i=s+1,s=n.indexOf(`
25
- `,i)}while(s!==-1);return r+=n.substr(i),r};Pn.exports={stringReplaceAll:_a,stringEncaseCRLFWithFirstIndex:Ca}});var Nn=O((du,Dn)=>{"use strict";var ka=/(?:\\(u(?:[a-f\d]{4}|\{[a-f\d]{1,6}\})|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi,Tn=/(?:^|\.)(\w+)(?:\(([^)]*)\))?/g,Ea=/^(['"])((?:\\.|(?!\1)[^\\])*)\1$/,Oa=/\\(u(?:[a-f\d]{4}|{[a-f\d]{1,6}})|x[a-f\d]{2}|.)|([^\\])/gi,Aa=new Map([["n",`
26
- `],["r","\r"],["t"," "],["b","\b"],["f","\f"],["v","\v"],["0","\0"],["\\","\\"],["e","\x1B"],["a","\x07"]]);function jn(n){let e=n[0]==="u",t=n[1]==="{";return e&&!t&&n.length===5||n[0]==="x"&&n.length===3?String.fromCharCode(parseInt(n.slice(1),16)):e&&t?String.fromCodePoint(parseInt(n.slice(2,-1),16)):Aa.get(n)||n}function Fa(n,e){let t=[],s=e.trim().split(/\s*,\s*/g),i;for(let r of s){let o=Number(r);if(!Number.isNaN(o))t.push(o);else if(i=r.match(Ea))t.push(i[2].replace(Oa,(a,l,c)=>l?jn(l):c));else throw new Error(`Invalid Chalk template style argument: ${r} (in style '${n}')`)}return t}function $a(n){Tn.lastIndex=0;let e=[],t;for(;(t=Tn.exec(n))!==null;){let s=t[1];if(t[2]){let i=Fa(s,t[2]);e.push([s].concat(i))}else e.push([s])}return e}function Mn(n,e){let t={};for(let i of e)for(let r of i.styles)t[r[0]]=i.inverse?null:r.slice(1);let s=n;for(let[i,r]of Object.entries(t))if(Array.isArray(r)){if(!(i in s))throw new Error(`Unknown Chalk style: ${i}`);s=r.length>0?s[i](...r):s[i]}return s}Dn.exports=(n,e)=>{let t=[],s=[],i=[];if(e.replace(ka,(r,o,a,l,c,u)=>{if(o)i.push(jn(o));else if(l){let h=i.join("");i=[],s.push(t.length===0?h:Mn(n,t)(h)),t.push({inverse:a,styles:$a(l)})}else if(c){if(t.length===0)throw new Error("Found extraneous } in Chalk template literal");s.push(Mn(n,t)(i.join(""))),i=[],t.pop()}else i.push(u)}),s.push(i.join("")),t.length>0){let r=`Chalk template literal is missing ${t.length} closing bracket${t.length===1?"":"s"} (\`}\`)`;throw new Error(r)}return s.join("")}});var re=O((pu,Vn)=>{"use strict";var dt=kn(),{stdout:ei,stderr:ti}=$n(),{stringReplaceAll:Pa,stringEncaseCRLFWithFirstIndex:Ra}=Rn(),{isArray:Ht}=Array,Ln=["ansi","ansi","ansi256","ansi16m"],Ge=Object.create(null),Ta=(n,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");let t=ei?ei.level:0;n.level=e.level===void 0?t:e.level},si=class{constructor(e){return Wn(e)}},Wn=n=>{let e={};return Ta(e,n),e.template=(...t)=>Bn(e.template,...t),Object.setPrototypeOf(e,Bt.prototype),Object.setPrototypeOf(e.template,e),e.template.constructor=()=>{throw new Error("`chalk.constructor()` is deprecated. Use `new chalk.Instance()` instead.")},e.template.Instance=si,e.template};function Bt(n){return Wn(n)}for(let[n,e]of Object.entries(dt))Ge[n]={get(){let t=Vt(this,ii(e.open,e.close,this._styler),this._isEmpty);return Object.defineProperty(this,n,{value:t}),t}};Ge.visible={get(){let n=Vt(this,this._styler,!0);return Object.defineProperty(this,"visible",{value:n}),n}};var Hn=["rgb","hex","keyword","hsl","hsv","hwb","ansi","ansi256"];for(let n of Hn)Ge[n]={get(){let{level:e}=this;return function(...t){let s=ii(dt.color[Ln[e]][n](...t),dt.color.close,this._styler);return Vt(this,s,this._isEmpty)}}};for(let n of Hn){let e="bg"+n[0].toUpperCase()+n.slice(1);Ge[e]={get(){let{level:t}=this;return function(...s){let i=ii(dt.bgColor[Ln[t]][n](...s),dt.bgColor.close,this._styler);return Vt(this,i,this._isEmpty)}}}}var Ma=Object.defineProperties(()=>{},{...Ge,level:{enumerable:!0,get(){return this._generator.level},set(n){this._generator.level=n}}}),ii=(n,e,t)=>{let s,i;return t===void 0?(s=n,i=e):(s=t.openAll+n,i=e+t.closeAll),{open:n,close:e,openAll:s,closeAll:i,parent:t}},Vt=(n,e,t)=>{let s=(...i)=>Ht(i[0])&&Ht(i[0].raw)?In(s,Bn(s,...i)):In(s,i.length===1?""+i[0]:i.join(" "));return Object.setPrototypeOf(s,Ma),s._generator=n,s._styler=e,s._isEmpty=t,s},In=(n,e)=>{if(n.level<=0||!e)return n._isEmpty?"":e;let t=n._styler;if(t===void 0)return e;let{openAll:s,closeAll:i}=t;if(e.indexOf("\x1B")!==-1)for(;t!==void 0;)e=Pa(e,t.close,t.open),t=t.parent;let r=e.indexOf(`
27
- `);return r!==-1&&(e=Ra(e,i,s,r)),s+e+i},Zs,Bn=(n,...e)=>{let[t]=e;if(!Ht(t)||!Ht(t.raw))return e.join(" ");let s=e.slice(1),i=[t.raw[0]];for(let r=1;r<t.length;r++)i.push(String(s[r-1]).replace(/[{}\\]/g,"\\$&"),String(t.raw[r]));return Zs===void 0&&(Zs=Nn()),Zs(n,i.join(""))};Object.defineProperties(Bt.prototype,Ge);var qt=Bt();qt.supportsColor=ei;qt.stderr=Bt({level:ti?ti.level:0});qt.stderr.supportsColor=ti;Vn.exports=qt});function Y(){let n=[Ye,Ae,je,Un];for(let e of n)A.existsSync(e)||A.mkdirSync(e,{recursive:!0,mode:448})}function zt(){return A.existsSync(Ut)}function Gt(){try{if(!A.existsSync(Ut))return null;let n=A.readFileSync(Ut,"utf-8");return JSON.parse(n)}catch{return null}}function ri(n){Y(),A.writeFileSync(Ut,JSON.stringify(n,null,2),{mode:384})}function Yt(){try{if(!A.existsSync(ni))return{};let n=A.readFileSync(ni,"utf-8");return JSON.parse(n)}catch{return{}}}function zn(n){Y(),A.writeFileSync(ni,JSON.stringify(n,null,2),{mode:384})}function R(){let n=Gt();return!n||n.expires_at&&new Date(n.expires_at)<new Date?null:n.token}function Gn(){try{return A.existsSync(Ae)?A.readdirSync(Ae).filter(n=>n.endsWith(".md")).map(n=>n.replace(".md","")):[]}catch{return[]}}function Ne(n){let e=ye.join(Ae,`${n}.md`);try{return A.existsSync(e)?A.readFileSync(e,"utf-8"):null}catch{return null}}function _e(n,e){Y();let t=ye.join(Ae,`${n}.md`);A.writeFileSync(t,e,{mode:384})}function Je(n){Y();let e=Date.now().toString(36)+Math.random().toString(36).slice(2,8),t=ye.join(Un,`${e}.json`);A.writeFileSync(t,JSON.stringify(n,null,2))}var A,ye,qn,Ye,Ut,ni,Ae,je,Un,De,oe=Ki(()=>{"use strict";A=C(require("fs")),ye=C(require("path")),qn=C(require("os")),Ye=ye.join(qn.homedir(),".hyv"),Ut=ye.join(Ye,"auth.json"),ni=ye.join(Ye,"config.json"),Ae=ye.join(Ye,"profiles"),je=ye.join(Ye,"cache"),Un=ye.join(Ye,"queue"),De=process.env.HYV_API_URL||"https://holdyourvoice.com"});var ai=O((mu,Jn)=>{"use strict";var Yn=require("fs"),oi;function ja(){try{return Yn.statSync("/.dockerenv"),!0}catch{return!1}}function Da(){try{return Yn.readFileSync("/proc/self/cgroup","utf8").includes("docker")}catch{return!1}}Jn.exports=()=>(oi===void 0&&(oi=ja()||Da()),oi)});var Qn=O((yu,li)=>{"use strict";var Na=require("os"),Ia=require("fs"),Kn=ai(),Xn=()=>{if(process.platform!=="linux")return!1;if(Na.release().toLowerCase().includes("microsoft"))return!Kn();try{return Ia.readFileSync("/proc/version","utf8").toLowerCase().includes("microsoft")?!Kn():!1}catch{return!1}};process.env.__IS_WSL_TEST__?li.exports=Xn:li.exports=Xn()});var er=O((bu,Zn)=>{"use strict";Zn.exports=(n,e,t)=>{let s=i=>Object.defineProperty(n,e,{value:i,enumerable:!0,writable:!0});return Object.defineProperty(n,e,{configurable:!0,enumerable:!0,get(){let i=t();return s(i),i},set(i){s(i)}}),n}});var pt=O((wu,or)=>{var La=require("path"),Wa=require("child_process"),{promises:Kt,constants:rr}=require("fs"),Jt=Qn(),Ha=ai(),hi=er(),tr=La.join(__dirname,"xdg-open"),{platform:Ke,arch:sr}=process,Ba=()=>{try{return Kt.statSync("/run/.containerenv"),!0}catch{return!1}},ci;function Va(){return ci===void 0&&(ci=Ba()||Ha()),ci}var qa=(()=>{let n="/mnt/",e;return async function(){if(e)return e;let t="/etc/wsl.conf",s=!1;try{await Kt.access(t,rr.F_OK),s=!0}catch{}if(!s)return n;let i=await Kt.readFile(t,{encoding:"utf8"}),r=/(?<!#.*)root\s*=\s*(?<mountPoint>.*)/g.exec(i);return r?(e=r.groups.mountPoint.trim(),e=e.endsWith("/")?e:`${e}/`,e):n}})(),ir=async(n,e)=>{let t;for(let s of n)try{return await e(s)}catch(i){t=i}throw t},Xt=async n=>{if(n={wait:!1,background:!1,newInstance:!1,allowNonzeroExitCode:!1,...n},Array.isArray(n.app))return ir(n.app,a=>Xt({...n,app:a}));let{name:e,arguments:t=[]}=n.app||{};if(t=[...t],Array.isArray(e))return ir(e,a=>Xt({...n,app:{name:a,arguments:t}}));let s,i=[],r={};if(Ke==="darwin")s="open",n.wait&&i.push("--wait-apps"),n.background&&i.push("--background"),n.newInstance&&i.push("--new"),e&&i.push("-a",e);else if(Ke==="win32"||Jt&&!Va()&&!e){let a=await qa();s=Jt?`${a}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe`:`${process.env.SYSTEMROOT}\\System32\\WindowsPowerShell\\v1.0\\powershell`,i.push("-NoProfile","-NonInteractive","\u2013ExecutionPolicy","Bypass","-EncodedCommand"),Jt||(r.windowsVerbatimArguments=!0);let l=["Start"];n.wait&&l.push("-Wait"),e?(l.push(`"\`"${e}\`""`,"-ArgumentList"),n.target&&t.unshift(n.target)):n.target&&l.push(`"${n.target}"`),t.length>0&&(t=t.map(c=>`"\`"${c}\`""`),l.push(t.join(","))),n.target=Buffer.from(l.join(" "),"utf16le").toString("base64")}else{if(e)s=e;else{let a=!__dirname||__dirname==="/",l=!1;try{await Kt.access(tr,rr.X_OK),l=!0}catch{}s=process.versions.electron||Ke==="android"||a||!l?"xdg-open":tr}t.length>0&&i.push(...t),n.wait||(r.stdio="ignore",r.detached=!0)}n.target&&i.push(n.target),Ke==="darwin"&&t.length>0&&i.push("--args",...t);let o=Wa.spawn(s,i,r);return n.wait?new Promise((a,l)=>{o.once("error",l),o.once("close",c=>{if(!n.allowNonzeroExitCode&&c>0){l(new Error(`Exited with code ${c}`));return}a(o)})}):(o.unref(),o)},ui=(n,e)=>{if(typeof n!="string")throw new TypeError("Expected a `target`");return Xt({...e,target:n})},Ua=(n,e)=>{if(typeof n!="string")throw new TypeError("Expected a `name`");let{arguments:t=[]}=e||{};if(t!=null&&!Array.isArray(t))throw new TypeError("Expected `appArguments` as Array type");return Xt({...e,app:{name:n,arguments:t}})};function nr(n){if(typeof n=="string"||Array.isArray(n))return n;let{[sr]:e}=n;if(!e)throw new Error(`${sr} is not supported`);return e}function fi({[Ke]:n},{wsl:e}){if(e&&Jt)return nr(e);if(!n)throw new Error(`${Ke} is not supported`);return nr(n)}var Qt={};hi(Qt,"chrome",()=>fi({darwin:"google chrome",win32:"chrome",linux:["google-chrome","google-chrome-stable","chromium"]},{wsl:{ia32:"/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe",x64:["/mnt/c/Program Files/Google/Chrome/Application/chrome.exe","/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe"]}}));hi(Qt,"firefox",()=>fi({darwin:"firefox",win32:"C:\\Program Files\\Mozilla Firefox\\firefox.exe",linux:"firefox"},{wsl:"/mnt/c/Program Files/Mozilla Firefox/firefox.exe"}));hi(Qt,"edge",()=>fi({darwin:"microsoft edge",win32:"msedge",linux:["microsoft-edge","microsoft-edge-dev"]},{wsl:"/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe"}));ui.apps=Qt;ui.openApp=Ua;or.exports=ui});var Dr={};Yo(Dr,{apiGet:()=>rs,apiPost:()=>Hl,requireSubscription:()=>Bl});async function jr(n,e,t){let s=R();if(!s)throw new Error("you're not signed in yet. run: hyv init");let i=`${De}${e}`,r={method:n,headers:{Authorization:`Bearer ${s}`,"Content-Type":"application/json"}};t&&(r.body=JSON.stringify(t));let o;try{o=await fetch(i,r)}catch{throw new Error("can't reach the server. check your internet connection and try again.")}if(o.status===401)throw new Error("your session expired. run: hyv init to sign in again.");if(o.status===403)throw new Error("you don't have access to this feature. check your plan at holdyourvoice.com/dashboard");if(!o.ok){let a=await o.text().catch(()=>"");throw new Error(`something went wrong (${o.status}). ${a.slice(0,150)}`)}return o.json()}function rs(n){return jr("GET",n)}function Hl(n,e){return jr("POST",n,e)}async function Bl(){let n;try{n=await rs("/cli/heartbeat")}catch(e){let t=e.message||"";throw t.includes("not signed in")||t.includes("session expired")||t.includes("don't have access")?e:new Error("can't reach the server. check your internet connection and try again.")}if(!n.plan||n.plan.toLowerCase()==="none"||n.status==="none")throw new Error("you don't have an active subscription yet. run: hyv plan --upgrade to start for $1.")}var vi=Ki(()=>{"use strict";oe()});var hn=C(cn(),1),{program:Yh,createCommand:Jh,createArgument:Kh,createOption:Xh,CommanderError:Qh,InvalidArgumentError:Zh,InvalidOptionArgumentError:eu,Command:un,Argument:tu,Option:su,Help:iu}=hn.default;var Ee=C(re());var j=C(re()),q=C(require("fs")),T=C(require("path")),fr=C(require("os"));oe();var di=C(require("http")),za=C(require("https")),ar=C(re()),lr=C(pt());oe();function gt(n,e={}){return new Promise((t,s)=>{let i=new URL(n),r=i.protocol==="https:",o=r?za:di,a={hostname:i.hostname,port:i.port||(r?443:80),path:i.pathname+i.search,method:e.method||"GET",headers:{"Content-Type":"application/json","User-Agent":"hyvoice-cli/0.1.0",...e.headers},timeout:e.timeout||3e4},l=o.request(a,c=>{let u="";c.on("data",h=>u+=h),c.on("end",()=>{try{t({status:c.statusCode||0,data:JSON.parse(u)})}catch{t({status:c.statusCode||0,data:u})}})});l.on("error",s),l.on("timeout",()=>{l.destroy(),s(new Error("Request timeout"))}),e.body&&l.write(JSON.stringify(e.body)),l.end()})}async function B(n,e={}){let t=R();if(!t)throw new Error("Not authenticated. Run `hyvoice init` first.");return gt(n,{...e,headers:{Authorization:`Bearer ${t}`}})}async function cr(n){let e=await gt(`${De}/cli/auth/license`,{method:"POST",body:{license_key:n,device_name:`CLI (${process.platform})`}});if(e.status!==200){let s=e.data;throw new Error(s?.error||"Authentication failed")}let t=e.data;return ri(t),t}async function hr(){let n=di.createServer(),e=await new Promise(o=>{n.listen(0,"127.0.0.1",()=>{o(n.address().port)})}),t=`http://127.0.0.1:${e}/callback`,s=await gt(`${De}/cli/auth/browser`,{method:"POST",body:{redirect_uri:t}});if(s.status!==200)throw n.close(),new Error("Failed to start authentication flow");let{auth_url:i}=s.data;console.log(ar.default.cyan(`
28
- Opening browser for authentication...`)),await(0,lr.default)(i);let r=await new Promise((o,a)=>{let l=setTimeout(()=>{n.close(),a(new Error("Authentication timeout. Please try again."))},12e4);n.on("request",async(c,u)=>{let h=new URL(c.url||"/",`http://127.0.0.1:${e}`);if(h.pathname==="/callback"){let f=h.searchParams.get("code"),d=h.searchParams.get("state");if(!f||!d){u.writeHead(400,{"Content-Type":"text/html"}),u.end("<h1>Authentication failed</h1><p>Missing code or state.</p>"),clearTimeout(l),n.close(),a(new Error("Invalid callback parameters"));return}try{let g=await gt(`${De}/cli/auth/callback`,{method:"POST",body:{code:f,state:d}});if(g.status!==200)throw new Error("Failed to complete authentication");let p=g.data;u.writeHead(200,{"Content-Type":"text/html"}),u.end(`
26
+ `,i)}while(s!==-1);return r+=n.substr(i),r};Wn.exports={stringReplaceAll:Ma,stringEncaseCRLFWithFirstIndex:ja}});var zn=A((Eu,Un)=>{"use strict";var Da=/(?:\\(u(?:[a-f\d]{4}|\{[a-f\d]{1,6}\})|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi,Vn=/(?:^|\.)(\w+)(?:\(([^)]*)\))?/g,Ia=/^(['"])((?:\\.|(?!\1)[^\\])*)\1$/,La=/\\(u(?:[a-f\d]{4}|{[a-f\d]{1,6}})|x[a-f\d]{2}|.)|([^\\])/gi,Na=new Map([["n",`
27
+ `],["r","\r"],["t"," "],["b","\b"],["f","\f"],["v","\v"],["0","\0"],["\\","\\"],["e","\x1B"],["a","\x07"]]);function Bn(n){let e=n[0]==="u",t=n[1]==="{";return e&&!t&&n.length===5||n[0]==="x"&&n.length===3?String.fromCharCode(parseInt(n.slice(1),16)):e&&t?String.fromCodePoint(parseInt(n.slice(2,-1),16)):Na.get(n)||n}function Wa(n,e){let t=[],s=e.trim().split(/\s*,\s*/g),i;for(let r of s){let o=Number(r);if(!Number.isNaN(o))t.push(o);else if(i=r.match(Ia))t.push(i[2].replace(La,(a,l,c)=>l?Bn(l):c));else throw new Error(`Invalid Chalk template style argument: ${r} (in style '${n}')`)}return t}function Ha(n){Vn.lastIndex=0;let e=[],t;for(;(t=Vn.exec(n))!==null;){let s=t[1];if(t[2]){let i=Wa(s,t[2]);e.push([s].concat(i))}else e.push([s])}return e}function qn(n,e){let t={};for(let i of e)for(let r of i.styles)t[r[0]]=i.inverse?null:r.slice(1);let s=n;for(let[i,r]of Object.entries(t))if(Array.isArray(r)){if(!(i in s))throw new Error(`Unknown Chalk style: ${i}`);s=r.length>0?s[i](...r):s[i]}return s}Un.exports=(n,e)=>{let t=[],s=[],i=[];if(e.replace(Da,(r,o,a,l,c,h)=>{if(o)i.push(Bn(o));else if(l){let u=i.join("");i=[],s.push(t.length===0?u:qn(n,t)(u)),t.push({inverse:a,styles:Ha(l)})}else if(c){if(t.length===0)throw new Error("Found extraneous } in Chalk template literal");s.push(qn(n,t)(i.join(""))),i=[],t.pop()}else i.push(h)}),s.push(i.join("")),t.length>0){let r=`Chalk template literal is missing ${t.length} closing bracket${t.length===1?"":"s"} (\`}\`)`;throw new Error(r)}return s.join("")}});var ie=A((Ou,Qn)=>{"use strict";var St=Mn(),{stdout:ai,stderr:li}=Nn(),{stringReplaceAll:Va,stringEncaseCRLFWithFirstIndex:qa}=Hn(),{isArray:Kt}=Array,Yn=["ansi","ansi","ansi256","ansi16m"],et=Object.create(null),Ba=(n,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");let t=ai?ai.level:0;n.level=e.level===void 0?t:e.level},ci=class{constructor(e){return Jn(e)}},Jn=n=>{let e={};return Ba(e,n),e.template=(...t)=>Xn(e.template,...t),Object.setPrototypeOf(e,Xt.prototype),Object.setPrototypeOf(e.template,e),e.template.constructor=()=>{throw new Error("`chalk.constructor()` is deprecated. Use `new chalk.Instance()` instead.")},e.template.Instance=ci,e.template};function Xt(n){return Jn(n)}for(let[n,e]of Object.entries(St))et[n]={get(){let t=Qt(this,hi(e.open,e.close,this._styler),this._isEmpty);return Object.defineProperty(this,n,{value:t}),t}};et.visible={get(){let n=Qt(this,this._styler,!0);return Object.defineProperty(this,"visible",{value:n}),n}};var Kn=["rgb","hex","keyword","hsl","hsv","hwb","ansi","ansi256"];for(let n of Kn)et[n]={get(){let{level:e}=this;return function(...t){let s=hi(St.color[Yn[e]][n](...t),St.color.close,this._styler);return Qt(this,s,this._isEmpty)}}};for(let n of Kn){let e="bg"+n[0].toUpperCase()+n.slice(1);et[e]={get(){let{level:t}=this;return function(...s){let i=hi(St.bgColor[Yn[t]][n](...s),St.bgColor.close,this._styler);return Qt(this,i,this._isEmpty)}}}}var Ua=Object.defineProperties(()=>{},{...et,level:{enumerable:!0,get(){return this._generator.level},set(n){this._generator.level=n}}}),hi=(n,e,t)=>{let s,i;return t===void 0?(s=n,i=e):(s=t.openAll+n,i=e+t.closeAll),{open:n,close:e,openAll:s,closeAll:i,parent:t}},Qt=(n,e,t)=>{let s=(...i)=>Kt(i[0])&&Kt(i[0].raw)?Gn(s,Xn(s,...i)):Gn(s,i.length===1?""+i[0]:i.join(" "));return Object.setPrototypeOf(s,Ua),s._generator=n,s._styler=e,s._isEmpty=t,s},Gn=(n,e)=>{if(n.level<=0||!e)return n._isEmpty?"":e;let t=n._styler;if(t===void 0)return e;let{openAll:s,closeAll:i}=t;if(e.indexOf("\x1B")!==-1)for(;t!==void 0;)e=Va(e,t.close,t.open),t=t.parent;let r=e.indexOf(`
28
+ `);return r!==-1&&(e=qa(e,i,s,r)),s+e+i},oi,Xn=(n,...e)=>{let[t]=e;if(!Kt(t)||!Kt(t.raw))return e.join(" ");let s=e.slice(1),i=[t.raw[0]];for(let r=1;r<t.length;r++)i.push(String(s[r-1]).replace(/[{}\\]/g,"\\$&"),String(t.raw[r]));return oi===void 0&&(oi=zn()),oi(n,i.join(""))};Object.defineProperties(Xt.prototype,et);var Zt=Xt();Zt.supportsColor=ai;Zt.stderr=Xt({level:li?li.level:0});Zt.stderr.supportsColor=li;Qn.exports=Zt});function U(){let n=[he,ne,Ve,er];for(let e of n)F.existsSync(e)||F.mkdirSync(e,{recursive:!0,mode:448})}function tt(){return F.existsSync(es)}function st(){try{if(!F.existsSync(es))return null;let n=F.readFileSync(es,"utf-8");return JSON.parse(n)}catch{return null}}function fi(n){U(),F.writeFileSync(es,JSON.stringify(n,null,2),{mode:384})}function ts(){try{if(!F.existsSync(ui))return{};let n=F.readFileSync(ui,"utf-8");return JSON.parse(n)}catch{return{}}}function tr(n){U(),F.writeFileSync(ui,JSON.stringify(n,null,2),{mode:384})}function M(){let n=st();return!n||n.expires_at&&new Date(n.expires_at)<new Date?null:n.token}function sr(){try{return F.existsSync(ne)?F.readdirSync(ne).filter(n=>n.endsWith(".md")).map(n=>n.replace(".md","")):[]}catch{return[]}}function Ae(n){let e=xe.join(ne,`${n}.md`);try{return F.existsSync(e)?F.readFileSync(e,"utf-8"):null}catch{return null}}function Fe(n,e){U();let t=xe.join(ne,`${n}.md`);F.writeFileSync(t,e,{mode:384})}function it(n){U();let e=Date.now().toString(36)+Math.random().toString(36).slice(2,8),t=xe.join(er,`${e}.json`);F.writeFileSync(t,JSON.stringify(n,null,2))}var F,xe,Zn,he,es,ui,ne,Ve,er,qe,re=bt(()=>{"use strict";F=C(require("fs")),xe=C(require("path")),Zn=C(require("os")),he=xe.join(Zn.homedir(),".hyv"),es=xe.join(he,"auth.json"),ui=xe.join(he,"config.json"),ne=xe.join(he,"profiles"),Ve=xe.join(he,"cache"),er=xe.join(he,"queue"),qe=process.env.HYV_API_URL||"https://holdyourvoice.com"});var pi=A((Fu,nr)=>{"use strict";var ir=require("fs"),di;function za(){try{return ir.statSync("/.dockerenv"),!0}catch{return!1}}function Ga(){try{return ir.readFileSync("/proc/self/cgroup","utf8").includes("docker")}catch{return!1}}nr.exports=()=>(di===void 0&&(di=za()||Ga()),di)});var ar=A(($u,gi)=>{"use strict";var Ya=require("os"),Ja=require("fs"),rr=pi(),or=()=>{if(process.platform!=="linux")return!1;if(Ya.release().toLowerCase().includes("microsoft"))return!rr();try{return Ja.readFileSync("/proc/version","utf8").toLowerCase().includes("microsoft")?!rr():!1}catch{return!1}};process.env.__IS_WSL_TEST__?gi.exports=or:gi.exports=or()});var cr=A((Ru,lr)=>{"use strict";lr.exports=(n,e,t)=>{let s=i=>Object.defineProperty(n,e,{value:i,enumerable:!0,writable:!0});return Object.defineProperty(n,e,{configurable:!0,enumerable:!0,get(){let i=t();return s(i),i},set(i){s(i)}}),n}});var _t=A((Pu,gr)=>{var Ka=require("path"),Xa=require("child_process"),{promises:is,constants:pr}=require("fs"),ss=ar(),Qa=pi(),yi=cr(),hr=Ka.join(__dirname,"xdg-open"),{platform:nt,arch:ur}=process,Za=()=>{try{return is.statSync("/run/.containerenv"),!0}catch{return!1}},mi;function el(){return mi===void 0&&(mi=Za()||Qa()),mi}var tl=(()=>{let n="/mnt/",e;return async function(){if(e)return e;let t="/etc/wsl.conf",s=!1;try{await is.access(t,pr.F_OK),s=!0}catch{}if(!s)return n;let i=await is.readFile(t,{encoding:"utf8"}),r=/(?<!#.*)root\s*=\s*(?<mountPoint>.*)/g.exec(i);return r?(e=r.groups.mountPoint.trim(),e=e.endsWith("/")?e:`${e}/`,e):n}})(),fr=async(n,e)=>{let t;for(let s of n)try{return await e(s)}catch(i){t=i}throw t},ns=async n=>{if(n={wait:!1,background:!1,newInstance:!1,allowNonzeroExitCode:!1,...n},Array.isArray(n.app))return fr(n.app,a=>ns({...n,app:a}));let{name:e,arguments:t=[]}=n.app||{};if(t=[...t],Array.isArray(e))return fr(e,a=>ns({...n,app:{name:a,arguments:t}}));let s,i=[],r={};if(nt==="darwin")s="open",n.wait&&i.push("--wait-apps"),n.background&&i.push("--background"),n.newInstance&&i.push("--new"),e&&i.push("-a",e);else if(nt==="win32"||ss&&!el()&&!e){let a=await tl();s=ss?`${a}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe`:`${process.env.SYSTEMROOT}\\System32\\WindowsPowerShell\\v1.0\\powershell`,i.push("-NoProfile","-NonInteractive","\u2013ExecutionPolicy","Bypass","-EncodedCommand"),ss||(r.windowsVerbatimArguments=!0);let l=["Start"];n.wait&&l.push("-Wait"),e?(l.push(`"\`"${e}\`""`,"-ArgumentList"),n.target&&t.unshift(n.target)):n.target&&l.push(`"${n.target}"`),t.length>0&&(t=t.map(c=>`"\`"${c}\`""`),l.push(t.join(","))),n.target=Buffer.from(l.join(" "),"utf16le").toString("base64")}else{if(e)s=e;else{let a=!__dirname||__dirname==="/",l=!1;try{await is.access(hr,pr.X_OK),l=!0}catch{}s=process.versions.electron||nt==="android"||a||!l?"xdg-open":hr}t.length>0&&i.push(...t),n.wait||(r.stdio="ignore",r.detached=!0)}n.target&&i.push(n.target),nt==="darwin"&&t.length>0&&i.push("--args",...t);let o=Xa.spawn(s,i,r);return n.wait?new Promise((a,l)=>{o.once("error",l),o.once("close",c=>{if(!n.allowNonzeroExitCode&&c>0){l(new Error(`Exited with code ${c}`));return}a(o)})}):(o.unref(),o)},wi=(n,e)=>{if(typeof n!="string")throw new TypeError("Expected a `target`");return ns({...e,target:n})},sl=(n,e)=>{if(typeof n!="string")throw new TypeError("Expected a `name`");let{arguments:t=[]}=e||{};if(t!=null&&!Array.isArray(t))throw new TypeError("Expected `appArguments` as Array type");return ns({...e,app:{name:n,arguments:t}})};function dr(n){if(typeof n=="string"||Array.isArray(n))return n;let{[ur]:e}=n;if(!e)throw new Error(`${ur} is not supported`);return e}function bi({[nt]:n},{wsl:e}){if(e&&ss)return dr(e);if(!n)throw new Error(`${nt} is not supported`);return dr(n)}var rs={};yi(rs,"chrome",()=>bi({darwin:"google chrome",win32:"chrome",linux:["google-chrome","google-chrome-stable","chromium"]},{wsl:{ia32:"/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe",x64:["/mnt/c/Program Files/Google/Chrome/Application/chrome.exe","/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe"]}}));yi(rs,"firefox",()=>bi({darwin:"firefox",win32:"C:\\Program Files\\Mozilla Firefox\\firefox.exe",linux:"firefox"},{wsl:"/mnt/c/Program Files/Mozilla Firefox/firefox.exe"}));yi(rs,"edge",()=>bi({darwin:"microsoft edge",win32:"msedge",linux:["microsoft-edge","microsoft-edge-dev"]},{wsl:"/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe"}));wi.apps=rs;wi.openApp=sl;gr.exports=wi});function Ct(n,e={}){return new Promise((t,s)=>{let i=new URL(n),r=i.protocol==="https:",o=r?il:vi,a={hostname:i.hostname,port:i.port||(r?443:80),path:i.pathname+i.search,method:e.method||"GET",headers:{"Content-Type":"application/json","User-Agent":"hyvoice-cli/0.1.0",...e.headers},timeout:e.timeout||3e4},l=o.request(a,c=>{let h="";c.on("data",u=>h+=u),c.on("end",()=>{try{t({status:c.statusCode||0,data:JSON.parse(h)})}catch{t({status:c.statusCode||0,data:h})}})});l.on("error",s),l.on("timeout",()=>{l.destroy(),s(new Error("Request timeout"))}),e.body&&l.write(JSON.stringify(e.body)),l.end()})}async function q(n,e={}){let t=M();if(!t)throw new Error("Not authenticated. Run `hyvoice init` first.");return Ct(n,{...e,headers:{Authorization:`Bearer ${t}`}})}async function wr(n){let e=await Ct(`${qe}/cli/auth/license`,{method:"POST",body:{license_key:n,device_name:`CLI (${process.platform})`}});if(e.status!==200){let s=e.data;throw new Error(s?.error||"Authentication failed")}let t=e.data;return fi(t),t}async function br(){let n=vi.createServer(),e=await new Promise(o=>{n.listen(0,"127.0.0.1",()=>{o(n.address().port)})}),t=`http://127.0.0.1:${e}/callback`,s=await Ct(`${qe}/cli/auth/browser`,{method:"POST",body:{redirect_uri:t}});if(s.status!==200)throw n.close(),new Error("Failed to start authentication flow");let{auth_url:i}=s.data;console.log(mr.default.cyan(`
29
+ Opening browser for authentication...`)),await(0,yr.default)(i);let r=await new Promise((o,a)=>{let l=setTimeout(()=>{n.close(),a(new Error("Authentication timeout. Please try again."))},12e4);n.on("request",async(c,h)=>{let u=new URL(c.url||"/",`http://127.0.0.1:${e}`);if(u.pathname==="/callback"){let f=u.searchParams.get("code"),d=u.searchParams.get("state");if(!f||!d){h.writeHead(400,{"Content-Type":"text/html"}),h.end("<h1>Authentication failed</h1><p>Missing code or state.</p>"),clearTimeout(l),n.close(),a(new Error("Invalid callback parameters"));return}try{let g=await Ct(`${qe}/cli/auth/callback`,{method:"POST",body:{code:f,state:d}});if(g.status!==200)throw new Error("Failed to complete authentication");let p=g.data;h.writeHead(200,{"Content-Type":"text/html"}),h.end(`
29
30
  <html>
30
31
  <body style="font-family: -apple-system, sans-serif; text-align: center; padding: 40px;">
31
32
  <h1 style="color: #22c55e;">\u2713 Authenticated</h1>
32
33
  <p>You can close this window and return to the terminal.</p>
33
34
  </body>
34
35
  </html>
35
- `),clearTimeout(l),n.close(),o(p)}catch(g){u.writeHead(500,{"Content-Type":"text/html"}),u.end(`<h1>Authentication failed</h1><p>${g.message}</p>`),clearTimeout(l),n.close(),a(g)}}else u.writeHead(404),u.end()})});return ri(r),r}async function Zt(){let n=R();if(!n)return{valid:!1};try{let e=await gt(`${De}/cli/heartbeat`,{method:"GET",headers:{Authorization:`Bearer ${n}`}});return e.status!==200?{valid:!1}:e.data}catch{return{valid:!1}}}var Xe=fr.homedir(),Ga=process.platform==="win32",Ya=T.join(Xe,".hyv"),ur=T.join(Ya,"voice.md"),mt=`# Hold Your Voice
36
+ `),clearTimeout(l),n.close(),o(p)}catch(g){h.writeHead(500,{"Content-Type":"text/html"}),h.end(`<h1>Authentication failed</h1><p>${g.message}</p>`),clearTimeout(l),n.close(),a(g)}}else h.writeHead(404),h.end()})});return fi(r),r}async function rt(){let n=M();if(!n)return{valid:!1};try{let e=await Ct(`${qe}/cli/heartbeat`,{method:"GET",headers:{Authorization:`Bearer ${n}`}});return e.status!==200?{valid:!1}:e.data}catch{return{valid:!1}}}var vi,il,mr,yr,$e=bt(()=>{"use strict";vi=C(require("http")),il=C(require("https")),mr=C(ie()),yr=C(_t());re()});function pe(n){return(n||"").match(/[a-zA-Z][a-zA-Z0-9']*/g)||[]}function kt(n){return(n||"").split(/(?<=[.!?])\s+|\n{2,}/).map(e=>e.trim()).filter(e=>pe(e).length>0)}function vr(n){return(n||"").split(/\n\s*\n/).map(e=>e.trim()).filter(e=>pe(e).length>=6)}function cl(n){let e=(n||"").trim().toLowerCase();if(!e)return[];let t=[];return(e.match(/[a-z']+/g)||[]).filter(r=>rl.has(r)).length>=3&&!/\b(?:for example|for instance|such as)\b|\d/i.test(e)&&t.push({line:0,rule:"abstract_noun_cluster",phrase:n.trim().slice(0,160)}),ol.test(e)&&t.push({line:0,rule:"generic_opening_generalization",phrase:n.trim().slice(0,160)}),al.test(e)&&t.push({line:0,rule:"voice_question_opener",phrase:"opens with a question instead of a concrete observation"}),ll.test(e)&&t.push({line:0,rule:"voice_lesson_opener",phrase:"opens with a lesson or inspirational claim"}),t}function De(n){let e=[],t=n||"";for(let r of nl){let o=t.match(r.pattern);if(o)for(let a of o){let l=a.trim();if(!l)continue;let c=t.indexOf(a),h=c>=0?t.slice(0,c).split(`
37
+ `).length:1;e.push({line:h,rule:r.id,phrase:l.slice(0,160)})}}let s=t.split(`
38
+ `);for(let r=0;r<s.length;r++){let o=cl(s[r]);for(let a of o)a.line=r+1,a.text=s[r].trim().slice(0,240),e.push(a)}let i=[];for(let r=0;r<s.length;r++){let o=s[r].split(/(?<=[.!?])\s+/);for(let a of o){let l=pe(a).length;l>0&&i.push({line:r+1,text:a.trim(),wordCount:l})}}for(let r=0;r<i.length-2;r++){let o=i.slice(r,r+3);if(o.every(a=>a.wordCount<=5)){e.push({line:o[0].line,rule:"voice_staccato_triplet",phrase:"three short sentences in a row reads like performance",text:o[0].text});break}}return e.sort((r,o)=>r.line!==o.line?r.line-o.line:r.rule.localeCompare(o.rule))}function xr(n,e){if(!e.length)return`${n}: no deterministic AI-pattern issues found`;let t=[`${n}: ${e.length} issue(s)`];for(let s of e)t.push(`- line ${s.line}: ${s.rule} - ${s.phrase}`);return t.join(`
39
+ `)}function Sr(n,e){return{path:n,issue_count:e.length,issues:e}}var nl,rl,ol,al,ll,ot=bt(()=>{"use strict";nl=[{id:"ai_antithesis",pattern:/\b(?:it'?s|isn'?t|is\s+not)\s+not\s+just\b.{0,80}\b(?:it'?s|but)\b/i},{id:"not_just_but",pattern:/\bnot\s+just\b.{3,80}\bbut\s+(?:also\s+)?/i},{id:"more_than_just",pattern:/\bmore\s+than\s+just\b/i},{id:"rhetorical_truth_setup",pattern:/\b(?:the\s+)?(?:uncomfortable|hard|harsh|brutal|ugly|unsexy|real|honest)\s+(?:truth|reality)\b/i},{id:"truth_is",pattern:/\bthe\s+truth\s+is\b/i},{id:"lesson_setup",pattern:/\b(?:here'?s\s+)?what\s+.{3,80}\s+(?:taught|teaches)\s+(?:me|us|you|everyone)\b/i},{id:"negation_cascade",pattern:/\b(?:no|not)\s+\w[^.!?\n]{0,80}[.!?][ \t]*\n?[ \t]*(?:no|not)\s+\w[^.!?\n]{0,80}[.!?][ \t]*\n?[ \t]*(?:no|not)\s+\w/i},{id:"formulaic_connector",pattern:/\b(?:firstly|secondly|thirdly|lastly|moreover|furthermore|in conclusion|to summarize|to sum up|in summary|it is important to note|it should be noted)\b/i},{id:"ai_words",pattern:/\b(?:delve|underscore|testament|intricate|multifaceted|cornerstone|landscape|foster|harness|leverage|tapestry|illuminate|pivotal|elevate|empower|seamlessly|revolutionize|supercharge|transformative|holistic|comprehensive|innovative|impactful|meaningful|utilize|paradigm|navigate|endeavor|realm|profound|encapsulate|synergy|robust|facilitate|bolster|streamline|differentiate|myriad|unlock|transform)\b/i},{id:"em_dash",pattern:/\u2014/},{id:"signpost_claim",pattern:/\bthis\s+is\s+(?:also\s+)?(?:why|how|where|what\b|what\s+happens\s+when)\b|\b(?:here'?s|here\s+is)\s+(?:where|why|what|the\s+part|the\s+(?:harder|real|actual|main|bigger)\s+problem)\b/i},{id:"generic_buyer_psychology",pattern:/\bpeople\s+don'?t\s+just\s+buy\b|\bpeople\s+buy\s+the\s+feeling\b/i},{id:"founder_cadence_restatement",pattern:/\bwhich\s+is\s+another\s+way\s+of\s+saying\b|\bin\s+other\s+words\b/i},{id:"founder_cadence_moment_becomes",pattern:/\b(?:the\s+)?moment\b.{3,80}\bbecomes?\b|\bbecomes?\s+(?:dangerous|useful|interesting|real|obvious)\s+the\s+moment\b/i},{id:"founder_cadence_same_better",pattern:/\bsame\s+[^.!?\n]{1,35}[.!?]\s*(?:better|nicer|cleaner|calmer|safer)\s+[^.!?\n]{1,35}[.!?]?/i}],rl=new Set(["alignment","authenticity","awareness","clarity","confidence","consistency","differentiation","execution","framework","identity","messaging","narrative","personality","positioning","preference","presence","recall","relevance","resonance","signal","strategy","trust","utility","value"]),ol=/^(?:most|many)\s+(?:brands|teams|people|founders|companies)\b/i,al=/^(?:have you|do you|did you|what if|why do|how do)\b/i,ll=/^(?:the most important thing|the key to|success is|if you want to|what i learned)\b/i});var Cr={};on(Cr,{registerOnboardingCommands:()=>Ci});function os(){try{U();let n=Re.readdirSync(ne).filter(t=>t.endsWith(".md"));if(n.length===0)return;let e="";for(let t of n){let s=Ae(t.replace(".md",""));if(s){e=s;break}}e&&Re.writeFileSync(hl,e)}catch{}}function dl(n){let e=n.map(b=>b.text).join(`
36
40
 
37
- The user's voice profile is at \`~/.hyv/voice.md\`. Read it before rewriting.
38
-
39
- When the user mentions "voice", "brand voice", "hyv", "write in my voice", or "rewrite in my voice":
40
-
41
- 1. Read the voice profile: \`~/.hyv/voice.md\`
42
- 2. Capture the text to rewrite (previous message, code block, file, etc.)
43
- 3. Run: \`hyv rewrite --text "the captured text"\`
44
- 4. Read the structured prompt from stdout
45
- 5. Execute the rewrite following the prompt's instructions
46
- 6. Present the rewritten text directly
47
-
48
- ## Natural Language Commands
49
-
50
- When the user says any of these, run the corresponding command:
51
-
52
- - "create a voice profile" / "set up my voice" / "onboard" \u2192 run \`hyv new <name>\`
53
- - "scan this" / "check my voice" / "does this sound like me" \u2192 run \`hyv scan <file>\` or \`hyv scan --text "the text"\`
54
- - "rewrite this in my voice" / "make this sound like me" \u2192 run \`hyv rewrite <file>\` or \`hyv rewrite --text "the text"\`
55
- - "rename my profile to X" / "call my profile X" \u2192 run \`hyv rename <new-name>\`
56
- - "what's my plan" / "subscription status" \u2192 run \`hyv plan\`
57
- - "show my profiles" / "list profiles" \u2192 run \`hyv profiles\`
58
-
59
- ## Onboarding with Natural Language
60
-
61
- When creating a voice profile, use \`--natural\` flag:
62
- \`\`\`bash
63
- hyv new my-voice --natural
64
- \`\`\`
65
-
66
- This will ask the user to describe their voice. The CLI outputs a prompt \u2014 YOU process that prompt using your own credits and save the profile.
67
-
68
- ## File rewrite
69
- \`\`\`bash
70
- hyv rewrite <file.md>
71
- \`\`\`
72
-
73
- ## Scan for issues
74
- \`\`\`bash
75
- hyv scan <file.md>
76
- \`\`\`
77
-
78
- ## Rules
79
- - The CLI generates prompts. **You** execute the rewrite.
80
- - Preserve original meaning. Match the voice profile's rhythm, vocabulary, patterns.
81
- - If no profile specified, check \`.hyv.yml\` or ask the user.
82
- - If CLI not installed: \`npm i -g @holdyourvoice/hyv\` then \`hyv init\`
83
- - Always use your own credits for processing. Never send to HYV server.
84
- `;function es(n){q.existsSync(n)||q.mkdirSync(n,{recursive:!0})}function yt(n,e,t="Hold Your Voice"){return q.existsSync(n)?q.readFileSync(n,"utf-8").includes(t)?!1:(q.appendFileSync(n,`
85
-
86
- `+e),!0):(es(T.dirname(n)),q.writeFileSync(n,e),!0)}function Ja(){let n=Ga?T.join(Xe,"AppData","Roaming","Claude"):T.join(Xe,"Library","Application Support","Claude"),e=T.join(n,"claude_desktop_config.json");if(!q.existsSync(n))return!1;let t={};if(q.existsSync(e))try{t=JSON.parse(q.readFileSync(e,"utf-8"))}catch{t={}}if(t.mcpServers||(t.mcpServers={}),t.mcpServers.hyv)return!1;t.mcpServers.hyv={command:"hyv",args:["mcp"]};try{return q.writeFileSync(e,JSON.stringify(t,null,2)),!0}catch{return!1}}function Ka(){let n=T.join(Xe,".chatgpt");es(n);let e=`Hold Your Voice \u2014 Voice Profile Integration
87
-
88
- The user's voice profile is at: ${ur}
89
-
90
- When the user says "rewrite in my voice" or mentions "hyv" or "brand voice":
91
- 1. Ask the user to paste their voice profile from ${ur}
92
- 2. Rewrite their text matching the profile's rhythm, vocabulary, and patterns
93
- 3. Never use AI-slop words (delve, leverage, tapestry, foster, harness, pivotal)
94
- 4. Preserve original meaning exactly
95
- 5. Remove patterns like "not just X, but Y" and "the truth is"
96
- `,t=T.join(n,"hyv-instructions.txt");return q.writeFileSync(t,e),!0}function Xa(){let n=process.cwd(),e=[],t=[],s=[{dir:T.join(n,".claude","commands"),scope:"project"},{dir:T.join(Xe,".claude","commands"),scope:"global"}];for(let{dir:l,scope:c}of s){es(l);let u=T.join(l,"hyv.md");yt(u,mt)&&e.push(`claude-code (${c})`)}let i=T.join(n,"CLAUDE.md");yt(i,mt)&&e.push("CLAUDE.md");let r=[{file:T.join(n,"AGENTS.md"),scope:"project"},{file:T.join(Xe,".codex","AGENTS.md"),scope:"global"}];for(let{file:l,scope:c}of r)es(T.dirname(l)),yt(l,mt)&&e.push(`codex (${c})`);let o=T.join(n,".cursorrules");yt(o,mt)&&e.push("cursor");let a=T.join(n,".windsurfrules");return yt(a,mt)&&e.push("windsurf"),Ja()&&e.push("claude-desktop (mcp)"),Ka()&&t.push("chatgpt"),{installed:e,needsConfig:t}}function dr(n){n.command("init").description("Authenticate with Hold Your Voice").argument("[license-key]","License key (skip browser flow)").option("--no-browser","Skip browser-based authentication").action(async(e,t)=>{try{if(Y(),zt()){let a=Gt(),l=await Zt();if(l.valid){console.log(j.default.green("\u2713 Already authenticated")),console.log(j.default.dim(` Email: ${a?.user?.email||"Unknown"}`)),console.log(j.default.dim(` Plan: ${l.plan||"Unknown"}`)),console.log("\nRun `hyvoice status` for more details.");return}else console.log(j.default.yellow(`Session expired. Re-authenticating...
97
- `))}let s;e?(console.log(j.default.cyan("Authenticating with license key...")),s=await cr(e)):t?.browser===!1?(console.log(j.default.red("License key required when --no-browser is set.")),console.log(`
98
- Usage: hyvoice init <license-key>`),console.log(`
99
- Generate a license key at: https://holdyourvoice.com/app/settings`),process.exit(1)):s=await hr();let i=Yt();zn({...i,created_at:i.created_at||new Date().toISOString()}),console.log(j.default.green(`
100
- \u2713 authenticated successfully!`)),console.log(j.default.dim(` email: ${s.user?.email||"unknown"}`)),console.log(j.default.dim(` plan: ${s.user?.plan||"unknown"}`)),s.license_key&&console.log(j.default.dim(` license: ${s.license_key.slice(0,12)}...`));let{installed:r,needsConfig:o}=Xa();if(r.length>0){console.log(j.default.green(`
101
- \u2713 connected to:`));for(let a of r)console.log(j.default.dim(` \u2192 ${a}`))}if(o.includes("chatgpt")){console.log(j.default.cyan(`
102
- \u2192 opening chatgpt connector settings...`)),console.log(j.default.dim(" add server: ")+j.default.cyan("https://holdyourvoice.com/mcp")),console.log(j.default.dim(" auth: your CLI key will be used automatically"));try{let a=(await Promise.resolve().then(()=>C(pt()))).default;await a("https://chatgpt.com/#settings/Connectors")}catch{}}console.log(`
103
- say "rewrite in my voice" in any connected agent to get started.
104
- `)}catch(s){console.error(j.default.red(`
105
- \u2717 Authentication failed: ${s.message}`)),process.exit(1)}})}var Fe=C(re());oe();function pr(n){n.command("status").description("show account and cli status").action(async()=>{let e=R();if(!zt()){console.log(Fe.default.red(`
106
- error: you're not signed in yet
107
- `)),console.log(Fe.default.dim(` run: hyv init
108
- `)),process.exit(2);return}let t=await Zt();t.valid?(console.log(Fe.default.bold(`
109
- account`)),console.log(` email: ${t.user?.email||"\u2014"}`),console.log(` plan: ${t.plan||"none"}`),(!t.plan||t.plan==="none")&&console.log(Fe.default.dim(" subscribe: ")+Fe.default.cyan("hyv plan --upgrade")),console.log("")):(console.log(Fe.default.red(`
110
- error: your session has expired
111
- `)),console.log(Fe.default.dim(` run: hyv init
112
- `)),process.exit(1))})}var D=C(re());oe();var ts=C(require("fs")),ss=C(require("path"));function gr(n){n.command("sync").description("Sync profiles and rules from server").option("--force","Force re-download even if cache is fresh").action(async e=>{try{R()||(console.log(D.default.yellow("Not authenticated. Run `hyvoice init` first.")),process.exit(1)),console.log(D.default.cyan("Syncing profiles and rules..."));let s=await B("https://holdyourvoice.com/cli/sync",{method:"GET"});if(s.status!==200){let c=s.data;console.error(D.default.red(`Sync failed: ${c?.error||"Unknown error"}`)),process.exit(1)}let i=s.data;Y();let r=0;for(let c of i.profiles)_e(c.slug||c.name,c.content),r++;let o=ss.join(je,"rules.md");ts.writeFileSync(o,i.rules,{mode:384});let a=ss.join(je,"prompt-template.md");ts.writeFileSync(a,i.prompt_template,{mode:384});let l=ss.join(je,"sync-meta.json");if(ts.writeFileSync(l,JSON.stringify({synced_at:i.synced_at,profile_count:r,plan:i.plan},null,2),{mode:384}),console.log(D.default.green(`
113
- \u2713 Synced successfully!`)),console.log(D.default.dim(` Profiles: ${r}`)),console.log(D.default.dim(" Rules: cached")),console.log(D.default.dim(" Prompt template: cached")),console.log(D.default.dim(` Plan: ${i.plan}`)),r>0){console.log(`
114
- Profiles:`);for(let c of i.profiles)console.log(D.default.dim(` \u2022 ${c.name} (${c.slug})`))}}catch(t){console.error(D.default.red(`Sync failed: ${t.message}`)),process.exit(1)}}),n.command("profiles").description("List voice profiles").action(async()=>{try{let e=Gn();if(console.log(D.default.bold(`
115
- Voice Profiles
116
- `)),e.length===0){console.log(D.default.dim("No profiles cached.")),console.log(D.default.dim("Run `hyvoice sync` to fetch profiles."));return}for(let t of e){let s=Ne(t);if(s){let i=s.match(/^#\s+(.+)$/m),r=i?i[1]:t;console.log(D.default.dim(`\u2022 ${r}`))}else console.log(D.default.dim(`\u2022 ${t}`))}console.log(D.default.dim(`
117
- ${e.length} profile(s) cached.`))}catch(e){console.error(D.default.red(`Error: ${e.message}`)),process.exit(1)}}),n.command("pull").description("Force re-download profiles and rules").action(async()=>{await n.parseAsync(["node","hyvoice","sync","--force"])})}var J=C(re()),Le=C(require("fs")),pi=C(require("path"));var Ie=C(require("fs")),wr=C(require("path"));oe();var Qa=[{id:"ai_antithesis",pattern:/\b(?:it'?s|isn'?t|is\s+not)\s+not\s+just\b.{0,80}\b(?:it'?s|but)\b/i},{id:"not_just_but",pattern:/\bnot\s+just\b.{3,80}\bbut\s+(?:also\s+)?/i},{id:"more_than_just",pattern:/\bmore\s+than\s+just\b/i},{id:"rhetorical_truth_setup",pattern:/\b(?:the\s+)?(?:uncomfortable|hard|harsh|brutal|ugly|unsexy|real|honest)\s+(?:truth|reality)\b/i},{id:"truth_is",pattern:/\bthe\s+truth\s+is\b/i},{id:"lesson_setup",pattern:/\b(?:here'?s\s+)?what\s+.{3,80}\s+(?:taught|teaches)\s+(?:me|us|you|everyone)\b/i},{id:"negation_cascade",pattern:/\b(?:no|not)\s+\w[^.!?\n]{0,80}[.!?][ \t]*\n?[ \t]*(?:no|not)\s+\w[^.!?\n]{0,80}[.!?][ \t]*\n?[ \t]*(?:no|not)\s+\w/i},{id:"formulaic_connector",pattern:/\b(?:firstly|secondly|thirdly|lastly|moreover|furthermore|in conclusion|to summarize|to sum up|in summary|it is important to note|it should be noted)\b/i},{id:"ai_words",pattern:/\b(?:delve|underscore|testament|intricate|multifaceted|cornerstone|landscape|foster|harness|leverage|tapestry|illuminate|pivotal|elevate|empower|seamlessly|revolutionize|supercharge|transformative|holistic|comprehensive|innovative|impactful|meaningful|utilize|paradigm|navigate|endeavor|realm|profound|encapsulate|synergy|robust|facilitate|bolster|streamline|differentiate|myriad|unlock|transform)\b/i},{id:"em_dash",pattern:/\u2014/},{id:"signpost_claim",pattern:/\bthis\s+is\s+(?:also\s+)?(?:why|how|where|what\b|what\s+happens\s+when)\b|\b(?:here'?s|here\s+is)\s+(?:where|why|what|the\s+part|the\s+(?:harder|real|actual|main|bigger)\s+problem)\b/i},{id:"generic_buyer_psychology",pattern:/\bpeople\s+don'?t\s+just\s+buy\b|\bpeople\s+buy\s+the\s+feeling\b/i},{id:"founder_cadence_restatement",pattern:/\bwhich\s+is\s+another\s+way\s+of\s+saying\b|\bin\s+other\s+words\b/i},{id:"founder_cadence_moment_becomes",pattern:/\b(?:the\s+)?moment\b.{3,80}\bbecomes?\b|\bbecomes?\s+(?:dangerous|useful|interesting|real|obvious)\s+the\s+moment\b/i},{id:"founder_cadence_same_better",pattern:/\bsame\s+[^.!?\n]{1,35}[.!?]\s*(?:better|nicer|cleaner|calmer|safer)\s+[^.!?\n]{1,35}[.!?]?/i}],Za=new Set(["alignment","authenticity","awareness","clarity","confidence","consistency","differentiation","execution","framework","identity","messaging","narrative","personality","positioning","preference","presence","recall","relevance","resonance","signal","strategy","trust","utility","value"]),el=/^(?:most|many)\s+(?:brands|teams|people|founders|companies)\b/i,tl=/^(?:have you|do you|did you|what if|why do|how do)\b/i,sl=/^(?:the most important thing|the key to|success is|if you want to|what i learned)\b/i;function he(n){return(n||"").match(/[a-zA-Z][a-zA-Z0-9']*/g)||[]}function bt(n){return(n||"").split(/(?<=[.!?])\s+|\n{2,}/).map(e=>e.trim()).filter(e=>he(e).length>0)}function mr(n){return(n||"").split(/\n\s*\n/).map(e=>e.trim()).filter(e=>he(e).length>=6)}function il(n){let e=(n||"").trim().toLowerCase();if(!e)return[];let t=[];return(e.match(/[a-z']+/g)||[]).filter(r=>Za.has(r)).length>=3&&!/\b(?:for example|for instance|such as)\b|\d/i.test(e)&&t.push({line:0,rule:"abstract_noun_cluster",phrase:n.trim().slice(0,160)}),el.test(e)&&t.push({line:0,rule:"generic_opening_generalization",phrase:n.trim().slice(0,160)}),tl.test(e)&&t.push({line:0,rule:"voice_question_opener",phrase:"opens with a question instead of a concrete observation"}),sl.test(e)&&t.push({line:0,rule:"voice_lesson_opener",phrase:"opens with a lesson or inspirational claim"}),t}function $e(n){let e=[],t=n||"";for(let r of Qa){let o=t.match(r.pattern);if(o)for(let a of o){let l=a.trim();if(!l)continue;let c=t.indexOf(a),u=c>=0?t.slice(0,c).split(`
118
- `).length:1;e.push({line:u,rule:r.id,phrase:l.slice(0,160)})}}let s=t.split(`
119
- `);for(let r=0;r<s.length;r++){let o=il(s[r]);for(let a of o)a.line=r+1,a.text=s[r].trim().slice(0,240),e.push(a)}let i=[];for(let r=0;r<s.length;r++){let o=s[r].split(/(?<=[.!?])\s+/);for(let a of o){let l=he(a).length;l>0&&i.push({line:r+1,text:a.trim(),wordCount:l})}}for(let r=0;r<i.length-2;r++){let o=i.slice(r,r+3);if(o.every(a=>a.wordCount<=5)){e.push({line:o[0].line,rule:"voice_staccato_triplet",phrase:"three short sentences in a row reads like performance",text:o[0].text});break}}return e.sort((r,o)=>r.line!==o.line?r.line-o.line:r.rule.localeCompare(o.rule))}function yr(n,e){if(!e.length)return`${n}: no deterministic AI-pattern issues found`;let t=[`${n}: ${e.length} issue(s)`];for(let s of e)t.push(`- line ${s.line}: ${s.rule} - ${s.phrase}`);return t.join(`
120
- `)}function br(n,e){return{path:n,issue_count:e.length,issues:e}}function nl(){let n=wr.join(je,"prompt-template.md");try{if(Ie.existsSync(n))return Ie.readFileSync(n,"utf-8")}catch{}return`Rewrite only the flagged lines. Do not rewrite the whole piece.
121
-
122
- Return only valid JSON in this exact shape:
123
- {{"replacements":[{{"line":1,"text":"replacement line"}}]}}
124
-
125
- Rules:
126
- - Include only flagged line numbers.
127
- - Preserve unflagged lines exactly by not returning them.
128
- - Preserve the original argument and local meaning.
129
- - Use the voice profile as the benchmark when present.
130
- - Remove AI cadence, polished founder cadence, abstract strategy-deck language, and generic lesson shapes.
131
- - Do not add new sections, hooks, CTAs, markdown, bullets, or commentary.
132
-
133
- Voice profile:
134
- {profile_block}
135
-
136
- Extra constraints:
137
- {constraints_block}
138
-
139
- Flagged lines:
140
- {issue_lines}
141
-
142
- Draft with line numbers ({draft_name}):
143
- {numbered_draft}
144
- `}function rl(n){if(n){let e=Ne(n);if(e)return{content:e,name:n}}try{if(!Ie.existsSync(Ae))return null;let e=Ie.readdirSync(Ae).filter(t=>t.endsWith(".md"));if(e.length>0){let t=e[0].replace(".md",""),s=Ne(t);if(s)return{content:s,name:t}}}catch{}return null}function is(n){let{draftPath:e,draftContent:t,profileName:s,constraints:i="",skipScan:r=!1}=n,o=r?[]:$e(t),a=o.length>0?o.map(g=>`- line ${g.line} [${g.rule}]: ${g.phrase}`).join(`
145
- `):"- none found by deterministic scan",l=rl(s),c=l?l.content:"(no voice profile supplied \u2014 use generic voice rules)",h=t.split(`
146
- `).map((g,p)=>`${p+1}: ${g}`).join(`
147
- `);return{prompt:nl().replace("{profile_block}",c).replace("{constraints_block}",i||"(none)").replace("{issue_lines}",a).replace("{draft_name}",e).replace("{numbered_draft}",h),profileUsed:l?.name||null,issuesFound:o.length}}function vr(n){n.command("rewrite").description("Generate rewrite prompt for LLM").argument("<file>","File to rewrite (or - for stdin)").option("--profile <name>","Voice profile to use").option("--format <type>","Content format (linkedin, blog, email)").option("--constraints <text>","Additional constraints").option("--no-scan","Skip local scan").option("--output <file>","Write prompt to file instead of stdout").action(async(e,t)=>{try{let s,i;e==="-"?(i="stdin",s=Le.readFileSync(0,"utf-8")):(i=pi.resolve(e),Le.existsSync(i)||(console.error(J.default.red(`File not found: ${i}`)),process.exit(1)),s=Le.readFileSync(i,"utf-8"));let r=is({draftPath:i,draftContent:s,profileName:t.profile,format:t.format,constraints:t.constraints,skipScan:t.scan===!1});if(console.log(J.default.dim(`
148
- Draft: ${i}`)),console.log(J.default.dim(`Profile: ${r.profileUsed||"none (using generic rules)"}`)),console.log(J.default.dim(`Issues found: ${r.issuesFound}`)),r.issuesFound===0){console.log(J.default.green(`
149
- \u2713 No issues found. Draft looks clean!`));return}console.log(J.default.bold(`
150
- Issues:`));let o=$e(s);for(let a of o.slice(0,10))console.log(J.default.yellow(` Line ${a.line}: [${a.rule}] ${a.phrase}`));if(o.length>10&&console.log(J.default.dim(` ... and ${o.length-10} more`)),t.output){let a=pi.resolve(t.output);Le.writeFileSync(a,r.prompt),console.log(J.default.green(`
151
- \u2713 Prompt written to ${a}`))}else console.log(J.default.bold(`
152
- --- Rewrite Prompt ---
153
- `)),console.log(r.prompt),console.log(J.default.dim(`
154
- --- End Prompt ---
155
- `)),console.log(J.default.dim("Copy this prompt and paste it into your LLM.")),console.log(J.default.dim("Or pipe directly: hyvoice rewrite draft.md | pbcopy"))}catch(s){console.error(J.default.red(`Error: ${s.message}`)),process.exit(1)}})}var N=C(re()),Qe=C(require("fs")),gi=C(require("path"));function ol(n,e){return n.trim()!==e.trim()}function xr(n,e,t,s){let i=t.split(`
156
- `),r=s.split(`
157
- `),o=$e(t),a=new Set(o.map(b=>b.line)),l={};for(let b of o)l[b.line]||(l[b.line]=[]),l[b.line].push(b.rule);let c={},u={},h={},f=Math.min(i.length,r.length),d=0;for(let b=0;b<f;b++){let P=b+1,Q=ol(i[b],r[b]),xe=l[P]||[];if(Q){if(d++,xe.length>0)for(let G of xe)c[G]=(c[G]||0)+1;else if(!a.has(P)){let G=i[b].trim();G.length>40&&(h[P]=G.slice(0,240))}}else if(xe.length>0)for(let G of xe)u[G]=(u[G]||0)+1}let g=d>Math.max(1,f*.8),p=he(s),m=bt(s).map(b=>he(b).length).filter(b=>b>0),x=m.length>0?Math.round(m.reduce((b,P)=>b+P,0)/m.length*10)/10:0,_=[],w=new Set;for(let b of Object.keys(h).map(Number).sort()){let P=h[b],Q=P.toLowerCase().trim().slice(0,60);if(!w.has(Q)&&(w.add(Q),_.push({line:b,original_text:P}),_.length>=10))break}return{signal_version:"hold-your-voice-signal-v1",session:{original_path:n,accepted_path:e,full_rewrite:g},patterns_accepted:c,patterns_overridden:u,new_removals:_,session_stats:{original_words:he(t).length,accepted_words:p.length,accepted_avg_sentence:x,accepted_sentence_count:m.length}}}function Sr(n){let e=[],t=Object.values(n.patterns_accepted).reduce((i,r)=>i+r,0),s=Object.values(n.patterns_overridden).reduce((i,r)=>i+r,0);if(t>0&&e.push(`${t} pattern(s) accepted (fixes applied)`),s>0&&e.push(`${s} pattern(s) overridden (user kept original)`),n.new_removals.length>0&&e.push(`${n.new_removals.length} potential new pattern(s) detected`),t===0&&s===0&&n.new_removals.length===0&&e.push("No significant changes detected"),Object.keys(n.patterns_accepted).length>0){e.push(""),e.push("Accepted patterns:");for(let[i,r]of Object.entries(n.patterns_accepted))e.push(` \u2022 ${i}: ${r} fix(es)`)}if(Object.keys(n.patterns_overridden).length>0){e.push(""),e.push("Overridden patterns (user kept original):");for(let[i,r]of Object.entries(n.patterns_overridden))e.push(` \u2022 ${i}: ${r} time(s)`)}return e.join(`
158
- `)}oe();function _r(n){n.command("reinforce").description("Send learning signals from edited draft").argument("<original>","Original file").argument("<edited>","Edited file").option("--profile <name>","Voice profile").option("--no-send","Queue signal without sending to server").action(async(e,t,s)=>{try{let i=gi.resolve(e),r=gi.resolve(t);Qe.existsSync(i)||(console.error(N.default.red(`Original file not found: ${i}`)),process.exit(1)),Qe.existsSync(r)||(console.error(N.default.red(`Edited file not found: ${r}`)),process.exit(1));let o=Qe.readFileSync(i,"utf-8"),a=Qe.readFileSync(r,"utf-8"),l=xr(i,r,o,a);if(console.log(N.default.bold(`
159
- Learning Signal Report
160
- `)),console.log(Sr(l)),s.send===!1)Je({type:"reinforce",profile:s.profile,report:l,timestamp:new Date().toISOString()}),console.log(N.default.yellow(`
161
- Signal queued for later sync.`));else{if(!R()){console.log(N.default.yellow(`
162
- Not authenticated. Queuing signal for later sync.`)),Je({type:"reinforce",profile:s.profile,report:l,timestamp:new Date().toISOString()});return}console.log(N.default.cyan(`
163
- Sending to server...`)),(await B("https://holdyourvoice.com/cli/learning/reinforce",{method:"POST",body:{profile_id:s.profile,original_text:o,accepted_text:a,signal_report:l}})).status===200?console.log(N.default.green("\u2713 Signal sent successfully")):(console.log(N.default.yellow("Failed to send. Queuing for later sync.")),Je({type:"reinforce",profile:s.profile,report:l,timestamp:new Date().toISOString()}))}}catch(i){console.error(N.default.red(`Error: ${i.message}`)),process.exit(1)}}),n.command("add").description("Add a voice instruction").argument("<instruction>","Natural language instruction").option("--profile <name>","Voice profile").action(async(e,t)=>{try{if(!R()){console.log(N.default.yellow("Not authenticated. Queuing instruction for later sync.")),Je({type:"add_instruction",profile:t.profile,instruction:e,timestamp:new Date().toISOString()}),console.log(N.default.dim(`Instruction: "${e}"`));return}console.log(N.default.cyan("Adding instruction..."));let i=await B("https://holdyourvoice.com/cli/learning/add",{method:"POST",body:{profile_id:t.profile,instruction:e}});if(i.status===200){let r=i.data;console.log(N.default.green(`
164
- \u2713 Instruction added`)),console.log(N.default.dim(` "${e}"`)),console.log(N.default.dim(` Confidence: ${r.confidence||.7}`))}else console.log(N.default.yellow("Failed to add. Queuing for later sync.")),Je({type:"add_instruction",profile:t.profile,instruction:e,timestamp:new Date().toISOString()})}catch(s){console.error(N.default.red(`Error: ${s.message}`)),process.exit(1)}})}var S=C(re()),Ze=C(require("fs")),et=C(require("path"));oe();var al=[{key:"tone",question:"How would you describe your tone? (e.g., casual, professional, witty, direct)"},{key:"audience",question:"Who is your audience? (e.g., founders, developers, marketers)"},{key:"personality",question:"If your brand was a person, how would they talk?"},{key:"avoid",question:"What words or phrases do you never use?"},{key:"inspiration",question:"Who writes like you? Any writers you admire?"},{key:"goal",question:"What should reading your content feel like?"},{key:"format",question:"What formats do you write in? (e.g., LinkedIn posts, emails, blog posts)"}],ll={tech:[{key:"technical_depth",question:"How technical do you get? (high-level concepts vs deep code)"},{key:"jargon",question:"Do you use technical jargon or explain everything?"},{key:"opinionated",question:"Do you take strong positions on tools/frameworks?"}],marketing:[{key:"pitch_style",question:"How do you pitch? (soft sell, hard sell, story-based)"},{key:"data_driven",question:"Do you lean on data or emotion?"},{key:"cta_style",question:"How do you end posts? (CTA style)"}],default:[{key:"formality",question:"How formal is your writing?"},{key:"storytelling",question:"Do you use stories/examples often?"},{key:"length",question:"Do you prefer short punchy content or longer pieces?"}]};function cl(n){let e=n.map(w=>w.text).join(`
165
-
166
- `),t=he(e),s=bt(e),i=mr(e),r=s.map(w=>he(w).length),o=r.length>0?Math.round(r.reduce((w,b)=>w+b,0)/r.length):0,a=i.map(w=>bt(w).length),l=a.length>0?Math.round(a.reduce((w,b)=>w+b,0)/a.length):0,c=o,u=r.length>2?Math.sqrt(r.reduce((w,b)=>w+Math.pow(b-c,2),0)/r.length)/c:0,h=u<.35?"low":u>.85?"high":"medium",f=s.map(w=>{let b=w.trim().match(/[A-Za-z]/);return b?b[0]:""}).filter(Boolean),g=f.filter(w=>w===w.toLowerCase()).length/f.length>.85?"mostly lowercase":"standard",p=s.filter(w=>w.trim().endsWith("?")).length/s.length,y=(e.match(/\b(?:i|we|my|our|me|us)\b/gi)||[]).length,m=(e.match(/\b(?:but|actually|instead|not|wrong|real|because)\b/gi)||[]).length,x=(e.match(/\b\d+(?:\.\d+)?%?\b/g)||[]).length,_="mixed";return p>.18?_="question-led":x>=Math.max(4,s.length/10)?_="data-led":y>=Math.max(6,s.length/4)?_="narrative":m>=Math.max(8,s.length/3)&&(_="contrarian"),{word_count:t.length,sentence_count:s.length,paragraph_count:i.length,avg_sentence_length:o,avg_paragraph_length:l,sentence_variance:h,case_style:g,argument_pattern:_,sample_count:n.length}}function Cr(n){n.command("new").description("Create a new voice profile").argument("<name>","Profile name").option("--from-samples <dir>","Create from writing samples").option("--from-url <urls>","Scrape blog/URL for writing samples (comma-separated)").option("--from-llm","Generate extraction prompt for LLM").option("--natural","Describe your voice in your own words (LLM-powered)").action(async(e,t)=>{try{let s=R();t.fromSamples?await ul(e,t.fromSamples,s):t.fromUrl?await fl(e,t.fromUrl,s):t.fromLlm?await pl(e):t.natural?await dl(e,s):await hl(e,s)}catch(s){console.error(S.default.red(`
167
- error: ${s.message}`)),process.exit(1)}})}async function hl(n,e){console.log(S.default.bold(`
41
+ `),t=pe(e),s=kt(e),i=vr(e),r=s.map(b=>pe(b).length),o=r.length>0?Math.round(r.reduce((b,w)=>b+w,0)/r.length):0,a=i.map(b=>kt(b).length),l=a.length>0?Math.round(a.reduce((b,w)=>b+w,0)/a.length):0,c=o,h=r.length>2?Math.sqrt(r.reduce((b,w)=>b+Math.pow(w-c,2),0)/r.length)/c:0,u=h<.35?"low":h>.85?"high":"medium",f=s.map(b=>{let w=b.trim().match(/[A-Za-z]/);return w?w[0]:""}).filter(Boolean),g=f.filter(b=>b===b.toLowerCase()).length/f.length>.85?"mostly lowercase":"standard",p=s.filter(b=>b.trim().endsWith("?")).length/s.length,y=(e.match(/\b(?:i|we|my|our|me|us)\b/gi)||[]).length,m=(e.match(/\b(?:but|actually|instead|not|wrong|real|because)\b/gi)||[]).length,x=(e.match(/\b\d+(?:\.\d+)?%?\b/g)||[]).length,_="mixed";return p>.18?_="question-led":x>=Math.max(4,s.length/10)?_="data-led":y>=Math.max(6,s.length/4)?_="narrative":m>=Math.max(8,s.length/3)&&(_="contrarian"),{word_count:t.length,sentence_count:s.length,paragraph_count:i.length,avg_sentence_length:o,avg_paragraph_length:l,sentence_variance:u,case_style:g,argument_pattern:_,sample_count:n.length}}function Ci(n){n.command("new").description("Create a new voice profile").argument("<name>","Profile name").option("--from-samples <dir>","Create from writing samples").option("--from-url <urls>","Scrape blog/URL for writing samples (comma-separated)").option("--from-llm","Generate extraction prompt for LLM").option("--natural","Describe your voice in your own words (LLM-powered)").action(async(e,t)=>{try{let s=M();t.fromSamples?await gl(e,t.fromSamples,s):t.fromUrl?await ml(e,t.fromUrl,s):t.fromLlm?await wl(e):t.natural?await yl(e,s):await pl(e,s)}catch(s){console.error(S.default.red(`
42
+ error: ${s.message}`)),process.exit(1)}})}async function pl(n,e){console.log(S.default.bold(`
168
43
  Creating voice profile: ${n}
169
44
  `)),console.log(S.default.dim(`Answer these questions to define your voice.
170
- `));let t={};for(let i of al){let r=await bi(i.question);t[i.key]=r}let s=t.format?.toLowerCase().includes("code")||t.audience?.toLowerCase().includes("developer")?"tech":t.format?.toLowerCase().includes("market")||t.audience?.toLowerCase().includes("market")?"marketing":"default";console.log(S.default.dim(`
45
+ `));let t={};for(let i of ul){let r=await _i(i.question);t[i.key]=r}let s=t.format?.toLowerCase().includes("code")||t.audience?.toLowerCase().includes("developer")?"tech":t.format?.toLowerCase().includes("market")||t.audience?.toLowerCase().includes("market")?"marketing":"default";console.log(S.default.dim(`
171
46
  Industry: ${s}
172
- `));for(let i of ll[s]){let r=await bi(i.question);t[i.key]=r}if(e){console.log(S.default.cyan(`
173
- Generating profile on server...`));let i=await B("https://holdyourvoice.com/cli/profiles/new",{method:"POST",body:{name:n,answers:t,industry:s}});if(i.status===200){let o=i.data.content||mi(n,t);Y(),_e(n,o),console.log(S.default.green(`
174
- \u2713 Profile created: ${n}`)),console.log(S.default.dim("Run `hyvoice profiles` to see your profiles."))}else{console.log(S.default.yellow(`
175
- Server unavailable. Creating local profile...`));let r=mi(n,t);Y(),_e(n,r),console.log(S.default.green(`
176
- \u2713 Local profile created: ${n}`))}}else{console.log(S.default.yellow(`
177
- Not authenticated. Creating local profile...`));let i=mi(n,t);Y(),_e(n,i),console.log(S.default.green(`
178
- \u2713 Local profile created: ${n}`))}}async function ul(n,e,t){let s=et.resolve(e);if(!Ze.existsSync(s))throw new Error(`Directory not found: ${s}`);console.log(S.default.bold(`
47
+ `));for(let i of fl[s]){let r=await _i(i.question);t[i.key]=r}if(e){console.log(S.default.cyan(`
48
+ Generating profile on server...`));let i=await q("https://holdyourvoice.com/cli/profiles/new",{method:"POST",body:{name:n,answers:t,industry:s}});if(i.status===200){let o=i.data.content||xi(n,t);U(),Fe(n,o),os(),console.log(S.default.green(`
49
+ \u2713 profile created: ${n}`)),console.log(S.default.dim("run `hyvoice profiles` to see your profiles."))}else{console.log(S.default.yellow(`
50
+ server unavailable. creating local profile...`));let r=xi(n,t);U(),Fe(n,r),os(),console.log(S.default.green(`
51
+ \u2713 local profile created: ${n}`))}}else{console.log(S.default.yellow(`
52
+ not authenticated. creating local profile...`));let i=xi(n,t);U(),Fe(n,i),os(),console.log(S.default.green(`
53
+ \u2713 local profile created: ${n}`))}}async function gl(n,e,t){let s=Be.resolve(e);if(!Re.existsSync(s))throw new Error(`Directory not found: ${s}`);console.log(S.default.bold(`
179
54
  Creating voice profile: ${n}`)),console.log(S.default.dim(`Reading samples from: ${s}
180
- `));let i=Ze.readdirSync(s).filter(a=>a.endsWith(".md")||a.endsWith(".txt")).map(a=>et.join(s,a));if(i.length===0)throw new Error("No .md or .txt files found in directory");let r=[];for(let a of i){let l=Ze.readFileSync(a,"utf-8");l.trim().length>0&&(r.push({path:a,text:l}),console.log(S.default.dim(` \u2022 ${et.basename(a)} (${he(l).length} words)`)))}if(r.length===0)throw new Error("No readable text found in files");let o=cl(r);if(console.log(S.default.dim(`
55
+ `));let i=Re.readdirSync(s).filter(a=>a.endsWith(".md")||a.endsWith(".txt")).map(a=>Be.join(s,a));if(i.length===0)throw new Error("No .md or .txt files found in directory");let r=[];for(let a of i){let l=Re.readFileSync(a,"utf-8");l.trim().length>0&&(r.push({path:a,text:l}),console.log(S.default.dim(` \u2022 ${Be.basename(a)} (${pe(l).length} words)`)))}if(r.length===0)throw new Error("No readable text found in files");let o=dl(r);if(console.log(S.default.dim(`
181
56
  Stats extracted:`)),console.log(S.default.dim(` Words: ${o.word_count}`)),console.log(S.default.dim(` Sentences: ${o.sentence_count}`)),console.log(S.default.dim(` Avg sentence: ${o.avg_sentence_length} words`)),console.log(S.default.dim(` Case style: ${o.case_style}`)),console.log(S.default.dim(` Argument pattern: ${o.argument_pattern}`)),t){console.log(S.default.cyan(`
182
- Generating profile on server...`));let a=await B("https://holdyourvoice.com/cli/profiles/new",{method:"POST",body:{name:n,samples:r.map(l=>({path:l.path,text:l.text.slice(0,4e3)})),stats:o}});if(a.status===200){let l=a.data;Y(),_e(n,l.content||yi(n,o)),console.log(S.default.green(`
183
- \u2713 Profile created: ${n}`))}else console.log(S.default.yellow(`
184
- Server unavailable. Creating local profile...`)),Y(),_e(n,yi(n,o)),console.log(S.default.green(`
57
+ Generating profile on server...`));let a=await q("https://holdyourvoice.com/cli/profiles/new",{method:"POST",body:{name:n,samples:r.map(l=>({path:l.path,text:l.text.slice(0,4e3)})),stats:o}});if(a.status===200){let l=a.data;U(),Fe(n,l.content||Si(n,o)),os(),console.log(S.default.green(`
58
+ \u2713 profile created: ${n}`))}else console.log(S.default.yellow(`
59
+ Server unavailable. Creating local profile...`)),U(),Fe(n,Si(n,o)),console.log(S.default.green(`
185
60
  \u2713 Local profile created: ${n}`))}else console.log(S.default.yellow(`
186
- Not authenticated. Creating local profile...`)),Y(),_e(n,yi(n,o)),console.log(S.default.green(`
187
- \u2713 local profile created: ${n}`));await kr(t)}async function fl(n,e,t){let s=e.split(",").map(i=>i.trim()).filter(Boolean);if(console.log(S.default.bold(`
61
+ Not authenticated. Creating local profile...`)),U(),Fe(n,Si(n,o)),console.log(S.default.green(`
62
+ \u2713 local profile created: ${n}`));await _r(t)}async function ml(n,e,t){let s=e.split(",").map(i=>i.trim()).filter(Boolean);if(console.log(S.default.bold(`
188
63
  creating voice profile: ${n}`)),console.log(S.default.dim(`scraping: ${s.join(", ")}
189
- `)),t){console.log(S.default.cyan("scraping urls on server..."));let i=await B("https://holdyourvoice.com/cli/onboarding/scrape",{method:"POST",body:{name:n,urls:s}});if(i.status===200){let r=i.data,o=r.samples_found||0,a=r.words_found||0;if(o===0){console.log(S.default.yellow(`
64
+ `)),t){console.log(S.default.cyan("scraping urls on server..."));let i=await q("https://holdyourvoice.com/cli/onboarding/scrape",{method:"POST",body:{name:n,urls:s}});if(i.status===200){let r=i.data,o=r.samples_found||0,a=r.words_found||0;if(o===0){console.log(S.default.yellow(`
190
65
  couldn't extract any content from those urls`)),console.log(S.default.dim("try: a blog homepage, substack, or medium profile")),console.log(S.default.dim("or: hyv new <name> --from-samples ./my-writing/"));return}console.log(S.default.green(`
191
66
  \u2713 found ${o} articles, ~${a} words`)),console.log(S.default.green(`\u2713 profile created: ${n}`))}else console.log(S.default.red(`
192
67
  error: server returned ${i.status}`))}else console.log(S.default.yellow(`
193
- not authenticated. url scraping requires a server connection.`)),console.log(S.default.dim("run: hyv init"));await kr(t)}async function kr(n){if(n){try{let e=await B("https://holdyourvoice.com/cli/heartbeat",{method:"GET"});if(e.status===200){let t=e.data,s=(t.plan||"none").toLowerCase(),i=t.status||"none";s==="none"||i==="none"?(console.log(""),console.log(S.default.bold("last step \u2014 unlock everything for just $1:")),console.log(""),console.log(S.default.cyan(" hyv plan --upgrade")),console.log(""),console.log(S.default.dim("first month is $1, then $9/month. cancel anytime."))):(console.log(""),console.log(S.default.bold("you're all set! try it out:")),console.log(""),console.log(S.default.cyan(" hyv scan draft.md")+S.default.dim(" \u2014 check a draft")),console.log(S.default.cyan(" hyv rewrite draft.md")+S.default.dim(" \u2014 get rewrite prompt")),console.log(S.default.dim(' or say "rewrite in my voice" in any connected agent')))}}catch{}console.log("")}}async function dl(n,e){console.log(S.default.bold(`
68
+ not authenticated. url scraping requires a server connection.`)),console.log(S.default.dim("run: hyv init"));await _r(t)}async function _r(n){if(n){try{let e=await q("https://holdyourvoice.com/cli/heartbeat",{method:"GET"});if(e.status===200){let t=e.data,s=(t.plan||"none").toLowerCase(),i=t.status||"none";s==="none"||i==="none"?(console.log(""),console.log(S.default.bold("last step \u2014 unlock everything for just $1:")),console.log(""),console.log(S.default.cyan(" hyv plan --upgrade")),console.log(""),console.log(S.default.dim("first month is $1, then $9/month. cancel anytime."))):(console.log(""),console.log(S.default.bold("you're all set! try it out:")),console.log(""),console.log(S.default.cyan(" hyv scan draft.md")+S.default.dim(" \u2014 check a draft")),console.log(S.default.cyan(" hyv rewrite draft.md")+S.default.dim(" \u2014 get rewrite prompt")),console.log(S.default.dim(' or say "rewrite in my voice" in any connected agent')))}}catch{}console.log("")}}async function yl(n,e){console.log(S.default.bold(`
194
69
  creating voice profile: ${n}
195
70
  `)),console.log(S.default.dim("describe your writing style in your own words.")),console.log(S.default.dim(`be as specific as you want \u2014 tone, vocabulary, what you avoid, etc.
196
- `));let t=await bi("how would you describe your voice?");if(!t.trim()){console.log(S.default.red(`
71
+ `));let t=await _i("how would you describe your voice?");if(!t.trim()){console.log(S.default.red(`
197
72
  error: please describe your writing style
198
73
  `)),process.exit(1);return}let s=`I need you to analyze this voice description and create a structured voice profile.
199
74
 
@@ -214,7 +89,7 @@ Then run: hyv import ${n} ~/.hyv/profiles/${n}.md`;console.log(S.default.dim(`
214
89
  paste this into your ai agent to generate your profile:
215
90
  `)),console.log(S.default.bold("\u2500".repeat(60))),console.log(s),console.log(S.default.bold("\u2500".repeat(60))),console.log(S.default.dim(`
216
91
  or save the prompt to a file and run it later.`)),console.log(S.default.dim(`the agent will use its own credits to process this.
217
- `))}async function pl(n){console.log(S.default.bold(`
92
+ `))}async function wl(n){console.log(S.default.bold(`
218
93
  Generating extraction prompt for: ${n}
219
94
  `));let e=`I need you to analyze writing samples and create a voice profile.
220
95
 
@@ -228,8 +103,8 @@ Please provide:
228
103
  Save the output as a markdown file, then run:
229
104
  hyvoice import ${n} <file.md>
230
105
 
231
- Or paste the profile content and I'll save it.`;console.log(e)}function bi(n){return new Promise(e=>{let s=require("readline").createInterface({input:process.stdin,output:process.stdout});s.question(S.default.cyan(` ${n}
232
- > `),i=>{s.close(),e(i.trim())})})}function mi(n,e){return`# Voice Profile: ${n}
106
+ Or paste the profile content and I'll save it.`;console.log(e)}function _i(n){return new Promise(e=>{let s=require("readline").createInterface({input:process.stdin,output:process.stdout});s.question(S.default.cyan(` ${n}
107
+ > `),i=>{s.close(),e(i.trim())})})}function xi(n,e){return`# Voice Profile: ${n}
233
108
 
234
109
  ## Tone & Style
235
110
  - **Tone:** ${e.tone||"Not specified"}
@@ -259,7 +134,7 @@ ${e.avoid?e.avoid.split(",").map(t=>`- ${t.trim()}`).join(`
259
134
 
260
135
  ---
261
136
  *Created via hyvoice onboarding*
262
- `}function yi(n,e){return`# Voice Profile: ${n}
137
+ `}function Si(n,e){return`# Voice Profile: ${n}
263
138
 
264
139
  ## Voice Stats
265
140
  - **Word count analyzed:** ${e.word_count}
@@ -284,72 +159,202 @@ ${e.avoid?e.avoid.split(",").map(t=>`- ${t.trim()}`).join(`
284
159
 
285
160
  ---
286
161
  *Created from ${e.sample_count} sample(s) via hyvoice*
287
- `}var k=C(re());oe();var wi=C(pt());function Er(n){n.command("plan").description("Manage subscription").option("--upgrade","Upgrade plan").option("--manage","Open billing portal").option("--downgrade","Downgrade plan").action(async e=>{try{R()||(console.log(k.default.yellow("Not authenticated. Run `hyvoice init` first.")),process.exit(1)),e.upgrade?await ml():e.manage?await yl():e.downgrade?await bl():await gl()}catch(t){console.error(k.default.red(`
288
- Error: ${t.message}`)),process.exit(1)}})}async function gl(){console.log(k.default.bold(`
162
+ `}var S,Re,Be,hl,ul,fl,ki=bt(()=>{"use strict";S=C(ie()),Re=C(require("fs")),Be=C(require("path"));re();$e();ot();hl=Be.join(he,"voice.md");ul=[{key:"tone",question:"How would you describe your tone? (e.g., casual, professional, witty, direct)"},{key:"audience",question:"Who is your audience? (e.g., founders, developers, marketers)"},{key:"personality",question:"If your brand was a person, how would they talk?"},{key:"avoid",question:"What words or phrases do you never use?"},{key:"inspiration",question:"Who writes like you? Any writers you admire?"},{key:"goal",question:"What should reading your content feel like?"},{key:"format",question:"What formats do you write in? (e.g., LinkedIn posts, emails, blog posts)"}],fl={tech:[{key:"technical_depth",question:"How technical do you get? (high-level concepts vs deep code)"},{key:"jargon",question:"Do you use technical jargon or explain everything?"},{key:"opinionated",question:"Do you take strong positions on tools/frameworks?"}],marketing:[{key:"pitch_style",question:"How do you pitch? (soft sell, hard sell, story-based)"},{key:"data_driven",question:"Do you lean on data or emotion?"},{key:"cta_style",question:"How do you end posts? (CTA style)"}],default:[{key:"formality",question:"How formal is your writing?"},{key:"storytelling",question:"Do you use stories/examples often?"},{key:"length",question:"Do you prefer short punchy content or longer pieces?"}]}});var Yr={};on(Yr,{apiGet:()=>fs,apiPost:()=>ec,requireSubscription:()=>tc});async function Gr(n,e,t){let s=M();if(!s)throw new Error("you're not signed in yet. run: hyv init");let i=`${qe}${e}`,r={method:n,headers:{Authorization:`Bearer ${s}`,"Content-Type":"application/json"}};t&&(r.body=JSON.stringify(t));let o;try{o=await fetch(i,r)}catch{throw new Error("can't reach the server. check your internet connection and try again.")}if(o.status===401)throw new Error("your session expired. run: hyv init to sign in again.");if(o.status===403)throw new Error("you don't have access to this feature. check your plan at holdyourvoice.com/dashboard");if(!o.ok){let a=await o.text().catch(()=>"");throw new Error(`something went wrong (${o.status}). ${a.slice(0,150)}`)}return o.json()}function fs(n){return Gr("GET",n)}function ec(n,e){return Gr("POST",n,e)}async function tc(){let n;try{n=await fs("/cli/heartbeat")}catch(e){let t=e.message||"";throw t.includes("not signed in")||t.includes("session expired")||t.includes("don't have access")?e:new Error("can't reach the server. check your internet connection and try again.")}if(!n.plan||n.plan.toLowerCase()==="none"||n.status==="none")throw new Error("you don't have an active subscription yet. run: hyv plan --upgrade to start for $1.")}var Fi=bt(()=>{"use strict";re()});var bn=C(wn(),1),{program:au,createCommand:lu,createArgument:cu,createOption:hu,CommanderError:uu,InvalidArgumentError:fu,InvalidOptionArgumentError:du,Command:vn,Argument:pu,Option:gu,Help:mu}=bn.default;var Me=C(ie());var $=C(ie()),z=C(require("fs")),j=C(require("path")),Er=C(require("os"));re();$e();var at=Er.homedir(),bl=process.platform==="win32",vl=j.join(at,".hyv"),kr=j.join(vl,"voice.md"),Et=`# Hold Your Voice
163
+
164
+ The user's voice profile is at \`~/.hyv/voice.md\`. Read it before rewriting.
165
+
166
+ When the user mentions "voice", "brand voice", "hyv", "write in my voice", or "rewrite in my voice":
167
+
168
+ 1. Read the voice profile: \`~/.hyv/voice.md\`
169
+ 2. Capture the text to rewrite (previous message, code block, file, etc.)
170
+ 3. Run: \`hyv rewrite --text "the captured text"\`
171
+ 4. Read the structured prompt from stdout
172
+ 5. Execute the rewrite following the prompt's instructions
173
+ 6. Present the rewritten text directly
174
+
175
+ ## Natural Language Commands
176
+
177
+ When the user says any of these, run the corresponding command:
178
+
179
+ - "create a voice profile" / "set up my voice" / "onboard" \u2192 run \`hyv new <name>\`
180
+ - "scan this" / "check my voice" / "does this sound like me" \u2192 run \`hyv scan <file>\` or \`hyv scan --text "the text"\`
181
+ - "rewrite this in my voice" / "make this sound like me" \u2192 run \`hyv rewrite <file>\` or \`hyv rewrite --text "the text"\`
182
+ - "rename my profile to X" / "call my profile X" \u2192 run \`hyv rename <new-name>\`
183
+ - "what's my plan" / "subscription status" \u2192 run \`hyv plan\`
184
+ - "show my profiles" / "list profiles" \u2192 run \`hyv profiles\`
185
+
186
+ ## Onboarding with Natural Language
187
+
188
+ When creating a voice profile, use \`--natural\` flag:
189
+ \`\`\`bash
190
+ hyv new my-voice --natural
191
+ \`\`\`
192
+
193
+ This will ask the user to describe their voice. The CLI outputs a prompt \u2014 YOU process that prompt using your own credits and save the profile.
194
+
195
+ ## File rewrite
196
+ \`\`\`bash
197
+ hyv rewrite <file.md>
198
+ \`\`\`
199
+
200
+ ## Scan for issues
201
+ \`\`\`bash
202
+ hyv scan <file.md>
203
+ \`\`\`
204
+
205
+ ## Rules
206
+ - The CLI generates prompts. **You** execute the rewrite.
207
+ - Preserve original meaning. Match the voice profile's rhythm, vocabulary, patterns.
208
+ - If no profile specified, check \`.hyv.yml\` or ask the user.
209
+ - If CLI not installed: \`npm i -g @holdyourvoice/hyv\` then \`hyv init\`
210
+ - Always use your own credits for processing. Never send to HYV server.
211
+ `;function as(n){z.existsSync(n)||z.mkdirSync(n,{recursive:!0})}function Ot(n,e,t="Hold Your Voice"){return z.existsSync(n)?z.readFileSync(n,"utf-8").includes(t)?!1:(z.appendFileSync(n,`
212
+
213
+ `+e),!0):(as(j.dirname(n)),z.writeFileSync(n,e),!0)}function xl(){let n=bl?j.join(at,"AppData","Roaming","Claude"):j.join(at,"Library","Application Support","Claude"),e=j.join(n,"claude_desktop_config.json");if(!z.existsSync(n))return!1;let t={};if(z.existsSync(e))try{t=JSON.parse(z.readFileSync(e,"utf-8"))}catch{t={}}if(t.mcpServers||(t.mcpServers={}),t.mcpServers.hyv)return!1;t.mcpServers.hyv={command:"hyv",args:["mcp"]};try{return z.writeFileSync(e,JSON.stringify(t,null,2)),!0}catch{return!1}}function Sl(){let n=j.join(at,".chatgpt");as(n);let e=`Hold Your Voice \u2014 Voice Profile Integration
214
+
215
+ The user's voice profile is at: ${kr}
216
+
217
+ When the user says "rewrite in my voice" or mentions "hyv" or "brand voice":
218
+ 1. Ask the user to paste their voice profile from ${kr}
219
+ 2. Rewrite their text matching the profile's rhythm, vocabulary, and patterns
220
+ 3. Never use AI-slop words (delve, leverage, tapestry, foster, harness, pivotal)
221
+ 4. Preserve original meaning exactly
222
+ 5. Remove patterns like "not just X, but Y" and "the truth is"
223
+ `,t=j.join(n,"hyv-instructions.txt");return z.writeFileSync(t,e),!0}function _l(){let n=process.cwd(),e=[],t=[],s=[{dir:j.join(n,".claude","commands"),scope:"project"},{dir:j.join(at,".claude","commands"),scope:"global"}];for(let{dir:l,scope:c}of s){as(l);let h=j.join(l,"hyv.md");Ot(h,Et)&&e.push(`claude-code (${c})`)}let i=j.join(n,"CLAUDE.md");Ot(i,Et)&&e.push("CLAUDE.md");let r=[{file:j.join(n,"AGENTS.md"),scope:"project"},{file:j.join(at,".codex","AGENTS.md"),scope:"global"}];for(let{file:l,scope:c}of r)as(j.dirname(l)),Ot(l,Et)&&e.push(`codex (${c})`);let o=j.join(n,".cursorrules");Ot(o,Et)&&e.push("cursor");let a=j.join(n,".windsurfrules");return Ot(a,Et)&&e.push("windsurf"),xl()&&e.push("claude-desktop (mcp)"),Sl()&&t.push("chatgpt"),{installed:e,needsConfig:t}}function Or(n){n.command("init").description("Authenticate with Hold Your Voice").argument("[license-key]","License key (skip browser flow)").option("--no-browser","Skip browser-based authentication").action(async(e,t)=>{try{if(U(),tt()){let c=st(),h=await rt();if(h.valid){console.log($.default.green("\u2713 Already authenticated")),console.log($.default.dim(` Email: ${c?.user?.email||"Unknown"}`)),console.log($.default.dim(` Plan: ${h.plan||"Unknown"}`)),console.log("\nRun `hyvoice status` for more details.");return}else console.log($.default.yellow(`Session expired. Re-authenticating...
224
+ `))}let s;e?(console.log($.default.cyan("Authenticating with license key...")),s=await wr(e)):t?.browser===!1?(console.log($.default.red("License key required when --no-browser is set.")),console.log(`
225
+ Usage: hyvoice init <license-key>`),console.log(`
226
+ Generate a license key at: https://holdyourvoice.com/app/settings`),process.exit(1)):s=await br();let i=ts();tr({...i,created_at:i.created_at||new Date().toISOString()}),console.log($.default.green(`
227
+ \u2713 authenticated successfully!`)),console.log($.default.dim(` email: ${s.user?.email||"unknown"}`)),console.log($.default.dim(` plan: ${s.user?.plan||"unknown"}`)),s.license_key&&console.log($.default.dim(` license: ${s.license_key.slice(0,12)}...`));let{installed:r,needsConfig:o}=_l();if(r.length>0){console.log($.default.green(`
228
+ \u2713 connected to:`));for(let c of r)console.log($.default.dim(` \u2192 ${c}`))}if(o.includes("chatgpt")){console.log($.default.cyan(`
229
+ \u2192 opening chatgpt connector settings...`)),console.log($.default.dim(" add server: ")+$.default.cyan("https://holdyourvoice.com/mcp")),console.log($.default.dim(" auth: your CLI key will be used automatically"));try{let c=(await Promise.resolve().then(()=>C(_t()))).default;await c("https://chatgpt.com/#settings/Connectors")}catch{}}console.log(`
230
+ say "rewrite in my voice" in any connected agent to get started.
231
+ `);let a=require("readline"),l=a.createInterface({input:process.stdin,output:process.stdout});l.question($.default.cyan(" create your first voice profile now? (y/n) "),async c=>{if(l.close(),c.trim().toLowerCase().startsWith("y")){let h=a.createInterface({input:process.stdin,output:process.stdout});h.question($.default.cyan(" profile name: "),async u=>{if(h.close(),u.trim()){console.log($.default.dim(`
232
+ starting onboarding...
233
+ `));let{flashcardOnboarding:f}=await Promise.resolve().then(()=>(ki(),Cr));await f(u.trim(),s.token||null)}})}})}catch(s){console.error($.default.red(`
234
+ \u2717 Authentication failed: ${s.message}`)),process.exit(1)}})}var Ie=C(ie());re();$e();function Ar(n){n.command("status").description("show account and cli status").action(async()=>{let e=M();if(!tt()){console.log(Ie.default.red(`
235
+ error: you're not signed in yet
236
+ `)),console.log(Ie.default.dim(` run: hyv init
237
+ `)),process.exit(2);return}let t=await rt();t.valid?(console.log(Ie.default.bold(`
238
+ account`)),console.log(` email: ${t.user?.email||"\u2014"}`),console.log(` plan: ${t.plan||"none"}`),(!t.plan||t.plan==="none")&&console.log(Ie.default.dim(" subscribe: ")+Ie.default.cyan("hyv plan --upgrade")),console.log("")):(console.log(Ie.default.red(`
239
+ error: your session has expired
240
+ `)),console.log(Ie.default.dim(` run: hyv init
241
+ `)),process.exit(1))})}var I=C(ie());re();$e();var ls=C(require("fs")),cs=C(require("path"));function Fr(n){n.command("sync").description("Sync profiles and rules from server").option("--force","Force re-download even if cache is fresh").action(async e=>{try{M()||(console.log(I.default.yellow("Not authenticated. Run `hyvoice init` first.")),process.exit(1)),console.log(I.default.cyan("Syncing profiles and rules..."));let s=await q("https://holdyourvoice.com/cli/sync",{method:"GET"});if(s.status!==200){let c=s.data;console.error(I.default.red(`Sync failed: ${c?.error||"Unknown error"}`)),process.exit(1)}let i=s.data;U();let r=0;for(let c of i.profiles)Fe(c.slug||c.name,c.content),r++;let o=cs.join(Ve,"rules.md");ls.writeFileSync(o,i.rules,{mode:384});let a=cs.join(Ve,"prompt-template.md");ls.writeFileSync(a,i.prompt_template,{mode:384});let l=cs.join(Ve,"sync-meta.json");if(ls.writeFileSync(l,JSON.stringify({synced_at:i.synced_at,profile_count:r,plan:i.plan},null,2),{mode:384}),console.log(I.default.green(`
242
+ \u2713 Synced successfully!`)),console.log(I.default.dim(` Profiles: ${r}`)),console.log(I.default.dim(" Rules: cached")),console.log(I.default.dim(" Prompt template: cached")),console.log(I.default.dim(` Plan: ${i.plan}`)),r>0){console.log(`
243
+ Profiles:`);for(let c of i.profiles)console.log(I.default.dim(` \u2022 ${c.name} (${c.slug})`))}}catch(t){console.error(I.default.red(`Sync failed: ${t.message}`)),process.exit(1)}}),n.command("profiles").description("List voice profiles").action(async()=>{try{let e=sr();if(console.log(I.default.bold(`
244
+ Voice Profiles
245
+ `)),e.length===0){console.log(I.default.dim("No profiles cached.")),console.log(I.default.dim("Run `hyvoice sync` to fetch profiles."));return}for(let t of e){let s=Ae(t);if(s){let i=s.match(/^#\s+(.+)$/m),r=i?i[1]:t;console.log(I.default.dim(`\u2022 ${r}`))}else console.log(I.default.dim(`\u2022 ${t}`))}console.log(I.default.dim(`
246
+ ${e.length} profile(s) cached.`))}catch(e){console.error(I.default.red(`Error: ${e.message}`)),process.exit(1)}}),n.command("pull").description("Force re-download profiles and rules").action(async()=>{await n.parseAsync(["node","hyvoice","sync","--force"])})}var K=C(ie()),ze=C(require("fs")),Ei=C(require("path"));var Ue=C(require("fs")),$r=C(require("path"));re();ot();function Cl(){let n=$r.join(Ve,"prompt-template.md");try{if(Ue.existsSync(n))return Ue.readFileSync(n,"utf-8")}catch{}return`Rewrite only the flagged lines. Do not rewrite the whole piece.
247
+
248
+ Return only valid JSON in this exact shape:
249
+ {{"replacements":[{{"line":1,"text":"replacement line"}}]}}
250
+
251
+ Rules:
252
+ - Include only flagged line numbers.
253
+ - Preserve unflagged lines exactly by not returning them.
254
+ - Preserve the original argument and local meaning.
255
+ - Use the voice profile as the benchmark when present.
256
+ - Remove AI cadence, polished founder cadence, abstract strategy-deck language, and generic lesson shapes.
257
+ - Do not add new sections, hooks, CTAs, markdown, bullets, or commentary.
258
+
259
+ Voice profile:
260
+ {profile_block}
261
+
262
+ Extra constraints:
263
+ {constraints_block}
264
+
265
+ Flagged lines:
266
+ {issue_lines}
267
+
268
+ Draft with line numbers ({draft_name}):
269
+ {numbered_draft}
270
+ `}function kl(n){if(n){let e=Ae(n);if(e)return{content:e,name:n}}try{if(!Ue.existsSync(ne))return null;let e=Ue.readdirSync(ne).filter(t=>t.endsWith(".md"));if(e.length>0){let t=e[0].replace(".md",""),s=Ae(t);if(s)return{content:s,name:t}}}catch{}return null}function hs(n){let{draftPath:e,draftContent:t,profileName:s,constraints:i="",skipScan:r=!1}=n,o=r?[]:De(t),a=o.length>0?o.map(g=>`- line ${g.line} [${g.rule}]: ${g.phrase}`).join(`
271
+ `):"- none found by deterministic scan",l=kl(s),c=l?l.content:"(no voice profile supplied \u2014 use generic voice rules)",u=t.split(`
272
+ `).map((g,p)=>`${p+1}: ${g}`).join(`
273
+ `);return{prompt:Cl().replace("{profile_block}",c).replace("{constraints_block}",i||"(none)").replace("{issue_lines}",a).replace("{draft_name}",e).replace("{numbered_draft}",u),profileUsed:l?.name||null,issuesFound:o.length}}ot();function Rr(n){n.command("rewrite").description("Generate rewrite prompt for LLM").argument("<file>","File to rewrite (or - for stdin)").option("--profile <name>","Voice profile to use").option("--format <type>","Content format (linkedin, blog, email)").option("--constraints <text>","Additional constraints").option("--no-scan","Skip local scan").option("--output <file>","Write prompt to file instead of stdout").action(async(e,t)=>{try{let s,i;e==="-"?(i="stdin",s=ze.readFileSync(0,"utf-8")):(i=Ei.resolve(e),ze.existsSync(i)||(console.error(K.default.red(`File not found: ${i}`)),process.exit(1)),s=ze.readFileSync(i,"utf-8"));let r=hs({draftPath:i,draftContent:s,profileName:t.profile,format:t.format,constraints:t.constraints,skipScan:t.scan===!1});if(console.log(K.default.dim(`
274
+ Draft: ${i}`)),console.log(K.default.dim(`Profile: ${r.profileUsed||"none (using generic rules)"}`)),console.log(K.default.dim(`Issues found: ${r.issuesFound}`)),r.issuesFound===0){console.log(K.default.green(`
275
+ \u2713 No issues found. Draft looks clean!`));return}console.log(K.default.bold(`
276
+ Issues:`));let o=De(s);for(let a of o.slice(0,10))console.log(K.default.yellow(` Line ${a.line}: [${a.rule}] ${a.phrase}`));if(o.length>10&&console.log(K.default.dim(` ... and ${o.length-10} more`)),t.output){let a=Ei.resolve(t.output);ze.writeFileSync(a,r.prompt),console.log(K.default.green(`
277
+ \u2713 Prompt written to ${a}`))}else console.log(K.default.bold(`
278
+ --- Rewrite Prompt ---
279
+ `)),console.log(r.prompt),console.log(K.default.dim(`
280
+ --- End Prompt ---
281
+ `)),console.log(K.default.dim("Copy this prompt and paste it into your LLM.")),console.log(K.default.dim("Or pipe directly: hyvoice rewrite draft.md | pbcopy"))}catch(s){console.error(K.default.red(`Error: ${s.message}`)),process.exit(1)}})}var L=C(ie()),lt=C(require("fs")),Oi=C(require("path"));ot();function El(n,e){return n.trim()!==e.trim()}function Pr(n,e,t,s){let i=t.split(`
282
+ `),r=s.split(`
283
+ `),o=De(t),a=new Set(o.map(w=>w.line)),l={};for(let w of o)l[w.line]||(l[w.line]=[]),l[w.line].push(w.rule);let c={},h={},u={},f=Math.min(i.length,r.length),d=0;for(let w=0;w<f;w++){let T=w+1,ee=El(i[w],r[w]),Ee=l[T]||[];if(ee){if(d++,Ee.length>0)for(let J of Ee)c[J]=(c[J]||0)+1;else if(!a.has(T)){let J=i[w].trim();J.length>40&&(u[T]=J.slice(0,240))}}else if(Ee.length>0)for(let J of Ee)h[J]=(h[J]||0)+1}let g=d>Math.max(1,f*.8),p=pe(s),m=kt(s).map(w=>pe(w).length).filter(w=>w>0),x=m.length>0?Math.round(m.reduce((w,T)=>w+T,0)/m.length*10)/10:0,_=[],b=new Set;for(let w of Object.keys(u).map(Number).sort()){let T=u[w],ee=T.toLowerCase().trim().slice(0,60);if(!b.has(ee)&&(b.add(ee),_.push({line:w,original_text:T}),_.length>=10))break}return{signal_version:"hold-your-voice-signal-v1",session:{original_path:n,accepted_path:e,full_rewrite:g},patterns_accepted:c,patterns_overridden:h,new_removals:_,session_stats:{original_words:pe(t).length,accepted_words:p.length,accepted_avg_sentence:x,accepted_sentence_count:m.length}}}function Tr(n){let e=[],t=Object.values(n.patterns_accepted).reduce((i,r)=>i+r,0),s=Object.values(n.patterns_overridden).reduce((i,r)=>i+r,0);if(t>0&&e.push(`${t} pattern(s) accepted (fixes applied)`),s>0&&e.push(`${s} pattern(s) overridden (user kept original)`),n.new_removals.length>0&&e.push(`${n.new_removals.length} potential new pattern(s) detected`),t===0&&s===0&&n.new_removals.length===0&&e.push("No significant changes detected"),Object.keys(n.patterns_accepted).length>0){e.push(""),e.push("Accepted patterns:");for(let[i,r]of Object.entries(n.patterns_accepted))e.push(` \u2022 ${i}: ${r} fix(es)`)}if(Object.keys(n.patterns_overridden).length>0){e.push(""),e.push("Overridden patterns (user kept original):");for(let[i,r]of Object.entries(n.patterns_overridden))e.push(` \u2022 ${i}: ${r} time(s)`)}return e.join(`
284
+ `)}re();$e();function Mr(n){n.command("reinforce").description("Send learning signals from edited draft").argument("<original>","Original file").argument("<edited>","Edited file").option("--profile <name>","Voice profile").option("--no-send","Queue signal without sending to server").action(async(e,t,s)=>{try{let i=Oi.resolve(e),r=Oi.resolve(t);lt.existsSync(i)||(console.error(L.default.red(`Original file not found: ${i}`)),process.exit(1)),lt.existsSync(r)||(console.error(L.default.red(`Edited file not found: ${r}`)),process.exit(1));let o=lt.readFileSync(i,"utf-8"),a=lt.readFileSync(r,"utf-8"),l=Pr(i,r,o,a);if(console.log(L.default.bold(`
285
+ Learning Signal Report
286
+ `)),console.log(Tr(l)),s.send===!1)it({type:"reinforce",profile:s.profile,report:l,timestamp:new Date().toISOString()}),console.log(L.default.yellow(`
287
+ Signal queued for later sync.`));else{if(!M()){console.log(L.default.yellow(`
288
+ Not authenticated. Queuing signal for later sync.`)),it({type:"reinforce",profile:s.profile,report:l,timestamp:new Date().toISOString()});return}console.log(L.default.cyan(`
289
+ Sending to server...`)),(await q("https://holdyourvoice.com/cli/learning/reinforce",{method:"POST",body:{profile_id:s.profile,original_text:o,accepted_text:a,signal_report:l}})).status===200?console.log(L.default.green("\u2713 Signal sent successfully")):(console.log(L.default.yellow("Failed to send. Queuing for later sync.")),it({type:"reinforce",profile:s.profile,report:l,timestamp:new Date().toISOString()}))}}catch(i){console.error(L.default.red(`Error: ${i.message}`)),process.exit(1)}}),n.command("add").description("Add a voice instruction").argument("<instruction>","Natural language instruction").option("--profile <name>","Voice profile").action(async(e,t)=>{try{if(!M()){console.log(L.default.yellow("Not authenticated. Queuing instruction for later sync.")),it({type:"add_instruction",profile:t.profile,instruction:e,timestamp:new Date().toISOString()}),console.log(L.default.dim(`Instruction: "${e}"`));return}console.log(L.default.cyan("Adding instruction..."));let i=await q("https://holdyourvoice.com/cli/learning/add",{method:"POST",body:{profile_id:t.profile,instruction:e}});if(i.status===200){let r=i.data;console.log(L.default.green(`
290
+ \u2713 Instruction added`)),console.log(L.default.dim(` "${e}"`)),console.log(L.default.dim(` Confidence: ${r.confidence||.7}`))}else console.log(L.default.yellow("Failed to add. Queuing for later sync.")),it({type:"add_instruction",profile:t.profile,instruction:e,timestamp:new Date().toISOString()})}catch(s){console.error(L.default.red(`Error: ${s.message}`)),process.exit(1)}})}ki();var E=C(ie());re();$e();var Ai=C(_t());function jr(n){n.command("plan").description("Manage subscription").option("--upgrade","Upgrade plan").option("--manage","Open billing portal").option("--downgrade","Downgrade plan").action(async e=>{try{M()||(console.log(E.default.yellow("Not authenticated. Run `hyvoice init` first.")),process.exit(1)),e.upgrade?await Al():e.manage?await Fl():e.downgrade?await $l():await Ol()}catch(t){console.error(E.default.red(`
291
+ Error: ${t.message}`)),process.exit(1)}})}async function Ol(){console.log(E.default.bold(`
289
292
  Subscription Plan
290
- `));let n=await B("https://holdyourvoice.com/cli/heartbeat",{method:"GET"});if(n.status!==200){console.log(k.default.yellow("Could not fetch plan info."));return}let e=n.data,t=e.plan||"none",s=e.license,i={none:"No Plan",individual:"Individual",team:"Team",agency:"Agency"},r={none:"-",individual:"$9/mo",team:"$29/mo",agency:"Custom"};console.log(k.default.dim("Plan:"),k.default.bold(i[t]||t)),console.log(k.default.dim("Price:"),r[t]||"-"),console.log(k.default.dim("Status:"),e.subscription_status||"none"),s&&console.log(k.default.dim("License:"),s.key_hint),t==="none"?(console.log(`
291
- You don't have an active subscription.`),console.log(k.default.dim("Run `hyvoice plan --upgrade` to subscribe."))):(console.log(`
292
- Manage your subscription:`),console.log(k.default.dim(" hyvoice plan --manage")))}async function ml(){console.log(k.default.cyan(`
293
+ `));let n=await q("https://holdyourvoice.com/cli/heartbeat",{method:"GET"});if(n.status!==200){console.log(E.default.yellow("Could not fetch plan info."));return}let e=n.data,t=e.plan||"none",s=e.license,i={none:"No Plan",individual:"Individual",team:"Team",agency:"Agency"},r={none:"-",individual:"$9/mo",team:"$29/mo",agency:"Custom"};console.log(E.default.dim("Plan:"),E.default.bold(i[t]||t)),console.log(E.default.dim("Price:"),r[t]||"-"),console.log(E.default.dim("Status:"),e.subscription_status||"none"),s&&console.log(E.default.dim("License:"),s.key_hint),t==="none"?(console.log(`
294
+ You don't have an active subscription.`),console.log(E.default.dim("Run `hyvoice plan --upgrade` to subscribe."))):(console.log(`
295
+ Manage your subscription:`),console.log(E.default.dim(" hyvoice plan --manage")))}async function Al(){console.log(E.default.cyan(`
293
296
  Opening checkout...
294
- `));let n=await B("https://holdyourvoice.com/cli/subscribe",{method:"POST",body:{plan:"individual"}});if(n.status===200){let t=n.data.checkout_url;t?(console.log(k.default.dim("Opening browser...")),await(0,wi.default)(t),console.log(k.default.green(`
295
- \u2713 Checkout opened in browser`)),console.log(k.default.dim("Complete the checkout to activate your plan."))):console.log(k.default.yellow("No checkout URL received."))}else console.log(k.default.yellow("Could not create checkout session.")),console.log(k.default.dim("Visit https://holdyourvoice.com/pricing to subscribe."))}async function yl(){console.log(k.default.cyan(`
297
+ `));let n=await q("https://holdyourvoice.com/cli/subscribe",{method:"POST",body:{plan:"individual"}});if(n.status===200){let t=n.data.checkout_url;t?(console.log(E.default.dim("Opening browser...")),await(0,Ai.default)(t),console.log(E.default.green(`
298
+ \u2713 Checkout opened in browser`)),console.log(E.default.dim("Complete the checkout to activate your plan."))):console.log(E.default.yellow("No checkout URL received."))}else console.log(E.default.yellow("Could not create checkout session.")),console.log(E.default.dim("Visit https://holdyourvoice.com/pricing to subscribe."))}async function Fl(){console.log(E.default.cyan(`
296
299
  Opening billing portal...
297
- `));let n=await B("https://holdyourvoice.com/cli/subscribe/manage",{method:"POST"});if(n.status===200){let t=n.data.portal_url;t?(console.log(k.default.dim("Opening browser...")),await(0,wi.default)(t),console.log(k.default.green(`
298
- \u2713 Billing portal opened`))):console.log(k.default.yellow("No portal URL received."))}else console.log(k.default.yellow("Could not open billing portal.")),console.log(k.default.dim("Visit https://holdyourvoice.com/app/settings to manage billing."))}async function bl(){console.log(k.default.yellow(`
300
+ `));let n=await q("https://holdyourvoice.com/cli/subscribe/manage",{method:"POST"});if(n.status===200){let t=n.data.portal_url;t?(console.log(E.default.dim("Opening browser...")),await(0,Ai.default)(t),console.log(E.default.green(`
301
+ \u2713 Billing portal opened`))):console.log(E.default.yellow("No portal URL received."))}else console.log(E.default.yellow("Could not open billing portal.")),console.log(E.default.dim("Visit https://holdyourvoice.com/app/settings to manage billing."))}async function $l(){console.log(E.default.yellow(`
299
302
  Downgrade Plan
300
- `)),console.log("To downgrade your plan, please visit:"),console.log(k.default.dim(" https://holdyourvoice.com/app/settings")),console.log(`
301
- Or contact support at shashank@holdyourvoice.com`)}var ue=C(re()),We=C(require("fs")),Or=C(require("path"));function Ar(n){n.command("scan").description("Scan text for voice issues").argument("<file>","File to scan (or - for stdin)").option("--format <type>","Output format (text or json)","text").option("--fail-on-hit","Exit with code 2 if issues found").option("--ignore <rules>","Comma-separated rules to ignore").action(async(e,t)=>{try{let s,i;if(e==="-")i="stdin",process.stdin.isTTY&&(console.error(ue.default.red("No input provided. Pipe content or specify a file.")),console.log(ue.default.dim('Example: echo "text" | hyvoice scan -')),console.log(ue.default.dim("Example: hyvoice scan draft.md")),process.exit(1)),s=We.readFileSync(0,"utf-8");else{i=Or.resolve(e),We.existsSync(i)||(console.error(ue.default.red(`File not found: ${i}`)),console.log(ue.default.dim("Check the file path and try again.")),process.exit(1));let a=We.statSync(i);a.isDirectory()&&(console.error(ue.default.red(`${i} is a directory, not a file.`)),console.log(ue.default.dim("Specify a file: hyvoice scan draft.md")),process.exit(1)),a.size>5e5&&console.warn(ue.default.yellow(`Warning: Large file (${Math.round(a.size/1024)}KB). Scanning may be slow.`)),s=We.readFileSync(i,"utf-8")}s.trim()||(console.warn(ue.default.yellow("File is empty or contains only whitespace.")),process.exit(0));let r=t.ignore?new Set(t.ignore.split(",").map(a=>a.trim())):new Set,o=$e(s);r.size>0&&(o=o.filter(a=>!r.has(a.rule))),t.format==="json"?console.log(JSON.stringify(br(i,o),null,2)):console.log(yr(i,o)),t.failOnHit&&o.length>0&&process.exit(2)}catch(s){console.error(ue.default.red(`Error: ${s.message}`)),process.exit(1)}})}var I=C(re());oe();function Fr(n){n.command("rename").description("rename a voice profile").argument("<new-name>","new name for the profile").option("-p, --profile <slug>","specific profile to rename").action(async(e,t)=>{try{let s=e.trim();if(!s){console.log(I.default.red(`
303
+ `)),console.log("To downgrade your plan, please visit:"),console.log(E.default.dim(" https://holdyourvoice.com/app/settings")),console.log(`
304
+ Or contact support at shashank@holdyourvoice.com`)}var ge=C(ie()),Ge=C(require("fs")),Dr=C(require("path"));ot();function Ir(n){n.command("scan").description("Scan text for voice issues").argument("<file>","File to scan (or - for stdin)").option("--format <type>","Output format (text or json)","text").option("--fail-on-hit","Exit with code 2 if issues found").option("--ignore <rules>","Comma-separated rules to ignore").action(async(e,t)=>{try{let s,i;if(e==="-")i="stdin",process.stdin.isTTY&&(console.error(ge.default.red("No input provided. Pipe content or specify a file.")),console.log(ge.default.dim('Example: echo "text" | hyvoice scan -')),console.log(ge.default.dim("Example: hyvoice scan draft.md")),process.exit(1)),s=Ge.readFileSync(0,"utf-8");else{i=Dr.resolve(e),Ge.existsSync(i)||(console.error(ge.default.red(`File not found: ${i}`)),console.log(ge.default.dim("Check the file path and try again.")),process.exit(1));let a=Ge.statSync(i);a.isDirectory()&&(console.error(ge.default.red(`${i} is a directory, not a file.`)),console.log(ge.default.dim("Specify a file: hyvoice scan draft.md")),process.exit(1)),a.size>5e5&&console.warn(ge.default.yellow(`Warning: Large file (${Math.round(a.size/1024)}KB). Scanning may be slow.`)),s=Ge.readFileSync(i,"utf-8")}s.trim()||(console.warn(ge.default.yellow("File is empty or contains only whitespace.")),process.exit(0));let r=t.ignore?new Set(t.ignore.split(",").map(a=>a.trim())):new Set,o=De(s);r.size>0&&(o=o.filter(a=>!r.has(a.rule))),t.format==="json"?console.log(JSON.stringify(Sr(i,o),null,2)):console.log(xr(i,o)),t.failOnHit&&o.length>0&&process.exit(2)}catch(s){console.error(ge.default.red(`Error: ${s.message}`)),process.exit(1)}})}var N=C(ie());re();$e();function Lr(n){n.command("rename").description("rename a voice profile").argument("<new-name>","new name for the profile").option("-p, --profile <slug>","specific profile to rename").action(async(e,t)=>{try{let s=e.trim();if(!s){console.log(N.default.red(`
302
305
  error: what do you want to name your profile?
303
- `)),console.log(I.default.dim(` example: hyv rename "my brand voice"
304
- `)),process.exit(1);return}if(s.length>100){console.log(I.default.red(`
306
+ `)),console.log(N.default.dim(` example: hyv rename "my brand voice"
307
+ `)),process.exit(1);return}if(s.length>100){console.log(N.default.red(`
305
308
  error: name is too long \u2014 keep it under 100 characters
306
- `)),process.exit(1);return}if(!R()){console.log(I.default.red(`
309
+ `)),process.exit(1);return}if(!M()){console.log(N.default.red(`
307
310
  error: you're not signed in yet
308
- `)),console.log(I.default.dim(` run: hyv init
309
- `)),process.exit(1);return}let r=await B("https://holdyourvoice.com/cli/profiles/rename",{method:"POST",body:{slug_or_id:t.profile||"default",new_name:s}});if(r.status===200){let o=r.data;console.log(I.default.green(`
311
+ `)),console.log(N.default.dim(` run: hyv init
312
+ `)),process.exit(1);return}let r=await q("https://holdyourvoice.com/cli/profiles/rename",{method:"POST",body:{slug_or_id:t.profile||"default",new_name:s}});if(r.status===200){let o=r.data;console.log(N.default.green(`
310
313
  \u2713 profile renamed to ${o.profile?.name||s}
311
- `))}else console.log(I.default.red(`
314
+ `))}else console.log(N.default.red(`
312
315
  error: server returned ${r.status}
313
- `))}catch(s){console.error(I.default.red(`
316
+ `))}catch(s){console.error(N.default.red(`
314
317
  error: ${s.message}
315
- `)),process.exit(1)}})}function $r(n){n.command("say").description('natural language commands (e.g., "rename my profile to X")').argument("<input>","natural language command").action(async e=>{let t=e.trim();if(!t){console.log(I.default.red(`
318
+ `)),process.exit(1)}})}function Nr(n){n.command("say").description('natural language commands (e.g., "rename my profile to X")').argument("<input>","natural language command").action(async e=>{let t=e.trim();if(!t){console.log(N.default.red(`
316
319
  error: no input provided
317
- `)),console.log(I.default.dim(` try: hyv say "rename my profile to <name>"
318
- `)),process.exit(1);return}let s=wl(t);switch(s.action){case"rename":if(s.name){if(!R()){console.log(I.default.red(`
320
+ `)),console.log(N.default.dim(` try: hyv say "rename my profile to <name>"
321
+ `)),process.exit(1);return}let s=Rl(t);switch(s.action){case"rename":if(s.name){if(!M()){console.log(N.default.red(`
319
322
  error: you're not signed in yet
320
- `)),console.log(I.default.dim(` run: hyv init
321
- `)),process.exit(1);return}let r=await B("https://holdyourvoice.com/cli/profiles/rename",{method:"POST",body:{slug_or_id:"default",new_name:s.name}});if(r.status===200){let o=r.data;console.log(I.default.green(`
323
+ `)),console.log(N.default.dim(` run: hyv init
324
+ `)),process.exit(1);return}let r=await q("https://holdyourvoice.com/cli/profiles/rename",{method:"POST",body:{slug_or_id:"default",new_name:s.name}});if(r.status===200){let o=r.data;console.log(N.default.green(`
322
325
  \u2713 profile renamed to ${o.profile?.name||s.name}
323
- `))}else console.log(I.default.red(`
326
+ `))}else console.log(N.default.red(`
324
327
  error: server returned ${r.status}
325
- `))}break;case"unknown":default:console.log(I.default.yellow(`
328
+ `))}break;case"unknown":default:console.log(N.default.yellow(`
326
329
  ! i didn't catch that
327
- `)),console.log(I.default.dim(' try: hyv say "rename my profile to <name>"')),console.log(I.default.dim(` or: hyv rename <new-name>
328
- `)),process.exit(1);break}})}function wl(n){let e=n.trim(),t=[/rename\s+(?:my\s+)?(?:voice\s+)?profile\s+(?:to|as)\s+(.+)/i,/update\s+(?:my\s+)?(?:voice\s+)?profile\s+(?:name\s+)?(?:to|as)\s+(.+)/i,/change\s+(?:my\s+)?(?:voice\s+)?profile\s+(?:name\s+)?(?:to|as)\s+(.+)/i,/call\s+(?:my\s+)?(?:voice\s+)?profile\s+(.+)/i,/set\s+(?:my\s+)?(?:voice\s+)?profile\s+(?:name\s+)?(?:to|as)\s+(.+)/i,/name\s+(?:my\s+)?(?:voice\s+)?profile\s+(.+)/i,/(?:voice\s+)?profile\s+(?:rename|name)\s+(?:to|as)\s+(.+)/i,/rename\s+(?:to|as)\s+(.+)/i,/update\s+(?:voice\s+)?profile\s+(?:name\s+)?(?:to|as)\s+(.+)/i];for(let s of t){let i=e.match(s);if(i&&i[1]){let r=i[1].trim();if((r.startsWith('"')&&r.endsWith('"')||r.startsWith("'")&&r.endsWith("'"))&&(r=r.slice(1,-1)),r=r.replace(/[.!?]+$/,"").trim(),r.length>0&&r.length<=100)return{action:"rename",name:r,raw:e}}}return{action:"unknown",raw:e}}var ht=C(require("fs")),Yi=C(require("path")),Fs=C(require("os"));var vl=[{id:"ai.delve",category:"ai-slop",severity:"red",regex:/\bdelve\b/gi,suggestion:"use a specific verb: dig, explore, look at",autoFixable:!0},{id:"ai.leverage",category:"ai-slop",severity:"red",regex:/\bleverage\b/gi,suggestion:"use: use, apply, build on",autoFixable:!0},{id:"ai.tapestry",category:"ai-slop",severity:"red",regex:/\btapestry\b/gi,suggestion:"be specific about what you mean",autoFixable:!0},{id:"ai.holistic",category:"ai-slop",severity:"red",regex:/\bholistic\b/gi,suggestion:"describe the actual approach",autoFixable:!0},{id:"ai.robust",category:"ai-slop",severity:"yellow",regex:/\brobust\b/gi,suggestion:"say what actually makes it strong",autoFixable:!0},{id:"ai.pivotal",category:"ai-slop",severity:"yellow",regex:/\bpivotal\b/gi,suggestion:"say why it matters specifically",autoFixable:!0},{id:"ai.foster",category:"ai-slop",severity:"yellow",regex:/\bfoster\b/gi,suggestion:"use: build, grow, encourage, support",autoFixable:!0},{id:"ai.harness",category:"ai-slop",severity:"yellow",regex:/\bharness\b/gi,suggestion:"use: use, apply, work with",autoFixable:!0},{id:"ai.illuminate",category:"ai-slop",severity:"yellow",regex:/\billuminate\b/gi,suggestion:"use: show, explain, highlight",autoFixable:!0},{id:"ai.ever-evolving",category:"ai-slop",severity:"red",regex:/\b(?:ever[\s-]evolving|ever[\s-]changing)\b/gi,suggestion:"cut this \u2014 it says nothing",autoFixable:!0},{id:"ai.fast-paced",category:"ai-slop",severity:"red",regex:/\bfast[\s-]paced\b/gi,suggestion:"cut this \u2014 every industry says this",autoFixable:!0},{id:"ai.game-changer",category:"ai-slop",severity:"red",regex:/\bgame[\s-]changer\b/gi,suggestion:"explain what actually changed",autoFixable:!0},{id:"ai.paradigm",category:"ai-slop",severity:"red",regex:/\bparadigm\b/gi,suggestion:"describe the actual shift",autoFixable:!0},{id:"ai.synergy",category:"ai-slop",severity:"red",regex:/\bsynergy\b/gi,suggestion:"describe what works together and why",autoFixable:!0},{id:"ai.ecosystem",category:"ai-slop",severity:"yellow",regex:/\becosystem\b/gi,suggestion:"name the specific tools/partners/platforms",autoFixable:!0},{id:"ai.seamless",category:"ai-slop",severity:"yellow",regex:/\bseamless\b/gi,suggestion:"describe how it actually works",autoFixable:!0},{id:"ai.actionable",category:"ai-slop",severity:"yellow",regex:/\bactionable\b/gi,suggestion:"just give the action, don't label it",autoFixable:!0},{id:"ai.granular",category:"ai-slop",severity:"yellow",regex:/\bgranular\b/gi,suggestion:"say: specific, detailed, or name the level",autoFixable:!0},{id:"ai.impactful",category:"ai-slop",severity:"yellow",regex:/\bimpactful\b/gi,suggestion:"describe the actual impact",autoFixable:!0},{id:"ai.transform",category:"ai-slop",severity:"yellow",regex:/\btransform\b/gi,suggestion:"describe what specifically changed",autoFixable:!1},{id:"ai.empower",category:"ai-slop",severity:"yellow",regex:/\bempower\b/gi,suggestion:"describe what people can actually do",autoFixable:!0},{id:"ai.unlock",category:"ai-slop",severity:"yellow",regex:/\bunlock\b/gi,suggestion:"describe what they get access to",autoFixable:!0},{id:"ai.nuanced",category:"ai-slop",severity:"yellow",regex:/\bnuanced\b/gi,suggestion:"explain the specific complexity",autoFixable:!0},{id:"ai.multifaceted",category:"ai-slop",severity:"red",regex:/\bmultifaceted\b/gi,suggestion:"name the specific aspects",autoFixable:!0},{id:"ai.comprehensive",category:"ai-slop",severity:"yellow",regex:/\bcomprehensive\b/gi,suggestion:"say what it covers specifically",autoFixable:!1},{id:"ai.innovative",category:"ai-slop",severity:"yellow",regex:/\binnovative\b/gi,suggestion:"describe what's actually new",autoFixable:!0},{id:"ai.cut[t]?ing-edge",category:"ai-slop",severity:"red",regex:/\bcut(?:t)?ing[\s-]edge\b/gi,suggestion:"name the specific technology",autoFixable:!0},{id:"ai.state-of-the-art",category:"ai-slop",severity:"red",regex:/\bstate[\s-]of[\s-]the[\s-]art\b/gi,suggestion:"describe what makes it current",autoFixable:!0},{id:"ai.best-practices",category:"ai-slop",severity:"yellow",regex:/\bbest[\s-]practices?\b/gi,suggestion:"name the specific practice",autoFixable:!1},{id:"ai.world-class",category:"ai-slop",severity:"red",regex:/\bworld[\s-]class\b/gi,suggestion:"prove it with specifics",autoFixable:!0},{id:"ai.second-to-none",category:"ai-slop",severity:"red",regex:/\bsecond[\s-]to[\s-]none\b/gi,suggestion:"drop the superlative, show the work",autoFixable:!0}],xl=[{id:"formula.firstly",category:"ai-slop",severity:"yellow",regex:/\bfirstly\b/gi,suggestion:'just start \u2014 "firstly" is filler',autoFixable:!0},{id:"formula.secondly",category:"ai-slop",severity:"yellow",regex:/\bsecondly\b/gi,suggestion:'just continue \u2014 "secondly" is filler',autoFixable:!0},{id:"formula.lastly",category:"ai-slop",severity:"yellow",regex:/\blastly\b/gi,suggestion:'just end \u2014 "lastly" is filler',autoFixable:!0},{id:"formula.moreover",category:"ai-slop",severity:"yellow",regex:/\bmoreover\b/gi,suggestion:"just add the point",autoFixable:!0},{id:"formula.furthermore",category:"ai-slop",severity:"yellow",regex:/\bfurthermore\b/gi,suggestion:"just add the point",autoFixable:!0},{id:"formula.in-conclusion",category:"ai-slop",severity:"red",regex:/\bin conclusion\b/gi,suggestion:"just end. readers know it's the end.",autoFixable:!0},{id:"formula.in-summary",category:"ai-slop",severity:"red",regex:/\bin summary\b/gi,suggestion:"just summarize. the label is redundant.",autoFixable:!0},{id:"formula.it-is-important",category:"ai-slop",severity:"yellow",regex:/\bit is important to note\b/gi,suggestion:"just note it. skip the preamble.",autoFixable:!0},{id:"formula.at-the-end",category:"ai-slop",severity:"yellow",regex:/\bat the end of the day\b/gi,suggestion:"cut this \u2014 it means nothing",autoFixable:!0},{id:"formula.needless-to-say",category:"ai-slop",severity:"yellow",regex:/\bneedless to say\b/gi,suggestion:"if it's needless, don't say it",autoFixable:!0},{id:"formula.it-goes-without",category:"ai-slop",severity:"yellow",regex:/\bit goes without saying\b/gi,suggestion:"then don't say it",autoFixable:!0},{id:"formula.in-today",category:"ai-slop",severity:"red",regex:/\bin today'?s\b/gi,suggestion:"start with your actual point instead",autoFixable:!0},{id:"formula.lets-dive",category:"ai-slop",severity:"red",regex:/\blet'?s (?:dive|jump|dig|delve)\b/gi,suggestion:"just start. no diving needed.",autoFixable:!0},{id:"formula.without-further",category:"ai-slop",severity:"red",regex:/\bwithout further ado\b/gi,suggestion:"cut this \u2014 just get to it",autoFixable:!0},{id:"formula.its-worth-noting",category:"ai-slop",severity:"yellow",regex:/\bit'?s worth noting\b/gi,suggestion:"just note it directly",autoFixable:!0}],Sl=[{id:"hedge.some-might",category:"voice-drift",severity:"yellow",regex:/\bsome might say\b/gi,suggestion:"commit to the claim or drop it",autoFixable:!0},{id:"hedge.arguably",category:"voice-drift",severity:"yellow",regex:/\barguably\b/gi,suggestion:"commit. say it or don't.",autoFixable:!0},{id:"hedge.worth-noting",category:"voice-drift",severity:"yellow",regex:/\bit'?s worth noting\b/gi,suggestion:"just note it directly",autoFixable:!0},{id:"hedge.to-some-extent",category:"voice-drift",severity:"yellow",regex:/\bto some extent\b/gi,suggestion:"be specific about the extent",autoFixable:!0},{id:"hedge.perhaps",category:"voice-drift",severity:"yellow",regex:/\bperhaps\b/gi,suggestion:"commit or cut",autoFixable:!0},{id:"hedge.maybe",category:"voice-drift",severity:"yellow",regex:/\bmaybe\b/gi,suggestion:"commit or cut",autoFixable:!0},{id:"hedge.possibly",category:"voice-drift",severity:"yellow",regex:/\bpossibly\b/gi,suggestion:"commit or cut",autoFixable:!1},{id:"hedge.it-seems",category:"voice-drift",severity:"yellow",regex:/\bit seems\b/gi,suggestion:"state it directly",autoFixable:!0},{id:"hedge.i-think",category:"voice-drift",severity:"yellow",regex:/\bi think\b/gi,suggestion:'just say it. the "i think" is implied.',autoFixable:!0},{id:"hedge.in-my-opinion",category:"voice-drift",severity:"yellow",regex:/\bin my opinion\b/gi,suggestion:"just state it. it's your article.",autoFixable:!0}],_l=[{id:"struct.antithesis",category:"structure",severity:"yellow",regex:/\bnot (?:just|only) .{3,50}, but .{3,50}/gi,suggestion:"this antithesis pattern is an AI tell \u2014 restructure",autoFixable:!1},{id:"struct.not-just-but-also",category:"structure",severity:"yellow",regex:/\bnot\s+just\b.{3,80}\bbut\s+(?:also\s+)?/gi,suggestion:"say what it IS, not what it isn't",autoFixable:!1},{id:"struct.more-than-just",category:"structure",severity:"yellow",regex:/\bmore\s+than\s+just\b/gi,suggestion:"say what it IS, not what it isn't",autoFixable:!1},{id:"struct.in-order-to",category:"structure",severity:"yellow",regex:/\bin order to\b/gi,suggestion:'just use "to"',autoFixable:!0},{id:"struct.due-to-the-fact",category:"structure",severity:"yellow",regex:/\bdue to the fact that\b/gi,suggestion:'use "because"',autoFixable:!0},{id:"struct.for-the-purpose",category:"structure",severity:"yellow",regex:/\bfor the purpose of\b/gi,suggestion:'use "to"',autoFixable:!0},{id:"struct.which-is-another",category:"structure",severity:"red",regex:/\bwhich is another way of saying\b/gi,suggestion:"just say the thing directly",autoFixable:!1},{id:"struct.in-other-words",category:"structure",severity:"red",regex:/\bin other words\b/gi,suggestion:"just say it once, well",autoFixable:!1},{id:"struct.rhetorical-truth",category:"structure",severity:"yellow",regex:/\b(?:the\s+)?(?:uncomfortable|hard|harsh|brutal|ugly|unsexy|real|honest)\s+(?:truth|reality)\b/gi,suggestion:"state the fact directly, skip the framing",autoFixable:!1},{id:"struct.truth-is",category:"structure",severity:"yellow",regex:/\bthe\s+truth\s+is\b/gi,suggestion:"just say the truth. the framing is filler.",autoFixable:!1},{id:"struct.lesson-setup",category:"structure",severity:"yellow",regex:/\b(?:here'?s\s+)?what\s+.{3,80}\s+(?:taught|teaches)\s+(?:me|us|you|everyone)\b/gi,suggestion:"just share the lesson",autoFixable:!1},{id:"struct.negation-cascade",category:"structure",severity:"yellow",regex:/\b(?:no|not)\s+\w[^.!?\n]{0,80}[.!?][ \t]*\n?[ \t]*(?:no|not)\s+\w[^.!?\n]{0,80}[.!?][ \t]*\n?[ \t]*(?:no|not)\s+\w/gi,suggestion:"three negations in a row reads like AI performance",autoFixable:!1},{id:"struct.inline-triplet",category:"structure",severity:"yellow",regex:/\bit'?s\s+\w[^,.!?;\n]{0,30},\s*it'?s\s+\w[^,.!?;\n]{0,30}[,.]?\s*(?:and\s+)?it'?s\b/gi,suggestion:`the "it's X, it's Y, it's Z" pattern is an AI tell`,autoFixable:!1},{id:"struct.moment-becomes",category:"structure",severity:"red",regex:/\b(?:the\s+)?moment\b.{3,80}\bbecomes?\b/gi,suggestion:'"the moment X becomes Y" is polished founder cadence \u2014 restructure',autoFixable:!1},{id:"struct.same-better",category:"structure",severity:"red",regex:/\bsame\s+[^.!?\n]{1,35}[.!?]\s*(?:better|nicer|cleaner|calmer|safer)\s+[^.!?\n]{1,35}[.!?]?/gi,suggestion:'"same X. better Y." is screenshot-ready founder cadence',autoFixable:!1},{id:"struct.this-is-why",category:"structure",severity:"yellow",regex:/\bthis\s+is\s+(?:also\s+)?(?:why|how|where|what\b)/gi,suggestion:"signpost claims are AI tells \u2014 just make the point",autoFixable:!1},{id:"struct.heres-where",category:"structure",severity:"yellow",regex:/\b(?:here'?s|here\s+is)\s+(?:where|why|what|the\s+part|the\s+(?:harder|real|actual|main|bigger)\s+problem)\b/gi,suggestion:"just make the point without the signpost",autoFixable:!1},{id:"struct.generic-buyer",category:"structure",severity:"red",regex:/\bpeople\s+don'?t\s+just\s+buy\b|\bpeople\s+buy\s+the\s+feeling\b/gi,suggestion:"generic buyer psychology is AI filler",autoFixable:!1}],Cl=[{id:"punct.em-dash",category:"ai-slop",severity:"yellow",regex:/—/g,suggestion:"em dashes are an AI tell \u2014 use a period, comma, or parentheses",autoFixable:!1}],kl=[...vl,...xl,...Sl,..._l,...Cl],Pr={delve:"dig",leverage:"use",tapestry:"web",holistic:"complete",robust:"strong",pivotal:"key",foster:"build",harness:"use",illuminate:"show","ever-evolving":"changing",everchanging:"changing","fast-paced":"fast","game-changer":"breakthrough",paradigm:"model",synergy:"fit",ecosystem:"network",seamless:"smooth",actionable:"practical",granular:"specific",impactful:"effective",empower:"enable",unlock:"open",nuanced:"complex",multifaceted:"complex",innovative:"new","cutting-edge":"modern","state-of-the-art":"modern","world-class":"excellent","second-to-none":"best",firstly:"",secondly:"",lastly:"",moreover:"",furthermore:"",perhaps:"",arguably:""};function El(n){let t=n.split(/[.!?]+/).filter(o=>o.trim().length>0).map(o=>o.trim().split(/\s+/).length),s=t.length>0?t.reduce((o,a)=>o+a,0)/t.length:0,i=t.length>1?Math.sqrt(t.reduce((o,a)=>o+Math.pow(a-s,2),0)/t.length):0,r="low";return i>8?r="high":i>4&&(r="medium"),{avgWords:s,variance:r,sentences:t}}function Ol(n){let e=[],t=n.split(`
329
- `),s=t.findIndex(r=>r.trim().length>10);if(s<0)return e;let i=t[s].trim().toLowerCase();return(i.endsWith("?")||/^(?:have you|do you|did you|what if|why do|how do|what's|how's)\b/.test(i))&&e.push({id:"voice.question-opener",line:s+1,column:1,category:"voice-drift",severity:"yellow",rule:"Opens with a question instead of a concrete observation",match:i.slice(0,80),excerpt:t[s].trim().slice(0,120),suggestion:"Open with a concrete observation, moment, mechanism, or pattern",autoFixable:!1}),/^(?:the most important thing|the key to|success is|if you want to|what i learned|here's what|the biggest mistake)\b/.test(i)&&e.push({id:"voice.lesson-opener",line:s+1,column:1,category:"voice-drift",severity:"yellow",rule:"Opens with a lesson or inspirational claim",match:i.slice(0,80),excerpt:t[s].trim().slice(0,120),suggestion:"Open with something concrete and specific, not a lesson",autoFixable:!1}),/^(?:most|many)\s+(?:brands|teams|people|founders|companies|businesses)\b/.test(i)&&e.push({id:"voice.generic-generalization",line:s+1,column:1,category:"voice-drift",severity:"yellow",rule:"Opens with a generic generalization",match:i.slice(0,80),excerpt:t[s].trim().slice(0,120),suggestion:"Start with a specific observation, not a sweeping claim",autoFixable:!1}),e}function Al(n){let e=[],t=n.split(`
330
- `),s=[];for(let i=0;i<t.length;i++){let r=t[i].trim();if(r.length<10||r.startsWith("#")||r.startsWith("```"))continue;let o=r.split(/(?<=[.!?])\s+/);for(let a of o){let l=a.trim().split(/\s+/).filter(c=>c.length>0);l.length>0&&l.length<=5?(s.push({line:i+1,text:a.trim()}),s.length>=3&&(e.push({id:"voice.staccato-triplet",line:s[0].line,column:1,category:"cadence",severity:"yellow",rule:"Three short sentences in a row reads like performance",match:s.map(c=>c.text).join(" | "),excerpt:s[0].text,suggestion:"Vary sentence length \u2014 short staccato runs feel like AI trying to sound punchy",autoFixable:!1}),s=[])):s=[]}}return e}var Fl=new Set(["alignment","authenticity","awareness","clarity","confidence","consistency","differentiation","execution","framework","identity","messaging","narrative","personality","positioning","preference","presence","recall","relevance","resonance","signal","strategy","trust","utility","value"]);function $l(n,e){let t=[];return(n.toLowerCase().match(/[a-z']+/g)||[]).filter(r=>Fl.has(r)).length>=3&&!/\b(?:for example|for instance|such as)\b|\d/i.test(n)&&t.push({id:"voice.abstract-cluster",line:e,column:1,category:"voice-drift",severity:"yellow",rule:"Abstract noun cluster \u2014 reads like a strategy deck",match:n.trim().slice(0,80),excerpt:n.trim().slice(0,120),suggestion:"Ground in specifics \u2014 name the thing, show the number, quote the person",autoFixable:!1}),t}function Pl(n,e,t){let s=[],i=n.toLowerCase();for(let r of t){if(!r)continue;let o=r.toLowerCase().trim();i.includes(o)&&s.push({id:"voice.never-list",line:e,column:i.indexOf(o)+1,category:"voice-drift",severity:"red",rule:`Never-list violation: "${r}"`,match:o,excerpt:n.trim().slice(0,120),suggestion:`Your voice profile explicitly bans "${r}" \u2014 restructure`,autoFixable:!1})}return s}function Rl(n,e,t){let s=[],i=n.toLowerCase();for(let r of t){if(!r.text)continue;let a=r.text.toLowerCase().trim().split(/\s+/);if(a.length<3)continue;let l=a.slice(0,4).join(" ");i.includes(l)&&s.push({id:`learned.${r.type}`,line:e,column:i.indexOf(l)+1,category:"learned",severity:"yellow",rule:`Learned pattern (${r.type}): "${r.text.slice(0,60)}"`,match:l,excerpt:n.trim().slice(0,120),suggestion:"Your editing history suggests this pattern should be rewritten",autoFixable:!1})}return s}function Tl(n){let e=new Set;for(let t of n)t.status==="accepted"&&t.rule_id&&e.add(t.rule_id),t.status==="dismissed"&&t.accept_rate!==void 0&&t.accept_rate<.25&&e.add(t.rule_id);return e}function ns(n,e){let t=n.split(`
331
- `),s=[],i=new Map,r=new Map,o=e?.drift_snapshot?Tl(e.drift_snapshot):new Set,a=e?.never_list||[],l=e?.learned_patterns||[];for(let d=0;d<t.length;d++){let g=t[d],p=d+1;if(!g.startsWith("```")&&!g.startsWith("---")&&!g.startsWith("#")&&!(g.trim().length<10)){for(let y of kl){y.regex.lastIndex=0;let m;for(;(m=y.regex.exec(g))!==null;){let x=o.has(y.id);s.push({id:y.id,line:p,column:m.index+1,category:y.category,severity:x?"yellow":y.severity,rule:y.suggestion,match:m[0],excerpt:Ml(g.trim(),m.index,m[0].length),suggestion:y.suggestion,autoFixable:y.autoFixable,driftAccepted:x})}}s.push(...$l(g,p)),s.push(...Pl(g,p,a)),s.push(...Rl(g,p,l))}}s.push(...Ol(n)),s.push(...Al(n));for(let d of s)i.has(d.line)||i.set(d.line,[]),i.get(d.line).push(d),r.has(d.id)||r.set(d.id,[]),r.get(d.id).push(d);let c=s.filter(d=>d.severity==="red").length,u=s.filter(d=>d.severity==="yellow").length,h=s.filter(d=>d.autoFixable).length,f=s.filter(d=>d.driftAccepted).length;return{signals:s,byLine:i,byRule:r,summary:{red:c,yellow:u,autoFixable:h,driftAccepted:f,total:s.length}}}function Rr(n,e){let{avgWords:t,variance:s}=El(n);if(!e?.avg_words)return 100;let i=e.avg_words,r=Math.abs(t-i)/i,o=Math.max(0,Math.round((1-r)*100));return e.variance&&s===e.variance?o=Math.min(100,o+10):e.variance&&s!==e.variance&&(o=Math.max(0,o-10)),o}function Ml(n,e,t){let s=n.slice(0,e),i=n.slice(e,e+t),r=n.slice(e+t);return`${s}\xAB${i}\xBB${r}`.slice(0,120)}function Tr(n){let e=n.byLine,t=[];for(let[c,u]of e){let h=u.filter(y=>!y.driftAccepted);if(h.length===0){t.push({line:c,signals:u,strategy:"skip",priority:0,instruction:"All issues on this line are consistently dismissed by user"});continue}let f=h.map(y=>jl(y)),d=Dl(f),g=Il(c,h,d),p=d==="auto_fix"?Ll(c,h):void 0;t.push({line:c,signals:h,strategy:d,priority:Nl(h,d),instruction:g,autoFixText:p})}let s=t.filter(c=>c.strategy==="auto_fix"),i=t.filter(c=>c.strategy==="restructure"||c.strategy==="voice_drift"),r=t.filter(c=>c.strategy==="skip"),o=Math.max(1,n.summary.total>0?new Set(n.signals.map(c=>c.line)).size:0),a=t.filter(c=>c.strategy!=="skip").length,l=Math.max(0,Math.round((o-a)/Math.max(1,o)*100));return{issues:t,autoFixes:s,llmFixes:i,skipped:r,stats:{total:t.length,autoFixable:s.length,needsLLM:i.length,skipped:r.length,score:l}}}function jl(n){return n.driftAccepted?"skip":n.autoFixable&&n.category==="ai-slop"||n.autoFixable&&n.category==="voice-drift"?"auto_fix":n.category==="voice-drift"||n.category==="cadence"||n.category==="learned"?"voice_drift":(n.category==="structure","restructure")}function Dl(n){return n.includes("restructure")?"restructure":n.includes("voice_drift")?"voice_drift":n.includes("auto_fix")?"auto_fix":"skip"}function Nl(n,e){let t=0,s=n.filter(r=>r.severity==="red").length,i=n.filter(r=>r.severity==="yellow").length;return t+=s*10+i*5,e==="restructure"&&(t+=20),e==="voice_drift"&&(t+=15),e==="auto_fix"&&(t+=5),t}function Il(n,e,t){let s=[...new Set(e.map(r=>r.rule))],i=e.filter(r=>r.severity==="red");if(t==="auto_fix")return`Replace AI-slop words: ${s.join("; ")}`;if(t==="restructure"){let r=e.map(o=>o.match).filter(Boolean).slice(0,3);return`Restructure line ${n}: ${s[0]||"structural issue"}. Patterns: ${r.join(", ")}`}return t==="voice_drift"?`Rewrite line ${n} to match voice profile: ${s[0]||"voice drift"}`:`Review line ${n}`}function Ll(n,e){return e.filter(s=>s.autoFixable).map(s=>s.id).join(",")}function Mr(n,e){let t=n.split(`
332
- `),s=[];for(let i of e){if(i.strategy!=="auto_fix")continue;let r=i.line-1;if(r<0||r>=t.length)continue;let o=t[r],a=o;for(let l of i.signals){if(!l.autoFixable)continue;let c=Pr[l.match.toLowerCase()];if(c!==void 0){let u=new RegExp(Wl(l.match),"gi");a=a.replace(u,h=>c===""?"":h[0]===h[0].toUpperCase()?c.charAt(0).toUpperCase()+c.slice(1):c)}}a=a.replace(/\s{2,}/g," ").trim(),a!==o&&(s.push({line:i.line,before:o,after:a,rule:i.signals.map(l=>l.id).join(", ")}),t[r]=a)}return{original:n,fixed:t.join(`
333
- `),changes:s,changed:s.length>0}}function Wl(n){return n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}vi();oe();var fe=C(require("fs")),_i=C(require("path")),Lr=C(require("os")),Nr=5*60*1e3,os=new Map;async function Si(n,e={}){let t=e.includeSamples!==!1,s=e.forceRefresh||!1;if(!s){let r=os.get(n);if(r&&Date.now()-r.timestamp<Nr)return r.data}let i=Hr(n);return i&&!s?Date.now()-i.timestamp<Nr?(os.set(n,i),i.data):(os.set(n,i),Vl(n).catch(()=>{}),i.data):Ir(n)}async function Ir(n){try{let e=await rs(`/cli/profiles/${encodeURIComponent(n)}/full`),t={id:e.profile.id,name:e.profile.name,slug:e.profile.slug,brand:e.profile.brand,keywords:e.profile.keywords,description:e.profile.description,body:e.body,drift_snapshot:e.drift_snapshot||[],learned_patterns:e.learned_patterns||[],voice_samples:e.voice_samples||[],voice_rules:e.voice_rules||[],never_list:e.never_list||[],cadence:e.cadence||{}},s={data:t,timestamp:Date.now(),version:1};return os.set(n,s),ql(n,s),t}catch{let t=Hr(n);if(t)return t.data;let s=Ne(n);if(s)return Ul(n,s);throw new Error(`Profile not found: ${n}. Run: hyv init`)}}async function Vl(n){try{await Ir(n)}catch{}}var xi=_i.join(Lr.homedir(),".hyv","cache","profiles");function Wr(n){return _i.join(xi,`${n.replace(/[^a-z0-9-]/gi,"_")}.json`)}function Hr(n){try{let e=Wr(n);if(!fe.existsSync(e))return null;let t=fe.readFileSync(e,"utf-8"),s=JSON.parse(t);return!s.data||!s.timestamp?null:s}catch{return null}}function ql(n,e){try{fe.existsSync(xi)||fe.mkdirSync(xi,{recursive:!0}),fe.writeFileSync(Wr(n),JSON.stringify(e),"utf-8")}catch{}}function Ul(n,e){return{id:"",name:n,slug:n,body:e,drift_snapshot:[],learned_patterns:[],voice_samples:[],voice_rules:[],never_list:[],cadence:{}}}function Ci(){return Yt().profile}var ct=C(require("fs")),Ui=C(require("path"));var ki=(n,e,t)=>{let s=n instanceof RegExp?Br(n,t):n,i=e instanceof RegExp?Br(e,t):e,r=s!==null&&i!=null&&zl(s,i,t);return r&&{start:r[0],end:r[1],pre:t.slice(0,r[0]),body:t.slice(r[0]+s.length,r[1]),post:t.slice(r[1]+i.length)}},Br=(n,e)=>{let t=e.match(n);return t?t[0]:null},zl=(n,e,t)=>{let s,i,r,o,a,l=t.indexOf(n),c=t.indexOf(e,l+1),u=l;if(l>=0&&c>0){if(n===e)return[l,c];for(s=[],r=t.length;u>=0&&!a;){if(u===l)s.push(u),l=t.indexOf(n,u+1);else if(s.length===1){let h=s.pop();h!==void 0&&(a=[h,c])}else i=s.pop(),i!==void 0&&i<r&&(r=i,o=c),c=t.indexOf(e,u+1);u=l<c&&l>=0?l:c}s.length&&o!==void 0&&(a=[r,o])}return a};var Vr="\0SLASH"+Math.random()+"\0",qr="\0OPEN"+Math.random()+"\0",Oi="\0CLOSE"+Math.random()+"\0",Ur="\0COMMA"+Math.random()+"\0",zr="\0PERIOD"+Math.random()+"\0",Gl=new RegExp(Vr,"g"),Yl=new RegExp(qr,"g"),Jl=new RegExp(Oi,"g"),Kl=new RegExp(Ur,"g"),Xl=new RegExp(zr,"g"),Ql=/\\\\/g,Zl=/\\{/g,ec=/\\}/g,tc=/\\,/g,sc=/\\\./g,ic=1e5;function Ei(n){return isNaN(n)?n.charCodeAt(0):parseInt(n,10)}function nc(n){return n.replace(Ql,Vr).replace(Zl,qr).replace(ec,Oi).replace(tc,Ur).replace(sc,zr)}function rc(n){return n.replace(Gl,"\\").replace(Yl,"{").replace(Jl,"}").replace(Kl,",").replace(Xl,".")}function Gr(n){if(!n)return[""];let e=[],t=ki("{","}",n);if(!t)return n.split(",");let{pre:s,body:i,post:r}=t,o=s.split(",");o[o.length-1]+="{"+i+"}";let a=Gr(r);return r.length&&(o[o.length-1]+=a.shift(),o.push.apply(o,a)),e.push.apply(e,o),e}function Yr(n,e={}){if(!n)return[];let{max:t=ic}=e;return n.slice(0,2)==="{}"&&(n="\\{\\}"+n.slice(2)),wt(nc(n),t,!0).map(rc)}function oc(n){return"{"+n+"}"}function ac(n){return/^-?0\d/.test(n)}function lc(n,e){return n<=e}function cc(n,e){return n>=e}function wt(n,e,t){let s=[],i=ki("{","}",n);if(!i)return[n];let r=i.pre,o=i.post.length?wt(i.post,e,!1):[""];if(/\$$/.test(i.pre))for(let a=0;a<o.length&&a<e;a++){let l=r+"{"+i.body+"}"+o[a];s.push(l)}else{let a=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(i.body),l=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(i.body),c=a||l,u=i.body.indexOf(",")>=0;if(!c&&!u)return i.post.match(/,(?!,).*\}/)?(n=i.pre+"{"+i.body+Oi+i.post,wt(n,e,!0)):[n];let h;if(c)h=i.body.split(/\.\./);else if(h=Gr(i.body),h.length===1&&h[0]!==void 0&&(h=wt(h[0],e,!1).map(oc),h.length===1))return o.map(d=>i.pre+h[0]+d);let f;if(c&&h[0]!==void 0&&h[1]!==void 0){let d=Ei(h[0]),g=Ei(h[1]),p=Math.max(h[0].length,h[1].length),y=h.length===3&&h[2]!==void 0?Math.max(Math.abs(Ei(h[2])),1):1,m=lc;g<d&&(y*=-1,m=cc);let _=h.some(ac);f=[];for(let w=d;m(w,g)&&f.length<e;w+=y){let b;if(l)b=String.fromCharCode(w),b==="\\"&&(b="");else if(b=String(w),_){let P=p-b.length;if(P>0){let Q=new Array(P+1).join("0");w<0?b="-"+Q+b.slice(1):b=Q+b}}f.push(b)}}else{f=[];for(let d=0;d<h.length;d++)f.push.apply(f,wt(h[d],e,!1))}for(let d=0;d<f.length;d++)for(let g=0;g<o.length&&s.length<e;g++){let p=r+f[d]+o[g];(!t||c||p)&&s.push(p)}}return s}var vt=n=>{if(typeof n!="string")throw new TypeError("invalid pattern");if(n.length>65536)throw new TypeError("pattern is too long")};var hc={"[:alnum:]":["\\p{L}\\p{Nl}\\p{Nd}",!0],"[:alpha:]":["\\p{L}\\p{Nl}",!0],"[:ascii:]":["\\x00-\\x7f",!1],"[:blank:]":["\\p{Zs}\\t",!0],"[:cntrl:]":["\\p{Cc}",!0],"[:digit:]":["\\p{Nd}",!0],"[:graph:]":["\\p{Z}\\p{C}",!0,!0],"[:lower:]":["\\p{Ll}",!0],"[:print:]":["\\p{C}",!0],"[:punct:]":["\\p{P}",!0],"[:space:]":["\\p{Z}\\t\\r\\n\\v\\f",!0],"[:upper:]":["\\p{Lu}",!0],"[:word:]":["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}",!0],"[:xdigit:]":["A-Fa-f0-9",!1]},xt=n=>n.replace(/[[\]\\-]/g,"\\$&"),uc=n=>n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),Jr=n=>n.join(""),Kr=(n,e)=>{let t=e;if(n.charAt(t)!=="[")throw new Error("not in a brace expression");let s=[],i=[],r=t+1,o=!1,a=!1,l=!1,c=!1,u=t,h="";e:for(;r<n.length;){let p=n.charAt(r);if((p==="!"||p==="^")&&r===t+1){c=!0,r++;continue}if(p==="]"&&o&&!l){u=r+1;break}if(o=!0,p==="\\"&&!l){l=!0,r++;continue}if(p==="["&&!l){for(let[y,[m,x,_]]of Object.entries(hc))if(n.startsWith(y,r)){if(h)return["$.",!1,n.length-t,!0];r+=y.length,_?i.push(m):s.push(m),a=a||x;continue e}}if(l=!1,h){p>h?s.push(xt(h)+"-"+xt(p)):p===h&&s.push(xt(p)),h="",r++;continue}if(n.startsWith("-]",r+1)){s.push(xt(p+"-")),r+=2;continue}if(n.startsWith("-",r+1)){h=p,r+=2;continue}s.push(xt(p)),r++}if(u<r)return["",!1,0,!1];if(!s.length&&!i.length)return["$.",!1,n.length-t,!0];if(i.length===0&&s.length===1&&/^\\?.$/.test(s[0])&&!c){let p=s[0].length===2?s[0].slice(-1):s[0];return[uc(p),!1,u-t,!1]}let f="["+(c?"^":"")+Jr(s)+"]",d="["+(c?"":"^")+Jr(i)+"]";return[s.length&&i.length?"("+f+"|"+d+")":s.length?f:d,a,u-t,!0]};var de=(n,{windowsPathsNoEscape:e=!1,magicalBraces:t=!0}={})=>t?e?n.replace(/\[([^/\\])\]/g,"$1"):n.replace(/((?!\\).|^)\[([^/\\])\]/g,"$1$2").replace(/\\([^/])/g,"$1"):e?n.replace(/\[([^/\\{}])\]/g,"$1"):n.replace(/((?!\\).|^)\[([^/\\{}])\]/g,"$1$2").replace(/\\([^/{}])/g,"$1");var Z,fc=new Set(["!","?","+","*","@"]),Ai=n=>fc.has(n),Xr=n=>Ai(n.type),dc=new Map([["!",["@"]],["?",["?","@"]],["@",["@"]],["*",["*","+","?","@"]],["+",["+","@"]]]),pc=new Map([["!",["?"]],["@",["?"]],["+",["?","*"]]]),gc=new Map([["!",["?","@"]],["?",["?","@"]],["@",["?","@"]],["*",["*","+","?","@"]],["+",["+","@","?","*"]]]),Qr=new Map([["!",new Map([["!","@"]])],["?",new Map([["*","*"],["+","*"]])],["@",new Map([["!","!"],["?","?"],["@","@"],["*","*"],["+","+"]])],["+",new Map([["?","*"],["*","*"]])]]),mc="(?!(?:^|/)\\.\\.?(?:$|/))",as="(?!\\.)",yc=new Set(["[","."]),bc=new Set(["..","."]),wc=new Set("().*{}+?[]^$\\!"),vc=n=>n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),Fi="[^/]",Zr=Fi+"*?",eo=Fi+"+?",xc=0,He=class{type;#e;#i;#n=!1;#t=[];#o;#_;#b;#u=!1;#a;#f;#h=!1;id=++xc;get depth(){return(this.#o?.depth??-1)+1}[Symbol.for("nodejs.util.inspect.custom")](){return{"@@type":"AST",id:this.id,type:this.type,root:this.#e.id,parent:this.#o?.id,depth:this.depth,partsLength:this.#t.length,parts:this.#t}}constructor(e,t,s={}){this.type=e,e&&(this.#i=!0),this.#o=t,this.#e=this.#o?this.#o.#e:this,this.#a=this.#e===this?s:this.#e.#a,this.#b=this.#e===this?[]:this.#e.#b,e==="!"&&!this.#e.#u&&this.#b.push(this),this.#_=this.#o?this.#o.#t.length:0}get hasMagic(){if(this.#i!==void 0)return this.#i;for(let e of this.#t)if(typeof e!="string"&&(e.type||e.hasMagic))return this.#i=!0;return this.#i}toString(){return this.#f!==void 0?this.#f:this.type?this.#f=this.type+"("+this.#t.map(e=>String(e)).join("|")+")":this.#f=this.#t.map(e=>String(e)).join("")}#c(){if(this!==this.#e)throw new Error("should only call on root");if(this.#u)return this;this.toString(),this.#u=!0;let e;for(;e=this.#b.pop();){if(e.type!=="!")continue;let t=e,s=t.#o;for(;s;){for(let i=t.#_+1;!s.type&&i<s.#t.length;i++)for(let r of e.#t){if(typeof r=="string")throw new Error("string part in extglob AST??");r.copyIn(s.#t[i])}t=s,s=t.#o}}return this}push(...e){for(let t of e)if(t!==""){if(typeof t!="string"&&!(t instanceof Z&&t.#o===this))throw new Error("invalid part: "+t);this.#t.push(t)}}toJSON(){let e=this.type===null?this.#t.slice().map(t=>typeof t=="string"?t:t.toJSON()):[this.type,...this.#t.map(t=>t.toJSON())];return this.isStart()&&!this.type&&e.unshift([]),this.isEnd()&&(this===this.#e||this.#e.#u&&this.#o?.type==="!")&&e.push({}),e}isStart(){if(this.#e===this)return!0;if(!this.#o?.isStart())return!1;if(this.#_===0)return!0;let e=this.#o;for(let t=0;t<this.#_;t++){let s=e.#t[t];if(!(s instanceof Z&&s.type==="!"))return!1}return!0}isEnd(){if(this.#e===this||this.#o?.type==="!")return!0;if(!this.#o?.isEnd())return!1;if(!this.type)return this.#o?.isEnd();let e=this.#o?this.#o.#t.length:0;return this.#_===e-1}copyIn(e){typeof e=="string"?this.push(e):this.push(e.clone(this))}clone(e){let t=new Z(this.type,e);for(let s of this.#t)t.copyIn(s);return t}static#r(e,t,s,i,r){let o=i.maxExtglobRecursion??2,a=!1,l=!1,c=-1,u=!1;if(t.type===null){let p=s,y="";for(;p<e.length;){let m=e.charAt(p++);if(a||m==="\\"){a=!a,y+=m;continue}if(l){p===c+1?(m==="^"||m==="!")&&(u=!0):m==="]"&&!(p===c+2&&u)&&(l=!1),y+=m;continue}else if(m==="["){l=!0,c=p,u=!1,y+=m;continue}if(!i.noext&&Ai(m)&&e.charAt(p)==="("&&r<=o){t.push(y),y="";let _=new Z(m,t);p=Z.#r(e,_,p,i,r+1),t.push(_);continue}y+=m}return t.push(y),p}let h=s+1,f=new Z(null,t),d=[],g="";for(;h<e.length;){let p=e.charAt(h++);if(a||p==="\\"){a=!a,g+=p;continue}if(l){h===c+1?(p==="^"||p==="!")&&(u=!0):p==="]"&&!(h===c+2&&u)&&(l=!1),g+=p;continue}else if(p==="["){l=!0,c=h,u=!1,g+=p;continue}if(!i.noext&&Ai(p)&&e.charAt(h)==="("&&(r<=o||t&&t.#p(p))){let m=t&&t.#p(p)?0:1;f.push(g),g="";let x=new Z(p,f);f.push(x),h=Z.#r(e,x,h,i,r+m);continue}if(p==="|"){f.push(g),g="",d.push(f),f=new Z(null,t);continue}if(p===")")return g===""&&t.#t.length===0&&(t.#h=!0),f.push(g),g="",t.push(...d,f),h;g+=p}return t.type=null,t.#i=void 0,t.#t=[e.substring(s-1)],h}#w(e){return this.#x(e,pc)}#x(e,t=dc){if(!e||typeof e!="object"||e.type!==null||e.#t.length!==1||this.type===null)return!1;let s=e.#t[0];return!s||typeof s!="object"||s.type===null?!1:this.#p(s.type,t)}#p(e,t=gc){return!!t.get(this.type)?.includes(e)}#g(e,t){let s=e.#t[0],i=new Z(null,s,this.options);i.#t.push(""),s.push(i),this.#E(e,t)}#E(e,t){let s=e.#t[0];this.#t.splice(t,1,...s.#t);for(let i of s.#t)typeof i=="object"&&(i.#o=this);this.#f=void 0}#m(e){return!!Qr.get(this.type)?.has(e)}#S(e){if(!e||typeof e!="object"||e.type!==null||e.#t.length!==1||this.type===null||this.#t.length!==1)return!1;let t=e.#t[0];return!t||typeof t!="object"||t.type===null?!1:this.#m(t.type)}#C(e){let t=Qr.get(this.type),s=e.#t[0],i=t?.get(s.type);if(!i)return!1;this.#t=s.#t;for(let r of this.#t)typeof r=="object"&&(r.#o=this);this.type=i,this.#f=void 0,this.#h=!1}static fromGlob(e,t={}){let s=new Z(null,void 0,t);return Z.#r(e,s,0,t,0),s}toMMPattern(){if(this!==this.#e)return this.#e.toMMPattern();let e=this.toString(),[t,s,i,r]=this.toRegExpSource();if(!(i||this.#i||this.#a.nocase&&!this.#a.nocaseMagicOnly&&e.toUpperCase()!==e.toLowerCase()))return s;let a=(this.#a.nocase?"i":"")+(r?"u":"");return Object.assign(new RegExp(`^${t}$`,a),{_src:t,_glob:e})}get options(){return this.#a}toRegExpSource(e){let t=e??!!this.#a.dot;if(this.#e===this&&(this.#d(),this.#c()),!Xr(this)){let l=this.isStart()&&this.isEnd()&&!this.#t.some(d=>typeof d!="string"),c=this.#t.map(d=>{let[g,p,y,m]=typeof d=="string"?Z.#v(d,this.#i,l):d.toRegExpSource(e);return this.#i=this.#i||y,this.#n=this.#n||m,g}).join(""),u="";if(this.isStart()&&typeof this.#t[0]=="string"&&!(this.#t.length===1&&bc.has(this.#t[0]))){let g=yc,p=t&&g.has(c.charAt(0))||c.startsWith("\\.")&&g.has(c.charAt(2))||c.startsWith("\\.\\.")&&g.has(c.charAt(4)),y=!t&&!e&&g.has(c.charAt(0));u=p?mc:y?as:""}let h="";return this.isEnd()&&this.#e.#u&&this.#o?.type==="!"&&(h="(?:$|\\/)"),[u+c+h,de(c),this.#i=!!this.#i,this.#n]}let s=this.type==="*"||this.type==="+",i=this.type==="!"?"(?:(?!(?:":"(?:",r=this.#y(t);if(this.isStart()&&this.isEnd()&&!r&&this.type!=="!"){let l=this.toString(),c=this;return c.#t=[l],c.type=null,c.#i=void 0,[l,de(this.toString()),!1,!1]}let o=!s||e||t||!as?"":this.#y(!0);o===r&&(o=""),o&&(r=`(?:${r})(?:${o})*?`);let a="";if(this.type==="!"&&this.#h)a=(this.isStart()&&!t?as:"")+eo;else{let l=this.type==="!"?"))"+(this.isStart()&&!t&&!e?as:"")+Zr+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&o?")":this.type==="*"&&o?")?":`)${this.type}`;a=i+r+l}return[a,de(r),this.#i=!!this.#i,this.#n]}#d(){if(Xr(this)){let e=0,t=!1;do{t=!0;for(let s=0;s<this.#t.length;s++){let i=this.#t[s];typeof i=="object"&&(i.#d(),this.#x(i)?(t=!1,this.#E(i,s)):this.#w(i)?(t=!1,this.#g(i,s)):this.#S(i)&&(t=!1,this.#C(i)))}}while(!t&&++e<10)}else for(let e of this.#t)typeof e=="object"&&e.#d();this.#f=void 0}#y(e){return this.#t.map(t=>{if(typeof t=="string")throw new Error("string type in extglob ast??");let[s,i,r,o]=t.toRegExpSource(e);return this.#n=this.#n||o,s}).filter(t=>!(this.isStart()&&this.isEnd())||!!t).join("|")}static#v(e,t,s=!1){let i=!1,r="",o=!1,a=!1;for(let l=0;l<e.length;l++){let c=e.charAt(l);if(i){i=!1,r+=(wc.has(c)?"\\":"")+c;continue}if(c==="*"){if(a)continue;a=!0,r+=s&&/^[*]+$/.test(e)?eo:Zr,t=!0;continue}else a=!1;if(c==="\\"){l===e.length-1?r+="\\\\":i=!0;continue}if(c==="["){let[u,h,f,d]=Kr(e,l);if(f){r+=u,o=o||h,l+=f-1,t=t||d;continue}}if(c==="?"){r+=Fi,t=!0;continue}r+=vc(c)}return[r,de(e),!!t,o]}};Z=He;var tt=(n,{windowsPathsNoEscape:e=!1,magicalBraces:t=!1}={})=>t?e?n.replace(/[?*()[\]{}]/g,"[$&]"):n.replace(/[?*()[\]\\{}]/g,"\\$&"):e?n.replace(/[?*()[\]]/g,"[$&]"):n.replace(/[?*()[\]\\]/g,"\\$&");var K=(n,e,t={})=>(vt(e),!t.nocomment&&e.charAt(0)==="#"?!1:new te(e,t).match(n)),Sc=/^\*+([^+@!?*[(]*)$/,_c=n=>e=>!e.startsWith(".")&&e.endsWith(n),Cc=n=>e=>e.endsWith(n),kc=n=>(n=n.toLowerCase(),e=>!e.startsWith(".")&&e.toLowerCase().endsWith(n)),Ec=n=>(n=n.toLowerCase(),e=>e.toLowerCase().endsWith(n)),Oc=/^\*+\.\*+$/,Ac=n=>!n.startsWith(".")&&n.includes("."),Fc=n=>n!=="."&&n!==".."&&n.includes("."),$c=/^\.\*+$/,Pc=n=>n!=="."&&n!==".."&&n.startsWith("."),Rc=/^\*+$/,Tc=n=>n.length!==0&&!n.startsWith("."),Mc=n=>n.length!==0&&n!=="."&&n!=="..",jc=/^\?+([^+@!?*[(]*)?$/,Dc=([n,e=""])=>{let t=io([n]);return e?(e=e.toLowerCase(),s=>t(s)&&s.toLowerCase().endsWith(e)):t},Nc=([n,e=""])=>{let t=no([n]);return e?(e=e.toLowerCase(),s=>t(s)&&s.toLowerCase().endsWith(e)):t},Ic=([n,e=""])=>{let t=no([n]);return e?s=>t(s)&&s.endsWith(e):t},Lc=([n,e=""])=>{let t=io([n]);return e?s=>t(s)&&s.endsWith(e):t},io=([n])=>{let e=n.length;return t=>t.length===e&&!t.startsWith(".")},no=([n])=>{let e=n.length;return t=>t.length===e&&t!=="."&&t!==".."},ro=typeof process=="object"&&process?typeof process.env=="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",to={win32:{sep:"\\"},posix:{sep:"/"}},Wc=ro==="win32"?to.win32.sep:to.posix.sep;K.sep=Wc;var F=Symbol("globstar **");K.GLOBSTAR=F;var Hc="[^/]",Bc=Hc+"*?",Vc="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",qc="(?:(?!(?:\\/|^)\\.).)*?",Uc=(n,e={})=>t=>K(t,n,e);K.filter=Uc;var ae=(n,e={})=>Object.assign({},n,e),zc=n=>{if(!n||typeof n!="object"||!Object.keys(n).length)return K;let e=K;return Object.assign((s,i,r={})=>e(s,i,ae(n,r)),{Minimatch:class extends e.Minimatch{constructor(i,r={}){super(i,ae(n,r))}static defaults(i){return e.defaults(ae(n,i)).Minimatch}},AST:class extends e.AST{constructor(i,r,o={}){super(i,r,ae(n,o))}static fromGlob(i,r={}){return e.AST.fromGlob(i,ae(n,r))}},unescape:(s,i={})=>e.unescape(s,ae(n,i)),escape:(s,i={})=>e.escape(s,ae(n,i)),filter:(s,i={})=>e.filter(s,ae(n,i)),defaults:s=>e.defaults(ae(n,s)),makeRe:(s,i={})=>e.makeRe(s,ae(n,i)),braceExpand:(s,i={})=>e.braceExpand(s,ae(n,i)),match:(s,i,r={})=>e.match(s,i,ae(n,r)),sep:e.sep,GLOBSTAR:F})};K.defaults=zc;var oo=(n,e={})=>(vt(n),e.nobrace||!/\{(?:(?!\{).)*\}/.test(n)?[n]:Yr(n,{max:e.braceExpandMax}));K.braceExpand=oo;var Gc=(n,e={})=>new te(n,e).makeRe();K.makeRe=Gc;var Yc=(n,e,t={})=>{let s=new te(e,t);return n=n.filter(i=>s.match(i)),s.options.nonull&&!n.length&&n.push(e),n};K.match=Yc;var so=/[?*]|[+@!]\(.*?\)|\[|\]/,Jc=n=>n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),te=class{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;maxGlobstarRecursion;regexp;constructor(e,t={}){vt(e),t=t||{},this.options=t,this.maxGlobstarRecursion=t.maxGlobstarRecursion??200,this.pattern=e,this.platform=t.platform||ro,this.isWindows=this.platform==="win32";let s="allowWindowsEscape";this.windowsPathsNoEscape=!!t.windowsPathsNoEscape||t[s]===!1,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,"/")),this.preserveMultipleSlashes=!!t.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!t.nonegate,this.comment=!1,this.empty=!1,this.partial=!!t.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=t.windowsNoMagicRoot!==void 0?t.windowsNoMagicRoot:!!(this.isWindows&&this.nocase),this.globSet=[],this.globParts=[],this.set=[],this.make()}hasMagic(){if(this.options.magicalBraces&&this.set.length>1)return!0;for(let e of this.set)for(let t of e)if(typeof t!="string")return!0;return!1}debug(...e){}make(){let e=this.pattern,t=this.options;if(!t.nocomment&&e.charAt(0)==="#"){this.comment=!0;return}if(!e){this.empty=!0;return}this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],t.debug&&(this.debug=(...r)=>console.error(...r)),this.debug(this.pattern,this.globSet);let s=this.globSet.map(r=>this.slashSplit(r));this.globParts=this.preprocess(s),this.debug(this.pattern,this.globParts);let i=this.globParts.map((r,o,a)=>{if(this.isWindows&&this.windowsNoMagicRoot){let l=r[0]===""&&r[1]===""&&(r[2]==="?"||!so.test(r[2]))&&!so.test(r[3]),c=/^[a-z]:/i.test(r[0]);if(l)return[...r.slice(0,4),...r.slice(4).map(u=>this.parse(u))];if(c)return[r[0],...r.slice(1).map(u=>this.parse(u))]}return r.map(l=>this.parse(l))});if(this.debug(this.pattern,i),this.set=i.filter(r=>r.indexOf(!1)===-1),this.isWindows)for(let r=0;r<this.set.length;r++){let o=this.set[r];o[0]===""&&o[1]===""&&this.globParts[r][2]==="?"&&typeof o[3]=="string"&&/^[a-z]:$/i.test(o[3])&&(o[2]="?")}this.debug(this.pattern,this.set)}preprocess(e){if(this.options.noglobstar)for(let s of e)for(let i=0;i<s.length;i++)s[i]==="**"&&(s[i]="*");let{optimizationLevel:t=1}=this.options;return t>=2?(e=this.firstPhasePreProcess(e),e=this.secondPhasePreProcess(e)):t>=1?e=this.levelOneOptimize(e):e=this.adjascentGlobstarOptimize(e),e}adjascentGlobstarOptimize(e){return e.map(t=>{let s=-1;for(;(s=t.indexOf("**",s+1))!==-1;){let i=s;for(;t[i+1]==="**";)i++;i!==s&&t.splice(s,i-s)}return t})}levelOneOptimize(e){return e.map(t=>(t=t.reduce((s,i)=>{let r=s[s.length-1];return i==="**"&&r==="**"?s:i===".."&&r&&r!==".."&&r!=="."&&r!=="**"?(s.pop(),s):(s.push(i),s)},[]),t.length===0?[""]:t))}levelTwoFileOptimize(e){Array.isArray(e)||(e=this.slashSplit(e));let t=!1;do{if(t=!1,!this.preserveMultipleSlashes){for(let i=1;i<e.length-1;i++){let r=e[i];i===1&&r===""&&e[0]===""||(r==="."||r==="")&&(t=!0,e.splice(i,1),i--)}e[0]==="."&&e.length===2&&(e[1]==="."||e[1]==="")&&(t=!0,e.pop())}let s=0;for(;(s=e.indexOf("..",s+1))!==-1;){let i=e[s-1];i&&i!=="."&&i!==".."&&i!=="**"&&!(this.isWindows&&/^[a-z]:$/i.test(i))&&(t=!0,e.splice(s-1,2),s-=2)}}while(t);return e.length===0?[""]:e}firstPhasePreProcess(e){let t=!1;do{t=!1;for(let s of e){let i=-1;for(;(i=s.indexOf("**",i+1))!==-1;){let o=i;for(;s[o+1]==="**";)o++;o>i&&s.splice(i+1,o-i);let a=s[i+1],l=s[i+2],c=s[i+3];if(a!==".."||!l||l==="."||l===".."||!c||c==="."||c==="..")continue;t=!0,s.splice(i,1);let u=s.slice(0);u[i]="**",e.push(u),i--}if(!this.preserveMultipleSlashes){for(let o=1;o<s.length-1;o++){let a=s[o];o===1&&a===""&&s[0]===""||(a==="."||a==="")&&(t=!0,s.splice(o,1),o--)}s[0]==="."&&s.length===2&&(s[1]==="."||s[1]==="")&&(t=!0,s.pop())}let r=0;for(;(r=s.indexOf("..",r+1))!==-1;){let o=s[r-1];if(o&&o!=="."&&o!==".."&&o!=="**"){t=!0;let l=r===1&&s[r+1]==="**"?["."]:[];s.splice(r-1,2,...l),s.length===0&&s.push(""),r-=2}}}}while(t);return e}secondPhasePreProcess(e){for(let t=0;t<e.length-1;t++)for(let s=t+1;s<e.length;s++){let i=this.partsMatch(e[t],e[s],!this.preserveMultipleSlashes);if(i){e[t]=[],e[s]=i;break}}return e.filter(t=>t.length)}partsMatch(e,t,s=!1){let i=0,r=0,o=[],a="";for(;i<e.length&&r<t.length;)if(e[i]===t[r])o.push(a==="b"?t[r]:e[i]),i++,r++;else if(s&&e[i]==="**"&&t[r]===e[i+1])o.push(e[i]),i++;else if(s&&t[r]==="**"&&e[i]===t[r+1])o.push(t[r]),r++;else if(e[i]==="*"&&t[r]&&(this.options.dot||!t[r].startsWith("."))&&t[r]!=="**"){if(a==="b")return!1;a="a",o.push(e[i]),i++,r++}else if(t[r]==="*"&&e[i]&&(this.options.dot||!e[i].startsWith("."))&&e[i]!=="**"){if(a==="a")return!1;a="b",o.push(t[r]),i++,r++}else return!1;return e.length===t.length&&o}parseNegate(){if(this.nonegate)return;let e=this.pattern,t=!1,s=0;for(let i=0;i<e.length&&e.charAt(i)==="!";i++)t=!t,s++;s&&(this.pattern=e.slice(s)),this.negate=t}matchOne(e,t,s=!1){let i=0,r=0;if(this.isWindows){let a=typeof e[0]=="string"&&/^[a-z]:$/i.test(e[0]),l=!a&&e[0]===""&&e[1]===""&&e[2]==="?"&&/^[a-z]:$/i.test(e[3]),c=typeof t[0]=="string"&&/^[a-z]:$/i.test(t[0]),u=!c&&t[0]===""&&t[1]===""&&t[2]==="?"&&typeof t[3]=="string"&&/^[a-z]:$/i.test(t[3]),h=l?3:a?0:void 0,f=u?3:c?0:void 0;if(typeof h=="number"&&typeof f=="number"){let[d,g]=[e[h],t[f]];d.toLowerCase()===g.toLowerCase()&&(t[f]=d,r=f,i=h)}}let{optimizationLevel:o=1}=this.options;return o>=2&&(e=this.levelTwoFileOptimize(e)),t.includes(F)?this.#e(e,t,s,i,r):this.#n(e,t,s,i,r)}#e(e,t,s,i,r){let o=t.indexOf(F,r),a=t.lastIndexOf(F),[l,c,u]=s?[t.slice(r,o),t.slice(o+1),[]]:[t.slice(r,o),t.slice(o+1,a),t.slice(a+1)];if(l.length){let x=e.slice(i,i+l.length);if(!this.#n(x,l,s,0,0))return!1;i+=l.length,r+=l.length}let h=0;if(u.length){if(u.length+i>e.length)return!1;let x=e.length-u.length;if(this.#n(e,u,s,x,0))h=u.length;else{if(e[e.length-1]!==""||i+u.length===e.length||(x--,!this.#n(e,u,s,x,0)))return!1;h=u.length+1}}if(!c.length){let x=!!h;for(let _=i;_<e.length-h;_++){let w=String(e[_]);if(x=!0,w==="."||w===".."||!this.options.dot&&w.startsWith("."))return!1}return s||x}let f=[[[],0]],d=f[0],g=0,p=[0];for(let x of c)x===F?(p.push(g),d=[[],0],f.push(d)):(d[0].push(x),g++);let y=f.length-1,m=e.length-h;for(let x of f)x[1]=m-(p[y--]+x[0].length);return!!this.#i(e,f,i,0,s,0,!!h)}#i(e,t,s,i,r,o,a){let l=t[i];if(!l){for(let h=s;h<e.length;h++){a=!0;let f=e[h];if(f==="."||f===".."||!this.options.dot&&f.startsWith("."))return!1}return a}let[c,u]=l;for(;s<=u;){if(this.#n(e.slice(0,s+c.length),c,r,s,0)&&o<this.maxGlobstarRecursion){let d=this.#i(e,t,s+c.length,i+1,r,o+1,a);if(d!==!1)return d}let f=e[s];if(f==="."||f===".."||!this.options.dot&&f.startsWith("."))return!1;s++}return r||null}#n(e,t,s,i,r){let o,a,l,c;for(o=i,a=r,c=e.length,l=t.length;o<c&&a<l;o++,a++){this.debug("matchOne loop");let u=t[a],h=e[o];if(this.debug(t,u,h),u===!1||u===F)return!1;let f;if(typeof u=="string"?(f=h===u,this.debug("string match",u,h,f)):(f=u.test(h),this.debug("pattern match",u,h,f)),!f)return!1}if(o===c&&a===l)return!0;if(o===c)return s;if(a===l)return o===c-1&&e[o]==="";throw new Error("wtf?")}braceExpand(){return oo(this.pattern,this.options)}parse(e){vt(e);let t=this.options;if(e==="**")return F;if(e==="")return"";let s,i=null;(s=e.match(Rc))?i=t.dot?Mc:Tc:(s=e.match(Sc))?i=(t.nocase?t.dot?Ec:kc:t.dot?Cc:_c)(s[1]):(s=e.match(jc))?i=(t.nocase?t.dot?Nc:Dc:t.dot?Ic:Lc)(s):(s=e.match(Oc))?i=t.dot?Fc:Ac:(s=e.match($c))&&(i=Pc);let r=He.fromGlob(e,this.options).toMMPattern();return i&&typeof r=="object"&&Reflect.defineProperty(r,"test",{value:i}),r}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let e=this.set;if(!e.length)return this.regexp=!1,this.regexp;let t=this.options,s=t.noglobstar?Bc:t.dot?Vc:qc,i=new Set(t.nocase?["i"]:[]),r=e.map(l=>{let c=l.map(h=>{if(h instanceof RegExp)for(let f of h.flags.split(""))i.add(f);return typeof h=="string"?Jc(h):h===F?F:h._src});c.forEach((h,f)=>{let d=c[f+1],g=c[f-1];h!==F||g===F||(g===void 0?d!==void 0&&d!==F?c[f+1]="(?:\\/|"+s+"\\/)?"+d:c[f]=s:d===void 0?c[f-1]=g+"(?:\\/|\\/"+s+")?":d!==F&&(c[f-1]=g+"(?:\\/|\\/"+s+"\\/)"+d,c[f+1]=F))});let u=c.filter(h=>h!==F);if(this.partial&&u.length>=1){let h=[];for(let f=1;f<=u.length;f++)h.push(u.slice(0,f).join("/"));return"(?:"+h.join("|")+")"}return u.join("/")}).join("|"),[o,a]=e.length>1?["(?:",")"]:["",""];r="^"+o+r+a+"$",this.partial&&(r="^(?:\\/|"+o+r.slice(1,-1)+a+")$"),this.negate&&(r="^(?!"+r+").+$");try{this.regexp=new RegExp(r,[...i].join(""))}catch{this.regexp=!1}return this.regexp}slashSplit(e){return this.preserveMultipleSlashes?e.split("/"):this.isWindows&&/^\/\/[^/]+/.test(e)?["",...e.split(/\/+/)]:e.split(/\/+/)}match(e,t=this.partial){if(this.debug("match",e,this.pattern),this.comment)return!1;if(this.empty)return e==="";if(e==="/"&&t)return!0;let s=this.options;this.isWindows&&(e=e.split("\\").join("/"));let i=this.slashSplit(e);this.debug(this.pattern,"split",i);let r=this.set;this.debug(this.pattern,"set",r);let o=i[i.length-1];if(!o)for(let a=i.length-2;!o&&a>=0;a--)o=i[a];for(let a of r){let l=i;if(s.matchBase&&a.length===1&&(l=[o]),this.matchOne(l,a,t))return s.flipNegate?!0:!this.negate}return s.flipNegate?!1:this.negate}static defaults(e){return K.defaults(e).Minimatch}};K.AST=He;K.Minimatch=te;K.escape=tt;K.unescape=de;var Po=require("node:url");var cs=require("node:diagnostics_channel"),V=(0,cs.channel)("lru-cache:metrics"),St=(0,cs.tracingChannel)("lru-cache"),Kc=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,$i=()=>V.hasSubscribers||St.hasSubscribers,lo=new Set,ao=typeof process=="object"&&process?process:{},Xc=(n,e,t,s)=>{typeof ao.emitWarning=="function"?ao.emitWarning(n,e,t,s):console.error(`[${t}] ${e}: ${n}`)},Qc=n=>!lo.has(n),Pe=n=>!!n&&n===Math.floor(n)&&n>0&&isFinite(n),co=n=>Pe(n)?n<=Math.pow(2,8)?Uint8Array:n<=Math.pow(2,16)?Uint16Array:n<=Math.pow(2,32)?Uint32Array:n<=Number.MAX_SAFE_INTEGER?ls:null:null,ls=class extends Array{constructor(n){super(n),this.fill(0)}},Zc=class _t{heap;length;static#e=!1;static create(e){let t=co(e);if(!t)return[];_t.#e=!0;let s=new _t(e,t);return _t.#e=!1,s}constructor(e,t){if(!_t.#e)throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new t(e),this.length=0}push(e){this.heap[this.length++]=e}pop(){return this.heap[--this.length]}},Ct=class ho{#e;#i;#n;#t;#o;#_;#b;#u;get perf(){return this.#u}ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;backgroundFetchSize;#a;#f;#h;#c;#r;#w;#x;#p;#g;#E;#m;#S;#C;#d;#y;#v;#A;#s;#P;static unsafeExposeInternals(e){return{starts:e.#C,ttls:e.#d,autopurgeTimers:e.#y,sizes:e.#S,keyMap:e.#h,keyList:e.#c,valList:e.#r,next:e.#w,prev:e.#x,get head(){return e.#p},get tail(){return e.#g},free:e.#E,isBackgroundFetch:t=>e.#l(t),backgroundFetch:(t,s,i,r)=>e.#N(t,s,i,r),moveToTail:t=>e.#Y(t),indexes:t=>e.#F(t),rindexes:t=>e.#$(t),isStale:t=>e.#k(t)}}get max(){return this.#e}get maxSize(){return this.#i}get calculatedSize(){return this.#f}get size(){return this.#a}get fetchMethod(){return this.#_}get memoMethod(){return this.#b}get dispose(){return this.#n}get onInsert(){return this.#t}get disposeAfter(){return this.#o}constructor(e){let{max:t=0,ttl:s,ttlResolution:i=1,ttlAutopurge:r,updateAgeOnGet:o,updateAgeOnHas:a,allowStale:l,dispose:c,onInsert:u,disposeAfter:h,noDisposeOnSet:f,noUpdateTTL:d,maxSize:g=0,maxEntrySize:p=0,sizeCalculation:y,fetchMethod:m,memoMethod:x,noDeleteOnFetchRejection:_,noDeleteOnStaleGet:w,allowStaleOnFetchRejection:b,allowStaleOnFetchAbort:P,ignoreFetchAbort:Q,backgroundFetchSize:xe=1,perf:G}=e;if(this.backgroundFetchSize=xe,G!==void 0&&typeof G?.now!="function")throw new TypeError("perf option must have a now() method if specified");if(this.#u=G??Kc,t!==0&&!Pe(t))throw new TypeError("max option must be a nonnegative integer");let $s=t?co(t):Array;if(!$s)throw new Error("invalid max value: "+t);if(this.#e=t,this.#i=g,this.maxEntrySize=p||this.#i,this.sizeCalculation=y,this.sizeCalculation){if(!this.#i&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(x!==void 0&&typeof x!="function")throw new TypeError("memoMethod must be a function if defined");if(this.#b=x,m!==void 0&&typeof m!="function")throw new TypeError("fetchMethod must be a function if specified");if(this.#_=m,this.#A=!!m,this.#h=new Map,this.#c=Array.from({length:t}).fill(void 0),this.#r=Array.from({length:t}).fill(void 0),this.#w=new $s(t),this.#x=new $s(t),this.#p=0,this.#g=0,this.#E=Zc.create(t),this.#a=0,this.#f=0,typeof c=="function"&&(this.#n=c),typeof u=="function"&&(this.#t=u),typeof h=="function"?(this.#o=h,this.#m=[]):(this.#o=void 0,this.#m=void 0),this.#v=!!this.#n,this.#P=!!this.#t,this.#s=!!this.#o,this.noDisposeOnSet=!!f,this.noUpdateTTL=!!d,this.noDeleteOnFetchRejection=!!_,this.allowStaleOnFetchRejection=!!b,this.allowStaleOnFetchAbort=!!P,this.ignoreFetchAbort=!!Q,this.maxEntrySize!==0){if(this.#i!==0&&!Pe(this.#i))throw new TypeError("maxSize must be a positive integer if specified");if(!Pe(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#q()}if(this.allowStale=!!l,this.noDeleteOnStaleGet=!!w,this.updateAgeOnGet=!!o,this.updateAgeOnHas=!!a,this.ttlResolution=Pe(i)||i===0?i:1,this.ttlAutopurge=!!r,this.ttl=s||0,this.ttl){if(!Pe(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#R()}if(this.#e===0&&this.ttl===0&&this.#i===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#e&&!this.#i){let Ps="LRU_CACHE_UNBOUNDED";Qc(Ps)&&(lo.add(Ps),Xc("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",Ps,ho))}}getRemainingTTL(e){return this.#h.has(e)?1/0:0}#R(){let e=new ls(this.#e),t=new ls(this.#e);this.#d=e,this.#C=t;let s=this.ttlAutopurge?Array.from({length:this.#e}):void 0;this.#y=s,this.#L=(a,l,c=this.#u.now())=>{t[a]=l!==0?c:0,e[a]=l,i(a,l)},this.#O=a=>{t[a]=e[a]!==0?this.#u.now():0,i(a,e[a])};let i=this.ttlAutopurge?(a,l)=>{if(s?.[a]&&(clearTimeout(s[a]),s[a]=void 0),l&&l!==0&&s){let c=setTimeout(()=>{this.#k(a)&&this.#I(this.#c[a],"expire")},l+1);c.unref&&c.unref(),s[a]=c}}:()=>{};this.#T=(a,l)=>{if(e[l]){let c=e[l],u=t[l];if(!c||!u)return;a.ttl=c,a.start=u,a.now=r||o();let h=a.now-u;a.remainingTTL=c-h}};let r=0,o=()=>{let a=this.#u.now();if(this.ttlResolution>0){r=a;let l=setTimeout(()=>r=0,this.ttlResolution);l.unref&&l.unref()}return a};this.getRemainingTTL=a=>{let l=this.#h.get(a);if(l===void 0)return 0;let c=e[l],u=t[l];if(!c||!u)return 1/0;let h=(r||o())-u;return c-h},this.#k=a=>{let l=t[a],c=e[a];return!!c&&!!l&&(r||o())-l>c}}#O=()=>{};#T=()=>{};#L=()=>{};#k=()=>!1;#q(){let e=new ls(this.#e);this.#f=0,this.#S=e,this.#j=t=>{this.#f-=e[t],e[t]=0},this.#W=(t,s,i,r)=>{if(!Pe(i)){if(this.#l(s))return this.backgroundFetchSize;if(r){if(typeof r!="function")throw new TypeError("sizeCalculation must be a function");if(i=r(s,t),!Pe(i))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.")}return i},this.#M=(t,s,i)=>{if(e[t]=s,this.#i){let r=this.#i-e[t];for(;this.#f>r;)this.#V(!0)}this.#f+=e[t],i&&(i.entrySize=s,i.totalCalculatedSize=this.#f)}}#j=e=>{};#M=(e,t,s)=>{};#W=(e,t,s,i)=>{if(s||i)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#F({allowStale:e=this.allowStale}={}){if(this.#a)for(let t=this.#g;this.#H(t)&&((e||!this.#k(t))&&(yield t),t!==this.#p);)t=this.#x[t]}*#$({allowStale:e=this.allowStale}={}){if(this.#a)for(let t=this.#p;this.#H(t)&&((e||!this.#k(t))&&(yield t),t!==this.#g);)t=this.#w[t]}#H(e){return e!==void 0&&this.#h.get(this.#c[e])===e}*entries(){for(let e of this.#F())this.#r[e]!==void 0&&this.#c[e]!==void 0&&!this.#l(this.#r[e])&&(yield[this.#c[e],this.#r[e]])}*rentries(){for(let e of this.#$())this.#r[e]!==void 0&&this.#c[e]!==void 0&&!this.#l(this.#r[e])&&(yield[this.#c[e],this.#r[e]])}*keys(){for(let e of this.#F()){let t=this.#c[e];t!==void 0&&!this.#l(this.#r[e])&&(yield t)}}*rkeys(){for(let e of this.#$()){let t=this.#c[e];t!==void 0&&!this.#l(this.#r[e])&&(yield t)}}*values(){for(let e of this.#F())this.#r[e]!==void 0&&!this.#l(this.#r[e])&&(yield this.#r[e])}*rvalues(){for(let e of this.#$())this.#r[e]!==void 0&&!this.#l(this.#r[e])&&(yield this.#r[e])}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(e,t={}){for(let s of this.#F()){let i=this.#r[s],r=this.#l(i)?i.__staleWhileFetching:i;if(r!==void 0&&e(r,this.#c[s],this))return this.#G(this.#c[s],t)}}forEach(e,t=this){for(let s of this.#F()){let i=this.#r[s],r=this.#l(i)?i.__staleWhileFetching:i;r!==void 0&&e.call(t,r,this.#c[s],this)}}rforEach(e,t=this){for(let s of this.#$()){let i=this.#r[s],r=this.#l(i)?i.__staleWhileFetching:i;r!==void 0&&e.call(t,r,this.#c[s],this)}}purgeStale(){let e=!1;for(let t of this.#$({allowStale:!0}))this.#k(t)&&(this.#I(this.#c[t],"expire"),e=!0);return e}info(e){let t=this.#h.get(e);if(t===void 0)return;let s=this.#r[t],i=this.#l(s)?s.__staleWhileFetching:s;if(i===void 0)return;let r={value:i};if(this.#d&&this.#C){let o=this.#d[t],a=this.#C[t];if(o&&a){let l=o-(this.#u.now()-a);r.ttl=l,r.start=Date.now()}}return this.#S&&(r.size=this.#S[t]),r}dump(){let e=[];for(let t of this.#F({allowStale:!0})){let s=this.#c[t],i=this.#r[t],r=this.#l(i)?i.__staleWhileFetching:i;if(r===void 0||s===void 0)continue;let o={value:r};if(this.#d&&this.#C){o.ttl=this.#d[t];let a=this.#u.now()-this.#C[t];o.start=Math.floor(Date.now()-a)}this.#S&&(o.size=this.#S[t]),e.unshift([s,o])}return e}load(e){this.clear();for(let[t,s]of e){if(s.start){let i=Date.now()-s.start;s.start=this.#u.now()-i}this.#D(t,s.value,s)}}set(e,t,s={}){let{status:i=V.hasSubscribers?{}:void 0}=s;s.status=i,i&&(i.op="set",i.key=e,t!==void 0&&(i.value=t),i.cache=this);let r=this.#D(e,t,s);return i&&V.hasSubscribers&&V.publish(i),r}#D(e,t,s,i){let{ttl:r=this.ttl,start:o,noDisposeOnSet:a=this.noDisposeOnSet,sizeCalculation:l=this.sizeCalculation,status:c}=s,u=this.#l(t);if(t===void 0)return c&&(c.set="deleted"),this.delete(e),this;let{noUpdateTTL:h=this.noUpdateTTL}=s;c&&!u&&(c.value=t);let f=this.#W(e,t,s.size||0,l,c);if(this.maxEntrySize&&f>this.maxEntrySize)return this.#I(e,"set"),c&&(c.set="miss",c.maxEntrySizeExceeded=!0),this;let d=this.#a===0?void 0:this.#h.get(e);if(d===void 0)d=this.#a===0?this.#g:this.#E.length!==0?this.#E.pop():this.#a===this.#e?this.#V(!1):this.#a,this.#c[d]=e,this.#r[d]=t,this.#h.set(e,d),this.#w[this.#g]=d,this.#x[d]=this.#g,this.#g=d,this.#a++,this.#M(d,f,c),c&&(c.set="add"),h=!1,this.#P&&!u&&this.#t?.(t,e,"add");else{this.#Y(d);let g=this.#r[d];if(t!==g){if(!a)if(this.#l(g)){g!==i&&g.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:p}=g;p!==void 0&&p!==t&&(this.#v&&this.#n?.(p,e,"set"),this.#s&&this.#m?.push([p,e,"set"]))}else this.#v&&this.#n?.(g,e,"set"),this.#s&&this.#m?.push([g,e,"set"]);if(this.#j(d),this.#M(d,f,c),this.#r[d]=t,!u){let p=g&&this.#l(g)?g.__staleWhileFetching:g,y=p===void 0?"add":t!==p?"replace":"update";c&&(c.set=y,p!==void 0&&(c.oldValue=p)),this.#P&&this.onInsert?.(t,e,y)}}else u||(c&&(c.set="update"),this.#P&&this.onInsert?.(t,e,"update"))}if(r!==0&&!this.#d&&this.#R(),this.#d&&(h||this.#L(d,r,o),c&&this.#T(c,d)),!a&&this.#s&&this.#m){let g=this.#m,p;for(;p=g?.shift();)this.#o?.(...p)}return this}pop(){try{for(;this.#a;){let e=this.#r[this.#p];if(this.#V(!0),this.#l(e)){if(e.__staleWhileFetching)return e.__staleWhileFetching}else if(e!==void 0)return e}}finally{if(this.#s&&this.#m){let e=this.#m,t;for(;t=e?.shift();)this.#o?.(...t)}}}#V(e){let t=this.#p,s=this.#c[t],i=this.#r[t],r=this.#l(i);r&&i.__abortController.abort(new Error("evicted"));let o=r?i.__staleWhileFetching:i;return(this.#v||this.#s)&&o!==void 0&&(this.#v&&this.#n?.(o,s,"evict"),this.#s&&this.#m?.push([o,s,"evict"])),this.#j(t),this.#y?.[t]&&(clearTimeout(this.#y[t]),this.#y[t]=void 0),e&&(this.#c[t]=void 0,this.#r[t]=void 0,this.#E.push(t)),this.#a===1?(this.#p=this.#g=0,this.#E.length=0):this.#p=this.#w[t],this.#h.delete(s),this.#a--,t}has(e,t={}){let{status:s=V.hasSubscribers?{}:void 0}=t;t.status=s,s&&(s.op="has",s.key=e,s.cache=this);let i=this.#J(e,t);return V.hasSubscribers&&V.publish(s),i}#J(e,t={}){let{updateAgeOnHas:s=this.updateAgeOnHas,status:i}=t,r=this.#h.get(e);if(r!==void 0){let o=this.#r[r];if(this.#l(o)&&o.__staleWhileFetching===void 0)return!1;if(this.#k(r))i&&(i.has="stale",this.#T(i,r));else return s&&this.#O(r),i&&(i.has="hit",this.#T(i,r)),!0}else i&&(i.has="miss");return!1}peek(e,t={}){let{status:s=$i()?{}:void 0}=t;s&&(s.op="peek",s.key=e,s.cache=this),t.status=s;let i=this.#U(e,t);return V.hasSubscribers&&V.publish(s),i}#U(e,t){let{status:s,allowStale:i=this.allowStale}=t,r=this.#h.get(e);if(r===void 0||!i&&this.#k(r)){s&&(s.peek=r===void 0?"miss":"stale");return}let o=this.#r[r],a=this.#l(o)?o.__staleWhileFetching:o;return s&&(a!==void 0?(s.peek="hit",s.value=a):s.peek="miss"),a}#N(e,t,s,i){let r=t===void 0?void 0:this.#r[t];if(this.#l(r))return r;let o=new AbortController,{signal:a}=s;a?.addEventListener("abort",()=>o.abort(a.reason),{signal:o.signal});let l={signal:o.signal,options:s,context:i},c=(p,y=!1)=>{let{aborted:m}=o.signal,x=s.ignoreFetchAbort&&p!==void 0,_=s.ignoreFetchAbort||!!(s.allowStaleOnFetchAbort&&p!==void 0);if(s.status&&(m&&!y?(s.status.fetchAborted=!0,s.status.fetchError=o.signal.reason,x&&(s.status.fetchAbortIgnored=!0)):s.status.fetchResolved=!0),m&&!x&&!y)return h(o.signal.reason,_);let w=d,b=this.#r[t];return(b===d||b===void 0&&x&&y)&&(p===void 0?w.__staleWhileFetching!==void 0?this.#r[t]=w.__staleWhileFetching:this.#I(e,"fetch"):(s.status&&(s.status.fetchUpdated=!0),this.#D(e,p,l.options,w))),p},u=p=>(s.status&&(s.status.fetchRejected=!0,s.status.fetchError=p),h(p,!1)),h=(p,y)=>{let{aborted:m}=o.signal,x=m&&s.allowStaleOnFetchAbort,_=x||s.allowStaleOnFetchRejection,w=_||s.noDeleteOnFetchRejection,b=d;if(this.#r[t]===d&&(!w||!y&&b.__staleWhileFetching===void 0?this.#I(e,"fetch"):x||(this.#r[t]=b.__staleWhileFetching)),_)return s.status&&b.__staleWhileFetching!==void 0&&(s.status.returnedStale=!0),b.__staleWhileFetching;if(b.__returned===b)throw p},f=(p,y)=>{let m=this.#_?.(e,r,l);o.signal.addEventListener("abort",()=>{(!s.ignoreFetchAbort||s.allowStaleOnFetchAbort)&&(p(void 0),s.allowStaleOnFetchAbort&&(p=x=>c(x,!0)))}),m&&m instanceof Promise?m.then(x=>p(x===void 0?void 0:x),y):m!==void 0&&p(m)};s.status&&(s.status.fetchDispatched=!0);let d=new Promise(f).then(c,u),g=Object.assign(d,{__abortController:o,__staleWhileFetching:r,__returned:void 0});return t===void 0?(this.#D(e,g,{...l.options,status:void 0}),t=this.#h.get(e)):this.#r[t]=g,g}#l(e){if(!this.#A)return!1;let t=e;return!!t&&t instanceof Promise&&t.hasOwnProperty("__staleWhileFetching")&&t.__abortController instanceof AbortController}fetch(e,t={}){let s=St.hasSubscribers,{status:i=$i()?{}:void 0}=t;t.status=i,i&&t.context&&(i.context=t.context);let r=this.#z(e,t);return i&&s&&(i.trace=!0,St.tracePromise(()=>r,i).catch(()=>{})),r}async#z(e,t={}){let{allowStale:s=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:r=this.noDeleteOnStaleGet,ttl:o=this.ttl,noDisposeOnSet:a=this.noDisposeOnSet,size:l=0,sizeCalculation:c=this.sizeCalculation,noUpdateTTL:u=this.noUpdateTTL,noDeleteOnFetchRejection:h=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:f=this.allowStaleOnFetchRejection,ignoreFetchAbort:d=this.ignoreFetchAbort,allowStaleOnFetchAbort:g=this.allowStaleOnFetchAbort,context:p,forceRefresh:y=!1,status:m,signal:x}=t;if(m&&(m.op="fetch",m.key=e,y&&(m.forceRefresh=!0),m.cache=this),!this.#A)return m&&(m.fetch="get"),this.#G(e,{allowStale:s,updateAgeOnGet:i,noDeleteOnStaleGet:r,status:m});let _={allowStale:s,updateAgeOnGet:i,noDeleteOnStaleGet:r,ttl:o,noDisposeOnSet:a,size:l,sizeCalculation:c,noUpdateTTL:u,noDeleteOnFetchRejection:h,allowStaleOnFetchRejection:f,allowStaleOnFetchAbort:g,ignoreFetchAbort:d,status:m,signal:x},w=this.#h.get(e);if(w===void 0){m&&(m.fetch="miss");let b=this.#N(e,w,_,p);return b.__returned=b}else{let b=this.#r[w];if(this.#l(b)){let G=s&&b.__staleWhileFetching!==void 0;return m&&(m.fetch="inflight",G&&(m.returnedStale=!0)),G?b.__staleWhileFetching:b.__returned=b}let P=this.#k(w);if(!y&&!P)return m&&(m.fetch="hit"),this.#Y(w),i&&this.#O(w),m&&this.#T(m,w),b;let Q=this.#N(e,w,_,p),xe=Q.__staleWhileFetching!==void 0&&s;return m&&(m.fetch=P?"stale":"refresh",xe&&P&&(m.returnedStale=!0)),xe?Q.__staleWhileFetching:Q.__returned=Q}}forceFetch(e,t={}){let s=St.hasSubscribers,{status:i=$i()?{}:void 0}=t;t.status=i,i&&t.context&&(i.context=t.context);let r=this.#B(e,t);return i&&s&&(i.trace=!0,St.tracePromise(()=>r,i).catch(()=>{})),r}async#B(e,t={}){let s=await this.#z(e,t);if(s===void 0)throw new Error("fetch() returned undefined");return s}memo(e,t={}){let{status:s=V.hasSubscribers?{}:void 0}=t;t.status=s,s&&(s.op="memo",s.key=e,t.context&&(s.context=t.context),s.cache=this);let i=this.#Q(e,t);return s&&(s.value=i),V.hasSubscribers&&V.publish(s),i}#Q(e,t={}){let s=this.#b;if(!s)throw new Error("no memoMethod provided to constructor");let{context:i,status:r,forceRefresh:o,...a}=t;r&&o&&(r.forceRefresh=!0);let l=this.#G(e,a),c=o||l===void 0;if(r&&(r.memo=c?"miss":"hit",c||(r.value=l)),!c)return l;let u=s(e,l,{options:a,context:i});return r&&(r.value=u),this.#D(e,u,a),u}get(e,t={}){let{status:s=V.hasSubscribers?{}:void 0}=t;t.status=s,s&&(s.op="get",s.key=e,s.cache=this);let i=this.#G(e,t);return s&&(i!==void 0&&(s.value=i),V.hasSubscribers&&V.publish(s)),i}#G(e,t={}){let{allowStale:s=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:r=this.noDeleteOnStaleGet,status:o}=t,a=this.#h.get(e);if(a===void 0){o&&(o.get="miss");return}let l=this.#r[a],c=this.#l(l);return o&&this.#T(o,a),this.#k(a)?c?(o&&(o.get="stale-fetching"),s&&l.__staleWhileFetching!==void 0?(o&&(o.returnedStale=!0),l.__staleWhileFetching):void 0):(r||this.#I(e,"expire"),o&&(o.get="stale"),s?(o&&(o.returnedStale=!0),l):void 0):(o&&(o.get=c?"fetching":"hit"),this.#Y(a),i&&this.#O(a),c?l.__staleWhileFetching:l)}#K(e,t){this.#x[t]=e,this.#w[e]=t}#Y(e){e!==this.#g&&(e===this.#p?this.#p=this.#w[e]:this.#K(this.#x[e],this.#w[e]),this.#K(this.#g,e),this.#g=e)}delete(e){return this.#I(e,"delete")}#I(e,t){V.hasSubscribers&&V.publish({op:"delete",delete:t,key:e,cache:this});let s=!1;if(this.#a!==0){let i=this.#h.get(e);if(i!==void 0)if(this.#y?.[i]&&(clearTimeout(this.#y?.[i]),this.#y[i]=void 0),s=!0,this.#a===1)this.#X(t);else{this.#j(i);let r=this.#r[i];if(this.#l(r)?r.__abortController.abort(new Error("deleted")):(this.#v||this.#s)&&(this.#v&&this.#n?.(r,e,t),this.#s&&this.#m?.push([r,e,t])),this.#h.delete(e),this.#c[i]=void 0,this.#r[i]=void 0,i===this.#g)this.#g=this.#x[i];else if(i===this.#p)this.#p=this.#w[i];else{let o=this.#x[i];this.#w[o]=this.#w[i];let a=this.#w[i];this.#x[a]=this.#x[i]}this.#a--,this.#E.push(i)}}if(this.#s&&this.#m?.length){let i=this.#m,r;for(;r=i?.shift();)this.#o?.(...r)}return s}clear(){return this.#X("delete")}#X(e){for(let t of this.#$({allowStale:!0})){let s=this.#r[t];if(this.#l(s))s.__abortController.abort(new Error("deleted"));else{let i=this.#c[t];this.#v&&this.#n?.(s,i,e),this.#s&&this.#m?.push([s,i,e])}}if(this.#h.clear(),this.#r.fill(void 0),this.#c.fill(void 0),this.#d&&this.#C){this.#d.fill(0),this.#C.fill(0);for(let t of this.#y??[])t!==void 0&&clearTimeout(t);this.#y?.fill(void 0)}if(this.#S&&this.#S.fill(0),this.#p=0,this.#g=0,this.#E.length=0,this.#f=0,this.#a=0,this.#s&&this.#m){let t=this.#m,s;for(;s=t?.shift();)this.#o?.(...s)}}};var nt=require("node:path"),xo=require("node:url"),ve=require("fs"),ch=C(require("node:fs"),1),Me=require("node:fs/promises");var ms=require("node:events"),Ni=C(require("node:stream"),1),mo=require("node:string_decoder"),uo=typeof process=="object"&&process?process:{stdout:null,stderr:null},eh=n=>!!n&&typeof n=="object"&&(n instanceof Te||n instanceof Ni.default||th(n)||sh(n)),th=n=>!!n&&typeof n=="object"&&n instanceof ms.EventEmitter&&typeof n.pipe=="function"&&n.pipe!==Ni.default.Writable.prototype.pipe,sh=n=>!!n&&typeof n=="object"&&n instanceof ms.EventEmitter&&typeof n.write=="function"&&typeof n.end=="function",Ce=Symbol("EOF"),ke=Symbol("maybeEmitEnd"),Re=Symbol("emittedEnd"),hs=Symbol("emittingEnd"),kt=Symbol("emittedError"),us=Symbol("closed"),fo=Symbol("read"),fs=Symbol("flush"),po=Symbol("flushChunk"),pe=Symbol("encoding"),st=Symbol("decoder"),L=Symbol("flowing"),Et=Symbol("paused"),it=Symbol("resume"),W=Symbol("buffer"),X=Symbol("pipes"),H=Symbol("bufferLength"),Pi=Symbol("bufferPush"),ds=Symbol("bufferShift"),U=Symbol("objectMode"),$=Symbol("destroyed"),Ri=Symbol("error"),Ti=Symbol("emitData"),go=Symbol("emitEnd"),Mi=Symbol("emitEnd2"),be=Symbol("async"),ji=Symbol("abort"),ps=Symbol("aborted"),Ot=Symbol("signal"),Be=Symbol("dataListeners"),se=Symbol("discarded"),At=n=>Promise.resolve().then(n),ih=n=>n(),nh=n=>n==="end"||n==="finish"||n==="prefinish",rh=n=>n instanceof ArrayBuffer||!!n&&typeof n=="object"&&n.constructor&&n.constructor.name==="ArrayBuffer"&&n.byteLength>=0,oh=n=>!Buffer.isBuffer(n)&&ArrayBuffer.isView(n),gs=class{src;dest;opts;ondrain;constructor(e,t,s){this.src=e,this.dest=t,this.opts=s,this.ondrain=()=>e[it](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(e){}end(){this.unpipe(),this.opts.end&&this.dest.end()}},Di=class extends gs{unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(e,t,s){super(e,t,s),this.proxyErrors=i=>this.dest.emit("error",i),e.on("error",this.proxyErrors)}},ah=n=>!!n.objectMode,lh=n=>!n.objectMode&&!!n.encoding&&n.encoding!=="buffer",Te=class extends ms.EventEmitter{[L]=!1;[Et]=!1;[X]=[];[W]=[];[U];[pe];[be];[st];[Ce]=!1;[Re]=!1;[hs]=!1;[us]=!1;[kt]=null;[H]=0;[$]=!1;[Ot];[ps]=!1;[Be]=0;[se]=!1;writable=!0;readable=!0;constructor(...e){let t=e[0]||{};if(super(),t.objectMode&&typeof t.encoding=="string")throw new TypeError("Encoding and objectMode may not be used together");ah(t)?(this[U]=!0,this[pe]=null):lh(t)?(this[pe]=t.encoding,this[U]=!1):(this[U]=!1,this[pe]=null),this[be]=!!t.async,this[st]=this[pe]?new mo.StringDecoder(this[pe]):null,t&&t.debugExposeBuffer===!0&&Object.defineProperty(this,"buffer",{get:()=>this[W]}),t&&t.debugExposePipes===!0&&Object.defineProperty(this,"pipes",{get:()=>this[X]});let{signal:s}=t;s&&(this[Ot]=s,s.aborted?this[ji]():s.addEventListener("abort",()=>this[ji]()))}get bufferLength(){return this[H]}get encoding(){return this[pe]}set encoding(e){throw new Error("Encoding must be set at instantiation time")}setEncoding(e){throw new Error("Encoding must be set at instantiation time")}get objectMode(){return this[U]}set objectMode(e){throw new Error("objectMode must be set at instantiation time")}get async(){return this[be]}set async(e){this[be]=this[be]||!!e}[ji](){this[ps]=!0,this.emit("abort",this[Ot]?.reason),this.destroy(this[Ot]?.reason)}get aborted(){return this[ps]}set aborted(e){}write(e,t,s){if(this[ps])return!1;if(this[Ce])throw new Error("write after end");if(this[$])return this.emit("error",Object.assign(new Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;typeof t=="function"&&(s=t,t="utf8"),t||(t="utf8");let i=this[be]?At:ih;if(!this[U]&&!Buffer.isBuffer(e)){if(oh(e))e=Buffer.from(e.buffer,e.byteOffset,e.byteLength);else if(rh(e))e=Buffer.from(e);else if(typeof e!="string")throw new Error("Non-contiguous data written to non-objectMode stream")}return this[U]?(this[L]&&this[H]!==0&&this[fs](!0),this[L]?this.emit("data",e):this[Pi](e),this[H]!==0&&this.emit("readable"),s&&i(s),this[L]):e.length?(typeof e=="string"&&!(t===this[pe]&&!this[st]?.lastNeed)&&(e=Buffer.from(e,t)),Buffer.isBuffer(e)&&this[pe]&&(e=this[st].write(e)),this[L]&&this[H]!==0&&this[fs](!0),this[L]?this.emit("data",e):this[Pi](e),this[H]!==0&&this.emit("readable"),s&&i(s),this[L]):(this[H]!==0&&this.emit("readable"),s&&i(s),this[L])}read(e){if(this[$])return null;if(this[se]=!1,this[H]===0||e===0||e&&e>this[H])return this[ke](),null;this[U]&&(e=null),this[W].length>1&&!this[U]&&(this[W]=[this[pe]?this[W].join(""):Buffer.concat(this[W],this[H])]);let t=this[fo](e||null,this[W][0]);return this[ke](),t}[fo](e,t){if(this[U])this[ds]();else{let s=t;e===s.length||e===null?this[ds]():typeof s=="string"?(this[W][0]=s.slice(e),t=s.slice(0,e),this[H]-=e):(this[W][0]=s.subarray(e),t=s.subarray(0,e),this[H]-=e)}return this.emit("data",t),!this[W].length&&!this[Ce]&&this.emit("drain"),t}end(e,t,s){return typeof e=="function"&&(s=e,e=void 0),typeof t=="function"&&(s=t,t="utf8"),e!==void 0&&this.write(e,t),s&&this.once("end",s),this[Ce]=!0,this.writable=!1,(this[L]||!this[Et])&&this[ke](),this}[it](){this[$]||(!this[Be]&&!this[X].length&&(this[se]=!0),this[Et]=!1,this[L]=!0,this.emit("resume"),this[W].length?this[fs]():this[Ce]?this[ke]():this.emit("drain"))}resume(){return this[it]()}pause(){this[L]=!1,this[Et]=!0,this[se]=!1}get destroyed(){return this[$]}get flowing(){return this[L]}get paused(){return this[Et]}[Pi](e){this[U]?this[H]+=1:this[H]+=e.length,this[W].push(e)}[ds](){return this[U]?this[H]-=1:this[H]-=this[W][0].length,this[W].shift()}[fs](e=!1){do;while(this[po](this[ds]())&&this[W].length);!e&&!this[W].length&&!this[Ce]&&this.emit("drain")}[po](e){return this.emit("data",e),this[L]}pipe(e,t){if(this[$])return e;this[se]=!1;let s=this[Re];return t=t||{},e===uo.stdout||e===uo.stderr?t.end=!1:t.end=t.end!==!1,t.proxyErrors=!!t.proxyErrors,s?t.end&&e.end():(this[X].push(t.proxyErrors?new Di(this,e,t):new gs(this,e,t)),this[be]?At(()=>this[it]()):this[it]()),e}unpipe(e){let t=this[X].find(s=>s.dest===e);t&&(this[X].length===1?(this[L]&&this[Be]===0&&(this[L]=!1),this[X]=[]):this[X].splice(this[X].indexOf(t),1),t.unpipe())}addListener(e,t){return this.on(e,t)}on(e,t){let s=super.on(e,t);if(e==="data")this[se]=!1,this[Be]++,!this[X].length&&!this[L]&&this[it]();else if(e==="readable"&&this[H]!==0)super.emit("readable");else if(nh(e)&&this[Re])super.emit(e),this.removeAllListeners(e);else if(e==="error"&&this[kt]){let i=t;this[be]?At(()=>i.call(this,this[kt])):i.call(this,this[kt])}return s}removeListener(e,t){return this.off(e,t)}off(e,t){let s=super.off(e,t);return e==="data"&&(this[Be]=this.listeners("data").length,this[Be]===0&&!this[se]&&!this[X].length&&(this[L]=!1)),s}removeAllListeners(e){let t=super.removeAllListeners(e);return(e==="data"||e===void 0)&&(this[Be]=0,!this[se]&&!this[X].length&&(this[L]=!1)),t}get emittedEnd(){return this[Re]}[ke](){!this[hs]&&!this[Re]&&!this[$]&&this[W].length===0&&this[Ce]&&(this[hs]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[us]&&this.emit("close"),this[hs]=!1)}emit(e,...t){let s=t[0];if(e!=="error"&&e!=="close"&&e!==$&&this[$])return!1;if(e==="data")return!this[U]&&!s?!1:this[be]?(At(()=>this[Ti](s)),!0):this[Ti](s);if(e==="end")return this[go]();if(e==="close"){if(this[us]=!0,!this[Re]&&!this[$])return!1;let r=super.emit("close");return this.removeAllListeners("close"),r}else if(e==="error"){this[kt]=s,super.emit(Ri,s);let r=!this[Ot]||this.listeners("error").length?super.emit("error",s):!1;return this[ke](),r}else if(e==="resume"){let r=super.emit("resume");return this[ke](),r}else if(e==="finish"||e==="prefinish"){let r=super.emit(e);return this.removeAllListeners(e),r}let i=super.emit(e,...t);return this[ke](),i}[Ti](e){for(let s of this[X])s.dest.write(e)===!1&&this.pause();let t=this[se]?!1:super.emit("data",e);return this[ke](),t}[go](){return this[Re]?!1:(this[Re]=!0,this.readable=!1,this[be]?(At(()=>this[Mi]()),!0):this[Mi]())}[Mi](){if(this[st]){let t=this[st].end();if(t){for(let s of this[X])s.dest.write(t);this[se]||super.emit("data",t)}}for(let t of this[X])t.end();let e=super.emit("end");return this.removeAllListeners("end"),e}async collect(){let e=Object.assign([],{dataLength:0});this[U]||(e.dataLength=0);let t=this.promise();return this.on("data",s=>{e.push(s),this[U]||(e.dataLength+=s.length)}),await t,e}async concat(){if(this[U])throw new Error("cannot concat in objectMode");let e=await this.collect();return this[pe]?e.join(""):Buffer.concat(e,e.dataLength)}async promise(){return new Promise((e,t)=>{this.on($,()=>t(new Error("stream destroyed"))),this.on("error",s=>t(s)),this.on("end",()=>e())})}[Symbol.asyncIterator](){this[se]=!1;let e=!1,t=async()=>(this.pause(),e=!0,{value:void 0,done:!0});return{next:()=>{if(e)return t();let i=this.read();if(i!==null)return Promise.resolve({done:!1,value:i});if(this[Ce])return t();let r,o,a=h=>{this.off("data",l),this.off("end",c),this.off($,u),t(),o(h)},l=h=>{this.off("error",a),this.off("end",c),this.off($,u),this.pause(),r({value:h,done:!!this[Ce]})},c=()=>{this.off("error",a),this.off("data",l),this.off($,u),t(),r({done:!0,value:void 0})},u=()=>a(new Error("stream destroyed"));return new Promise((h,f)=>{o=f,r=h,this.once($,u),this.once("error",a),this.once("end",c),this.once("data",l)})},throw:t,return:t,[Symbol.asyncIterator](){return this},[Symbol.asyncDispose]:async()=>{}}}[Symbol.iterator](){this[se]=!1;let e=!1,t=()=>(this.pause(),this.off(Ri,t),this.off($,t),this.off("end",t),e=!0,{done:!0,value:void 0}),s=()=>{if(e)return t();let i=this.read();return i===null?t():{done:!1,value:i}};return this.once("end",t),this.once(Ri,t),this.once($,t),{next:s,throw:t,return:t,[Symbol.iterator](){return this},[Symbol.dispose]:()=>{}}}destroy(e){if(this[$])return e?this.emit("error",e):this.emit($),this;this[$]=!0,this[se]=!0,this[W].length=0,this[H]=0;let t=this;return typeof t.close=="function"&&!this[us]&&t.close(),e?this.emit("error",e):this.emit($),this}static get isStream(){return eh}};var hh=ve.realpathSync.native,$t={lstatSync:ve.lstatSync,readdir:ve.readdir,readdirSync:ve.readdirSync,readlinkSync:ve.readlinkSync,realpathSync:hh,promises:{lstat:Me.lstat,readdir:Me.readdir,readlink:Me.readlink,realpath:Me.realpath}},So=n=>!n||n===$t||n===ch?$t:{...$t,...n,promises:{...$t.promises,...n.promises||{}}},_o=/^\\\\\?\\([a-z]:)\\?$/i,uh=n=>n.replace(/\//g,"\\").replace(_o,"$1\\"),fh=/[\\\/]/,ce=0,Co=1,ko=2,we=4,Eo=6,Oo=8,Ve=10,Ao=12,le=15,Ft=~le,Ii=16,yo=32,Pt=64,ge=128,ys=256,ws=512,bo=Pt|ge|ws,dh=1023,Li=n=>n.isFile()?Oo:n.isDirectory()?we:n.isSymbolicLink()?Ve:n.isCharacterDevice()?ko:n.isBlockDevice()?Eo:n.isSocket()?Ao:n.isFIFO()?Co:ce,wo=new Ct({max:2**12}),Rt=n=>{let e=wo.get(n);if(e)return e;let t=n.normalize("NFKD");return wo.set(n,t),t},vo=new Ct({max:2**12}),bs=n=>{let e=vo.get(n);if(e)return e;let t=Rt(n.toLowerCase());return vo.set(n,t),t},vs=class extends Ct{constructor(){super({max:256})}},Wi=class extends Ct{constructor(e=16*1024){super({maxSize:e,sizeCalculation:t=>t.length+1})}},Fo=Symbol("PathScurry setAsCwd"),z=class{name;root;roots;parent;nocase;isCWD=!1;#e;#i;get dev(){return this.#i}#n;get mode(){return this.#n}#t;get nlink(){return this.#t}#o;get uid(){return this.#o}#_;get gid(){return this.#_}#b;get rdev(){return this.#b}#u;get blksize(){return this.#u}#a;get ino(){return this.#a}#f;get size(){return this.#f}#h;get blocks(){return this.#h}#c;get atimeMs(){return this.#c}#r;get mtimeMs(){return this.#r}#w;get ctimeMs(){return this.#w}#x;get birthtimeMs(){return this.#x}#p;get atime(){return this.#p}#g;get mtime(){return this.#g}#E;get ctime(){return this.#E}#m;get birthtime(){return this.#m}#S;#C;#d;#y;#v;#A;#s;#P;#R;#O;get parentPath(){return(this.parent||this).fullpath()}get path(){return this.parentPath}constructor(e,t=ce,s,i,r,o,a){this.name=e,this.#S=r?bs(e):Rt(e),this.#s=t&dh,this.nocase=r,this.roots=i,this.root=s||this,this.#P=o,this.#d=a.fullpath,this.#v=a.relative,this.#A=a.relativePosix,this.parent=a.parent,this.parent?this.#e=this.parent.#e:this.#e=So(a.fs)}depth(){return this.#C!==void 0?this.#C:this.parent?this.#C=this.parent.depth()+1:this.#C=0}childrenCache(){return this.#P}resolve(e){if(!e)return this;let t=this.getRootString(e),i=e.substring(t.length).split(this.splitSep);return t?this.getRoot(t).#T(i):this.#T(i)}#T(e){let t=this;for(let s of e)t=t.child(s);return t}children(){let e=this.#P.get(this);if(e)return e;let t=Object.assign([],{provisional:0});return this.#P.set(this,t),this.#s&=~Ii,t}child(e,t){if(e===""||e===".")return this;if(e==="..")return this.parent||this;let s=this.children(),i=this.nocase?bs(e):Rt(e);for(let l of s)if(l.#S===i)return l;let r=this.parent?this.sep:"",o=this.#d?this.#d+r+e:void 0,a=this.newChild(e,ce,{...t,parent:this,fullpath:o});return this.canReaddir()||(a.#s|=ge),s.push(a),a}relative(){if(this.isCWD)return"";if(this.#v!==void 0)return this.#v;let e=this.name,t=this.parent;if(!t)return this.#v=this.name;let s=t.relative();return s+(!s||!t.parent?"":this.sep)+e}relativePosix(){if(this.sep==="/")return this.relative();if(this.isCWD)return"";if(this.#A!==void 0)return this.#A;let e=this.name,t=this.parent;if(!t)return this.#A=this.fullpathPosix();let s=t.relativePosix();return s+(!s||!t.parent?"":"/")+e}fullpath(){if(this.#d!==void 0)return this.#d;let e=this.name,t=this.parent;if(!t)return this.#d=this.name;let i=t.fullpath()+(t.parent?this.sep:"")+e;return this.#d=i}fullpathPosix(){if(this.#y!==void 0)return this.#y;if(this.sep==="/")return this.#y=this.fullpath();if(!this.parent){let i=this.fullpath().replace(/\\/g,"/");return/^[a-z]:\//i.test(i)?this.#y=`//?/${i}`:this.#y=i}let e=this.parent,t=e.fullpathPosix(),s=t+(!t||!e.parent?"":"/")+this.name;return this.#y=s}isUnknown(){return(this.#s&le)===ce}isType(e){return this[`is${e}`]()}getType(){return this.isUnknown()?"Unknown":this.isDirectory()?"Directory":this.isFile()?"File":this.isSymbolicLink()?"SymbolicLink":this.isFIFO()?"FIFO":this.isCharacterDevice()?"CharacterDevice":this.isBlockDevice()?"BlockDevice":this.isSocket()?"Socket":"Unknown"}isFile(){return(this.#s&le)===Oo}isDirectory(){return(this.#s&le)===we}isCharacterDevice(){return(this.#s&le)===ko}isBlockDevice(){return(this.#s&le)===Eo}isFIFO(){return(this.#s&le)===Co}isSocket(){return(this.#s&le)===Ao}isSymbolicLink(){return(this.#s&Ve)===Ve}lstatCached(){return this.#s&yo?this:void 0}readlinkCached(){return this.#R}realpathCached(){return this.#O}readdirCached(){let e=this.children();return e.slice(0,e.provisional)}canReadlink(){if(this.#R)return!0;if(!this.parent)return!1;let e=this.#s&le;return!(e!==ce&&e!==Ve||this.#s&ys||this.#s&ge)}calledReaddir(){return!!(this.#s&Ii)}isENOENT(){return!!(this.#s&ge)}isNamed(e){return this.nocase?this.#S===bs(e):this.#S===Rt(e)}async readlink(){let e=this.#R;if(e)return e;if(this.canReadlink()&&this.parent)try{let t=await this.#e.promises.readlink(this.fullpath()),s=(await this.parent.realpath())?.resolve(t);if(s)return this.#R=s}catch(t){this.#$(t.code);return}}readlinkSync(){let e=this.#R;if(e)return e;if(this.canReadlink()&&this.parent)try{let t=this.#e.readlinkSync(this.fullpath()),s=this.parent.realpathSync()?.resolve(t);if(s)return this.#R=s}catch(t){this.#$(t.code);return}}#L(e){this.#s|=Ii;for(let t=e.provisional;t<e.length;t++){let s=e[t];s&&s.#k()}}#k(){this.#s&ge||(this.#s=(this.#s|ge)&Ft,this.#q())}#q(){let e=this.children();e.provisional=0;for(let t of e)t.#k()}#j(){this.#s|=ws,this.#M()}#M(){if(this.#s&Pt)return;let e=this.#s;(e&le)===we&&(e&=Ft),this.#s=e|Pt,this.#q()}#W(e=""){e==="ENOTDIR"||e==="EPERM"?this.#M():e==="ENOENT"?this.#k():this.children().provisional=0}#F(e=""){e==="ENOTDIR"?this.parent.#M():e==="ENOENT"&&this.#k()}#$(e=""){let t=this.#s;t|=ys,e==="ENOENT"&&(t|=ge),(e==="EINVAL"||e==="UNKNOWN")&&(t&=Ft),this.#s=t,e==="ENOTDIR"&&this.parent&&this.parent.#M()}#H(e,t){return this.#V(e,t)||this.#D(e,t)}#D(e,t){let s=Li(e),i=this.newChild(e.name,s,{parent:this}),r=i.#s&le;return r!==we&&r!==Ve&&r!==ce&&(i.#s|=Pt),t.unshift(i),t.provisional++,i}#V(e,t){for(let s=t.provisional;s<t.length;s++){let i=t[s];if((this.nocase?bs(e.name):Rt(e.name))===i.#S)return this.#J(e,i,s,t)}}#J(e,t,s,i){let r=t.name;return t.#s=t.#s&Ft|Li(e),r!==e.name&&(t.name=e.name),s!==i.provisional&&(s===i.length-1?i.pop():i.splice(s,1),i.unshift(t)),i.provisional++,t}async lstat(){if(!(this.#s&ge))try{return this.#U(await this.#e.promises.lstat(this.fullpath())),this}catch(e){this.#F(e.code)}}lstatSync(){if(!(this.#s&ge))try{return this.#U(this.#e.lstatSync(this.fullpath())),this}catch(e){this.#F(e.code)}}#U(e){let{atime:t,atimeMs:s,birthtime:i,birthtimeMs:r,blksize:o,blocks:a,ctime:l,ctimeMs:c,dev:u,gid:h,ino:f,mode:d,mtime:g,mtimeMs:p,nlink:y,rdev:m,size:x,uid:_}=e;this.#p=t,this.#c=s,this.#m=i,this.#x=r,this.#u=o,this.#h=a,this.#E=l,this.#w=c,this.#i=u,this.#_=h,this.#a=f,this.#n=d,this.#g=g,this.#r=p,this.#t=y,this.#b=m,this.#f=x,this.#o=_;let w=Li(e);this.#s=this.#s&Ft|w|yo,w!==ce&&w!==we&&w!==Ve&&(this.#s|=Pt)}#N=[];#l=!1;#z(e){this.#l=!1;let t=this.#N.slice();this.#N.length=0,t.forEach(s=>s(null,e))}readdirCB(e,t=!1){if(!this.canReaddir()){t?e(null,[]):queueMicrotask(()=>e(null,[]));return}let s=this.children();if(this.calledReaddir()){let r=s.slice(0,s.provisional);t?e(null,r):queueMicrotask(()=>e(null,r));return}if(this.#N.push(e),this.#l)return;this.#l=!0;let i=this.fullpath();this.#e.readdir(i,{withFileTypes:!0},(r,o)=>{if(r)this.#W(r.code),s.provisional=0;else{for(let a of o)this.#H(a,s);this.#L(s)}this.#z(s.slice(0,s.provisional))})}#B;async readdir(){if(!this.canReaddir())return[];let e=this.children();if(this.calledReaddir())return e.slice(0,e.provisional);let t=this.fullpath();if(this.#B)await this.#B;else{let s=()=>{};this.#B=new Promise(i=>s=i);try{for(let i of await this.#e.promises.readdir(t,{withFileTypes:!0}))this.#H(i,e);this.#L(e)}catch(i){this.#W(i.code),e.provisional=0}this.#B=void 0,s()}return e.slice(0,e.provisional)}readdirSync(){if(!this.canReaddir())return[];let e=this.children();if(this.calledReaddir())return e.slice(0,e.provisional);let t=this.fullpath();try{for(let s of this.#e.readdirSync(t,{withFileTypes:!0}))this.#H(s,e);this.#L(e)}catch(s){this.#W(s.code),e.provisional=0}return e.slice(0,e.provisional)}canReaddir(){if(this.#s&bo)return!1;let e=le&this.#s;return e===ce||e===we||e===Ve}shouldWalk(e,t){return(this.#s&we)===we&&!(this.#s&bo)&&!e.has(this)&&(!t||t(this))}async realpath(){if(this.#O)return this.#O;if(!((ws|ys|ge)&this.#s))try{let e=await this.#e.promises.realpath(this.fullpath());return this.#O=this.resolve(e)}catch{this.#j()}}realpathSync(){if(this.#O)return this.#O;if(!((ws|ys|ge)&this.#s))try{let e=this.#e.realpathSync(this.fullpath());return this.#O=this.resolve(e)}catch{this.#j()}}[Fo](e){if(e===this)return;e.isCWD=!1,this.isCWD=!0;let t=new Set([]),s=[],i=this;for(;i&&i.parent;)t.add(i),i.#v=s.join(this.sep),i.#A=s.join("/"),i=i.parent,s.push("..");for(i=e;i&&i.parent&&!t.has(i);)i.#v=void 0,i.#A=void 0,i=i.parent}},xs=class n extends z{sep="\\";splitSep=fh;constructor(e,t=ce,s,i,r,o,a){super(e,t,s,i,r,o,a)}newChild(e,t=ce,s={}){return new n(e,t,this.root,this.roots,this.nocase,this.childrenCache(),s)}getRootString(e){return nt.win32.parse(e).root}getRoot(e){if(e=uh(e.toUpperCase()),e===this.root.name)return this.root;for(let[t,s]of Object.entries(this.roots))if(this.sameRoot(e,t))return this.roots[e]=s;return this.roots[e]=new rt(e,this).root}sameRoot(e,t=this.root.name){return e=e.toUpperCase().replace(/\//g,"\\").replace(_o,"$1\\"),e===t}},Ss=class n extends z{splitSep="/";sep="/";constructor(e,t=ce,s,i,r,o,a){super(e,t,s,i,r,o,a)}getRootString(e){return e.startsWith("/")?"/":""}getRoot(e){return this.root}newChild(e,t=ce,s={}){return new n(e,t,this.root,this.roots,this.nocase,this.childrenCache(),s)}},_s=class{root;rootPath;roots;cwd;#e;#i;#n;nocase;#t;constructor(e=process.cwd(),t,s,{nocase:i,childrenCacheSize:r=16*1024,fs:o=$t}={}){this.#t=So(o),(e instanceof URL||e.startsWith("file://"))&&(e=(0,xo.fileURLToPath)(e));let a=t.resolve(e);this.roots=Object.create(null),this.rootPath=this.parseRootPath(a),this.#e=new vs,this.#i=new vs,this.#n=new Wi(r);let l=a.substring(this.rootPath.length).split(s);if(l.length===1&&!l[0]&&l.pop(),i===void 0)throw new TypeError("must provide nocase setting to PathScurryBase ctor");this.nocase=i,this.root=this.newRoot(this.#t),this.roots[this.rootPath]=this.root;let c=this.root,u=l.length-1,h=t.sep,f=this.rootPath,d=!1;for(let g of l){let p=u--;c=c.child(g,{relative:new Array(p).fill("..").join(h),relativePosix:new Array(p).fill("..").join("/"),fullpath:f+=(d?"":h)+g}),d=!0}this.cwd=c}depth(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),e.depth()}childrenCache(){return this.#n}resolve(...e){let t="";for(let r=e.length-1;r>=0;r--){let o=e[r];if(!(!o||o===".")&&(t=t?`${o}/${t}`:o,this.isAbsolute(o)))break}let s=this.#e.get(t);if(s!==void 0)return s;let i=this.cwd.resolve(t).fullpath();return this.#e.set(t,i),i}resolvePosix(...e){let t="";for(let r=e.length-1;r>=0;r--){let o=e[r];if(!(!o||o===".")&&(t=t?`${o}/${t}`:o,this.isAbsolute(o)))break}let s=this.#i.get(t);if(s!==void 0)return s;let i=this.cwd.resolve(t).fullpathPosix();return this.#i.set(t,i),i}relative(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),e.relative()}relativePosix(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),e.relativePosix()}basename(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),e.name}dirname(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),(e.parent||e).fullpath()}async readdir(e=this.cwd,t={withFileTypes:!0}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof z||(t=e,e=this.cwd);let{withFileTypes:s}=t;if(e.canReaddir()){let i=await e.readdir();return s?i:i.map(r=>r.name)}else return[]}readdirSync(e=this.cwd,t={withFileTypes:!0}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof z||(t=e,e=this.cwd);let{withFileTypes:s=!0}=t;return e.canReaddir()?s?e.readdirSync():e.readdirSync().map(i=>i.name):[]}async lstat(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),e.lstat()}lstatSync(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),e.lstatSync()}async readlink(e=this.cwd,{withFileTypes:t}={withFileTypes:!1}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof z||(t=e.withFileTypes,e=this.cwd);let s=await e.readlink();return t?s:s?.fullpath()}readlinkSync(e=this.cwd,{withFileTypes:t}={withFileTypes:!1}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof z||(t=e.withFileTypes,e=this.cwd);let s=e.readlinkSync();return t?s:s?.fullpath()}async realpath(e=this.cwd,{withFileTypes:t}={withFileTypes:!1}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof z||(t=e.withFileTypes,e=this.cwd);let s=await e.realpath();return t?s:s?.fullpath()}realpathSync(e=this.cwd,{withFileTypes:t}={withFileTypes:!1}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof z||(t=e.withFileTypes,e=this.cwd);let s=e.realpathSync();return t?s:s?.fullpath()}async walk(e=this.cwd,t={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof z||(t=e,e=this.cwd);let{withFileTypes:s=!0,follow:i=!1,filter:r,walkFilter:o}=t,a=[];(!r||r(e))&&a.push(s?e:e.fullpath());let l=new Set,c=(h,f)=>{l.add(h),h.readdirCB((d,g)=>{if(d)return f(d);let p=g.length;if(!p)return f();let y=()=>{--p===0&&f()};for(let m of g)(!r||r(m))&&a.push(s?m:m.fullpath()),i&&m.isSymbolicLink()?m.realpath().then(x=>x?.isUnknown()?x.lstat():x).then(x=>x?.shouldWalk(l,o)?c(x,y):y()):m.shouldWalk(l,o)?c(m,y):y()},!0)},u=e;return new Promise((h,f)=>{c(u,d=>{if(d)return f(d);h(a)})})}walkSync(e=this.cwd,t={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof z||(t=e,e=this.cwd);let{withFileTypes:s=!0,follow:i=!1,filter:r,walkFilter:o}=t,a=[];(!r||r(e))&&a.push(s?e:e.fullpath());let l=new Set([e]);for(let c of l){let u=c.readdirSync();for(let h of u){(!r||r(h))&&a.push(s?h:h.fullpath());let f=h;if(h.isSymbolicLink()){if(!(i&&(f=h.realpathSync())))continue;f.isUnknown()&&f.lstatSync()}f.shouldWalk(l,o)&&l.add(f)}}return a}[Symbol.asyncIterator](){return this.iterate()}iterate(e=this.cwd,t={}){return typeof e=="string"?e=this.cwd.resolve(e):e instanceof z||(t=e,e=this.cwd),this.stream(e,t)[Symbol.asyncIterator]()}[Symbol.iterator](){return this.iterateSync()}*iterateSync(e=this.cwd,t={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof z||(t=e,e=this.cwd);let{withFileTypes:s=!0,follow:i=!1,filter:r,walkFilter:o}=t;(!r||r(e))&&(yield s?e:e.fullpath());let a=new Set([e]);for(let l of a){let c=l.readdirSync();for(let u of c){(!r||r(u))&&(yield s?u:u.fullpath());let h=u;if(u.isSymbolicLink()){if(!(i&&(h=u.realpathSync())))continue;h.isUnknown()&&h.lstatSync()}h.shouldWalk(a,o)&&a.add(h)}}}stream(e=this.cwd,t={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof z||(t=e,e=this.cwd);let{withFileTypes:s=!0,follow:i=!1,filter:r,walkFilter:o}=t,a=new Te({objectMode:!0});(!r||r(e))&&a.write(s?e:e.fullpath());let l=new Set,c=[e],u=0,h=()=>{let f=!1;for(;!f;){let d=c.shift();if(!d){u===0&&a.end();return}u++,l.add(d);let g=(y,m,x=!1)=>{if(y)return a.emit("error",y);if(i&&!x){let _=[];for(let w of m)w.isSymbolicLink()&&_.push(w.realpath().then(b=>b?.isUnknown()?b.lstat():b));if(_.length){Promise.all(_).then(()=>g(null,m,!0));return}}for(let _ of m)_&&(!r||r(_))&&(a.write(s?_:_.fullpath())||(f=!0));u--;for(let _ of m){let w=_.realpathCached()||_;w.shouldWalk(l,o)&&c.push(w)}f&&!a.flowing?a.once("drain",h):p||h()},p=!0;d.readdirCB(g,!0),p=!1}};return h(),a}streamSync(e=this.cwd,t={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof z||(t=e,e=this.cwd);let{withFileTypes:s=!0,follow:i=!1,filter:r,walkFilter:o}=t,a=new Te({objectMode:!0}),l=new Set;(!r||r(e))&&a.write(s?e:e.fullpath());let c=[e],u=0,h=()=>{let f=!1;for(;!f;){let d=c.shift();if(!d){u===0&&a.end();return}u++,l.add(d);let g=d.readdirSync();for(let p of g)(!r||r(p))&&(a.write(s?p:p.fullpath())||(f=!0));u--;for(let p of g){let y=p;if(p.isSymbolicLink()){if(!(i&&(y=p.realpathSync())))continue;y.isUnknown()&&y.lstatSync()}y.shouldWalk(l,o)&&c.push(y)}}f&&!a.flowing&&a.once("drain",h)};return h(),a}chdir(e=this.cwd){let t=this.cwd;this.cwd=typeof e=="string"?this.cwd.resolve(e):e,this.cwd[Fo](t)}},rt=class extends _s{sep="\\";constructor(e=process.cwd(),t={}){let{nocase:s=!0}=t;super(e,nt.win32,"\\",{...t,nocase:s}),this.nocase=s;for(let i=this.cwd;i;i=i.parent)i.nocase=this.nocase}parseRootPath(e){return nt.win32.parse(e).root.toUpperCase()}newRoot(e){return new xs(this.rootPath,we,void 0,this.roots,this.nocase,this.childrenCache(),{fs:e})}isAbsolute(e){return e.startsWith("/")||e.startsWith("\\")||/^[a-z]:(\/|\\)/i.test(e)}},ot=class extends _s{sep="/";constructor(e=process.cwd(),t={}){let{nocase:s=!1}=t;super(e,nt.posix,"/",{...t,nocase:s}),this.nocase=s}parseRootPath(e){return"/"}newRoot(e){return new Ss(this.rootPath,we,void 0,this.roots,this.nocase,this.childrenCache(),{fs:e})}isAbsolute(e){return e.startsWith("/")}},Tt=class extends ot{constructor(e=process.cwd(),t={}){let{nocase:s=!0}=t;super(e,{...t,nocase:s})}},Yf=process.platform==="win32"?xs:Ss,$o=process.platform==="win32"?rt:process.platform==="darwin"?Tt:ot;var ph=n=>n.length>=1,gh=n=>n.length>=1,at=class n{#e;#i;#n;length;#t;#o;#_;#b;#u;#a;#f=!0;constructor(e,t,s,i){if(!ph(e))throw new TypeError("empty pattern list");if(!gh(t))throw new TypeError("empty glob list");if(t.length!==e.length)throw new TypeError("mismatched pattern list and glob list lengths");if(this.length=e.length,s<0||s>=this.length)throw new TypeError("index out of range");if(this.#e=e,this.#i=t,this.#n=s,this.#t=i,this.#n===0){if(this.isUNC()){let[r,o,a,l,...c]=this.#e,[u,h,f,d,...g]=this.#i;c[0]===""&&(c.shift(),g.shift());let p=[r,o,a,l,""].join("/"),y=[u,h,f,d,""].join("/");this.#e=[p,...c],this.#i=[y,...g],this.length=this.#e.length}else if(this.isDrive()||this.isAbsolute()){let[r,...o]=this.#e,[a,...l]=this.#i;o[0]===""&&(o.shift(),l.shift());let c=r+"/",u=a+"/";this.#e=[c,...o],this.#i=[u,...l],this.length=this.#e.length}}}pattern(){return this.#e[this.#n]}isString(){return typeof this.#e[this.#n]=="string"}isGlobstar(){return this.#e[this.#n]===F}isRegExp(){return this.#e[this.#n]instanceof RegExp}globString(){return this.#_=this.#_||(this.#n===0?this.isAbsolute()?this.#i[0]+this.#i.slice(1).join("/"):this.#i.join("/"):this.#i.slice(this.#n).join("/"))}hasMore(){return this.length>this.#n+1}rest(){return this.#o!==void 0?this.#o:this.hasMore()?(this.#o=new n(this.#e,this.#i,this.#n+1,this.#t),this.#o.#a=this.#a,this.#o.#u=this.#u,this.#o.#b=this.#b,this.#o):this.#o=null}isUNC(){let e=this.#e;return this.#u!==void 0?this.#u:this.#u=this.#t==="win32"&&this.#n===0&&e[0]===""&&e[1]===""&&typeof e[2]=="string"&&!!e[2]&&typeof e[3]=="string"&&!!e[3]}isDrive(){let e=this.#e;return this.#b!==void 0?this.#b:this.#b=this.#t==="win32"&&this.#n===0&&this.length>1&&typeof e[0]=="string"&&/^[a-z]:$/i.test(e[0])}isAbsolute(){let e=this.#e;return this.#a!==void 0?this.#a:this.#a=e[0]===""&&e.length>1||this.isDrive()||this.isUNC()}root(){let e=this.#e[0];return typeof e=="string"&&this.isAbsolute()&&this.#n===0?e:""}checkFollowGlobstar(){return!(this.#n===0||!this.isGlobstar()||!this.#f)}markFollowGlobstar(){return this.#n===0||!this.isGlobstar()||!this.#f?!1:(this.#f=!1,!0)}};var mh=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",lt=class{relative;relativeChildren;absolute;absoluteChildren;platform;mmopts;constructor(e,{nobrace:t,nocase:s,noext:i,noglobstar:r,platform:o=mh}){this.relative=[],this.absolute=[],this.relativeChildren=[],this.absoluteChildren=[],this.platform=o,this.mmopts={dot:!0,nobrace:t,nocase:s,noext:i,noglobstar:r,optimizationLevel:2,platform:o,nocomment:!0,nonegate:!0};for(let a of e)this.add(a)}add(e){let t=new te(e,this.mmopts);for(let s=0;s<t.set.length;s++){let i=t.set[s],r=t.globParts[s];if(!i||!r)throw new Error("invalid pattern object");for(;i[0]==="."&&r[0]===".";)i.shift(),r.shift();let o=new at(i,r,0,this.platform),a=new te(o.globString(),this.mmopts),l=r[r.length-1]==="**",c=o.isAbsolute();c?this.absolute.push(a):this.relative.push(a),l&&(c?this.absoluteChildren.push(a):this.relativeChildren.push(a))}}ignored(e){let t=e.fullpath(),s=`${t}/`,i=e.relative()||".",r=`${i}/`;for(let o of this.relative)if(o.match(i)||o.match(r))return!0;for(let o of this.absolute)if(o.match(t)||o.match(s))return!0;return!1}childrenIgnored(e){let t=e.fullpath()+"/",s=(e.relative()||".")+"/";for(let i of this.relativeChildren)if(i.match(s))return!0;for(let i of this.absoluteChildren)if(i.match(t))return!0;return!1}};var Hi=class n{store;constructor(e=new Map){this.store=e}copy(){return new n(new Map(this.store))}hasWalked(e,t){return this.store.get(e.fullpath())?.has(t.globString())}storeWalked(e,t){let s=e.fullpath(),i=this.store.get(s);i?i.add(t.globString()):this.store.set(s,new Set([t.globString()]))}},Bi=class{store=new Map;add(e,t,s){let i=(t?2:0)|(s?1:0),r=this.store.get(e);this.store.set(e,r===void 0?i:i&r)}entries(){return[...this.store.entries()].map(([e,t])=>[e,!!(t&2),!!(t&1)])}},Vi=class{store=new Map;add(e,t){if(!e.canReaddir())return;let s=this.store.get(e);s?s.find(i=>i.globString()===t.globString())||s.push(t):this.store.set(e,[t])}get(e){let t=this.store.get(e);if(!t)throw new Error("attempting to walk unknown path");return t}entries(){return this.keys().map(e=>[e,this.store.get(e)])}keys(){return[...this.store.keys()].filter(e=>e.canReaddir())}},Mt=class n{hasWalkedCache;matches=new Bi;subwalks=new Vi;patterns;follow;dot;opts;constructor(e,t){this.opts=e,this.follow=!!e.follow,this.dot=!!e.dot,this.hasWalkedCache=t?t.copy():new Hi}processPatterns(e,t){this.patterns=t;let s=t.map(i=>[e,i]);for(let[i,r]of s){this.hasWalkedCache.storeWalked(i,r);let o=r.root(),a=r.isAbsolute()&&this.opts.absolute!==!1;if(o){i=i.resolve(o==="/"&&this.opts.root!==void 0?this.opts.root:o);let h=r.rest();if(h)r=h;else{this.matches.add(i,!0,!1);continue}}if(i.isENOENT())continue;let l,c,u=!1;for(;typeof(l=r.pattern())=="string"&&(c=r.rest());)i=i.resolve(l),r=c,u=!0;if(l=r.pattern(),c=r.rest(),u){if(this.hasWalkedCache.hasWalked(i,r))continue;this.hasWalkedCache.storeWalked(i,r)}if(typeof l=="string"){let h=l===".."||l===""||l===".";this.matches.add(i.resolve(l),a,h);continue}else if(l===F){(!i.isSymbolicLink()||this.follow||r.checkFollowGlobstar())&&this.subwalks.add(i,r);let h=c?.pattern(),f=c?.rest();if(!c||(h===""||h===".")&&!f)this.matches.add(i,a,h===""||h===".");else if(h===".."){let d=i.parent||i;f?this.hasWalkedCache.hasWalked(d,f)||this.subwalks.add(d,f):this.matches.add(d,a,!0)}}else l instanceof RegExp&&this.subwalks.add(i,r)}return this}subwalkTargets(){return this.subwalks.keys()}child(){return new n(this.opts,this.hasWalkedCache)}filterEntries(e,t){let s=this.subwalks.get(e),i=this.child();for(let r of t)for(let o of s){let a=o.isAbsolute(),l=o.pattern(),c=o.rest();l===F?i.testGlobstar(r,o,c,a):l instanceof RegExp?i.testRegExp(r,l,c,a):i.testString(r,l,c,a)}return i}testGlobstar(e,t,s,i){if((this.dot||!e.name.startsWith("."))&&(t.hasMore()||this.matches.add(e,i,!1),e.canReaddir()&&(this.follow||!e.isSymbolicLink()?this.subwalks.add(e,t):e.isSymbolicLink()&&(s&&t.checkFollowGlobstar()?this.subwalks.add(e,s):t.markFollowGlobstar()&&this.subwalks.add(e,t)))),s){let r=s.pattern();if(typeof r=="string"&&r!==".."&&r!==""&&r!==".")this.testString(e,r,s.rest(),i);else if(r===".."){let o=e.parent||e;this.subwalks.add(o,s)}else r instanceof RegExp&&this.testRegExp(e,r,s.rest(),i)}}testRegExp(e,t,s,i){t.test(e.name)&&(s?this.subwalks.add(e,s):this.matches.add(e,i,!1))}testString(e,t,s,i){e.isNamed(t)&&(s?this.subwalks.add(e,s):this.matches.add(e,i,!1))}};var yh=(n,e)=>typeof n=="string"?new lt([n],e):Array.isArray(n)?new lt(n,e):n,Cs=class{path;patterns;opts;seen=new Set;paused=!1;aborted=!1;#e=[];#i;#n;signal;maxDepth;includeChildMatches;constructor(e,t,s){if(this.patterns=e,this.path=t,this.opts=s,this.#n=!s.posix&&s.platform==="win32"?"\\":"/",this.includeChildMatches=s.includeChildMatches!==!1,(s.ignore||!this.includeChildMatches)&&(this.#i=yh(s.ignore??[],s),!this.includeChildMatches&&typeof this.#i.add!="function")){let i="cannot ignore child matches, ignore lacks add() method.";throw new Error(i)}this.maxDepth=s.maxDepth||1/0,s.signal&&(this.signal=s.signal,this.signal.addEventListener("abort",()=>{this.#e.length=0}))}#t(e){return this.seen.has(e)||!!this.#i?.ignored?.(e)}#o(e){return!!this.#i?.childrenIgnored?.(e)}pause(){this.paused=!0}resume(){if(this.signal?.aborted)return;this.paused=!1;let e;for(;!this.paused&&(e=this.#e.shift());)e()}onResume(e){this.signal?.aborted||(this.paused?this.#e.push(e):e())}async matchCheck(e,t){if(t&&this.opts.nodir)return;let s;if(this.opts.realpath){if(s=e.realpathCached()||await e.realpath(),!s)return;e=s}let r=e.isUnknown()||this.opts.stat?await e.lstat():e;if(this.opts.follow&&this.opts.nodir&&r?.isSymbolicLink()){let o=await r.realpath();o&&(o.isUnknown()||this.opts.stat)&&await o.lstat()}return this.matchCheckTest(r,t)}matchCheckTest(e,t){return e&&(this.maxDepth===1/0||e.depth()<=this.maxDepth)&&(!t||e.canReaddir())&&(!this.opts.nodir||!e.isDirectory())&&(!this.opts.nodir||!this.opts.follow||!e.isSymbolicLink()||!e.realpathCached()?.isDirectory())&&!this.#t(e)?e:void 0}matchCheckSync(e,t){if(t&&this.opts.nodir)return;let s;if(this.opts.realpath){if(s=e.realpathCached()||e.realpathSync(),!s)return;e=s}let r=e.isUnknown()||this.opts.stat?e.lstatSync():e;if(this.opts.follow&&this.opts.nodir&&r?.isSymbolicLink()){let o=r.realpathSync();o&&(o?.isUnknown()||this.opts.stat)&&o.lstatSync()}return this.matchCheckTest(r,t)}matchFinish(e,t){if(this.#t(e))return;if(!this.includeChildMatches&&this.#i?.add){let r=`${e.relativePosix()}/**`;this.#i.add(r)}let s=this.opts.absolute===void 0?t:this.opts.absolute;this.seen.add(e);let i=this.opts.mark&&e.isDirectory()?this.#n:"";if(this.opts.withFileTypes)this.matchEmit(e);else if(s){let r=this.opts.posix?e.fullpathPosix():e.fullpath();this.matchEmit(r+i)}else{let r=this.opts.posix?e.relativePosix():e.relative(),o=this.opts.dotRelative&&!r.startsWith(".."+this.#n)?"."+this.#n:"";this.matchEmit(r?o+r+i:"."+i)}}async match(e,t,s){let i=await this.matchCheck(e,s);i&&this.matchFinish(i,t)}matchSync(e,t,s){let i=this.matchCheckSync(e,s);i&&this.matchFinish(i,t)}walkCB(e,t,s){this.signal?.aborted&&s(),this.walkCB2(e,t,new Mt(this.opts),s)}walkCB2(e,t,s,i){if(this.#o(e))return i();if(this.signal?.aborted&&i(),this.paused){this.onResume(()=>this.walkCB2(e,t,s,i));return}s.processPatterns(e,t);let r=1,o=()=>{--r===0&&i()};for(let[a,l,c]of s.matches.entries())this.#t(a)||(r++,this.match(a,l,c).then(()=>o()));for(let a of s.subwalkTargets()){if(this.maxDepth!==1/0&&a.depth()>=this.maxDepth)continue;r++;let l=a.readdirCached();a.calledReaddir()?this.walkCB3(a,l,s,o):a.readdirCB((c,u)=>this.walkCB3(a,u,s,o),!0)}o()}walkCB3(e,t,s,i){s=s.filterEntries(e,t);let r=1,o=()=>{--r===0&&i()};for(let[a,l,c]of s.matches.entries())this.#t(a)||(r++,this.match(a,l,c).then(()=>o()));for(let[a,l]of s.subwalks.entries())r++,this.walkCB2(a,l,s.child(),o);o()}walkCBSync(e,t,s){this.signal?.aborted&&s(),this.walkCB2Sync(e,t,new Mt(this.opts),s)}walkCB2Sync(e,t,s,i){if(this.#o(e))return i();if(this.signal?.aborted&&i(),this.paused){this.onResume(()=>this.walkCB2Sync(e,t,s,i));return}s.processPatterns(e,t);let r=1,o=()=>{--r===0&&i()};for(let[a,l,c]of s.matches.entries())this.#t(a)||this.matchSync(a,l,c);for(let a of s.subwalkTargets()){if(this.maxDepth!==1/0&&a.depth()>=this.maxDepth)continue;r++;let l=a.readdirSync();this.walkCB3Sync(a,l,s,o)}o()}walkCB3Sync(e,t,s,i){s=s.filterEntries(e,t);let r=1,o=()=>{--r===0&&i()};for(let[a,l,c]of s.matches.entries())this.#t(a)||this.matchSync(a,l,c);for(let[a,l]of s.subwalks.entries())r++,this.walkCB2Sync(a,l,s.child(),o);o()}},jt=class extends Cs{matches=new Set;constructor(e,t,s){super(e,t,s)}matchEmit(e){this.matches.add(e)}async walk(){if(this.signal?.aborted)throw this.signal.reason;return this.path.isUnknown()&&await this.path.lstat(),await new Promise((e,t)=>{this.walkCB(this.path,this.patterns,()=>{this.signal?.aborted?t(this.signal.reason):e(this.matches)})}),this.matches}walkSync(){if(this.signal?.aborted)throw this.signal.reason;return this.path.isUnknown()&&this.path.lstatSync(),this.walkCBSync(this.path,this.patterns,()=>{if(this.signal?.aborted)throw this.signal.reason}),this.matches}},Dt=class extends Cs{results;constructor(e,t,s){super(e,t,s),this.results=new Te({signal:this.signal,objectMode:!0}),this.results.on("drain",()=>this.resume()),this.results.on("resume",()=>this.resume())}matchEmit(e){this.results.write(e),this.results.flowing||this.pause()}stream(){let e=this.path;return e.isUnknown()?e.lstat().then(()=>{this.walkCB(e,this.patterns,()=>this.results.end())}):this.walkCB(e,this.patterns,()=>this.results.end()),this.results}streamSync(){return this.path.isUnknown()&&this.path.lstatSync(),this.walkCBSync(this.path,this.patterns,()=>this.results.end()),this.results}};var bh=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",me=class{absolute;cwd;root;dot;dotRelative;follow;ignore;magicalBraces;mark;matchBase;maxDepth;nobrace;nocase;nodir;noext;noglobstar;pattern;platform;realpath;scurry;stat;signal;windowsPathsNoEscape;withFileTypes;includeChildMatches;opts;patterns;constructor(e,t){if(!t)throw new TypeError("glob options required");if(this.withFileTypes=!!t.withFileTypes,this.signal=t.signal,this.follow=!!t.follow,this.dot=!!t.dot,this.dotRelative=!!t.dotRelative,this.nodir=!!t.nodir,this.mark=!!t.mark,t.cwd?(t.cwd instanceof URL||t.cwd.startsWith("file://"))&&(t.cwd=(0,Po.fileURLToPath)(t.cwd)):this.cwd="",this.cwd=t.cwd||"",this.root=t.root,this.magicalBraces=!!t.magicalBraces,this.nobrace=!!t.nobrace,this.noext=!!t.noext,this.realpath=!!t.realpath,this.absolute=t.absolute,this.includeChildMatches=t.includeChildMatches!==!1,this.noglobstar=!!t.noglobstar,this.matchBase=!!t.matchBase,this.maxDepth=typeof t.maxDepth=="number"?t.maxDepth:1/0,this.stat=!!t.stat,this.ignore=t.ignore,this.withFileTypes&&this.absolute!==void 0)throw new Error("cannot set absolute and withFileTypes:true");if(typeof e=="string"&&(e=[e]),this.windowsPathsNoEscape=!!t.windowsPathsNoEscape||t.allowWindowsEscape===!1,this.windowsPathsNoEscape&&(e=e.map(l=>l.replace(/\\/g,"/"))),this.matchBase){if(t.noglobstar)throw new TypeError("base matching requires globstar");e=e.map(l=>l.includes("/")?l:`./**/${l}`)}if(this.pattern=e,this.platform=t.platform||bh,this.opts={...t,platform:this.platform},t.scurry){if(this.scurry=t.scurry,t.nocase!==void 0&&t.nocase!==t.scurry.nocase)throw new Error("nocase option contradicts provided scurry option")}else{let l=t.platform==="win32"?rt:t.platform==="darwin"?Tt:t.platform?ot:$o;this.scurry=new l(this.cwd,{nocase:t.nocase,fs:t.fs})}this.nocase=this.scurry.nocase;let s=this.platform==="darwin"||this.platform==="win32",i={...t,dot:this.dot,matchBase:this.matchBase,nobrace:this.nobrace,nocase:this.nocase,nocaseMagicOnly:s,nocomment:!0,noext:this.noext,nonegate:!0,optimizationLevel:2,platform:this.platform,windowsPathsNoEscape:this.windowsPathsNoEscape,debug:!!this.opts.debug},r=this.pattern.map(l=>new te(l,i)),[o,a]=r.reduce((l,c)=>(l[0].push(...c.set),l[1].push(...c.globParts),l),[[],[]]);this.patterns=o.map((l,c)=>{let u=a[c];if(!u)throw new Error("invalid pattern object");return new at(l,u,0,this.platform)})}async walk(){return[...await new jt(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).walk()]}walkSync(){return[...new jt(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).walkSync()]}stream(){return new Dt(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).stream()}streamSync(){return new Dt(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).streamSync()}iterateSync(){return this.streamSync()[Symbol.iterator]()}[Symbol.iterator](){return this.iterateSync()}iterate(){return this.stream()[Symbol.asyncIterator]()}[Symbol.asyncIterator](){return this.iterate()}};var qi=(n,e={})=>{Array.isArray(n)||(n=[n]);for(let t of n)if(new te(t,e).hasMagic())return!0;return!1};function Es(n,e={}){return new me(n,e).streamSync()}function To(n,e={}){return new me(n,e).stream()}function Mo(n,e={}){return new me(n,e).walkSync()}async function Ro(n,e={}){return new me(n,e).walk()}function Os(n,e={}){return new me(n,e).iterateSync()}function jo(n,e={}){return new me(n,e).iterate()}var wh=Es,vh=Object.assign(To,{sync:Es}),xh=Os,Sh=Object.assign(jo,{sync:Os}),_h=Object.assign(Mo,{stream:Es,iterate:Os}),ks=Object.assign(Ro,{glob:Ro,globSync:Mo,sync:_h,globStream:To,stream:vh,globStreamSync:Es,streamSync:wh,globIterate:jo,iterate:Sh,globIterateSync:Os,iterateSync:xh,Glob:me,hasMagic:qi,escape:tt,unescape:de});ks.glob=ks;var Ch=[{id:"ai.delve",category:"ai-slop",severity:"red",regex:/\bdelve\b/gi,suggestion:"use a specific verb: dig, explore, look at"},{id:"ai.leverage",category:"ai-slop",severity:"red",regex:/\bleverage\b/gi,suggestion:"use: use, apply, build on"},{id:"ai.tapestry",category:"ai-slop",severity:"red",regex:/\btapestry\b/gi,suggestion:"be specific about what you mean"},{id:"ai.holistic",category:"ai-slop",severity:"red",regex:/\bholistic\b/gi,suggestion:"describe the actual approach"},{id:"ai.robust",category:"ai-slop",severity:"yellow",regex:/\brobust\b/gi,suggestion:"say what actually makes it strong"},{id:"ai.pivotal",category:"ai-slop",severity:"yellow",regex:/\bpivotal\b/gi,suggestion:"say why it matters specifically"},{id:"ai.foster",category:"ai-slop",severity:"yellow",regex:/\bfoster\b/gi,suggestion:"use: build, grow, encourage, support"},{id:"ai.harness",category:"ai-slop",severity:"yellow",regex:/\bharness\b/gi,suggestion:"use: use, apply, work with"},{id:"ai.illuminate",category:"ai-slop",severity:"yellow",regex:/\billuminate\b/gi,suggestion:"use: show, explain, highlight"},{id:"ai.ever-evolving",category:"ai-slop",severity:"red",regex:/\b(?:ever[\s-]evolving|ever[\s-]changing)\b/gi,suggestion:"cut this \u2014 it says nothing"},{id:"ai.fast-paced",category:"ai-slop",severity:"red",regex:/\bfast[\s-]paced\b/gi,suggestion:"cut this \u2014 every industry says this"},{id:"ai.game-changer",category:"ai-slop",severity:"red",regex:/\bgame[\s-]changer\b/gi,suggestion:"explain what actually changed"},{id:"ai.paradigm",category:"ai-slop",severity:"red",regex:/\bparadigm\b/gi,suggestion:"describe the actual shift"},{id:"ai.synergy",category:"ai-slop",severity:"red",regex:/\bsynergy\b/gi,suggestion:"describe what works together and why"},{id:"ai.ecosystem",category:"ai-slop",severity:"yellow",regex:/\becosystem\b/gi,suggestion:"name the specific tools/partners/platforms"},{id:"ai.seamless",category:"ai-slop",severity:"yellow",regex:/\bseamless\b/gi,suggestion:"describe how it actually works"},{id:"ai.actionable",category:"ai-slop",severity:"yellow",regex:/\bactionable\b/gi,suggestion:"just give the action, don't label it"},{id:"ai.granular",category:"ai-slop",severity:"yellow",regex:/\bgranular\b/gi,suggestion:"say: specific, detailed, or name the level"},{id:"ai.impactful",category:"ai-slop",severity:"yellow",regex:/\bimpactful\b/gi,suggestion:"describe the actual impact"}],kh=[{id:"formula.firstly",category:"ai-slop",severity:"yellow",regex:/\bfirstly\b/gi,suggestion:'just start \u2014 "firstly" is filler'},{id:"formula.in-conclusion",category:"ai-slop",severity:"red",regex:/\bin conclusion\b/gi,suggestion:"just end. readers know it's the end."},{id:"formula.it-is-important",category:"ai-slop",severity:"yellow",regex:/\bit is important to note\b/gi,suggestion:"just note it. skip the preamble."},{id:"formula.at-the-end",category:"ai-slop",severity:"yellow",regex:/\bat the end of the day\b/gi,suggestion:"cut this \u2014 it means nothing"},{id:"formula.needless-to-say",category:"ai-slop",severity:"yellow",regex:/\bneedless to say\b/gi,suggestion:"if it's needless, don't say it"},{id:"formula.it-goes-without",category:"ai-slop",severity:"yellow",regex:/\bit goes without saying\b/gi,suggestion:"then don't say it"},{id:"formula.in-today",category:"ai-slop",severity:"red",regex:/\bin today'?s\b/gi,suggestion:"start with your actual point instead"},{id:"formula.lets-dive",category:"ai-slop",severity:"red",regex:/\blet'?s (?:dive|jump|dig|delve)\b/gi,suggestion:"just start. no diving needed."},{id:"formula.without-further",category:"ai-slop",severity:"red",regex:/\bwithout further ado\b/gi,suggestion:"cut this \u2014 just get to it"}],Eh=[{id:"hedge.some-might",category:"voice-drift",severity:"yellow",regex:/\bsome might say\b/gi,suggestion:"commit to the claim or drop it"},{id:"hedge.arguably",category:"voice-drift",severity:"yellow",regex:/\barguably\b/gi,suggestion:"commit. say it or don't."},{id:"hedge.worth-noting",category:"voice-drift",severity:"yellow",regex:/\bit'?s worth noting\b/gi,suggestion:"just note it directly"},{id:"hedge.to-some-extent",category:"voice-drift",severity:"yellow",regex:/\bto some extent\b/gi,suggestion:"be specific about the extent"}],Oh=[{id:"struct.antithesis",category:"structure",severity:"yellow",regex:/\bnot (?:just|only) .{3,50}, but .{3,50}/gi,suggestion:"this antithesis pattern is an AI tell \u2014 restructure"},{id:"struct.more-than-just",category:"structure",severity:"yellow",regex:/\bmore than just\b/gi,suggestion:"say what it IS, not what it isn't"},{id:"struct.in-order-to",category:"structure",severity:"yellow",regex:/\bin order to\b/gi,suggestion:'just use "to"'},{id:"struct.due-to-the-fact",category:"structure",severity:"yellow",regex:/\bdue to the fact that\b/gi,suggestion:'use "because"'},{id:"struct.for-the-purpose",category:"structure",severity:"yellow",regex:/\bfor the purpose of\b/gi,suggestion:'use "to"'},{id:"struct.which-is-another",category:"structure",severity:"red",regex:/\bwhich is another way of saying\b/gi,suggestion:"just say the thing directly"}],Ah=[...Ch,...kh,...Eh,...Oh];function Do(n,e,t){let s=[];for(let i of Ah){i.regex.lastIndex=0;let r;for(;(r=i.regex.exec(n))!==null;)s.push({file:t,line:e,column:r.index+1,pattern:i.id,category:i.category,severity:i.severity,excerpt:Fh(n.trim(),r.index,r[0].length),suggestion:i.suggestion})}return s}function Fh(n,e,t){let s=n.slice(0,e),i=n.slice(e,e+t),r=n.slice(e+t);return`${s}\xAB${i}\xBB${r}`.slice(0,120)}async function zi(n,e=[]){let t=[];for(let o of n)if(ct.existsSync(o)&&ct.statSync(o).isFile())t.push(o);else{let a=await ks("**/*.md",{cwd:o,ignore:["node_modules/**",".git/**",...e],absolute:!0});t.push(...a)}let s=[...new Set(t)],i=[],r={files:0,total_lines:0,red:0,yellow:0,clean:0};for(let o of s){if(!o.endsWith(".md"))continue;let a;try{a=ct.readFileSync(o,"utf-8")}catch{continue}let l=a.split(`
334
- `),c=[];for(let f=0;f<l.length;f++){let d=l[f];d.startsWith("```")||d.startsWith("---")||d.startsWith("#")||d.trim().length<10||c.push(...Do(d,f+1,Ui.relative(process.cwd(),o)))}r.files++,r.total_lines+=l.length;let u=c.filter(f=>f.severity==="red").length,h=c.filter(f=>f.severity==="yellow").length;r.red+=u,r.yellow+=h,u+h===0&&r.clean++,i.push({file:Ui.relative(process.cwd(),o),findings:c,lines:l.length})}return{results:i,summary:r}}var No=70;var $h=25;function Lo(n,e,t,s){let i=[],r=ns(e,t),o=r.summary.red,a=r.summary.yellow;if(o>0&&i.push(`Rewrite introduced ${o} new critical issues`),s){let _=new Set(s.signals.map(b=>b.id)),w=r.signals.filter(b=>!_.has(b.id));if(w.length>0){let b=[...new Set(w.map(P=>P.id))].slice(0,5);i.push(`Rewrite introduced new patterns: ${b.join(", ")}`)}}let l=Rr(e,t.cadence);l<100-$h&&i.push(`Cadence deviation: score ${l}/100 (target avg ${t.cadence?.avg_words||"?"} words)`);let c=[],u=e.toLowerCase();for(let _ of t.never_list||[])_&&u.includes(_.toLowerCase())&&c.push(_);c.length>0&&i.push(`Never-list violations: ${c.join(", ")}`);let h=Ph(n,e);h<60&&i.push(`Semantic drift detected: score ${h}/100`);let f=e.length/Math.max(1,n.length);(f<.5||f>2)&&i.push(`Length changed too much: ${(f*100).toFixed(0)}% of original`);let d=Math.max(0,100-o*20-a*5),g=Math.max(0,100-c.length*25),p=Math.round(d*.35+l*.25+h*.25+g*.15),y=p<No&&i.length>0,m=!1,x;return y&&(x=Rh(i,r,t)),{valid:p>=No,score:p,issues:i,newSignals:r,cadenceScore:l,neverListHits:c,needsRetry:y,needsVerification:m,retryInstruction:x}}function Ph(n,e){let t=Io(n),s=Io(e);if(t.size===0)return 100;let i=0;for(let l of t)s.has(l)&&i++;let r=i/t.size*100,o=e.length/Math.max(1,n.length),a=o>=.7&&o<=1.5?100:Math.max(0,100-Math.abs(1-o)*100);return Math.round(r*.7+a*.3)}function Io(n){let e=n.toLowerCase().match(/[a-z]{4,}/g)||[],t=new Set(["that","this","with","from","have","been","were","they","their","would","could","should","about","which","when","what","there","than","them","then","into","over","also","just","more","some","very","your","only","will","each","make","like","well","back","much","most","other","after"]);return new Set(e.filter(s=>!t.has(s)))}function Rh(n,e,t){let s=[];s.push("The rewrite had these issues:");for(let r of n)s.push(`- ${r}`);s.push("");let i=e.byRule;if(i.size>0){s.push("Fix these specific patterns:");for(let[r,o]of i){let a=o.map(l=>l.line).join(", ");s.push(`- ${r} on lines ${a}`)}}return t.never_list?.length&&(s.push(""),s.push(`Remember: never use these words: ${t.never_list.join(", ")}`)),s.join(`
335
- `)}var Wo=Yi.join(Fs.homedir(),".hyv","voice.md");function Gi(n,e){return JSON.stringify({jsonrpc:"2.0",id:n,result:e})}function Th(n,e,t){return JSON.stringify({jsonrpc:"2.0",id:n,error:{code:e,message:t}})}function As(n){process.stdout.write(n+`
336
- `)}async function Mh(n){let e=n.text||"",t=n.profile||Ci()||"default";if(!e.trim())return"Error: no text provided";try{let s=await Si(t),i=ns(e,s),r=Tr(i),o=e;if(r.autoFixes.length>0&&(o=Mr(e,r.issues).fixed),r.llmFixes.length>0){let a=is({draftPath:"inline",draftContent:o,profileName:t});return`Auto-fixed ${r.autoFixes.length} issues. ${r.llmFixes.length} issues need LLM rewrite.
337
-
338
- ${a.prompt}`}return o}catch(s){return`Error: ${s.message}`}}async function jh(n){let e=n.text||"",t=n.file||"";if(!e.trim()&&!t.trim())return"Error: no text or file provided";try{if(t){let{results:i,summary:r}=await zi([t]),o=i.flatMap(a=>a.findings.map(l=>`line ${l.line}: [${l.severity}] ${l.pattern} \u2014 ${l.excerpt}`));return o.length===0?`No issues found in ${t}`:`Found ${o.length} issues:
330
+ `)),console.log(N.default.dim(' try: hyv say "rename my profile to <name>"')),console.log(N.default.dim(` or: hyv rename <new-name>
331
+ `)),process.exit(1);break}})}function Rl(n){let e=n.trim(),t=[/rename\s+(?:my\s+)?(?:voice\s+)?profile\s+(?:to|as)\s+(.+)/i,/update\s+(?:my\s+)?(?:voice\s+)?profile\s+(?:name\s+)?(?:to|as)\s+(.+)/i,/change\s+(?:my\s+)?(?:voice\s+)?profile\s+(?:name\s+)?(?:to|as)\s+(.+)/i,/call\s+(?:my\s+)?(?:voice\s+)?profile\s+(.+)/i,/set\s+(?:my\s+)?(?:voice\s+)?profile\s+(?:name\s+)?(?:to|as)\s+(.+)/i,/name\s+(?:my\s+)?(?:voice\s+)?profile\s+(.+)/i,/(?:voice\s+)?profile\s+(?:rename|name)\s+(?:to|as)\s+(.+)/i,/rename\s+(?:to|as)\s+(.+)/i,/update\s+(?:voice\s+)?profile\s+(?:name\s+)?(?:to|as)\s+(.+)/i];for(let s of t){let i=e.match(s);if(i&&i[1]){let r=i[1].trim();if((r.startsWith('"')&&r.endsWith('"')||r.startsWith("'")&&r.endsWith("'"))&&(r=r.slice(1,-1)),r=r.replace(/[.!?]+$/,"").trim(),r.length>0&&r.length<=100)return{action:"rename",name:r,raw:e}}}return{action:"unknown",raw:e}}var k=C(ie()),te=C(require("fs")),Se=C(require("path")),Hr=C(require("os"));re();$e();var Wr=Hr.homedir(),Pl=process.platform==="win32";function Vr(n){n.command("doctor").description("diagnose and fix common issues").action(async()=>{console.log(k.default.bold(`
332
+ hold your voice \u2014 doctor
333
+ `));let e=0,t=0;console.log(k.default.dim("checking cli installation..."));let s=process.argv[1];if(s&&te.existsSync(s)?console.log(k.default.green(" \u2713 cli installed")):(console.log(k.default.red(" \u2717 cli not found")),e++),console.log(k.default.dim("checking .hyv directory...")),te.existsSync(he)?console.log(k.default.green(" \u2713 .hyv directory exists")):(console.log(k.default.yellow(" ! .hyv directory missing \u2014 creating...")),te.mkdirSync(he,{recursive:!0}),t++),console.log(k.default.dim("checking authentication...")),tt()){let c=st();if(c){console.log(k.default.green(" \u2713 authenticated")),console.log(k.default.dim(` email: ${c.user?.email||"unknown"}`));let h=await rt();h.valid?(console.log(k.default.green(" \u2713 session valid")),console.log(k.default.dim(` plan: ${h.plan||"none"}`))):(console.log(k.default.red(" \u2717 session expired")),console.log(k.default.dim(" run: hyv init")),e++)}else console.log(k.default.red(" \u2717 auth data missing")),console.log(k.default.dim(" run: hyv init")),e++}else console.log(k.default.red(" \u2717 not authenticated")),console.log(k.default.dim(" run: hyv init")),e++;console.log(k.default.dim("checking voice profile..."));let i=Se.join(he,"voice.md");if(te.existsSync(i)){let c=te.readFileSync(i,"utf-8");c.length>50?(console.log(k.default.green(" \u2713 voice.md exists")),console.log(k.default.dim(` size: ${c.length} bytes`))):(console.log(k.default.yellow(" ! voice.md seems empty")),e++)}else console.log(k.default.yellow(" ! voice.md missing")),console.log(k.default.dim(" run: hyv new <name> to create a profile")),e++;if(console.log(k.default.dim("checking profiles...")),te.existsSync(ne)){let c=te.readdirSync(ne).filter(h=>h.endsWith(".md"));c.length>0?console.log(k.default.green(` \u2713 ${c.length} profile(s) found`)):(console.log(k.default.yellow(" ! no profiles found")),console.log(k.default.dim(" run: hyv new <name>")),e++)}else console.log(k.default.yellow(" ! profiles directory missing")),e++;console.log(k.default.dim("checking agent configurations..."));let r=process.cwd(),o=[{name:"claude-code",file:Se.join(r,".claude","commands","hyv.md")},{name:"claude-md",file:Se.join(r,"CLAUDE.md")},{name:"codex",file:Se.join(r,"AGENTS.md")},{name:"cursor",file:Se.join(r,".cursorrules")},{name:"windsurf",file:Se.join(r,".windsurfrules")}];for(let c of o)te.existsSync(c.file)?console.log(k.default.green(` \u2713 ${c.name} configured`)):console.log(k.default.dim(` - ${c.name} not configured (run hyv init)`));console.log(k.default.dim("checking mcp server..."));let a=Pl?Se.join(Wr,"AppData","Roaming","Claude"):Se.join(Wr,"Library","Application Support","Claude"),l=Se.join(a,"claude_desktop_config.json");if(te.existsSync(l))try{JSON.parse(te.readFileSync(l,"utf-8")).mcpServers?.hyv?console.log(k.default.green(" \u2713 mcp server configured for claude desktop")):console.log(k.default.dim(" - mcp server not configured (run hyv init)"))}catch{console.log(k.default.yellow(" ! could not read claude desktop config"))}else console.log(k.default.dim(" - claude desktop not found"));console.log(""),e===0&&t===0?console.log(k.default.green("\u2713 everything looks good!")):t>0?(console.log(k.default.green(`\u2713 fixed ${t} issue(s)`)),e>0&&console.log(k.default.yellow(`! ${e} issue(s) remaining`))):console.log(k.default.yellow(`! ${e} issue(s) found`)),console.log("")})}var wt=C(require("fs")),nn=C(require("path")),Ds=C(require("os"));var Tl=[{id:"ai.delve",category:"ai-slop",severity:"red",regex:/\bdelve\b/gi,suggestion:"use a specific verb: dig, explore, look at",autoFixable:!0},{id:"ai.leverage",category:"ai-slop",severity:"red",regex:/\bleverage\b/gi,suggestion:"use: use, apply, build on",autoFixable:!0},{id:"ai.tapestry",category:"ai-slop",severity:"red",regex:/\btapestry\b/gi,suggestion:"be specific about what you mean",autoFixable:!0},{id:"ai.holistic",category:"ai-slop",severity:"red",regex:/\bholistic\b/gi,suggestion:"describe the actual approach",autoFixable:!0},{id:"ai.robust",category:"ai-slop",severity:"yellow",regex:/\brobust\b/gi,suggestion:"say what actually makes it strong",autoFixable:!0},{id:"ai.pivotal",category:"ai-slop",severity:"yellow",regex:/\bpivotal\b/gi,suggestion:"say why it matters specifically",autoFixable:!0},{id:"ai.foster",category:"ai-slop",severity:"yellow",regex:/\bfoster\b/gi,suggestion:"use: build, grow, encourage, support",autoFixable:!0},{id:"ai.harness",category:"ai-slop",severity:"yellow",regex:/\bharness\b/gi,suggestion:"use: use, apply, work with",autoFixable:!0},{id:"ai.illuminate",category:"ai-slop",severity:"yellow",regex:/\billuminate\b/gi,suggestion:"use: show, explain, highlight",autoFixable:!0},{id:"ai.ever-evolving",category:"ai-slop",severity:"red",regex:/\b(?:ever[\s-]evolving|ever[\s-]changing)\b/gi,suggestion:"cut this \u2014 it says nothing",autoFixable:!0},{id:"ai.fast-paced",category:"ai-slop",severity:"red",regex:/\bfast[\s-]paced\b/gi,suggestion:"cut this \u2014 every industry says this",autoFixable:!0},{id:"ai.game-changer",category:"ai-slop",severity:"red",regex:/\bgame[\s-]changer\b/gi,suggestion:"explain what actually changed",autoFixable:!0},{id:"ai.paradigm",category:"ai-slop",severity:"red",regex:/\bparadigm\b/gi,suggestion:"describe the actual shift",autoFixable:!0},{id:"ai.synergy",category:"ai-slop",severity:"red",regex:/\bsynergy\b/gi,suggestion:"describe what works together and why",autoFixable:!0},{id:"ai.ecosystem",category:"ai-slop",severity:"yellow",regex:/\becosystem\b/gi,suggestion:"name the specific tools/partners/platforms",autoFixable:!0},{id:"ai.seamless",category:"ai-slop",severity:"yellow",regex:/\bseamless\b/gi,suggestion:"describe how it actually works",autoFixable:!0},{id:"ai.actionable",category:"ai-slop",severity:"yellow",regex:/\bactionable\b/gi,suggestion:"just give the action, don't label it",autoFixable:!0},{id:"ai.granular",category:"ai-slop",severity:"yellow",regex:/\bgranular\b/gi,suggestion:"say: specific, detailed, or name the level",autoFixable:!0},{id:"ai.impactful",category:"ai-slop",severity:"yellow",regex:/\bimpactful\b/gi,suggestion:"describe the actual impact",autoFixable:!0},{id:"ai.transform",category:"ai-slop",severity:"yellow",regex:/\btransform\b/gi,suggestion:"describe what specifically changed",autoFixable:!1},{id:"ai.empower",category:"ai-slop",severity:"yellow",regex:/\bempower\b/gi,suggestion:"describe what people can actually do",autoFixable:!0},{id:"ai.unlock",category:"ai-slop",severity:"yellow",regex:/\bunlock\b/gi,suggestion:"describe what they get access to",autoFixable:!0},{id:"ai.nuanced",category:"ai-slop",severity:"yellow",regex:/\bnuanced\b/gi,suggestion:"explain the specific complexity",autoFixable:!0},{id:"ai.multifaceted",category:"ai-slop",severity:"red",regex:/\bmultifaceted\b/gi,suggestion:"name the specific aspects",autoFixable:!0},{id:"ai.comprehensive",category:"ai-slop",severity:"yellow",regex:/\bcomprehensive\b/gi,suggestion:"say what it covers specifically",autoFixable:!1},{id:"ai.innovative",category:"ai-slop",severity:"yellow",regex:/\binnovative\b/gi,suggestion:"describe what's actually new",autoFixable:!0},{id:"ai.cut[t]?ing-edge",category:"ai-slop",severity:"red",regex:/\bcut(?:t)?ing[\s-]edge\b/gi,suggestion:"name the specific technology",autoFixable:!0},{id:"ai.state-of-the-art",category:"ai-slop",severity:"red",regex:/\bstate[\s-]of[\s-]the[\s-]art\b/gi,suggestion:"describe what makes it current",autoFixable:!0},{id:"ai.best-practices",category:"ai-slop",severity:"yellow",regex:/\bbest[\s-]practices?\b/gi,suggestion:"name the specific practice",autoFixable:!1},{id:"ai.world-class",category:"ai-slop",severity:"red",regex:/\bworld[\s-]class\b/gi,suggestion:"prove it with specifics",autoFixable:!0},{id:"ai.second-to-none",category:"ai-slop",severity:"red",regex:/\bsecond[\s-]to[\s-]none\b/gi,suggestion:"drop the superlative, show the work",autoFixable:!0}],Ml=[{id:"formula.firstly",category:"ai-slop",severity:"yellow",regex:/\bfirstly\b/gi,suggestion:'just start \u2014 "firstly" is filler',autoFixable:!0},{id:"formula.secondly",category:"ai-slop",severity:"yellow",regex:/\bsecondly\b/gi,suggestion:'just continue \u2014 "secondly" is filler',autoFixable:!0},{id:"formula.lastly",category:"ai-slop",severity:"yellow",regex:/\blastly\b/gi,suggestion:'just end \u2014 "lastly" is filler',autoFixable:!0},{id:"formula.moreover",category:"ai-slop",severity:"yellow",regex:/\bmoreover\b/gi,suggestion:"just add the point",autoFixable:!0},{id:"formula.furthermore",category:"ai-slop",severity:"yellow",regex:/\bfurthermore\b/gi,suggestion:"just add the point",autoFixable:!0},{id:"formula.in-conclusion",category:"ai-slop",severity:"red",regex:/\bin conclusion\b/gi,suggestion:"just end. readers know it's the end.",autoFixable:!0},{id:"formula.in-summary",category:"ai-slop",severity:"red",regex:/\bin summary\b/gi,suggestion:"just summarize. the label is redundant.",autoFixable:!0},{id:"formula.it-is-important",category:"ai-slop",severity:"yellow",regex:/\bit is important to note\b/gi,suggestion:"just note it. skip the preamble.",autoFixable:!0},{id:"formula.at-the-end",category:"ai-slop",severity:"yellow",regex:/\bat the end of the day\b/gi,suggestion:"cut this \u2014 it means nothing",autoFixable:!0},{id:"formula.needless-to-say",category:"ai-slop",severity:"yellow",regex:/\bneedless to say\b/gi,suggestion:"if it's needless, don't say it",autoFixable:!0},{id:"formula.it-goes-without",category:"ai-slop",severity:"yellow",regex:/\bit goes without saying\b/gi,suggestion:"then don't say it",autoFixable:!0},{id:"formula.in-today",category:"ai-slop",severity:"red",regex:/\bin today'?s\b/gi,suggestion:"start with your actual point instead",autoFixable:!0},{id:"formula.lets-dive",category:"ai-slop",severity:"red",regex:/\blet'?s (?:dive|jump|dig|delve)\b/gi,suggestion:"just start. no diving needed.",autoFixable:!0},{id:"formula.without-further",category:"ai-slop",severity:"red",regex:/\bwithout further ado\b/gi,suggestion:"cut this \u2014 just get to it",autoFixable:!0},{id:"formula.its-worth-noting",category:"ai-slop",severity:"yellow",regex:/\bit'?s worth noting\b/gi,suggestion:"just note it directly",autoFixable:!0}],jl=[{id:"hedge.some-might",category:"voice-drift",severity:"yellow",regex:/\bsome might say\b/gi,suggestion:"commit to the claim or drop it",autoFixable:!0},{id:"hedge.arguably",category:"voice-drift",severity:"yellow",regex:/\barguably\b/gi,suggestion:"commit. say it or don't.",autoFixable:!0},{id:"hedge.worth-noting",category:"voice-drift",severity:"yellow",regex:/\bit'?s worth noting\b/gi,suggestion:"just note it directly",autoFixable:!0},{id:"hedge.to-some-extent",category:"voice-drift",severity:"yellow",regex:/\bto some extent\b/gi,suggestion:"be specific about the extent",autoFixable:!0},{id:"hedge.perhaps",category:"voice-drift",severity:"yellow",regex:/\bperhaps\b/gi,suggestion:"commit or cut",autoFixable:!0},{id:"hedge.maybe",category:"voice-drift",severity:"yellow",regex:/\bmaybe\b/gi,suggestion:"commit or cut",autoFixable:!0},{id:"hedge.possibly",category:"voice-drift",severity:"yellow",regex:/\bpossibly\b/gi,suggestion:"commit or cut",autoFixable:!1},{id:"hedge.it-seems",category:"voice-drift",severity:"yellow",regex:/\bit seems\b/gi,suggestion:"state it directly",autoFixable:!0},{id:"hedge.i-think",category:"voice-drift",severity:"yellow",regex:/\bi think\b/gi,suggestion:'just say it. the "i think" is implied.',autoFixable:!0},{id:"hedge.in-my-opinion",category:"voice-drift",severity:"yellow",regex:/\bin my opinion\b/gi,suggestion:"just state it. it's your article.",autoFixable:!0}],Dl=[{id:"struct.antithesis",category:"structure",severity:"yellow",regex:/\bnot (?:just|only) .{3,50}, but .{3,50}/gi,suggestion:"this antithesis pattern is an AI tell \u2014 restructure",autoFixable:!1},{id:"struct.not-just-but-also",category:"structure",severity:"yellow",regex:/\bnot\s+just\b.{3,80}\bbut\s+(?:also\s+)?/gi,suggestion:"say what it IS, not what it isn't",autoFixable:!1},{id:"struct.more-than-just",category:"structure",severity:"yellow",regex:/\bmore\s+than\s+just\b/gi,suggestion:"say what it IS, not what it isn't",autoFixable:!1},{id:"struct.in-order-to",category:"structure",severity:"yellow",regex:/\bin order to\b/gi,suggestion:'just use "to"',autoFixable:!0},{id:"struct.due-to-the-fact",category:"structure",severity:"yellow",regex:/\bdue to the fact that\b/gi,suggestion:'use "because"',autoFixable:!0},{id:"struct.for-the-purpose",category:"structure",severity:"yellow",regex:/\bfor the purpose of\b/gi,suggestion:'use "to"',autoFixable:!0},{id:"struct.which-is-another",category:"structure",severity:"red",regex:/\bwhich is another way of saying\b/gi,suggestion:"just say the thing directly",autoFixable:!1},{id:"struct.in-other-words",category:"structure",severity:"red",regex:/\bin other words\b/gi,suggestion:"just say it once, well",autoFixable:!1},{id:"struct.rhetorical-truth",category:"structure",severity:"yellow",regex:/\b(?:the\s+)?(?:uncomfortable|hard|harsh|brutal|ugly|unsexy|real|honest)\s+(?:truth|reality)\b/gi,suggestion:"state the fact directly, skip the framing",autoFixable:!1},{id:"struct.truth-is",category:"structure",severity:"yellow",regex:/\bthe\s+truth\s+is\b/gi,suggestion:"just say the truth. the framing is filler.",autoFixable:!1},{id:"struct.lesson-setup",category:"structure",severity:"yellow",regex:/\b(?:here'?s\s+)?what\s+.{3,80}\s+(?:taught|teaches)\s+(?:me|us|you|everyone)\b/gi,suggestion:"just share the lesson",autoFixable:!1},{id:"struct.negation-cascade",category:"structure",severity:"yellow",regex:/\b(?:no|not)\s+\w[^.!?\n]{0,80}[.!?][ \t]*\n?[ \t]*(?:no|not)\s+\w[^.!?\n]{0,80}[.!?][ \t]*\n?[ \t]*(?:no|not)\s+\w/gi,suggestion:"three negations in a row reads like AI performance",autoFixable:!1},{id:"struct.inline-triplet",category:"structure",severity:"yellow",regex:/\bit'?s\s+\w[^,.!?;\n]{0,30},\s*it'?s\s+\w[^,.!?;\n]{0,30}[,.]?\s*(?:and\s+)?it'?s\b/gi,suggestion:`the "it's X, it's Y, it's Z" pattern is an AI tell`,autoFixable:!1},{id:"struct.moment-becomes",category:"structure",severity:"red",regex:/\b(?:the\s+)?moment\b.{3,80}\bbecomes?\b/gi,suggestion:'"the moment X becomes Y" is polished founder cadence \u2014 restructure',autoFixable:!1},{id:"struct.same-better",category:"structure",severity:"red",regex:/\bsame\s+[^.!?\n]{1,35}[.!?]\s*(?:better|nicer|cleaner|calmer|safer)\s+[^.!?\n]{1,35}[.!?]?/gi,suggestion:'"same X. better Y." is screenshot-ready founder cadence',autoFixable:!1},{id:"struct.this-is-why",category:"structure",severity:"yellow",regex:/\bthis\s+is\s+(?:also\s+)?(?:why|how|where|what\b)/gi,suggestion:"signpost claims are AI tells \u2014 just make the point",autoFixable:!1},{id:"struct.heres-where",category:"structure",severity:"yellow",regex:/\b(?:here'?s|here\s+is)\s+(?:where|why|what|the\s+part|the\s+(?:harder|real|actual|main|bigger)\s+problem)\b/gi,suggestion:"just make the point without the signpost",autoFixable:!1},{id:"struct.generic-buyer",category:"structure",severity:"red",regex:/\bpeople\s+don'?t\s+just\s+buy\b|\bpeople\s+buy\s+the\s+feeling\b/gi,suggestion:"generic buyer psychology is AI filler",autoFixable:!1}],Il=[{id:"punct.em-dash",category:"ai-slop",severity:"yellow",regex:/—/g,suggestion:"em dashes are an AI tell \u2014 use a period, comma, or parentheses",autoFixable:!1}],Ll=[...Tl,...Ml,...jl,...Dl,...Il],qr={delve:"dig",leverage:"use",tapestry:"web",holistic:"complete",robust:"strong",pivotal:"key",foster:"build",harness:"use",illuminate:"show","ever-evolving":"changing",everchanging:"changing","fast-paced":"fast","game-changer":"breakthrough",paradigm:"model",synergy:"fit",ecosystem:"network",seamless:"smooth",actionable:"practical",granular:"specific",impactful:"effective",empower:"enable",unlock:"open",nuanced:"complex",multifaceted:"complex",innovative:"new","cutting-edge":"modern","state-of-the-art":"modern","world-class":"excellent","second-to-none":"best",firstly:"",secondly:"",lastly:"",moreover:"",furthermore:"",perhaps:"",arguably:""};function Nl(n){let t=n.split(/[.!?]+/).filter(o=>o.trim().length>0).map(o=>o.trim().split(/\s+/).length),s=t.length>0?t.reduce((o,a)=>o+a,0)/t.length:0,i=t.length>1?Math.sqrt(t.reduce((o,a)=>o+Math.pow(a-s,2),0)/t.length):0,r="low";return i>8?r="high":i>4&&(r="medium"),{avgWords:s,variance:r,sentences:t}}function Wl(n){let e=[],t=n.split(`
334
+ `),s=t.findIndex(r=>r.trim().length>10);if(s<0)return e;let i=t[s].trim().toLowerCase();return(i.endsWith("?")||/^(?:have you|do you|did you|what if|why do|how do|what's|how's)\b/.test(i))&&e.push({id:"voice.question-opener",line:s+1,column:1,category:"voice-drift",severity:"yellow",rule:"Opens with a question instead of a concrete observation",match:i.slice(0,80),excerpt:t[s].trim().slice(0,120),suggestion:"Open with a concrete observation, moment, mechanism, or pattern",autoFixable:!1}),/^(?:the most important thing|the key to|success is|if you want to|what i learned|here's what|the biggest mistake)\b/.test(i)&&e.push({id:"voice.lesson-opener",line:s+1,column:1,category:"voice-drift",severity:"yellow",rule:"Opens with a lesson or inspirational claim",match:i.slice(0,80),excerpt:t[s].trim().slice(0,120),suggestion:"Open with something concrete and specific, not a lesson",autoFixable:!1}),/^(?:most|many)\s+(?:brands|teams|people|founders|companies|businesses)\b/.test(i)&&e.push({id:"voice.generic-generalization",line:s+1,column:1,category:"voice-drift",severity:"yellow",rule:"Opens with a generic generalization",match:i.slice(0,80),excerpt:t[s].trim().slice(0,120),suggestion:"Start with a specific observation, not a sweeping claim",autoFixable:!1}),e}function Hl(n){let e=[],t=n.split(`
335
+ `),s=[];for(let i=0;i<t.length;i++){let r=t[i].trim();if(r.length<10||r.startsWith("#")||r.startsWith("```"))continue;let o=r.split(/(?<=[.!?])\s+/);for(let a of o){let l=a.trim().split(/\s+/).filter(c=>c.length>0);l.length>0&&l.length<=5?(s.push({line:i+1,text:a.trim()}),s.length>=3&&(e.push({id:"voice.staccato-triplet",line:s[0].line,column:1,category:"cadence",severity:"yellow",rule:"Three short sentences in a row reads like performance",match:s.map(c=>c.text).join(" | "),excerpt:s[0].text,suggestion:"Vary sentence length \u2014 short staccato runs feel like AI trying to sound punchy",autoFixable:!1}),s=[])):s=[]}}return e}var Vl=new Set(["alignment","authenticity","awareness","clarity","confidence","consistency","differentiation","execution","framework","identity","messaging","narrative","personality","positioning","preference","presence","recall","relevance","resonance","signal","strategy","trust","utility","value"]);function ql(n,e){let t=[];return(n.toLowerCase().match(/[a-z']+/g)||[]).filter(r=>Vl.has(r)).length>=3&&!/\b(?:for example|for instance|such as)\b|\d/i.test(n)&&t.push({id:"voice.abstract-cluster",line:e,column:1,category:"voice-drift",severity:"yellow",rule:"Abstract noun cluster \u2014 reads like a strategy deck",match:n.trim().slice(0,80),excerpt:n.trim().slice(0,120),suggestion:"Ground in specifics \u2014 name the thing, show the number, quote the person",autoFixable:!1}),t}function Bl(n,e,t){let s=[],i=n.toLowerCase();for(let r of t){if(!r)continue;let o=r.toLowerCase().trim();i.includes(o)&&s.push({id:"voice.never-list",line:e,column:i.indexOf(o)+1,category:"voice-drift",severity:"red",rule:`Never-list violation: "${r}"`,match:o,excerpt:n.trim().slice(0,120),suggestion:`Your voice profile explicitly bans "${r}" \u2014 restructure`,autoFixable:!1})}return s}function Ul(n,e,t){let s=[],i=n.toLowerCase();for(let r of t){if(!r.text)continue;let a=r.text.toLowerCase().trim().split(/\s+/);if(a.length<3)continue;let l=a.slice(0,4).join(" ");i.includes(l)&&s.push({id:`learned.${r.type}`,line:e,column:i.indexOf(l)+1,category:"learned",severity:"yellow",rule:`Learned pattern (${r.type}): "${r.text.slice(0,60)}"`,match:l,excerpt:n.trim().slice(0,120),suggestion:"Your editing history suggests this pattern should be rewritten",autoFixable:!1})}return s}function zl(n){let e=new Set;for(let t of n)t.status==="accepted"&&t.rule_id&&e.add(t.rule_id),t.status==="dismissed"&&t.accept_rate!==void 0&&t.accept_rate<.25&&e.add(t.rule_id);return e}function us(n,e){let t=n.split(`
336
+ `),s=[],i=new Map,r=new Map,o=e?.drift_snapshot?zl(e.drift_snapshot):new Set,a=e?.never_list||[],l=e?.learned_patterns||[];for(let d=0;d<t.length;d++){let g=t[d],p=d+1;if(!g.startsWith("```")&&!g.startsWith("---")&&!g.startsWith("#")&&!(g.trim().length<10)){for(let y of Ll){y.regex.lastIndex=0;let m;for(;(m=y.regex.exec(g))!==null;){let x=o.has(y.id);s.push({id:y.id,line:p,column:m.index+1,category:y.category,severity:x?"yellow":y.severity,rule:y.suggestion,match:m[0],excerpt:Gl(g.trim(),m.index,m[0].length),suggestion:y.suggestion,autoFixable:y.autoFixable,driftAccepted:x})}}s.push(...ql(g,p)),s.push(...Bl(g,p,a)),s.push(...Ul(g,p,l))}}s.push(...Wl(n)),s.push(...Hl(n));for(let d of s)i.has(d.line)||i.set(d.line,[]),i.get(d.line).push(d),r.has(d.id)||r.set(d.id,[]),r.get(d.id).push(d);let c=s.filter(d=>d.severity==="red").length,h=s.filter(d=>d.severity==="yellow").length,u=s.filter(d=>d.autoFixable).length,f=s.filter(d=>d.driftAccepted).length;return{signals:s,byLine:i,byRule:r,summary:{red:c,yellow:h,autoFixable:u,driftAccepted:f,total:s.length}}}function Br(n,e){let{avgWords:t,variance:s}=Nl(n);if(!e?.avg_words)return 100;let i=e.avg_words,r=Math.abs(t-i)/i,o=Math.max(0,Math.round((1-r)*100));return e.variance&&s===e.variance?o=Math.min(100,o+10):e.variance&&s!==e.variance&&(o=Math.max(0,o-10)),o}function Gl(n,e,t){let s=n.slice(0,e),i=n.slice(e,e+t),r=n.slice(e+t);return`${s}\xAB${i}\xBB${r}`.slice(0,120)}function Ur(n){let e=n.byLine,t=[];for(let[c,h]of e){let u=h.filter(y=>!y.driftAccepted);if(u.length===0){t.push({line:c,signals:h,strategy:"skip",priority:0,instruction:"All issues on this line are consistently dismissed by user"});continue}let f=u.map(y=>Yl(y)),d=Jl(f),g=Xl(c,u,d),p=d==="auto_fix"?Ql(c,u):void 0;t.push({line:c,signals:u,strategy:d,priority:Kl(u,d),instruction:g,autoFixText:p})}let s=t.filter(c=>c.strategy==="auto_fix"),i=t.filter(c=>c.strategy==="restructure"||c.strategy==="voice_drift"),r=t.filter(c=>c.strategy==="skip"),o=Math.max(1,n.summary.total>0?new Set(n.signals.map(c=>c.line)).size:0),a=t.filter(c=>c.strategy!=="skip").length,l=Math.max(0,Math.round((o-a)/Math.max(1,o)*100));return{issues:t,autoFixes:s,llmFixes:i,skipped:r,stats:{total:t.length,autoFixable:s.length,needsLLM:i.length,skipped:r.length,score:l}}}function Yl(n){return n.driftAccepted?"skip":n.autoFixable&&n.category==="ai-slop"||n.autoFixable&&n.category==="voice-drift"?"auto_fix":n.category==="voice-drift"||n.category==="cadence"||n.category==="learned"?"voice_drift":(n.category==="structure","restructure")}function Jl(n){return n.includes("restructure")?"restructure":n.includes("voice_drift")?"voice_drift":n.includes("auto_fix")?"auto_fix":"skip"}function Kl(n,e){let t=0,s=n.filter(r=>r.severity==="red").length,i=n.filter(r=>r.severity==="yellow").length;return t+=s*10+i*5,e==="restructure"&&(t+=20),e==="voice_drift"&&(t+=15),e==="auto_fix"&&(t+=5),t}function Xl(n,e,t){let s=[...new Set(e.map(r=>r.rule))],i=e.filter(r=>r.severity==="red");if(t==="auto_fix")return`Replace AI-slop words: ${s.join("; ")}`;if(t==="restructure"){let r=e.map(o=>o.match).filter(Boolean).slice(0,3);return`Restructure line ${n}: ${s[0]||"structural issue"}. Patterns: ${r.join(", ")}`}return t==="voice_drift"?`Rewrite line ${n} to match voice profile: ${s[0]||"voice drift"}`:`Review line ${n}`}function Ql(n,e){return e.filter(s=>s.autoFixable).map(s=>s.id).join(",")}function zr(n,e){let t=n.split(`
337
+ `),s=[];for(let i of e){if(i.strategy!=="auto_fix")continue;let r=i.line-1;if(r<0||r>=t.length)continue;let o=t[r],a=o;for(let l of i.signals){if(!l.autoFixable)continue;let c=qr[l.match.toLowerCase()];if(c!==void 0){let h=new RegExp(Zl(l.match),"gi");a=a.replace(h,u=>c===""?"":u[0]===u[0].toUpperCase()?c.charAt(0).toUpperCase()+c.slice(1):c)}}a=a.replace(/\s{2,}/g," ").trim(),a!==o&&(s.push({line:i.line,before:o,after:a,rule:i.signals.map(l=>l.id).join(", ")}),t[r]=a)}return{original:n,fixed:t.join(`
338
+ `),changes:s,changed:s.length>0}}function Zl(n){return n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}Fi();re();var me=C(require("fs")),Pi=C(require("path")),Xr=C(require("os")),Jr=5*60*1e3,ds=new Map;async function Ri(n,e={}){let t=e.includeSamples!==!1,s=e.forceRefresh||!1;if(!s){let r=ds.get(n);if(r&&Date.now()-r.timestamp<Jr)return r.data}let i=Zr(n);return i&&!s?Date.now()-i.timestamp<Jr?(ds.set(n,i),i.data):(ds.set(n,i),sc(n).catch(()=>{}),i.data):Kr(n)}async function Kr(n){try{let e=await fs(`/cli/profiles/${encodeURIComponent(n)}/full`),t={id:e.profile.id,name:e.profile.name,slug:e.profile.slug,brand:e.profile.brand,keywords:e.profile.keywords,description:e.profile.description,body:e.body,drift_snapshot:e.drift_snapshot||[],learned_patterns:e.learned_patterns||[],voice_samples:e.voice_samples||[],voice_rules:e.voice_rules||[],never_list:e.never_list||[],cadence:e.cadence||{}},s={data:t,timestamp:Date.now(),version:1};return ds.set(n,s),ic(n,s),t}catch{let t=Zr(n);if(t)return t.data;let s=Ae(n);if(s)return nc(n,s);throw new Error(`Profile not found: ${n}. Run: hyv init`)}}async function sc(n){try{await Kr(n)}catch{}}var $i=Pi.join(Xr.homedir(),".hyv","cache","profiles");function Qr(n){return Pi.join($i,`${n.replace(/[^a-z0-9-]/gi,"_")}.json`)}function Zr(n){try{let e=Qr(n);if(!me.existsSync(e))return null;let t=me.readFileSync(e,"utf-8"),s=JSON.parse(t);return!s.data||!s.timestamp?null:s}catch{return null}}function ic(n,e){try{me.existsSync($i)||me.mkdirSync($i,{recursive:!0}),me.writeFileSync(Qr(n),JSON.stringify(e),"utf-8")}catch{}}function nc(n,e){return{id:"",name:n,slug:n,body:e,drift_snapshot:[],learned_patterns:[],voice_samples:[],voice_rules:[],never_list:[],cadence:{}}}function Ti(){return ts().profile}var yt=C(require("fs")),en=C(require("path"));var Mi=(n,e,t)=>{let s=n instanceof RegExp?eo(n,t):n,i=e instanceof RegExp?eo(e,t):e,r=s!==null&&i!=null&&rc(s,i,t);return r&&{start:r[0],end:r[1],pre:t.slice(0,r[0]),body:t.slice(r[0]+s.length,r[1]),post:t.slice(r[1]+i.length)}},eo=(n,e)=>{let t=e.match(n);return t?t[0]:null},rc=(n,e,t)=>{let s,i,r,o,a,l=t.indexOf(n),c=t.indexOf(e,l+1),h=l;if(l>=0&&c>0){if(n===e)return[l,c];for(s=[],r=t.length;h>=0&&!a;){if(h===l)s.push(h),l=t.indexOf(n,h+1);else if(s.length===1){let u=s.pop();u!==void 0&&(a=[u,c])}else i=s.pop(),i!==void 0&&i<r&&(r=i,o=c),c=t.indexOf(e,h+1);h=l<c&&l>=0?l:c}s.length&&o!==void 0&&(a=[r,o])}return a};var to="\0SLASH"+Math.random()+"\0",so="\0OPEN"+Math.random()+"\0",Di="\0CLOSE"+Math.random()+"\0",io="\0COMMA"+Math.random()+"\0",no="\0PERIOD"+Math.random()+"\0",oc=new RegExp(to,"g"),ac=new RegExp(so,"g"),lc=new RegExp(Di,"g"),cc=new RegExp(io,"g"),hc=new RegExp(no,"g"),uc=/\\\\/g,fc=/\\{/g,dc=/\\}/g,pc=/\\,/g,gc=/\\\./g,mc=1e5;function ji(n){return isNaN(n)?n.charCodeAt(0):parseInt(n,10)}function yc(n){return n.replace(uc,to).replace(fc,so).replace(dc,Di).replace(pc,io).replace(gc,no)}function wc(n){return n.replace(oc,"\\").replace(ac,"{").replace(lc,"}").replace(cc,",").replace(hc,".")}function ro(n){if(!n)return[""];let e=[],t=Mi("{","}",n);if(!t)return n.split(",");let{pre:s,body:i,post:r}=t,o=s.split(",");o[o.length-1]+="{"+i+"}";let a=ro(r);return r.length&&(o[o.length-1]+=a.shift(),o.push.apply(o,a)),e.push.apply(e,o),e}function oo(n,e={}){if(!n)return[];let{max:t=mc}=e;return n.slice(0,2)==="{}"&&(n="\\{\\}"+n.slice(2)),At(yc(n),t,!0).map(wc)}function bc(n){return"{"+n+"}"}function vc(n){return/^-?0\d/.test(n)}function xc(n,e){return n<=e}function Sc(n,e){return n>=e}function At(n,e,t){let s=[],i=Mi("{","}",n);if(!i)return[n];let r=i.pre,o=i.post.length?At(i.post,e,!1):[""];if(/\$$/.test(i.pre))for(let a=0;a<o.length&&a<e;a++){let l=r+"{"+i.body+"}"+o[a];s.push(l)}else{let a=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(i.body),l=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(i.body),c=a||l,h=i.body.indexOf(",")>=0;if(!c&&!h)return i.post.match(/,(?!,).*\}/)?(n=i.pre+"{"+i.body+Di+i.post,At(n,e,!0)):[n];let u;if(c)u=i.body.split(/\.\./);else if(u=ro(i.body),u.length===1&&u[0]!==void 0&&(u=At(u[0],e,!1).map(bc),u.length===1))return o.map(d=>i.pre+u[0]+d);let f;if(c&&u[0]!==void 0&&u[1]!==void 0){let d=ji(u[0]),g=ji(u[1]),p=Math.max(u[0].length,u[1].length),y=u.length===3&&u[2]!==void 0?Math.max(Math.abs(ji(u[2])),1):1,m=xc;g<d&&(y*=-1,m=Sc);let _=u.some(vc);f=[];for(let b=d;m(b,g)&&f.length<e;b+=y){let w;if(l)w=String.fromCharCode(b),w==="\\"&&(w="");else if(w=String(b),_){let T=p-w.length;if(T>0){let ee=new Array(T+1).join("0");b<0?w="-"+ee+w.slice(1):w=ee+w}}f.push(w)}}else{f=[];for(let d=0;d<u.length;d++)f.push.apply(f,At(u[d],e,!1))}for(let d=0;d<f.length;d++)for(let g=0;g<o.length&&s.length<e;g++){let p=r+f[d]+o[g];(!t||c||p)&&s.push(p)}}return s}var Ft=n=>{if(typeof n!="string")throw new TypeError("invalid pattern");if(n.length>65536)throw new TypeError("pattern is too long")};var _c={"[:alnum:]":["\\p{L}\\p{Nl}\\p{Nd}",!0],"[:alpha:]":["\\p{L}\\p{Nl}",!0],"[:ascii:]":["\\x00-\\x7f",!1],"[:blank:]":["\\p{Zs}\\t",!0],"[:cntrl:]":["\\p{Cc}",!0],"[:digit:]":["\\p{Nd}",!0],"[:graph:]":["\\p{Z}\\p{C}",!0,!0],"[:lower:]":["\\p{Ll}",!0],"[:print:]":["\\p{C}",!0],"[:punct:]":["\\p{P}",!0],"[:space:]":["\\p{Z}\\t\\r\\n\\v\\f",!0],"[:upper:]":["\\p{Lu}",!0],"[:word:]":["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}",!0],"[:xdigit:]":["A-Fa-f0-9",!1]},$t=n=>n.replace(/[[\]\\-]/g,"\\$&"),Cc=n=>n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),ao=n=>n.join(""),lo=(n,e)=>{let t=e;if(n.charAt(t)!=="[")throw new Error("not in a brace expression");let s=[],i=[],r=t+1,o=!1,a=!1,l=!1,c=!1,h=t,u="";e:for(;r<n.length;){let p=n.charAt(r);if((p==="!"||p==="^")&&r===t+1){c=!0,r++;continue}if(p==="]"&&o&&!l){h=r+1;break}if(o=!0,p==="\\"&&!l){l=!0,r++;continue}if(p==="["&&!l){for(let[y,[m,x,_]]of Object.entries(_c))if(n.startsWith(y,r)){if(u)return["$.",!1,n.length-t,!0];r+=y.length,_?i.push(m):s.push(m),a=a||x;continue e}}if(l=!1,u){p>u?s.push($t(u)+"-"+$t(p)):p===u&&s.push($t(p)),u="",r++;continue}if(n.startsWith("-]",r+1)){s.push($t(p+"-")),r+=2;continue}if(n.startsWith("-",r+1)){u=p,r+=2;continue}s.push($t(p)),r++}if(h<r)return["",!1,0,!1];if(!s.length&&!i.length)return["$.",!1,n.length-t,!0];if(i.length===0&&s.length===1&&/^\\?.$/.test(s[0])&&!c){let p=s[0].length===2?s[0].slice(-1):s[0];return[Cc(p),!1,h-t,!1]}let f="["+(c?"^":"")+ao(s)+"]",d="["+(c?"":"^")+ao(i)+"]";return[s.length&&i.length?"("+f+"|"+d+")":s.length?f:d,a,h-t,!0]};var ye=(n,{windowsPathsNoEscape:e=!1,magicalBraces:t=!0}={})=>t?e?n.replace(/\[([^/\\])\]/g,"$1"):n.replace(/((?!\\).|^)\[([^/\\])\]/g,"$1$2").replace(/\\([^/])/g,"$1"):e?n.replace(/\[([^/\\{}])\]/g,"$1"):n.replace(/((?!\\).|^)\[([^/\\{}])\]/g,"$1$2").replace(/\\([^/{}])/g,"$1");var se,kc=new Set(["!","?","+","*","@"]),Ii=n=>kc.has(n),co=n=>Ii(n.type),Ec=new Map([["!",["@"]],["?",["?","@"]],["@",["@"]],["*",["*","+","?","@"]],["+",["+","@"]]]),Oc=new Map([["!",["?"]],["@",["?"]],["+",["?","*"]]]),Ac=new Map([["!",["?","@"]],["?",["?","@"]],["@",["?","@"]],["*",["*","+","?","@"]],["+",["+","@","?","*"]]]),ho=new Map([["!",new Map([["!","@"]])],["?",new Map([["*","*"],["+","*"]])],["@",new Map([["!","!"],["?","?"],["@","@"],["*","*"],["+","+"]])],["+",new Map([["?","*"],["*","*"]])]]),Fc="(?!(?:^|/)\\.\\.?(?:$|/))",ps="(?!\\.)",$c=new Set(["[","."]),Rc=new Set(["..","."]),Pc=new Set("().*{}+?[]^$\\!"),Tc=n=>n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),Li="[^/]",uo=Li+"*?",fo=Li+"+?",Mc=0,Ye=class{type;#e;#i;#n=!1;#t=[];#o;#_;#w;#u=!1;#a;#f;#h=!1;id=++Mc;get depth(){return(this.#o?.depth??-1)+1}[Symbol.for("nodejs.util.inspect.custom")](){return{"@@type":"AST",id:this.id,type:this.type,root:this.#e.id,parent:this.#o?.id,depth:this.depth,partsLength:this.#t.length,parts:this.#t}}constructor(e,t,s={}){this.type=e,e&&(this.#i=!0),this.#o=t,this.#e=this.#o?this.#o.#e:this,this.#a=this.#e===this?s:this.#e.#a,this.#w=this.#e===this?[]:this.#e.#w,e==="!"&&!this.#e.#u&&this.#w.push(this),this.#_=this.#o?this.#o.#t.length:0}get hasMagic(){if(this.#i!==void 0)return this.#i;for(let e of this.#t)if(typeof e!="string"&&(e.type||e.hasMagic))return this.#i=!0;return this.#i}toString(){return this.#f!==void 0?this.#f:this.type?this.#f=this.type+"("+this.#t.map(e=>String(e)).join("|")+")":this.#f=this.#t.map(e=>String(e)).join("")}#c(){if(this!==this.#e)throw new Error("should only call on root");if(this.#u)return this;this.toString(),this.#u=!0;let e;for(;e=this.#w.pop();){if(e.type!=="!")continue;let t=e,s=t.#o;for(;s;){for(let i=t.#_+1;!s.type&&i<s.#t.length;i++)for(let r of e.#t){if(typeof r=="string")throw new Error("string part in extglob AST??");r.copyIn(s.#t[i])}t=s,s=t.#o}}return this}push(...e){for(let t of e)if(t!==""){if(typeof t!="string"&&!(t instanceof se&&t.#o===this))throw new Error("invalid part: "+t);this.#t.push(t)}}toJSON(){let e=this.type===null?this.#t.slice().map(t=>typeof t=="string"?t:t.toJSON()):[this.type,...this.#t.map(t=>t.toJSON())];return this.isStart()&&!this.type&&e.unshift([]),this.isEnd()&&(this===this.#e||this.#e.#u&&this.#o?.type==="!")&&e.push({}),e}isStart(){if(this.#e===this)return!0;if(!this.#o?.isStart())return!1;if(this.#_===0)return!0;let e=this.#o;for(let t=0;t<this.#_;t++){let s=e.#t[t];if(!(s instanceof se&&s.type==="!"))return!1}return!0}isEnd(){if(this.#e===this||this.#o?.type==="!")return!0;if(!this.#o?.isEnd())return!1;if(!this.type)return this.#o?.isEnd();let e=this.#o?this.#o.#t.length:0;return this.#_===e-1}copyIn(e){typeof e=="string"?this.push(e):this.push(e.clone(this))}clone(e){let t=new se(this.type,e);for(let s of this.#t)t.copyIn(s);return t}static#r(e,t,s,i,r){let o=i.maxExtglobRecursion??2,a=!1,l=!1,c=-1,h=!1;if(t.type===null){let p=s,y="";for(;p<e.length;){let m=e.charAt(p++);if(a||m==="\\"){a=!a,y+=m;continue}if(l){p===c+1?(m==="^"||m==="!")&&(h=!0):m==="]"&&!(p===c+2&&h)&&(l=!1),y+=m;continue}else if(m==="["){l=!0,c=p,h=!1,y+=m;continue}if(!i.noext&&Ii(m)&&e.charAt(p)==="("&&r<=o){t.push(y),y="";let _=new se(m,t);p=se.#r(e,_,p,i,r+1),t.push(_);continue}y+=m}return t.push(y),p}let u=s+1,f=new se(null,t),d=[],g="";for(;u<e.length;){let p=e.charAt(u++);if(a||p==="\\"){a=!a,g+=p;continue}if(l){u===c+1?(p==="^"||p==="!")&&(h=!0):p==="]"&&!(u===c+2&&h)&&(l=!1),g+=p;continue}else if(p==="["){l=!0,c=u,h=!1,g+=p;continue}if(!i.noext&&Ii(p)&&e.charAt(u)==="("&&(r<=o||t&&t.#p(p))){let m=t&&t.#p(p)?0:1;f.push(g),g="";let x=new se(p,f);f.push(x),u=se.#r(e,x,u,i,r+m);continue}if(p==="|"){f.push(g),g="",d.push(f),f=new se(null,t);continue}if(p===")")return g===""&&t.#t.length===0&&(t.#h=!0),f.push(g),g="",t.push(...d,f),u;g+=p}return t.type=null,t.#i=void 0,t.#t=[e.substring(s-1)],u}#b(e){return this.#x(e,Oc)}#x(e,t=Ec){if(!e||typeof e!="object"||e.type!==null||e.#t.length!==1||this.type===null)return!1;let s=e.#t[0];return!s||typeof s!="object"||s.type===null?!1:this.#p(s.type,t)}#p(e,t=Ac){return!!t.get(this.type)?.includes(e)}#g(e,t){let s=e.#t[0],i=new se(null,s,this.options);i.#t.push(""),s.push(i),this.#E(e,t)}#E(e,t){let s=e.#t[0];this.#t.splice(t,1,...s.#t);for(let i of s.#t)typeof i=="object"&&(i.#o=this);this.#f=void 0}#m(e){return!!ho.get(this.type)?.has(e)}#S(e){if(!e||typeof e!="object"||e.type!==null||e.#t.length!==1||this.type===null||this.#t.length!==1)return!1;let t=e.#t[0];return!t||typeof t!="object"||t.type===null?!1:this.#m(t.type)}#C(e){let t=ho.get(this.type),s=e.#t[0],i=t?.get(s.type);if(!i)return!1;this.#t=s.#t;for(let r of this.#t)typeof r=="object"&&(r.#o=this);this.type=i,this.#f=void 0,this.#h=!1}static fromGlob(e,t={}){let s=new se(null,void 0,t);return se.#r(e,s,0,t,0),s}toMMPattern(){if(this!==this.#e)return this.#e.toMMPattern();let e=this.toString(),[t,s,i,r]=this.toRegExpSource();if(!(i||this.#i||this.#a.nocase&&!this.#a.nocaseMagicOnly&&e.toUpperCase()!==e.toLowerCase()))return s;let a=(this.#a.nocase?"i":"")+(r?"u":"");return Object.assign(new RegExp(`^${t}$`,a),{_src:t,_glob:e})}get options(){return this.#a}toRegExpSource(e){let t=e??!!this.#a.dot;if(this.#e===this&&(this.#d(),this.#c()),!co(this)){let l=this.isStart()&&this.isEnd()&&!this.#t.some(d=>typeof d!="string"),c=this.#t.map(d=>{let[g,p,y,m]=typeof d=="string"?se.#v(d,this.#i,l):d.toRegExpSource(e);return this.#i=this.#i||y,this.#n=this.#n||m,g}).join(""),h="";if(this.isStart()&&typeof this.#t[0]=="string"&&!(this.#t.length===1&&Rc.has(this.#t[0]))){let g=$c,p=t&&g.has(c.charAt(0))||c.startsWith("\\.")&&g.has(c.charAt(2))||c.startsWith("\\.\\.")&&g.has(c.charAt(4)),y=!t&&!e&&g.has(c.charAt(0));h=p?Fc:y?ps:""}let u="";return this.isEnd()&&this.#e.#u&&this.#o?.type==="!"&&(u="(?:$|\\/)"),[h+c+u,ye(c),this.#i=!!this.#i,this.#n]}let s=this.type==="*"||this.type==="+",i=this.type==="!"?"(?:(?!(?:":"(?:",r=this.#y(t);if(this.isStart()&&this.isEnd()&&!r&&this.type!=="!"){let l=this.toString(),c=this;return c.#t=[l],c.type=null,c.#i=void 0,[l,ye(this.toString()),!1,!1]}let o=!s||e||t||!ps?"":this.#y(!0);o===r&&(o=""),o&&(r=`(?:${r})(?:${o})*?`);let a="";if(this.type==="!"&&this.#h)a=(this.isStart()&&!t?ps:"")+fo;else{let l=this.type==="!"?"))"+(this.isStart()&&!t&&!e?ps:"")+uo+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&o?")":this.type==="*"&&o?")?":`)${this.type}`;a=i+r+l}return[a,ye(r),this.#i=!!this.#i,this.#n]}#d(){if(co(this)){let e=0,t=!1;do{t=!0;for(let s=0;s<this.#t.length;s++){let i=this.#t[s];typeof i=="object"&&(i.#d(),this.#x(i)?(t=!1,this.#E(i,s)):this.#b(i)?(t=!1,this.#g(i,s)):this.#S(i)&&(t=!1,this.#C(i)))}}while(!t&&++e<10)}else for(let e of this.#t)typeof e=="object"&&e.#d();this.#f=void 0}#y(e){return this.#t.map(t=>{if(typeof t=="string")throw new Error("string type in extglob ast??");let[s,i,r,o]=t.toRegExpSource(e);return this.#n=this.#n||o,s}).filter(t=>!(this.isStart()&&this.isEnd())||!!t).join("|")}static#v(e,t,s=!1){let i=!1,r="",o=!1,a=!1;for(let l=0;l<e.length;l++){let c=e.charAt(l);if(i){i=!1,r+=(Pc.has(c)?"\\":"")+c;continue}if(c==="*"){if(a)continue;a=!0,r+=s&&/^[*]+$/.test(e)?fo:uo,t=!0;continue}else a=!1;if(c==="\\"){l===e.length-1?r+="\\\\":i=!0;continue}if(c==="["){let[h,u,f,d]=lo(e,l);if(f){r+=h,o=o||u,l+=f-1,t=t||d;continue}}if(c==="?"){r+=Li,t=!0;continue}r+=Tc(c)}return[r,ye(e),!!t,o]}};se=Ye;var ct=(n,{windowsPathsNoEscape:e=!1,magicalBraces:t=!1}={})=>t?e?n.replace(/[?*()[\]{}]/g,"[$&]"):n.replace(/[?*()[\]\\{}]/g,"\\$&"):e?n.replace(/[?*()[\]]/g,"[$&]"):n.replace(/[?*()[\]\\]/g,"\\$&");var X=(n,e,t={})=>(Ft(e),!t.nocomment&&e.charAt(0)==="#"?!1:new oe(e,t).match(n)),jc=/^\*+([^+@!?*[(]*)$/,Dc=n=>e=>!e.startsWith(".")&&e.endsWith(n),Ic=n=>e=>e.endsWith(n),Lc=n=>(n=n.toLowerCase(),e=>!e.startsWith(".")&&e.toLowerCase().endsWith(n)),Nc=n=>(n=n.toLowerCase(),e=>e.toLowerCase().endsWith(n)),Wc=/^\*+\.\*+$/,Hc=n=>!n.startsWith(".")&&n.includes("."),Vc=n=>n!=="."&&n!==".."&&n.includes("."),qc=/^\.\*+$/,Bc=n=>n!=="."&&n!==".."&&n.startsWith("."),Uc=/^\*+$/,zc=n=>n.length!==0&&!n.startsWith("."),Gc=n=>n.length!==0&&n!=="."&&n!=="..",Yc=/^\?+([^+@!?*[(]*)?$/,Jc=([n,e=""])=>{let t=mo([n]);return e?(e=e.toLowerCase(),s=>t(s)&&s.toLowerCase().endsWith(e)):t},Kc=([n,e=""])=>{let t=yo([n]);return e?(e=e.toLowerCase(),s=>t(s)&&s.toLowerCase().endsWith(e)):t},Xc=([n,e=""])=>{let t=yo([n]);return e?s=>t(s)&&s.endsWith(e):t},Qc=([n,e=""])=>{let t=mo([n]);return e?s=>t(s)&&s.endsWith(e):t},mo=([n])=>{let e=n.length;return t=>t.length===e&&!t.startsWith(".")},yo=([n])=>{let e=n.length;return t=>t.length===e&&t!=="."&&t!==".."},wo=typeof process=="object"&&process?typeof process.env=="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",po={win32:{sep:"\\"},posix:{sep:"/"}},Zc=wo==="win32"?po.win32.sep:po.posix.sep;X.sep=Zc;var R=Symbol("globstar **");X.GLOBSTAR=R;var eh="[^/]",th=eh+"*?",sh="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",ih="(?:(?!(?:\\/|^)\\.).)*?",nh=(n,e={})=>t=>X(t,n,e);X.filter=nh;var ue=(n,e={})=>Object.assign({},n,e),rh=n=>{if(!n||typeof n!="object"||!Object.keys(n).length)return X;let e=X;return Object.assign((s,i,r={})=>e(s,i,ue(n,r)),{Minimatch:class extends e.Minimatch{constructor(i,r={}){super(i,ue(n,r))}static defaults(i){return e.defaults(ue(n,i)).Minimatch}},AST:class extends e.AST{constructor(i,r,o={}){super(i,r,ue(n,o))}static fromGlob(i,r={}){return e.AST.fromGlob(i,ue(n,r))}},unescape:(s,i={})=>e.unescape(s,ue(n,i)),escape:(s,i={})=>e.escape(s,ue(n,i)),filter:(s,i={})=>e.filter(s,ue(n,i)),defaults:s=>e.defaults(ue(n,s)),makeRe:(s,i={})=>e.makeRe(s,ue(n,i)),braceExpand:(s,i={})=>e.braceExpand(s,ue(n,i)),match:(s,i,r={})=>e.match(s,i,ue(n,r)),sep:e.sep,GLOBSTAR:R})};X.defaults=rh;var bo=(n,e={})=>(Ft(n),e.nobrace||!/\{(?:(?!\{).)*\}/.test(n)?[n]:oo(n,{max:e.braceExpandMax}));X.braceExpand=bo;var oh=(n,e={})=>new oe(n,e).makeRe();X.makeRe=oh;var ah=(n,e,t={})=>{let s=new oe(e,t);return n=n.filter(i=>s.match(i)),s.options.nonull&&!n.length&&n.push(e),n};X.match=ah;var go=/[?*]|[+@!]\(.*?\)|\[|\]/,lh=n=>n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),oe=class{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;maxGlobstarRecursion;regexp;constructor(e,t={}){Ft(e),t=t||{},this.options=t,this.maxGlobstarRecursion=t.maxGlobstarRecursion??200,this.pattern=e,this.platform=t.platform||wo,this.isWindows=this.platform==="win32";let s="allowWindowsEscape";this.windowsPathsNoEscape=!!t.windowsPathsNoEscape||t[s]===!1,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,"/")),this.preserveMultipleSlashes=!!t.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!t.nonegate,this.comment=!1,this.empty=!1,this.partial=!!t.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=t.windowsNoMagicRoot!==void 0?t.windowsNoMagicRoot:!!(this.isWindows&&this.nocase),this.globSet=[],this.globParts=[],this.set=[],this.make()}hasMagic(){if(this.options.magicalBraces&&this.set.length>1)return!0;for(let e of this.set)for(let t of e)if(typeof t!="string")return!0;return!1}debug(...e){}make(){let e=this.pattern,t=this.options;if(!t.nocomment&&e.charAt(0)==="#"){this.comment=!0;return}if(!e){this.empty=!0;return}this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],t.debug&&(this.debug=(...r)=>console.error(...r)),this.debug(this.pattern,this.globSet);let s=this.globSet.map(r=>this.slashSplit(r));this.globParts=this.preprocess(s),this.debug(this.pattern,this.globParts);let i=this.globParts.map((r,o,a)=>{if(this.isWindows&&this.windowsNoMagicRoot){let l=r[0]===""&&r[1]===""&&(r[2]==="?"||!go.test(r[2]))&&!go.test(r[3]),c=/^[a-z]:/i.test(r[0]);if(l)return[...r.slice(0,4),...r.slice(4).map(h=>this.parse(h))];if(c)return[r[0],...r.slice(1).map(h=>this.parse(h))]}return r.map(l=>this.parse(l))});if(this.debug(this.pattern,i),this.set=i.filter(r=>r.indexOf(!1)===-1),this.isWindows)for(let r=0;r<this.set.length;r++){let o=this.set[r];o[0]===""&&o[1]===""&&this.globParts[r][2]==="?"&&typeof o[3]=="string"&&/^[a-z]:$/i.test(o[3])&&(o[2]="?")}this.debug(this.pattern,this.set)}preprocess(e){if(this.options.noglobstar)for(let s of e)for(let i=0;i<s.length;i++)s[i]==="**"&&(s[i]="*");let{optimizationLevel:t=1}=this.options;return t>=2?(e=this.firstPhasePreProcess(e),e=this.secondPhasePreProcess(e)):t>=1?e=this.levelOneOptimize(e):e=this.adjascentGlobstarOptimize(e),e}adjascentGlobstarOptimize(e){return e.map(t=>{let s=-1;for(;(s=t.indexOf("**",s+1))!==-1;){let i=s;for(;t[i+1]==="**";)i++;i!==s&&t.splice(s,i-s)}return t})}levelOneOptimize(e){return e.map(t=>(t=t.reduce((s,i)=>{let r=s[s.length-1];return i==="**"&&r==="**"?s:i===".."&&r&&r!==".."&&r!=="."&&r!=="**"?(s.pop(),s):(s.push(i),s)},[]),t.length===0?[""]:t))}levelTwoFileOptimize(e){Array.isArray(e)||(e=this.slashSplit(e));let t=!1;do{if(t=!1,!this.preserveMultipleSlashes){for(let i=1;i<e.length-1;i++){let r=e[i];i===1&&r===""&&e[0]===""||(r==="."||r==="")&&(t=!0,e.splice(i,1),i--)}e[0]==="."&&e.length===2&&(e[1]==="."||e[1]==="")&&(t=!0,e.pop())}let s=0;for(;(s=e.indexOf("..",s+1))!==-1;){let i=e[s-1];i&&i!=="."&&i!==".."&&i!=="**"&&!(this.isWindows&&/^[a-z]:$/i.test(i))&&(t=!0,e.splice(s-1,2),s-=2)}}while(t);return e.length===0?[""]:e}firstPhasePreProcess(e){let t=!1;do{t=!1;for(let s of e){let i=-1;for(;(i=s.indexOf("**",i+1))!==-1;){let o=i;for(;s[o+1]==="**";)o++;o>i&&s.splice(i+1,o-i);let a=s[i+1],l=s[i+2],c=s[i+3];if(a!==".."||!l||l==="."||l===".."||!c||c==="."||c==="..")continue;t=!0,s.splice(i,1);let h=s.slice(0);h[i]="**",e.push(h),i--}if(!this.preserveMultipleSlashes){for(let o=1;o<s.length-1;o++){let a=s[o];o===1&&a===""&&s[0]===""||(a==="."||a==="")&&(t=!0,s.splice(o,1),o--)}s[0]==="."&&s.length===2&&(s[1]==="."||s[1]==="")&&(t=!0,s.pop())}let r=0;for(;(r=s.indexOf("..",r+1))!==-1;){let o=s[r-1];if(o&&o!=="."&&o!==".."&&o!=="**"){t=!0;let l=r===1&&s[r+1]==="**"?["."]:[];s.splice(r-1,2,...l),s.length===0&&s.push(""),r-=2}}}}while(t);return e}secondPhasePreProcess(e){for(let t=0;t<e.length-1;t++)for(let s=t+1;s<e.length;s++){let i=this.partsMatch(e[t],e[s],!this.preserveMultipleSlashes);if(i){e[t]=[],e[s]=i;break}}return e.filter(t=>t.length)}partsMatch(e,t,s=!1){let i=0,r=0,o=[],a="";for(;i<e.length&&r<t.length;)if(e[i]===t[r])o.push(a==="b"?t[r]:e[i]),i++,r++;else if(s&&e[i]==="**"&&t[r]===e[i+1])o.push(e[i]),i++;else if(s&&t[r]==="**"&&e[i]===t[r+1])o.push(t[r]),r++;else if(e[i]==="*"&&t[r]&&(this.options.dot||!t[r].startsWith("."))&&t[r]!=="**"){if(a==="b")return!1;a="a",o.push(e[i]),i++,r++}else if(t[r]==="*"&&e[i]&&(this.options.dot||!e[i].startsWith("."))&&e[i]!=="**"){if(a==="a")return!1;a="b",o.push(t[r]),i++,r++}else return!1;return e.length===t.length&&o}parseNegate(){if(this.nonegate)return;let e=this.pattern,t=!1,s=0;for(let i=0;i<e.length&&e.charAt(i)==="!";i++)t=!t,s++;s&&(this.pattern=e.slice(s)),this.negate=t}matchOne(e,t,s=!1){let i=0,r=0;if(this.isWindows){let a=typeof e[0]=="string"&&/^[a-z]:$/i.test(e[0]),l=!a&&e[0]===""&&e[1]===""&&e[2]==="?"&&/^[a-z]:$/i.test(e[3]),c=typeof t[0]=="string"&&/^[a-z]:$/i.test(t[0]),h=!c&&t[0]===""&&t[1]===""&&t[2]==="?"&&typeof t[3]=="string"&&/^[a-z]:$/i.test(t[3]),u=l?3:a?0:void 0,f=h?3:c?0:void 0;if(typeof u=="number"&&typeof f=="number"){let[d,g]=[e[u],t[f]];d.toLowerCase()===g.toLowerCase()&&(t[f]=d,r=f,i=u)}}let{optimizationLevel:o=1}=this.options;return o>=2&&(e=this.levelTwoFileOptimize(e)),t.includes(R)?this.#e(e,t,s,i,r):this.#n(e,t,s,i,r)}#e(e,t,s,i,r){let o=t.indexOf(R,r),a=t.lastIndexOf(R),[l,c,h]=s?[t.slice(r,o),t.slice(o+1),[]]:[t.slice(r,o),t.slice(o+1,a),t.slice(a+1)];if(l.length){let x=e.slice(i,i+l.length);if(!this.#n(x,l,s,0,0))return!1;i+=l.length,r+=l.length}let u=0;if(h.length){if(h.length+i>e.length)return!1;let x=e.length-h.length;if(this.#n(e,h,s,x,0))u=h.length;else{if(e[e.length-1]!==""||i+h.length===e.length||(x--,!this.#n(e,h,s,x,0)))return!1;u=h.length+1}}if(!c.length){let x=!!u;for(let _=i;_<e.length-u;_++){let b=String(e[_]);if(x=!0,b==="."||b===".."||!this.options.dot&&b.startsWith("."))return!1}return s||x}let f=[[[],0]],d=f[0],g=0,p=[0];for(let x of c)x===R?(p.push(g),d=[[],0],f.push(d)):(d[0].push(x),g++);let y=f.length-1,m=e.length-u;for(let x of f)x[1]=m-(p[y--]+x[0].length);return!!this.#i(e,f,i,0,s,0,!!u)}#i(e,t,s,i,r,o,a){let l=t[i];if(!l){for(let u=s;u<e.length;u++){a=!0;let f=e[u];if(f==="."||f===".."||!this.options.dot&&f.startsWith("."))return!1}return a}let[c,h]=l;for(;s<=h;){if(this.#n(e.slice(0,s+c.length),c,r,s,0)&&o<this.maxGlobstarRecursion){let d=this.#i(e,t,s+c.length,i+1,r,o+1,a);if(d!==!1)return d}let f=e[s];if(f==="."||f===".."||!this.options.dot&&f.startsWith("."))return!1;s++}return r||null}#n(e,t,s,i,r){let o,a,l,c;for(o=i,a=r,c=e.length,l=t.length;o<c&&a<l;o++,a++){this.debug("matchOne loop");let h=t[a],u=e[o];if(this.debug(t,h,u),h===!1||h===R)return!1;let f;if(typeof h=="string"?(f=u===h,this.debug("string match",h,u,f)):(f=h.test(u),this.debug("pattern match",h,u,f)),!f)return!1}if(o===c&&a===l)return!0;if(o===c)return s;if(a===l)return o===c-1&&e[o]==="";throw new Error("wtf?")}braceExpand(){return bo(this.pattern,this.options)}parse(e){Ft(e);let t=this.options;if(e==="**")return R;if(e==="")return"";let s,i=null;(s=e.match(Uc))?i=t.dot?Gc:zc:(s=e.match(jc))?i=(t.nocase?t.dot?Nc:Lc:t.dot?Ic:Dc)(s[1]):(s=e.match(Yc))?i=(t.nocase?t.dot?Kc:Jc:t.dot?Xc:Qc)(s):(s=e.match(Wc))?i=t.dot?Vc:Hc:(s=e.match(qc))&&(i=Bc);let r=Ye.fromGlob(e,this.options).toMMPattern();return i&&typeof r=="object"&&Reflect.defineProperty(r,"test",{value:i}),r}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let e=this.set;if(!e.length)return this.regexp=!1,this.regexp;let t=this.options,s=t.noglobstar?th:t.dot?sh:ih,i=new Set(t.nocase?["i"]:[]),r=e.map(l=>{let c=l.map(u=>{if(u instanceof RegExp)for(let f of u.flags.split(""))i.add(f);return typeof u=="string"?lh(u):u===R?R:u._src});c.forEach((u,f)=>{let d=c[f+1],g=c[f-1];u!==R||g===R||(g===void 0?d!==void 0&&d!==R?c[f+1]="(?:\\/|"+s+"\\/)?"+d:c[f]=s:d===void 0?c[f-1]=g+"(?:\\/|\\/"+s+")?":d!==R&&(c[f-1]=g+"(?:\\/|\\/"+s+"\\/)"+d,c[f+1]=R))});let h=c.filter(u=>u!==R);if(this.partial&&h.length>=1){let u=[];for(let f=1;f<=h.length;f++)u.push(h.slice(0,f).join("/"));return"(?:"+u.join("|")+")"}return h.join("/")}).join("|"),[o,a]=e.length>1?["(?:",")"]:["",""];r="^"+o+r+a+"$",this.partial&&(r="^(?:\\/|"+o+r.slice(1,-1)+a+")$"),this.negate&&(r="^(?!"+r+").+$");try{this.regexp=new RegExp(r,[...i].join(""))}catch{this.regexp=!1}return this.regexp}slashSplit(e){return this.preserveMultipleSlashes?e.split("/"):this.isWindows&&/^\/\/[^/]+/.test(e)?["",...e.split(/\/+/)]:e.split(/\/+/)}match(e,t=this.partial){if(this.debug("match",e,this.pattern),this.comment)return!1;if(this.empty)return e==="";if(e==="/"&&t)return!0;let s=this.options;this.isWindows&&(e=e.split("\\").join("/"));let i=this.slashSplit(e);this.debug(this.pattern,"split",i);let r=this.set;this.debug(this.pattern,"set",r);let o=i[i.length-1];if(!o)for(let a=i.length-2;!o&&a>=0;a--)o=i[a];for(let a of r){let l=i;if(s.matchBase&&a.length===1&&(l=[o]),this.matchOne(l,a,t))return s.flipNegate?!0:!this.negate}return s.flipNegate?!1:this.negate}static defaults(e){return X.defaults(e).Minimatch}};X.AST=Ye;X.Minimatch=oe;X.escape=ct;X.unescape=ye;var qo=require("node:url");var ms=require("node:diagnostics_channel"),B=(0,ms.channel)("lru-cache:metrics"),Rt=(0,ms.tracingChannel)("lru-cache"),ch=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,Ni=()=>B.hasSubscribers||Rt.hasSubscribers,xo=new Set,vo=typeof process=="object"&&process?process:{},hh=(n,e,t,s)=>{typeof vo.emitWarning=="function"?vo.emitWarning(n,e,t,s):console.error(`[${t}] ${e}: ${n}`)},uh=n=>!xo.has(n),Le=n=>!!n&&n===Math.floor(n)&&n>0&&isFinite(n),So=n=>Le(n)?n<=Math.pow(2,8)?Uint8Array:n<=Math.pow(2,16)?Uint16Array:n<=Math.pow(2,32)?Uint32Array:n<=Number.MAX_SAFE_INTEGER?gs:null:null,gs=class extends Array{constructor(n){super(n),this.fill(0)}},fh=class Pt{heap;length;static#e=!1;static create(e){let t=So(e);if(!t)return[];Pt.#e=!0;let s=new Pt(e,t);return Pt.#e=!1,s}constructor(e,t){if(!Pt.#e)throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new t(e),this.length=0}push(e){this.heap[this.length++]=e}pop(){return this.heap[--this.length]}},Tt=class _o{#e;#i;#n;#t;#o;#_;#w;#u;get perf(){return this.#u}ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;backgroundFetchSize;#a;#f;#h;#c;#r;#b;#x;#p;#g;#E;#m;#S;#C;#d;#y;#v;#A;#s;#R;static unsafeExposeInternals(e){return{starts:e.#C,ttls:e.#d,autopurgeTimers:e.#y,sizes:e.#S,keyMap:e.#h,keyList:e.#c,valList:e.#r,next:e.#b,prev:e.#x,get head(){return e.#p},get tail(){return e.#g},free:e.#E,isBackgroundFetch:t=>e.#l(t),backgroundFetch:(t,s,i,r)=>e.#I(t,s,i,r),moveToTail:t=>e.#Y(t),indexes:t=>e.#F(t),rindexes:t=>e.#$(t),isStale:t=>e.#k(t)}}get max(){return this.#e}get maxSize(){return this.#i}get calculatedSize(){return this.#f}get size(){return this.#a}get fetchMethod(){return this.#_}get memoMethod(){return this.#w}get dispose(){return this.#n}get onInsert(){return this.#t}get disposeAfter(){return this.#o}constructor(e){let{max:t=0,ttl:s,ttlResolution:i=1,ttlAutopurge:r,updateAgeOnGet:o,updateAgeOnHas:a,allowStale:l,dispose:c,onInsert:h,disposeAfter:u,noDisposeOnSet:f,noUpdateTTL:d,maxSize:g=0,maxEntrySize:p=0,sizeCalculation:y,fetchMethod:m,memoMethod:x,noDeleteOnFetchRejection:_,noDeleteOnStaleGet:b,allowStaleOnFetchRejection:w,allowStaleOnFetchAbort:T,ignoreFetchAbort:ee,backgroundFetchSize:Ee=1,perf:J}=e;if(this.backgroundFetchSize=Ee,J!==void 0&&typeof J?.now!="function")throw new TypeError("perf option must have a now() method if specified");if(this.#u=J??ch,t!==0&&!Le(t))throw new TypeError("max option must be a nonnegative integer");let Is=t?So(t):Array;if(!Is)throw new Error("invalid max value: "+t);if(this.#e=t,this.#i=g,this.maxEntrySize=p||this.#i,this.sizeCalculation=y,this.sizeCalculation){if(!this.#i&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(x!==void 0&&typeof x!="function")throw new TypeError("memoMethod must be a function if defined");if(this.#w=x,m!==void 0&&typeof m!="function")throw new TypeError("fetchMethod must be a function if specified");if(this.#_=m,this.#A=!!m,this.#h=new Map,this.#c=Array.from({length:t}).fill(void 0),this.#r=Array.from({length:t}).fill(void 0),this.#b=new Is(t),this.#x=new Is(t),this.#p=0,this.#g=0,this.#E=fh.create(t),this.#a=0,this.#f=0,typeof c=="function"&&(this.#n=c),typeof h=="function"&&(this.#t=h),typeof u=="function"?(this.#o=u,this.#m=[]):(this.#o=void 0,this.#m=void 0),this.#v=!!this.#n,this.#R=!!this.#t,this.#s=!!this.#o,this.noDisposeOnSet=!!f,this.noUpdateTTL=!!d,this.noDeleteOnFetchRejection=!!_,this.allowStaleOnFetchRejection=!!w,this.allowStaleOnFetchAbort=!!T,this.ignoreFetchAbort=!!ee,this.maxEntrySize!==0){if(this.#i!==0&&!Le(this.#i))throw new TypeError("maxSize must be a positive integer if specified");if(!Le(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#B()}if(this.allowStale=!!l,this.noDeleteOnStaleGet=!!b,this.updateAgeOnGet=!!o,this.updateAgeOnHas=!!a,this.ttlResolution=Le(i)||i===0?i:1,this.ttlAutopurge=!!r,this.ttl=s||0,this.ttl){if(!Le(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#P()}if(this.#e===0&&this.ttl===0&&this.#i===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#e&&!this.#i){let Ls="LRU_CACHE_UNBOUNDED";uh(Ls)&&(xo.add(Ls),hh("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",Ls,_o))}}getRemainingTTL(e){return this.#h.has(e)?1/0:0}#P(){let e=new gs(this.#e),t=new gs(this.#e);this.#d=e,this.#C=t;let s=this.ttlAutopurge?Array.from({length:this.#e}):void 0;this.#y=s,this.#N=(a,l,c=this.#u.now())=>{t[a]=l!==0?c:0,e[a]=l,i(a,l)},this.#O=a=>{t[a]=e[a]!==0?this.#u.now():0,i(a,e[a])};let i=this.ttlAutopurge?(a,l)=>{if(s?.[a]&&(clearTimeout(s[a]),s[a]=void 0),l&&l!==0&&s){let c=setTimeout(()=>{this.#k(a)&&this.#L(this.#c[a],"expire")},l+1);c.unref&&c.unref(),s[a]=c}}:()=>{};this.#T=(a,l)=>{if(e[l]){let c=e[l],h=t[l];if(!c||!h)return;a.ttl=c,a.start=h,a.now=r||o();let u=a.now-h;a.remainingTTL=c-u}};let r=0,o=()=>{let a=this.#u.now();if(this.ttlResolution>0){r=a;let l=setTimeout(()=>r=0,this.ttlResolution);l.unref&&l.unref()}return a};this.getRemainingTTL=a=>{let l=this.#h.get(a);if(l===void 0)return 0;let c=e[l],h=t[l];if(!c||!h)return 1/0;let u=(r||o())-h;return c-u},this.#k=a=>{let l=t[a],c=e[a];return!!c&&!!l&&(r||o())-l>c}}#O=()=>{};#T=()=>{};#N=()=>{};#k=()=>!1;#B(){let e=new gs(this.#e);this.#f=0,this.#S=e,this.#j=t=>{this.#f-=e[t],e[t]=0},this.#W=(t,s,i,r)=>{if(!Le(i)){if(this.#l(s))return this.backgroundFetchSize;if(r){if(typeof r!="function")throw new TypeError("sizeCalculation must be a function");if(i=r(s,t),!Le(i))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.")}return i},this.#M=(t,s,i)=>{if(e[t]=s,this.#i){let r=this.#i-e[t];for(;this.#f>r;)this.#q(!0)}this.#f+=e[t],i&&(i.entrySize=s,i.totalCalculatedSize=this.#f)}}#j=e=>{};#M=(e,t,s)=>{};#W=(e,t,s,i)=>{if(s||i)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#F({allowStale:e=this.allowStale}={}){if(this.#a)for(let t=this.#g;this.#H(t)&&((e||!this.#k(t))&&(yield t),t!==this.#p);)t=this.#x[t]}*#$({allowStale:e=this.allowStale}={}){if(this.#a)for(let t=this.#p;this.#H(t)&&((e||!this.#k(t))&&(yield t),t!==this.#g);)t=this.#b[t]}#H(e){return e!==void 0&&this.#h.get(this.#c[e])===e}*entries(){for(let e of this.#F())this.#r[e]!==void 0&&this.#c[e]!==void 0&&!this.#l(this.#r[e])&&(yield[this.#c[e],this.#r[e]])}*rentries(){for(let e of this.#$())this.#r[e]!==void 0&&this.#c[e]!==void 0&&!this.#l(this.#r[e])&&(yield[this.#c[e],this.#r[e]])}*keys(){for(let e of this.#F()){let t=this.#c[e];t!==void 0&&!this.#l(this.#r[e])&&(yield t)}}*rkeys(){for(let e of this.#$()){let t=this.#c[e];t!==void 0&&!this.#l(this.#r[e])&&(yield t)}}*values(){for(let e of this.#F())this.#r[e]!==void 0&&!this.#l(this.#r[e])&&(yield this.#r[e])}*rvalues(){for(let e of this.#$())this.#r[e]!==void 0&&!this.#l(this.#r[e])&&(yield this.#r[e])}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(e,t={}){for(let s of this.#F()){let i=this.#r[s],r=this.#l(i)?i.__staleWhileFetching:i;if(r!==void 0&&e(r,this.#c[s],this))return this.#G(this.#c[s],t)}}forEach(e,t=this){for(let s of this.#F()){let i=this.#r[s],r=this.#l(i)?i.__staleWhileFetching:i;r!==void 0&&e.call(t,r,this.#c[s],this)}}rforEach(e,t=this){for(let s of this.#$()){let i=this.#r[s],r=this.#l(i)?i.__staleWhileFetching:i;r!==void 0&&e.call(t,r,this.#c[s],this)}}purgeStale(){let e=!1;for(let t of this.#$({allowStale:!0}))this.#k(t)&&(this.#L(this.#c[t],"expire"),e=!0);return e}info(e){let t=this.#h.get(e);if(t===void 0)return;let s=this.#r[t],i=this.#l(s)?s.__staleWhileFetching:s;if(i===void 0)return;let r={value:i};if(this.#d&&this.#C){let o=this.#d[t],a=this.#C[t];if(o&&a){let l=o-(this.#u.now()-a);r.ttl=l,r.start=Date.now()}}return this.#S&&(r.size=this.#S[t]),r}dump(){let e=[];for(let t of this.#F({allowStale:!0})){let s=this.#c[t],i=this.#r[t],r=this.#l(i)?i.__staleWhileFetching:i;if(r===void 0||s===void 0)continue;let o={value:r};if(this.#d&&this.#C){o.ttl=this.#d[t];let a=this.#u.now()-this.#C[t];o.start=Math.floor(Date.now()-a)}this.#S&&(o.size=this.#S[t]),e.unshift([s,o])}return e}load(e){this.clear();for(let[t,s]of e){if(s.start){let i=Date.now()-s.start;s.start=this.#u.now()-i}this.#D(t,s.value,s)}}set(e,t,s={}){let{status:i=B.hasSubscribers?{}:void 0}=s;s.status=i,i&&(i.op="set",i.key=e,t!==void 0&&(i.value=t),i.cache=this);let r=this.#D(e,t,s);return i&&B.hasSubscribers&&B.publish(i),r}#D(e,t,s,i){let{ttl:r=this.ttl,start:o,noDisposeOnSet:a=this.noDisposeOnSet,sizeCalculation:l=this.sizeCalculation,status:c}=s,h=this.#l(t);if(t===void 0)return c&&(c.set="deleted"),this.delete(e),this;let{noUpdateTTL:u=this.noUpdateTTL}=s;c&&!h&&(c.value=t);let f=this.#W(e,t,s.size||0,l,c);if(this.maxEntrySize&&f>this.maxEntrySize)return this.#L(e,"set"),c&&(c.set="miss",c.maxEntrySizeExceeded=!0),this;let d=this.#a===0?void 0:this.#h.get(e);if(d===void 0)d=this.#a===0?this.#g:this.#E.length!==0?this.#E.pop():this.#a===this.#e?this.#q(!1):this.#a,this.#c[d]=e,this.#r[d]=t,this.#h.set(e,d),this.#b[this.#g]=d,this.#x[d]=this.#g,this.#g=d,this.#a++,this.#M(d,f,c),c&&(c.set="add"),u=!1,this.#R&&!h&&this.#t?.(t,e,"add");else{this.#Y(d);let g=this.#r[d];if(t!==g){if(!a)if(this.#l(g)){g!==i&&g.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:p}=g;p!==void 0&&p!==t&&(this.#v&&this.#n?.(p,e,"set"),this.#s&&this.#m?.push([p,e,"set"]))}else this.#v&&this.#n?.(g,e,"set"),this.#s&&this.#m?.push([g,e,"set"]);if(this.#j(d),this.#M(d,f,c),this.#r[d]=t,!h){let p=g&&this.#l(g)?g.__staleWhileFetching:g,y=p===void 0?"add":t!==p?"replace":"update";c&&(c.set=y,p!==void 0&&(c.oldValue=p)),this.#R&&this.onInsert?.(t,e,y)}}else h||(c&&(c.set="update"),this.#R&&this.onInsert?.(t,e,"update"))}if(r!==0&&!this.#d&&this.#P(),this.#d&&(u||this.#N(d,r,o),c&&this.#T(c,d)),!a&&this.#s&&this.#m){let g=this.#m,p;for(;p=g?.shift();)this.#o?.(...p)}return this}pop(){try{for(;this.#a;){let e=this.#r[this.#p];if(this.#q(!0),this.#l(e)){if(e.__staleWhileFetching)return e.__staleWhileFetching}else if(e!==void 0)return e}}finally{if(this.#s&&this.#m){let e=this.#m,t;for(;t=e?.shift();)this.#o?.(...t)}}}#q(e){let t=this.#p,s=this.#c[t],i=this.#r[t],r=this.#l(i);r&&i.__abortController.abort(new Error("evicted"));let o=r?i.__staleWhileFetching:i;return(this.#v||this.#s)&&o!==void 0&&(this.#v&&this.#n?.(o,s,"evict"),this.#s&&this.#m?.push([o,s,"evict"])),this.#j(t),this.#y?.[t]&&(clearTimeout(this.#y[t]),this.#y[t]=void 0),e&&(this.#c[t]=void 0,this.#r[t]=void 0,this.#E.push(t)),this.#a===1?(this.#p=this.#g=0,this.#E.length=0):this.#p=this.#b[t],this.#h.delete(s),this.#a--,t}has(e,t={}){let{status:s=B.hasSubscribers?{}:void 0}=t;t.status=s,s&&(s.op="has",s.key=e,s.cache=this);let i=this.#J(e,t);return B.hasSubscribers&&B.publish(s),i}#J(e,t={}){let{updateAgeOnHas:s=this.updateAgeOnHas,status:i}=t,r=this.#h.get(e);if(r!==void 0){let o=this.#r[r];if(this.#l(o)&&o.__staleWhileFetching===void 0)return!1;if(this.#k(r))i&&(i.has="stale",this.#T(i,r));else return s&&this.#O(r),i&&(i.has="hit",this.#T(i,r)),!0}else i&&(i.has="miss");return!1}peek(e,t={}){let{status:s=Ni()?{}:void 0}=t;s&&(s.op="peek",s.key=e,s.cache=this),t.status=s;let i=this.#U(e,t);return B.hasSubscribers&&B.publish(s),i}#U(e,t){let{status:s,allowStale:i=this.allowStale}=t,r=this.#h.get(e);if(r===void 0||!i&&this.#k(r)){s&&(s.peek=r===void 0?"miss":"stale");return}let o=this.#r[r],a=this.#l(o)?o.__staleWhileFetching:o;return s&&(a!==void 0?(s.peek="hit",s.value=a):s.peek="miss"),a}#I(e,t,s,i){let r=t===void 0?void 0:this.#r[t];if(this.#l(r))return r;let o=new AbortController,{signal:a}=s;a?.addEventListener("abort",()=>o.abort(a.reason),{signal:o.signal});let l={signal:o.signal,options:s,context:i},c=(p,y=!1)=>{let{aborted:m}=o.signal,x=s.ignoreFetchAbort&&p!==void 0,_=s.ignoreFetchAbort||!!(s.allowStaleOnFetchAbort&&p!==void 0);if(s.status&&(m&&!y?(s.status.fetchAborted=!0,s.status.fetchError=o.signal.reason,x&&(s.status.fetchAbortIgnored=!0)):s.status.fetchResolved=!0),m&&!x&&!y)return u(o.signal.reason,_);let b=d,w=this.#r[t];return(w===d||w===void 0&&x&&y)&&(p===void 0?b.__staleWhileFetching!==void 0?this.#r[t]=b.__staleWhileFetching:this.#L(e,"fetch"):(s.status&&(s.status.fetchUpdated=!0),this.#D(e,p,l.options,b))),p},h=p=>(s.status&&(s.status.fetchRejected=!0,s.status.fetchError=p),u(p,!1)),u=(p,y)=>{let{aborted:m}=o.signal,x=m&&s.allowStaleOnFetchAbort,_=x||s.allowStaleOnFetchRejection,b=_||s.noDeleteOnFetchRejection,w=d;if(this.#r[t]===d&&(!b||!y&&w.__staleWhileFetching===void 0?this.#L(e,"fetch"):x||(this.#r[t]=w.__staleWhileFetching)),_)return s.status&&w.__staleWhileFetching!==void 0&&(s.status.returnedStale=!0),w.__staleWhileFetching;if(w.__returned===w)throw p},f=(p,y)=>{let m=this.#_?.(e,r,l);o.signal.addEventListener("abort",()=>{(!s.ignoreFetchAbort||s.allowStaleOnFetchAbort)&&(p(void 0),s.allowStaleOnFetchAbort&&(p=x=>c(x,!0)))}),m&&m instanceof Promise?m.then(x=>p(x===void 0?void 0:x),y):m!==void 0&&p(m)};s.status&&(s.status.fetchDispatched=!0);let d=new Promise(f).then(c,h),g=Object.assign(d,{__abortController:o,__staleWhileFetching:r,__returned:void 0});return t===void 0?(this.#D(e,g,{...l.options,status:void 0}),t=this.#h.get(e)):this.#r[t]=g,g}#l(e){if(!this.#A)return!1;let t=e;return!!t&&t instanceof Promise&&t.hasOwnProperty("__staleWhileFetching")&&t.__abortController instanceof AbortController}fetch(e,t={}){let s=Rt.hasSubscribers,{status:i=Ni()?{}:void 0}=t;t.status=i,i&&t.context&&(i.context=t.context);let r=this.#z(e,t);return i&&s&&(i.trace=!0,Rt.tracePromise(()=>r,i).catch(()=>{})),r}async#z(e,t={}){let{allowStale:s=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:r=this.noDeleteOnStaleGet,ttl:o=this.ttl,noDisposeOnSet:a=this.noDisposeOnSet,size:l=0,sizeCalculation:c=this.sizeCalculation,noUpdateTTL:h=this.noUpdateTTL,noDeleteOnFetchRejection:u=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:f=this.allowStaleOnFetchRejection,ignoreFetchAbort:d=this.ignoreFetchAbort,allowStaleOnFetchAbort:g=this.allowStaleOnFetchAbort,context:p,forceRefresh:y=!1,status:m,signal:x}=t;if(m&&(m.op="fetch",m.key=e,y&&(m.forceRefresh=!0),m.cache=this),!this.#A)return m&&(m.fetch="get"),this.#G(e,{allowStale:s,updateAgeOnGet:i,noDeleteOnStaleGet:r,status:m});let _={allowStale:s,updateAgeOnGet:i,noDeleteOnStaleGet:r,ttl:o,noDisposeOnSet:a,size:l,sizeCalculation:c,noUpdateTTL:h,noDeleteOnFetchRejection:u,allowStaleOnFetchRejection:f,allowStaleOnFetchAbort:g,ignoreFetchAbort:d,status:m,signal:x},b=this.#h.get(e);if(b===void 0){m&&(m.fetch="miss");let w=this.#I(e,b,_,p);return w.__returned=w}else{let w=this.#r[b];if(this.#l(w)){let J=s&&w.__staleWhileFetching!==void 0;return m&&(m.fetch="inflight",J&&(m.returnedStale=!0)),J?w.__staleWhileFetching:w.__returned=w}let T=this.#k(b);if(!y&&!T)return m&&(m.fetch="hit"),this.#Y(b),i&&this.#O(b),m&&this.#T(m,b),w;let ee=this.#I(e,b,_,p),Ee=ee.__staleWhileFetching!==void 0&&s;return m&&(m.fetch=T?"stale":"refresh",Ee&&T&&(m.returnedStale=!0)),Ee?ee.__staleWhileFetching:ee.__returned=ee}}forceFetch(e,t={}){let s=Rt.hasSubscribers,{status:i=Ni()?{}:void 0}=t;t.status=i,i&&t.context&&(i.context=t.context);let r=this.#V(e,t);return i&&s&&(i.trace=!0,Rt.tracePromise(()=>r,i).catch(()=>{})),r}async#V(e,t={}){let s=await this.#z(e,t);if(s===void 0)throw new Error("fetch() returned undefined");return s}memo(e,t={}){let{status:s=B.hasSubscribers?{}:void 0}=t;t.status=s,s&&(s.op="memo",s.key=e,t.context&&(s.context=t.context),s.cache=this);let i=this.#Q(e,t);return s&&(s.value=i),B.hasSubscribers&&B.publish(s),i}#Q(e,t={}){let s=this.#w;if(!s)throw new Error("no memoMethod provided to constructor");let{context:i,status:r,forceRefresh:o,...a}=t;r&&o&&(r.forceRefresh=!0);let l=this.#G(e,a),c=o||l===void 0;if(r&&(r.memo=c?"miss":"hit",c||(r.value=l)),!c)return l;let h=s(e,l,{options:a,context:i});return r&&(r.value=h),this.#D(e,h,a),h}get(e,t={}){let{status:s=B.hasSubscribers?{}:void 0}=t;t.status=s,s&&(s.op="get",s.key=e,s.cache=this);let i=this.#G(e,t);return s&&(i!==void 0&&(s.value=i),B.hasSubscribers&&B.publish(s)),i}#G(e,t={}){let{allowStale:s=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:r=this.noDeleteOnStaleGet,status:o}=t,a=this.#h.get(e);if(a===void 0){o&&(o.get="miss");return}let l=this.#r[a],c=this.#l(l);return o&&this.#T(o,a),this.#k(a)?c?(o&&(o.get="stale-fetching"),s&&l.__staleWhileFetching!==void 0?(o&&(o.returnedStale=!0),l.__staleWhileFetching):void 0):(r||this.#L(e,"expire"),o&&(o.get="stale"),s?(o&&(o.returnedStale=!0),l):void 0):(o&&(o.get=c?"fetching":"hit"),this.#Y(a),i&&this.#O(a),c?l.__staleWhileFetching:l)}#K(e,t){this.#x[t]=e,this.#b[e]=t}#Y(e){e!==this.#g&&(e===this.#p?this.#p=this.#b[e]:this.#K(this.#x[e],this.#b[e]),this.#K(this.#g,e),this.#g=e)}delete(e){return this.#L(e,"delete")}#L(e,t){B.hasSubscribers&&B.publish({op:"delete",delete:t,key:e,cache:this});let s=!1;if(this.#a!==0){let i=this.#h.get(e);if(i!==void 0)if(this.#y?.[i]&&(clearTimeout(this.#y?.[i]),this.#y[i]=void 0),s=!0,this.#a===1)this.#X(t);else{this.#j(i);let r=this.#r[i];if(this.#l(r)?r.__abortController.abort(new Error("deleted")):(this.#v||this.#s)&&(this.#v&&this.#n?.(r,e,t),this.#s&&this.#m?.push([r,e,t])),this.#h.delete(e),this.#c[i]=void 0,this.#r[i]=void 0,i===this.#g)this.#g=this.#x[i];else if(i===this.#p)this.#p=this.#b[i];else{let o=this.#x[i];this.#b[o]=this.#b[i];let a=this.#b[i];this.#x[a]=this.#x[i]}this.#a--,this.#E.push(i)}}if(this.#s&&this.#m?.length){let i=this.#m,r;for(;r=i?.shift();)this.#o?.(...r)}return s}clear(){return this.#X("delete")}#X(e){for(let t of this.#$({allowStale:!0})){let s=this.#r[t];if(this.#l(s))s.__abortController.abort(new Error("deleted"));else{let i=this.#c[t];this.#v&&this.#n?.(s,i,e),this.#s&&this.#m?.push([s,i,e])}}if(this.#h.clear(),this.#r.fill(void 0),this.#c.fill(void 0),this.#d&&this.#C){this.#d.fill(0),this.#C.fill(0);for(let t of this.#y??[])t!==void 0&&clearTimeout(t);this.#y?.fill(void 0)}if(this.#S&&this.#S.fill(0),this.#p=0,this.#g=0,this.#E.length=0,this.#f=0,this.#a=0,this.#s&&this.#m){let t=this.#m,s;for(;s=t?.shift();)this.#o?.(...s)}}};var ft=require("node:path"),To=require("node:url"),ke=require("fs"),Sh=C(require("node:fs"),1),He=require("node:fs/promises");var _s=require("node:events"),zi=C(require("node:stream"),1),Ao=require("node:string_decoder"),Co=typeof process=="object"&&process?process:{stdout:null,stderr:null},dh=n=>!!n&&typeof n=="object"&&(n instanceof We||n instanceof zi.default||ph(n)||gh(n)),ph=n=>!!n&&typeof n=="object"&&n instanceof _s.EventEmitter&&typeof n.pipe=="function"&&n.pipe!==zi.default.Writable.prototype.pipe,gh=n=>!!n&&typeof n=="object"&&n instanceof _s.EventEmitter&&typeof n.write=="function"&&typeof n.end=="function",Pe=Symbol("EOF"),Te=Symbol("maybeEmitEnd"),Ne=Symbol("emittedEnd"),ys=Symbol("emittingEnd"),Mt=Symbol("emittedError"),ws=Symbol("closed"),ko=Symbol("read"),bs=Symbol("flush"),Eo=Symbol("flushChunk"),we=Symbol("encoding"),ht=Symbol("decoder"),W=Symbol("flowing"),jt=Symbol("paused"),ut=Symbol("resume"),H=Symbol("buffer"),Q=Symbol("pipes"),V=Symbol("bufferLength"),Wi=Symbol("bufferPush"),vs=Symbol("bufferShift"),G=Symbol("objectMode"),P=Symbol("destroyed"),Hi=Symbol("error"),Vi=Symbol("emitData"),Oo=Symbol("emitEnd"),qi=Symbol("emitEnd2"),_e=Symbol("async"),Bi=Symbol("abort"),xs=Symbol("aborted"),Dt=Symbol("signal"),Je=Symbol("dataListeners"),ae=Symbol("discarded"),It=n=>Promise.resolve().then(n),mh=n=>n(),yh=n=>n==="end"||n==="finish"||n==="prefinish",wh=n=>n instanceof ArrayBuffer||!!n&&typeof n=="object"&&n.constructor&&n.constructor.name==="ArrayBuffer"&&n.byteLength>=0,bh=n=>!Buffer.isBuffer(n)&&ArrayBuffer.isView(n),Ss=class{src;dest;opts;ondrain;constructor(e,t,s){this.src=e,this.dest=t,this.opts=s,this.ondrain=()=>e[ut](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(e){}end(){this.unpipe(),this.opts.end&&this.dest.end()}},Ui=class extends Ss{unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(e,t,s){super(e,t,s),this.proxyErrors=i=>this.dest.emit("error",i),e.on("error",this.proxyErrors)}},vh=n=>!!n.objectMode,xh=n=>!n.objectMode&&!!n.encoding&&n.encoding!=="buffer",We=class extends _s.EventEmitter{[W]=!1;[jt]=!1;[Q]=[];[H]=[];[G];[we];[_e];[ht];[Pe]=!1;[Ne]=!1;[ys]=!1;[ws]=!1;[Mt]=null;[V]=0;[P]=!1;[Dt];[xs]=!1;[Je]=0;[ae]=!1;writable=!0;readable=!0;constructor(...e){let t=e[0]||{};if(super(),t.objectMode&&typeof t.encoding=="string")throw new TypeError("Encoding and objectMode may not be used together");vh(t)?(this[G]=!0,this[we]=null):xh(t)?(this[we]=t.encoding,this[G]=!1):(this[G]=!1,this[we]=null),this[_e]=!!t.async,this[ht]=this[we]?new Ao.StringDecoder(this[we]):null,t&&t.debugExposeBuffer===!0&&Object.defineProperty(this,"buffer",{get:()=>this[H]}),t&&t.debugExposePipes===!0&&Object.defineProperty(this,"pipes",{get:()=>this[Q]});let{signal:s}=t;s&&(this[Dt]=s,s.aborted?this[Bi]():s.addEventListener("abort",()=>this[Bi]()))}get bufferLength(){return this[V]}get encoding(){return this[we]}set encoding(e){throw new Error("Encoding must be set at instantiation time")}setEncoding(e){throw new Error("Encoding must be set at instantiation time")}get objectMode(){return this[G]}set objectMode(e){throw new Error("objectMode must be set at instantiation time")}get async(){return this[_e]}set async(e){this[_e]=this[_e]||!!e}[Bi](){this[xs]=!0,this.emit("abort",this[Dt]?.reason),this.destroy(this[Dt]?.reason)}get aborted(){return this[xs]}set aborted(e){}write(e,t,s){if(this[xs])return!1;if(this[Pe])throw new Error("write after end");if(this[P])return this.emit("error",Object.assign(new Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;typeof t=="function"&&(s=t,t="utf8"),t||(t="utf8");let i=this[_e]?It:mh;if(!this[G]&&!Buffer.isBuffer(e)){if(bh(e))e=Buffer.from(e.buffer,e.byteOffset,e.byteLength);else if(wh(e))e=Buffer.from(e);else if(typeof e!="string")throw new Error("Non-contiguous data written to non-objectMode stream")}return this[G]?(this[W]&&this[V]!==0&&this[bs](!0),this[W]?this.emit("data",e):this[Wi](e),this[V]!==0&&this.emit("readable"),s&&i(s),this[W]):e.length?(typeof e=="string"&&!(t===this[we]&&!this[ht]?.lastNeed)&&(e=Buffer.from(e,t)),Buffer.isBuffer(e)&&this[we]&&(e=this[ht].write(e)),this[W]&&this[V]!==0&&this[bs](!0),this[W]?this.emit("data",e):this[Wi](e),this[V]!==0&&this.emit("readable"),s&&i(s),this[W]):(this[V]!==0&&this.emit("readable"),s&&i(s),this[W])}read(e){if(this[P])return null;if(this[ae]=!1,this[V]===0||e===0||e&&e>this[V])return this[Te](),null;this[G]&&(e=null),this[H].length>1&&!this[G]&&(this[H]=[this[we]?this[H].join(""):Buffer.concat(this[H],this[V])]);let t=this[ko](e||null,this[H][0]);return this[Te](),t}[ko](e,t){if(this[G])this[vs]();else{let s=t;e===s.length||e===null?this[vs]():typeof s=="string"?(this[H][0]=s.slice(e),t=s.slice(0,e),this[V]-=e):(this[H][0]=s.subarray(e),t=s.subarray(0,e),this[V]-=e)}return this.emit("data",t),!this[H].length&&!this[Pe]&&this.emit("drain"),t}end(e,t,s){return typeof e=="function"&&(s=e,e=void 0),typeof t=="function"&&(s=t,t="utf8"),e!==void 0&&this.write(e,t),s&&this.once("end",s),this[Pe]=!0,this.writable=!1,(this[W]||!this[jt])&&this[Te](),this}[ut](){this[P]||(!this[Je]&&!this[Q].length&&(this[ae]=!0),this[jt]=!1,this[W]=!0,this.emit("resume"),this[H].length?this[bs]():this[Pe]?this[Te]():this.emit("drain"))}resume(){return this[ut]()}pause(){this[W]=!1,this[jt]=!0,this[ae]=!1}get destroyed(){return this[P]}get flowing(){return this[W]}get paused(){return this[jt]}[Wi](e){this[G]?this[V]+=1:this[V]+=e.length,this[H].push(e)}[vs](){return this[G]?this[V]-=1:this[V]-=this[H][0].length,this[H].shift()}[bs](e=!1){do;while(this[Eo](this[vs]())&&this[H].length);!e&&!this[H].length&&!this[Pe]&&this.emit("drain")}[Eo](e){return this.emit("data",e),this[W]}pipe(e,t){if(this[P])return e;this[ae]=!1;let s=this[Ne];return t=t||{},e===Co.stdout||e===Co.stderr?t.end=!1:t.end=t.end!==!1,t.proxyErrors=!!t.proxyErrors,s?t.end&&e.end():(this[Q].push(t.proxyErrors?new Ui(this,e,t):new Ss(this,e,t)),this[_e]?It(()=>this[ut]()):this[ut]()),e}unpipe(e){let t=this[Q].find(s=>s.dest===e);t&&(this[Q].length===1?(this[W]&&this[Je]===0&&(this[W]=!1),this[Q]=[]):this[Q].splice(this[Q].indexOf(t),1),t.unpipe())}addListener(e,t){return this.on(e,t)}on(e,t){let s=super.on(e,t);if(e==="data")this[ae]=!1,this[Je]++,!this[Q].length&&!this[W]&&this[ut]();else if(e==="readable"&&this[V]!==0)super.emit("readable");else if(yh(e)&&this[Ne])super.emit(e),this.removeAllListeners(e);else if(e==="error"&&this[Mt]){let i=t;this[_e]?It(()=>i.call(this,this[Mt])):i.call(this,this[Mt])}return s}removeListener(e,t){return this.off(e,t)}off(e,t){let s=super.off(e,t);return e==="data"&&(this[Je]=this.listeners("data").length,this[Je]===0&&!this[ae]&&!this[Q].length&&(this[W]=!1)),s}removeAllListeners(e){let t=super.removeAllListeners(e);return(e==="data"||e===void 0)&&(this[Je]=0,!this[ae]&&!this[Q].length&&(this[W]=!1)),t}get emittedEnd(){return this[Ne]}[Te](){!this[ys]&&!this[Ne]&&!this[P]&&this[H].length===0&&this[Pe]&&(this[ys]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[ws]&&this.emit("close"),this[ys]=!1)}emit(e,...t){let s=t[0];if(e!=="error"&&e!=="close"&&e!==P&&this[P])return!1;if(e==="data")return!this[G]&&!s?!1:this[_e]?(It(()=>this[Vi](s)),!0):this[Vi](s);if(e==="end")return this[Oo]();if(e==="close"){if(this[ws]=!0,!this[Ne]&&!this[P])return!1;let r=super.emit("close");return this.removeAllListeners("close"),r}else if(e==="error"){this[Mt]=s,super.emit(Hi,s);let r=!this[Dt]||this.listeners("error").length?super.emit("error",s):!1;return this[Te](),r}else if(e==="resume"){let r=super.emit("resume");return this[Te](),r}else if(e==="finish"||e==="prefinish"){let r=super.emit(e);return this.removeAllListeners(e),r}let i=super.emit(e,...t);return this[Te](),i}[Vi](e){for(let s of this[Q])s.dest.write(e)===!1&&this.pause();let t=this[ae]?!1:super.emit("data",e);return this[Te](),t}[Oo](){return this[Ne]?!1:(this[Ne]=!0,this.readable=!1,this[_e]?(It(()=>this[qi]()),!0):this[qi]())}[qi](){if(this[ht]){let t=this[ht].end();if(t){for(let s of this[Q])s.dest.write(t);this[ae]||super.emit("data",t)}}for(let t of this[Q])t.end();let e=super.emit("end");return this.removeAllListeners("end"),e}async collect(){let e=Object.assign([],{dataLength:0});this[G]||(e.dataLength=0);let t=this.promise();return this.on("data",s=>{e.push(s),this[G]||(e.dataLength+=s.length)}),await t,e}async concat(){if(this[G])throw new Error("cannot concat in objectMode");let e=await this.collect();return this[we]?e.join(""):Buffer.concat(e,e.dataLength)}async promise(){return new Promise((e,t)=>{this.on(P,()=>t(new Error("stream destroyed"))),this.on("error",s=>t(s)),this.on("end",()=>e())})}[Symbol.asyncIterator](){this[ae]=!1;let e=!1,t=async()=>(this.pause(),e=!0,{value:void 0,done:!0});return{next:()=>{if(e)return t();let i=this.read();if(i!==null)return Promise.resolve({done:!1,value:i});if(this[Pe])return t();let r,o,a=u=>{this.off("data",l),this.off("end",c),this.off(P,h),t(),o(u)},l=u=>{this.off("error",a),this.off("end",c),this.off(P,h),this.pause(),r({value:u,done:!!this[Pe]})},c=()=>{this.off("error",a),this.off("data",l),this.off(P,h),t(),r({done:!0,value:void 0})},h=()=>a(new Error("stream destroyed"));return new Promise((u,f)=>{o=f,r=u,this.once(P,h),this.once("error",a),this.once("end",c),this.once("data",l)})},throw:t,return:t,[Symbol.asyncIterator](){return this},[Symbol.asyncDispose]:async()=>{}}}[Symbol.iterator](){this[ae]=!1;let e=!1,t=()=>(this.pause(),this.off(Hi,t),this.off(P,t),this.off("end",t),e=!0,{done:!0,value:void 0}),s=()=>{if(e)return t();let i=this.read();return i===null?t():{done:!1,value:i}};return this.once("end",t),this.once(Hi,t),this.once(P,t),{next:s,throw:t,return:t,[Symbol.iterator](){return this},[Symbol.dispose]:()=>{}}}destroy(e){if(this[P])return e?this.emit("error",e):this.emit(P),this;this[P]=!0,this[ae]=!0,this[H].length=0,this[V]=0;let t=this;return typeof t.close=="function"&&!this[ws]&&t.close(),e?this.emit("error",e):this.emit(P),this}static get isStream(){return dh}};var _h=ke.realpathSync.native,Nt={lstatSync:ke.lstatSync,readdir:ke.readdir,readdirSync:ke.readdirSync,readlinkSync:ke.readlinkSync,realpathSync:_h,promises:{lstat:He.lstat,readdir:He.readdir,readlink:He.readlink,realpath:He.realpath}},Mo=n=>!n||n===Nt||n===Sh?Nt:{...Nt,...n,promises:{...Nt.promises,...n.promises||{}}},jo=/^\\\\\?\\([a-z]:)\\?$/i,Ch=n=>n.replace(/\//g,"\\").replace(jo,"$1\\"),kh=/[\\\/]/,de=0,Do=1,Io=2,Ce=4,Lo=6,No=8,Ke=10,Wo=12,fe=15,Lt=~fe,Gi=16,Fo=32,Wt=64,be=128,Cs=256,Es=512,$o=Wt|be|Es,Eh=1023,Yi=n=>n.isFile()?No:n.isDirectory()?Ce:n.isSymbolicLink()?Ke:n.isCharacterDevice()?Io:n.isBlockDevice()?Lo:n.isSocket()?Wo:n.isFIFO()?Do:de,Ro=new Tt({max:2**12}),Ht=n=>{let e=Ro.get(n);if(e)return e;let t=n.normalize("NFKD");return Ro.set(n,t),t},Po=new Tt({max:2**12}),ks=n=>{let e=Po.get(n);if(e)return e;let t=Ht(n.toLowerCase());return Po.set(n,t),t},Os=class extends Tt{constructor(){super({max:256})}},Ji=class extends Tt{constructor(e=16*1024){super({maxSize:e,sizeCalculation:t=>t.length+1})}},Ho=Symbol("PathScurry setAsCwd"),Y=class{name;root;roots;parent;nocase;isCWD=!1;#e;#i;get dev(){return this.#i}#n;get mode(){return this.#n}#t;get nlink(){return this.#t}#o;get uid(){return this.#o}#_;get gid(){return this.#_}#w;get rdev(){return this.#w}#u;get blksize(){return this.#u}#a;get ino(){return this.#a}#f;get size(){return this.#f}#h;get blocks(){return this.#h}#c;get atimeMs(){return this.#c}#r;get mtimeMs(){return this.#r}#b;get ctimeMs(){return this.#b}#x;get birthtimeMs(){return this.#x}#p;get atime(){return this.#p}#g;get mtime(){return this.#g}#E;get ctime(){return this.#E}#m;get birthtime(){return this.#m}#S;#C;#d;#y;#v;#A;#s;#R;#P;#O;get parentPath(){return(this.parent||this).fullpath()}get path(){return this.parentPath}constructor(e,t=de,s,i,r,o,a){this.name=e,this.#S=r?ks(e):Ht(e),this.#s=t&Eh,this.nocase=r,this.roots=i,this.root=s||this,this.#R=o,this.#d=a.fullpath,this.#v=a.relative,this.#A=a.relativePosix,this.parent=a.parent,this.parent?this.#e=this.parent.#e:this.#e=Mo(a.fs)}depth(){return this.#C!==void 0?this.#C:this.parent?this.#C=this.parent.depth()+1:this.#C=0}childrenCache(){return this.#R}resolve(e){if(!e)return this;let t=this.getRootString(e),i=e.substring(t.length).split(this.splitSep);return t?this.getRoot(t).#T(i):this.#T(i)}#T(e){let t=this;for(let s of e)t=t.child(s);return t}children(){let e=this.#R.get(this);if(e)return e;let t=Object.assign([],{provisional:0});return this.#R.set(this,t),this.#s&=~Gi,t}child(e,t){if(e===""||e===".")return this;if(e==="..")return this.parent||this;let s=this.children(),i=this.nocase?ks(e):Ht(e);for(let l of s)if(l.#S===i)return l;let r=this.parent?this.sep:"",o=this.#d?this.#d+r+e:void 0,a=this.newChild(e,de,{...t,parent:this,fullpath:o});return this.canReaddir()||(a.#s|=be),s.push(a),a}relative(){if(this.isCWD)return"";if(this.#v!==void 0)return this.#v;let e=this.name,t=this.parent;if(!t)return this.#v=this.name;let s=t.relative();return s+(!s||!t.parent?"":this.sep)+e}relativePosix(){if(this.sep==="/")return this.relative();if(this.isCWD)return"";if(this.#A!==void 0)return this.#A;let e=this.name,t=this.parent;if(!t)return this.#A=this.fullpathPosix();let s=t.relativePosix();return s+(!s||!t.parent?"":"/")+e}fullpath(){if(this.#d!==void 0)return this.#d;let e=this.name,t=this.parent;if(!t)return this.#d=this.name;let i=t.fullpath()+(t.parent?this.sep:"")+e;return this.#d=i}fullpathPosix(){if(this.#y!==void 0)return this.#y;if(this.sep==="/")return this.#y=this.fullpath();if(!this.parent){let i=this.fullpath().replace(/\\/g,"/");return/^[a-z]:\//i.test(i)?this.#y=`//?/${i}`:this.#y=i}let e=this.parent,t=e.fullpathPosix(),s=t+(!t||!e.parent?"":"/")+this.name;return this.#y=s}isUnknown(){return(this.#s&fe)===de}isType(e){return this[`is${e}`]()}getType(){return this.isUnknown()?"Unknown":this.isDirectory()?"Directory":this.isFile()?"File":this.isSymbolicLink()?"SymbolicLink":this.isFIFO()?"FIFO":this.isCharacterDevice()?"CharacterDevice":this.isBlockDevice()?"BlockDevice":this.isSocket()?"Socket":"Unknown"}isFile(){return(this.#s&fe)===No}isDirectory(){return(this.#s&fe)===Ce}isCharacterDevice(){return(this.#s&fe)===Io}isBlockDevice(){return(this.#s&fe)===Lo}isFIFO(){return(this.#s&fe)===Do}isSocket(){return(this.#s&fe)===Wo}isSymbolicLink(){return(this.#s&Ke)===Ke}lstatCached(){return this.#s&Fo?this:void 0}readlinkCached(){return this.#P}realpathCached(){return this.#O}readdirCached(){let e=this.children();return e.slice(0,e.provisional)}canReadlink(){if(this.#P)return!0;if(!this.parent)return!1;let e=this.#s&fe;return!(e!==de&&e!==Ke||this.#s&Cs||this.#s&be)}calledReaddir(){return!!(this.#s&Gi)}isENOENT(){return!!(this.#s&be)}isNamed(e){return this.nocase?this.#S===ks(e):this.#S===Ht(e)}async readlink(){let e=this.#P;if(e)return e;if(this.canReadlink()&&this.parent)try{let t=await this.#e.promises.readlink(this.fullpath()),s=(await this.parent.realpath())?.resolve(t);if(s)return this.#P=s}catch(t){this.#$(t.code);return}}readlinkSync(){let e=this.#P;if(e)return e;if(this.canReadlink()&&this.parent)try{let t=this.#e.readlinkSync(this.fullpath()),s=this.parent.realpathSync()?.resolve(t);if(s)return this.#P=s}catch(t){this.#$(t.code);return}}#N(e){this.#s|=Gi;for(let t=e.provisional;t<e.length;t++){let s=e[t];s&&s.#k()}}#k(){this.#s&be||(this.#s=(this.#s|be)&Lt,this.#B())}#B(){let e=this.children();e.provisional=0;for(let t of e)t.#k()}#j(){this.#s|=Es,this.#M()}#M(){if(this.#s&Wt)return;let e=this.#s;(e&fe)===Ce&&(e&=Lt),this.#s=e|Wt,this.#B()}#W(e=""){e==="ENOTDIR"||e==="EPERM"?this.#M():e==="ENOENT"?this.#k():this.children().provisional=0}#F(e=""){e==="ENOTDIR"?this.parent.#M():e==="ENOENT"&&this.#k()}#$(e=""){let t=this.#s;t|=Cs,e==="ENOENT"&&(t|=be),(e==="EINVAL"||e==="UNKNOWN")&&(t&=Lt),this.#s=t,e==="ENOTDIR"&&this.parent&&this.parent.#M()}#H(e,t){return this.#q(e,t)||this.#D(e,t)}#D(e,t){let s=Yi(e),i=this.newChild(e.name,s,{parent:this}),r=i.#s&fe;return r!==Ce&&r!==Ke&&r!==de&&(i.#s|=Wt),t.unshift(i),t.provisional++,i}#q(e,t){for(let s=t.provisional;s<t.length;s++){let i=t[s];if((this.nocase?ks(e.name):Ht(e.name))===i.#S)return this.#J(e,i,s,t)}}#J(e,t,s,i){let r=t.name;return t.#s=t.#s&Lt|Yi(e),r!==e.name&&(t.name=e.name),s!==i.provisional&&(s===i.length-1?i.pop():i.splice(s,1),i.unshift(t)),i.provisional++,t}async lstat(){if(!(this.#s&be))try{return this.#U(await this.#e.promises.lstat(this.fullpath())),this}catch(e){this.#F(e.code)}}lstatSync(){if(!(this.#s&be))try{return this.#U(this.#e.lstatSync(this.fullpath())),this}catch(e){this.#F(e.code)}}#U(e){let{atime:t,atimeMs:s,birthtime:i,birthtimeMs:r,blksize:o,blocks:a,ctime:l,ctimeMs:c,dev:h,gid:u,ino:f,mode:d,mtime:g,mtimeMs:p,nlink:y,rdev:m,size:x,uid:_}=e;this.#p=t,this.#c=s,this.#m=i,this.#x=r,this.#u=o,this.#h=a,this.#E=l,this.#b=c,this.#i=h,this.#_=u,this.#a=f,this.#n=d,this.#g=g,this.#r=p,this.#t=y,this.#w=m,this.#f=x,this.#o=_;let b=Yi(e);this.#s=this.#s&Lt|b|Fo,b!==de&&b!==Ce&&b!==Ke&&(this.#s|=Wt)}#I=[];#l=!1;#z(e){this.#l=!1;let t=this.#I.slice();this.#I.length=0,t.forEach(s=>s(null,e))}readdirCB(e,t=!1){if(!this.canReaddir()){t?e(null,[]):queueMicrotask(()=>e(null,[]));return}let s=this.children();if(this.calledReaddir()){let r=s.slice(0,s.provisional);t?e(null,r):queueMicrotask(()=>e(null,r));return}if(this.#I.push(e),this.#l)return;this.#l=!0;let i=this.fullpath();this.#e.readdir(i,{withFileTypes:!0},(r,o)=>{if(r)this.#W(r.code),s.provisional=0;else{for(let a of o)this.#H(a,s);this.#N(s)}this.#z(s.slice(0,s.provisional))})}#V;async readdir(){if(!this.canReaddir())return[];let e=this.children();if(this.calledReaddir())return e.slice(0,e.provisional);let t=this.fullpath();if(this.#V)await this.#V;else{let s=()=>{};this.#V=new Promise(i=>s=i);try{for(let i of await this.#e.promises.readdir(t,{withFileTypes:!0}))this.#H(i,e);this.#N(e)}catch(i){this.#W(i.code),e.provisional=0}this.#V=void 0,s()}return e.slice(0,e.provisional)}readdirSync(){if(!this.canReaddir())return[];let e=this.children();if(this.calledReaddir())return e.slice(0,e.provisional);let t=this.fullpath();try{for(let s of this.#e.readdirSync(t,{withFileTypes:!0}))this.#H(s,e);this.#N(e)}catch(s){this.#W(s.code),e.provisional=0}return e.slice(0,e.provisional)}canReaddir(){if(this.#s&$o)return!1;let e=fe&this.#s;return e===de||e===Ce||e===Ke}shouldWalk(e,t){return(this.#s&Ce)===Ce&&!(this.#s&$o)&&!e.has(this)&&(!t||t(this))}async realpath(){if(this.#O)return this.#O;if(!((Es|Cs|be)&this.#s))try{let e=await this.#e.promises.realpath(this.fullpath());return this.#O=this.resolve(e)}catch{this.#j()}}realpathSync(){if(this.#O)return this.#O;if(!((Es|Cs|be)&this.#s))try{let e=this.#e.realpathSync(this.fullpath());return this.#O=this.resolve(e)}catch{this.#j()}}[Ho](e){if(e===this)return;e.isCWD=!1,this.isCWD=!0;let t=new Set([]),s=[],i=this;for(;i&&i.parent;)t.add(i),i.#v=s.join(this.sep),i.#A=s.join("/"),i=i.parent,s.push("..");for(i=e;i&&i.parent&&!t.has(i);)i.#v=void 0,i.#A=void 0,i=i.parent}},As=class n extends Y{sep="\\";splitSep=kh;constructor(e,t=de,s,i,r,o,a){super(e,t,s,i,r,o,a)}newChild(e,t=de,s={}){return new n(e,t,this.root,this.roots,this.nocase,this.childrenCache(),s)}getRootString(e){return ft.win32.parse(e).root}getRoot(e){if(e=Ch(e.toUpperCase()),e===this.root.name)return this.root;for(let[t,s]of Object.entries(this.roots))if(this.sameRoot(e,t))return this.roots[e]=s;return this.roots[e]=new dt(e,this).root}sameRoot(e,t=this.root.name){return e=e.toUpperCase().replace(/\//g,"\\").replace(jo,"$1\\"),e===t}},Fs=class n extends Y{splitSep="/";sep="/";constructor(e,t=de,s,i,r,o,a){super(e,t,s,i,r,o,a)}getRootString(e){return e.startsWith("/")?"/":""}getRoot(e){return this.root}newChild(e,t=de,s={}){return new n(e,t,this.root,this.roots,this.nocase,this.childrenCache(),s)}},$s=class{root;rootPath;roots;cwd;#e;#i;#n;nocase;#t;constructor(e=process.cwd(),t,s,{nocase:i,childrenCacheSize:r=16*1024,fs:o=Nt}={}){this.#t=Mo(o),(e instanceof URL||e.startsWith("file://"))&&(e=(0,To.fileURLToPath)(e));let a=t.resolve(e);this.roots=Object.create(null),this.rootPath=this.parseRootPath(a),this.#e=new Os,this.#i=new Os,this.#n=new Ji(r);let l=a.substring(this.rootPath.length).split(s);if(l.length===1&&!l[0]&&l.pop(),i===void 0)throw new TypeError("must provide nocase setting to PathScurryBase ctor");this.nocase=i,this.root=this.newRoot(this.#t),this.roots[this.rootPath]=this.root;let c=this.root,h=l.length-1,u=t.sep,f=this.rootPath,d=!1;for(let g of l){let p=h--;c=c.child(g,{relative:new Array(p).fill("..").join(u),relativePosix:new Array(p).fill("..").join("/"),fullpath:f+=(d?"":u)+g}),d=!0}this.cwd=c}depth(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),e.depth()}childrenCache(){return this.#n}resolve(...e){let t="";for(let r=e.length-1;r>=0;r--){let o=e[r];if(!(!o||o===".")&&(t=t?`${o}/${t}`:o,this.isAbsolute(o)))break}let s=this.#e.get(t);if(s!==void 0)return s;let i=this.cwd.resolve(t).fullpath();return this.#e.set(t,i),i}resolvePosix(...e){let t="";for(let r=e.length-1;r>=0;r--){let o=e[r];if(!(!o||o===".")&&(t=t?`${o}/${t}`:o,this.isAbsolute(o)))break}let s=this.#i.get(t);if(s!==void 0)return s;let i=this.cwd.resolve(t).fullpathPosix();return this.#i.set(t,i),i}relative(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),e.relative()}relativePosix(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),e.relativePosix()}basename(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),e.name}dirname(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),(e.parent||e).fullpath()}async readdir(e=this.cwd,t={withFileTypes:!0}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof Y||(t=e,e=this.cwd);let{withFileTypes:s}=t;if(e.canReaddir()){let i=await e.readdir();return s?i:i.map(r=>r.name)}else return[]}readdirSync(e=this.cwd,t={withFileTypes:!0}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof Y||(t=e,e=this.cwd);let{withFileTypes:s=!0}=t;return e.canReaddir()?s?e.readdirSync():e.readdirSync().map(i=>i.name):[]}async lstat(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),e.lstat()}lstatSync(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),e.lstatSync()}async readlink(e=this.cwd,{withFileTypes:t}={withFileTypes:!1}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof Y||(t=e.withFileTypes,e=this.cwd);let s=await e.readlink();return t?s:s?.fullpath()}readlinkSync(e=this.cwd,{withFileTypes:t}={withFileTypes:!1}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof Y||(t=e.withFileTypes,e=this.cwd);let s=e.readlinkSync();return t?s:s?.fullpath()}async realpath(e=this.cwd,{withFileTypes:t}={withFileTypes:!1}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof Y||(t=e.withFileTypes,e=this.cwd);let s=await e.realpath();return t?s:s?.fullpath()}realpathSync(e=this.cwd,{withFileTypes:t}={withFileTypes:!1}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof Y||(t=e.withFileTypes,e=this.cwd);let s=e.realpathSync();return t?s:s?.fullpath()}async walk(e=this.cwd,t={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof Y||(t=e,e=this.cwd);let{withFileTypes:s=!0,follow:i=!1,filter:r,walkFilter:o}=t,a=[];(!r||r(e))&&a.push(s?e:e.fullpath());let l=new Set,c=(u,f)=>{l.add(u),u.readdirCB((d,g)=>{if(d)return f(d);let p=g.length;if(!p)return f();let y=()=>{--p===0&&f()};for(let m of g)(!r||r(m))&&a.push(s?m:m.fullpath()),i&&m.isSymbolicLink()?m.realpath().then(x=>x?.isUnknown()?x.lstat():x).then(x=>x?.shouldWalk(l,o)?c(x,y):y()):m.shouldWalk(l,o)?c(m,y):y()},!0)},h=e;return new Promise((u,f)=>{c(h,d=>{if(d)return f(d);u(a)})})}walkSync(e=this.cwd,t={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof Y||(t=e,e=this.cwd);let{withFileTypes:s=!0,follow:i=!1,filter:r,walkFilter:o}=t,a=[];(!r||r(e))&&a.push(s?e:e.fullpath());let l=new Set([e]);for(let c of l){let h=c.readdirSync();for(let u of h){(!r||r(u))&&a.push(s?u:u.fullpath());let f=u;if(u.isSymbolicLink()){if(!(i&&(f=u.realpathSync())))continue;f.isUnknown()&&f.lstatSync()}f.shouldWalk(l,o)&&l.add(f)}}return a}[Symbol.asyncIterator](){return this.iterate()}iterate(e=this.cwd,t={}){return typeof e=="string"?e=this.cwd.resolve(e):e instanceof Y||(t=e,e=this.cwd),this.stream(e,t)[Symbol.asyncIterator]()}[Symbol.iterator](){return this.iterateSync()}*iterateSync(e=this.cwd,t={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof Y||(t=e,e=this.cwd);let{withFileTypes:s=!0,follow:i=!1,filter:r,walkFilter:o}=t;(!r||r(e))&&(yield s?e:e.fullpath());let a=new Set([e]);for(let l of a){let c=l.readdirSync();for(let h of c){(!r||r(h))&&(yield s?h:h.fullpath());let u=h;if(h.isSymbolicLink()){if(!(i&&(u=h.realpathSync())))continue;u.isUnknown()&&u.lstatSync()}u.shouldWalk(a,o)&&a.add(u)}}}stream(e=this.cwd,t={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof Y||(t=e,e=this.cwd);let{withFileTypes:s=!0,follow:i=!1,filter:r,walkFilter:o}=t,a=new We({objectMode:!0});(!r||r(e))&&a.write(s?e:e.fullpath());let l=new Set,c=[e],h=0,u=()=>{let f=!1;for(;!f;){let d=c.shift();if(!d){h===0&&a.end();return}h++,l.add(d);let g=(y,m,x=!1)=>{if(y)return a.emit("error",y);if(i&&!x){let _=[];for(let b of m)b.isSymbolicLink()&&_.push(b.realpath().then(w=>w?.isUnknown()?w.lstat():w));if(_.length){Promise.all(_).then(()=>g(null,m,!0));return}}for(let _ of m)_&&(!r||r(_))&&(a.write(s?_:_.fullpath())||(f=!0));h--;for(let _ of m){let b=_.realpathCached()||_;b.shouldWalk(l,o)&&c.push(b)}f&&!a.flowing?a.once("drain",u):p||u()},p=!0;d.readdirCB(g,!0),p=!1}};return u(),a}streamSync(e=this.cwd,t={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof Y||(t=e,e=this.cwd);let{withFileTypes:s=!0,follow:i=!1,filter:r,walkFilter:o}=t,a=new We({objectMode:!0}),l=new Set;(!r||r(e))&&a.write(s?e:e.fullpath());let c=[e],h=0,u=()=>{let f=!1;for(;!f;){let d=c.shift();if(!d){h===0&&a.end();return}h++,l.add(d);let g=d.readdirSync();for(let p of g)(!r||r(p))&&(a.write(s?p:p.fullpath())||(f=!0));h--;for(let p of g){let y=p;if(p.isSymbolicLink()){if(!(i&&(y=p.realpathSync())))continue;y.isUnknown()&&y.lstatSync()}y.shouldWalk(l,o)&&c.push(y)}}f&&!a.flowing&&a.once("drain",u)};return u(),a}chdir(e=this.cwd){let t=this.cwd;this.cwd=typeof e=="string"?this.cwd.resolve(e):e,this.cwd[Ho](t)}},dt=class extends $s{sep="\\";constructor(e=process.cwd(),t={}){let{nocase:s=!0}=t;super(e,ft.win32,"\\",{...t,nocase:s}),this.nocase=s;for(let i=this.cwd;i;i=i.parent)i.nocase=this.nocase}parseRootPath(e){return ft.win32.parse(e).root.toUpperCase()}newRoot(e){return new As(this.rootPath,Ce,void 0,this.roots,this.nocase,this.childrenCache(),{fs:e})}isAbsolute(e){return e.startsWith("/")||e.startsWith("\\")||/^[a-z]:(\/|\\)/i.test(e)}},pt=class extends $s{sep="/";constructor(e=process.cwd(),t={}){let{nocase:s=!1}=t;super(e,ft.posix,"/",{...t,nocase:s}),this.nocase=s}parseRootPath(e){return"/"}newRoot(e){return new Fs(this.rootPath,Ce,void 0,this.roots,this.nocase,this.childrenCache(),{fs:e})}isAbsolute(e){return e.startsWith("/")}},Vt=class extends pt{constructor(e=process.cwd(),t={}){let{nocase:s=!0}=t;super(e,{...t,nocase:s})}},cd=process.platform==="win32"?As:Fs,Vo=process.platform==="win32"?dt:process.platform==="darwin"?Vt:pt;var Oh=n=>n.length>=1,Ah=n=>n.length>=1,gt=class n{#e;#i;#n;length;#t;#o;#_;#w;#u;#a;#f=!0;constructor(e,t,s,i){if(!Oh(e))throw new TypeError("empty pattern list");if(!Ah(t))throw new TypeError("empty glob list");if(t.length!==e.length)throw new TypeError("mismatched pattern list and glob list lengths");if(this.length=e.length,s<0||s>=this.length)throw new TypeError("index out of range");if(this.#e=e,this.#i=t,this.#n=s,this.#t=i,this.#n===0){if(this.isUNC()){let[r,o,a,l,...c]=this.#e,[h,u,f,d,...g]=this.#i;c[0]===""&&(c.shift(),g.shift());let p=[r,o,a,l,""].join("/"),y=[h,u,f,d,""].join("/");this.#e=[p,...c],this.#i=[y,...g],this.length=this.#e.length}else if(this.isDrive()||this.isAbsolute()){let[r,...o]=this.#e,[a,...l]=this.#i;o[0]===""&&(o.shift(),l.shift());let c=r+"/",h=a+"/";this.#e=[c,...o],this.#i=[h,...l],this.length=this.#e.length}}}pattern(){return this.#e[this.#n]}isString(){return typeof this.#e[this.#n]=="string"}isGlobstar(){return this.#e[this.#n]===R}isRegExp(){return this.#e[this.#n]instanceof RegExp}globString(){return this.#_=this.#_||(this.#n===0?this.isAbsolute()?this.#i[0]+this.#i.slice(1).join("/"):this.#i.join("/"):this.#i.slice(this.#n).join("/"))}hasMore(){return this.length>this.#n+1}rest(){return this.#o!==void 0?this.#o:this.hasMore()?(this.#o=new n(this.#e,this.#i,this.#n+1,this.#t),this.#o.#a=this.#a,this.#o.#u=this.#u,this.#o.#w=this.#w,this.#o):this.#o=null}isUNC(){let e=this.#e;return this.#u!==void 0?this.#u:this.#u=this.#t==="win32"&&this.#n===0&&e[0]===""&&e[1]===""&&typeof e[2]=="string"&&!!e[2]&&typeof e[3]=="string"&&!!e[3]}isDrive(){let e=this.#e;return this.#w!==void 0?this.#w:this.#w=this.#t==="win32"&&this.#n===0&&this.length>1&&typeof e[0]=="string"&&/^[a-z]:$/i.test(e[0])}isAbsolute(){let e=this.#e;return this.#a!==void 0?this.#a:this.#a=e[0]===""&&e.length>1||this.isDrive()||this.isUNC()}root(){let e=this.#e[0];return typeof e=="string"&&this.isAbsolute()&&this.#n===0?e:""}checkFollowGlobstar(){return!(this.#n===0||!this.isGlobstar()||!this.#f)}markFollowGlobstar(){return this.#n===0||!this.isGlobstar()||!this.#f?!1:(this.#f=!1,!0)}};var Fh=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",mt=class{relative;relativeChildren;absolute;absoluteChildren;platform;mmopts;constructor(e,{nobrace:t,nocase:s,noext:i,noglobstar:r,platform:o=Fh}){this.relative=[],this.absolute=[],this.relativeChildren=[],this.absoluteChildren=[],this.platform=o,this.mmopts={dot:!0,nobrace:t,nocase:s,noext:i,noglobstar:r,optimizationLevel:2,platform:o,nocomment:!0,nonegate:!0};for(let a of e)this.add(a)}add(e){let t=new oe(e,this.mmopts);for(let s=0;s<t.set.length;s++){let i=t.set[s],r=t.globParts[s];if(!i||!r)throw new Error("invalid pattern object");for(;i[0]==="."&&r[0]===".";)i.shift(),r.shift();let o=new gt(i,r,0,this.platform),a=new oe(o.globString(),this.mmopts),l=r[r.length-1]==="**",c=o.isAbsolute();c?this.absolute.push(a):this.relative.push(a),l&&(c?this.absoluteChildren.push(a):this.relativeChildren.push(a))}}ignored(e){let t=e.fullpath(),s=`${t}/`,i=e.relative()||".",r=`${i}/`;for(let o of this.relative)if(o.match(i)||o.match(r))return!0;for(let o of this.absolute)if(o.match(t)||o.match(s))return!0;return!1}childrenIgnored(e){let t=e.fullpath()+"/",s=(e.relative()||".")+"/";for(let i of this.relativeChildren)if(i.match(s))return!0;for(let i of this.absoluteChildren)if(i.match(t))return!0;return!1}};var Ki=class n{store;constructor(e=new Map){this.store=e}copy(){return new n(new Map(this.store))}hasWalked(e,t){return this.store.get(e.fullpath())?.has(t.globString())}storeWalked(e,t){let s=e.fullpath(),i=this.store.get(s);i?i.add(t.globString()):this.store.set(s,new Set([t.globString()]))}},Xi=class{store=new Map;add(e,t,s){let i=(t?2:0)|(s?1:0),r=this.store.get(e);this.store.set(e,r===void 0?i:i&r)}entries(){return[...this.store.entries()].map(([e,t])=>[e,!!(t&2),!!(t&1)])}},Qi=class{store=new Map;add(e,t){if(!e.canReaddir())return;let s=this.store.get(e);s?s.find(i=>i.globString()===t.globString())||s.push(t):this.store.set(e,[t])}get(e){let t=this.store.get(e);if(!t)throw new Error("attempting to walk unknown path");return t}entries(){return this.keys().map(e=>[e,this.store.get(e)])}keys(){return[...this.store.keys()].filter(e=>e.canReaddir())}},qt=class n{hasWalkedCache;matches=new Xi;subwalks=new Qi;patterns;follow;dot;opts;constructor(e,t){this.opts=e,this.follow=!!e.follow,this.dot=!!e.dot,this.hasWalkedCache=t?t.copy():new Ki}processPatterns(e,t){this.patterns=t;let s=t.map(i=>[e,i]);for(let[i,r]of s){this.hasWalkedCache.storeWalked(i,r);let o=r.root(),a=r.isAbsolute()&&this.opts.absolute!==!1;if(o){i=i.resolve(o==="/"&&this.opts.root!==void 0?this.opts.root:o);let u=r.rest();if(u)r=u;else{this.matches.add(i,!0,!1);continue}}if(i.isENOENT())continue;let l,c,h=!1;for(;typeof(l=r.pattern())=="string"&&(c=r.rest());)i=i.resolve(l),r=c,h=!0;if(l=r.pattern(),c=r.rest(),h){if(this.hasWalkedCache.hasWalked(i,r))continue;this.hasWalkedCache.storeWalked(i,r)}if(typeof l=="string"){let u=l===".."||l===""||l===".";this.matches.add(i.resolve(l),a,u);continue}else if(l===R){(!i.isSymbolicLink()||this.follow||r.checkFollowGlobstar())&&this.subwalks.add(i,r);let u=c?.pattern(),f=c?.rest();if(!c||(u===""||u===".")&&!f)this.matches.add(i,a,u===""||u===".");else if(u===".."){let d=i.parent||i;f?this.hasWalkedCache.hasWalked(d,f)||this.subwalks.add(d,f):this.matches.add(d,a,!0)}}else l instanceof RegExp&&this.subwalks.add(i,r)}return this}subwalkTargets(){return this.subwalks.keys()}child(){return new n(this.opts,this.hasWalkedCache)}filterEntries(e,t){let s=this.subwalks.get(e),i=this.child();for(let r of t)for(let o of s){let a=o.isAbsolute(),l=o.pattern(),c=o.rest();l===R?i.testGlobstar(r,o,c,a):l instanceof RegExp?i.testRegExp(r,l,c,a):i.testString(r,l,c,a)}return i}testGlobstar(e,t,s,i){if((this.dot||!e.name.startsWith("."))&&(t.hasMore()||this.matches.add(e,i,!1),e.canReaddir()&&(this.follow||!e.isSymbolicLink()?this.subwalks.add(e,t):e.isSymbolicLink()&&(s&&t.checkFollowGlobstar()?this.subwalks.add(e,s):t.markFollowGlobstar()&&this.subwalks.add(e,t)))),s){let r=s.pattern();if(typeof r=="string"&&r!==".."&&r!==""&&r!==".")this.testString(e,r,s.rest(),i);else if(r===".."){let o=e.parent||e;this.subwalks.add(o,s)}else r instanceof RegExp&&this.testRegExp(e,r,s.rest(),i)}}testRegExp(e,t,s,i){t.test(e.name)&&(s?this.subwalks.add(e,s):this.matches.add(e,i,!1))}testString(e,t,s,i){e.isNamed(t)&&(s?this.subwalks.add(e,s):this.matches.add(e,i,!1))}};var $h=(n,e)=>typeof n=="string"?new mt([n],e):Array.isArray(n)?new mt(n,e):n,Rs=class{path;patterns;opts;seen=new Set;paused=!1;aborted=!1;#e=[];#i;#n;signal;maxDepth;includeChildMatches;constructor(e,t,s){if(this.patterns=e,this.path=t,this.opts=s,this.#n=!s.posix&&s.platform==="win32"?"\\":"/",this.includeChildMatches=s.includeChildMatches!==!1,(s.ignore||!this.includeChildMatches)&&(this.#i=$h(s.ignore??[],s),!this.includeChildMatches&&typeof this.#i.add!="function")){let i="cannot ignore child matches, ignore lacks add() method.";throw new Error(i)}this.maxDepth=s.maxDepth||1/0,s.signal&&(this.signal=s.signal,this.signal.addEventListener("abort",()=>{this.#e.length=0}))}#t(e){return this.seen.has(e)||!!this.#i?.ignored?.(e)}#o(e){return!!this.#i?.childrenIgnored?.(e)}pause(){this.paused=!0}resume(){if(this.signal?.aborted)return;this.paused=!1;let e;for(;!this.paused&&(e=this.#e.shift());)e()}onResume(e){this.signal?.aborted||(this.paused?this.#e.push(e):e())}async matchCheck(e,t){if(t&&this.opts.nodir)return;let s;if(this.opts.realpath){if(s=e.realpathCached()||await e.realpath(),!s)return;e=s}let r=e.isUnknown()||this.opts.stat?await e.lstat():e;if(this.opts.follow&&this.opts.nodir&&r?.isSymbolicLink()){let o=await r.realpath();o&&(o.isUnknown()||this.opts.stat)&&await o.lstat()}return this.matchCheckTest(r,t)}matchCheckTest(e,t){return e&&(this.maxDepth===1/0||e.depth()<=this.maxDepth)&&(!t||e.canReaddir())&&(!this.opts.nodir||!e.isDirectory())&&(!this.opts.nodir||!this.opts.follow||!e.isSymbolicLink()||!e.realpathCached()?.isDirectory())&&!this.#t(e)?e:void 0}matchCheckSync(e,t){if(t&&this.opts.nodir)return;let s;if(this.opts.realpath){if(s=e.realpathCached()||e.realpathSync(),!s)return;e=s}let r=e.isUnknown()||this.opts.stat?e.lstatSync():e;if(this.opts.follow&&this.opts.nodir&&r?.isSymbolicLink()){let o=r.realpathSync();o&&(o?.isUnknown()||this.opts.stat)&&o.lstatSync()}return this.matchCheckTest(r,t)}matchFinish(e,t){if(this.#t(e))return;if(!this.includeChildMatches&&this.#i?.add){let r=`${e.relativePosix()}/**`;this.#i.add(r)}let s=this.opts.absolute===void 0?t:this.opts.absolute;this.seen.add(e);let i=this.opts.mark&&e.isDirectory()?this.#n:"";if(this.opts.withFileTypes)this.matchEmit(e);else if(s){let r=this.opts.posix?e.fullpathPosix():e.fullpath();this.matchEmit(r+i)}else{let r=this.opts.posix?e.relativePosix():e.relative(),o=this.opts.dotRelative&&!r.startsWith(".."+this.#n)?"."+this.#n:"";this.matchEmit(r?o+r+i:"."+i)}}async match(e,t,s){let i=await this.matchCheck(e,s);i&&this.matchFinish(i,t)}matchSync(e,t,s){let i=this.matchCheckSync(e,s);i&&this.matchFinish(i,t)}walkCB(e,t,s){this.signal?.aborted&&s(),this.walkCB2(e,t,new qt(this.opts),s)}walkCB2(e,t,s,i){if(this.#o(e))return i();if(this.signal?.aborted&&i(),this.paused){this.onResume(()=>this.walkCB2(e,t,s,i));return}s.processPatterns(e,t);let r=1,o=()=>{--r===0&&i()};for(let[a,l,c]of s.matches.entries())this.#t(a)||(r++,this.match(a,l,c).then(()=>o()));for(let a of s.subwalkTargets()){if(this.maxDepth!==1/0&&a.depth()>=this.maxDepth)continue;r++;let l=a.readdirCached();a.calledReaddir()?this.walkCB3(a,l,s,o):a.readdirCB((c,h)=>this.walkCB3(a,h,s,o),!0)}o()}walkCB3(e,t,s,i){s=s.filterEntries(e,t);let r=1,o=()=>{--r===0&&i()};for(let[a,l,c]of s.matches.entries())this.#t(a)||(r++,this.match(a,l,c).then(()=>o()));for(let[a,l]of s.subwalks.entries())r++,this.walkCB2(a,l,s.child(),o);o()}walkCBSync(e,t,s){this.signal?.aborted&&s(),this.walkCB2Sync(e,t,new qt(this.opts),s)}walkCB2Sync(e,t,s,i){if(this.#o(e))return i();if(this.signal?.aborted&&i(),this.paused){this.onResume(()=>this.walkCB2Sync(e,t,s,i));return}s.processPatterns(e,t);let r=1,o=()=>{--r===0&&i()};for(let[a,l,c]of s.matches.entries())this.#t(a)||this.matchSync(a,l,c);for(let a of s.subwalkTargets()){if(this.maxDepth!==1/0&&a.depth()>=this.maxDepth)continue;r++;let l=a.readdirSync();this.walkCB3Sync(a,l,s,o)}o()}walkCB3Sync(e,t,s,i){s=s.filterEntries(e,t);let r=1,o=()=>{--r===0&&i()};for(let[a,l,c]of s.matches.entries())this.#t(a)||this.matchSync(a,l,c);for(let[a,l]of s.subwalks.entries())r++,this.walkCB2Sync(a,l,s.child(),o);o()}},Bt=class extends Rs{matches=new Set;constructor(e,t,s){super(e,t,s)}matchEmit(e){this.matches.add(e)}async walk(){if(this.signal?.aborted)throw this.signal.reason;return this.path.isUnknown()&&await this.path.lstat(),await new Promise((e,t)=>{this.walkCB(this.path,this.patterns,()=>{this.signal?.aborted?t(this.signal.reason):e(this.matches)})}),this.matches}walkSync(){if(this.signal?.aborted)throw this.signal.reason;return this.path.isUnknown()&&this.path.lstatSync(),this.walkCBSync(this.path,this.patterns,()=>{if(this.signal?.aborted)throw this.signal.reason}),this.matches}},Ut=class extends Rs{results;constructor(e,t,s){super(e,t,s),this.results=new We({signal:this.signal,objectMode:!0}),this.results.on("drain",()=>this.resume()),this.results.on("resume",()=>this.resume())}matchEmit(e){this.results.write(e),this.results.flowing||this.pause()}stream(){let e=this.path;return e.isUnknown()?e.lstat().then(()=>{this.walkCB(e,this.patterns,()=>this.results.end())}):this.walkCB(e,this.patterns,()=>this.results.end()),this.results}streamSync(){return this.path.isUnknown()&&this.path.lstatSync(),this.walkCBSync(this.path,this.patterns,()=>this.results.end()),this.results}};var Rh=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",ve=class{absolute;cwd;root;dot;dotRelative;follow;ignore;magicalBraces;mark;matchBase;maxDepth;nobrace;nocase;nodir;noext;noglobstar;pattern;platform;realpath;scurry;stat;signal;windowsPathsNoEscape;withFileTypes;includeChildMatches;opts;patterns;constructor(e,t){if(!t)throw new TypeError("glob options required");if(this.withFileTypes=!!t.withFileTypes,this.signal=t.signal,this.follow=!!t.follow,this.dot=!!t.dot,this.dotRelative=!!t.dotRelative,this.nodir=!!t.nodir,this.mark=!!t.mark,t.cwd?(t.cwd instanceof URL||t.cwd.startsWith("file://"))&&(t.cwd=(0,qo.fileURLToPath)(t.cwd)):this.cwd="",this.cwd=t.cwd||"",this.root=t.root,this.magicalBraces=!!t.magicalBraces,this.nobrace=!!t.nobrace,this.noext=!!t.noext,this.realpath=!!t.realpath,this.absolute=t.absolute,this.includeChildMatches=t.includeChildMatches!==!1,this.noglobstar=!!t.noglobstar,this.matchBase=!!t.matchBase,this.maxDepth=typeof t.maxDepth=="number"?t.maxDepth:1/0,this.stat=!!t.stat,this.ignore=t.ignore,this.withFileTypes&&this.absolute!==void 0)throw new Error("cannot set absolute and withFileTypes:true");if(typeof e=="string"&&(e=[e]),this.windowsPathsNoEscape=!!t.windowsPathsNoEscape||t.allowWindowsEscape===!1,this.windowsPathsNoEscape&&(e=e.map(l=>l.replace(/\\/g,"/"))),this.matchBase){if(t.noglobstar)throw new TypeError("base matching requires globstar");e=e.map(l=>l.includes("/")?l:`./**/${l}`)}if(this.pattern=e,this.platform=t.platform||Rh,this.opts={...t,platform:this.platform},t.scurry){if(this.scurry=t.scurry,t.nocase!==void 0&&t.nocase!==t.scurry.nocase)throw new Error("nocase option contradicts provided scurry option")}else{let l=t.platform==="win32"?dt:t.platform==="darwin"?Vt:t.platform?pt:Vo;this.scurry=new l(this.cwd,{nocase:t.nocase,fs:t.fs})}this.nocase=this.scurry.nocase;let s=this.platform==="darwin"||this.platform==="win32",i={...t,dot:this.dot,matchBase:this.matchBase,nobrace:this.nobrace,nocase:this.nocase,nocaseMagicOnly:s,nocomment:!0,noext:this.noext,nonegate:!0,optimizationLevel:2,platform:this.platform,windowsPathsNoEscape:this.windowsPathsNoEscape,debug:!!this.opts.debug},r=this.pattern.map(l=>new oe(l,i)),[o,a]=r.reduce((l,c)=>(l[0].push(...c.set),l[1].push(...c.globParts),l),[[],[]]);this.patterns=o.map((l,c)=>{let h=a[c];if(!h)throw new Error("invalid pattern object");return new gt(l,h,0,this.platform)})}async walk(){return[...await new Bt(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).walk()]}walkSync(){return[...new Bt(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).walkSync()]}stream(){return new Ut(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).stream()}streamSync(){return new Ut(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).streamSync()}iterateSync(){return this.streamSync()[Symbol.iterator]()}[Symbol.iterator](){return this.iterateSync()}iterate(){return this.stream()[Symbol.asyncIterator]()}[Symbol.asyncIterator](){return this.iterate()}};var Zi=(n,e={})=>{Array.isArray(n)||(n=[n]);for(let t of n)if(new oe(t,e).hasMagic())return!0;return!1};function Ts(n,e={}){return new ve(n,e).streamSync()}function Uo(n,e={}){return new ve(n,e).stream()}function zo(n,e={}){return new ve(n,e).walkSync()}async function Bo(n,e={}){return new ve(n,e).walk()}function Ms(n,e={}){return new ve(n,e).iterateSync()}function Go(n,e={}){return new ve(n,e).iterate()}var Ph=Ts,Th=Object.assign(Uo,{sync:Ts}),Mh=Ms,jh=Object.assign(Go,{sync:Ms}),Dh=Object.assign(zo,{stream:Ts,iterate:Ms}),Ps=Object.assign(Bo,{glob:Bo,globSync:zo,sync:Dh,globStream:Uo,stream:Th,globStreamSync:Ts,streamSync:Ph,globIterate:Go,iterate:jh,globIterateSync:Ms,iterateSync:Mh,Glob:ve,hasMagic:Zi,escape:ct,unescape:ye});Ps.glob=Ps;var Ih=[{id:"ai.delve",category:"ai-slop",severity:"red",regex:/\bdelve\b/gi,suggestion:"use a specific verb: dig, explore, look at"},{id:"ai.leverage",category:"ai-slop",severity:"red",regex:/\bleverage\b/gi,suggestion:"use: use, apply, build on"},{id:"ai.tapestry",category:"ai-slop",severity:"red",regex:/\btapestry\b/gi,suggestion:"be specific about what you mean"},{id:"ai.holistic",category:"ai-slop",severity:"red",regex:/\bholistic\b/gi,suggestion:"describe the actual approach"},{id:"ai.robust",category:"ai-slop",severity:"yellow",regex:/\brobust\b/gi,suggestion:"say what actually makes it strong"},{id:"ai.pivotal",category:"ai-slop",severity:"yellow",regex:/\bpivotal\b/gi,suggestion:"say why it matters specifically"},{id:"ai.foster",category:"ai-slop",severity:"yellow",regex:/\bfoster\b/gi,suggestion:"use: build, grow, encourage, support"},{id:"ai.harness",category:"ai-slop",severity:"yellow",regex:/\bharness\b/gi,suggestion:"use: use, apply, work with"},{id:"ai.illuminate",category:"ai-slop",severity:"yellow",regex:/\billuminate\b/gi,suggestion:"use: show, explain, highlight"},{id:"ai.ever-evolving",category:"ai-slop",severity:"red",regex:/\b(?:ever[\s-]evolving|ever[\s-]changing)\b/gi,suggestion:"cut this \u2014 it says nothing"},{id:"ai.fast-paced",category:"ai-slop",severity:"red",regex:/\bfast[\s-]paced\b/gi,suggestion:"cut this \u2014 every industry says this"},{id:"ai.game-changer",category:"ai-slop",severity:"red",regex:/\bgame[\s-]changer\b/gi,suggestion:"explain what actually changed"},{id:"ai.paradigm",category:"ai-slop",severity:"red",regex:/\bparadigm\b/gi,suggestion:"describe the actual shift"},{id:"ai.synergy",category:"ai-slop",severity:"red",regex:/\bsynergy\b/gi,suggestion:"describe what works together and why"},{id:"ai.ecosystem",category:"ai-slop",severity:"yellow",regex:/\becosystem\b/gi,suggestion:"name the specific tools/partners/platforms"},{id:"ai.seamless",category:"ai-slop",severity:"yellow",regex:/\bseamless\b/gi,suggestion:"describe how it actually works"},{id:"ai.actionable",category:"ai-slop",severity:"yellow",regex:/\bactionable\b/gi,suggestion:"just give the action, don't label it"},{id:"ai.granular",category:"ai-slop",severity:"yellow",regex:/\bgranular\b/gi,suggestion:"say: specific, detailed, or name the level"},{id:"ai.impactful",category:"ai-slop",severity:"yellow",regex:/\bimpactful\b/gi,suggestion:"describe the actual impact"}],Lh=[{id:"formula.firstly",category:"ai-slop",severity:"yellow",regex:/\bfirstly\b/gi,suggestion:'just start \u2014 "firstly" is filler'},{id:"formula.in-conclusion",category:"ai-slop",severity:"red",regex:/\bin conclusion\b/gi,suggestion:"just end. readers know it's the end."},{id:"formula.it-is-important",category:"ai-slop",severity:"yellow",regex:/\bit is important to note\b/gi,suggestion:"just note it. skip the preamble."},{id:"formula.at-the-end",category:"ai-slop",severity:"yellow",regex:/\bat the end of the day\b/gi,suggestion:"cut this \u2014 it means nothing"},{id:"formula.needless-to-say",category:"ai-slop",severity:"yellow",regex:/\bneedless to say\b/gi,suggestion:"if it's needless, don't say it"},{id:"formula.it-goes-without",category:"ai-slop",severity:"yellow",regex:/\bit goes without saying\b/gi,suggestion:"then don't say it"},{id:"formula.in-today",category:"ai-slop",severity:"red",regex:/\bin today'?s\b/gi,suggestion:"start with your actual point instead"},{id:"formula.lets-dive",category:"ai-slop",severity:"red",regex:/\blet'?s (?:dive|jump|dig|delve)\b/gi,suggestion:"just start. no diving needed."},{id:"formula.without-further",category:"ai-slop",severity:"red",regex:/\bwithout further ado\b/gi,suggestion:"cut this \u2014 just get to it"}],Nh=[{id:"hedge.some-might",category:"voice-drift",severity:"yellow",regex:/\bsome might say\b/gi,suggestion:"commit to the claim or drop it"},{id:"hedge.arguably",category:"voice-drift",severity:"yellow",regex:/\barguably\b/gi,suggestion:"commit. say it or don't."},{id:"hedge.worth-noting",category:"voice-drift",severity:"yellow",regex:/\bit'?s worth noting\b/gi,suggestion:"just note it directly"},{id:"hedge.to-some-extent",category:"voice-drift",severity:"yellow",regex:/\bto some extent\b/gi,suggestion:"be specific about the extent"}],Wh=[{id:"struct.antithesis",category:"structure",severity:"yellow",regex:/\bnot (?:just|only) .{3,50}, but .{3,50}/gi,suggestion:"this antithesis pattern is an AI tell \u2014 restructure"},{id:"struct.more-than-just",category:"structure",severity:"yellow",regex:/\bmore than just\b/gi,suggestion:"say what it IS, not what it isn't"},{id:"struct.in-order-to",category:"structure",severity:"yellow",regex:/\bin order to\b/gi,suggestion:'just use "to"'},{id:"struct.due-to-the-fact",category:"structure",severity:"yellow",regex:/\bdue to the fact that\b/gi,suggestion:'use "because"'},{id:"struct.for-the-purpose",category:"structure",severity:"yellow",regex:/\bfor the purpose of\b/gi,suggestion:'use "to"'},{id:"struct.which-is-another",category:"structure",severity:"red",regex:/\bwhich is another way of saying\b/gi,suggestion:"just say the thing directly"}],Hh=[...Ih,...Lh,...Nh,...Wh];function Yo(n,e,t){let s=[];for(let i of Hh){i.regex.lastIndex=0;let r;for(;(r=i.regex.exec(n))!==null;)s.push({file:t,line:e,column:r.index+1,pattern:i.id,category:i.category,severity:i.severity,excerpt:Vh(n.trim(),r.index,r[0].length),suggestion:i.suggestion})}return s}function Vh(n,e,t){let s=n.slice(0,e),i=n.slice(e,e+t),r=n.slice(e+t);return`${s}\xAB${i}\xBB${r}`.slice(0,120)}async function tn(n,e=[]){let t=[];for(let o of n)if(yt.existsSync(o)&&yt.statSync(o).isFile())t.push(o);else{let a=await Ps("**/*.md",{cwd:o,ignore:["node_modules/**",".git/**",...e],absolute:!0});t.push(...a)}let s=[...new Set(t)],i=[],r={files:0,total_lines:0,red:0,yellow:0,clean:0};for(let o of s){if(!o.endsWith(".md"))continue;let a;try{a=yt.readFileSync(o,"utf-8")}catch{continue}let l=a.split(`
339
+ `),c=[];for(let f=0;f<l.length;f++){let d=l[f];d.startsWith("```")||d.startsWith("---")||d.startsWith("#")||d.trim().length<10||c.push(...Yo(d,f+1,en.relative(process.cwd(),o)))}r.files++,r.total_lines+=l.length;let h=c.filter(f=>f.severity==="red").length,u=c.filter(f=>f.severity==="yellow").length;r.red+=h,r.yellow+=u,h+u===0&&r.clean++,i.push({file:en.relative(process.cwd(),o),findings:c,lines:l.length})}return{results:i,summary:r}}var Jo=70;var qh=25;function Xo(n,e,t,s){let i=[],r=us(e,t),o=r.summary.red,a=r.summary.yellow;if(o>0&&i.push(`Rewrite introduced ${o} new critical issues`),s){let _=new Set(s.signals.map(w=>w.id)),b=r.signals.filter(w=>!_.has(w.id));if(b.length>0){let w=[...new Set(b.map(T=>T.id))].slice(0,5);i.push(`Rewrite introduced new patterns: ${w.join(", ")}`)}}let l=Br(e,t.cadence);l<100-qh&&i.push(`Cadence deviation: score ${l}/100 (target avg ${t.cadence?.avg_words||"?"} words)`);let c=[],h=e.toLowerCase();for(let _ of t.never_list||[])_&&h.includes(_.toLowerCase())&&c.push(_);c.length>0&&i.push(`Never-list violations: ${c.join(", ")}`);let u=Bh(n,e);u<60&&i.push(`Semantic drift detected: score ${u}/100`);let f=e.length/Math.max(1,n.length);(f<.5||f>2)&&i.push(`Length changed too much: ${(f*100).toFixed(0)}% of original`);let d=Math.max(0,100-o*20-a*5),g=Math.max(0,100-c.length*25),p=Math.round(d*.35+l*.25+u*.25+g*.15),y=p<Jo&&i.length>0,m=!1,x;return y&&(x=Uh(i,r,t)),{valid:p>=Jo,score:p,issues:i,newSignals:r,cadenceScore:l,neverListHits:c,needsRetry:y,needsVerification:m,retryInstruction:x}}function Bh(n,e){let t=Ko(n),s=Ko(e);if(t.size===0)return 100;let i=0;for(let l of t)s.has(l)&&i++;let r=i/t.size*100,o=e.length/Math.max(1,n.length),a=o>=.7&&o<=1.5?100:Math.max(0,100-Math.abs(1-o)*100);return Math.round(r*.7+a*.3)}function Ko(n){let e=n.toLowerCase().match(/[a-z]{4,}/g)||[],t=new Set(["that","this","with","from","have","been","were","they","their","would","could","should","about","which","when","what","there","than","them","then","into","over","also","just","more","some","very","your","only","will","each","make","like","well","back","much","most","other","after"]);return new Set(e.filter(s=>!t.has(s)))}function Uh(n,e,t){let s=[];s.push("The rewrite had these issues:");for(let r of n)s.push(`- ${r}`);s.push("");let i=e.byRule;if(i.size>0){s.push("Fix these specific patterns:");for(let[r,o]of i){let a=o.map(l=>l.line).join(", ");s.push(`- ${r} on lines ${a}`)}}return t.never_list?.length&&(s.push(""),s.push(`Remember: never use these words: ${t.never_list.join(", ")}`)),s.join(`
340
+ `)}var Qo=nn.join(Ds.homedir(),".hyv","voice.md");function sn(n,e){return JSON.stringify({jsonrpc:"2.0",id:n,result:e})}function zh(n,e,t){return JSON.stringify({jsonrpc:"2.0",id:n,error:{code:e,message:t}})}function js(n){process.stdout.write(n+`
341
+ `)}async function Gh(n){let e=n.text||"",t=n.profile||Ti()||"default";if(!e.trim())return"Error: no text provided";try{let s=await Ri(t),i=us(e,s),r=Ur(i),o=e;if(r.autoFixes.length>0&&(o=zr(e,r.issues).fixed),r.llmFixes.length>0){let a=hs({draftPath:"inline",draftContent:o,profileName:t});return`Auto-fixed ${r.autoFixes.length} issues. ${r.llmFixes.length} issues need LLM rewrite.
342
+
343
+ ${a.prompt}`}return o}catch(s){return`Error: ${s.message}`}}async function Yh(n){let e=n.text||"",t=n.file||"";if(!e.trim()&&!t.trim())return"Error: no text or file provided";try{if(t){let{results:i,summary:r}=await tn([t]),o=i.flatMap(a=>a.findings.map(l=>`line ${l.line}: [${l.severity}] ${l.pattern} \u2014 ${l.excerpt}`));return o.length===0?`No issues found in ${t}`:`Found ${o.length} issues:
339
344
  ${o.join(`
340
- `)}`}let s=Yi.join(Fs.tmpdir(),`hyv-scan-${Date.now()}.md`);ht.writeFileSync(s,e);try{let{results:i,summary:r}=await zi([s]),o=i.flatMap(a=>a.findings.map(l=>`line ${l.line}: [${l.severity}] ${l.pattern} \u2014 ${l.excerpt}`));return o.length===0?"No AI patterns found":`Found ${o.length} issues:
345
+ `)}`}let s=nn.join(Ds.tmpdir(),`hyv-scan-${Date.now()}.md`);wt.writeFileSync(s,e);try{let{results:i,summary:r}=await tn([s]),o=i.flatMap(a=>a.findings.map(l=>`line ${l.line}: [${l.severity}] ${l.pattern} \u2014 ${l.excerpt}`));return o.length===0?"No AI patterns found":`Found ${o.length} issues:
341
346
  ${o.join(`
342
- `)}`}finally{try{ht.unlinkSync(s)}catch{}}}catch(s){return`Error: ${s.message}`}}async function Dh(n){try{let{apiGet:e}=await Promise.resolve().then(()=>(vi(),Dr)),s=(await e("/cli/profiles")).profiles||[];return s.length===0?"No voice profiles found. Create one at holdyourvoice.com or run: hyv new <name>":s.map(i=>`${i.name}${i.is_default?" (default)":""}${i.keywords?.length?" \u2014 "+i.keywords.slice(0,3).join(", "):""}`).join(`
343
- `)}catch(e){return`Error: ${e.message}`}}async function Nh(n){let e=n.text||"",t=n.profile||Ci()||"default";if(!e.trim())return"Error: no text provided";try{let s=await Si(t),i=Lo(e,e,s),r=[`Score: ${i.score}/100`];return i.cadenceScore&&r.push(`Cadence: ${i.cadenceScore}/100`),i.neverListHits.length&&r.push(`Never-list hits: ${i.neverListHits.join(", ")}`),i.valid?r.push("PASS"):r.push("NEEDS IMPROVEMENT"),i.issues.length&&r.push(`Issues:
347
+ `)}`}finally{try{wt.unlinkSync(s)}catch{}}}catch(s){return`Error: ${s.message}`}}async function Jh(n){try{let{apiGet:e}=await Promise.resolve().then(()=>(Fi(),Yr)),s=(await e("/cli/profiles")).profiles||[];return s.length===0?"No voice profiles found. Create one at holdyourvoice.com or run: hyv new <name>":s.map(i=>`${i.name}${i.is_default?" (default)":""}${i.keywords?.length?" \u2014 "+i.keywords.slice(0,3).join(", "):""}`).join(`
348
+ `)}catch(e){return`Error: ${e.message}`}}async function Kh(n){let e=n.text||"",t=n.profile||Ti()||"default";if(!e.trim())return"Error: no text provided";try{let s=await Ri(t),i=Xo(e,e,s),r=[`Score: ${i.score}/100`];return i.cadenceScore&&r.push(`Cadence: ${i.cadenceScore}/100`),i.neverListHits.length&&r.push(`Never-list hits: ${i.neverListHits.join(", ")}`),i.valid?r.push("PASS"):r.push("NEEDS IMPROVEMENT"),i.issues.length&&r.push(`Issues:
344
349
  ${i.issues.map(o=>` - ${o}`).join(`
345
350
  `)}`),r.join(`
346
- `)}catch(s){return`Error: ${s.message}`}}var Ih=[{name:"hyv_rewrite",description:`Rewrite text to match the user's voice profile. Auto-fixes AI patterns and generates a prompt for remaining issues. Use when the user says "rewrite in my voice" or wants text rewritten.`,inputSchema:{type:"object",properties:{text:{type:"string",description:"The text to rewrite"},profile:{type:"string",description:"Voice profile name (optional, uses default if omitted)"}},required:["text"]}},{name:"hyv_scan",description:"Scan text or a file for AI writing patterns and voice drift. Returns a list of issues found.",inputSchema:{type:"object",properties:{text:{type:"string",description:"Inline text to scan"},file:{type:"string",description:"Path to a .md file to scan"}}}},{name:"hyv_profiles",description:"List the user's voice profiles. Use before rewriting to pick the right profile.",inputSchema:{type:"object",properties:{}}},{name:"hyv_validate",description:"Validate text against a voice profile. Returns a score and list of remaining issues.",inputSchema:{type:"object",properties:{text:{type:"string",description:"Text to validate"},profile:{type:"string",description:"Voice profile name (optional)"}},required:["text"]}}];async function Lh(n){let e;try{e=JSON.parse(n)}catch{return}let{id:t,method:s,params:i}=e;switch(s){case"initialize":As(Gi(t,{protocolVersion:"2024-11-05",capabilities:{tools:{}},serverInfo:{name:"hyv",version:"0.7.4"}}));break;case"notifications/initialized":break;case"tools/list":As(Gi(t,{tools:Ih}));break;case"tools/call":{let r=i?.name,o=i?.arguments||{},a;try{switch(r){case"hyv_rewrite":a=await Mh(o);break;case"hyv_scan":a=await jh(o);break;case"hyv_profiles":a=await Dh(o);break;case"hyv_validate":a=await Nh(o);break;default:a=`Unknown tool: ${r}`;break}}catch(l){a=`Error: ${l.message}`}As(Gi(t,{content:[{type:"text",text:a}]}));break}default:t!==void 0&&As(Th(t,-32601,`Method not found: ${s}`));break}}function Ho(){ht.existsSync(Wo)?process.stderr.write(`[hyv-mcp] voice profile: ${Wo}
351
+ `)}catch(s){return`Error: ${s.message}`}}var Xh=[{name:"hyv_rewrite",description:`Rewrite text to match the user's voice profile. Auto-fixes AI patterns and generates a prompt for remaining issues. Use when the user says "rewrite in my voice" or wants text rewritten.`,inputSchema:{type:"object",properties:{text:{type:"string",description:"The text to rewrite"},profile:{type:"string",description:"Voice profile name (optional, uses default if omitted)"}},required:["text"]}},{name:"hyv_scan",description:"Scan text or a file for AI writing patterns and voice drift. Returns a list of issues found.",inputSchema:{type:"object",properties:{text:{type:"string",description:"Inline text to scan"},file:{type:"string",description:"Path to a .md file to scan"}}}},{name:"hyv_profiles",description:"List the user's voice profiles. Use before rewriting to pick the right profile.",inputSchema:{type:"object",properties:{}}},{name:"hyv_validate",description:"Validate text against a voice profile. Returns a score and list of remaining issues.",inputSchema:{type:"object",properties:{text:{type:"string",description:"Text to validate"},profile:{type:"string",description:"Voice profile name (optional)"}},required:["text"]}}];async function Qh(n){let e;try{e=JSON.parse(n)}catch{return}let{id:t,method:s,params:i}=e;switch(s){case"initialize":js(sn(t,{protocolVersion:"2024-11-05",capabilities:{tools:{}},serverInfo:{name:"hyv",version:"0.7.4"}}));break;case"notifications/initialized":break;case"tools/list":js(sn(t,{tools:Xh}));break;case"tools/call":{let r=i?.name,o=i?.arguments||{},a;try{switch(r){case"hyv_rewrite":a=await Gh(o);break;case"hyv_scan":a=await Yh(o);break;case"hyv_profiles":a=await Jh(o);break;case"hyv_validate":a=await Kh(o);break;default:a=`Unknown tool: ${r}`;break}}catch(l){a=`Error: ${l.message}`}js(sn(t,{content:[{type:"text",text:a}]}));break}default:t!==void 0&&js(zh(t,-32601,`Method not found: ${s}`));break}}function Zo(){wt.existsSync(Qo)?process.stderr.write(`[hyv-mcp] voice profile: ${Qo}
347
352
  `):process.stderr.write(`[hyv-mcp] no voice.md found \u2014 run hyv init first
348
353
  `);let n="";process.stdin.setEncoding("utf-8"),process.stdin.on("data",e=>{n+=e;let t=n.split(`
349
- `);n=t.pop()||"";for(let s of t)s.trim()&&Lh(s.trim()).catch(i=>{process.stderr.write(`[hyv-mcp] error: ${i.message}
354
+ `);n=t.pop()||"";for(let s of t)s.trim()&&Qh(s.trim()).catch(i=>{process.stderr.write(`[hyv-mcp] error: ${i.message}
350
355
  `)})}),process.stdin.on("end",()=>{process.exit(0)}),process.stderr.write(`[hyv-mcp] server started
351
- `)}var Ji="0.7.4",Bo="@holdyourvoice/hyv";(async()=>{try{let n=Number(process.env._HYV_UPDATE_CHECK||"0"),e=Date.now();if(e-n<864e5)return;process.env._HYV_UPDATE_CHECK=String(e);let t=await fetch(`https://registry.npmjs.org/${Bo}/latest`,{signal:AbortSignal.timeout(3e3)});if(!t.ok)return;let s=await t.json();s.version&&s.version!==Ji&&(console.log(`
352
- ${Ee.default.yellow("\u2B06")} update available: ${Ee.default.dim(Ji)} \u2192 ${Ee.default.green(s.version)}`),console.log(` ${Ee.default.dim("run:")} npm i -g ${Bo}
353
- `))}catch{}})();var ee=new un;ee.name("hyv").description("hold your voice \u2014 voice gate layer for ai workflows").version(Ji);dr(ee);pr(ee);gr(ee);vr(ee);_r(ee);Cr(ee);Er(ee);Ar(ee);Fr(ee);$r(ee);ee.command("mcp").description("start MCP server (for Claude Desktop and other MCP hosts)").option("--setup-chatgpt","open ChatGPT connector settings to add HYV").action(async n=>{if(n.setupChatgpt){let e=(await Promise.resolve().then(()=>C(pt()))).default;console.log(Ee.default.bold(`
356
+ `)}var rn="0.7.4",ea="@holdyourvoice/hyv";(async()=>{try{let n=Number(process.env._HYV_UPDATE_CHECK||"0"),e=Date.now();if(e-n<864e5)return;process.env._HYV_UPDATE_CHECK=String(e);let t=await fetch(`https://registry.npmjs.org/${ea}/latest`,{signal:AbortSignal.timeout(3e3)});if(!t.ok)return;let s=await t.json();s.version&&s.version!==rn&&(console.log(`
357
+ ${Me.default.yellow("\u2B06")} update available: ${Me.default.dim(rn)} \u2192 ${Me.default.green(s.version)}`),console.log(` ${Me.default.dim("run:")} npm i -g ${ea}
358
+ `))}catch{}})();var Z=new vn;Z.name("hyv").description("hold your voice \u2014 voice gate layer for ai workflows").version(rn);Or(Z);Ar(Z);Fr(Z);Rr(Z);Mr(Z);Ci(Z);jr(Z);Ir(Z);Lr(Z);Nr(Z);Vr(Z);Z.command("mcp").description("start MCP server (for Claude Desktop and other MCP hosts)").option("--setup-chatgpt","open ChatGPT connector settings to add HYV").action(async n=>{if(n.setupChatgpt){let e=(await Promise.resolve().then(()=>C(_t()))).default;console.log(Me.default.bold(`
354
359
  hold your voice \u2014 chatgpt setup
355
- `)),console.log("opening chatgpt connector settings..."),console.log(Ee.default.dim("add this server url: ")+Ee.default.cyan("https://holdyourvoice.com/mcp")),console.log(Ee.default.dim('authentication: select "OAuth" or "API Key"')),await e("https://chatgpt.com/#settings/Connectors");return}Ho()});ee.parse();process.argv.slice(2).length||ee.outputHelp();
360
+ `)),console.log("opening chatgpt connector settings..."),console.log(Me.default.dim("add this server url: ")+Me.default.cyan("https://holdyourvoice.com/mcp")),console.log(Me.default.dim('authentication: select "OAuth" or "API Key"')),await e("https://chatgpt.com/#settings/Connectors");return}Zo()});Z.parse();process.argv.slice(2).length||Z.outputHelp();