@holdyourvoice/hyv 0.5.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +171 -153
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,185 +1,175 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
"use strict";var
|
|
3
|
-
`).replace(/^/gm," ".repeat(r))}let c=[`Usage: ${t.commandUsage(e)}`,""],u=t.commandDescription(e);u.length>0&&(c=c.concat([t.wrap(u,
|
|
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
|
|
2
|
+
"use strict";var Ro=Object.create;var mi=Object.defineProperty;var jo=Object.getOwnPropertyDescriptor;var To=Object.getOwnPropertyNames;var Po=Object.getPrototypeOf,Mo=Object.prototype.hasOwnProperty;var Os=(n,e)=>()=>(n&&(e=n(n=0)),e);var O=(n,e)=>()=>(e||n((e={exports:{}}).exports,e),e.exports),Io=(n,e)=>{for(var t in e)mi(n,t,{get:e[t],enumerable:!0})},Lo=(n,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of To(e))!Mo.call(n,s)&&s!==t&&mi(n,s,{get:()=>e[s],enumerable:!(i=jo(e,s))||i.enumerable});return n};var C=(n,e,t)=>(t=n!=null?Ro(Po(n)):{},Lo(e||!n||!n.__esModule?mi(t,"default",{value:n,enumerable:!0}):t,n));var rt=O(bi=>{var kt=class extends Error{constructor(e,t,i){super(i),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=t,this.exitCode=e,this.nestedError=void 0}},yi=class extends kt{constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};bi.CommanderError=kt;bi.InvalidArgumentError=yi});var Ft=O(vi=>{var{InvalidArgumentError:No}=rt(),wi=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,i)=>{if(!this.argChoices.includes(t))throw new No(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(t,i):t},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function Do(n){let e=n.name()+(n.variadic===!0?"...":"");return n.required?"<"+e+">":"["+e+"]"}vi.Argument=wi;vi.humanReadableArgName=Do});var Si=O(As=>{var{humanReadableArgName:Wo}=Ft(),xi=class{constructor(){this.helpWidth=void 0,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}visibleCommands(e){let t=e.commands.filter(s=>!s._hidden),i=e._getHelpCommand();return i&&!i._hidden&&t.push(i),this.sortSubcommands&&t.sort((s,r)=>s.name().localeCompare(r.name())),t}compareOptions(e,t){let i=s=>s.short?s.short.replace(/^-/,""):s.long.replace(/^--/,"");return i(e).localeCompare(i(t))}visibleOptions(e){let t=e.options.filter(s=>!s.hidden),i=e._getHelpOption();if(i&&!i.hidden){let s=i.short&&e._findOption(i.short),r=i.long&&e._findOption(i.long);!s&&!r?t.push(i):i.long&&!r?t.push(e.createOption(i.long,i.description)):i.short&&!s&&t.push(e.createOption(i.short,i.description))}return this.sortOptions&&t.sort(this.compareOptions),t}visibleGlobalOptions(e){if(!this.showGlobalOptions)return[];let t=[];for(let i=e.parent;i;i=i.parent){let s=i.options.filter(r=>!r.hidden);t.push(...s)}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(i=>Wo(i)).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((i,s)=>Math.max(i,t.subcommandTerm(s).length),0)}longestOptionTermLength(e,t){return t.visibleOptions(e).reduce((i,s)=>Math.max(i,t.optionTerm(s).length),0)}longestGlobalOptionTermLength(e,t){return t.visibleGlobalOptions(e).reduce((i,s)=>Math.max(i,t.optionTerm(s).length),0)}longestArgumentTermLength(e,t){return t.visibleArguments(e).reduce((i,s)=>Math.max(i,t.argumentTerm(s).length),0)}commandUsage(e){let t=e._name;e._aliases[0]&&(t=t+"|"+e._aliases[0]);let i="";for(let s=e.parent;s;s=s.parent)i=s.name()+" "+i;return i+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(i=>JSON.stringify(i)).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(i=>JSON.stringify(i)).join(", ")}`),e.defaultValue!==void 0&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),t.length>0){let i=`(${t.join(", ")})`;return e.description?`${e.description} ${i}`:i}return e.description}formatHelp(e,t){let i=t.padWidth(e,t),s=t.helpWidth||80,r=2,o=2;function a(m,g){if(g){let y=`${m.padEnd(i+o)}${g}`;return t.wrap(y,s-r,i+o)}return m}function l(m){return m.join(`
|
|
3
|
+
`).replace(/^/gm," ".repeat(r))}let c=[`Usage: ${t.commandUsage(e)}`,""],u=t.commandDescription(e);u.length>0&&(c=c.concat([t.wrap(u,s,0),""]));let h=t.visibleArguments(e).map(m=>a(t.argumentTerm(m),t.argumentDescription(m)));h.length>0&&(c=c.concat(["Arguments:",l(h),""]));let p=t.visibleOptions(e).map(m=>a(t.optionTerm(m),t.optionDescription(m)));if(p.length>0&&(c=c.concat(["Options:",l(p),""])),this.showGlobalOptions){let m=t.visibleGlobalOptions(e).map(g=>a(t.optionTerm(g),t.optionDescription(g)));m.length>0&&(c=c.concat(["Global Options:",l(m),""]))}let d=t.visibleCommands(e).map(m=>a(t.subcommandTerm(m),t.subcommandDescription(m)));return d.length>0&&(c=c.concat(["Commands:",l(d),""])),c.join(`
|
|
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,i,s=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-i;if(a<s)return e;let l=e.slice(0,i),c=e.slice(i).replace(`\r
|
|
5
5
|
`,`
|
|
6
|
-
`),u=" ".repeat(
|
|
7
|
-
|.{1,${a-1}}([${
|
|
8
|
-
`?"":(y>0?u:"")+
|
|
9
|
-
`)}};
|
|
10
|
-
(Did you mean one of ${
|
|
11
|
-
(Did you mean ${
|
|
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
|
|
13
|
-
Expecting one of '${
|
|
14
|
-
- already used by option '${t.flags}'`)}this.options.push(e)}_registerCommand(e){let t=
|
|
6
|
+
`),u=" ".repeat(i),p="\\s\u200B",d=new RegExp(`
|
|
7
|
+
|.{1,${a-1}}([${p}]|$)|[^${p}]+?([${p}]|$)`,"g"),m=c.match(d)||[];return l+m.map((g,y)=>g===`
|
|
8
|
+
`?"":(y>0?u:"")+g.trimEnd()).join(`
|
|
9
|
+
`)}};As.Help=xi});var $i=O(Ei=>{var{InvalidArgumentError:Vo}=rt(),_i=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 i=Bo(e);this.short=i.shortFlag,this.long=i.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,i)=>{if(!this.argChoices.includes(t))throw new Vo(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(t,i):t},this}name(){return this.long?this.long.replace(/^--/,""):this.short.replace(/^-/,"")}attributeName(){return Ho(this.name().replace(/^no-/,""))}is(e){return this.short===e||this.long===e}isBoolean(){return!this.required&&!this.optional&&!this.negate}},Ci=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,i)=>{this.positiveOptions.has(i)&&this.dualOptions.add(i)})}valueFromOption(e,t){let i=t.attributeName();if(!this.dualOptions.has(i))return!0;let s=this.negativeOptions.get(i).presetArg,r=s!==void 0?s:!1;return t.negate===(r===e)}};function Ho(n){return n.split("-").reduce((e,t)=>e+t[0].toUpperCase()+t.slice(1))}function Bo(n){let e,t,i=n.split(/[ |,]+/);return i.length>1&&!/^[[<]/.test(i[1])&&(e=i.shift()),t=i.shift(),!e&&/^-[^-]$/.test(t)&&(e=t,t=void 0),{shortFlag:e,longFlag:t}}Ei.Option=_i;Ei.DualOptions=Ci});var Fs=O(ks=>{function Uo(n,e){if(Math.abs(n.length-e.length)>3)return Math.max(n.length,e.length);let t=[];for(let i=0;i<=n.length;i++)t[i]=[i];for(let i=0;i<=e.length;i++)t[0][i]=i;for(let i=1;i<=e.length;i++)for(let s=1;s<=n.length;s++){let r=1;n[s-1]===e[i-1]?r=0:r=1,t[s][i]=Math.min(t[s-1][i]+1,t[s][i-1]+1,t[s-1][i-1]+r),s>1&&i>1&&n[s-1]===e[i-2]&&n[s-2]===e[i-1]&&(t[s][i]=Math.min(t[s][i],t[s-2][i-2]+1))}return t[n.length][e.length]}function zo(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 i=[],s=3,r=.4;return e.forEach(o=>{if(o.length<=1)return;let a=Uo(n,o),l=Math.max(n.length,o.length);(l-a)/l>r&&(a<s?(s=a,i=[o]):a===s&&i.push(o))}),i.sort((o,a)=>o.localeCompare(a)),t&&(i=i.map(o=>`--${o}`)),i.length>1?`
|
|
10
|
+
(Did you mean one of ${i.join(", ")}?)`:i.length===1?`
|
|
11
|
+
(Did you mean ${i[0]}?)`:""}ks.suggestSimilar=zo});var Ms=O(Ps=>{var qo=require("node:events").EventEmitter,Oi=require("node:child_process"),ue=require("node:path"),Ai=require("node:fs"),A=require("node:process"),{Argument:Go,humanReadableArgName:Jo}=Ft(),{CommanderError:ki}=rt(),{Help:Yo}=Si(),{Option:Rs,DualOptions:Ko}=$i(),{suggestSimilar:js}=Fs(),Fi=class n extends qo{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=>A.stdout.write(t),writeErr:t=>A.stderr.write(t),getOutHelpWidth:()=>A.stdout.isTTY?A.stdout.columns:void 0,getErrHelpWidth:()=>A.stderr.isTTY?A.stderr.columns:void 0,outputError:(t,i)=>i(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,i){let s=t,r=i;typeof s=="object"&&s!==null&&(r=s,s=null),r=r||{};let[,o,a]=e.match(/([^ ]+) *(.*)/),l=this.createCommand(o);return s&&(l.description(s),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),s?this:l}createCommand(e){return new n(e)}createHelp(){return Object.assign(new Yo,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 Go(e,t)}argument(e,t,i,s){let r=this.createArgument(e,t);return typeof i=="function"?r.default(s).argParser(i):r.default(i),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[,i,s]=e.match(/([^ ]+) *(.*)/),r=t??"display help for command",o=this.createCommand(i);return o.helpOption(!1),s&&o.arguments(s),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 i=["preSubcommand","preAction","postAction"];if(!i.includes(e))throw new Error(`Unexpected value for event passed to hook : '${e}'.
|
|
13
|
+
Expecting one of '${i.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,i){this._exitCallback&&this._exitCallback(new ki(e,t,i)),A.exit(e)}action(e){let t=i=>{let s=this.registeredArguments.length,r=i.slice(0,s);return this._storeOptionsAsProperties?r[s]=this:r[s]=this.opts(),r.push(this),e.apply(this,r)};return this._actionHandler=t,this}createOption(e,t){return new Rs(e,t)}_callParseArg(e,t,i,s){try{return e.parseArg(t,i)}catch(r){if(r.code==="commander.invalidArgument"){let o=`${s} ${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 i=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 '${i}'
|
|
14
|
+
- already used by option '${t.flags}'`)}this.options.push(e)}_registerCommand(e){let t=s=>[s.name()].concat(s.aliases()),i=t(e).find(s=>this._findCommand(s));if(i){let s=t(this._findCommand(i)).join("|"),r=t(e).join("|");throw new Error(`cannot add command '${r}' as already have command '${s}'`)}this.commands.push(e)}addOption(e){this._registerOption(e);let t=e.name(),i=e.attributeName();if(e.negate){let r=e.long.replace(/^--no-/,"--");this._findOption(r)||this.setOptionValueWithSource(i,e.defaultValue===void 0?!0:e.defaultValue,"default")}else e.defaultValue!==void 0&&this.setOptionValueWithSource(i,e.defaultValue,"default");let s=(r,o,a)=>{r==null&&e.presetArg!==void 0&&(r=e.presetArg);let l=this.getOptionValue(i);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(i,r,a)};return this.on("option:"+t,r=>{let o=`error: option '${e.flags}' argument '${r}' is invalid.`;s(r,o,"cli")}),e.envVar&&this.on("optionEnv:"+t,r=>{let o=`error: option '${e.flags}' value '${r}' from env '${e.envVar}' is invalid.`;s(r,o,"env")}),this}_optionEx(e,t,i,s,r){if(typeof t=="object"&&t instanceof Rs)throw new Error("To add an Option object use addOption() instead of option() or requiredOption()");let o=this.createOption(t,i);if(o.makeOptionMandatory(!!e.mandatory),typeof s=="function")o.default(r).argParser(s);else if(s instanceof RegExp){let a=s;s=(l,c)=>{let u=a.exec(l);return u?u[0]:c},o.default(r).argParser(s)}else o.default(s);return this.addOption(o)}option(e,t,i,s){return this._optionEx({},e,t,i,s)}requiredOption(e,t,i,s){return this._optionEx({mandatory:!0},e,t,i,s)}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,i){return this._storeOptionsAsProperties?this[e]=t:this._optionValues[e]=t,this._optionValueSources[e]=i,this}getOptionValueSource(e){return this._optionValueSources[e]}getOptionValueSourceWithGlobals(e){let t;return this._getCommandAndAncestors().forEach(i=>{i.getOptionValueSource(e)!==void 0&&(t=i.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){A.versions?.electron&&(t.from="electron");let s=A.execArgv??[];(s.includes("-e")||s.includes("--eval")||s.includes("-p")||s.includes("--print"))&&(t.from="eval")}e===void 0&&(e=A.argv),this.rawArgs=e.slice();let i;switch(t.from){case void 0:case"node":this._scriptPath=e[1],i=e.slice(2);break;case"electron":A.defaultApp?(this._scriptPath=e[1],i=e.slice(2)):i=e.slice(1);break;case"user":i=e.slice(0);break;case"eval":i=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",i}parse(e,t){let i=this._prepareUserArgs(e,t);return this._parseCommand([],i),this}async parseAsync(e,t){let i=this._prepareUserArgs(e,t);return await this._parseCommand([],i),this}_executeSubCommand(e,t){t=t.slice();let i=!1,s=[".js",".ts",".tsx",".mjs",".cjs"];function r(u,h){let p=ue.resolve(u,h);if(Ai.existsSync(p))return p;if(s.includes(ue.extname(h)))return;let d=s.find(m=>Ai.existsSync(`${p}${m}`));if(d)return`${p}${d}`}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let o=e._executableFile||`${this._name}-${e._name}`,a=this._executableDir||"";if(this._scriptPath){let u;try{u=Ai.realpathSync(this._scriptPath)}catch{u=this._scriptPath}a=ue.resolve(ue.dirname(u),a)}if(a){let u=r(a,o);if(!u&&!e._executableFile&&this._scriptPath){let h=ue.basename(this._scriptPath,ue.extname(this._scriptPath));h!==this._name&&(u=r(a,`${h}-${e._name}`))}o=u||o}i=s.includes(ue.extname(o));let l;A.platform!=="win32"?i?(t.unshift(o),t=Ts(A.execArgv).concat(t),l=Oi.spawn(A.argv[0],t,{stdio:"inherit"})):l=Oi.spawn(o,t,{stdio:"inherit"}):(t.unshift(o),t=Ts(A.execArgv).concat(t),l=Oi.spawn(A.execPath,t,{stdio:"inherit"})),l.killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(h=>{A.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 ki(u,"commander.executeSubCommandAsync","(close)")):A.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",p=`'${o}' does not exist
|
|
15
15
|
- if '${e._name}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
|
|
16
16
|
- if the default executable name is not suitable, use the executableFile option to supply a custom name or path
|
|
17
|
-
- ${h}`;throw new Error(
|
|
17
|
+
- ${h}`;throw new Error(p)}else if(u.code==="EACCES")throw new Error(`'${o}' not executable`);if(!c)A.exit(1);else{let h=new ki(1,"commander.executeSubCommandAsync","(error)");h.nestedError=u,c(h)}}),this.runningCommand=l}_dispatchSubcommand(e,t,i){let s=this._findCommand(e);s||this.help({error:!0});let r;return r=this._chainOrCallSubCommandHook(r,s,"preSubcommand"),r=this._chainOrCall(r,()=>{if(s._executableHandler)this._executeSubCommand(s,t.concat(i));else return s._parseCommand(t,i)}),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=(i,s,r)=>{let o=s;if(s!==null&&i.parseArg){let a=`error: command-argument value '${s}' is invalid for argument '${i.name()}'.`;o=this._callParseArg(i,s,r,a)}return o};this._checkNumberOfArguments();let t=[];this.registeredArguments.forEach((i,s)=>{let r=i.defaultValue;i.variadic?s<this.args.length?(r=this.args.slice(s),i.parseArg&&(r=r.reduce((o,a)=>e(i,a,o),i.defaultValue))):r===void 0&&(r=[]):s<this.args.length&&(r=this.args[s],i.parseArg&&(r=e(i,r,i.defaultValue))),t[s]=r}),this.processedArgs=t}_chainOrCall(e,t){return e&&e.then&&typeof e.then=="function"?e.then(()=>t()):t()}_chainOrCallHooks(e,t){let i=e,s=[];return this._getCommandAndAncestors().reverse().filter(r=>r._lifeCycleHooks[t]!==void 0).forEach(r=>{r._lifeCycleHooks[t].forEach(o=>{s.push({hookedCommand:r,callback:o})})}),t==="postAction"&&s.reverse(),s.forEach(r=>{i=this._chainOrCall(i,()=>r.callback(r.hookedCommand,this))}),i}_chainOrCallSubCommandHook(e,t,i){let s=e;return this._lifeCycleHooks[i]!==void 0&&this._lifeCycleHooks[i].forEach(r=>{s=this._chainOrCall(s,()=>r(this,t))}),s}_parseCommand(e,t){let i=this.parseOptions(t);if(this._parseOptionsEnv(),this._parseOptionsImplied(),e=e.concat(i.operands),t=i.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(i.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let s=()=>{i.unknown.length>0&&this.unknownOption(i.unknown[0])},r=`command:${this.name()}`;if(this._actionHandler){s(),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))s(),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():(s(),this._processArguments())}else this.commands.length?(s(),this.help({error:!0})):(s(),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(i=>{let s=i.attributeName();return this.getOptionValue(s)===void 0?!1:this.getOptionValueSource(s)!=="default"});e.filter(i=>i.conflictsWith.length>0).forEach(i=>{let s=e.find(r=>i.conflictsWith.includes(r.attributeName()));s&&this._conflictingOption(i,s)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(e=>{e._checkForConflictingLocalOptions()})}parseOptions(e){let t=[],i=[],s=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==="--"){s===i&&s.push(l),s.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)&&(s=i),(this._enablePositionalOptions||this._passThroughOptions)&&t.length===0&&i.length===0){if(this._findCommand(l)){t.push(l),r.length>0&&i.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){i.push(l),r.length>0&&i.push(...r);break}}if(this._passThroughOptions){s.push(l),r.length>0&&s.push(...r);break}s.push(l)}return{operands:t,unknown:i}}opts(){if(this._storeOptionsAsProperties){let e={},t=this.options.length;for(let i=0;i<t;i++){let s=this.options[i].attributeName();e[s]=s===this._versionOptionName?this._version:this[s]}return e}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce((e,t)=>Object.assign(e,t.opts()),{})}error(e,t){this._outputConfiguration.outputError(`${e}
|
|
18
18
|
`,this._outputConfiguration.writeErr),typeof this._showHelpAfterError=="string"?this._outputConfiguration.writeErr(`${this._showHelpAfterError}
|
|
19
19
|
`):this._showHelpAfterError&&(this._outputConfiguration.writeErr(`
|
|
20
|
-
`),this.outputHelp({error:!0}));let
|
|
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
|
|
22
|
-
Expecting one of '${
|
|
23
|
-
`)}),this}_outputHelpIfRequested(e){let t=this._getHelpOption();t&&e.find(
|
|
24
|
-
`)){let i
|
|
20
|
+
`),this.outputHelp({error:!0}));let i=t||{},s=i.exitCode||1,r=i.code||"commander.error";this._exit(s,r,e)}_parseOptionsEnv(){this.options.forEach(e=>{if(e.envVar&&e.envVar in A.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()}`,A.env[e.envVar]):this.emit(`optionEnv:${e.name()}`))}})}_parseOptionsImplied(){let e=new Ko(this.options),t=i=>this.getOptionValue(i)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(i));this.options.filter(i=>i.implied!==void 0&&t(i.attributeName())&&e.valueFromOption(this.getOptionValue(i.attributeName()),i)).forEach(i=>{Object.keys(i.implied).filter(s=>!t(s)).forEach(s=>{this.setOptionValueWithSource(s,i.implied[s],"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 i=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},s=o=>{let a=i(o),l=a.attributeName();return this.getOptionValueSource(l)==="env"?`environment variable '${a.envVar}'`:`option '${a.flags}'`},r=`error: ${s(e)} cannot be used with ${s(t)}`;this.error(r,{code:"commander.conflictingOption"})}unknownOption(e){if(this._allowUnknownOption)return;let t="";if(e.startsWith("--")&&this._showSuggestionAfterError){let s=[],r=this;do{let o=r.createHelp().visibleOptions(r).filter(a=>a.long).map(a=>a.long);s=s.concat(o),r=r.parent}while(r&&!r._enablePositionalOptions);t=js(e,s)}let i=`error: unknown option '${e}'${t}`;this.error(i,{code:"commander.unknownOption"})}_excessArguments(e){if(this._allowExcessArguments)return;let t=this.registeredArguments.length,i=t===1?"":"s",r=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${t} argument${i} but got ${e.length}.`;this.error(r,{code:"commander.excessArguments"})}unknownCommand(){let e=this.args[0],t="";if(this._showSuggestionAfterError){let s=[];this.createHelp().visibleCommands(this).forEach(r=>{s.push(r.name()),r.alias()&&s.push(r.alias())}),t=js(e,s)}let i=`error: unknown command '${e}'${t}`;this.error(i,{code:"commander.unknownCommand"})}version(e,t,i){if(e===void 0)return this._version;this._version=e,t=t||"-V, --version",i=i||"output the version number";let s=this.createOption(t,i);return this._versionOptionName=s.attributeName(),this._registerOption(s),this.on("option:"+s.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 i=this.parent?._findCommand(e);if(i){let s=[i.name()].concat(i.aliases()).join("|");throw new Error(`cannot add alias '${e}' to command '${this.name()}' as already have command '${s}'`)}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(i=>Jo(i));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=ue.basename(e,ue.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},i;return t.error?i=s=>this._outputConfiguration.writeErr(s):i=s=>this._outputConfiguration.writeOut(s),t.write=e.write||i,t.command=this,t}outputHelp(e){let t;typeof e=="function"&&(t=e,e=void 0);let i=this._getHelpContext(e);this._getCommandAndAncestors().reverse().forEach(r=>r.emit("beforeAllHelp",i)),this.emit("beforeHelp",i);let s=this.helpInformation(i);if(t&&(s=t(s),typeof s!="string"&&!Buffer.isBuffer(s)))throw new Error("outputHelp callback must return a string or a Buffer");i.write(s),this._getHelpOption()?.long&&this.emit(this._getHelpOption().long),this.emit("afterHelp",i),this._getCommandAndAncestors().forEach(r=>r.emit("afterAllHelp",i))}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=A.exitCode||0;t===0&&e&&typeof e!="function"&&e.error&&(t=1),this._exit(t,"commander.help","(outputHelp)")}addHelpText(e,t){let i=["beforeAll","before","after","afterAll"];if(!i.includes(e))throw new Error(`Unexpected value for position to addHelpText.
|
|
22
|
+
Expecting one of '${i.join("', '")}'`);let s=`${e}Help`;return this.on(s,r=>{let o;typeof t=="function"?o=t({error:r.error,command:r.command}):o=t,o&&r.write(`${o}
|
|
23
|
+
`)}),this}_outputHelpIfRequested(e){let t=this._getHelpOption();t&&e.find(s=>t.is(s))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}};function Ts(n){return n.map(e=>{if(!e.startsWith("--inspect"))return e;let t,i="127.0.0.1",s="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])?s=r[3]:i=r[3]):(r=e.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(t=r[1],i=r[3],s=r[4]),t&&s!=="0"?`${t}=${i}:${parseInt(s)+1}`:e})}Ps.Command=Fi});var Ds=O(Y=>{var{Argument:Is}=Ft(),{Command:Ri}=Ms(),{CommanderError:Xo,InvalidArgumentError:Ls}=rt(),{Help:Zo}=Si(),{Option:Ns}=$i();Y.program=new Ri;Y.createCommand=n=>new Ri(n);Y.createOption=(n,e)=>new Ns(n,e);Y.createArgument=(n,e)=>new Is(n,e);Y.Command=Ri;Y.Option=Ns;Y.Argument=Is;Y.Help=Zo;Y.CommanderError=Xo;Y.InvalidArgumentError=Ls;Y.InvalidOptionArgumentError=Ls});var Ti=O((Ah,Bs)=>{"use strict";var Hs=require("fs"),ji;function Qo(){try{return Hs.statSync("/.dockerenv"),!0}catch{return!1}}function ea(){try{return Hs.readFileSync("/proc/self/cgroup","utf8").includes("docker")}catch{return!1}}Bs.exports=()=>(ji===void 0&&(ji=Qo()||ea()),ji)});var qs=O((kh,Pi)=>{"use strict";var ta=require("os"),ia=require("fs"),Us=Ti(),zs=()=>{if(process.platform!=="linux")return!1;if(ta.release().toLowerCase().includes("microsoft"))return!Us();try{return ia.readFileSync("/proc/version","utf8").toLowerCase().includes("microsoft")?!Us():!1}catch{return!1}};process.env.__IS_WSL_TEST__?Pi.exports=zs:Pi.exports=zs()});var Js=O((Fh,Gs)=>{"use strict";Gs.exports=(n,e,t)=>{let i=s=>Object.defineProperty(n,e,{value:s,enumerable:!0,writable:!0});return Object.defineProperty(n,e,{configurable:!0,enumerable:!0,get(){let s=t();return i(s),s},set(s){i(s)}}),n}});var Le=O((Rh,en)=>{var sa=require("path"),na=require("child_process"),{promises:jt,constants:Qs}=require("fs"),Rt=qs(),ra=Ti(),Ii=Js(),Ys=sa.join(__dirname,"xdg-open"),{platform:Ie,arch:Ks}=process,oa=()=>{try{return jt.statSync("/run/.containerenv"),!0}catch{return!1}},Mi;function aa(){return Mi===void 0&&(Mi=oa()||ra()),Mi}var la=(()=>{let n="/mnt/",e;return async function(){if(e)return e;let t="/etc/wsl.conf",i=!1;try{await jt.access(t,Qs.F_OK),i=!0}catch{}if(!i)return n;let s=await jt.readFile(t,{encoding:"utf8"}),r=/(?<!#.*)root\s*=\s*(?<mountPoint>.*)/g.exec(s);return r?(e=r.groups.mountPoint.trim(),e=e.endsWith("/")?e:`${e}/`,e):n}})(),Xs=async(n,e)=>{let t;for(let i of n)try{return await e(i)}catch(s){t=s}throw t},Tt=async n=>{if(n={wait:!1,background:!1,newInstance:!1,allowNonzeroExitCode:!1,...n},Array.isArray(n.app))return Xs(n.app,a=>Tt({...n,app:a}));let{name:e,arguments:t=[]}=n.app||{};if(t=[...t],Array.isArray(e))return Xs(e,a=>Tt({...n,app:{name:a,arguments:t}}));let i,s=[],r={};if(Ie==="darwin")i="open",n.wait&&s.push("--wait-apps"),n.background&&s.push("--background"),n.newInstance&&s.push("--new"),e&&s.push("-a",e);else if(Ie==="win32"||Rt&&!aa()&&!e){let a=await la();i=Rt?`${a}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe`:`${process.env.SYSTEMROOT}\\System32\\WindowsPowerShell\\v1.0\\powershell`,s.push("-NoProfile","-NonInteractive","\u2013ExecutionPolicy","Bypass","-EncodedCommand"),Rt||(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)i=e;else{let a=!__dirname||__dirname==="/",l=!1;try{await jt.access(Ys,Qs.X_OK),l=!0}catch{}i=process.versions.electron||Ie==="android"||a||!l?"xdg-open":Ys}t.length>0&&s.push(...t),n.wait||(r.stdio="ignore",r.detached=!0)}n.target&&s.push(n.target),Ie==="darwin"&&t.length>0&&s.push("--args",...t);let o=na.spawn(i,s,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)},Li=(n,e)=>{if(typeof n!="string")throw new TypeError("Expected a `target`");return Tt({...e,target:n})},ca=(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 Tt({...e,app:{name:n,arguments:t}})};function Zs(n){if(typeof n=="string"||Array.isArray(n))return n;let{[Ks]:e}=n;if(!e)throw new Error(`${Ks} is not supported`);return e}function Ni({[Ie]:n},{wsl:e}){if(e&&Rt)return Zs(e);if(!n)throw new Error(`${Ie} is not supported`);return Zs(n)}var Pt={};Ii(Pt,"chrome",()=>Ni({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"]}}));Ii(Pt,"firefox",()=>Ni({darwin:"firefox",win32:"C:\\Program Files\\Mozilla Firefox\\firefox.exe",linux:"firefox"},{wsl:"/mnt/c/Program Files/Mozilla Firefox/firefox.exe"}));Ii(Pt,"edge",()=>Ni({darwin:"microsoft edge",win32:"msedge",linux:["microsoft-edge","microsoft-edge-dev"]},{wsl:"/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe"}));Li.apps=Pt;Li.openApp=ca;en.exports=Li});function ua(n){q.existsSync(n)||q.mkdirSync(n,{recursive:!0})}function be(){let n=process.env.HYV_API_KEY;if(n)return{api_key:n,base_url:process.env.HYV_BASE_URL||"https://holdyourvoice.com"};try{let e=q.readFileSync(sn,"utf-8"),t=JSON.parse(e);return t.api_key?t:null}catch{return null}}function Mt(n){ua(Di),q.writeFileSync(sn,JSON.stringify(n,null,2))}function It(){let n=Oe.join(process.cwd(),".hyv.yml");if(!q.existsSync(n))return{};try{let e=q.readFileSync(n,"utf-8"),t={};for(let i of e.split(`
|
|
24
|
+
`)){let s=i.trim();if(!s||s.startsWith("#"))continue;let r=s.indexOf(":");if(r===-1)continue;let o=s.slice(0,r).trim(),a=s.slice(r+1).trim();o==="profile"?t.profile=a:o==="scan_paths"?t.scan_paths=a.split(",").map(l=>l.trim()):o==="ignore"&&(t.ignore=a.split(",").map(l=>l.trim()))}return t}catch{return{}}}function Wi(n){let e=Oe.join(process.cwd(),".hyv.yml"),t=["# hold your voice \u2014 project config"];n.profile&&t.push(`profile: ${n.profile}`),n.scan_paths?.length&&t.push(`scan_paths: ${n.scan_paths.join(", ")}`),q.writeFileSync(e,t.join(`
|
|
25
25
|
`)+`
|
|
26
|
-
`)}function Bi(n){let e=Ee.join(Xo,`${n}.md`);try{return z.readFileSync(e,"utf-8")}catch{return null}}var z,Ee,Hi,Cs,Vi,Xo,Te=fi(()=>{"use strict";z=A(require("fs")),Ee=A(require("path")),Hi=A(require("os")),Cs=Ee.join(Hi.homedir(),".hyv"),Vi=Ee.join(Cs,"credentials.json"),Xo=Ee.join(Cs,"profiles")});var zi={};_o(zi,{apiGet:()=>V,apiPost:()=>Me});async function Ui(n,e,t){let s=je();if(!s)throw new Error("Not authenticated. Run: hyv init");let i=`${s.base_url||Qo}${e}`,r={method:n,headers:{Authorization:`Bearer ${s.api_key}`,"Content-Type":"application/json"}};t&&(r.body=JSON.stringify(t));let o=await fetch(i,r);if(o.status===401)throw new Error("Session expired. Run: hyv init");if(o.status===403)throw new Error("Access denied. Check your subscription at holdyourvoice.com/dashboard");if(!o.ok){let a=await o.text().catch(()=>"");throw new Error(`API error (${o.status}): ${a.slice(0,200)}`)}return o.json()}function V(n){return Ui("GET",n)}function Me(n,e){return Ui("POST",n,e)}var Qo,ue=fi(()=>{"use strict";Te();Qo="https://holdyourvoice.com"});var qi=O((ch,Gi)=>{"use strict";Gi.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 Os=O((hh,Ji)=>{var Ze=qi(),Yi={};for(let n of Object.keys(Ze))Yi[Ze[n]]=n;var w={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"]}};Ji.exports=w;for(let n of Object.keys(w)){if(!("channels"in w[n]))throw new Error("missing channels property: "+n);if(!("labels"in w[n]))throw new Error("missing channel labels property: "+n);if(w[n].labels.length!==w[n].channels)throw new Error("channel and label counts mismatch: "+n);let{channels:e,labels:t}=w[n];delete w[n].channels,delete w[n].labels,Object.defineProperty(w[n],"channels",{value:e}),Object.defineProperty(w[n],"labels",{value:t})}w.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]};w.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(g){return(c-g)/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]};w.rgb.hwb=function(n){let e=n[0],t=n[1],s=n[2],i=w.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]};w.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 ea(n,e){return(n[0]-e[0])**2+(n[1]-e[1])**2+(n[2]-e[2])**2}w.rgb.keyword=function(n){let e=Yi[n];if(e)return e;let t=1/0,s;for(let i of Object.keys(Ze)){let r=Ze[i],o=ea(n,r);o<t&&(t=o,s=i)}return s};w.keyword.rgb=function(n){return Ze[n]};w.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]};w.rgb.lab=function(n){let e=w.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]};w.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};w.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]};w.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]}};w.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]};w.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]};w.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]};w.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]};w.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]};w.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]};w.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]};w.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]};w.rgb.ansi16=function(n,e=null){let[t,s,i]=n,r=e===null?w.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};w.hsv.ansi16=function(n){return w.rgb.ansi16(w.hsv.rgb(n),n[2])};w.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)};w.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]};w.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]};w.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};w.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]};w.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]};w.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]};w.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]};w.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]};w.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]};w.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]};w.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]};w.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]};w.apple.rgb=function(n){return[n[0]/65535*255,n[1]/65535*255,n[2]/65535*255]};w.rgb.apple=function(n){return[n[0]/255*65535,n[1]/255*65535,n[2]/255*65535]};w.gray.rgb=function(n){return[n[0]/100*255,n[0]/100*255,n[0]/100*255]};w.gray.hsl=function(n){return[0,0,n[0]]};w.gray.hsv=w.gray.hsl;w.gray.hwb=function(n){return[0,100,n[0]]};w.gray.cmyk=function(n){return[0,0,0,n[0]]};w.gray.lab=function(n){return[n[0],0,0]};w.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};w.rgb.gray=function(n){return[(n[0]+n[1]+n[2])/3/255*100]}});var Xi=O((uh,Ki)=>{var At=Os();function ta(){let n={},e=Object.keys(At);for(let t=e.length,s=0;s<t;s++)n[e[s]]={distance:-1,parent:null};return n}function sa(n){let e=ta(),t=[n];for(e[n].distance=0;t.length;){let s=t.pop(),i=Object.keys(At[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 ia(n,e){return function(t){return e(n(t))}}function na(n,e){let t=[e[n].parent,n],s=At[e[n].parent][n],i=e[n].parent;for(;e[i].parent;)t.unshift(e[i].parent),s=ia(At[e[i].parent][i],s),i=e[i].parent;return s.conversion=t,s}Ki.exports=function(n){let e=sa(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]=na(o,e))}return t}});var Qi=O((fh,Zi)=>{var As=Os(),ra=Xi(),Pe={},oa=Object.keys(As);function aa(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 la(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}oa.forEach(n=>{Pe[n]={},Object.defineProperty(Pe[n],"channels",{value:As[n].channels}),Object.defineProperty(Pe[n],"labels",{value:As[n].labels});let e=ra(n);Object.keys(e).forEach(s=>{let i=e[s];Pe[n][s]=la(i),Pe[n][s].raw=aa(i)})});Zi.exports=Pe});var on=O((dh,rn)=>{"use strict";var en=(n,e)=>(...t)=>`\x1B[${n(...t)+e}m`,tn=(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`},$t=n=>n,nn=(n,e,t)=>[n,e,t],Ie=(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})},$s,Le=(n,e,t,s)=>{$s===void 0&&($s=Qi());let i=s?10:0,r={};for(let[o,a]of Object.entries($s)){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 ca(){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",Ie(e.color,"ansi",()=>Le(en,"ansi16",$t,!1)),Ie(e.color,"ansi256",()=>Le(tn,"ansi256",$t,!1)),Ie(e.color,"ansi16m",()=>Le(sn,"rgb",nn,!1)),Ie(e.bgColor,"ansi",()=>Le(en,"ansi16",$t,!0)),Ie(e.bgColor,"ansi256",()=>Le(tn,"ansi256",$t,!0)),Ie(e.bgColor,"ansi16m",()=>Le(sn,"rgb",nn,!0)),e}Object.defineProperty(rn,"exports",{enumerable:!0,get:ca})});var ln=O((gh,an)=>{"use strict";an.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 un=O((ph,hn)=>{"use strict";var ha=require("os"),cn=require("tty"),J=ln(),{env:T}=process,ye;J("no-color")||J("no-colors")||J("color=false")||J("color=never")?ye=0:(J("color")||J("colors")||J("color=true")||J("color=always"))&&(ye=1);"FORCE_COLOR"in T&&(T.FORCE_COLOR==="true"?ye=1:T.FORCE_COLOR==="false"?ye=0:ye=T.FORCE_COLOR.length===0?1:Math.min(parseInt(T.FORCE_COLOR,10),3));function ks(n){return n===0?!1:{level:n,hasBasic:!0,has256:n>=2,has16m:n>=3}}function Fs(n,e){if(ye===0)return 0;if(J("color=16m")||J("color=full")||J("color=truecolor"))return 3;if(J("color=256"))return 2;if(n&&!e&&ye===void 0)return 0;let t=ye||0;if(T.TERM==="dumb")return t;if(process.platform==="win32"){let s=ha.release().split(".");return Number(s[0])>=10&&Number(s[2])>=10586?Number(s[2])>=14931?3:2:1}if("CI"in T)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some(s=>s in T)||T.CI_NAME==="codeship"?1:t;if("TEAMCITY_VERSION"in T)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(T.TEAMCITY_VERSION)?1:0;if(T.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in T){let s=parseInt((T.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(T.TERM_PROGRAM){case"iTerm.app":return s>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(T.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(T.TERM)||"COLORTERM"in T?1:t}function ua(n){let e=Fs(n,n&&n.isTTY);return ks(e)}hn.exports={supportsColor:ua,stdout:ks(Fs(!0,cn.isatty(1))),stderr:ks(Fs(!0,cn.isatty(2)))}});var dn=O((mh,fn)=>{"use strict";var fa=(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},da=(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
|
|
26
|
+
`)}function nn(n){let e=Oe.join(ha,`${n}.md`);try{return q.readFileSync(e,"utf-8")}catch{return null}}var q,Oe,tn,Di,sn,ha,Ae=Os(()=>{"use strict";q=C(require("fs")),Oe=C(require("path")),tn=C(require("os")),Di=Oe.join(tn.homedir(),".hyv"),sn=Oe.join(Di,"credentials.json"),ha=Oe.join(Di,"profiles")});var Vi={};Io(Vi,{apiGet:()=>N,apiPost:()=>fe});async function rn(n,e,t){let i=be();if(!i)throw new Error("Not authenticated. Run: hyv init");let s=`${i.base_url||fa}${e}`,r={method:n,headers:{Authorization:`Bearer ${i.api_key}`,"Content-Type":"application/json"}};t&&(r.body=JSON.stringify(t));let o=await fetch(s,r);if(o.status===401)throw new Error("Session expired. Run: hyv init");if(o.status===403)throw new Error("Access denied. Check your subscription at holdyourvoice.com/dashboard");if(!o.ok){let a=await o.text().catch(()=>"");throw new Error(`API error (${o.status}): ${a.slice(0,200)}`)}return o.json()}function N(n){return rn("GET",n)}function fe(n,e){return rn("POST",n,e)}var fa,te=Os(()=>{"use strict";Ae();fa="https://holdyourvoice.com"});var an=O((Ph,on)=>{"use strict";on.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 Hi=O((Mh,cn)=>{var ot=an(),ln={};for(let n of Object.keys(ot))ln[ot[n]]=n;var w={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=w;for(let n of Object.keys(w)){if(!("channels"in w[n]))throw new Error("missing channels property: "+n);if(!("labels"in w[n]))throw new Error("missing channel labels property: "+n);if(w[n].labels.length!==w[n].channels)throw new Error("channel and label counts mismatch: "+n);let{channels:e,labels:t}=w[n];delete w[n].channels,delete w[n].labels,Object.defineProperty(w[n],"channels",{value:e}),Object.defineProperty(w[n],"labels",{value:t})}w.rgb.hsl=function(n){let e=n[0]/255,t=n[1]/255,i=n[2]/255,s=Math.min(e,t,i),r=Math.max(e,t,i),o=r-s,a,l;r===s?a=0:e===r?a=(t-i)/o:t===r?a=2+(i-e)/o:i===r&&(a=4+(e-t)/o),a=Math.min(a*60,360),a<0&&(a+=360);let c=(s+r)/2;return r===s?l=0:c<=.5?l=o/(r+s):l=o/(2-r-s),[a,l*100,c*100]};w.rgb.hsv=function(n){let e,t,i,s,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(p){return(c-p)/6/u+1/2};return u===0?(s=0,r=0):(r=u/c,e=h(o),t=h(a),i=h(l),o===c?s=i-t:a===c?s=1/3+e-i:l===c&&(s=2/3+t-e),s<0?s+=1:s>1&&(s-=1)),[s*360,r*100,c*100]};w.rgb.hwb=function(n){let e=n[0],t=n[1],i=n[2],s=w.rgb.hsl(n)[0],r=1/255*Math.min(e,Math.min(t,i));return i=1-1/255*Math.max(e,Math.max(t,i)),[s,r*100,i*100]};w.rgb.cmyk=function(n){let e=n[0]/255,t=n[1]/255,i=n[2]/255,s=Math.min(1-e,1-t,1-i),r=(1-e-s)/(1-s)||0,o=(1-t-s)/(1-s)||0,a=(1-i-s)/(1-s)||0;return[r*100,o*100,a*100,s*100]};function da(n,e){return(n[0]-e[0])**2+(n[1]-e[1])**2+(n[2]-e[2])**2}w.rgb.keyword=function(n){let e=ln[n];if(e)return e;let t=1/0,i;for(let s of Object.keys(ot)){let r=ot[s],o=da(n,r);o<t&&(t=o,i=s)}return i};w.keyword.rgb=function(n){return ot[n]};w.rgb.xyz=function(n){let e=n[0]/255,t=n[1]/255,i=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,i=i>.04045?((i+.055)/1.055)**2.4:i/12.92;let s=e*.4124+t*.3576+i*.1805,r=e*.2126+t*.7152+i*.0722,o=e*.0193+t*.1192+i*.9505;return[s*100,r*100,o*100]};w.rgb.lab=function(n){let e=w.rgb.xyz(n),t=e[0],i=e[1],s=e[2];t/=95.047,i/=100,s/=108.883,t=t>.008856?t**(1/3):7.787*t+16/116,i=i>.008856?i**(1/3):7.787*i+16/116,s=s>.008856?s**(1/3):7.787*s+16/116;let r=116*i-16,o=500*(t-i),a=200*(i-s);return[r,o,a]};w.hsl.rgb=function(n){let e=n[0]/360,t=n[1]/100,i=n[2]/100,s,r,o;if(t===0)return o=i*255,[o,o,o];i<.5?s=i*(1+t):s=i+t-i*t;let a=2*i-s,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+(s-a)*6*r:2*r<1?o=s:3*r<2?o=a+(s-a)*(2/3-r)*6:o=a,l[c]=o*255;return l};w.hsl.hsv=function(n){let e=n[0],t=n[1]/100,i=n[2]/100,s=t,r=Math.max(i,.01);i*=2,t*=i<=1?i:2-i,s*=r<=1?r:2-r;let o=(i+t)/2,a=i===0?2*s/(r+s):2*t/(i+t);return[e,a*100,o*100]};w.hsv.rgb=function(n){let e=n[0]/60,t=n[1]/100,i=n[2]/100,s=Math.floor(e)%6,r=e-Math.floor(e),o=255*i*(1-t),a=255*i*(1-t*r),l=255*i*(1-t*(1-r));switch(i*=255,s){case 0:return[i,l,o];case 1:return[a,i,o];case 2:return[o,i,l];case 3:return[o,a,i];case 4:return[l,o,i];case 5:return[i,o,a]}};w.hsv.hsl=function(n){let e=n[0],t=n[1]/100,i=n[2]/100,s=Math.max(i,.01),r,o;o=(2-t)*i;let a=(2-t)*s;return r=t*s,r/=a<=1?a:2-a,r=r||0,o/=2,[e,r*100,o*100]};w.hwb.rgb=function(n){let e=n[0]/360,t=n[1]/100,i=n[2]/100,s=t+i,r;s>1&&(t/=s,i/=s);let o=Math.floor(6*e),a=1-i;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]};w.cmyk.rgb=function(n){let e=n[0]/100,t=n[1]/100,i=n[2]/100,s=n[3]/100,r=1-Math.min(1,e*(1-s)+s),o=1-Math.min(1,t*(1-s)+s),a=1-Math.min(1,i*(1-s)+s);return[r*255,o*255,a*255]};w.xyz.rgb=function(n){let e=n[0]/100,t=n[1]/100,i=n[2]/100,s,r,o;return s=e*3.2406+t*-1.5372+i*-.4986,r=e*-.9689+t*1.8758+i*.0415,o=e*.0557+t*-.204+i*1.057,s=s>.0031308?1.055*s**(1/2.4)-.055:s*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,s=Math.min(Math.max(0,s),1),r=Math.min(Math.max(0,r),1),o=Math.min(Math.max(0,o),1),[s*255,r*255,o*255]};w.xyz.lab=function(n){let e=n[0],t=n[1],i=n[2];e/=95.047,t/=100,i/=108.883,e=e>.008856?e**(1/3):7.787*e+16/116,t=t>.008856?t**(1/3):7.787*t+16/116,i=i>.008856?i**(1/3):7.787*i+16/116;let s=116*t-16,r=500*(e-t),o=200*(t-i);return[s,r,o]};w.lab.xyz=function(n){let e=n[0],t=n[1],i=n[2],s,r,o;r=(e+16)/116,s=t/500+r,o=r-i/200;let a=r**3,l=s**3,c=o**3;return r=a>.008856?a:(r-16/116)/7.787,s=l>.008856?l:(s-16/116)/7.787,o=c>.008856?c:(o-16/116)/7.787,s*=95.047,r*=100,o*=108.883,[s,r,o]};w.lab.lch=function(n){let e=n[0],t=n[1],i=n[2],s;s=Math.atan2(i,t)*360/2/Math.PI,s<0&&(s+=360);let o=Math.sqrt(t*t+i*i);return[e,o,s]};w.lch.lab=function(n){let e=n[0],t=n[1],s=n[2]/360*2*Math.PI,r=t*Math.cos(s),o=t*Math.sin(s);return[e,r,o]};w.rgb.ansi16=function(n,e=null){let[t,i,s]=n,r=e===null?w.rgb.hsv(n)[2]:e;if(r=Math.round(r/50),r===0)return 30;let o=30+(Math.round(s/255)<<2|Math.round(i/255)<<1|Math.round(t/255));return r===2&&(o+=60),o};w.hsv.ansi16=function(n){return w.rgb.ansi16(w.hsv.rgb(n),n[2])};w.rgb.ansi256=function(n){let e=n[0],t=n[1],i=n[2];return e===t&&t===i?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(i/255*5)};w.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,i=(e&1)*t*255,s=(e>>1&1)*t*255,r=(e>>2&1)*t*255;return[i,s,r]};w.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,i=Math.floor((e=n%36)/6)/5*255,s=e%6/5*255;return[t,i,s]};w.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};w.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 i=parseInt(t,16),s=i>>16&255,r=i>>8&255,o=i&255;return[s,r,o]};w.rgb.hcg=function(n){let e=n[0]/255,t=n[1]/255,i=n[2]/255,s=Math.max(Math.max(e,t),i),r=Math.min(Math.min(e,t),i),o=s-r,a,l;return o<1?a=r/(1-o):a=0,o<=0?l=0:s===e?l=(t-i)/o%6:s===t?l=2+(i-e)/o:l=4+(e-t)/o,l/=6,l%=1,[l*360,o*100,a*100]};w.hsl.hcg=function(n){let e=n[1]/100,t=n[2]/100,i=t<.5?2*e*t:2*e*(1-t),s=0;return i<1&&(s=(t-.5*i)/(1-i)),[n[0],i*100,s*100]};w.hsv.hcg=function(n){let e=n[1]/100,t=n[2]/100,i=e*t,s=0;return i<1&&(s=(t-i)/(1-i)),[n[0],i*100,s*100]};w.hcg.rgb=function(n){let e=n[0]/360,t=n[1]/100,i=n[2]/100;if(t===0)return[i*255,i*255,i*255];let s=[0,0,0],r=e%1*6,o=r%1,a=1-o,l=0;switch(Math.floor(r)){case 0:s[0]=1,s[1]=o,s[2]=0;break;case 1:s[0]=a,s[1]=1,s[2]=0;break;case 2:s[0]=0,s[1]=1,s[2]=o;break;case 3:s[0]=0,s[1]=a,s[2]=1;break;case 4:s[0]=o,s[1]=0,s[2]=1;break;default:s[0]=1,s[1]=0,s[2]=a}return l=(1-t)*i,[(t*s[0]+l)*255,(t*s[1]+l)*255,(t*s[2]+l)*255]};w.hcg.hsv=function(n){let e=n[1]/100,t=n[2]/100,i=e+t*(1-e),s=0;return i>0&&(s=e/i),[n[0],s*100,i*100]};w.hcg.hsl=function(n){let e=n[1]/100,i=n[2]/100*(1-e)+.5*e,s=0;return i>0&&i<.5?s=e/(2*i):i>=.5&&i<1&&(s=e/(2*(1-i))),[n[0],s*100,i*100]};w.hcg.hwb=function(n){let e=n[1]/100,t=n[2]/100,i=e+t*(1-e);return[n[0],(i-e)*100,(1-i)*100]};w.hwb.hcg=function(n){let e=n[1]/100,i=1-n[2]/100,s=i-e,r=0;return s<1&&(r=(i-s)/(1-s)),[n[0],s*100,r*100]};w.apple.rgb=function(n){return[n[0]/65535*255,n[1]/65535*255,n[2]/65535*255]};w.rgb.apple=function(n){return[n[0]/255*65535,n[1]/255*65535,n[2]/255*65535]};w.gray.rgb=function(n){return[n[0]/100*255,n[0]/100*255,n[0]/100*255]};w.gray.hsl=function(n){return[0,0,n[0]]};w.gray.hsv=w.gray.hsl;w.gray.hwb=function(n){return[0,100,n[0]]};w.gray.cmyk=function(n){return[0,0,0,n[0]]};w.gray.lab=function(n){return[n[0],0,0]};w.gray.hex=function(n){let e=Math.round(n[0]/100*255)&255,i=((e<<16)+(e<<8)+e).toString(16).toUpperCase();return"000000".substring(i.length)+i};w.rgb.gray=function(n){return[(n[0]+n[1]+n[2])/3/255*100]}});var un=O((Ih,hn)=>{var Lt=Hi();function pa(){let n={},e=Object.keys(Lt);for(let t=e.length,i=0;i<t;i++)n[e[i]]={distance:-1,parent:null};return n}function ga(n){let e=pa(),t=[n];for(e[n].distance=0;t.length;){let i=t.pop(),s=Object.keys(Lt[i]);for(let r=s.length,o=0;o<r;o++){let a=s[o],l=e[a];l.distance===-1&&(l.distance=e[i].distance+1,l.parent=i,t.unshift(a))}}return e}function ma(n,e){return function(t){return e(n(t))}}function ya(n,e){let t=[e[n].parent,n],i=Lt[e[n].parent][n],s=e[n].parent;for(;e[s].parent;)t.unshift(e[s].parent),i=ma(Lt[e[s].parent][s],i),s=e[s].parent;return i.conversion=t,i}hn.exports=function(n){let e=ga(n),t={},i=Object.keys(e);for(let s=i.length,r=0;r<s;r++){let o=i[r];e[o].parent!==null&&(t[o]=ya(o,e))}return t}});var dn=O((Lh,fn)=>{var Bi=Hi(),ba=un(),Ne={},wa=Object.keys(Bi);function va(n){let e=function(...t){let i=t[0];return i==null?i:(i.length>1&&(t=i),n(t))};return"conversion"in n&&(e.conversion=n.conversion),e}function xa(n){let e=function(...t){let i=t[0];if(i==null)return i;i.length>1&&(t=i);let s=n(t);if(typeof s=="object")for(let r=s.length,o=0;o<r;o++)s[o]=Math.round(s[o]);return s};return"conversion"in n&&(e.conversion=n.conversion),e}wa.forEach(n=>{Ne[n]={},Object.defineProperty(Ne[n],"channels",{value:Bi[n].channels}),Object.defineProperty(Ne[n],"labels",{value:Bi[n].labels});let e=ba(n);Object.keys(e).forEach(i=>{let s=e[i];Ne[n][i]=xa(s),Ne[n][i].raw=va(s)})});fn.exports=Ne});var wn=O((Nh,bn)=>{"use strict";var pn=(n,e)=>(...t)=>`\x1B[${n(...t)+e}m`,gn=(n,e)=>(...t)=>{let i=n(...t);return`\x1B[${38+e};5;${i}m`},mn=(n,e)=>(...t)=>{let i=n(...t);return`\x1B[${38+e};2;${i[0]};${i[1]};${i[2]}m`},Nt=n=>n,yn=(n,e,t)=>[n,e,t],De=(n,e,t)=>{Object.defineProperty(n,e,{get:()=>{let i=t();return Object.defineProperty(n,e,{value:i,enumerable:!0,configurable:!0}),i},enumerable:!0,configurable:!0})},Ui,We=(n,e,t,i)=>{Ui===void 0&&(Ui=dn());let s=i?10:0,r={};for(let[o,a]of Object.entries(Ui)){let l=o==="ansi16"?"ansi":o;o===e?r[l]=n(t,s):typeof a=="object"&&(r[l]=n(a[e],s))}return r};function Sa(){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,i]of Object.entries(e)){for(let[s,r]of Object.entries(i))e[s]={open:`\x1B[${r[0]}m`,close:`\x1B[${r[1]}m`},i[s]=e[s],n.set(r[0],r[1]);Object.defineProperty(e,t,{value:i,enumerable:!1})}return Object.defineProperty(e,"codes",{value:n,enumerable:!1}),e.color.close="\x1B[39m",e.bgColor.close="\x1B[49m",De(e.color,"ansi",()=>We(pn,"ansi16",Nt,!1)),De(e.color,"ansi256",()=>We(gn,"ansi256",Nt,!1)),De(e.color,"ansi16m",()=>We(mn,"rgb",yn,!1)),De(e.bgColor,"ansi",()=>We(pn,"ansi16",Nt,!0)),De(e.bgColor,"ansi256",()=>We(gn,"ansi256",Nt,!0)),De(e.bgColor,"ansi16m",()=>We(mn,"rgb",yn,!0)),e}Object.defineProperty(bn,"exports",{enumerable:!0,get:Sa})});var xn=O((Dh,vn)=>{"use strict";vn.exports=(n,e=process.argv)=>{let t=n.startsWith("-")?"":n.length===1?"-":"--",i=e.indexOf(t+n),s=e.indexOf("--");return i!==-1&&(s===-1||i<s)}});var Cn=O((Wh,_n)=>{"use strict";var _a=require("os"),Sn=require("tty"),K=xn(),{env:P}=process,we;K("no-color")||K("no-colors")||K("color=false")||K("color=never")?we=0:(K("color")||K("colors")||K("color=true")||K("color=always"))&&(we=1);"FORCE_COLOR"in P&&(P.FORCE_COLOR==="true"?we=1:P.FORCE_COLOR==="false"?we=0:we=P.FORCE_COLOR.length===0?1:Math.min(parseInt(P.FORCE_COLOR,10),3));function zi(n){return n===0?!1:{level:n,hasBasic:!0,has256:n>=2,has16m:n>=3}}function qi(n,e){if(we===0)return 0;if(K("color=16m")||K("color=full")||K("color=truecolor"))return 3;if(K("color=256"))return 2;if(n&&!e&&we===void 0)return 0;let t=we||0;if(P.TERM==="dumb")return t;if(process.platform==="win32"){let i=_a.release().split(".");return Number(i[0])>=10&&Number(i[2])>=10586?Number(i[2])>=14931?3:2:1}if("CI"in P)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some(i=>i in P)||P.CI_NAME==="codeship"?1:t;if("TEAMCITY_VERSION"in P)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(P.TEAMCITY_VERSION)?1:0;if(P.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in P){let i=parseInt((P.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(P.TERM_PROGRAM){case"iTerm.app":return i>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(P.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(P.TERM)||"COLORTERM"in P?1:t}function Ca(n){let e=qi(n,n&&n.isTTY);return zi(e)}_n.exports={supportsColor:Ca,stdout:zi(qi(!0,Sn.isatty(1))),stderr:zi(qi(!0,Sn.isatty(2)))}});var $n=O((Vh,En)=>{"use strict";var Ea=(n,e,t)=>{let i=n.indexOf(e);if(i===-1)return n;let s=e.length,r=0,o="";do o+=n.substr(r,i-r)+e+t,r=i+s,i=n.indexOf(e,r);while(i!==-1);return o+=n.substr(r),o},$a=(n,e,t,i)=>{let s=0,r="";do{let o=n[i-1]==="\r";r+=n.substr(s,(o?i-1:i)-s)+e+(o?`\r
|
|
27
27
|
`:`
|
|
28
|
-
`)+t,i
|
|
29
|
-
`,
|
|
30
|
-
`],["r","\r"],["t"," "],["b","\b"],["f","\f"],["v","\v"],["0","\0"],["\\","\\"],["e","\x1B"],["a","\x07"]]);function
|
|
31
|
-
`);return r!==-1&&(e=
|
|
28
|
+
`)+t,s=i+1,i=n.indexOf(`
|
|
29
|
+
`,s)}while(i!==-1);return r+=n.substr(s),r};En.exports={stringReplaceAll:Ea,stringEncaseCRLFWithFirstIndex:$a}});var Rn=O((Hh,Fn)=>{"use strict";var Oa=/(?:\\(u(?:[a-f\d]{4}|\{[a-f\d]{1,6}\})|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi,On=/(?:^|\.)(\w+)(?:\(([^)]*)\))?/g,Aa=/^(['"])((?:\\.|(?!\1)[^\\])*)\1$/,ka=/\\(u(?:[a-f\d]{4}|{[a-f\d]{1,6}})|x[a-f\d]{2}|.)|([^\\])/gi,Fa=new Map([["n",`
|
|
30
|
+
`],["r","\r"],["t"," "],["b","\b"],["f","\f"],["v","\v"],["0","\0"],["\\","\\"],["e","\x1B"],["a","\x07"]]);function kn(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)):Fa.get(n)||n}function Ra(n,e){let t=[],i=e.trim().split(/\s*,\s*/g),s;for(let r of i){let o=Number(r);if(!Number.isNaN(o))t.push(o);else if(s=r.match(Aa))t.push(s[2].replace(ka,(a,l,c)=>l?kn(l):c));else throw new Error(`Invalid Chalk template style argument: ${r} (in style '${n}')`)}return t}function ja(n){On.lastIndex=0;let e=[],t;for(;(t=On.exec(n))!==null;){let i=t[1];if(t[2]){let s=Ra(i,t[2]);e.push([i].concat(s))}else e.push([i])}return e}function An(n,e){let t={};for(let s of e)for(let r of s.styles)t[r[0]]=s.inverse?null:r.slice(1);let i=n;for(let[s,r]of Object.entries(t))if(Array.isArray(r)){if(!(s in i))throw new Error(`Unknown Chalk style: ${s}`);i=r.length>0?i[s](...r):i[s]}return i}Fn.exports=(n,e)=>{let t=[],i=[],s=[];if(e.replace(Oa,(r,o,a,l,c,u)=>{if(o)s.push(kn(o));else if(l){let h=s.join("");s=[],i.push(t.length===0?h:An(n,t)(h)),t.push({inverse:a,styles:ja(l)})}else if(c){if(t.length===0)throw new Error("Found extraneous } in Chalk template literal");i.push(An(n,t)(s.join(""))),s=[],t.pop()}else s.push(u)}),i.push(s.join("")),t.length>0){let r=`Chalk template literal is missing ${t.length} closing bracket${t.length===1?"":"s"} (\`}\`)`;throw new Error(r)}return i.join("")}});var Nn=O((Bh,Ln)=>{"use strict";var at=wn(),{stdout:Ji,stderr:Yi}=Cn(),{stringReplaceAll:Ta,stringEncaseCRLFWithFirstIndex:Pa}=$n(),{isArray:Dt}=Array,Tn=["ansi","ansi","ansi256","ansi16m"],Ve=Object.create(null),Ma=(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=Ji?Ji.level:0;n.level=e.level===void 0?t:e.level},Ki=class{constructor(e){return Pn(e)}},Pn=n=>{let e={};return Ma(e,n),e.template=(...t)=>In(e.template,...t),Object.setPrototypeOf(e,Wt.prototype),Object.setPrototypeOf(e.template,e),e.template.constructor=()=>{throw new Error("`chalk.constructor()` is deprecated. Use `new chalk.Instance()` instead.")},e.template.Instance=Ki,e.template};function Wt(n){return Pn(n)}for(let[n,e]of Object.entries(at))Ve[n]={get(){let t=Vt(this,Xi(e.open,e.close,this._styler),this._isEmpty);return Object.defineProperty(this,n,{value:t}),t}};Ve.visible={get(){let n=Vt(this,this._styler,!0);return Object.defineProperty(this,"visible",{value:n}),n}};var Mn=["rgb","hex","keyword","hsl","hsv","hwb","ansi","ansi256"];for(let n of Mn)Ve[n]={get(){let{level:e}=this;return function(...t){let i=Xi(at.color[Tn[e]][n](...t),at.color.close,this._styler);return Vt(this,i,this._isEmpty)}}};for(let n of Mn){let e="bg"+n[0].toUpperCase()+n.slice(1);Ve[e]={get(){let{level:t}=this;return function(...i){let s=Xi(at.bgColor[Tn[t]][n](...i),at.bgColor.close,this._styler);return Vt(this,s,this._isEmpty)}}}}var Ia=Object.defineProperties(()=>{},{...Ve,level:{enumerable:!0,get(){return this._generator.level},set(n){this._generator.level=n}}}),Xi=(n,e,t)=>{let i,s;return t===void 0?(i=n,s=e):(i=t.openAll+n,s=e+t.closeAll),{open:n,close:e,openAll:i,closeAll:s,parent:t}},Vt=(n,e,t)=>{let i=(...s)=>Dt(s[0])&&Dt(s[0].raw)?jn(i,In(i,...s)):jn(i,s.length===1?""+s[0]:s.join(" "));return Object.setPrototypeOf(i,Ia),i._generator=n,i._styler=e,i._isEmpty=t,i},jn=(n,e)=>{if(n.level<=0||!e)return n._isEmpty?"":e;let t=n._styler;if(t===void 0)return e;let{openAll:i,closeAll:s}=t;if(e.indexOf("\x1B")!==-1)for(;t!==void 0;)e=Ta(e,t.close,t.open),t=t.parent;let r=e.indexOf(`
|
|
31
|
+
`);return r!==-1&&(e=Pa(e,s,i,r)),i+e+s},Gi,In=(n,...e)=>{let[t]=e;if(!Dt(t)||!Dt(t.raw))return e.join(" ");let i=e.slice(1),s=[t.raw[0]];for(let r=1;r<t.length;r++)s.push(String(i[r-1]).replace(/[{}\\]/g,"\\$&"),String(t.raw[r]));return Gi===void 0&&(Gi=Rn()),Gi(n,s.join(""))};Object.defineProperties(Wt.prototype,Ve);var Ht=Wt();Ht.supportsColor=Ji;Ht.stderr=Wt({level:Yi?Yi.level:0});Ht.stderr.supportsColor=Yi;Ln.exports=Ht});var Kn=O((Yh,Yn)=>{"use strict";Yn.exports=Gn;function Gn(n,e,t){n instanceof RegExp&&(n=qn(n,t)),e instanceof RegExp&&(e=qn(e,t));var i=Jn(n,e,t);return i&&{start:i[0],end:i[1],pre:t.slice(0,i[0]),body:t.slice(i[0]+n.length,i[1]),post:t.slice(i[1]+e.length)}}function qn(n,e){var t=e.match(n);return t?t[0]:null}Gn.range=Jn;function Jn(n,e,t){var i,s,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(i=[],r=t.length;u>=0&&!a;)u==l?(i.push(u),l=t.indexOf(n,u+1)):i.length==1?a=[i.pop(),c]:(s=i.pop(),s<r&&(r=s,o=c),c=t.indexOf(e,u+1)),u=l<c&&l>=0?l:c;i.length&&(a=[r,o])}return a}});var nr=O((Kh,sr)=>{var Xn=Kn();sr.exports=za;var Zn="\0SLASH"+Math.random()+"\0",Qn="\0OPEN"+Math.random()+"\0",ts="\0CLOSE"+Math.random()+"\0",er="\0COMMA"+Math.random()+"\0",tr="\0PERIOD"+Math.random()+"\0";function es(n){return parseInt(n,10)==n?parseInt(n,10):n.charCodeAt(0)}function Ba(n){return n.split("\\\\").join(Zn).split("\\{").join(Qn).split("\\}").join(ts).split("\\,").join(er).split("\\.").join(tr)}function Ua(n){return n.split(Zn).join("\\").split(Qn).join("{").split(ts).join("}").split(er).join(",").split(tr).join(".")}function ir(n){if(!n)return[""];var e=[],t=Xn("{","}",n);if(!t)return n.split(",");var i=t.pre,s=t.body,r=t.post,o=i.split(",");o[o.length-1]+="{"+s+"}";var a=ir(r);return r.length&&(o[o.length-1]+=a.shift(),o.push.apply(o,a)),e.push.apply(e,o),e}function za(n,e){if(!n)return[];e=e||{};var t=e.max==null?1/0:e.max;return n.substr(0,2)==="{}"&&(n="\\{\\}"+n.substr(2)),ht(Ba(n),t,!0).map(Ua)}function qa(n){return"{"+n+"}"}function Ga(n){return/^-?0\d/.test(n)}function Ja(n,e){return n<=e}function Ya(n,e){return n>=e}function ht(n,e,t){var i=[],s=Xn("{","}",n);if(!s)return[n];var r=s.pre,o=s.post.length?ht(s.post,e,!1):[""];if(/\$$/.test(s.pre))for(var a=0;a<o.length&&a<e;a++){var l=r+"{"+s.body+"}"+o[a];i.push(l)}else{var c=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(s.body),u=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(s.body),h=c||u,p=s.body.indexOf(",")>=0;if(!h&&!p)return s.post.match(/,(?!,).*\}/)?(n=s.pre+"{"+s.body+ts+s.post,ht(n,e,!0)):[n];var d;if(h)d=s.body.split(/\.\./);else if(d=ir(s.body),d.length===1&&(d=ht(d[0],e,!1).map(qa),d.length===1))return o.map(function(Fo){return s.pre+d[0]+Fo});var m;if(h){var g=es(d[0]),y=es(d[1]),b=Math.max(d[0].length,d[1].length),v=d.length==3?Math.max(Math.abs(es(d[2])),1):1,x=Ja,S=y<g;S&&(v*=-1,x=Ya);var $=d.some(Ga);m=[];for(var z=g;x(z,y)&&m.length<e;z+=v){var j;if(u)j=String.fromCharCode(z),j==="\\"&&(j="");else if(j=String(z),$){var $e=b-j.length;if($e>0){var Me=new Array($e+1).join("0");z<0?j="-"+Me+j.slice(1):j=Me+j}}m.push(j)}}else{m=[];for(var ae=0;ae<d.length;ae++)m.push.apply(m,ht(d[ae],e,!1))}for(var ae=0;ae<m.length;ae++)for(var a=0;a<o.length&&i.length<e;a++){var l=r+m[ae]+o[a];(!t||h||l)&&i.push(l)}}return i}});var Ws=C(Ds(),1),{program:yh,createCommand:bh,createArgument:wh,createOption:vh,CommanderError:xh,InvalidArgumentError:Sh,InvalidOptionArgumentError:_h,Command:Vs,Argument:Ch,Option:Eh,Help:$h}=Ws.default;var Hn=C(require("http")),T=C(require("fs")),R=C(require("path")),Bn=C(require("os")),Un=C(Le());Ae();te();var de=C(Nn()),f={dim:n=>de.default.dim(n),bold:n=>de.default.bold(n),accent:n=>de.default.hex("#C4441A")(n),green:n=>de.default.green(n),red:n=>de.default.red(n),yellow:n=>de.default.yellow(n),cyan:n=>de.default.cyan(n),white:n=>de.default.white(n)};function E(){return`${f.bold("hold your ")}${f.accent("voice")}`}function Dn(n){let e=n.severity==="red"?f.red("\u25CF"):f.yellow("\u25CF"),t=f.dim(`${n.file}:${n.line}`),i=f.dim(n.pattern);console.log(` ${e} ${t} ${i}`),console.log(` ${n.excerpt}`)}function Wn(n){if(console.log(""),console.log(` ${f.bold("scanned")} ${f.cyan(String(n.files))} files, ${f.cyan(String(n.total_lines))} lines`),n.red+n.yellow===0)console.log(` ${f.green("\u2713 clean \u2014 no issues found")}`);else{let e=[];n.red&&e.push(f.red(`${n.red} critical`)),n.yellow&&e.push(f.yellow(`${n.yellow} advisory`)),console.log(` ${e.join(", ")}`)}}var ke=process.env.HYV_BASE_URL||"https://holdyourvoice.com",He=Bn.homedir(),Vn=process.platform==="win32",Qi=R.join(He,".hyv"),Be=R.join(Qi,"voice.md"),lt=`# Hold Your Voice
|
|
32
|
+
|
|
33
|
+
The user's voice profile is at \`~/.hyv/voice.md\`. Read it before rewriting.
|
|
32
34
|
|
|
33
35
|
When the user mentions "voice", "brand voice", "hyv", "write in my voice", or "rewrite in my voice":
|
|
34
36
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
\`\`\`
|
|
42
|
-
Or if no profile mentioned, use the default:
|
|
43
|
-
\`\`\`bash
|
|
44
|
-
hyv rewrite --text "the captured text"
|
|
45
|
-
\`\`\`
|
|
46
|
-
3. Read the structured prompt from stdout
|
|
47
|
-
4. Execute the rewrite following the prompt's instructions
|
|
48
|
-
5. Present the rewritten text directly in the conversation
|
|
37
|
+
1. Read the voice profile: \`~/.hyv/voice.md\`
|
|
38
|
+
2. Capture the text to rewrite (previous message, code block, file, etc.)
|
|
39
|
+
3. Run: \`hyv rewrite --text "the captured text"\`
|
|
40
|
+
4. Read the structured prompt from stdout
|
|
41
|
+
5. Execute the rewrite following the prompt's instructions
|
|
42
|
+
6. Present the rewritten text directly
|
|
49
43
|
|
|
50
44
|
## File rewrite
|
|
51
|
-
|
|
52
45
|
\`\`\`bash
|
|
53
|
-
hyv rewrite <
|
|
46
|
+
hyv rewrite <file.md>
|
|
54
47
|
\`\`\`
|
|
55
48
|
|
|
56
49
|
## Scan for issues
|
|
57
|
-
|
|
58
50
|
\`\`\`bash
|
|
59
|
-
hyv scan
|
|
51
|
+
hyv scan <file.md>
|
|
60
52
|
\`\`\`
|
|
61
53
|
|
|
62
54
|
## Rules
|
|
63
|
-
|
|
64
|
-
- The CLI never calls an LLM. It generates prompts. **You** execute the rewrite.
|
|
55
|
+
- The CLI generates prompts. **You** execute the rewrite.
|
|
65
56
|
- Preserve original meaning. Match the voice profile's rhythm, vocabulary, patterns.
|
|
66
57
|
- If no profile specified, check \`.hyv.yml\` or ask the user.
|
|
67
|
-
- If CLI not installed: \`
|
|
68
|
-
|
|
58
|
+
- If CLI not installed: \`npm i -g @holdyourvoice/hyv\` then \`hyv init\`
|
|
59
|
+
`;function Ue(n){T.existsSync(n)||T.mkdirSync(n,{recursive:!0})}function ct(n,e,t="Hold Your Voice"){return T.existsSync(n)?T.readFileSync(n,"utf-8").includes(t)?!1:(T.appendFileSync(n,`
|
|
69
60
|
|
|
70
|
-
|
|
61
|
+
`+e),!0):(Ue(R.dirname(n)),T.writeFileSync(n,e),!0)}async function La(){Ue(Qi);try{let e=(await N("/cli/profiles")).profiles||[];if(e.length===0)return!1;let t=[`# Voice Profile
|
|
62
|
+
`];for(let i of e)t.push(`## ${i.name}${i.is_default?" (default)":""}`),i.brand&&t.push(`Brand: ${i.brand}`),i.description&&t.push(i.description),i.keywords?.length&&t.push(`Keywords: ${i.keywords.join(", ")}`),t.push("");return T.writeFileSync(Be,t.join(`
|
|
63
|
+
`)),!0}catch{return!1}}function Na(){if(T.existsSync(Be))return;Ue(Qi);let n=`# Voice Profile
|
|
71
64
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
3. Read the structured prompt from stdout
|
|
75
|
-
4. Execute the rewrite and present it
|
|
65
|
+
This file is your cross-platform voice profile.
|
|
66
|
+
All agents (Claude, ChatGPT, Codex, Cursor) read this file when rewriting in your voice.
|
|
76
67
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
`,Tt=`# Hold Your Voice (HYV)
|
|
68
|
+
Run \`hyv export claude -o ~/.hyv/voice.md\` to populate with your actual voice profile.
|
|
69
|
+
Or create a voice profile at: ${ke}/app/voice
|
|
80
70
|
|
|
81
|
-
|
|
71
|
+
## Instructions for agents
|
|
82
72
|
|
|
83
|
-
|
|
84
|
-
|
|
73
|
+
When the user asks to rewrite text "in my voice":
|
|
74
|
+
1. Read this file for voice context
|
|
75
|
+
2. Run: hyv rewrite --text "text to rewrite"
|
|
85
76
|
3. Execute the rewrite from the prompt output
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
${
|
|
99
|
-
`)
|
|
100
|
-
`);let r=`${Ne}/api/cli/auth?port=${i}`,o=new Promise((a,l)=>{let c=setTimeout(()=>{s.close(),l(new Error("Authentication timed out (5 minutes)"))},3e5);s.on("request",(u,h)=>{let g=new URL(u.url||"/",`http://127.0.0.1:${i}`),d=g.searchParams.get("token"),m=g.searchParams.get("email"),p=g.searchParams.get("name"),y=g.searchParams.get("error");if(y){h.writeHead(302,{Location:`${Ne}/dashboard?cli_error=${encodeURIComponent(y)}`}),h.end(),clearTimeout(c),s.close(),l(new Error(y));return}if(d){h.writeHead(200,{"Content-Type":"text/html"}),h.end(`<!DOCTYPE html><html><body style="font-family:sans-serif;text-align:center;padding:60px">
|
|
77
|
+
`;T.writeFileSync(Be,n)}function Da(){let n=R.join(He,"Library","Application Support","Claude"),e=R.join(n,"claude_desktop_config.json"),t=R.join(He,"AppData","Roaming","Claude"),i=R.join(t,"claude_desktop_config.json"),s=Vn?i:e;if(!T.existsSync(Vn?t:n))return!1;let o={};if(T.existsSync(s))try{o=JSON.parse(T.readFileSync(s,"utf-8"))}catch{o={}}if(o.mcpServers||(o.mcpServers={}),o.mcpServers.hyv)return!1;o.mcpServers.hyv={command:"hyv",args:["mcp"]};try{return T.writeFileSync(s,JSON.stringify(o,null,2)),!0}catch{return!1}}function Wa(){let n=R.join(He,".chatgpt");Ue(n);let e=`Hold Your Voice \u2014 Voice Profile Integration
|
|
78
|
+
|
|
79
|
+
The user's voice profile is at: ${Be}
|
|
80
|
+
|
|
81
|
+
When the user says "rewrite in my voice" or mentions "hyv" or "brand voice":
|
|
82
|
+
1. Ask the user to paste their voice profile from ${Be}
|
|
83
|
+
2. Rewrite their text matching the profile's rhythm, vocabulary, and patterns
|
|
84
|
+
3. Never use AI-slop words (delve, leverage, tapestry, foster, harness, pivotal)
|
|
85
|
+
4. Preserve original meaning exactly
|
|
86
|
+
5. Remove patterns like "not just X, but Y" and "the truth is"
|
|
87
|
+
`,t=R.join(n,"hyv-instructions.txt");return T.writeFileSync(t,e),!0}function Va(){let n=process.cwd(),e=[],t=[],i=[{dir:R.join(n,".claude","commands"),scope:"project"},{dir:R.join(He,".claude","commands"),scope:"global"}];for(let{dir:l,scope:c}of i){Ue(l);let u=R.join(l,"hyv.md");ct(u,lt)&&e.push(`claude-code (${c})`)}let s=R.join(n,"CLAUDE.md");ct(s,lt)&&e.push("CLAUDE.md");let r=[{file:R.join(n,"AGENTS.md"),scope:"project"},{file:R.join(He,".codex","AGENTS.md"),scope:"global"}];for(let{file:l,scope:c}of r)Ue(R.dirname(l)),ct(l,lt)&&e.push(`codex (${c})`);let o=R.join(n,".cursorrules");ct(o,lt)&&e.push("cursor");let a=R.join(n,".windsurfrules");return ct(a,lt)&&e.push("windsurf"),Da()&&e.push("claude-desktop (mcp)"),Wa()&&t.push("chatgpt"),{installed:e,needsConfig:t}}async function zn(n,e){if(e?.quiet||console.log(`
|
|
88
|
+
${E()}
|
|
89
|
+
`),e?.key){await Ha(e.key),await Zi(n,e?.quiet);return}let t=be();if(t)try{await N("/cli/heartbeat"),e?.quiet||console.log(` ${f.green("\u2713")} already authenticated as ${f.dim(t.user_email||"unknown")}`),n&&(Wi({profile:n}),e?.quiet||console.log(` ${f.green("\u2713")} default profile set to ${f.bold(n)}`)),await Zi(n,e?.quiet);return}catch{e?.quiet||console.log(` ${f.dim("credentials expired, re-authenticating...")}`)}let i=Hn.createServer(),s=await new Promise(a=>{i.listen(0,"127.0.0.1",()=>{a(i.address().port)})});e?.quiet||(console.log(" opening browser for authentication..."),console.log(` ${f.dim("if the browser doesn't open, visit the URL manually")}
|
|
90
|
+
`));let r=`${ke}/api/cli/auth?port=${s}`,o=new Promise((a,l)=>{let c=setTimeout(()=>{i.close(),l(new Error("Authentication timed out (5 minutes)"))},3e5);i.on("request",(u,h)=>{let p=new URL(u.url||"/",`http://127.0.0.1:${s}`),d=p.searchParams.get("token"),m=p.searchParams.get("email"),g=p.searchParams.get("name"),y=p.searchParams.get("error");if(y){h.writeHead(302,{Location:`${ke}/dashboard?cli_error=${encodeURIComponent(y)}`}),h.end(),clearTimeout(c),i.close(),l(new Error(y));return}if(d){h.writeHead(200,{"Content-Type":"text/html"}),h.end(`<!DOCTYPE html><html><body style="font-family:sans-serif;text-align:center;padding:60px">
|
|
101
91
|
<h2 style="color:#1A7A4A">\u2713 authenticated</h2>
|
|
102
92
|
<p>you can close this tab and return to your terminal.</p>
|
|
103
93
|
<script>setTimeout(() => window.close(), 2000)</script>
|
|
104
|
-
</body></html>`),clearTimeout(c),
|
|
105
|
-
`)}try{let{api_key:a,email:l,name:c}=await o;
|
|
106
|
-
${f.red("\u2717")} authentication failed: ${a.message}`),process.exit(1)}}function
|
|
107
|
-
${f.green("\u2713")}
|
|
108
|
-
${f.
|
|
109
|
-
${f.dim("no agents detected in this directory")}`),console.log(` ${f.dim("agent files are included in the package at:")} node_modules/@holdyourvoice/hyv/agents/`)}async function Ea(n){Et({api_key:n,base_url:Ne});try{let e=await V("/cli/heartbeat");Et({api_key:n,base_url:Ne,user_email:e.email,user_name:e.name}),console.log(` ${f.green("\u2713")} authenticated with license key`)}catch(e){console.log(` ${f.red("\u2717")} invalid license key: ${e.message}`),process.exit(1)}}var Ke=A(require("fs")),ri=A(require("path"));var Zn=A(Bn(),1);var tt=n=>{if(typeof n!="string")throw new TypeError("invalid pattern");if(n.length>65536)throw new TypeError("pattern is too long")};var Ta={"[: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]},st=n=>n.replace(/[[\]\\-]/g,"\\$&"),Ma=n=>n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),Un=n=>n.join(""),zn=(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,[b,x,v]]of Object.entries(Ta))if(n.startsWith(y,r)){if(h)return["$.",!1,n.length-t,!0];r+=y.length,v?i.push(b):s.push(b),a=a||x;continue e}}if(l=!1,h){p>h?s.push(st(h)+"-"+st(p)):p===h&&s.push(st(p)),h="",r++;continue}if(n.startsWith("-]",r+1)){s.push(st(p+"-")),r+=2;continue}if(n.startsWith("-",r+1)){h=p,r+=2;continue}s.push(st(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[Ma(p),!1,u-t,!1]}let g="["+(c?"^":"")+Un(s)+"]",d="["+(c?"":"^")+Un(i)+"]";return[s.length&&i.length?"("+g+"|"+d+")":s.length?g:d,a,u-t,!0]};var te=(n,{windowsPathsNoEscape:e=!1}={})=>e?n.replace(/\[([^\/\\])\]/g,"$1"):n.replace(/((?!\\).|^)\[([^\/\\])\]/g,"$1$2").replace(/\\([^\/])/g,"$1");var B,Pa=new Set(["!","?","+","*","@"]),Hs=n=>Pa.has(n),Gn=n=>Hs(n.type),Ia=new Map([["!",["@"]],["?",["?","@"]],["@",["@"]],["*",["*","+","?","@"]],["+",["+","@"]]]),La=new Map([["!",["?"]],["@",["?"]],["+",["?","*"]]]),Da=new Map([["!",["?","@"]],["?",["?","@"]],["@",["?","@"]],["*",["*","+","?","@"]],["+",["+","@","?","*"]]]),qn=new Map([["!",new Map([["!","@"]])],["?",new Map([["*","*"],["+","*"]])],["@",new Map([["!","!"],["?","?"],["@","@"],["*","*"],["+","+"]])],["+",new Map([["?","*"],["*","*"]])]]),Na="(?!(?:^|/)\\.\\.?(?:$|/))",Mt="(?!\\.)",Wa=new Set(["[","."]),Ha=new Set(["..","."]),Va=new Set("().*{}+?[]^$\\!"),Ba=n=>n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),Vs="[^/]",Yn=Vs+"*?",Jn=Vs+"+?",Oe=class{type;#e;#s;#n=!1;#t=[];#o;#v;#c;#u=!1;#l;#a;#r=!1;constructor(e,t,s={}){this.type=e,e&&(this.#s=!0),this.#o=t,this.#e=this.#o?this.#o.#e:this,this.#l=this.#e===this?s:this.#e.#l,this.#c=this.#e===this?[]:this.#e.#c,e==="!"&&!this.#e.#u&&this.#c.push(this),this.#v=this.#o?this.#o.#t.length:0}get hasMagic(){if(this.#s!==void 0)return this.#s;for(let e of this.#t)if(typeof e!="string"&&(e.type||e.hasMagic))return this.#s=!0;return this.#s}toString(){return this.#a!==void 0?this.#a:this.type?this.#a=this.type+"("+this.#t.map(e=>String(e)).join("|")+")":this.#a=this.#t.map(e=>String(e)).join("")}#y(){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.#c.pop();){if(e.type!=="!")continue;let t=e,s=t.#o;for(;s;){for(let i=t.#v+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 B&&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.#v===0)return!0;let e=this.#o;for(let t=0;t<this.#v;t++){let s=e.#t[t];if(!(s instanceof B&&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.#v===e-1}copyIn(e){typeof e=="string"?this.push(e):this.push(e.clone(this))}clone(e){let t=new B(this.type,e);for(let s of this.#t)t.copyIn(s);return t}static#b(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 b=e.charAt(p++);if(a||b==="\\"){a=!a,y+=b;continue}if(l){p===c+1?(b==="^"||b==="!")&&(u=!0):b==="]"&&!(p===c+2&&u)&&(l=!1),y+=b;continue}else if(b==="["){l=!0,c=p,u=!1,y+=b;continue}if(!i.noext&&Hs(b)&&e.charAt(p)==="("&&r<=o){t.push(y),y="";let v=new B(b,t);p=B.#b(e,v,p,i,r+1),t.push(v);continue}y+=b}return t.push(y),p}let h=s+1,g=new B(null,t),d=[],m="";for(;h<e.length;){let p=e.charAt(h++);if(a||p==="\\"){a=!a,m+=p;continue}if(l){h===c+1?(p==="^"||p==="!")&&(u=!0):p==="]"&&!(h===c+2&&u)&&(l=!1),m+=p;continue}else if(p==="["){l=!0,c=h,u=!1,m+=p;continue}if(Hs(p)&&e.charAt(h)==="("&&(r<=o||t&&t.#S(p))){let b=t&&t.#S(p)?0:1;g.push(m),m="";let x=new B(p,g);g.push(x),h=B.#b(e,x,h,i,r+b);continue}if(p==="|"){g.push(m),m="",d.push(g),g=new B(null,t);continue}if(p===")")return m===""&&t.#t.length===0&&(t.#r=!0),g.push(m),m="",t.push(...d,g),h;m+=p}return t.type=null,t.#s=void 0,t.#t=[e.substring(s-1)],h}#p(e){return this.#d(e,La)}#d(e,t=Ia){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.#S(s.type,t)}#S(e,t=Da){return!!t.get(this.type)?.includes(e)}#g(e,t){let s=e.#t[0],i=new B(null,s,this.options);i.#t.push(""),s.push(i),this.#C(e,t)}#C(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.#a=void 0}#E(e){return!!qn.get(this.type)?.has(e)}#m(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.#E(t.type)}#_(e){let t=qn.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.#a=void 0,this.#r=!1}#w(){if(Gn(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.#w(),this.#d(i)?(t=!1,this.#C(i,s)):this.#p(i)?(t=!1,this.#g(i,s)):this.#m(i)&&(t=!1,this.#_(i)))}}while(!t&&++e<10)}else for(let e of this.#t)typeof e=="object"&&e.#w();this.#a=void 0}static fromGlob(e,t={}){let s=new B(null,void 0,t);return B.#b(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.#s||this.#l.nocase&&!this.#l.nocaseMagicOnly&&e.toUpperCase()!==e.toLowerCase()))return s;let a=(this.#l.nocase?"i":"")+(r?"u":"");return Object.assign(new RegExp(`^${t}$`,a),{_src:t,_glob:e})}get options(){return this.#l}toRegExpSource(e){let t=e??!!this.#l.dot;if(this.#e===this&&(this.#w(),this.#y()),!Gn(this)){let l=this.isStart()&&this.isEnd(),c=this.#t.map(d=>{let[m,p,y,b]=typeof d=="string"?B.#O(d,this.#s,l):d.toRegExpSource(e);return this.#s=this.#s||y,this.#n=this.#n||b,m}).join(""),u="";if(this.isStart()&&typeof this.#t[0]=="string"&&!(this.#t.length===1&&Ha.has(this.#t[0]))){let m=Wa,p=t&&m.has(c.charAt(0))||c.startsWith("\\.")&&m.has(c.charAt(2))||c.startsWith("\\.\\.")&&m.has(c.charAt(4)),y=!t&&!e&&m.has(c.charAt(0));u=p?Na:y?Mt:""}let h="";return this.isEnd()&&this.#e.#u&&this.#o?.type==="!"&&(h="(?:$|\\/)"),[u+c+h,te(c),this.#s=!!this.#s,this.#n]}let s=this.type==="*"||this.type==="+",i=this.type==="!"?"(?:(?!(?:":"(?:",r=this.#f(t);if(this.isStart()&&this.isEnd()&&!r&&this.type!=="!"){let l=this.toString(),c=this;return c.#t=[l],c.type=null,c.#s=void 0,[l,te(this.toString()),!1,!1]}let o=!s||e||t||!Mt?"":this.#f(!0);o===r&&(o=""),o&&(r=`(?:${r})(?:${o})*?`);let a="";if(this.type==="!"&&this.#r)a=(this.isStart()&&!t?Mt:"")+Jn;else{let l=this.type==="!"?"))"+(this.isStart()&&!t&&!e?Mt:"")+Yn+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&o?")":this.type==="*"&&o?")?":`)${this.type}`;a=i+r+l}return[a,te(r),this.#s=!!this.#s,this.#n]}#f(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#O(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+=(Va.has(c)?"\\":"")+c,a=!1;continue}if(c==="\\"){l===e.length-1?r+="\\\\":i=!0;continue}if(c==="["){let[u,h,g,d]=zn(e,l);if(g){r+=u,o=o||h,l+=g-1,t=t||d,a=!1;continue}}if(c==="*"){if(a)continue;a=!0,r+=s&&/^[*]+$/.test(e)?Jn:Yn,t=!0;continue}else a=!1;if(c==="?"){r+=Vs,t=!0;continue}r+=Ba(c)}return[r,te(e),!!t,o]}};B=Oe;var We=(n,{windowsPathsNoEscape:e=!1}={})=>e?n.replace(/[?*()[\]]/g,"[$&]"):n.replace(/[?*()[\]\\]/g,"\\$&");var W=(n,e,t={})=>(tt(e),!t.nocomment&&e.charAt(0)==="#"?!1:new G(e,t).match(n)),Ua=/^\*+([^+@!?\*\[\(]*)$/,za=n=>e=>!e.startsWith(".")&&e.endsWith(n),Ga=n=>e=>e.endsWith(n),qa=n=>(n=n.toLowerCase(),e=>!e.startsWith(".")&&e.toLowerCase().endsWith(n)),Ya=n=>(n=n.toLowerCase(),e=>e.toLowerCase().endsWith(n)),Ja=/^\*+\.\*+$/,Ka=n=>!n.startsWith(".")&&n.includes("."),Xa=n=>n!=="."&&n!==".."&&n.includes("."),Za=/^\.\*+$/,Qa=n=>n!=="."&&n!==".."&&n.startsWith("."),el=/^\*+$/,tl=n=>n.length!==0&&!n.startsWith("."),sl=n=>n.length!==0&&n!=="."&&n!=="..",il=/^\?+([^+@!?\*\[\(]*)?$/,nl=([n,e=""])=>{let t=Qn([n]);return e?(e=e.toLowerCase(),s=>t(s)&&s.toLowerCase().endsWith(e)):t},rl=([n,e=""])=>{let t=er([n]);return e?(e=e.toLowerCase(),s=>t(s)&&s.toLowerCase().endsWith(e)):t},ol=([n,e=""])=>{let t=er([n]);return e?s=>t(s)&&s.endsWith(e):t},al=([n,e=""])=>{let t=Qn([n]);return e?s=>t(s)&&s.endsWith(e):t},Qn=([n])=>{let e=n.length;return t=>t.length===e&&!t.startsWith(".")},er=([n])=>{let e=n.length;return t=>t.length===e&&t!=="."&&t!==".."},tr=typeof process=="object"&&process?typeof process.env=="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",Kn={win32:{sep:"\\"},posix:{sep:"/"}},ll=tr==="win32"?Kn.win32.sep:Kn.posix.sep;W.sep=ll;var F=Symbol("globstar **");W.GLOBSTAR=F;var cl="[^/]",hl=cl+"*?",ul="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",fl="(?:(?!(?:\\/|^)\\.).)*?",dl=(n,e={})=>t=>W(t,n,e);W.filter=dl;var K=(n,e={})=>Object.assign({},n,e),gl=n=>{if(!n||typeof n!="object"||!Object.keys(n).length)return W;let e=W;return Object.assign((s,i,r={})=>e(s,i,K(n,r)),{Minimatch:class extends e.Minimatch{constructor(i,r={}){super(i,K(n,r))}static defaults(i){return e.defaults(K(n,i)).Minimatch}},AST:class extends e.AST{constructor(i,r,o={}){super(i,r,K(n,o))}static fromGlob(i,r={}){return e.AST.fromGlob(i,K(n,r))}},unescape:(s,i={})=>e.unescape(s,K(n,i)),escape:(s,i={})=>e.escape(s,K(n,i)),filter:(s,i={})=>e.filter(s,K(n,i)),defaults:s=>e.defaults(K(n,s)),makeRe:(s,i={})=>e.makeRe(s,K(n,i)),braceExpand:(s,i={})=>e.braceExpand(s,K(n,i)),match:(s,i,r={})=>e.match(s,i,K(n,r)),sep:e.sep,GLOBSTAR:F})};W.defaults=gl;var sr=(n,e={})=>(tt(n),e.nobrace||!/\{(?:(?!\{).)*\}/.test(n)?[n]:(0,Zn.default)(n));W.braceExpand=sr;var pl=(n,e={})=>new G(n,e).makeRe();W.makeRe=pl;var ml=(n,e,t={})=>{let s=new G(e,t);return n=n.filter(i=>s.match(i)),s.options.nonull&&!n.length&&n.push(e),n};W.match=ml;var Xn=/[?*]|[+@!]\(.*?\)|\[|\]/,yl=n=>n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),G=class{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;maxGlobstarRecursion;regexp;constructor(e,t={}){tt(e),t=t||{},this.options=t,this.maxGlobstarRecursion=t.maxGlobstarRecursion??200,this.pattern=e,this.platform=t.platform||tr,this.isWindows=this.platform==="win32",this.windowsPathsNoEscape=!!t.windowsPathsNoEscape||t.allowWindowsEscape===!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]==="?"||!Xn.test(r[2]))&&!Xn.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=0;s<e.length;s++)for(let i=0;i<e[s].length;i++)e[s][i]==="**"&&(e[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!=="**"&&(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,g=u?3:c?0:void 0;if(typeof h=="number"&&typeof g=="number"){let[d,m]=[e[h],t[g]];d.toLowerCase()===m.toLowerCase()&&(t[g]=d,r=g,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}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 v=i;v<e.length-h;v++){let S=String(e[v]);if(x=!0,S==="."||S===".."||!this.options.dot&&S.startsWith("."))return!1}return s||x}let g=[[[],0]],d=g[0],m=0,p=[0];for(let x of c)x===F?(p.push(m),d=[[],0],g.push(d)):(d[0].push(x),m++);let y=g.length-1,b=e.length-h;for(let x of g)x[1]=b-(p[y--]+x[0].length);return!!this.#s(e,g,i,0,s,0,!!h)}#s(e,t,s,i,r,o,a){let l=t[i];if(!l){for(let h=s;h<e.length;h++){a=!0;let g=e[h];if(g==="."||g===".."||!this.options.dot&&g.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.#s(e,t,s+c.length,i+1,r,o+1,a);if(d!==!1)return d}let g=e[s];if(g==="."||g===".."||!this.options.dot&&g.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 g;if(typeof u=="string"?(g=h===u,this.debug("string match",u,h,g)):(g=u.test(h),this.debug("pattern match",u,h,g)),!g)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 sr(this.pattern,this.options)}parse(e){tt(e);let t=this.options;if(e==="**")return F;if(e==="")return"";let s,i=null;(s=e.match(el))?i=t.dot?sl:tl:(s=e.match(Ua))?i=(t.nocase?t.dot?Ya:qa:t.dot?Ga:za)(s[1]):(s=e.match(il))?i=(t.nocase?t.dot?rl:nl:t.dot?ol:al)(s):(s=e.match(Ja))?i=t.dot?Xa:Ka:(s=e.match(Za))&&(i=Qa);let r=Oe.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?hl:t.dot?ul:fl,i=new Set(t.nocase?["i"]:[]),r=e.map(l=>{let c=l.map(u=>{if(u instanceof RegExp)for(let h of u.flags.split(""))i.add(h);return typeof u=="string"?yl(u):u===F?F:u._src});return c.forEach((u,h)=>{let g=c[h+1],d=c[h-1];u!==F||d===F||(d===void 0?g!==void 0&&g!==F?c[h+1]="(?:\\/|"+s+"\\/)?"+g:c[h]=s:g===void 0?c[h-1]=d+"(?:\\/|"+s+")?":g!==F&&(c[h-1]=d+"(?:\\/|\\/"+s+"\\/)"+g,c[h+1]=F))}),c.filter(u=>u!==F).join("/")}).join("|"),[o,a]=e.length>1?["(?:",")"]:["",""];r="^"+o+r+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=0;a<r.length;a++){let l=r[a],c=i;if(s.matchBase&&l.length===1&&(c=[o]),this.matchOne(c,l,t))return s.flipNegate?!0:!this.negate}return s.flipNegate?!1:this.negate}static defaults(e){return W.defaults(e).Minimatch}};W.AST=Oe;W.Minimatch=G;W.escape=We;W.unescape=te;var Or=require("node:url");var He=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,nr=new Set,Bs=typeof process=="object"&&process?process:{},rr=(n,e,t,s)=>{typeof Bs.emitWarning=="function"?Bs.emitWarning(n,e,t,s):console.error(`[${t}] ${e}: ${n}`)},Pt=globalThis.AbortController,ir=globalThis.AbortSignal;if(typeof Pt>"u"){ir=class{onabort;_onabort=[];reason;aborted=!1;addEventListener(s,i){this._onabort.push(i)}},Pt=class{constructor(){e()}signal=new ir;abort(s){if(!this.signal.aborted){this.signal.reason=s,this.signal.aborted=!0;for(let i of this.signal._onabort)i(s);this.signal.onabort?.(s)}}};let n=Bs.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",e=()=>{n&&(n=!1,rr("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",e))}}var bl=n=>!nr.has(n),zh=Symbol("type"),be=n=>n&&n===Math.floor(n)&&n>0&&isFinite(n),or=n=>be(n)?n<=Math.pow(2,8)?Uint8Array:n<=Math.pow(2,16)?Uint16Array:n<=Math.pow(2,32)?Uint32Array:n<=Number.MAX_SAFE_INTEGER?Ve:null:null,Ve=class extends Array{constructor(e){super(e),this.fill(0)}},Us=class n{heap;length;static#e=!1;static create(e){let t=or(e);if(!t)return[];n.#e=!0;let s=new n(e,t);return n.#e=!1,s}constructor(e,t){if(!n.#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]}},it=class n{#e;#s;#n;#t;#o;#v;ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#c;#u;#l;#a;#r;#y;#b;#p;#d;#S;#g;#C;#E;#m;#_;#w;#f;static unsafeExposeInternals(e){return{starts:e.#E,ttls:e.#m,sizes:e.#C,keyMap:e.#l,keyList:e.#a,valList:e.#r,next:e.#y,prev:e.#b,get head(){return e.#p},get tail(){return e.#d},free:e.#S,isBackgroundFetch:t=>e.#h(t),backgroundFetch:(t,s,i,r)=>e.#D(t,s,i,r),moveToTail:t=>e.#W(t),indexes:t=>e.#$(t),rindexes:t=>e.#k(t),isStale:t=>e.#x(t)}}get max(){return this.#e}get maxSize(){return this.#s}get calculatedSize(){return this.#u}get size(){return this.#c}get fetchMethod(){return this.#o}get memoMethod(){return this.#v}get dispose(){return this.#n}get disposeAfter(){return this.#t}constructor(e){let{max:t=0,ttl:s,ttlResolution:i=1,ttlAutopurge:r,updateAgeOnGet:o,updateAgeOnHas:a,allowStale:l,dispose:c,disposeAfter:u,noDisposeOnSet:h,noUpdateTTL:g,maxSize:d=0,maxEntrySize:m=0,sizeCalculation:p,fetchMethod:y,memoMethod:b,noDeleteOnFetchRejection:x,noDeleteOnStaleGet:v,allowStaleOnFetchRejection:S,allowStaleOnFetchAbort:E,ignoreFetchAbort:U}=e;if(t!==0&&!be(t))throw new TypeError("max option must be a nonnegative integer");let j=t?or(t):Array;if(!j)throw new Error("invalid max value: "+t);if(this.#e=t,this.#s=d,this.maxEntrySize=m||this.#s,this.sizeCalculation=p,this.sizeCalculation){if(!this.#s&&!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(b!==void 0&&typeof b!="function")throw new TypeError("memoMethod must be a function if defined");if(this.#v=b,y!==void 0&&typeof y!="function")throw new TypeError("fetchMethod must be a function if specified");if(this.#o=y,this.#w=!!y,this.#l=new Map,this.#a=new Array(t).fill(void 0),this.#r=new Array(t).fill(void 0),this.#y=new j(t),this.#b=new j(t),this.#p=0,this.#d=0,this.#S=Us.create(t),this.#c=0,this.#u=0,typeof c=="function"&&(this.#n=c),typeof u=="function"?(this.#t=u,this.#g=[]):(this.#t=void 0,this.#g=void 0),this.#_=!!this.#n,this.#f=!!this.#t,this.noDisposeOnSet=!!h,this.noUpdateTTL=!!g,this.noDeleteOnFetchRejection=!!x,this.allowStaleOnFetchRejection=!!S,this.allowStaleOnFetchAbort=!!E,this.ignoreFetchAbort=!!U,this.maxEntrySize!==0){if(this.#s!==0&&!be(this.#s))throw new TypeError("maxSize must be a positive integer if specified");if(!be(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#F()}if(this.allowStale=!!l,this.noDeleteOnStaleGet=!!v,this.updateAgeOnGet=!!o,this.updateAgeOnHas=!!a,this.ttlResolution=be(i)||i===0?i:1,this.ttlAutopurge=!!r,this.ttl=s||0,this.ttl){if(!be(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#O()}if(this.#e===0&&this.ttl===0&&this.#s===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#e&&!this.#s){let Ce="LRU_CACHE_UNBOUNDED";bl(Ce)&&(nr.add(Ce),rr("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",Ce,n))}}getRemainingTTL(e){return this.#l.has(e)?1/0:0}#O(){let e=new Ve(this.#e),t=new Ve(this.#e);this.#m=e,this.#E=t,this.#j=(r,o,a=He.now())=>{if(t[r]=o!==0?a:0,e[r]=o,o!==0&&this.ttlAutopurge){let l=setTimeout(()=>{this.#x(r)&&this.#R(this.#a[r],"expire")},o+1);l.unref&&l.unref()}},this.#A=r=>{t[r]=e[r]!==0?He.now():0},this.#i=(r,o)=>{if(e[o]){let a=e[o],l=t[o];if(!a||!l)return;r.ttl=a,r.start=l,r.now=s||i();let c=r.now-l;r.remainingTTL=a-c}};let s=0,i=()=>{let r=He.now();if(this.ttlResolution>0){s=r;let o=setTimeout(()=>s=0,this.ttlResolution);o.unref&&o.unref()}return r};this.getRemainingTTL=r=>{let o=this.#l.get(r);if(o===void 0)return 0;let a=e[o],l=t[o];if(!a||!l)return 1/0;let c=(s||i())-l;return a-c},this.#x=r=>{let o=t[r],a=e[r];return!!a&&!!o&&(s||i())-o>a}}#A=()=>{};#i=()=>{};#j=()=>{};#x=()=>!1;#F(){let e=new Ve(this.#e);this.#u=0,this.#C=e,this.#T=t=>{this.#u-=e[t],e[t]=0},this.#P=(t,s,i,r)=>{if(this.#h(s))return 0;if(!be(i))if(r){if(typeof r!="function")throw new TypeError("sizeCalculation must be a function");if(i=r(s,t),!be(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.#s){let r=this.#s-e[t];for(;this.#u>r;)this.#L(!0)}this.#u+=e[t],i&&(i.entrySize=s,i.totalCalculatedSize=this.#u)}}#T=e=>{};#M=(e,t,s)=>{};#P=(e,t,s,i)=>{if(s||i)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#$({allowStale:e=this.allowStale}={}){if(this.#c)for(let t=this.#d;!(!this.#I(t)||((e||!this.#x(t))&&(yield t),t===this.#p));)t=this.#b[t]}*#k({allowStale:e=this.allowStale}={}){if(this.#c)for(let t=this.#p;!(!this.#I(t)||((e||!this.#x(t))&&(yield t),t===this.#d));)t=this.#y[t]}#I(e){return e!==void 0&&this.#l.get(this.#a[e])===e}*entries(){for(let e of this.#$())this.#r[e]!==void 0&&this.#a[e]!==void 0&&!this.#h(this.#r[e])&&(yield[this.#a[e],this.#r[e]])}*rentries(){for(let e of this.#k())this.#r[e]!==void 0&&this.#a[e]!==void 0&&!this.#h(this.#r[e])&&(yield[this.#a[e],this.#r[e]])}*keys(){for(let e of this.#$()){let t=this.#a[e];t!==void 0&&!this.#h(this.#r[e])&&(yield t)}}*rkeys(){for(let e of this.#k()){let t=this.#a[e];t!==void 0&&!this.#h(this.#r[e])&&(yield t)}}*values(){for(let e of this.#$())this.#r[e]!==void 0&&!this.#h(this.#r[e])&&(yield this.#r[e])}*rvalues(){for(let e of this.#k())this.#r[e]!==void 0&&!this.#h(this.#r[e])&&(yield this.#r[e])}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(e,t={}){for(let s of this.#$()){let i=this.#r[s],r=this.#h(i)?i.__staleWhileFetching:i;if(r!==void 0&&e(r,this.#a[s],this))return this.get(this.#a[s],t)}}forEach(e,t=this){for(let s of this.#$()){let i=this.#r[s],r=this.#h(i)?i.__staleWhileFetching:i;r!==void 0&&e.call(t,r,this.#a[s],this)}}rforEach(e,t=this){for(let s of this.#k()){let i=this.#r[s],r=this.#h(i)?i.__staleWhileFetching:i;r!==void 0&&e.call(t,r,this.#a[s],this)}}purgeStale(){let e=!1;for(let t of this.#k({allowStale:!0}))this.#x(t)&&(this.#R(this.#a[t],"expire"),e=!0);return e}info(e){let t=this.#l.get(e);if(t===void 0)return;let s=this.#r[t],i=this.#h(s)?s.__staleWhileFetching:s;if(i===void 0)return;let r={value:i};if(this.#m&&this.#E){let o=this.#m[t],a=this.#E[t];if(o&&a){let l=o-(He.now()-a);r.ttl=l,r.start=Date.now()}}return this.#C&&(r.size=this.#C[t]),r}dump(){let e=[];for(let t of this.#$({allowStale:!0})){let s=this.#a[t],i=this.#r[t],r=this.#h(i)?i.__staleWhileFetching:i;if(r===void 0||s===void 0)continue;let o={value:r};if(this.#m&&this.#E){o.ttl=this.#m[t];let a=He.now()-this.#E[t];o.start=Math.floor(Date.now()-a)}this.#C&&(o.size=this.#C[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=He.now()-i}this.set(t,s.value,s)}}set(e,t,s={}){if(t===void 0)return this.delete(e),this;let{ttl:i=this.ttl,start:r,noDisposeOnSet:o=this.noDisposeOnSet,sizeCalculation:a=this.sizeCalculation,status:l}=s,{noUpdateTTL:c=this.noUpdateTTL}=s,u=this.#P(e,t,s.size||0,a);if(this.maxEntrySize&&u>this.maxEntrySize)return l&&(l.set="miss",l.maxEntrySizeExceeded=!0),this.#R(e,"set"),this;let h=this.#c===0?void 0:this.#l.get(e);if(h===void 0)h=this.#c===0?this.#d:this.#S.length!==0?this.#S.pop():this.#c===this.#e?this.#L(!1):this.#c,this.#a[h]=e,this.#r[h]=t,this.#l.set(e,h),this.#y[this.#d]=h,this.#b[h]=this.#d,this.#d=h,this.#c++,this.#M(h,u,l),l&&(l.set="add"),c=!1;else{this.#W(h);let g=this.#r[h];if(t!==g){if(this.#w&&this.#h(g)){g.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:d}=g;d!==void 0&&!o&&(this.#_&&this.#n?.(d,e,"set"),this.#f&&this.#g?.push([d,e,"set"]))}else o||(this.#_&&this.#n?.(g,e,"set"),this.#f&&this.#g?.push([g,e,"set"]));if(this.#T(h),this.#M(h,u,l),this.#r[h]=t,l){l.set="replace";let d=g&&this.#h(g)?g.__staleWhileFetching:g;d!==void 0&&(l.oldValue=d)}}else l&&(l.set="update")}if(i!==0&&!this.#m&&this.#O(),this.#m&&(c||this.#j(h,i,r),l&&this.#i(l,h)),!o&&this.#f&&this.#g){let g=this.#g,d;for(;d=g?.shift();)this.#t?.(...d)}return this}pop(){try{for(;this.#c;){let e=this.#r[this.#p];if(this.#L(!0),this.#h(e)){if(e.__staleWhileFetching)return e.__staleWhileFetching}else if(e!==void 0)return e}}finally{if(this.#f&&this.#g){let e=this.#g,t;for(;t=e?.shift();)this.#t?.(...t)}}}#L(e){let t=this.#p,s=this.#a[t],i=this.#r[t];return this.#w&&this.#h(i)?i.__abortController.abort(new Error("evicted")):(this.#_||this.#f)&&(this.#_&&this.#n?.(i,s,"evict"),this.#f&&this.#g?.push([i,s,"evict"])),this.#T(t),e&&(this.#a[t]=void 0,this.#r[t]=void 0,this.#S.push(t)),this.#c===1?(this.#p=this.#d=0,this.#S.length=0):this.#p=this.#y[t],this.#l.delete(s),this.#c--,t}has(e,t={}){let{updateAgeOnHas:s=this.updateAgeOnHas,status:i}=t,r=this.#l.get(e);if(r!==void 0){let o=this.#r[r];if(this.#h(o)&&o.__staleWhileFetching===void 0)return!1;if(this.#x(r))i&&(i.has="stale",this.#i(i,r));else return s&&this.#A(r),i&&(i.has="hit",this.#i(i,r)),!0}else i&&(i.has="miss");return!1}peek(e,t={}){let{allowStale:s=this.allowStale}=t,i=this.#l.get(e);if(i===void 0||!s&&this.#x(i))return;let r=this.#r[i];return this.#h(r)?r.__staleWhileFetching:r}#D(e,t,s,i){let r=t===void 0?void 0:this.#r[t];if(this.#h(r))return r;let o=new Pt,{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:b}=o.signal,x=s.ignoreFetchAbort&&p!==void 0;if(s.status&&(b&&!y?(s.status.fetchAborted=!0,s.status.fetchError=o.signal.reason,x&&(s.status.fetchAbortIgnored=!0)):s.status.fetchResolved=!0),b&&!x&&!y)return h(o.signal.reason);let v=d;return this.#r[t]===d&&(p===void 0?v.__staleWhileFetching?this.#r[t]=v.__staleWhileFetching:this.#R(e,"fetch"):(s.status&&(s.status.fetchUpdated=!0),this.set(e,p,l.options))),p},u=p=>(s.status&&(s.status.fetchRejected=!0,s.status.fetchError=p),h(p)),h=p=>{let{aborted:y}=o.signal,b=y&&s.allowStaleOnFetchAbort,x=b||s.allowStaleOnFetchRejection,v=x||s.noDeleteOnFetchRejection,S=d;if(this.#r[t]===d&&(!v||S.__staleWhileFetching===void 0?this.#R(e,"fetch"):b||(this.#r[t]=S.__staleWhileFetching)),x)return s.status&&S.__staleWhileFetching!==void 0&&(s.status.returnedStale=!0),S.__staleWhileFetching;if(S.__returned===S)throw p},g=(p,y)=>{let b=this.#o?.(e,r,l);b&&b instanceof Promise&&b.then(x=>p(x===void 0?void 0:x),y),o.signal.addEventListener("abort",()=>{(!s.ignoreFetchAbort||s.allowStaleOnFetchAbort)&&(p(void 0),s.allowStaleOnFetchAbort&&(p=x=>c(x,!0)))})};s.status&&(s.status.fetchDispatched=!0);let d=new Promise(g).then(c,u),m=Object.assign(d,{__abortController:o,__staleWhileFetching:r,__returned:void 0});return t===void 0?(this.set(e,m,{...l.options,status:void 0}),t=this.#l.get(e)):this.#r[t]=m,m}#h(e){if(!this.#w)return!1;let t=e;return!!t&&t instanceof Promise&&t.hasOwnProperty("__staleWhileFetching")&&t.__abortController instanceof Pt}async fetch(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:g=this.allowStaleOnFetchRejection,ignoreFetchAbort:d=this.ignoreFetchAbort,allowStaleOnFetchAbort:m=this.allowStaleOnFetchAbort,context:p,forceRefresh:y=!1,status:b,signal:x}=t;if(!this.#w)return b&&(b.fetch="get"),this.get(e,{allowStale:s,updateAgeOnGet:i,noDeleteOnStaleGet:r,status:b});let v={allowStale:s,updateAgeOnGet:i,noDeleteOnStaleGet:r,ttl:o,noDisposeOnSet:a,size:l,sizeCalculation:c,noUpdateTTL:u,noDeleteOnFetchRejection:h,allowStaleOnFetchRejection:g,allowStaleOnFetchAbort:m,ignoreFetchAbort:d,status:b,signal:x},S=this.#l.get(e);if(S===void 0){b&&(b.fetch="miss");let E=this.#D(e,S,v,p);return E.__returned=E}else{let E=this.#r[S];if(this.#h(E)){let oe=s&&E.__staleWhileFetching!==void 0;return b&&(b.fetch="inflight",oe&&(b.returnedStale=!0)),oe?E.__staleWhileFetching:E.__returned=E}let U=this.#x(S);if(!y&&!U)return b&&(b.fetch="hit"),this.#W(S),i&&this.#A(S),b&&this.#i(b,S),E;let j=this.#D(e,S,v,p),Fe=j.__staleWhileFetching!==void 0&&s;return b&&(b.fetch=U?"stale":"refresh",Fe&&U&&(b.returnedStale=!0)),Fe?j.__staleWhileFetching:j.__returned=j}}async forceFetch(e,t={}){let s=await this.fetch(e,t);if(s===void 0)throw new Error("fetch() returned undefined");return s}memo(e,t={}){let s=this.#v;if(!s)throw new Error("no memoMethod provided to constructor");let{context:i,forceRefresh:r,...o}=t,a=this.get(e,o);if(!r&&a!==void 0)return a;let l=s(e,a,{options:o,context:i});return this.set(e,l,o),l}get(e,t={}){let{allowStale:s=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:r=this.noDeleteOnStaleGet,status:o}=t,a=this.#l.get(e);if(a!==void 0){let l=this.#r[a],c=this.#h(l);return o&&this.#i(o,a),this.#x(a)?(o&&(o.get="stale"),c?(o&&s&&l.__staleWhileFetching!==void 0&&(o.returnedStale=!0),s?l.__staleWhileFetching:void 0):(r||this.#R(e,"expire"),o&&s&&(o.returnedStale=!0),s?l:void 0)):(o&&(o.get="hit"),c?l.__staleWhileFetching:(this.#W(a),i&&this.#A(a),l))}else o&&(o.get="miss")}#N(e,t){this.#b[t]=e,this.#y[e]=t}#W(e){e!==this.#d&&(e===this.#p?this.#p=this.#y[e]:this.#N(this.#b[e],this.#y[e]),this.#N(this.#d,e),this.#d=e)}delete(e){return this.#R(e,"delete")}#R(e,t){let s=!1;if(this.#c!==0){let i=this.#l.get(e);if(i!==void 0)if(s=!0,this.#c===1)this.#H(t);else{this.#T(i);let r=this.#r[i];if(this.#h(r)?r.__abortController.abort(new Error("deleted")):(this.#_||this.#f)&&(this.#_&&this.#n?.(r,e,t),this.#f&&this.#g?.push([r,e,t])),this.#l.delete(e),this.#a[i]=void 0,this.#r[i]=void 0,i===this.#d)this.#d=this.#b[i];else if(i===this.#p)this.#p=this.#y[i];else{let o=this.#b[i];this.#y[o]=this.#y[i];let a=this.#y[i];this.#b[a]=this.#b[i]}this.#c--,this.#S.push(i)}}if(this.#f&&this.#g?.length){let i=this.#g,r;for(;r=i?.shift();)this.#t?.(...r)}return s}clear(){return this.#H("delete")}#H(e){for(let t of this.#k({allowStale:!0})){let s=this.#r[t];if(this.#h(s))s.__abortController.abort(new Error("deleted"));else{let i=this.#a[t];this.#_&&this.#n?.(s,i,e),this.#f&&this.#g?.push([s,i,e])}}if(this.#l.clear(),this.#r.fill(void 0),this.#a.fill(void 0),this.#m&&this.#E&&(this.#m.fill(0),this.#E.fill(0)),this.#C&&this.#C.fill(0),this.#p=0,this.#d=0,this.#S.length=0,this.#u=0,this.#c=0,this.#f&&this.#g){let t=this.#g,s;for(;s=t?.shift();)this.#t?.(...s)}}};var ze=require("node:path"),mr=require("node:url"),ce=require("fs"),$l=A(require("node:fs"),1),ve=require("node:fs/promises");var Vt=require("node:events"),Xs=A(require("node:stream"),1),ur=require("node:string_decoder"),ar=typeof process=="object"&&process?process:{stdout:null,stderr:null},wl=n=>!!n&&typeof n=="object"&&(n instanceof xe||n instanceof Xs.default||xl(n)||vl(n)),xl=n=>!!n&&typeof n=="object"&&n instanceof Vt.EventEmitter&&typeof n.pipe=="function"&&n.pipe!==Xs.default.Writable.prototype.pipe,vl=n=>!!n&&typeof n=="object"&&n instanceof Vt.EventEmitter&&typeof n.write=="function"&&typeof n.end=="function",de=Symbol("EOF"),ge=Symbol("maybeEmitEnd"),we=Symbol("emittedEnd"),It=Symbol("emittingEnd"),nt=Symbol("emittedError"),Lt=Symbol("closed"),lr=Symbol("read"),Dt=Symbol("flush"),cr=Symbol("flushChunk"),se=Symbol("encoding"),Be=Symbol("decoder"),M=Symbol("flowing"),rt=Symbol("paused"),Ue=Symbol("resume"),P=Symbol("buffer"),H=Symbol("pipes"),I=Symbol("bufferLength"),zs=Symbol("bufferPush"),Nt=Symbol("bufferShift"),D=Symbol("objectMode"),R=Symbol("destroyed"),Gs=Symbol("error"),qs=Symbol("emitData"),hr=Symbol("emitEnd"),Ys=Symbol("emitEnd2"),ae=Symbol("async"),Js=Symbol("abort"),Wt=Symbol("aborted"),ot=Symbol("signal"),Ae=Symbol("dataListeners"),q=Symbol("discarded"),at=n=>Promise.resolve().then(n),Sl=n=>n(),_l=n=>n==="end"||n==="finish"||n==="prefinish",Cl=n=>n instanceof ArrayBuffer||!!n&&typeof n=="object"&&n.constructor&&n.constructor.name==="ArrayBuffer"&&n.byteLength>=0,El=n=>!Buffer.isBuffer(n)&&ArrayBuffer.isView(n),Ht=class{src;dest;opts;ondrain;constructor(e,t,s){this.src=e,this.dest=t,this.opts=s,this.ondrain=()=>e[Ue](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(e){}end(){this.unpipe(),this.opts.end&&this.dest.end()}},Ks=class extends Ht{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)}},Ol=n=>!!n.objectMode,Al=n=>!n.objectMode&&!!n.encoding&&n.encoding!=="buffer",xe=class extends Vt.EventEmitter{[M]=!1;[rt]=!1;[H]=[];[P]=[];[D];[se];[ae];[Be];[de]=!1;[we]=!1;[It]=!1;[Lt]=!1;[nt]=null;[I]=0;[R]=!1;[ot];[Wt]=!1;[Ae]=0;[q]=!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");Ol(t)?(this[D]=!0,this[se]=null):Al(t)?(this[se]=t.encoding,this[D]=!1):(this[D]=!1,this[se]=null),this[ae]=!!t.async,this[Be]=this[se]?new ur.StringDecoder(this[se]):null,t&&t.debugExposeBuffer===!0&&Object.defineProperty(this,"buffer",{get:()=>this[P]}),t&&t.debugExposePipes===!0&&Object.defineProperty(this,"pipes",{get:()=>this[H]});let{signal:s}=t;s&&(this[ot]=s,s.aborted?this[Js]():s.addEventListener("abort",()=>this[Js]()))}get bufferLength(){return this[I]}get encoding(){return this[se]}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[D]}set objectMode(e){throw new Error("objectMode must be set at instantiation time")}get async(){return this[ae]}set async(e){this[ae]=this[ae]||!!e}[Js](){this[Wt]=!0,this.emit("abort",this[ot]?.reason),this.destroy(this[ot]?.reason)}get aborted(){return this[Wt]}set aborted(e){}write(e,t,s){if(this[Wt])return!1;if(this[de])throw new Error("write after end");if(this[R])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[ae]?at:Sl;if(!this[D]&&!Buffer.isBuffer(e)){if(El(e))e=Buffer.from(e.buffer,e.byteOffset,e.byteLength);else if(Cl(e))e=Buffer.from(e);else if(typeof e!="string")throw new Error("Non-contiguous data written to non-objectMode stream")}return this[D]?(this[M]&&this[I]!==0&&this[Dt](!0),this[M]?this.emit("data",e):this[zs](e),this[I]!==0&&this.emit("readable"),s&&i(s),this[M]):e.length?(typeof e=="string"&&!(t===this[se]&&!this[Be]?.lastNeed)&&(e=Buffer.from(e,t)),Buffer.isBuffer(e)&&this[se]&&(e=this[Be].write(e)),this[M]&&this[I]!==0&&this[Dt](!0),this[M]?this.emit("data",e):this[zs](e),this[I]!==0&&this.emit("readable"),s&&i(s),this[M]):(this[I]!==0&&this.emit("readable"),s&&i(s),this[M])}read(e){if(this[R])return null;if(this[q]=!1,this[I]===0||e===0||e&&e>this[I])return this[ge](),null;this[D]&&(e=null),this[P].length>1&&!this[D]&&(this[P]=[this[se]?this[P].join(""):Buffer.concat(this[P],this[I])]);let t=this[lr](e||null,this[P][0]);return this[ge](),t}[lr](e,t){if(this[D])this[Nt]();else{let s=t;e===s.length||e===null?this[Nt]():typeof s=="string"?(this[P][0]=s.slice(e),t=s.slice(0,e),this[I]-=e):(this[P][0]=s.subarray(e),t=s.subarray(0,e),this[I]-=e)}return this.emit("data",t),!this[P].length&&!this[de]&&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[de]=!0,this.writable=!1,(this[M]||!this[rt])&&this[ge](),this}[Ue](){this[R]||(!this[Ae]&&!this[H].length&&(this[q]=!0),this[rt]=!1,this[M]=!0,this.emit("resume"),this[P].length?this[Dt]():this[de]?this[ge]():this.emit("drain"))}resume(){return this[Ue]()}pause(){this[M]=!1,this[rt]=!0,this[q]=!1}get destroyed(){return this[R]}get flowing(){return this[M]}get paused(){return this[rt]}[zs](e){this[D]?this[I]+=1:this[I]+=e.length,this[P].push(e)}[Nt](){return this[D]?this[I]-=1:this[I]-=this[P][0].length,this[P].shift()}[Dt](e=!1){do;while(this[cr](this[Nt]())&&this[P].length);!e&&!this[P].length&&!this[de]&&this.emit("drain")}[cr](e){return this.emit("data",e),this[M]}pipe(e,t){if(this[R])return e;this[q]=!1;let s=this[we];return t=t||{},e===ar.stdout||e===ar.stderr?t.end=!1:t.end=t.end!==!1,t.proxyErrors=!!t.proxyErrors,s?t.end&&e.end():(this[H].push(t.proxyErrors?new Ks(this,e,t):new Ht(this,e,t)),this[ae]?at(()=>this[Ue]()):this[Ue]()),e}unpipe(e){let t=this[H].find(s=>s.dest===e);t&&(this[H].length===1?(this[M]&&this[Ae]===0&&(this[M]=!1),this[H]=[]):this[H].splice(this[H].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[q]=!1,this[Ae]++,!this[H].length&&!this[M]&&this[Ue]();else if(e==="readable"&&this[I]!==0)super.emit("readable");else if(_l(e)&&this[we])super.emit(e),this.removeAllListeners(e);else if(e==="error"&&this[nt]){let i=t;this[ae]?at(()=>i.call(this,this[nt])):i.call(this,this[nt])}return s}removeListener(e,t){return this.off(e,t)}off(e,t){let s=super.off(e,t);return e==="data"&&(this[Ae]=this.listeners("data").length,this[Ae]===0&&!this[q]&&!this[H].length&&(this[M]=!1)),s}removeAllListeners(e){let t=super.removeAllListeners(e);return(e==="data"||e===void 0)&&(this[Ae]=0,!this[q]&&!this[H].length&&(this[M]=!1)),t}get emittedEnd(){return this[we]}[ge](){!this[It]&&!this[we]&&!this[R]&&this[P].length===0&&this[de]&&(this[It]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[Lt]&&this.emit("close"),this[It]=!1)}emit(e,...t){let s=t[0];if(e!=="error"&&e!=="close"&&e!==R&&this[R])return!1;if(e==="data")return!this[D]&&!s?!1:this[ae]?(at(()=>this[qs](s)),!0):this[qs](s);if(e==="end")return this[hr]();if(e==="close"){if(this[Lt]=!0,!this[we]&&!this[R])return!1;let r=super.emit("close");return this.removeAllListeners("close"),r}else if(e==="error"){this[nt]=s,super.emit(Gs,s);let r=!this[ot]||this.listeners("error").length?super.emit("error",s):!1;return this[ge](),r}else if(e==="resume"){let r=super.emit("resume");return this[ge](),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[ge](),i}[qs](e){for(let s of this[H])s.dest.write(e)===!1&&this.pause();let t=this[q]?!1:super.emit("data",e);return this[ge](),t}[hr](){return this[we]?!1:(this[we]=!0,this.readable=!1,this[ae]?(at(()=>this[Ys]()),!0):this[Ys]())}[Ys](){if(this[Be]){let t=this[Be].end();if(t){for(let s of this[H])s.dest.write(t);this[q]||super.emit("data",t)}}for(let t of this[H])t.end();let e=super.emit("end");return this.removeAllListeners("end"),e}async collect(){let e=Object.assign([],{dataLength:0});this[D]||(e.dataLength=0);let t=this.promise();return this.on("data",s=>{e.push(s),this[D]||(e.dataLength+=s.length)}),await t,e}async concat(){if(this[D])throw new Error("cannot concat in objectMode");let e=await this.collect();return this[se]?e.join(""):Buffer.concat(e,e.dataLength)}async promise(){return new Promise((e,t)=>{this.on(R,()=>t(new Error("stream destroyed"))),this.on("error",s=>t(s)),this.on("end",()=>e())})}[Symbol.asyncIterator](){this[q]=!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[de])return t();let r,o,a=h=>{this.off("data",l),this.off("end",c),this.off(R,u),t(),o(h)},l=h=>{this.off("error",a),this.off("end",c),this.off(R,u),this.pause(),r({value:h,done:!!this[de]})},c=()=>{this.off("error",a),this.off("data",l),this.off(R,u),t(),r({done:!0,value:void 0})},u=()=>a(new Error("stream destroyed"));return new Promise((h,g)=>{o=g,r=h,this.once(R,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[q]=!1;let e=!1,t=()=>(this.pause(),this.off(Gs,t),this.off(R,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(Gs,t),this.once(R,t),{next:s,throw:t,return:t,[Symbol.iterator](){return this},[Symbol.dispose]:()=>{}}}destroy(e){if(this[R])return e?this.emit("error",e):this.emit(R),this;this[R]=!0,this[q]=!0,this[P].length=0,this[I]=0;let t=this;return typeof t.close=="function"&&!this[Lt]&&t.close(),e?this.emit("error",e):this.emit(R),this}static get isStream(){return wl}};var kl=ce.realpathSync.native,ct={lstatSync:ce.lstatSync,readdir:ce.readdir,readdirSync:ce.readdirSync,readlinkSync:ce.readlinkSync,realpathSync:kl,promises:{lstat:ve.lstat,readdir:ve.readdir,readlink:ve.readlink,realpath:ve.realpath}},yr=n=>!n||n===ct||n===$l?ct:{...ct,...n,promises:{...ct.promises,...n.promises||{}}},br=/^\\\\\?\\([a-z]:)\\?$/i,Fl=n=>n.replace(/\//g,"\\").replace(br,"$1\\"),Rl=/[\\\/]/,Z=0,wr=1,xr=2,le=4,vr=6,Sr=8,$e=10,_r=12,X=15,lt=~X,Zs=16,fr=32,ht=64,ie=128,Bt=256,zt=512,dr=ht|ie|zt,jl=1023,Qs=n=>n.isFile()?Sr:n.isDirectory()?le:n.isSymbolicLink()?$e:n.isCharacterDevice()?xr:n.isBlockDevice()?vr:n.isSocket()?_r:n.isFIFO()?wr:Z,gr=new Map,ut=n=>{let e=gr.get(n);if(e)return e;let t=n.normalize("NFKD");return gr.set(n,t),t},pr=new Map,Ut=n=>{let e=pr.get(n);if(e)return e;let t=ut(n.toLowerCase());return pr.set(n,t),t},Gt=class extends it{constructor(){super({max:256})}},ei=class extends it{constructor(e=16*1024){super({maxSize:e,sizeCalculation:t=>t.length+1})}},Cr=Symbol("PathScurry setAsCwd"),N=class{name;root;roots;parent;nocase;isCWD=!1;#e;#s;get dev(){return this.#s}#n;get mode(){return this.#n}#t;get nlink(){return this.#t}#o;get uid(){return this.#o}#v;get gid(){return this.#v}#c;get rdev(){return this.#c}#u;get blksize(){return this.#u}#l;get ino(){return this.#l}#a;get size(){return this.#a}#r;get blocks(){return this.#r}#y;get atimeMs(){return this.#y}#b;get mtimeMs(){return this.#b}#p;get ctimeMs(){return this.#p}#d;get birthtimeMs(){return this.#d}#S;get atime(){return this.#S}#g;get mtime(){return this.#g}#C;get ctime(){return this.#C}#E;get birthtime(){return this.#E}#m;#_;#w;#f;#O;#A;#i;#j;#x;#F;get parentPath(){return(this.parent||this).fullpath()}get path(){return this.parentPath}constructor(e,t=Z,s,i,r,o,a){this.name=e,this.#m=r?Ut(e):ut(e),this.#i=t&jl,this.nocase=r,this.roots=i,this.root=s||this,this.#j=o,this.#w=a.fullpath,this.#O=a.relative,this.#A=a.relativePosix,this.parent=a.parent,this.parent?this.#e=this.parent.#e:this.#e=yr(a.fs)}depth(){return this.#_!==void 0?this.#_:this.parent?this.#_=this.parent.depth()+1:this.#_=0}childrenCache(){return this.#j}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.#j.get(this);if(e)return e;let t=Object.assign([],{provisional:0});return this.#j.set(this,t),this.#i&=~Zs,t}child(e,t){if(e===""||e===".")return this;if(e==="..")return this.parent||this;let s=this.children(),i=this.nocase?Ut(e):ut(e);for(let l of s)if(l.#m===i)return l;let r=this.parent?this.sep:"",o=this.#w?this.#w+r+e:void 0,a=this.newChild(e,Z,{...t,parent:this,fullpath:o});return this.canReaddir()||(a.#i|=ie),s.push(a),a}relative(){if(this.isCWD)return"";if(this.#O!==void 0)return this.#O;let e=this.name,t=this.parent;if(!t)return this.#O=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.#w!==void 0)return this.#w;let e=this.name,t=this.parent;if(!t)return this.#w=this.name;let i=t.fullpath()+(t.parent?this.sep:"")+e;return this.#w=i}fullpathPosix(){if(this.#f!==void 0)return this.#f;if(this.sep==="/")return this.#f=this.fullpath();if(!this.parent){let i=this.fullpath().replace(/\\/g,"/");return/^[a-z]:\//i.test(i)?this.#f=`//?/${i}`:this.#f=i}let e=this.parent,t=e.fullpathPosix(),s=t+(!t||!e.parent?"":"/")+this.name;return this.#f=s}isUnknown(){return(this.#i&X)===Z}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.#i&X)===Sr}isDirectory(){return(this.#i&X)===le}isCharacterDevice(){return(this.#i&X)===xr}isBlockDevice(){return(this.#i&X)===vr}isFIFO(){return(this.#i&X)===wr}isSocket(){return(this.#i&X)===_r}isSymbolicLink(){return(this.#i&$e)===$e}lstatCached(){return this.#i&fr?this:void 0}readlinkCached(){return this.#x}realpathCached(){return this.#F}readdirCached(){let e=this.children();return e.slice(0,e.provisional)}canReadlink(){if(this.#x)return!0;if(!this.parent)return!1;let e=this.#i&X;return!(e!==Z&&e!==$e||this.#i&Bt||this.#i&ie)}calledReaddir(){return!!(this.#i&Zs)}isENOENT(){return!!(this.#i&ie)}isNamed(e){return this.nocase?this.#m===Ut(e):this.#m===ut(e)}async readlink(){let e=this.#x;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.#x=s}catch(t){this.#h(t.code);return}}readlinkSync(){let e=this.#x;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.#x=s}catch(t){this.#h(t.code);return}}#M(e){this.#i|=Zs;for(let t=e.provisional;t<e.length;t++){let s=e[t];s&&s.#P()}}#P(){this.#i&ie||(this.#i=(this.#i|ie)<,this.#$())}#$(){let e=this.children();e.provisional=0;for(let t of e)t.#P()}#k(){this.#i|=zt,this.#I()}#I(){if(this.#i&ht)return;let e=this.#i;(e&X)===le&&(e&=lt),this.#i=e|ht,this.#$()}#L(e=""){e==="ENOTDIR"||e==="EPERM"?this.#I():e==="ENOENT"?this.#P():this.children().provisional=0}#D(e=""){e==="ENOTDIR"?this.parent.#I():e==="ENOENT"&&this.#P()}#h(e=""){let t=this.#i;t|=Bt,e==="ENOENT"&&(t|=ie),(e==="EINVAL"||e==="UNKNOWN")&&(t&=lt),this.#i=t,e==="ENOTDIR"&&this.parent&&this.parent.#I()}#N(e,t){return this.#R(e,t)||this.#W(e,t)}#W(e,t){let s=Qs(e),i=this.newChild(e.name,s,{parent:this}),r=i.#i&X;return r!==le&&r!==$e&&r!==Z&&(i.#i|=ht),t.unshift(i),t.provisional++,i}#R(e,t){for(let s=t.provisional;s<t.length;s++){let i=t[s];if((this.nocase?Ut(e.name):ut(e.name))===i.#m)return this.#H(e,i,s,t)}}#H(e,t,s,i){let r=t.name;return t.#i=t.#i<|Qs(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.#i&ie))try{return this.#z(await this.#e.promises.lstat(this.fullpath())),this}catch(e){this.#D(e.code)}}lstatSync(){if(!(this.#i&ie))try{return this.#z(this.#e.lstatSync(this.fullpath())),this}catch(e){this.#D(e.code)}}#z(e){let{atime:t,atimeMs:s,birthtime:i,birthtimeMs:r,blksize:o,blocks:a,ctime:l,ctimeMs:c,dev:u,gid:h,ino:g,mode:d,mtime:m,mtimeMs:p,nlink:y,rdev:b,size:x,uid:v}=e;this.#S=t,this.#y=s,this.#E=i,this.#d=r,this.#u=o,this.#r=a,this.#C=l,this.#p=c,this.#s=u,this.#v=h,this.#l=g,this.#n=d,this.#g=m,this.#b=p,this.#t=y,this.#c=b,this.#a=x,this.#o=v;let S=Qs(e);this.#i=this.#i<|S|fr,S!==Z&&S!==le&&S!==$e&&(this.#i|=ht)}#B=[];#U=!1;#G(e){this.#U=!1;let t=this.#B.slice();this.#B.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.#B.push(e),this.#U)return;this.#U=!0;let i=this.fullpath();this.#e.readdir(i,{withFileTypes:!0},(r,o)=>{if(r)this.#L(r.code),s.provisional=0;else{for(let a of o)this.#N(a,s);this.#M(s)}this.#G(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.#N(i,e);this.#M(e)}catch(i){this.#L(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.#N(s,e);this.#M(e)}catch(s){this.#L(s.code),e.provisional=0}return e.slice(0,e.provisional)}canReaddir(){if(this.#i&dr)return!1;let e=X&this.#i;return e===Z||e===le||e===$e}shouldWalk(e,t){return(this.#i&le)===le&&!(this.#i&dr)&&!e.has(this)&&(!t||t(this))}async realpath(){if(this.#F)return this.#F;if(!((zt|Bt|ie)&this.#i))try{let e=await this.#e.promises.realpath(this.fullpath());return this.#F=this.resolve(e)}catch{this.#k()}}realpathSync(){if(this.#F)return this.#F;if(!((zt|Bt|ie)&this.#i))try{let e=this.#e.realpathSync(this.fullpath());return this.#F=this.resolve(e)}catch{this.#k()}}[Cr](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.#O=s.join(this.sep),i.#A=s.join("/"),i=i.parent,s.push("..");for(i=e;i&&i.parent&&!t.has(i);)i.#O=void 0,i.#A=void 0,i=i.parent}},qt=class n extends N{sep="\\";splitSep=Rl;constructor(e,t=Z,s,i,r,o,a){super(e,t,s,i,r,o,a)}newChild(e,t=Z,s={}){return new n(e,t,this.root,this.roots,this.nocase,this.childrenCache(),s)}getRootString(e){return ze.win32.parse(e).root}getRoot(e){if(e=Fl(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 Ge(e,this).root}sameRoot(e,t=this.root.name){return e=e.toUpperCase().replace(/\//g,"\\").replace(br,"$1\\"),e===t}},Yt=class n extends N{splitSep="/";sep="/";constructor(e,t=Z,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=Z,s={}){return new n(e,t,this.root,this.roots,this.nocase,this.childrenCache(),s)}},Jt=class{root;rootPath;roots;cwd;#e;#s;#n;nocase;#t;constructor(e=process.cwd(),t,s,{nocase:i,childrenCacheSize:r=16*1024,fs:o=ct}={}){this.#t=yr(o),(e instanceof URL||e.startsWith("file://"))&&(e=(0,mr.fileURLToPath)(e));let a=t.resolve(e);this.roots=Object.create(null),this.rootPath=this.parseRootPath(a),this.#e=new Gt,this.#s=new Gt,this.#n=new ei(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,g=this.rootPath,d=!1;for(let m of l){let p=u--;c=c.child(m,{relative:new Array(p).fill("..").join(h),relativePosix:new Array(p).fill("..").join("/"),fullpath:g+=(d?"":h)+m}),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.#s.get(t);if(s!==void 0)return s;let i=this.cwd.resolve(t).fullpathPosix();return this.#s.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 N||(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 N||(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 N||(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 N||(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 N||(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 N||(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 N||(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,g)=>{l.add(h),h.readdirCB((d,m)=>{if(d)return g(d);let p=m.length;if(!p)return g();let y=()=>{--p===0&&g()};for(let b of m)(!r||r(b))&&a.push(s?b:b.fullpath()),i&&b.isSymbolicLink()?b.realpath().then(x=>x?.isUnknown()?x.lstat():x).then(x=>x?.shouldWalk(l,o)?c(x,y):y()):b.shouldWalk(l,o)?c(b,y):y()},!0)},u=e;return new Promise((h,g)=>{c(u,d=>{if(d)return g(d);h(a)})})}walkSync(e=this.cwd,t={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof N||(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 g=h;if(h.isSymbolicLink()){if(!(i&&(g=h.realpathSync())))continue;g.isUnknown()&&g.lstatSync()}g.shouldWalk(l,o)&&l.add(g)}}return a}[Symbol.asyncIterator](){return this.iterate()}iterate(e=this.cwd,t={}){return typeof e=="string"?e=this.cwd.resolve(e):e instanceof N||(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 N||(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 N||(t=e,e=this.cwd);let{withFileTypes:s=!0,follow:i=!1,filter:r,walkFilter:o}=t,a=new xe({objectMode:!0});(!r||r(e))&&a.write(s?e:e.fullpath());let l=new Set,c=[e],u=0,h=()=>{let g=!1;for(;!g;){let d=c.shift();if(!d){u===0&&a.end();return}u++,l.add(d);let m=(y,b,x=!1)=>{if(y)return a.emit("error",y);if(i&&!x){let v=[];for(let S of b)S.isSymbolicLink()&&v.push(S.realpath().then(E=>E?.isUnknown()?E.lstat():E));if(v.length){Promise.all(v).then(()=>m(null,b,!0));return}}for(let v of b)v&&(!r||r(v))&&(a.write(s?v:v.fullpath())||(g=!0));u--;for(let v of b){let S=v.realpathCached()||v;S.shouldWalk(l,o)&&c.push(S)}g&&!a.flowing?a.once("drain",h):p||h()},p=!0;d.readdirCB(m,!0),p=!1}};return h(),a}streamSync(e=this.cwd,t={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof N||(t=e,e=this.cwd);let{withFileTypes:s=!0,follow:i=!1,filter:r,walkFilter:o}=t,a=new xe({objectMode:!0}),l=new Set;(!r||r(e))&&a.write(s?e:e.fullpath());let c=[e],u=0,h=()=>{let g=!1;for(;!g;){let d=c.shift();if(!d){u===0&&a.end();return}u++,l.add(d);let m=d.readdirSync();for(let p of m)(!r||r(p))&&(a.write(s?p:p.fullpath())||(g=!0));u--;for(let p of m){let y=p;if(p.isSymbolicLink()){if(!(i&&(y=p.realpathSync())))continue;y.isUnknown()&&y.lstatSync()}y.shouldWalk(l,o)&&c.push(y)}}g&&!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[Cr](t)}},Ge=class extends Jt{sep="\\";constructor(e=process.cwd(),t={}){let{nocase:s=!0}=t;super(e,ze.win32,"\\",{...t,nocase:s}),this.nocase=s;for(let i=this.cwd;i;i=i.parent)i.nocase=this.nocase}parseRootPath(e){return ze.win32.parse(e).root.toUpperCase()}newRoot(e){return new qt(this.rootPath,le,void 0,this.roots,this.nocase,this.childrenCache(),{fs:e})}isAbsolute(e){return e.startsWith("/")||e.startsWith("\\")||/^[a-z]:(\/|\\)/i.test(e)}},qe=class extends Jt{sep="/";constructor(e=process.cwd(),t={}){let{nocase:s=!1}=t;super(e,ze.posix,"/",{...t,nocase:s}),this.nocase=s}parseRootPath(e){return"/"}newRoot(e){return new Yt(this.rootPath,le,void 0,this.roots,this.nocase,this.childrenCache(),{fs:e})}isAbsolute(e){return e.startsWith("/")}},ft=class extends qe{constructor(e=process.cwd(),t={}){let{nocase:s=!0}=t;super(e,{...t,nocase:s})}},Kh=process.platform==="win32"?qt:Yt,Er=process.platform==="win32"?Ge:process.platform==="darwin"?ft:qe;var Tl=n=>n.length>=1,Ml=n=>n.length>=1,Ye=class n{#e;#s;#n;length;#t;#o;#v;#c;#u;#l;#a=!0;constructor(e,t,s,i){if(!Tl(e))throw new TypeError("empty pattern list");if(!Ml(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.#s=t,this.#n=s,this.#t=i,this.#n===0){if(this.isUNC()){let[r,o,a,l,...c]=this.#e,[u,h,g,d,...m]=this.#s;c[0]===""&&(c.shift(),m.shift());let p=[r,o,a,l,""].join("/"),y=[u,h,g,d,""].join("/");this.#e=[p,...c],this.#s=[y,...m],this.length=this.#e.length}else if(this.isDrive()||this.isAbsolute()){let[r,...o]=this.#e,[a,...l]=this.#s;o[0]===""&&(o.shift(),l.shift());let c=r+"/",u=a+"/";this.#e=[c,...o],this.#s=[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.#v=this.#v||(this.#n===0?this.isAbsolute()?this.#s[0]+this.#s.slice(1).join("/"):this.#s.join("/"):this.#s.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.#s,this.#n+1,this.#t),this.#o.#l=this.#l,this.#o.#u=this.#u,this.#o.#c=this.#c,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.#c!==void 0?this.#c:this.#c=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.#l!==void 0?this.#l:this.#l=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.#a)}markFollowGlobstar(){return this.#n===0||!this.isGlobstar()||!this.#a?!1:(this.#a=!1,!0)}};var Pl=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",Je=class{relative;relativeChildren;absolute;absoluteChildren;platform;mmopts;constructor(e,{nobrace:t,nocase:s,noext:i,noglobstar:r,platform:o=Pl}){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 G(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 Ye(i,r,0,this.platform),a=new G(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 ti=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()]))}},si=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)])}},ii=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())}},dt=class n{hasWalkedCache;matches=new si;subwalks=new ii;patterns;follow;dot;opts;constructor(e,t){this.opts=e,this.follow=!!e.follow,this.dot=!!e.dot,this.hasWalkedCache=t?t.copy():new ti}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(),g=c?.rest();if(!c||(h===""||h===".")&&!g)this.matches.add(i,a,h===""||h===".");else if(h===".."){let d=i.parent||i;g?this.hasWalkedCache.hasWalked(d,g)||this.subwalks.add(d,g):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 Il=(n,e)=>typeof n=="string"?new Je([n],e):Array.isArray(n)?new Je(n,e):n,Kt=class{path;patterns;opts;seen=new Set;paused=!1;aborted=!1;#e=[];#s;#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.#s=Il(s.ignore??[],s),!this.includeChildMatches&&typeof this.#s.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.#s?.ignored?.(e)}#o(e){return!!this.#s?.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.#s?.add){let r=`${e.relativePosix()}/**`;this.#s.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 dt(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 dt(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()}},gt=class extends Kt{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}},pt=class extends Kt{results;constructor(e,t,s){super(e,t,s),this.results=new xe({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 Ll=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",ne=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,Or.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||Ll,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"?Ge:t.platform==="darwin"?ft:t.platform?qe:Er;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 G(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 Ye(l,u,0,this.platform)})}async walk(){return[...await new gt(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 gt(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 pt(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 pt(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 ni=(n,e={})=>{Array.isArray(n)||(n=[n]);for(let t of n)if(new G(t,e).hasMagic())return!0;return!1};function Zt(n,e={}){return new ne(n,e).streamSync()}function $r(n,e={}){return new ne(n,e).stream()}function kr(n,e={}){return new ne(n,e).walkSync()}async function Ar(n,e={}){return new ne(n,e).walk()}function Qt(n,e={}){return new ne(n,e).iterateSync()}function Fr(n,e={}){return new ne(n,e).iterate()}var Dl=Zt,Nl=Object.assign($r,{sync:Zt}),Wl=Qt,Hl=Object.assign(Fr,{sync:Qt}),Vl=Object.assign(kr,{stream:Zt,iterate:Qt}),Xt=Object.assign(Ar,{glob:Ar,globSync:kr,sync:Vl,globStream:$r,stream:Nl,globStreamSync:Zt,streamSync:Dl,globIterate:Fr,iterate:Hl,globIterateSync:Qt,iterateSync:Wl,Glob:ne,hasMagic:ni,escape:We,unescape:te});Xt.glob=Xt;var Bl=[{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"}],Ul=[{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"}],zl=[{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"}],Gl=[{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"}],ql=[...Bl,...Ul,...zl,...Gl];function Rr(n,e,t){let s=[];for(let i of ql){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:Yl(n.trim(),r.index,r[0].length),suggestion:i.suggestion})}return s}function Yl(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 jr(n,e=[]){let t=[];for(let o of n)if(Ke.existsSync(o)&&Ke.statSync(o).isFile())t.push(o);else{let a=await Xt("**/*.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=Ke.readFileSync(o,"utf-8")}catch{continue}let l=a.split(`
|
|
110
|
-
`),c=[];for(let
|
|
111
|
-
`;_.appendFileSync(
|
|
94
|
+
</body></html>`),clearTimeout(c),i.close(),a({api_key:d,email:m||"",name:g||""});return}h.writeHead(302,{Location:r}),h.end()})});try{await(0,Un.default)(r)}catch{e?.quiet||(console.log(` ${f.yellow("!")} couldn't open browser. visit:`),console.log(` ${f.cyan(r)}
|
|
95
|
+
`))}try{let{api_key:a,email:l,name:c}=await o;Mt({api_key:a,base_url:ke,user_email:l,user_name:c}),e?.quiet||console.log(` ${f.green("\u2713")} authenticated as ${f.bold(l||c)}`);try{let u=await N("/cli/heartbeat");e?.quiet||(u.plan==="none"||u.status==="none"?(console.log(` ${f.yellow("!")} no active subscription`),console.log(` ${f.dim("visit")} ${f.cyan(`${ke}/dashboard`)} ${f.dim("to subscribe")}`)):console.log(` ${f.green("\u2713")} plan: ${f.bold(u.plan)}`))}catch{}n&&(Wi({profile:n}),e?.quiet||console.log(` ${f.green("\u2713")} default profile set to ${f.bold(n)}`)),await Zi(n,e?.quiet)}catch(a){console.log(`
|
|
96
|
+
${f.red("\u2717")} authentication failed: ${a.message}`),process.exit(1)}}async function Zi(n,e){await La()||Na(),e||console.log(` ${f.green("\u2713")} voice profile: ${f.dim(Be)}`);let{installed:i,needsConfig:s}=Va();if(!e){if(i.length>0){console.log(`
|
|
97
|
+
${f.green("\u2713")} connected to:`);for(let r of i)console.log(` ${f.dim("\u2192")} ${r}`)}if(s.includes("chatgpt")){console.log(`
|
|
98
|
+
${f.cyan("\u2192")} opening chatgpt connector settings...`),console.log(` ${f.dim("add server:")} ${f.cyan("https://holdyourvoice.com/mcp")}`),console.log(` ${f.dim("auth: your CLI key will be used automatically")}`);try{let r=(await Promise.resolve().then(()=>C(Le()))).default;await r("https://chatgpt.com/#settings/Connectors")}catch{}}console.log(`
|
|
99
|
+
${f.dim('say "rewrite in my voice" in any connected agent to get started')}`)}}async function Ha(n){Mt({api_key:n,base_url:ke});try{let e=await N("/cli/heartbeat");Mt({api_key:n,base_url:ke,user_email:e.email,user_name:e.name}),console.log(` ${f.green("\u2713")} authenticated with license key`)}catch(e){console.log(` ${f.red("\u2717")} invalid license key: ${e.message}`),process.exit(1)}}var tt=C(require("fs")),vs=C(require("path"));var dr=C(nr(),1);var ut=n=>{if(typeof n!="string")throw new TypeError("invalid pattern");if(n.length>65536)throw new TypeError("pattern is too long")};var Ka={"[: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]},ft=n=>n.replace(/[[\]\\-]/g,"\\$&"),Xa=n=>n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),rr=n=>n.join(""),or=(n,e)=>{let t=e;if(n.charAt(t)!=="[")throw new Error("not in a brace expression");let i=[],s=[],r=t+1,o=!1,a=!1,l=!1,c=!1,u=t,h="";e:for(;r<n.length;){let g=n.charAt(r);if((g==="!"||g==="^")&&r===t+1){c=!0,r++;continue}if(g==="]"&&o&&!l){u=r+1;break}if(o=!0,g==="\\"&&!l){l=!0,r++;continue}if(g==="["&&!l){for(let[y,[b,v,x]]of Object.entries(Ka))if(n.startsWith(y,r)){if(h)return["$.",!1,n.length-t,!0];r+=y.length,x?s.push(b):i.push(b),a=a||v;continue e}}if(l=!1,h){g>h?i.push(ft(h)+"-"+ft(g)):g===h&&i.push(ft(g)),h="",r++;continue}if(n.startsWith("-]",r+1)){i.push(ft(g+"-")),r+=2;continue}if(n.startsWith("-",r+1)){h=g,r+=2;continue}i.push(ft(g)),r++}if(u<r)return["",!1,0,!1];if(!i.length&&!s.length)return["$.",!1,n.length-t,!0];if(s.length===0&&i.length===1&&/^\\?.$/.test(i[0])&&!c){let g=i[0].length===2?i[0].slice(-1):i[0];return[Xa(g),!1,u-t,!1]}let p="["+(c?"^":"")+rr(i)+"]",d="["+(c?"":"^")+rr(s)+"]";return[i.length&&s.length?"("+p+"|"+d+")":i.length?p:d,a,u-t,!0]};var ie=(n,{windowsPathsNoEscape:e=!1}={})=>e?n.replace(/\[([^\/\\])\]/g,"$1"):n.replace(/((?!\\).|^)\[([^\/\\])\]/g,"$1$2").replace(/\\([^\/])/g,"$1");var B,Za=new Set(["!","?","+","*","@"]),is=n=>Za.has(n),ar=n=>is(n.type),Qa=new Map([["!",["@"]],["?",["?","@"]],["@",["@"]],["*",["*","+","?","@"]],["+",["+","@"]]]),el=new Map([["!",["?"]],["@",["?"]],["+",["?","*"]]]),tl=new Map([["!",["?","@"]],["?",["?","@"]],["@",["?","@"]],["*",["*","+","?","@"]],["+",["+","@","?","*"]]]),lr=new Map([["!",new Map([["!","@"]])],["?",new Map([["*","*"],["+","*"]])],["@",new Map([["!","!"],["?","?"],["@","@"],["*","*"],["+","+"]])],["+",new Map([["?","*"],["*","*"]])]]),il="(?!(?:^|/)\\.\\.?(?:$|/))",Bt="(?!\\.)",sl=new Set(["[","."]),nl=new Set(["..","."]),rl=new Set("().*{}+?[]^$\\!"),ol=n=>n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),ss="[^/]",cr=ss+"*?",hr=ss+"+?",Fe=class{type;#e;#i;#n=!1;#t=[];#o;#x;#c;#u=!1;#l;#a;#r=!1;constructor(e,t,i={}){this.type=e,e&&(this.#i=!0),this.#o=t,this.#e=this.#o?this.#o.#e:this,this.#l=this.#e===this?i:this.#e.#l,this.#c=this.#e===this?[]:this.#e.#c,e==="!"&&!this.#e.#u&&this.#c.push(this),this.#x=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.#a!==void 0?this.#a:this.type?this.#a=this.type+"("+this.#t.map(e=>String(e)).join("|")+")":this.#a=this.#t.map(e=>String(e)).join("")}#y(){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.#c.pop();){if(e.type!=="!")continue;let t=e,i=t.#o;for(;i;){for(let s=t.#x+1;!i.type&&s<i.#t.length;s++)for(let r of e.#t){if(typeof r=="string")throw new Error("string part in extglob AST??");r.copyIn(i.#t[s])}t=i,i=t.#o}}return this}push(...e){for(let t of e)if(t!==""){if(typeof t!="string"&&!(t instanceof B&&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.#x===0)return!0;let e=this.#o;for(let t=0;t<this.#x;t++){let i=e.#t[t];if(!(i instanceof B&&i.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.#x===e-1}copyIn(e){typeof e=="string"?this.push(e):this.push(e.clone(this))}clone(e){let t=new B(this.type,e);for(let i of this.#t)t.copyIn(i);return t}static#b(e,t,i,s,r){let o=s.maxExtglobRecursion??2,a=!1,l=!1,c=-1,u=!1;if(t.type===null){let g=i,y="";for(;g<e.length;){let b=e.charAt(g++);if(a||b==="\\"){a=!a,y+=b;continue}if(l){g===c+1?(b==="^"||b==="!")&&(u=!0):b==="]"&&!(g===c+2&&u)&&(l=!1),y+=b;continue}else if(b==="["){l=!0,c=g,u=!1,y+=b;continue}if(!s.noext&&is(b)&&e.charAt(g)==="("&&r<=o){t.push(y),y="";let x=new B(b,t);g=B.#b(e,x,g,s,r+1),t.push(x);continue}y+=b}return t.push(y),g}let h=i+1,p=new B(null,t),d=[],m="";for(;h<e.length;){let g=e.charAt(h++);if(a||g==="\\"){a=!a,m+=g;continue}if(l){h===c+1?(g==="^"||g==="!")&&(u=!0):g==="]"&&!(h===c+2&&u)&&(l=!1),m+=g;continue}else if(g==="["){l=!0,c=h,u=!1,m+=g;continue}if(is(g)&&e.charAt(h)==="("&&(r<=o||t&&t.#S(g))){let b=t&&t.#S(g)?0:1;p.push(m),m="";let v=new B(g,p);p.push(v),h=B.#b(e,v,h,s,r+b);continue}if(g==="|"){p.push(m),m="",d.push(p),p=new B(null,t);continue}if(g===")")return m===""&&t.#t.length===0&&(t.#r=!0),p.push(m),m="",t.push(...d,p),h;m+=g}return t.type=null,t.#i=void 0,t.#t=[e.substring(i-1)],h}#g(e){return this.#d(e,el)}#d(e,t=Qa){if(!e||typeof e!="object"||e.type!==null||e.#t.length!==1||this.type===null)return!1;let i=e.#t[0];return!i||typeof i!="object"||i.type===null?!1:this.#S(i.type,t)}#S(e,t=tl){return!!t.get(this.type)?.includes(e)}#p(e,t){let i=e.#t[0],s=new B(null,i,this.options);s.#t.push(""),i.push(s),this.#C(e,t)}#C(e,t){let i=e.#t[0];this.#t.splice(t,1,...i.#t);for(let s of i.#t)typeof s=="object"&&(s.#o=this);this.#a=void 0}#E(e){return!!lr.get(this.type)?.has(e)}#m(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.#E(t.type)}#_(e){let t=lr.get(this.type),i=e.#t[0],s=t?.get(i.type);if(!s)return!1;this.#t=i.#t;for(let r of this.#t)typeof r=="object"&&(r.#o=this);this.type=s,this.#a=void 0,this.#r=!1}#w(){if(ar(this)){let e=0,t=!1;do{t=!0;for(let i=0;i<this.#t.length;i++){let s=this.#t[i];typeof s=="object"&&(s.#w(),this.#d(s)?(t=!1,this.#C(s,i)):this.#g(s)?(t=!1,this.#p(s,i)):this.#m(s)&&(t=!1,this.#_(s)))}}while(!t&&++e<10)}else for(let e of this.#t)typeof e=="object"&&e.#w();this.#a=void 0}static fromGlob(e,t={}){let i=new B(null,void 0,t);return B.#b(e,i,0,t,0),i}toMMPattern(){if(this!==this.#e)return this.#e.toMMPattern();let e=this.toString(),[t,i,s,r]=this.toRegExpSource();if(!(s||this.#i||this.#l.nocase&&!this.#l.nocaseMagicOnly&&e.toUpperCase()!==e.toLowerCase()))return i;let a=(this.#l.nocase?"i":"")+(r?"u":"");return Object.assign(new RegExp(`^${t}$`,a),{_src:t,_glob:e})}get options(){return this.#l}toRegExpSource(e){let t=e??!!this.#l.dot;if(this.#e===this&&(this.#w(),this.#y()),!ar(this)){let l=this.isStart()&&this.isEnd(),c=this.#t.map(d=>{let[m,g,y,b]=typeof d=="string"?B.#$(d,this.#i,l):d.toRegExpSource(e);return this.#i=this.#i||y,this.#n=this.#n||b,m}).join(""),u="";if(this.isStart()&&typeof this.#t[0]=="string"&&!(this.#t.length===1&&nl.has(this.#t[0]))){let m=sl,g=t&&m.has(c.charAt(0))||c.startsWith("\\.")&&m.has(c.charAt(2))||c.startsWith("\\.\\.")&&m.has(c.charAt(4)),y=!t&&!e&&m.has(c.charAt(0));u=g?il:y?Bt:""}let h="";return this.isEnd()&&this.#e.#u&&this.#o?.type==="!"&&(h="(?:$|\\/)"),[u+c+h,ie(c),this.#i=!!this.#i,this.#n]}let i=this.type==="*"||this.type==="+",s=this.type==="!"?"(?:(?!(?:":"(?:",r=this.#f(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,ie(this.toString()),!1,!1]}let o=!i||e||t||!Bt?"":this.#f(!0);o===r&&(o=""),o&&(r=`(?:${r})(?:${o})*?`);let a="";if(this.type==="!"&&this.#r)a=(this.isStart()&&!t?Bt:"")+hr;else{let l=this.type==="!"?"))"+(this.isStart()&&!t&&!e?Bt:"")+cr+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&o?")":this.type==="*"&&o?")?":`)${this.type}`;a=s+r+l}return[a,ie(r),this.#i=!!this.#i,this.#n]}#f(e){return this.#t.map(t=>{if(typeof t=="string")throw new Error("string type in extglob ast??");let[i,s,r,o]=t.toRegExpSource(e);return this.#n=this.#n||o,i}).filter(t=>!(this.isStart()&&this.isEnd())||!!t).join("|")}static#$(e,t,i=!1){let s=!1,r="",o=!1,a=!1;for(let l=0;l<e.length;l++){let c=e.charAt(l);if(s){s=!1,r+=(rl.has(c)?"\\":"")+c,a=!1;continue}if(c==="\\"){l===e.length-1?r+="\\\\":s=!0;continue}if(c==="["){let[u,h,p,d]=or(e,l);if(p){r+=u,o=o||h,l+=p-1,t=t||d,a=!1;continue}}if(c==="*"){if(a)continue;a=!0,r+=i&&/^[*]+$/.test(e)?hr:cr,t=!0;continue}else a=!1;if(c==="?"){r+=ss,t=!0;continue}r+=ol(c)}return[r,ie(e),!!t,o]}};B=Fe;var ze=(n,{windowsPathsNoEscape:e=!1}={})=>e?n.replace(/[?*()[\]]/g,"[$&]"):n.replace(/[?*()[\]\\]/g,"\\$&");var V=(n,e,t={})=>(ut(e),!t.nocomment&&e.charAt(0)==="#"?!1:new G(e,t).match(n)),al=/^\*+([^+@!?\*\[\(]*)$/,ll=n=>e=>!e.startsWith(".")&&e.endsWith(n),cl=n=>e=>e.endsWith(n),hl=n=>(n=n.toLowerCase(),e=>!e.startsWith(".")&&e.toLowerCase().endsWith(n)),ul=n=>(n=n.toLowerCase(),e=>e.toLowerCase().endsWith(n)),fl=/^\*+\.\*+$/,dl=n=>!n.startsWith(".")&&n.includes("."),pl=n=>n!=="."&&n!==".."&&n.includes("."),gl=/^\.\*+$/,ml=n=>n!=="."&&n!==".."&&n.startsWith("."),yl=/^\*+$/,bl=n=>n.length!==0&&!n.startsWith("."),wl=n=>n.length!==0&&n!=="."&&n!=="..",vl=/^\?+([^+@!?\*\[\(]*)?$/,xl=([n,e=""])=>{let t=pr([n]);return e?(e=e.toLowerCase(),i=>t(i)&&i.toLowerCase().endsWith(e)):t},Sl=([n,e=""])=>{let t=gr([n]);return e?(e=e.toLowerCase(),i=>t(i)&&i.toLowerCase().endsWith(e)):t},_l=([n,e=""])=>{let t=gr([n]);return e?i=>t(i)&&i.endsWith(e):t},Cl=([n,e=""])=>{let t=pr([n]);return e?i=>t(i)&&i.endsWith(e):t},pr=([n])=>{let e=n.length;return t=>t.length===e&&!t.startsWith(".")},gr=([n])=>{let e=n.length;return t=>t.length===e&&t!=="."&&t!==".."},mr=typeof process=="object"&&process?typeof process.env=="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",ur={win32:{sep:"\\"},posix:{sep:"/"}},El=mr==="win32"?ur.win32.sep:ur.posix.sep;V.sep=El;var k=Symbol("globstar **");V.GLOBSTAR=k;var $l="[^/]",Ol=$l+"*?",Al="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",kl="(?:(?!(?:\\/|^)\\.).)*?",Fl=(n,e={})=>t=>V(t,n,e);V.filter=Fl;var X=(n,e={})=>Object.assign({},n,e),Rl=n=>{if(!n||typeof n!="object"||!Object.keys(n).length)return V;let e=V;return Object.assign((i,s,r={})=>e(i,s,X(n,r)),{Minimatch:class extends e.Minimatch{constructor(s,r={}){super(s,X(n,r))}static defaults(s){return e.defaults(X(n,s)).Minimatch}},AST:class extends e.AST{constructor(s,r,o={}){super(s,r,X(n,o))}static fromGlob(s,r={}){return e.AST.fromGlob(s,X(n,r))}},unescape:(i,s={})=>e.unescape(i,X(n,s)),escape:(i,s={})=>e.escape(i,X(n,s)),filter:(i,s={})=>e.filter(i,X(n,s)),defaults:i=>e.defaults(X(n,i)),makeRe:(i,s={})=>e.makeRe(i,X(n,s)),braceExpand:(i,s={})=>e.braceExpand(i,X(n,s)),match:(i,s,r={})=>e.match(i,s,X(n,r)),sep:e.sep,GLOBSTAR:k})};V.defaults=Rl;var yr=(n,e={})=>(ut(n),e.nobrace||!/\{(?:(?!\{).)*\}/.test(n)?[n]:(0,dr.default)(n));V.braceExpand=yr;var jl=(n,e={})=>new G(n,e).makeRe();V.makeRe=jl;var Tl=(n,e,t={})=>{let i=new G(e,t);return n=n.filter(s=>i.match(s)),i.options.nonull&&!n.length&&n.push(e),n};V.match=Tl;var fr=/[?*]|[+@!]\(.*?\)|\[|\]/,Pl=n=>n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),G=class{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;maxGlobstarRecursion;regexp;constructor(e,t={}){ut(e),t=t||{},this.options=t,this.maxGlobstarRecursion=t.maxGlobstarRecursion??200,this.pattern=e,this.platform=t.platform||mr,this.isWindows=this.platform==="win32",this.windowsPathsNoEscape=!!t.windowsPathsNoEscape||t.allowWindowsEscape===!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 i=this.globSet.map(r=>this.slashSplit(r));this.globParts=this.preprocess(i),this.debug(this.pattern,this.globParts);let s=this.globParts.map((r,o,a)=>{if(this.isWindows&&this.windowsNoMagicRoot){let l=r[0]===""&&r[1]===""&&(r[2]==="?"||!fr.test(r[2]))&&!fr.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,s),this.set=s.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 i=0;i<e.length;i++)for(let s=0;s<e[i].length;s++)e[i][s]==="**"&&(e[i][s]="*");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 i=-1;for(;(i=t.indexOf("**",i+1))!==-1;){let s=i;for(;t[s+1]==="**";)s++;s!==i&&t.splice(i,s-i)}return t})}levelOneOptimize(e){return e.map(t=>(t=t.reduce((i,s)=>{let r=i[i.length-1];return s==="**"&&r==="**"?i:s===".."&&r&&r!==".."&&r!=="."&&r!=="**"?(i.pop(),i):(i.push(s),i)},[]),t.length===0?[""]:t))}levelTwoFileOptimize(e){Array.isArray(e)||(e=this.slashSplit(e));let t=!1;do{if(t=!1,!this.preserveMultipleSlashes){for(let s=1;s<e.length-1;s++){let r=e[s];s===1&&r===""&&e[0]===""||(r==="."||r==="")&&(t=!0,e.splice(s,1),s--)}e[0]==="."&&e.length===2&&(e[1]==="."||e[1]==="")&&(t=!0,e.pop())}let i=0;for(;(i=e.indexOf("..",i+1))!==-1;){let s=e[i-1];s&&s!=="."&&s!==".."&&s!=="**"&&(t=!0,e.splice(i-1,2),i-=2)}}while(t);return e.length===0?[""]:e}firstPhasePreProcess(e){let t=!1;do{t=!1;for(let i of e){let s=-1;for(;(s=i.indexOf("**",s+1))!==-1;){let o=s;for(;i[o+1]==="**";)o++;o>s&&i.splice(s+1,o-s);let a=i[s+1],l=i[s+2],c=i[s+3];if(a!==".."||!l||l==="."||l===".."||!c||c==="."||c==="..")continue;t=!0,i.splice(s,1);let u=i.slice(0);u[s]="**",e.push(u),s--}if(!this.preserveMultipleSlashes){for(let o=1;o<i.length-1;o++){let a=i[o];o===1&&a===""&&i[0]===""||(a==="."||a==="")&&(t=!0,i.splice(o,1),o--)}i[0]==="."&&i.length===2&&(i[1]==="."||i[1]==="")&&(t=!0,i.pop())}let r=0;for(;(r=i.indexOf("..",r+1))!==-1;){let o=i[r-1];if(o&&o!=="."&&o!==".."&&o!=="**"){t=!0;let l=r===1&&i[r+1]==="**"?["."]:[];i.splice(r-1,2,...l),i.length===0&&i.push(""),r-=2}}}}while(t);return e}secondPhasePreProcess(e){for(let t=0;t<e.length-1;t++)for(let i=t+1;i<e.length;i++){let s=this.partsMatch(e[t],e[i],!this.preserveMultipleSlashes);if(s){e[t]=[],e[i]=s;break}}return e.filter(t=>t.length)}partsMatch(e,t,i=!1){let s=0,r=0,o=[],a="";for(;s<e.length&&r<t.length;)if(e[s]===t[r])o.push(a==="b"?t[r]:e[s]),s++,r++;else if(i&&e[s]==="**"&&t[r]===e[s+1])o.push(e[s]),s++;else if(i&&t[r]==="**"&&e[s]===t[r+1])o.push(t[r]),r++;else if(e[s]==="*"&&t[r]&&(this.options.dot||!t[r].startsWith("."))&&t[r]!=="**"){if(a==="b")return!1;a="a",o.push(e[s]),s++,r++}else if(t[r]==="*"&&e[s]&&(this.options.dot||!e[s].startsWith("."))&&e[s]!=="**"){if(a==="a")return!1;a="b",o.push(t[r]),s++,r++}else return!1;return e.length===t.length&&o}parseNegate(){if(this.nonegate)return;let e=this.pattern,t=!1,i=0;for(let s=0;s<e.length&&e.charAt(s)==="!";s++)t=!t,i++;i&&(this.pattern=e.slice(i)),this.negate=t}matchOne(e,t,i=!1){let s=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,p=u?3:c?0:void 0;if(typeof h=="number"&&typeof p=="number"){let[d,m]=[e[h],t[p]];d.toLowerCase()===m.toLowerCase()&&(t[p]=d,r=p,s=h)}}let{optimizationLevel:o=1}=this.options;return o>=2&&(e=this.levelTwoFileOptimize(e)),t.includes(k)?this.#e(e,t,i,s,r):this.#n(e,t,i,s,r)}#e(e,t,i,s,r){let o=t.indexOf(k,r),a=t.lastIndexOf(k),[l,c,u]=i?[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 v=e.slice(s,s+l.length);if(!this.#n(v,l,i,0,0))return!1;s+=l.length}let h=0;if(u.length){if(u.length+s>e.length)return!1;let v=e.length-u.length;if(this.#n(e,u,i,v,0))h=u.length;else{if(e[e.length-1]!==""||s+u.length===e.length||(v--,!this.#n(e,u,i,v,0)))return!1;h=u.length+1}}if(!c.length){let v=!!h;for(let x=s;x<e.length-h;x++){let S=String(e[x]);if(v=!0,S==="."||S===".."||!this.options.dot&&S.startsWith("."))return!1}return i||v}let p=[[[],0]],d=p[0],m=0,g=[0];for(let v of c)v===k?(g.push(m),d=[[],0],p.push(d)):(d[0].push(v),m++);let y=p.length-1,b=e.length-h;for(let v of p)v[1]=b-(g[y--]+v[0].length);return!!this.#i(e,p,s,0,i,0,!!h)}#i(e,t,i,s,r,o,a){let l=t[s];if(!l){for(let h=i;h<e.length;h++){a=!0;let p=e[h];if(p==="."||p===".."||!this.options.dot&&p.startsWith("."))return!1}return a}let[c,u]=l;for(;i<=u;){if(this.#n(e.slice(0,i+c.length),c,r,i,0)&&o<this.maxGlobstarRecursion){let d=this.#i(e,t,i+c.length,s+1,r,o+1,a);if(d!==!1)return d}let p=e[i];if(p==="."||p===".."||!this.options.dot&&p.startsWith("."))return!1;i++}return r||null}#n(e,t,i,s,r){let o,a,l,c;for(o=s,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===k)return!1;let p;if(typeof u=="string"?(p=h===u,this.debug("string match",u,h,p)):(p=u.test(h),this.debug("pattern match",u,h,p)),!p)return!1}if(o===c&&a===l)return!0;if(o===c)return i;if(a===l)return o===c-1&&e[o]==="";throw new Error("wtf?")}braceExpand(){return yr(this.pattern,this.options)}parse(e){ut(e);let t=this.options;if(e==="**")return k;if(e==="")return"";let i,s=null;(i=e.match(yl))?s=t.dot?wl:bl:(i=e.match(al))?s=(t.nocase?t.dot?ul:hl:t.dot?cl:ll)(i[1]):(i=e.match(vl))?s=(t.nocase?t.dot?Sl:xl:t.dot?_l:Cl)(i):(i=e.match(fl))?s=t.dot?pl:dl:(i=e.match(gl))&&(s=ml);let r=Fe.fromGlob(e,this.options).toMMPattern();return s&&typeof r=="object"&&Reflect.defineProperty(r,"test",{value:s}),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,i=t.noglobstar?Ol:t.dot?Al:kl,s=new Set(t.nocase?["i"]:[]),r=e.map(l=>{let c=l.map(u=>{if(u instanceof RegExp)for(let h of u.flags.split(""))s.add(h);return typeof u=="string"?Pl(u):u===k?k:u._src});return c.forEach((u,h)=>{let p=c[h+1],d=c[h-1];u!==k||d===k||(d===void 0?p!==void 0&&p!==k?c[h+1]="(?:\\/|"+i+"\\/)?"+p:c[h]=i:p===void 0?c[h-1]=d+"(?:\\/|"+i+")?":p!==k&&(c[h-1]=d+"(?:\\/|\\/"+i+"\\/)"+p,c[h+1]=k))}),c.filter(u=>u!==k).join("/")}).join("|"),[o,a]=e.length>1?["(?:",")"]:["",""];r="^"+o+r+a+"$",this.negate&&(r="^(?!"+r+").+$");try{this.regexp=new RegExp(r,[...s].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 i=this.options;this.isWindows&&(e=e.split("\\").join("/"));let s=this.slashSplit(e);this.debug(this.pattern,"split",s);let r=this.set;this.debug(this.pattern,"set",r);let o=s[s.length-1];if(!o)for(let a=s.length-2;!o&&a>=0;a--)o=s[a];for(let a=0;a<r.length;a++){let l=r[a],c=s;if(i.matchBase&&l.length===1&&(c=[o]),this.matchOne(c,l,t))return i.flipNegate?!0:!this.negate}return i.flipNegate?!1:this.negate}static defaults(e){return V.defaults(e).Minimatch}};V.AST=Fe;V.Minimatch=G;V.escape=ze;V.unescape=ie;var Vr=require("node:url");var qe=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,wr=new Set,ns=typeof process=="object"&&process?process:{},vr=(n,e,t,i)=>{typeof ns.emitWarning=="function"?ns.emitWarning(n,e,t,i):console.error(`[${t}] ${e}: ${n}`)},Ut=globalThis.AbortController,br=globalThis.AbortSignal;if(typeof Ut>"u"){br=class{onabort;_onabort=[];reason;aborted=!1;addEventListener(i,s){this._onabort.push(s)}},Ut=class{constructor(){e()}signal=new br;abort(i){if(!this.signal.aborted){this.signal.reason=i,this.signal.aborted=!0;for(let s of this.signal._onabort)s(i);this.signal.onabort?.(i)}}};let n=ns.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",e=()=>{n&&(n=!1,vr("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",e))}}var Ml=n=>!wr.has(n),mu=Symbol("type"),ve=n=>n&&n===Math.floor(n)&&n>0&&isFinite(n),xr=n=>ve(n)?n<=Math.pow(2,8)?Uint8Array:n<=Math.pow(2,16)?Uint16Array:n<=Math.pow(2,32)?Uint32Array:n<=Number.MAX_SAFE_INTEGER?Ge:null:null,Ge=class extends Array{constructor(e){super(e),this.fill(0)}},rs=class n{heap;length;static#e=!1;static create(e){let t=xr(e);if(!t)return[];n.#e=!0;let i=new n(e,t);return n.#e=!1,i}constructor(e,t){if(!n.#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]}},dt=class n{#e;#i;#n;#t;#o;#x;ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#c;#u;#l;#a;#r;#y;#b;#g;#d;#S;#p;#C;#E;#m;#_;#w;#f;static unsafeExposeInternals(e){return{starts:e.#E,ttls:e.#m,sizes:e.#C,keyMap:e.#l,keyList:e.#a,valList:e.#r,next:e.#y,prev:e.#b,get head(){return e.#g},get tail(){return e.#d},free:e.#S,isBackgroundFetch:t=>e.#h(t),backgroundFetch:(t,i,s,r)=>e.#N(t,i,s,r),moveToTail:t=>e.#W(t),indexes:t=>e.#A(t),rindexes:t=>e.#k(t),isStale:t=>e.#v(t)}}get max(){return this.#e}get maxSize(){return this.#i}get calculatedSize(){return this.#u}get size(){return this.#c}get fetchMethod(){return this.#o}get memoMethod(){return this.#x}get dispose(){return this.#n}get disposeAfter(){return this.#t}constructor(e){let{max:t=0,ttl:i,ttlResolution:s=1,ttlAutopurge:r,updateAgeOnGet:o,updateAgeOnHas:a,allowStale:l,dispose:c,disposeAfter:u,noDisposeOnSet:h,noUpdateTTL:p,maxSize:d=0,maxEntrySize:m=0,sizeCalculation:g,fetchMethod:y,memoMethod:b,noDeleteOnFetchRejection:v,noDeleteOnStaleGet:x,allowStaleOnFetchRejection:S,allowStaleOnFetchAbort:$,ignoreFetchAbort:z}=e;if(t!==0&&!ve(t))throw new TypeError("max option must be a nonnegative integer");let j=t?xr(t):Array;if(!j)throw new Error("invalid max value: "+t);if(this.#e=t,this.#i=d,this.maxEntrySize=m||this.#i,this.sizeCalculation=g,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(b!==void 0&&typeof b!="function")throw new TypeError("memoMethod must be a function if defined");if(this.#x=b,y!==void 0&&typeof y!="function")throw new TypeError("fetchMethod must be a function if specified");if(this.#o=y,this.#w=!!y,this.#l=new Map,this.#a=new Array(t).fill(void 0),this.#r=new Array(t).fill(void 0),this.#y=new j(t),this.#b=new j(t),this.#g=0,this.#d=0,this.#S=rs.create(t),this.#c=0,this.#u=0,typeof c=="function"&&(this.#n=c),typeof u=="function"?(this.#t=u,this.#p=[]):(this.#t=void 0,this.#p=void 0),this.#_=!!this.#n,this.#f=!!this.#t,this.noDisposeOnSet=!!h,this.noUpdateTTL=!!p,this.noDeleteOnFetchRejection=!!v,this.allowStaleOnFetchRejection=!!S,this.allowStaleOnFetchAbort=!!$,this.ignoreFetchAbort=!!z,this.maxEntrySize!==0){if(this.#i!==0&&!ve(this.#i))throw new TypeError("maxSize must be a positive integer if specified");if(!ve(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#F()}if(this.allowStale=!!l,this.noDeleteOnStaleGet=!!x,this.updateAgeOnGet=!!o,this.updateAgeOnHas=!!a,this.ttlResolution=ve(s)||s===0?s:1,this.ttlAutopurge=!!r,this.ttl=i||0,this.ttl){if(!ve(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#$()}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 $e="LRU_CACHE_UNBOUNDED";Ml($e)&&(wr.add($e),vr("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",$e,n))}}getRemainingTTL(e){return this.#l.has(e)?1/0:0}#$(){let e=new Ge(this.#e),t=new Ge(this.#e);this.#m=e,this.#E=t,this.#j=(r,o,a=qe.now())=>{if(t[r]=o!==0?a:0,e[r]=o,o!==0&&this.ttlAutopurge){let l=setTimeout(()=>{this.#v(r)&&this.#R(this.#a[r],"expire")},o+1);l.unref&&l.unref()}},this.#O=r=>{t[r]=e[r]!==0?qe.now():0},this.#s=(r,o)=>{if(e[o]){let a=e[o],l=t[o];if(!a||!l)return;r.ttl=a,r.start=l,r.now=i||s();let c=r.now-l;r.remainingTTL=a-c}};let i=0,s=()=>{let r=qe.now();if(this.ttlResolution>0){i=r;let o=setTimeout(()=>i=0,this.ttlResolution);o.unref&&o.unref()}return r};this.getRemainingTTL=r=>{let o=this.#l.get(r);if(o===void 0)return 0;let a=e[o],l=t[o];if(!a||!l)return 1/0;let c=(i||s())-l;return a-c},this.#v=r=>{let o=t[r],a=e[r];return!!a&&!!o&&(i||s())-o>a}}#O=()=>{};#s=()=>{};#j=()=>{};#v=()=>!1;#F(){let e=new Ge(this.#e);this.#u=0,this.#C=e,this.#T=t=>{this.#u-=e[t],e[t]=0},this.#M=(t,i,s,r)=>{if(this.#h(i))return 0;if(!ve(s))if(r){if(typeof r!="function")throw new TypeError("sizeCalculation must be a function");if(s=r(i,t),!ve(s))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 s},this.#P=(t,i,s)=>{if(e[t]=i,this.#i){let r=this.#i-e[t];for(;this.#u>r;)this.#L(!0)}this.#u+=e[t],s&&(s.entrySize=i,s.totalCalculatedSize=this.#u)}}#T=e=>{};#P=(e,t,i)=>{};#M=(e,t,i,s)=>{if(i||s)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#A({allowStale:e=this.allowStale}={}){if(this.#c)for(let t=this.#d;!(!this.#I(t)||((e||!this.#v(t))&&(yield t),t===this.#g));)t=this.#b[t]}*#k({allowStale:e=this.allowStale}={}){if(this.#c)for(let t=this.#g;!(!this.#I(t)||((e||!this.#v(t))&&(yield t),t===this.#d));)t=this.#y[t]}#I(e){return e!==void 0&&this.#l.get(this.#a[e])===e}*entries(){for(let e of this.#A())this.#r[e]!==void 0&&this.#a[e]!==void 0&&!this.#h(this.#r[e])&&(yield[this.#a[e],this.#r[e]])}*rentries(){for(let e of this.#k())this.#r[e]!==void 0&&this.#a[e]!==void 0&&!this.#h(this.#r[e])&&(yield[this.#a[e],this.#r[e]])}*keys(){for(let e of this.#A()){let t=this.#a[e];t!==void 0&&!this.#h(this.#r[e])&&(yield t)}}*rkeys(){for(let e of this.#k()){let t=this.#a[e];t!==void 0&&!this.#h(this.#r[e])&&(yield t)}}*values(){for(let e of this.#A())this.#r[e]!==void 0&&!this.#h(this.#r[e])&&(yield this.#r[e])}*rvalues(){for(let e of this.#k())this.#r[e]!==void 0&&!this.#h(this.#r[e])&&(yield this.#r[e])}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(e,t={}){for(let i of this.#A()){let s=this.#r[i],r=this.#h(s)?s.__staleWhileFetching:s;if(r!==void 0&&e(r,this.#a[i],this))return this.get(this.#a[i],t)}}forEach(e,t=this){for(let i of this.#A()){let s=this.#r[i],r=this.#h(s)?s.__staleWhileFetching:s;r!==void 0&&e.call(t,r,this.#a[i],this)}}rforEach(e,t=this){for(let i of this.#k()){let s=this.#r[i],r=this.#h(s)?s.__staleWhileFetching:s;r!==void 0&&e.call(t,r,this.#a[i],this)}}purgeStale(){let e=!1;for(let t of this.#k({allowStale:!0}))this.#v(t)&&(this.#R(this.#a[t],"expire"),e=!0);return e}info(e){let t=this.#l.get(e);if(t===void 0)return;let i=this.#r[t],s=this.#h(i)?i.__staleWhileFetching:i;if(s===void 0)return;let r={value:s};if(this.#m&&this.#E){let o=this.#m[t],a=this.#E[t];if(o&&a){let l=o-(qe.now()-a);r.ttl=l,r.start=Date.now()}}return this.#C&&(r.size=this.#C[t]),r}dump(){let e=[];for(let t of this.#A({allowStale:!0})){let i=this.#a[t],s=this.#r[t],r=this.#h(s)?s.__staleWhileFetching:s;if(r===void 0||i===void 0)continue;let o={value:r};if(this.#m&&this.#E){o.ttl=this.#m[t];let a=qe.now()-this.#E[t];o.start=Math.floor(Date.now()-a)}this.#C&&(o.size=this.#C[t]),e.unshift([i,o])}return e}load(e){this.clear();for(let[t,i]of e){if(i.start){let s=Date.now()-i.start;i.start=qe.now()-s}this.set(t,i.value,i)}}set(e,t,i={}){if(t===void 0)return this.delete(e),this;let{ttl:s=this.ttl,start:r,noDisposeOnSet:o=this.noDisposeOnSet,sizeCalculation:a=this.sizeCalculation,status:l}=i,{noUpdateTTL:c=this.noUpdateTTL}=i,u=this.#M(e,t,i.size||0,a);if(this.maxEntrySize&&u>this.maxEntrySize)return l&&(l.set="miss",l.maxEntrySizeExceeded=!0),this.#R(e,"set"),this;let h=this.#c===0?void 0:this.#l.get(e);if(h===void 0)h=this.#c===0?this.#d:this.#S.length!==0?this.#S.pop():this.#c===this.#e?this.#L(!1):this.#c,this.#a[h]=e,this.#r[h]=t,this.#l.set(e,h),this.#y[this.#d]=h,this.#b[h]=this.#d,this.#d=h,this.#c++,this.#P(h,u,l),l&&(l.set="add"),c=!1;else{this.#W(h);let p=this.#r[h];if(t!==p){if(this.#w&&this.#h(p)){p.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:d}=p;d!==void 0&&!o&&(this.#_&&this.#n?.(d,e,"set"),this.#f&&this.#p?.push([d,e,"set"]))}else o||(this.#_&&this.#n?.(p,e,"set"),this.#f&&this.#p?.push([p,e,"set"]));if(this.#T(h),this.#P(h,u,l),this.#r[h]=t,l){l.set="replace";let d=p&&this.#h(p)?p.__staleWhileFetching:p;d!==void 0&&(l.oldValue=d)}}else l&&(l.set="update")}if(s!==0&&!this.#m&&this.#$(),this.#m&&(c||this.#j(h,s,r),l&&this.#s(l,h)),!o&&this.#f&&this.#p){let p=this.#p,d;for(;d=p?.shift();)this.#t?.(...d)}return this}pop(){try{for(;this.#c;){let e=this.#r[this.#g];if(this.#L(!0),this.#h(e)){if(e.__staleWhileFetching)return e.__staleWhileFetching}else if(e!==void 0)return e}}finally{if(this.#f&&this.#p){let e=this.#p,t;for(;t=e?.shift();)this.#t?.(...t)}}}#L(e){let t=this.#g,i=this.#a[t],s=this.#r[t];return this.#w&&this.#h(s)?s.__abortController.abort(new Error("evicted")):(this.#_||this.#f)&&(this.#_&&this.#n?.(s,i,"evict"),this.#f&&this.#p?.push([s,i,"evict"])),this.#T(t),e&&(this.#a[t]=void 0,this.#r[t]=void 0,this.#S.push(t)),this.#c===1?(this.#g=this.#d=0,this.#S.length=0):this.#g=this.#y[t],this.#l.delete(i),this.#c--,t}has(e,t={}){let{updateAgeOnHas:i=this.updateAgeOnHas,status:s}=t,r=this.#l.get(e);if(r!==void 0){let o=this.#r[r];if(this.#h(o)&&o.__staleWhileFetching===void 0)return!1;if(this.#v(r))s&&(s.has="stale",this.#s(s,r));else return i&&this.#O(r),s&&(s.has="hit",this.#s(s,r)),!0}else s&&(s.has="miss");return!1}peek(e,t={}){let{allowStale:i=this.allowStale}=t,s=this.#l.get(e);if(s===void 0||!i&&this.#v(s))return;let r=this.#r[s];return this.#h(r)?r.__staleWhileFetching:r}#N(e,t,i,s){let r=t===void 0?void 0:this.#r[t];if(this.#h(r))return r;let o=new Ut,{signal:a}=i;a?.addEventListener("abort",()=>o.abort(a.reason),{signal:o.signal});let l={signal:o.signal,options:i,context:s},c=(g,y=!1)=>{let{aborted:b}=o.signal,v=i.ignoreFetchAbort&&g!==void 0;if(i.status&&(b&&!y?(i.status.fetchAborted=!0,i.status.fetchError=o.signal.reason,v&&(i.status.fetchAbortIgnored=!0)):i.status.fetchResolved=!0),b&&!v&&!y)return h(o.signal.reason);let x=d;return this.#r[t]===d&&(g===void 0?x.__staleWhileFetching?this.#r[t]=x.__staleWhileFetching:this.#R(e,"fetch"):(i.status&&(i.status.fetchUpdated=!0),this.set(e,g,l.options))),g},u=g=>(i.status&&(i.status.fetchRejected=!0,i.status.fetchError=g),h(g)),h=g=>{let{aborted:y}=o.signal,b=y&&i.allowStaleOnFetchAbort,v=b||i.allowStaleOnFetchRejection,x=v||i.noDeleteOnFetchRejection,S=d;if(this.#r[t]===d&&(!x||S.__staleWhileFetching===void 0?this.#R(e,"fetch"):b||(this.#r[t]=S.__staleWhileFetching)),v)return i.status&&S.__staleWhileFetching!==void 0&&(i.status.returnedStale=!0),S.__staleWhileFetching;if(S.__returned===S)throw g},p=(g,y)=>{let b=this.#o?.(e,r,l);b&&b instanceof Promise&&b.then(v=>g(v===void 0?void 0:v),y),o.signal.addEventListener("abort",()=>{(!i.ignoreFetchAbort||i.allowStaleOnFetchAbort)&&(g(void 0),i.allowStaleOnFetchAbort&&(g=v=>c(v,!0)))})};i.status&&(i.status.fetchDispatched=!0);let d=new Promise(p).then(c,u),m=Object.assign(d,{__abortController:o,__staleWhileFetching:r,__returned:void 0});return t===void 0?(this.set(e,m,{...l.options,status:void 0}),t=this.#l.get(e)):this.#r[t]=m,m}#h(e){if(!this.#w)return!1;let t=e;return!!t&&t instanceof Promise&&t.hasOwnProperty("__staleWhileFetching")&&t.__abortController instanceof Ut}async fetch(e,t={}){let{allowStale:i=this.allowStale,updateAgeOnGet:s=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:p=this.allowStaleOnFetchRejection,ignoreFetchAbort:d=this.ignoreFetchAbort,allowStaleOnFetchAbort:m=this.allowStaleOnFetchAbort,context:g,forceRefresh:y=!1,status:b,signal:v}=t;if(!this.#w)return b&&(b.fetch="get"),this.get(e,{allowStale:i,updateAgeOnGet:s,noDeleteOnStaleGet:r,status:b});let x={allowStale:i,updateAgeOnGet:s,noDeleteOnStaleGet:r,ttl:o,noDisposeOnSet:a,size:l,sizeCalculation:c,noUpdateTTL:u,noDeleteOnFetchRejection:h,allowStaleOnFetchRejection:p,allowStaleOnFetchAbort:m,ignoreFetchAbort:d,status:b,signal:v},S=this.#l.get(e);if(S===void 0){b&&(b.fetch="miss");let $=this.#N(e,S,x,g);return $.__returned=$}else{let $=this.#r[S];if(this.#h($)){let ae=i&&$.__staleWhileFetching!==void 0;return b&&(b.fetch="inflight",ae&&(b.returnedStale=!0)),ae?$.__staleWhileFetching:$.__returned=$}let z=this.#v(S);if(!y&&!z)return b&&(b.fetch="hit"),this.#W(S),s&&this.#O(S),b&&this.#s(b,S),$;let j=this.#N(e,S,x,g),Me=j.__staleWhileFetching!==void 0&&i;return b&&(b.fetch=z?"stale":"refresh",Me&&z&&(b.returnedStale=!0)),Me?j.__staleWhileFetching:j.__returned=j}}async forceFetch(e,t={}){let i=await this.fetch(e,t);if(i===void 0)throw new Error("fetch() returned undefined");return i}memo(e,t={}){let i=this.#x;if(!i)throw new Error("no memoMethod provided to constructor");let{context:s,forceRefresh:r,...o}=t,a=this.get(e,o);if(!r&&a!==void 0)return a;let l=i(e,a,{options:o,context:s});return this.set(e,l,o),l}get(e,t={}){let{allowStale:i=this.allowStale,updateAgeOnGet:s=this.updateAgeOnGet,noDeleteOnStaleGet:r=this.noDeleteOnStaleGet,status:o}=t,a=this.#l.get(e);if(a!==void 0){let l=this.#r[a],c=this.#h(l);return o&&this.#s(o,a),this.#v(a)?(o&&(o.get="stale"),c?(o&&i&&l.__staleWhileFetching!==void 0&&(o.returnedStale=!0),i?l.__staleWhileFetching:void 0):(r||this.#R(e,"expire"),o&&i&&(o.returnedStale=!0),i?l:void 0)):(o&&(o.get="hit"),c?l.__staleWhileFetching:(this.#W(a),s&&this.#O(a),l))}else o&&(o.get="miss")}#D(e,t){this.#b[t]=e,this.#y[e]=t}#W(e){e!==this.#d&&(e===this.#g?this.#g=this.#y[e]:this.#D(this.#b[e],this.#y[e]),this.#D(this.#d,e),this.#d=e)}delete(e){return this.#R(e,"delete")}#R(e,t){let i=!1;if(this.#c!==0){let s=this.#l.get(e);if(s!==void 0)if(i=!0,this.#c===1)this.#V(t);else{this.#T(s);let r=this.#r[s];if(this.#h(r)?r.__abortController.abort(new Error("deleted")):(this.#_||this.#f)&&(this.#_&&this.#n?.(r,e,t),this.#f&&this.#p?.push([r,e,t])),this.#l.delete(e),this.#a[s]=void 0,this.#r[s]=void 0,s===this.#d)this.#d=this.#b[s];else if(s===this.#g)this.#g=this.#y[s];else{let o=this.#b[s];this.#y[o]=this.#y[s];let a=this.#y[s];this.#b[a]=this.#b[s]}this.#c--,this.#S.push(s)}}if(this.#f&&this.#p?.length){let s=this.#p,r;for(;r=s?.shift();)this.#t?.(...r)}return i}clear(){return this.#V("delete")}#V(e){for(let t of this.#k({allowStale:!0})){let i=this.#r[t];if(this.#h(i))i.__abortController.abort(new Error("deleted"));else{let s=this.#a[t];this.#_&&this.#n?.(i,s,e),this.#f&&this.#p?.push([i,s,e])}}if(this.#l.clear(),this.#r.fill(void 0),this.#a.fill(void 0),this.#m&&this.#E&&(this.#m.fill(0),this.#E.fill(0)),this.#C&&this.#C.fill(0),this.#g=0,this.#d=0,this.#S.length=0,this.#u=0,this.#c=0,this.#f&&this.#p){let t=this.#p,i;for(;i=t?.shift();)this.#t?.(...i)}}};var Ke=require("node:path"),Rr=require("node:url"),he=require("fs"),zl=C(require("node:fs"),1),_e=require("node:fs/promises");var Xt=require("node:events"),fs=C(require("node:stream"),1),$r=require("node:string_decoder"),Sr=typeof process=="object"&&process?process:{stdout:null,stderr:null},Il=n=>!!n&&typeof n=="object"&&(n instanceof Se||n instanceof fs.default||Ll(n)||Nl(n)),Ll=n=>!!n&&typeof n=="object"&&n instanceof Xt.EventEmitter&&typeof n.pipe=="function"&&n.pipe!==fs.default.Writable.prototype.pipe,Nl=n=>!!n&&typeof n=="object"&&n instanceof Xt.EventEmitter&&typeof n.write=="function"&&typeof n.end=="function",pe=Symbol("EOF"),ge=Symbol("maybeEmitEnd"),xe=Symbol("emittedEnd"),zt=Symbol("emittingEnd"),pt=Symbol("emittedError"),qt=Symbol("closed"),_r=Symbol("read"),Gt=Symbol("flush"),Cr=Symbol("flushChunk"),se=Symbol("encoding"),Je=Symbol("decoder"),M=Symbol("flowing"),gt=Symbol("paused"),Ye=Symbol("resume"),I=Symbol("buffer"),H=Symbol("pipes"),L=Symbol("bufferLength"),os=Symbol("bufferPush"),Jt=Symbol("bufferShift"),D=Symbol("objectMode"),F=Symbol("destroyed"),as=Symbol("error"),ls=Symbol("emitData"),Er=Symbol("emitEnd"),cs=Symbol("emitEnd2"),le=Symbol("async"),hs=Symbol("abort"),Yt=Symbol("aborted"),mt=Symbol("signal"),Re=Symbol("dataListeners"),J=Symbol("discarded"),yt=n=>Promise.resolve().then(n),Dl=n=>n(),Wl=n=>n==="end"||n==="finish"||n==="prefinish",Vl=n=>n instanceof ArrayBuffer||!!n&&typeof n=="object"&&n.constructor&&n.constructor.name==="ArrayBuffer"&&n.byteLength>=0,Hl=n=>!Buffer.isBuffer(n)&&ArrayBuffer.isView(n),Kt=class{src;dest;opts;ondrain;constructor(e,t,i){this.src=e,this.dest=t,this.opts=i,this.ondrain=()=>e[Ye](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(e){}end(){this.unpipe(),this.opts.end&&this.dest.end()}},us=class extends Kt{unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(e,t,i){super(e,t,i),this.proxyErrors=s=>this.dest.emit("error",s),e.on("error",this.proxyErrors)}},Bl=n=>!!n.objectMode,Ul=n=>!n.objectMode&&!!n.encoding&&n.encoding!=="buffer",Se=class extends Xt.EventEmitter{[M]=!1;[gt]=!1;[H]=[];[I]=[];[D];[se];[le];[Je];[pe]=!1;[xe]=!1;[zt]=!1;[qt]=!1;[pt]=null;[L]=0;[F]=!1;[mt];[Yt]=!1;[Re]=0;[J]=!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");Bl(t)?(this[D]=!0,this[se]=null):Ul(t)?(this[se]=t.encoding,this[D]=!1):(this[D]=!1,this[se]=null),this[le]=!!t.async,this[Je]=this[se]?new $r.StringDecoder(this[se]):null,t&&t.debugExposeBuffer===!0&&Object.defineProperty(this,"buffer",{get:()=>this[I]}),t&&t.debugExposePipes===!0&&Object.defineProperty(this,"pipes",{get:()=>this[H]});let{signal:i}=t;i&&(this[mt]=i,i.aborted?this[hs]():i.addEventListener("abort",()=>this[hs]()))}get bufferLength(){return this[L]}get encoding(){return this[se]}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[D]}set objectMode(e){throw new Error("objectMode must be set at instantiation time")}get async(){return this[le]}set async(e){this[le]=this[le]||!!e}[hs](){this[Yt]=!0,this.emit("abort",this[mt]?.reason),this.destroy(this[mt]?.reason)}get aborted(){return this[Yt]}set aborted(e){}write(e,t,i){if(this[Yt])return!1;if(this[pe])throw new Error("write after end");if(this[F])return this.emit("error",Object.assign(new Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;typeof t=="function"&&(i=t,t="utf8"),t||(t="utf8");let s=this[le]?yt:Dl;if(!this[D]&&!Buffer.isBuffer(e)){if(Hl(e))e=Buffer.from(e.buffer,e.byteOffset,e.byteLength);else if(Vl(e))e=Buffer.from(e);else if(typeof e!="string")throw new Error("Non-contiguous data written to non-objectMode stream")}return this[D]?(this[M]&&this[L]!==0&&this[Gt](!0),this[M]?this.emit("data",e):this[os](e),this[L]!==0&&this.emit("readable"),i&&s(i),this[M]):e.length?(typeof e=="string"&&!(t===this[se]&&!this[Je]?.lastNeed)&&(e=Buffer.from(e,t)),Buffer.isBuffer(e)&&this[se]&&(e=this[Je].write(e)),this[M]&&this[L]!==0&&this[Gt](!0),this[M]?this.emit("data",e):this[os](e),this[L]!==0&&this.emit("readable"),i&&s(i),this[M]):(this[L]!==0&&this.emit("readable"),i&&s(i),this[M])}read(e){if(this[F])return null;if(this[J]=!1,this[L]===0||e===0||e&&e>this[L])return this[ge](),null;this[D]&&(e=null),this[I].length>1&&!this[D]&&(this[I]=[this[se]?this[I].join(""):Buffer.concat(this[I],this[L])]);let t=this[_r](e||null,this[I][0]);return this[ge](),t}[_r](e,t){if(this[D])this[Jt]();else{let i=t;e===i.length||e===null?this[Jt]():typeof i=="string"?(this[I][0]=i.slice(e),t=i.slice(0,e),this[L]-=e):(this[I][0]=i.subarray(e),t=i.subarray(0,e),this[L]-=e)}return this.emit("data",t),!this[I].length&&!this[pe]&&this.emit("drain"),t}end(e,t,i){return typeof e=="function"&&(i=e,e=void 0),typeof t=="function"&&(i=t,t="utf8"),e!==void 0&&this.write(e,t),i&&this.once("end",i),this[pe]=!0,this.writable=!1,(this[M]||!this[gt])&&this[ge](),this}[Ye](){this[F]||(!this[Re]&&!this[H].length&&(this[J]=!0),this[gt]=!1,this[M]=!0,this.emit("resume"),this[I].length?this[Gt]():this[pe]?this[ge]():this.emit("drain"))}resume(){return this[Ye]()}pause(){this[M]=!1,this[gt]=!0,this[J]=!1}get destroyed(){return this[F]}get flowing(){return this[M]}get paused(){return this[gt]}[os](e){this[D]?this[L]+=1:this[L]+=e.length,this[I].push(e)}[Jt](){return this[D]?this[L]-=1:this[L]-=this[I][0].length,this[I].shift()}[Gt](e=!1){do;while(this[Cr](this[Jt]())&&this[I].length);!e&&!this[I].length&&!this[pe]&&this.emit("drain")}[Cr](e){return this.emit("data",e),this[M]}pipe(e,t){if(this[F])return e;this[J]=!1;let i=this[xe];return t=t||{},e===Sr.stdout||e===Sr.stderr?t.end=!1:t.end=t.end!==!1,t.proxyErrors=!!t.proxyErrors,i?t.end&&e.end():(this[H].push(t.proxyErrors?new us(this,e,t):new Kt(this,e,t)),this[le]?yt(()=>this[Ye]()):this[Ye]()),e}unpipe(e){let t=this[H].find(i=>i.dest===e);t&&(this[H].length===1?(this[M]&&this[Re]===0&&(this[M]=!1),this[H]=[]):this[H].splice(this[H].indexOf(t),1),t.unpipe())}addListener(e,t){return this.on(e,t)}on(e,t){let i=super.on(e,t);if(e==="data")this[J]=!1,this[Re]++,!this[H].length&&!this[M]&&this[Ye]();else if(e==="readable"&&this[L]!==0)super.emit("readable");else if(Wl(e)&&this[xe])super.emit(e),this.removeAllListeners(e);else if(e==="error"&&this[pt]){let s=t;this[le]?yt(()=>s.call(this,this[pt])):s.call(this,this[pt])}return i}removeListener(e,t){return this.off(e,t)}off(e,t){let i=super.off(e,t);return e==="data"&&(this[Re]=this.listeners("data").length,this[Re]===0&&!this[J]&&!this[H].length&&(this[M]=!1)),i}removeAllListeners(e){let t=super.removeAllListeners(e);return(e==="data"||e===void 0)&&(this[Re]=0,!this[J]&&!this[H].length&&(this[M]=!1)),t}get emittedEnd(){return this[xe]}[ge](){!this[zt]&&!this[xe]&&!this[F]&&this[I].length===0&&this[pe]&&(this[zt]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[qt]&&this.emit("close"),this[zt]=!1)}emit(e,...t){let i=t[0];if(e!=="error"&&e!=="close"&&e!==F&&this[F])return!1;if(e==="data")return!this[D]&&!i?!1:this[le]?(yt(()=>this[ls](i)),!0):this[ls](i);if(e==="end")return this[Er]();if(e==="close"){if(this[qt]=!0,!this[xe]&&!this[F])return!1;let r=super.emit("close");return this.removeAllListeners("close"),r}else if(e==="error"){this[pt]=i,super.emit(as,i);let r=!this[mt]||this.listeners("error").length?super.emit("error",i):!1;return this[ge](),r}else if(e==="resume"){let r=super.emit("resume");return this[ge](),r}else if(e==="finish"||e==="prefinish"){let r=super.emit(e);return this.removeAllListeners(e),r}let s=super.emit(e,...t);return this[ge](),s}[ls](e){for(let i of this[H])i.dest.write(e)===!1&&this.pause();let t=this[J]?!1:super.emit("data",e);return this[ge](),t}[Er](){return this[xe]?!1:(this[xe]=!0,this.readable=!1,this[le]?(yt(()=>this[cs]()),!0):this[cs]())}[cs](){if(this[Je]){let t=this[Je].end();if(t){for(let i of this[H])i.dest.write(t);this[J]||super.emit("data",t)}}for(let t of this[H])t.end();let e=super.emit("end");return this.removeAllListeners("end"),e}async collect(){let e=Object.assign([],{dataLength:0});this[D]||(e.dataLength=0);let t=this.promise();return this.on("data",i=>{e.push(i),this[D]||(e.dataLength+=i.length)}),await t,e}async concat(){if(this[D])throw new Error("cannot concat in objectMode");let e=await this.collect();return this[se]?e.join(""):Buffer.concat(e,e.dataLength)}async promise(){return new Promise((e,t)=>{this.on(F,()=>t(new Error("stream destroyed"))),this.on("error",i=>t(i)),this.on("end",()=>e())})}[Symbol.asyncIterator](){this[J]=!1;let e=!1,t=async()=>(this.pause(),e=!0,{value:void 0,done:!0});return{next:()=>{if(e)return t();let s=this.read();if(s!==null)return Promise.resolve({done:!1,value:s});if(this[pe])return t();let r,o,a=h=>{this.off("data",l),this.off("end",c),this.off(F,u),t(),o(h)},l=h=>{this.off("error",a),this.off("end",c),this.off(F,u),this.pause(),r({value:h,done:!!this[pe]})},c=()=>{this.off("error",a),this.off("data",l),this.off(F,u),t(),r({done:!0,value:void 0})},u=()=>a(new Error("stream destroyed"));return new Promise((h,p)=>{o=p,r=h,this.once(F,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[J]=!1;let e=!1,t=()=>(this.pause(),this.off(as,t),this.off(F,t),this.off("end",t),e=!0,{done:!0,value:void 0}),i=()=>{if(e)return t();let s=this.read();return s===null?t():{done:!1,value:s}};return this.once("end",t),this.once(as,t),this.once(F,t),{next:i,throw:t,return:t,[Symbol.iterator](){return this},[Symbol.dispose]:()=>{}}}destroy(e){if(this[F])return e?this.emit("error",e):this.emit(F),this;this[F]=!0,this[J]=!0,this[I].length=0,this[L]=0;let t=this;return typeof t.close=="function"&&!this[qt]&&t.close(),e?this.emit("error",e):this.emit(F),this}static get isStream(){return Il}};var ql=he.realpathSync.native,wt={lstatSync:he.lstatSync,readdir:he.readdir,readdirSync:he.readdirSync,readlinkSync:he.readlinkSync,realpathSync:ql,promises:{lstat:_e.lstat,readdir:_e.readdir,readlink:_e.readlink,realpath:_e.realpath}},jr=n=>!n||n===wt||n===zl?wt:{...wt,...n,promises:{...wt.promises,...n.promises||{}}},Tr=/^\\\\\?\\([a-z]:)\\?$/i,Gl=n=>n.replace(/\//g,"\\").replace(Tr,"$1\\"),Jl=/[\\\/]/,Q=0,Pr=1,Mr=2,ce=4,Ir=6,Lr=8,je=10,Nr=12,Z=15,bt=~Z,ds=16,Or=32,vt=64,ne=128,Zt=256,ei=512,Ar=vt|ne|ei,Yl=1023,ps=n=>n.isFile()?Lr:n.isDirectory()?ce:n.isSymbolicLink()?je:n.isCharacterDevice()?Mr:n.isBlockDevice()?Ir:n.isSocket()?Nr:n.isFIFO()?Pr:Q,kr=new Map,xt=n=>{let e=kr.get(n);if(e)return e;let t=n.normalize("NFKD");return kr.set(n,t),t},Fr=new Map,Qt=n=>{let e=Fr.get(n);if(e)return e;let t=xt(n.toLowerCase());return Fr.set(n,t),t},ti=class extends dt{constructor(){super({max:256})}},gs=class extends dt{constructor(e=16*1024){super({maxSize:e,sizeCalculation:t=>t.length+1})}},Dr=Symbol("PathScurry setAsCwd"),W=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}#x;get gid(){return this.#x}#c;get rdev(){return this.#c}#u;get blksize(){return this.#u}#l;get ino(){return this.#l}#a;get size(){return this.#a}#r;get blocks(){return this.#r}#y;get atimeMs(){return this.#y}#b;get mtimeMs(){return this.#b}#g;get ctimeMs(){return this.#g}#d;get birthtimeMs(){return this.#d}#S;get atime(){return this.#S}#p;get mtime(){return this.#p}#C;get ctime(){return this.#C}#E;get birthtime(){return this.#E}#m;#_;#w;#f;#$;#O;#s;#j;#v;#F;get parentPath(){return(this.parent||this).fullpath()}get path(){return this.parentPath}constructor(e,t=Q,i,s,r,o,a){this.name=e,this.#m=r?Qt(e):xt(e),this.#s=t&Yl,this.nocase=r,this.roots=s,this.root=i||this,this.#j=o,this.#w=a.fullpath,this.#$=a.relative,this.#O=a.relativePosix,this.parent=a.parent,this.parent?this.#e=this.parent.#e:this.#e=jr(a.fs)}depth(){return this.#_!==void 0?this.#_:this.parent?this.#_=this.parent.depth()+1:this.#_=0}childrenCache(){return this.#j}resolve(e){if(!e)return this;let t=this.getRootString(e),s=e.substring(t.length).split(this.splitSep);return t?this.getRoot(t).#T(s):this.#T(s)}#T(e){let t=this;for(let i of e)t=t.child(i);return t}children(){let e=this.#j.get(this);if(e)return e;let t=Object.assign([],{provisional:0});return this.#j.set(this,t),this.#s&=~ds,t}child(e,t){if(e===""||e===".")return this;if(e==="..")return this.parent||this;let i=this.children(),s=this.nocase?Qt(e):xt(e);for(let l of i)if(l.#m===s)return l;let r=this.parent?this.sep:"",o=this.#w?this.#w+r+e:void 0,a=this.newChild(e,Q,{...t,parent:this,fullpath:o});return this.canReaddir()||(a.#s|=ne),i.push(a),a}relative(){if(this.isCWD)return"";if(this.#$!==void 0)return this.#$;let e=this.name,t=this.parent;if(!t)return this.#$=this.name;let i=t.relative();return i+(!i||!t.parent?"":this.sep)+e}relativePosix(){if(this.sep==="/")return this.relative();if(this.isCWD)return"";if(this.#O!==void 0)return this.#O;let e=this.name,t=this.parent;if(!t)return this.#O=this.fullpathPosix();let i=t.relativePosix();return i+(!i||!t.parent?"":"/")+e}fullpath(){if(this.#w!==void 0)return this.#w;let e=this.name,t=this.parent;if(!t)return this.#w=this.name;let s=t.fullpath()+(t.parent?this.sep:"")+e;return this.#w=s}fullpathPosix(){if(this.#f!==void 0)return this.#f;if(this.sep==="/")return this.#f=this.fullpath();if(!this.parent){let s=this.fullpath().replace(/\\/g,"/");return/^[a-z]:\//i.test(s)?this.#f=`//?/${s}`:this.#f=s}let e=this.parent,t=e.fullpathPosix(),i=t+(!t||!e.parent?"":"/")+this.name;return this.#f=i}isUnknown(){return(this.#s&Z)===Q}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&Z)===Lr}isDirectory(){return(this.#s&Z)===ce}isCharacterDevice(){return(this.#s&Z)===Mr}isBlockDevice(){return(this.#s&Z)===Ir}isFIFO(){return(this.#s&Z)===Pr}isSocket(){return(this.#s&Z)===Nr}isSymbolicLink(){return(this.#s&je)===je}lstatCached(){return this.#s&Or?this:void 0}readlinkCached(){return this.#v}realpathCached(){return this.#F}readdirCached(){let e=this.children();return e.slice(0,e.provisional)}canReadlink(){if(this.#v)return!0;if(!this.parent)return!1;let e=this.#s&Z;return!(e!==Q&&e!==je||this.#s&Zt||this.#s&ne)}calledReaddir(){return!!(this.#s&ds)}isENOENT(){return!!(this.#s&ne)}isNamed(e){return this.nocase?this.#m===Qt(e):this.#m===xt(e)}async readlink(){let e=this.#v;if(e)return e;if(this.canReadlink()&&this.parent)try{let t=await this.#e.promises.readlink(this.fullpath()),i=(await this.parent.realpath())?.resolve(t);if(i)return this.#v=i}catch(t){this.#h(t.code);return}}readlinkSync(){let e=this.#v;if(e)return e;if(this.canReadlink()&&this.parent)try{let t=this.#e.readlinkSync(this.fullpath()),i=this.parent.realpathSync()?.resolve(t);if(i)return this.#v=i}catch(t){this.#h(t.code);return}}#P(e){this.#s|=ds;for(let t=e.provisional;t<e.length;t++){let i=e[t];i&&i.#M()}}#M(){this.#s&ne||(this.#s=(this.#s|ne)&bt,this.#A())}#A(){let e=this.children();e.provisional=0;for(let t of e)t.#M()}#k(){this.#s|=ei,this.#I()}#I(){if(this.#s&vt)return;let e=this.#s;(e&Z)===ce&&(e&=bt),this.#s=e|vt,this.#A()}#L(e=""){e==="ENOTDIR"||e==="EPERM"?this.#I():e==="ENOENT"?this.#M():this.children().provisional=0}#N(e=""){e==="ENOTDIR"?this.parent.#I():e==="ENOENT"&&this.#M()}#h(e=""){let t=this.#s;t|=Zt,e==="ENOENT"&&(t|=ne),(e==="EINVAL"||e==="UNKNOWN")&&(t&=bt),this.#s=t,e==="ENOTDIR"&&this.parent&&this.parent.#I()}#D(e,t){return this.#R(e,t)||this.#W(e,t)}#W(e,t){let i=ps(e),s=this.newChild(e.name,i,{parent:this}),r=s.#s&Z;return r!==ce&&r!==je&&r!==Q&&(s.#s|=vt),t.unshift(s),t.provisional++,s}#R(e,t){for(let i=t.provisional;i<t.length;i++){let s=t[i];if((this.nocase?Qt(e.name):xt(e.name))===s.#m)return this.#V(e,s,i,t)}}#V(e,t,i,s){let r=t.name;return t.#s=t.#s&bt|ps(e),r!==e.name&&(t.name=e.name),i!==s.provisional&&(i===s.length-1?s.pop():s.splice(i,1),s.unshift(t)),s.provisional++,t}async lstat(){if(!(this.#s&ne))try{return this.#z(await this.#e.promises.lstat(this.fullpath())),this}catch(e){this.#N(e.code)}}lstatSync(){if(!(this.#s&ne))try{return this.#z(this.#e.lstatSync(this.fullpath())),this}catch(e){this.#N(e.code)}}#z(e){let{atime:t,atimeMs:i,birthtime:s,birthtimeMs:r,blksize:o,blocks:a,ctime:l,ctimeMs:c,dev:u,gid:h,ino:p,mode:d,mtime:m,mtimeMs:g,nlink:y,rdev:b,size:v,uid:x}=e;this.#S=t,this.#y=i,this.#E=s,this.#d=r,this.#u=o,this.#r=a,this.#C=l,this.#g=c,this.#i=u,this.#x=h,this.#l=p,this.#n=d,this.#p=m,this.#b=g,this.#t=y,this.#c=b,this.#a=v,this.#o=x;let S=ps(e);this.#s=this.#s&bt|S|Or,S!==Q&&S!==ce&&S!==je&&(this.#s|=vt)}#B=[];#U=!1;#q(e){this.#U=!1;let t=this.#B.slice();this.#B.length=0,t.forEach(i=>i(null,e))}readdirCB(e,t=!1){if(!this.canReaddir()){t?e(null,[]):queueMicrotask(()=>e(null,[]));return}let i=this.children();if(this.calledReaddir()){let r=i.slice(0,i.provisional);t?e(null,r):queueMicrotask(()=>e(null,r));return}if(this.#B.push(e),this.#U)return;this.#U=!0;let s=this.fullpath();this.#e.readdir(s,{withFileTypes:!0},(r,o)=>{if(r)this.#L(r.code),i.provisional=0;else{for(let a of o)this.#D(a,i);this.#P(i)}this.#q(i.slice(0,i.provisional))})}#H;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.#H)await this.#H;else{let i=()=>{};this.#H=new Promise(s=>i=s);try{for(let s of await this.#e.promises.readdir(t,{withFileTypes:!0}))this.#D(s,e);this.#P(e)}catch(s){this.#L(s.code),e.provisional=0}this.#H=void 0,i()}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 i of this.#e.readdirSync(t,{withFileTypes:!0}))this.#D(i,e);this.#P(e)}catch(i){this.#L(i.code),e.provisional=0}return e.slice(0,e.provisional)}canReaddir(){if(this.#s&Ar)return!1;let e=Z&this.#s;return e===Q||e===ce||e===je}shouldWalk(e,t){return(this.#s&ce)===ce&&!(this.#s&Ar)&&!e.has(this)&&(!t||t(this))}async realpath(){if(this.#F)return this.#F;if(!((ei|Zt|ne)&this.#s))try{let e=await this.#e.promises.realpath(this.fullpath());return this.#F=this.resolve(e)}catch{this.#k()}}realpathSync(){if(this.#F)return this.#F;if(!((ei|Zt|ne)&this.#s))try{let e=this.#e.realpathSync(this.fullpath());return this.#F=this.resolve(e)}catch{this.#k()}}[Dr](e){if(e===this)return;e.isCWD=!1,this.isCWD=!0;let t=new Set([]),i=[],s=this;for(;s&&s.parent;)t.add(s),s.#$=i.join(this.sep),s.#O=i.join("/"),s=s.parent,i.push("..");for(s=e;s&&s.parent&&!t.has(s);)s.#$=void 0,s.#O=void 0,s=s.parent}},ii=class n extends W{sep="\\";splitSep=Jl;constructor(e,t=Q,i,s,r,o,a){super(e,t,i,s,r,o,a)}newChild(e,t=Q,i={}){return new n(e,t,this.root,this.roots,this.nocase,this.childrenCache(),i)}getRootString(e){return Ke.win32.parse(e).root}getRoot(e){if(e=Gl(e.toUpperCase()),e===this.root.name)return this.root;for(let[t,i]of Object.entries(this.roots))if(this.sameRoot(e,t))return this.roots[e]=i;return this.roots[e]=new Xe(e,this).root}sameRoot(e,t=this.root.name){return e=e.toUpperCase().replace(/\//g,"\\").replace(Tr,"$1\\"),e===t}},si=class n extends W{splitSep="/";sep="/";constructor(e,t=Q,i,s,r,o,a){super(e,t,i,s,r,o,a)}getRootString(e){return e.startsWith("/")?"/":""}getRoot(e){return this.root}newChild(e,t=Q,i={}){return new n(e,t,this.root,this.roots,this.nocase,this.childrenCache(),i)}},ni=class{root;rootPath;roots;cwd;#e;#i;#n;nocase;#t;constructor(e=process.cwd(),t,i,{nocase:s,childrenCacheSize:r=16*1024,fs:o=wt}={}){this.#t=jr(o),(e instanceof URL||e.startsWith("file://"))&&(e=(0,Rr.fileURLToPath)(e));let a=t.resolve(e);this.roots=Object.create(null),this.rootPath=this.parseRootPath(a),this.#e=new ti,this.#i=new ti,this.#n=new gs(r);let l=a.substring(this.rootPath.length).split(i);if(l.length===1&&!l[0]&&l.pop(),s===void 0)throw new TypeError("must provide nocase setting to PathScurryBase ctor");this.nocase=s,this.root=this.newRoot(this.#t),this.roots[this.rootPath]=this.root;let c=this.root,u=l.length-1,h=t.sep,p=this.rootPath,d=!1;for(let m of l){let g=u--;c=c.child(m,{relative:new Array(g).fill("..").join(h),relativePosix:new Array(g).fill("..").join("/"),fullpath:p+=(d?"":h)+m}),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 i=this.#e.get(t);if(i!==void 0)return i;let s=this.cwd.resolve(t).fullpath();return this.#e.set(t,s),s}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 i=this.#i.get(t);if(i!==void 0)return i;let s=this.cwd.resolve(t).fullpathPosix();return this.#i.set(t,s),s}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 W||(t=e,e=this.cwd);let{withFileTypes:i}=t;if(e.canReaddir()){let s=await e.readdir();return i?s:s.map(r=>r.name)}else return[]}readdirSync(e=this.cwd,t={withFileTypes:!0}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof W||(t=e,e=this.cwd);let{withFileTypes:i=!0}=t;return e.canReaddir()?i?e.readdirSync():e.readdirSync().map(s=>s.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 W||(t=e.withFileTypes,e=this.cwd);let i=await e.readlink();return t?i:i?.fullpath()}readlinkSync(e=this.cwd,{withFileTypes:t}={withFileTypes:!1}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof W||(t=e.withFileTypes,e=this.cwd);let i=e.readlinkSync();return t?i:i?.fullpath()}async realpath(e=this.cwd,{withFileTypes:t}={withFileTypes:!1}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof W||(t=e.withFileTypes,e=this.cwd);let i=await e.realpath();return t?i:i?.fullpath()}realpathSync(e=this.cwd,{withFileTypes:t}={withFileTypes:!1}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof W||(t=e.withFileTypes,e=this.cwd);let i=e.realpathSync();return t?i:i?.fullpath()}async walk(e=this.cwd,t={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof W||(t=e,e=this.cwd);let{withFileTypes:i=!0,follow:s=!1,filter:r,walkFilter:o}=t,a=[];(!r||r(e))&&a.push(i?e:e.fullpath());let l=new Set,c=(h,p)=>{l.add(h),h.readdirCB((d,m)=>{if(d)return p(d);let g=m.length;if(!g)return p();let y=()=>{--g===0&&p()};for(let b of m)(!r||r(b))&&a.push(i?b:b.fullpath()),s&&b.isSymbolicLink()?b.realpath().then(v=>v?.isUnknown()?v.lstat():v).then(v=>v?.shouldWalk(l,o)?c(v,y):y()):b.shouldWalk(l,o)?c(b,y):y()},!0)},u=e;return new Promise((h,p)=>{c(u,d=>{if(d)return p(d);h(a)})})}walkSync(e=this.cwd,t={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof W||(t=e,e=this.cwd);let{withFileTypes:i=!0,follow:s=!1,filter:r,walkFilter:o}=t,a=[];(!r||r(e))&&a.push(i?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(i?h:h.fullpath());let p=h;if(h.isSymbolicLink()){if(!(s&&(p=h.realpathSync())))continue;p.isUnknown()&&p.lstatSync()}p.shouldWalk(l,o)&&l.add(p)}}return a}[Symbol.asyncIterator](){return this.iterate()}iterate(e=this.cwd,t={}){return typeof e=="string"?e=this.cwd.resolve(e):e instanceof W||(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 W||(t=e,e=this.cwd);let{withFileTypes:i=!0,follow:s=!1,filter:r,walkFilter:o}=t;(!r||r(e))&&(yield i?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 i?u:u.fullpath());let h=u;if(u.isSymbolicLink()){if(!(s&&(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 W||(t=e,e=this.cwd);let{withFileTypes:i=!0,follow:s=!1,filter:r,walkFilter:o}=t,a=new Se({objectMode:!0});(!r||r(e))&&a.write(i?e:e.fullpath());let l=new Set,c=[e],u=0,h=()=>{let p=!1;for(;!p;){let d=c.shift();if(!d){u===0&&a.end();return}u++,l.add(d);let m=(y,b,v=!1)=>{if(y)return a.emit("error",y);if(s&&!v){let x=[];for(let S of b)S.isSymbolicLink()&&x.push(S.realpath().then($=>$?.isUnknown()?$.lstat():$));if(x.length){Promise.all(x).then(()=>m(null,b,!0));return}}for(let x of b)x&&(!r||r(x))&&(a.write(i?x:x.fullpath())||(p=!0));u--;for(let x of b){let S=x.realpathCached()||x;S.shouldWalk(l,o)&&c.push(S)}p&&!a.flowing?a.once("drain",h):g||h()},g=!0;d.readdirCB(m,!0),g=!1}};return h(),a}streamSync(e=this.cwd,t={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof W||(t=e,e=this.cwd);let{withFileTypes:i=!0,follow:s=!1,filter:r,walkFilter:o}=t,a=new Se({objectMode:!0}),l=new Set;(!r||r(e))&&a.write(i?e:e.fullpath());let c=[e],u=0,h=()=>{let p=!1;for(;!p;){let d=c.shift();if(!d){u===0&&a.end();return}u++,l.add(d);let m=d.readdirSync();for(let g of m)(!r||r(g))&&(a.write(i?g:g.fullpath())||(p=!0));u--;for(let g of m){let y=g;if(g.isSymbolicLink()){if(!(s&&(y=g.realpathSync())))continue;y.isUnknown()&&y.lstatSync()}y.shouldWalk(l,o)&&c.push(y)}}p&&!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[Dr](t)}},Xe=class extends ni{sep="\\";constructor(e=process.cwd(),t={}){let{nocase:i=!0}=t;super(e,Ke.win32,"\\",{...t,nocase:i}),this.nocase=i;for(let s=this.cwd;s;s=s.parent)s.nocase=this.nocase}parseRootPath(e){return Ke.win32.parse(e).root.toUpperCase()}newRoot(e){return new ii(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)}},Ze=class extends ni{sep="/";constructor(e=process.cwd(),t={}){let{nocase:i=!1}=t;super(e,Ke.posix,"/",{...t,nocase:i}),this.nocase=i}parseRootPath(e){return"/"}newRoot(e){return new si(this.rootPath,ce,void 0,this.roots,this.nocase,this.childrenCache(),{fs:e})}isAbsolute(e){return e.startsWith("/")}},St=class extends Ze{constructor(e=process.cwd(),t={}){let{nocase:i=!0}=t;super(e,{...t,nocase:i})}},xu=process.platform==="win32"?ii:si,Wr=process.platform==="win32"?Xe:process.platform==="darwin"?St:Ze;var Kl=n=>n.length>=1,Xl=n=>n.length>=1,Qe=class n{#e;#i;#n;length;#t;#o;#x;#c;#u;#l;#a=!0;constructor(e,t,i,s){if(!Kl(e))throw new TypeError("empty pattern list");if(!Xl(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,i<0||i>=this.length)throw new TypeError("index out of range");if(this.#e=e,this.#i=t,this.#n=i,this.#t=s,this.#n===0){if(this.isUNC()){let[r,o,a,l,...c]=this.#e,[u,h,p,d,...m]=this.#i;c[0]===""&&(c.shift(),m.shift());let g=[r,o,a,l,""].join("/"),y=[u,h,p,d,""].join("/");this.#e=[g,...c],this.#i=[y,...m],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]===k}isRegExp(){return this.#e[this.#n]instanceof RegExp}globString(){return this.#x=this.#x||(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.#l=this.#l,this.#o.#u=this.#u,this.#o.#c=this.#c,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.#c!==void 0?this.#c:this.#c=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.#l!==void 0?this.#l:this.#l=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.#a)}markFollowGlobstar(){return this.#n===0||!this.isGlobstar()||!this.#a?!1:(this.#a=!1,!0)}};var Zl=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",et=class{relative;relativeChildren;absolute;absoluteChildren;platform;mmopts;constructor(e,{nobrace:t,nocase:i,noext:s,noglobstar:r,platform:o=Zl}){this.relative=[],this.absolute=[],this.relativeChildren=[],this.absoluteChildren=[],this.platform=o,this.mmopts={dot:!0,nobrace:t,nocase:i,noext:s,noglobstar:r,optimizationLevel:2,platform:o,nocomment:!0,nonegate:!0};for(let a of e)this.add(a)}add(e){let t=new G(e,this.mmopts);for(let i=0;i<t.set.length;i++){let s=t.set[i],r=t.globParts[i];if(!s||!r)throw new Error("invalid pattern object");for(;s[0]==="."&&r[0]===".";)s.shift(),r.shift();let o=new Qe(s,r,0,this.platform),a=new G(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(),i=`${t}/`,s=e.relative()||".",r=`${s}/`;for(let o of this.relative)if(o.match(s)||o.match(r))return!0;for(let o of this.absolute)if(o.match(t)||o.match(i))return!0;return!1}childrenIgnored(e){let t=e.fullpath()+"/",i=(e.relative()||".")+"/";for(let s of this.relativeChildren)if(s.match(i))return!0;for(let s of this.absoluteChildren)if(s.match(t))return!0;return!1}};var ms=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 i=e.fullpath(),s=this.store.get(i);s?s.add(t.globString()):this.store.set(i,new Set([t.globString()]))}},ys=class{store=new Map;add(e,t,i){let s=(t?2:0)|(i?1:0),r=this.store.get(e);this.store.set(e,r===void 0?s:s&r)}entries(){return[...this.store.entries()].map(([e,t])=>[e,!!(t&2),!!(t&1)])}},bs=class{store=new Map;add(e,t){if(!e.canReaddir())return;let i=this.store.get(e);i?i.find(s=>s.globString()===t.globString())||i.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())}},_t=class n{hasWalkedCache;matches=new ys;subwalks=new bs;patterns;follow;dot;opts;constructor(e,t){this.opts=e,this.follow=!!e.follow,this.dot=!!e.dot,this.hasWalkedCache=t?t.copy():new ms}processPatterns(e,t){this.patterns=t;let i=t.map(s=>[e,s]);for(let[s,r]of i){this.hasWalkedCache.storeWalked(s,r);let o=r.root(),a=r.isAbsolute()&&this.opts.absolute!==!1;if(o){s=s.resolve(o==="/"&&this.opts.root!==void 0?this.opts.root:o);let h=r.rest();if(h)r=h;else{this.matches.add(s,!0,!1);continue}}if(s.isENOENT())continue;let l,c,u=!1;for(;typeof(l=r.pattern())=="string"&&(c=r.rest());)s=s.resolve(l),r=c,u=!0;if(l=r.pattern(),c=r.rest(),u){if(this.hasWalkedCache.hasWalked(s,r))continue;this.hasWalkedCache.storeWalked(s,r)}if(typeof l=="string"){let h=l===".."||l===""||l===".";this.matches.add(s.resolve(l),a,h);continue}else if(l===k){(!s.isSymbolicLink()||this.follow||r.checkFollowGlobstar())&&this.subwalks.add(s,r);let h=c?.pattern(),p=c?.rest();if(!c||(h===""||h===".")&&!p)this.matches.add(s,a,h===""||h===".");else if(h===".."){let d=s.parent||s;p?this.hasWalkedCache.hasWalked(d,p)||this.subwalks.add(d,p):this.matches.add(d,a,!0)}}else l instanceof RegExp&&this.subwalks.add(s,r)}return this}subwalkTargets(){return this.subwalks.keys()}child(){return new n(this.opts,this.hasWalkedCache)}filterEntries(e,t){let i=this.subwalks.get(e),s=this.child();for(let r of t)for(let o of i){let a=o.isAbsolute(),l=o.pattern(),c=o.rest();l===k?s.testGlobstar(r,o,c,a):l instanceof RegExp?s.testRegExp(r,l,c,a):s.testString(r,l,c,a)}return s}testGlobstar(e,t,i,s){if((this.dot||!e.name.startsWith("."))&&(t.hasMore()||this.matches.add(e,s,!1),e.canReaddir()&&(this.follow||!e.isSymbolicLink()?this.subwalks.add(e,t):e.isSymbolicLink()&&(i&&t.checkFollowGlobstar()?this.subwalks.add(e,i):t.markFollowGlobstar()&&this.subwalks.add(e,t)))),i){let r=i.pattern();if(typeof r=="string"&&r!==".."&&r!==""&&r!==".")this.testString(e,r,i.rest(),s);else if(r===".."){let o=e.parent||e;this.subwalks.add(o,i)}else r instanceof RegExp&&this.testRegExp(e,r,i.rest(),s)}}testRegExp(e,t,i,s){t.test(e.name)&&(i?this.subwalks.add(e,i):this.matches.add(e,s,!1))}testString(e,t,i,s){e.isNamed(t)&&(i?this.subwalks.add(e,i):this.matches.add(e,s,!1))}};var Ql=(n,e)=>typeof n=="string"?new et([n],e):Array.isArray(n)?new et(n,e):n,ri=class{path;patterns;opts;seen=new Set;paused=!1;aborted=!1;#e=[];#i;#n;signal;maxDepth;includeChildMatches;constructor(e,t,i){if(this.patterns=e,this.path=t,this.opts=i,this.#n=!i.posix&&i.platform==="win32"?"\\":"/",this.includeChildMatches=i.includeChildMatches!==!1,(i.ignore||!this.includeChildMatches)&&(this.#i=Ql(i.ignore??[],i),!this.includeChildMatches&&typeof this.#i.add!="function")){let s="cannot ignore child matches, ignore lacks add() method.";throw new Error(s)}this.maxDepth=i.maxDepth||1/0,i.signal&&(this.signal=i.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 i;if(this.opts.realpath){if(i=e.realpathCached()||await e.realpath(),!i)return;e=i}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 i;if(this.opts.realpath){if(i=e.realpathCached()||e.realpathSync(),!i)return;e=i}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 i=this.opts.absolute===void 0?t:this.opts.absolute;this.seen.add(e);let s=this.opts.mark&&e.isDirectory()?this.#n:"";if(this.opts.withFileTypes)this.matchEmit(e);else if(i){let r=this.opts.posix?e.fullpathPosix():e.fullpath();this.matchEmit(r+s)}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+s:"."+s)}}async match(e,t,i){let s=await this.matchCheck(e,i);s&&this.matchFinish(s,t)}matchSync(e,t,i){let s=this.matchCheckSync(e,i);s&&this.matchFinish(s,t)}walkCB(e,t,i){this.signal?.aborted&&i(),this.walkCB2(e,t,new _t(this.opts),i)}walkCB2(e,t,i,s){if(this.#o(e))return s();if(this.signal?.aborted&&s(),this.paused){this.onResume(()=>this.walkCB2(e,t,i,s));return}i.processPatterns(e,t);let r=1,o=()=>{--r===0&&s()};for(let[a,l,c]of i.matches.entries())this.#t(a)||(r++,this.match(a,l,c).then(()=>o()));for(let a of i.subwalkTargets()){if(this.maxDepth!==1/0&&a.depth()>=this.maxDepth)continue;r++;let l=a.readdirCached();a.calledReaddir()?this.walkCB3(a,l,i,o):a.readdirCB((c,u)=>this.walkCB3(a,u,i,o),!0)}o()}walkCB3(e,t,i,s){i=i.filterEntries(e,t);let r=1,o=()=>{--r===0&&s()};for(let[a,l,c]of i.matches.entries())this.#t(a)||(r++,this.match(a,l,c).then(()=>o()));for(let[a,l]of i.subwalks.entries())r++,this.walkCB2(a,l,i.child(),o);o()}walkCBSync(e,t,i){this.signal?.aborted&&i(),this.walkCB2Sync(e,t,new _t(this.opts),i)}walkCB2Sync(e,t,i,s){if(this.#o(e))return s();if(this.signal?.aborted&&s(),this.paused){this.onResume(()=>this.walkCB2Sync(e,t,i,s));return}i.processPatterns(e,t);let r=1,o=()=>{--r===0&&s()};for(let[a,l,c]of i.matches.entries())this.#t(a)||this.matchSync(a,l,c);for(let a of i.subwalkTargets()){if(this.maxDepth!==1/0&&a.depth()>=this.maxDepth)continue;r++;let l=a.readdirSync();this.walkCB3Sync(a,l,i,o)}o()}walkCB3Sync(e,t,i,s){i=i.filterEntries(e,t);let r=1,o=()=>{--r===0&&s()};for(let[a,l,c]of i.matches.entries())this.#t(a)||this.matchSync(a,l,c);for(let[a,l]of i.subwalks.entries())r++,this.walkCB2Sync(a,l,i.child(),o);o()}},Ct=class extends ri{matches=new Set;constructor(e,t,i){super(e,t,i)}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}},Et=class extends ri{results;constructor(e,t,i){super(e,t,i),this.results=new Se({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 ec=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",re=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,Vr.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||ec,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"?Xe:t.platform==="darwin"?St:t.platform?Ze:Wr;this.scurry=new l(this.cwd,{nocase:t.nocase,fs:t.fs})}this.nocase=this.scurry.nocase;let i=this.platform==="darwin"||this.platform==="win32",s={...t,dot:this.dot,matchBase:this.matchBase,nobrace:this.nobrace,nocase:this.nocase,nocaseMagicOnly:i,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 G(l,s)),[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 Qe(l,u,0,this.platform)})}async walk(){return[...await new Ct(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 Ct(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 Et(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 Et(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 ws=(n,e={})=>{Array.isArray(n)||(n=[n]);for(let t of n)if(new G(t,e).hasMagic())return!0;return!1};function ai(n,e={}){return new re(n,e).streamSync()}function Br(n,e={}){return new re(n,e).stream()}function Ur(n,e={}){return new re(n,e).walkSync()}async function Hr(n,e={}){return new re(n,e).walk()}function li(n,e={}){return new re(n,e).iterateSync()}function zr(n,e={}){return new re(n,e).iterate()}var tc=ai,ic=Object.assign(Br,{sync:ai}),sc=li,nc=Object.assign(zr,{sync:li}),rc=Object.assign(Ur,{stream:ai,iterate:li}),oi=Object.assign(Hr,{glob:Hr,globSync:Ur,sync:rc,globStream:Br,stream:ic,globStreamSync:ai,streamSync:tc,globIterate:zr,iterate:nc,globIterateSync:li,iterateSync:sc,Glob:re,hasMagic:ws,escape:ze,unescape:ie});oi.glob=oi;var oc=[{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"}],ac=[{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"}],lc=[{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"}],cc=[{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"}],hc=[...oc,...ac,...lc,...cc];function qr(n,e,t){let i=[];for(let s of hc){s.regex.lastIndex=0;let r;for(;(r=s.regex.exec(n))!==null;)i.push({file:t,line:e,column:r.index+1,pattern:s.id,category:s.category,severity:s.severity,excerpt:uc(n.trim(),r.index,r[0].length),suggestion:s.suggestion})}return i}function uc(n,e,t){let i=n.slice(0,e),s=n.slice(e,e+t),r=n.slice(e+t);return`${i}\xAB${s}\xBB${r}`.slice(0,120)}async function $t(n,e=[]){let t=[];for(let o of n)if(tt.existsSync(o)&&tt.statSync(o).isFile())t.push(o);else{let a=await oi("**/*.md",{cwd:o,ignore:["node_modules/**",".git/**",...e],absolute:!0});t.push(...a)}let i=[...new Set(t)],s=[],r={files:0,total_lines:0,red:0,yellow:0,clean:0};for(let o of i){if(!o.endsWith(".md"))continue;let a;try{a=tt.readFileSync(o,"utf-8")}catch{continue}let l=a.split(`
|
|
100
|
+
`),c=[];for(let p=0;p<l.length;p++){let d=l[p];d.startsWith("```")||d.startsWith("---")||d.startsWith("#")||d.trim().length<10||c.push(...qr(d,p+1,vs.relative(process.cwd(),o)))}r.files++,r.total_lines+=l.length;let u=c.filter(p=>p.severity==="red").length,h=c.filter(p=>p.severity==="yellow").length;r.red+=u,r.yellow+=h,u+h===0&&r.clean++,s.push({file:vs.relative(process.cwd(),o),findings:c,lines:l.length})}return{results:s,summary:r}}Ae();var _=C(require("fs")),Te=C(require("path")),Kr=C(require("os"));te();var ye=Te.join(Kr.homedir(),".hyv","learning"),me=Te.join(ye,"events.jsonl"),xs=Te.join(ye,".last-sync"),Gr=Te.join(ye,".last-cleanup"),ef=5*1024*1024;function Jr(n){try{_.existsSync(ye)||_.mkdirSync(ye,{recursive:!0});let e=JSON.stringify({...n,timestamp:n.timestamp||Date.now()})+`
|
|
101
|
+
`;_.appendFileSync(me,e,"utf-8")}catch{}}function Xr(n,e,t,i){if(Jr({timestamp:Date.now(),type:i?"accept":"reject",ruleId:"algorithm.overall",original:n.slice(0,500),edited:i?void 0:e.slice(0,500),context:`score:${t}`}),i&&n!==e){let s=yc(n,e);for(let r of s)Jr({timestamp:Date.now(),type:"accept",ruleId:"algorithm.change",original:r.before.slice(0,200),edited:r.after.slice(0,200),context:`line:${r.line}`})}}var Ce=Te.join(ye,"ignored-rules.json"),fc=3;function Zr(n){if(n.length)try{_.existsSync(ye)||_.mkdirSync(ye,{recursive:!0});let e={};_.existsSync(Ce)&&(e=JSON.parse(_.readFileSync(Ce,"utf-8")));let t=Date.now();for(let i of n){let s=i.ruleId||i.pattern||"unknown";e[s]||(e[s]={ruleId:s,count:0,firstSeen:t,lastSeen:t}),e[s].count++,e[s].lastSeen=t}_.writeFileSync(Ce,JSON.stringify(e,null,2),"utf-8")}catch{}}function At(){try{if(!_.existsSync(Ce))return[];let n=JSON.parse(_.readFileSync(Ce,"utf-8")),e=[];for(let[t,i]of Object.entries(n))if(i.count>=fc){let s=t.replace(/\./g," ").replace(/-/g," ");e.push({ruleId:t,count:i.count,suggestion:`You've ignored "${s}" flags ${i.count} times. Want us to stop flagging it?`})}return e.sort((t,i)=>i.count-t.count)}catch{return[]}}function Qr(n){try{if(!_.existsSync(Ce))return;let e=JSON.parse(_.readFileSync(Ce,"utf-8"));delete e[n],_.writeFileSync(Ce,JSON.stringify(e,null,2),"utf-8")}catch{}}var Ot=Te.join(ye,"consolidated.md"),dc=7;function pc(){try{if(_.existsSync(Ot))return _.readFileSync(Ot,"utf-8")}catch{}return""}function Yr(n){let e=pc(),i=`
|
|
112
102
|
|
|
113
103
|
## Consolidated ${new Date().toISOString().split("T")[0]}
|
|
114
104
|
|
|
115
|
-
${n}`;_.writeFileSync(
|
|
116
|
-
`).filter(o=>o.length>0),t=Date.now()-
|
|
105
|
+
${n}`;_.writeFileSync(Ot,e+i,"utf-8")}function gc(){if(!_.existsSync(me))return{events:[],rawLines:[]};let e=_.readFileSync(me,"utf-8").trim().split(`
|
|
106
|
+
`).filter(o=>o.length>0),t=Date.now()-dc*24*60*60*1e3,i=[],s=[],r=[];for(let o of e)try{let a=JSON.parse(o);a.timestamp&&a.timestamp<t?(i.push(a),s.push(o)):r.push(o)}catch{r.push(o)}return _.writeFileSync(me,r.join(`
|
|
117
107
|
`)+(r.length?`
|
|
118
|
-
`:""),"utf-8"),{events:
|
|
119
|
-
`)}async function
|
|
108
|
+
`:""),"utf-8"),{events:i,rawLines:s}}function eo(n){let e=new Map;for(let i of n){let s=i.ruleId;e.has(s)||e.set(s,{accepts:0,rejects:0,edits:[]});let r=e.get(s);i.type==="accept"&&r.accepts++,i.type==="reject"&&r.rejects++,i.type==="edit"&&i.edited&&r.edits.push(`${i.original.slice(0,60)} \u2192 ${i.edited.slice(0,60)}`)}let t=[];for(let[i,s]of e)t.push(`- ${i}: ${s.accepts} accepts, ${s.rejects} rejects`),s.edits.length>0&&t.push(` edits: ${s.edits.slice(0,3).join("; ")}`);return t.join(`
|
|
109
|
+
`)}async function mc(n){if(n.length===0)return null;try{let{apiPost:e}=await Promise.resolve().then(()=>(te(),Vi)),t=eo(n);return(await e("/api/llm",{model:"free",system:`You extract voice patterns from a user's editing behavior.
|
|
120
110
|
Return a concise bullet list of their preferences. No commentary. Max 10 bullets.`,prompt:`User learning signals over the past month:
|
|
121
111
|
|
|
122
112
|
${t}
|
|
123
113
|
|
|
124
|
-
Extract their voice preferences as bullet points.`,maxTokens:200,action:"free"}))?.text||null}catch{return null}}async function
|
|
125
|
-
${t}`)}return _.writeFileSync(
|
|
126
|
-
`).filter(o=>o.length>0);if(e.length===0)return{synced:0,errors:0};let t=[];for(let o of e)try{t.push(JSON.parse(o))}catch{}if(t.length===0)return{synced:0,errors:0};let
|
|
127
|
-
`).filter(
|
|
128
|
-
`),
|
|
129
|
-
`),
|
|
130
|
-
${
|
|
131
|
-
`);let l=0;for(let u of r)if(u.findings.length!==0){console.log(` ${f.bold(u.file)} ${f.dim(`(${u.lines} lines)`)}`);for(let h of u.findings)On(h),l++;console.log("")}An(o);let c=yt();if(c.length>0){console.log(` ${f.yellow("\u{1F4A1} suggestions:")}`);for(let u of c.slice(0,3))console.log(` ${f.dim("\u2192")} ${u.suggestion}`);console.log("")}e.failOnHit&&o.red+o.yellow>0&&process.exit(1)}var Q=A(require("fs"));var tc=[{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}],sc=[{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}],ic=[{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}],nc=[{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}],rc=[{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}],oc=[...tc,...sc,...ic,...nc,...rc],Gr={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 ac(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 lc(n){let e=[],t=n.split(`
|
|
132
|
-
`),
|
|
133
|
-
`),
|
|
134
|
-
`),
|
|
135
|
-
`),
|
|
136
|
-
`),changes:
|
|
137
|
-
`)}function
|
|
138
|
-
`)}function
|
|
139
|
-
`)}function
|
|
140
|
-
`)}function
|
|
141
|
-
`)}function
|
|
142
|
-
`)[e-1]?.trim()||""}function
|
|
143
|
-
`)}var
|
|
144
|
-
${f.red("\u2717")} no profile specified`),console.error(` ${f.dim("usage:")} hyv rewrite <profile> <file>`),console.error(` ${f.dim("or set a default:")} hyv init --profile <name>`),process.exit(1));let r;t.text?r=t.text:
|
|
145
|
-
${f.red("\u2717")} file not found: ${
|
|
146
|
-
${f.red("\u2717")} no text provided`),process.exit(1)),r=
|
|
114
|
+
Extract their voice preferences as bullet points.`,maxTokens:200,action:"free"}))?.text||null}catch{return null}}async function to(){let{events:n}=gc();if(n.length===0)return _.writeFileSync(Gr,new Date().toISOString(),"utf-8"),{consolidated:0,kept:0};let e=await mc(n);if(e)Yr(e);else{let t=eo(n);Yr(`Raw summary (${n.length} events):
|
|
115
|
+
${t}`)}return _.writeFileSync(Gr,new Date().toISOString(),"utf-8"),{consolidated:n.length,kept:0}}function io(){try{if(_.existsSync(Ot))return _.readFileSync(Ot,"utf-8")}catch{}return""}async function so(){if(!_.existsSync(me))return{synced:0,errors:0};try{let e=_.readFileSync(me,"utf-8").trim().split(`
|
|
116
|
+
`).filter(o=>o.length>0);if(e.length===0)return{synced:0,errors:0};let t=[];for(let o of e)try{t.push(JSON.parse(o))}catch{}if(t.length===0)return{synced:0,errors:0};let i=0,s=0,r=20;for(let o=0;o<t.length;o+=r){let a=t.slice(o,o+r);try{await fe("/cli/learning/batch",{events:a}),i+=a.length}catch{s+=a.length}}return s===0&&(_.writeFileSync(me,"","utf-8"),_.writeFileSync(xs,new Date().toISOString(),"utf-8")),{synced:i,errors:s}}catch{return{synced:0,errors:1}}}function no(){let n={total:0,byType:{},lastSync:void 0};if(_.existsSync(me)){let t=_.readFileSync(me,"utf-8").trim().split(`
|
|
117
|
+
`).filter(i=>i.length>0);n.total=t.length;for(let i of t)try{let s=JSON.parse(i);n.byType[s.type]=(n.byType[s.type]||0)+1}catch{}}return _.existsSync(xs)&&(n.lastSync=_.readFileSync(xs,"utf-8").trim()),n}function yc(n,e){let t=n.split(`
|
|
118
|
+
`),i=e.split(`
|
|
119
|
+
`),s=[],r=Math.max(t.length,i.length);for(let o=0;o<r;o++){let a=t[o]||"",l=i[o]||"";a!==l&&s.push({line:o+1,before:a,after:l})}return s}async function ro(n,e){let t=It(),i=n.length?n:t.scan_paths||["."],s=t.ignore||[],{results:r,summary:o}=await $t(i,s),a=r.flatMap(u=>u.findings.map(h=>({ruleId:h.pattern})));if(a.length>0&&Zr(a),e.json){console.log(JSON.stringify({results:r.filter(u=>u.findings.length>0),summary:o},null,2)),e.failOnHit&&o.red+o.yellow>0&&process.exit(1);return}console.log(`
|
|
120
|
+
${E()} ${f.dim("scan")}
|
|
121
|
+
`);let l=0;for(let u of r)if(u.findings.length!==0){console.log(` ${f.bold(u.file)} ${f.dim(`(${u.lines} lines)`)}`);for(let h of u.findings)Dn(h),l++;console.log("")}Wn(o);let c=At();if(c.length>0){console.log(` ${f.yellow("\u{1F4A1} suggestions:")}`);for(let u of c.slice(0,3))console.log(` ${f.dim("\u2192")} ${u.suggestion}`);console.log("")}e.failOnHit&&o.red+o.yellow>0&&process.exit(1)}var ee=C(require("fs"));var bc=[{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}],wc=[{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}],vc=[{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}],xc=[{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}],Sc=[{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}],_c=[...bc,...wc,...vc,...xc,...Sc],oo={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 Cc(n){let t=n.split(/[.!?]+/).filter(o=>o.trim().length>0).map(o=>o.trim().split(/\s+/).length),i=t.length>0?t.reduce((o,a)=>o+a,0)/t.length:0,s=t.length>1?Math.sqrt(t.reduce((o,a)=>o+Math.pow(a-i,2),0)/t.length):0,r="low";return s>8?r="high":s>4&&(r="medium"),{avgWords:i,variance:r,sentences:t}}function Ec(n){let e=[],t=n.split(`
|
|
122
|
+
`),i=t.findIndex(r=>r.trim().length>10);if(i<0)return e;let s=t[i].trim().toLowerCase();return(s.endsWith("?")||/^(?:have you|do you|did you|what if|why do|how do|what's|how's)\b/.test(s))&&e.push({id:"voice.question-opener",line:i+1,column:1,category:"voice-drift",severity:"yellow",rule:"Opens with a question instead of a concrete observation",match:s.slice(0,80),excerpt:t[i].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(s)&&e.push({id:"voice.lesson-opener",line:i+1,column:1,category:"voice-drift",severity:"yellow",rule:"Opens with a lesson or inspirational claim",match:s.slice(0,80),excerpt:t[i].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(s)&&e.push({id:"voice.generic-generalization",line:i+1,column:1,category:"voice-drift",severity:"yellow",rule:"Opens with a generic generalization",match:s.slice(0,80),excerpt:t[i].trim().slice(0,120),suggestion:"Start with a specific observation, not a sweeping claim",autoFixable:!1}),e}function $c(n){let e=[],t=n.split(`
|
|
123
|
+
`),i=[];for(let s=0;s<t.length;s++){let r=t[s].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?(i.push({line:s+1,text:a.trim()}),i.length>=3&&(e.push({id:"voice.staccato-triplet",line:i[0].line,column:1,category:"cadence",severity:"yellow",rule:"Three short sentences in a row reads like performance",match:i.map(c=>c.text).join(" | "),excerpt:i[0].text,suggestion:"Vary sentence length \u2014 short staccato runs feel like AI trying to sound punchy",autoFixable:!1}),i=[])):i=[]}}return e}var Oc=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 Ac(n,e){let t=[];return(n.toLowerCase().match(/[a-z']+/g)||[]).filter(r=>Oc.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 kc(n,e,t){let i=[],s=n.toLowerCase();for(let r of t){if(!r)continue;let o=r.toLowerCase().trim();s.includes(o)&&i.push({id:"voice.never-list",line:e,column:s.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 i}function Fc(n,e,t){let i=[],s=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(" ");s.includes(l)&&i.push({id:`learned.${r.type}`,line:e,column:s.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 i}function Rc(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 Pe(n,e){let t=n.split(`
|
|
124
|
+
`),i=[],s=new Map,r=new Map,o=e?.drift_snapshot?Rc(e.drift_snapshot):new Set,a=e?.never_list||[],l=e?.learned_patterns||[];for(let d=0;d<t.length;d++){let m=t[d],g=d+1;if(!m.startsWith("```")&&!m.startsWith("---")&&!m.startsWith("#")&&!(m.trim().length<10)){for(let y of _c){y.regex.lastIndex=0;let b;for(;(b=y.regex.exec(m))!==null;){let v=o.has(y.id);i.push({id:y.id,line:g,column:b.index+1,category:y.category,severity:v?"yellow":y.severity,rule:y.suggestion,match:b[0],excerpt:jc(m.trim(),b.index,b[0].length),suggestion:y.suggestion,autoFixable:y.autoFixable,driftAccepted:v})}}i.push(...Ac(m,g)),i.push(...kc(m,g,a)),i.push(...Fc(m,g,l))}}i.push(...Ec(n)),i.push(...$c(n));for(let d of i)s.has(d.line)||s.set(d.line,[]),s.get(d.line).push(d),r.has(d.id)||r.set(d.id,[]),r.get(d.id).push(d);let c=i.filter(d=>d.severity==="red").length,u=i.filter(d=>d.severity==="yellow").length,h=i.filter(d=>d.autoFixable).length,p=i.filter(d=>d.driftAccepted).length;return{signals:i,byLine:s,byRule:r,summary:{red:c,yellow:u,autoFixable:h,driftAccepted:p,total:i.length}}}function ao(n,e){let{avgWords:t,variance:i}=Cc(n);if(!e?.avg_words)return 100;let s=e.avg_words,r=Math.abs(t-s)/s,o=Math.max(0,Math.round((1-r)*100));return e.variance&&i===e.variance?o=Math.min(100,o+10):e.variance&&i!==e.variance&&(o=Math.max(0,o-10)),o}function jc(n,e,t){let i=n.slice(0,e),s=n.slice(e,e+t),r=n.slice(e+t);return`${i}\xAB${s}\xBB${r}`.slice(0,120)}function ci(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 p=h.map(y=>Tc(y)),d=Pc(p),m=Ic(c,h,d),g=d==="auto_fix"?Lc(c,h):void 0;t.push({line:c,signals:h,strategy:d,priority:Mc(h,d),instruction:m,autoFixText:g})}let i=t.filter(c=>c.strategy==="auto_fix"),s=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:i,llmFixes:s,skipped:r,stats:{total:t.length,autoFixable:i.length,needsLLM:s.length,skipped:r.length,score:l}}}function Tc(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 Pc(n){return n.includes("restructure")?"restructure":n.includes("voice_drift")?"voice_drift":n.includes("auto_fix")?"auto_fix":"skip"}function Mc(n,e){let t=0,i=n.filter(r=>r.severity==="red").length,s=n.filter(r=>r.severity==="yellow").length;return t+=i*10+s*5,e==="restructure"&&(t+=20),e==="voice_drift"&&(t+=15),e==="auto_fix"&&(t+=5),t}function Ic(n,e,t){let i=[...new Set(e.map(r=>r.rule))],s=e.filter(r=>r.severity==="red");if(t==="auto_fix")return`Replace AI-slop words: ${i.join("; ")}`;if(t==="restructure"){let r=e.map(o=>o.match).filter(Boolean).slice(0,3);return`Restructure line ${n}: ${i[0]||"structural issue"}. Patterns: ${r.join(", ")}`}return t==="voice_drift"?`Rewrite line ${n} to match voice profile: ${i[0]||"voice drift"}`:`Review line ${n}`}function Lc(n,e){return e.filter(i=>i.autoFixable).map(i=>i.id).join(",")}function hi(n,e){let t=n.split(`
|
|
125
|
+
`),i=[];for(let s of e){if(s.strategy!=="auto_fix")continue;let r=s.line-1;if(r<0||r>=t.length)continue;let o=t[r],a=o;for(let l of s.signals){if(!l.autoFixable)continue;let c=oo[l.match.toLowerCase()];if(c!==void 0){let u=new RegExp(Nc(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&&(i.push({line:s.line,before:o,after:a,rule:s.signals.map(l=>l.id).join(", ")}),t[r]=a)}return{original:n,fixed:t.join(`
|
|
126
|
+
`),changes:i,changed:i.length>0}}function Nc(n){return n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}te();Ae();var oe=C(require("fs")),_s=C(require("path")),ho=C(require("os")),lo=5*60*1e3,ui=new Map;async function it(n,e={}){let t=e.includeSamples!==!1,i=e.forceRefresh||!1;if(!i){let r=ui.get(n);if(r&&Date.now()-r.timestamp<lo)return r.data}let s=fo(n);return s&&!i?Date.now()-s.timestamp<lo?(ui.set(n,s),s.data):(ui.set(n,s),Dc(n).catch(()=>{}),s.data):co(n)}async function co(n){try{let e=await N(`/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||{}},i={data:t,timestamp:Date.now(),version:1};return ui.set(n,i),Wc(n,i),t}catch{let t=fo(n);if(t)return t.data;let i=nn(n);if(i)return Vc(n,i);throw new Error(`Profile not found: ${n}. Run: hyv init`)}}async function Dc(n){try{await co(n)}catch{}}var Ss=_s.join(ho.homedir(),".hyv","cache","profiles");function uo(n){return _s.join(Ss,`${n.replace(/[^a-z0-9-]/gi,"_")}.json`)}function fo(n){try{let e=uo(n);if(!oe.existsSync(e))return null;let t=oe.readFileSync(e,"utf-8"),i=JSON.parse(t);return!i.data||!i.timestamp?null:i}catch{return null}}function Wc(n,e){try{oe.existsSync(Ss)||oe.mkdirSync(Ss,{recursive:!0}),oe.writeFileSync(uo(n),JSON.stringify(e),"utf-8")}catch{}}function Vc(n,e){return{id:"",name:n,slug:n,body:e,drift_snapshot:[],learned_patterns:[],voice_samples:[],voice_rules:[],never_list:[],cadence:{}}}function st(){return It().profile}var Hc=15,Bc=2,Uc=200,zc=10;function fi(n,e,t,i,s=1){let r=[],o=t.issues.filter(l=>l.strategy==="restructure"||l.strategy==="voice_drift").sort((l,c)=>c.priority-l.priority).slice(0,Hc);return r.push(qc(n,o.length,s)),r.push(""),o.length>0&&(r.push(Gc(e,o,n)),r.push("")),o.some(l=>l.strategy==="voice_drift")&&n.voice_samples?.length&&(r.push(Yc(n.voice_samples)),r.push("")),r.push(Kc(e,o,s)),r.join(`
|
|
127
|
+
`)}function qc(n,e,t){let i=[];if(i.push(`Rewrite ${e} lines to match ${n.name}'s voice.`),n.description&&i.push(`Voice: ${n.description.slice(0,100)}`),n.cadence?.avg_words&&i.push(`Rhythm: ${n.cadence.avg_words} words/sentence, ${n.cadence.variance||"mixed"} variance`),n.never_list?.length){let r=n.never_list.slice(0,zc);i.push(`Never: ${r.join(", ")}`)}let s=n.drift_snapshot.filter(r=>r.status==="accepted"&&r.profile_line).map(r=>r.profile_line).slice(0,3);return s.length&&i.push(`User voice: ${s.join("; ")}`),t>1&&i.push(`RETRY ${t}: Previous rewrite had issues. Be more careful.`),i.join(`
|
|
128
|
+
`)}function Gc(n,e,t){let i=[];i.push("FIX THESE LINES:");for(let s of e){let r=Xc(n,s.line),o=Jc(s,t);i.push(`${s.line}: "${po(r,80)}" \u2192 ${o}`)}return i.join(`
|
|
129
|
+
`)}function Jc(n,e){let t=n.signals.filter(r=>r.autoFixable&&r.match);if(t.length>0&&t.length===n.signals.length)return`replace: ${t.map(r=>r.match).join(", ")}`;let i=n.signals.find(r=>r.category==="structure");if(i)return i.suggestion.slice(0,60);let s=n.signals.find(r=>r.category==="voice-drift"||r.category==="learned");return s?s.suggestion.slice(0,60):n.signals.some(r=>r.category==="cadence")?`match rhythm: ${e.cadence?.avg_words||12} words/sentence`:n.instruction.slice(0,60)}function Yc(n){let e=["VOICE EXAMPLES:"];for(let t=0;t<Math.min(Bc,n.length);t++){let i=n[t];e.push(`[${i.origin}] ${po(i.text,Uc)}`)}return e.join(`
|
|
130
|
+
`)}function Kc(n,e,t){let i=[];return i.push("OUTPUT: Return the FULL text with only the flagged lines rewritten."),i.push("- Include all lines (changed + unchanged)"),i.push("- Preserve markdown formatting"),i.push("- No commentary, no fences"),i.join(`
|
|
131
|
+
`)}function Xc(n,e){return n.split(`
|
|
132
|
+
`)[e-1]?.trim()||""}function po(n,e){return n.length<=e?n:n.slice(0,e-3)+"..."}var go=70;var Zc=25;function di(n,e,t,i){let s=[],r=Pe(e,t),o=r.summary.red,a=r.summary.yellow;if(o>0&&s.push(`Rewrite introduced ${o} new critical issues`),i){let x=new Set(i.signals.map($=>$.id)),S=r.signals.filter($=>!x.has($.id));if(S.length>0){let $=[...new Set(S.map(z=>z.id))].slice(0,5);s.push(`Rewrite introduced new patterns: ${$.join(", ")}`)}}let l=ao(e,t.cadence);l<100-Zc&&s.push(`Cadence deviation: score ${l}/100 (target avg ${t.cadence?.avg_words||"?"} words)`);let c=[],u=e.toLowerCase();for(let x of t.never_list||[])x&&u.includes(x.toLowerCase())&&c.push(x);c.length>0&&s.push(`Never-list violations: ${c.join(", ")}`);let h=Qc(n,e);h<60&&s.push(`Semantic drift detected: score ${h}/100`);let p=e.length/Math.max(1,n.length);(p<.5||p>2)&&s.push(`Length changed too much: ${(p*100).toFixed(0)}% of original`);let d=Math.max(0,100-o*20-a*5),m=Math.max(0,100-c.length*25),g=Math.round(d*.35+l*.25+h*.25+m*.15),y=g<go&&s.length>0,b=!1,v;return y&&(v=eh(s,r,t)),{valid:g>=go,score:g,issues:s,newSignals:r,cadenceScore:l,neverListHits:c,needsRetry:y,needsVerification:b,retryInstruction:v}}function Qc(n,e){let t=mo(n),i=mo(e);if(t.size===0)return 100;let s=0;for(let l of t)i.has(l)&&s++;let r=s/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 mo(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(i=>!t.has(i)))}function eh(n,e,t){let i=[];i.push("The rewrite had these issues:");for(let r of n)i.push(`- ${r}`);i.push("");let s=e.byRule;if(s.size>0){i.push("Fix these specific patterns:");for(let[r,o]of s){let a=o.map(l=>l.line).join(", ");i.push(`- ${r} on lines ${a}`)}}return t.never_list?.length&&(i.push(""),i.push(`Remember: never use these words: ${t.never_list.join(", ")}`)),i.join(`
|
|
133
|
+
`)}var yo=50;async function bo(n,e,t){let i=st(),s;n&&e?(i=n,s=e):n&&(n.endsWith(".md")||ee.existsSync(n)?s=n:i=n),i||(console.error(`
|
|
134
|
+
${f.red("\u2717")} no profile specified`),console.error(` ${f.dim("usage:")} hyv rewrite <profile> <file>`),console.error(` ${f.dim("or set a default:")} hyv init --profile <name>`),process.exit(1));let r;t.text?r=t.text:s?(ee.existsSync(s)||(console.error(`
|
|
135
|
+
${f.red("\u2717")} file not found: ${s}`),process.exit(1)),r=ee.readFileSync(s,"utf-8")):(process.stdin.isTTY&&(console.error(`
|
|
136
|
+
${f.red("\u2717")} no text provided`),process.exit(1)),r=ee.readFileSync(0,"utf-8")),r.trim()||(console.error(`
|
|
147
137
|
${f.red("\u2717")} empty draft`),process.exit(1)),console.log(`
|
|
148
|
-
${
|
|
149
|
-
`),console.log(` ${f.dim("1/6")} loading profile: ${f.bold(
|
|
138
|
+
${E()} ${f.dim("algorithm")} ${f.dim("v2.0")}
|
|
139
|
+
`),console.log(` ${f.dim("1/6")} loading profile: ${f.bold(i)}`);let o;try{o=await it(i)}catch(d){console.error(`
|
|
150
140
|
${f.red("\u2717")} ${d.message}`),process.exit(1)}console.log(` ${f.dim("drift rules:")} ${o.drift_snapshot.length}`),console.log(` ${f.dim("learned patterns:")} ${o.learned_patterns.length}`),console.log(` ${f.dim("voice samples:")} ${o.voice_samples.length}`),console.log(`
|
|
151
|
-
${f.dim("2/6")} extracting signals...`);let a=
|
|
152
|
-
${f.dim("3/6")} classifying issues...`);let l=
|
|
153
|
-
${f.dim("4/6")} applying ${l.autoFixes.length} auto-fixes...`);let d=
|
|
154
|
-
${f.dim("4/6")} no auto-fixes needed`);let u=c,h=l.stats.score,
|
|
155
|
-
${f.dim("5/6")} building prompt for your LLM...`);let d=
|
|
141
|
+
${f.dim("2/6")} extracting signals...`);let a=Pe(r,o);console.log(` ${f.red(a.summary.red)} critical`),console.log(` ${f.yellow(a.summary.yellow)} advisory`),console.log(` ${f.dim(a.summary.autoFixable)} auto-fixable`),console.log(` ${f.dim(a.summary.driftAccepted)} drift-accepted (skipped)`),console.log(`
|
|
142
|
+
${f.dim("3/6")} classifying issues...`);let l=ci(a);console.log(` ${f.green(l.autoFixes.length)} auto-fixes`),console.log(` ${f.yellow(l.llmFixes.length)} need LLM rewrite`),console.log(` ${f.dim(l.skipped.length)} skipped`);let c=r;if(l.autoFixes.length>0){console.log(`
|
|
143
|
+
${f.dim("4/6")} applying ${l.autoFixes.length} auto-fixes...`);let d=hi(r,l.issues);if(c=d.fixed,d.changed){console.log(` ${f.green("\u2713")} ${d.changes.length} lines fixed`);for(let m of d.changes.slice(0,5))console.log(` ${f.dim(`line ${m.line}:`)} ${m.before.slice(0,40)} \u2192 ${f.green(m.after.slice(0,40))}`)}else console.log(` ${f.dim("no auto-fixes applied")}`)}else console.log(`
|
|
144
|
+
${f.dim("4/6")} no auto-fixes needed`);let u=c,h=l.stats.score,p=h<yo;if(l.llmFixes.length>0){console.log(`
|
|
145
|
+
${f.dim("5/6")} building prompt for your LLM...`);let d=fi(o,c,l,a,1),m=s?`${s}.hyv-prompt.md`:"hyv-rewrite-prompt.md";ee.writeFileSync(m,d,"utf-8"),console.log(` ${f.dim("prompt:")} ${m}`),t.output?(ee.writeFileSync(t.output,d,"utf-8"),console.log(`
|
|
156
146
|
${f.green("\u2713")} prompt written to ${f.bold(t.output)}`)):(console.log(`
|
|
157
147
|
${"\u2500".repeat(50)}`),console.log(d),console.log(`${"\u2500".repeat(50)}
|
|
158
|
-
`)),console.log(` ${f.yellow("\u2192")} pass this prompt to your AI agent to rewrite`),console.log(` ${f.dim(" then validate:")} hyv validate <output.md> --profile ${
|
|
148
|
+
`)),console.log(` ${f.yellow("\u2192")} pass this prompt to your AI agent to rewrite`),console.log(` ${f.dim(" then validate:")} hyv validate <output.md> --profile ${i}`)}else console.log(`
|
|
159
149
|
${f.dim("5/6")} no LLM rewrite needed \u2014 all issues auto-fixable`);console.log(`
|
|
160
150
|
${f.dim("6/6")} algorithm complete`),console.log(`
|
|
161
|
-
${"\u2500".repeat(50)}`),console.log(` ${f.bold("Score:")} ${
|
|
162
|
-
${f.yellow("\u26A0")} Score below ${
|
|
163
|
-
`),
|
|
164
|
-
${f.red("\u2717")} no profile specified`),process.exit(1));let
|
|
165
|
-
${f.red("\u2717")} no text provided`),process.exit(1)),
|
|
166
|
-
${
|
|
167
|
-
`);let
|
|
151
|
+
${"\u2500".repeat(50)}`),console.log(` ${f.bold("Score:")} ${vo(h)}/100`),console.log(` ${f.bold("Auto-fixed:")} ${l.autoFixes.length} lines`),console.log(` ${f.bold("Needs LLM:")} ${l.llmFixes.length} lines`),console.log(` ${f.bold("Skipped:")} ${l.skipped.length} lines (drift-accepted)`),p&&l.llmFixes.length>0&&console.log(`
|
|
152
|
+
${f.yellow("\u26A0")} Score below ${yo} \u2014 verify the rewrite after your LLM processes it`),console.log(`${"\u2500".repeat(50)}
|
|
153
|
+
`),Xr(r,u,h,!0),t.json&&console.log(JSON.stringify({score:h,auto_fixed:l.autoFixes.length,needs_llm:l.llmFixes.length,skipped:l.skipped.length,needs_verification:p,signals:a.summary,prompt_file:l.llmFixes.length>0?s?`${s}.hyv-prompt.md`:"hyv-rewrite-prompt.md":null},null,2))}async function wo(n,e){let t=e.profile||st();t||(console.error(`
|
|
154
|
+
${f.red("\u2717")} no profile specified`),process.exit(1));let i;e.text?i=e.text:n&&ee.existsSync(n)?i=ee.readFileSync(n,"utf-8"):(process.stdin.isTTY&&(console.error(`
|
|
155
|
+
${f.red("\u2717")} no text provided`),process.exit(1)),i=ee.readFileSync(0,"utf-8")),console.log(`
|
|
156
|
+
${E()} ${f.dim("validate")}
|
|
157
|
+
`);let s=await it(t),r=Pe(i,s),o=di(i,i,s);if(console.log(` ${f.bold("Score:")} ${vo(o.score)}/100`),console.log(` ${f.bold("Signals:")} ${r.summary.red} red, ${r.summary.yellow} yellow`),console.log(` ${f.bold("Cadence:")} ${o.cadenceScore}/100`),o.neverListHits.length>0&&console.log(` ${f.red("Never-list:")} ${o.neverListHits.join(", ")}`),o.issues.length>0){console.log(`
|
|
168
158
|
${f.yellow("Issues:")}`);for(let a of o.issues)console.log(` - ${a}`)}o.valid?console.log(`
|
|
169
159
|
${f.green("\u2713")} text passes validation`):console.log(`
|
|
170
|
-
${f.yellow("\u26A0")} text needs improvement`),e.json&&console.log(JSON.stringify({score:o.score,valid:o.valid,cadence_score:o.cadenceScore,never_list_hits:o.neverListHits,issues:o.issues,signals:r.summary},null,2))}function
|
|
171
|
-
${
|
|
172
|
-
`),t.length===0){console.log(` ${f.dim("no voice profiles yet")}`),console.log(` ${f.dim("create one at:")} ${f.cyan("https://holdyourvoice.com/dashboard")}`);return}for(let
|
|
173
|
-
${f.red("\u2717")} not authenticated. run ${f.bold("hyv init")}`),process.exit(2);return}try{let t=await
|
|
174
|
-
${
|
|
175
|
-
`),console.log(` ${f.bold("account")}`),console.log(` email: ${t.email||"\u2014"}`),console.log(` plan: ${t.plan||"none"} (${t.status||"\u2014"})`),t.plan==="none"&&console.log(` ${f.dim("subscribe at:")} ${f.cyan("https://holdyourvoice.com/dashboard")}`),console.log(""),console.log(` ${f.bold("cli")}`),console.log(` server: ${f.dim(e.base_url)}`),console.log(` key: ${f.dim(e.api_key.slice(0,12)+"...")}`),console.log("")}catch(t){n.json?console.log(JSON.stringify({error:t.message})):console.log(` ${f.red("\u2717")} connection failed: ${t.message}`),process.exit(1)}}var
|
|
176
|
-
${f.red("\u2717")} ${r.error}`),process.exit(1);return}if(!
|
|
177
|
-
${f.red("\u2717")} ${r.error}`),process.exit(1);return}let
|
|
178
|
-
${
|
|
179
|
-
`);try{let r=await
|
|
180
|
-
${f.red("\u2717")} ${
|
|
181
|
-
${
|
|
182
|
-
`);try{let
|
|
160
|
+
${f.yellow("\u26A0")} text needs improvement`),e.json&&console.log(JSON.stringify({score:o.score,valid:o.valid,cadence_score:o.cadenceScore,never_list_hits:o.neverListHits,issues:o.issues,signals:r.summary},null,2))}function vo(n){return n>=80?f.green(String(n)):n>=50?f.yellow(String(n)):f.red(String(n))}te();async function xo(n){let t=(await N("/cli/profiles")).profiles||[];if(n.json){console.log(JSON.stringify(t,null,2));return}if(console.log(`
|
|
161
|
+
${E()} ${f.dim("profiles")}
|
|
162
|
+
`),t.length===0){console.log(` ${f.dim("no voice profiles yet")}`),console.log(` ${f.dim("create one at:")} ${f.cyan("https://holdyourvoice.com/dashboard")}`);return}for(let i of t){let s=f.bold(i.name||i.slug),r=i.brand?f.dim(` (${i.brand})`):"",o=i.keywords?.length?f.dim(` \u2014 ${i.keywords.slice(0,3).join(", ")}`):"";console.log(` \u25CF ${s}${r}${o}`)}console.log("")}te();Ae();async function So(n){let e=be();if(!e){n.json?console.log(JSON.stringify({error:"Not authenticated. Run: hyv init"})):console.log(`
|
|
163
|
+
${f.red("\u2717")} not authenticated. run ${f.bold("hyv init")}`),process.exit(2);return}try{let t=await N("/cli/heartbeat");if(n.json){console.log(JSON.stringify({email:t.email,name:t.name,plan:t.plan,status:t.status,server:e.base_url,key_prefix:e.api_key.slice(0,12)},null,2));return}console.log(`
|
|
164
|
+
${E()} ${f.dim("status")}
|
|
165
|
+
`),console.log(` ${f.bold("account")}`),console.log(` email: ${t.email||"\u2014"}`),console.log(` plan: ${t.plan||"none"} (${t.status||"\u2014"})`),t.plan==="none"&&console.log(` ${f.dim("subscribe at:")} ${f.cyan("https://holdyourvoice.com/dashboard")}`),console.log(""),console.log(` ${f.bold("cli")}`),console.log(` server: ${f.dim(e.base_url)}`),console.log(` key: ${f.dim(e.api_key.slice(0,12)+"...")}`),console.log("")}catch(t){n.json?console.log(JSON.stringify({error:t.message})):console.log(` ${f.red("\u2717")} connection failed: ${t.message}`),process.exit(1)}}var Ee=C(require("fs"));te();async function _o(n,e,t){if(!Ee.existsSync(n)){let r={error:`File not found: ${n}`};t.json?console.log(JSON.stringify(r)):console.log(`
|
|
166
|
+
${f.red("\u2717")} ${r.error}`),process.exit(1);return}if(!Ee.existsSync(e)){let r={error:`File not found: ${e}`};t.json?console.log(JSON.stringify(r)):console.log(`
|
|
167
|
+
${f.red("\u2717")} ${r.error}`),process.exit(1);return}let i=Ee.readFileSync(n,"utf-8"),s=Ee.readFileSync(e,"utf-8");t.json||console.log(`
|
|
168
|
+
${E()} ${f.dim("reinforce")}
|
|
169
|
+
`);try{let r=await fe("/cli/learning/reinforce",{original:i,edited:s});t.json?console.log(JSON.stringify({ok:!0,...r})):console.log(` ${f.green("\u2713")} learning signal sent`)}catch(r){t.json?console.log(JSON.stringify({error:r.message})):console.log(` ${f.red("\u2717")} failed: ${r.message}`),process.exit(1)}}async function Co(n,e){if(!Ee.existsSync(n)){let i={error:`File not found: ${n}`};e.json?console.log(JSON.stringify(i)):console.log(`
|
|
170
|
+
${f.red("\u2717")} ${i.error}`),process.exit(1);return}let t=Ee.readFileSync(n,"utf-8");e.json||console.log(`
|
|
171
|
+
${E()} ${f.dim("add sample")}
|
|
172
|
+
`);try{let i=await fe("/cli/learning/add",{text:t,profile:e.profile});e.json?console.log(JSON.stringify({ok:!0,...i})):console.log(` ${f.green("\u2713")} sample added${e.profile?` to ${f.bold(e.profile)}`:""}`)}catch(i){e.json?console.log(JSON.stringify({error:i.message})):console.log(` ${f.red("\u2717")} failed: ${i.message}`),process.exit(1)}}var Eo=C(require("fs"));te();var Cs={claude:{name:"Claude / Claude Code",wrap:(n,e)=>`You are rewriting text to match a specific voice profile. Use this voice profile for all writing:
|
|
183
173
|
|
|
184
174
|
${e}
|
|
185
175
|
|
|
@@ -200,25 +190,53 @@ ${e}
|
|
|
200
190
|
- Match this voice profile for all writing
|
|
201
191
|
- Preserve meaning
|
|
202
192
|
- Remove AI-slop patterns
|
|
203
|
-
- Use the same rhythm and vocabulary`}};async function
|
|
204
|
-
${f.red("\u2717")} unknown format: ${f.bold(n)}`),console.log(` ${f.dim("valid formats:")} ${r}`)),process.exit(1);return}let t;try{t=(await
|
|
193
|
+
- Use the same rhythm and vocabulary`}};async function $o(n,e){if(!Cs[n]){let r=Object.keys(Cs).join(", ");e.json?console.log(JSON.stringify({error:`Unknown format: ${n}. Valid: ${r}`})):(console.log(`
|
|
194
|
+
${f.red("\u2717")} unknown format: ${f.bold(n)}`),console.log(` ${f.dim("valid formats:")} ${r}`)),process.exit(1);return}let t;try{t=(await N("/cli/profiles")).profiles||[]}catch(r){e.json?console.log(JSON.stringify({error:r.message})):console.log(`
|
|
205
195
|
${f.red("\u2717")} failed to fetch profiles: ${r.message}`),process.exit(1);return}if(t.length===0){e.json?console.log(JSON.stringify({error:"No voice profiles found"})):(console.log(`
|
|
206
|
-
${f.red("\u2717")} no voice profiles found`),console.log(` ${f.dim("create one at")} ${f.cyan("https://holdyourvoice.com/dashboard")}`)),process.exit(1);return}let
|
|
207
|
-
${
|
|
208
|
-
`),console.log(` ${f.bold(n.toUpperCase())} \u2014 ${
|
|
209
|
-
`);for(let r of
|
|
210
|
-
`))}}
|
|
211
|
-
${
|
|
212
|
-
|
|
213
|
-
${
|
|
214
|
-
|
|
215
|
-
${
|
|
216
|
-
|
|
217
|
-
${f.dim("
|
|
196
|
+
${f.red("\u2717")} no voice profiles found`),console.log(` ${f.dim("create one at")} ${f.cyan("https://holdyourvoice.com/dashboard")}`)),process.exit(1);return}let i=Cs[n],s=[];for(let r of t)try{let o=await N(`/cli/profiles/${encodeURIComponent(r.slug||r.name)}`),a=i.wrap(o.profile,o.body);if(e.output){let l=e.output.replace("{name}",r.slug||r.name);Eo.writeFileSync(l,a),s.push({profile:r.name,file:l})}else s.push({profile:r.name,prompt:a})}catch{s.push({profile:r.name,error:"Failed to fetch profile body"})}if(e.json){console.log(JSON.stringify({format:n,results:s},null,2));return}console.log(`
|
|
197
|
+
${E()} ${f.dim("export")}
|
|
198
|
+
`),console.log(` ${f.bold(n.toUpperCase())} \u2014 ${i.name}
|
|
199
|
+
`);for(let r of s){if(r.error){console.log(` ${f.red("\u2717")} ${r.profile}: ${r.error}`);continue}r.file?console.log(` ${f.green("\u2713")} ${f.bold(r.profile)} \u2192 ${f.dim(r.file)}`):(console.log(` ${f.bold("\u2500\u2500 "+r.profile+" \u2500\u2500".padEnd(60,"\u2500"))}`),console.log(r.prompt),console.log(` ${"\u2500".repeat(60)}
|
|
200
|
+
`))}}te();Ae();var th={solo:{name:"Solo",price:"$19/mo",docs:"50 docs/mo"},team:{name:"Team",price:"$59/mo",docs:"300 docs/mo"},agency:{name:"BYOK",price:"$99 once",docs:"unlimited"}};async function Oo(n){if(!be()){n.json?console.log(JSON.stringify({error:"Not authenticated. Run: hyv init"})):console.log(`
|
|
201
|
+
${f.red("\u2717")} not authenticated. run ${f.bold("hyv init")}`),process.exit(2);return}if(n.manage){try{let t=await fe("/cli/subscribe/manage"),i=t.portal_url||t.url;if(i){let s=(await Promise.resolve().then(()=>C(Le()))).default;await s(i),console.log(`
|
|
202
|
+
${f.green("\u2713")} opening billing portal...`)}else console.log(`
|
|
203
|
+
${f.dim("manage billing at:")} ${f.cyan("https://holdyourvoice.com/app/billing")}`)}catch{console.log(`
|
|
204
|
+
${f.dim("manage billing at:")} ${f.cyan("https://holdyourvoice.com/app/billing")}`)}return}if(n.upgrade){try{let i=(await fe("/cli/subscribe",{plan:"team"})).checkout_url;if(i){let s=(await Promise.resolve().then(()=>C(Le()))).default;await s(i),console.log(`
|
|
205
|
+
${f.green("\u2713")} opening checkout...`)}else console.log(`
|
|
206
|
+
${f.dim("upgrade at:")} ${f.cyan("https://holdyourvoice.com/app/billing")}`)}catch{console.log(`
|
|
207
|
+
${f.dim("upgrade at:")} ${f.cyan("https://holdyourvoice.com/app/billing")}`)}return}try{let t=await N("/cli/heartbeat");if(n.json){console.log(JSON.stringify({plan:t.plan,status:t.status,email:t.email},null,2));return}let i=(t.plan||"none").toLowerCase(),s=th[i];console.log(`
|
|
208
|
+
${E()} ${f.dim("plan")}
|
|
209
|
+
`),console.log(` ${f.bold("account")} ${t.email||"\u2014"}`),s?(console.log(` ${f.bold("plan")} ${s.name} ${f.dim(s.price)}`),console.log(` ${f.bold("status")} ${t.status||"\u2014"}`),console.log(` ${f.bold("quota")} ${s.docs}`)):console.log(` ${f.bold("plan")} ${f.yellow(t.plan||"none")} (${t.status||"\u2014"})`),console.log(""),console.log(` ${f.dim("manage:")} hyv plan --manage`),console.log(` ${f.dim("upgrade:")} hyv plan --upgrade`),console.log(` ${f.dim("web:")} ${f.cyan("https://holdyourvoice.com/app/billing")}`),console.log("")}catch(t){n.json?console.log(JSON.stringify({error:t.message})):console.log(` ${f.red("\u2717")} failed: ${t.message}`),process.exit(1)}}var nt=C(require("fs")),$s=C(require("path")),gi=C(require("os"));var Ao=$s.join(gi.homedir(),".hyv","voice.md");function Es(n,e){return JSON.stringify({jsonrpc:"2.0",id:n,result:e})}function ih(n,e,t){return JSON.stringify({jsonrpc:"2.0",id:n,error:{code:e,message:t}})}function pi(n){process.stdout.write(n+`
|
|
210
|
+
`)}async function sh(n){let e=n.text||"",t=n.profile||st()||"default";if(!e.trim())return"Error: no text provided";try{let i=await it(t),s=Pe(e,i),r=ci(s),o=e;if(r.autoFixes.length>0&&(o=hi(e,r.issues).fixed),r.llmFixes.length>0){let a=fi(i,o,r,s,1);return`Auto-fixed ${r.autoFixes.length} issues. ${r.llmFixes.length} issues need LLM rewrite.
|
|
211
|
+
|
|
212
|
+
${a}`}return o}catch(i){return`Error: ${i.message}`}}async function nh(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:s,summary:r}=await $t([t]),o=s.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:
|
|
213
|
+
${o.join(`
|
|
214
|
+
`)}`}let i=$s.join(gi.tmpdir(),`hyv-scan-${Date.now()}.md`);nt.writeFileSync(i,e);try{let{results:s,summary:r}=await $t([i]),o=s.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:
|
|
215
|
+
${o.join(`
|
|
216
|
+
`)}`}finally{try{nt.unlinkSync(i)}catch{}}}catch(i){return`Error: ${i.message}`}}async function rh(n){try{let{apiGet:e}=await Promise.resolve().then(()=>(te(),Vi)),i=(await e("/cli/profiles")).profiles||[];return i.length===0?"No voice profiles found. Create one at holdyourvoice.com or run: hyv new <name>":i.map(s=>`${s.name}${s.is_default?" (default)":""}${s.keywords?.length?" \u2014 "+s.keywords.slice(0,3).join(", "):""}`).join(`
|
|
217
|
+
`)}catch(e){return`Error: ${e.message}`}}async function oh(n){let e=n.text||"",t=n.profile||st()||"default";if(!e.trim())return"Error: no text provided";try{let i=await it(t),s=di(e,e,i),r=[`Score: ${s.score}/100`];return s.cadenceScore&&r.push(`Cadence: ${s.cadenceScore}/100`),s.neverListHits.length&&r.push(`Never-list hits: ${s.neverListHits.join(", ")}`),s.valid?r.push("PASS"):r.push("NEEDS IMPROVEMENT"),s.issues.length&&r.push(`Issues:
|
|
218
|
+
${s.issues.map(o=>` - ${o}`).join(`
|
|
219
|
+
`)}`),r.join(`
|
|
220
|
+
`)}catch(i){return`Error: ${i.message}`}}var ah=[{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:i,params:s}=e;switch(i){case"initialize":pi(Es(t,{protocolVersion:"2024-11-05",capabilities:{tools:{}},serverInfo:{name:"hyv",version:"0.6.0"}}));break;case"notifications/initialized":break;case"tools/list":pi(Es(t,{tools:ah}));break;case"tools/call":{let r=s?.name,o=s?.arguments||{},a;try{switch(r){case"hyv_rewrite":a=await sh(o);break;case"hyv_scan":a=await nh(o);break;case"hyv_profiles":a=await rh(o);break;case"hyv_validate":a=await oh(o);break;default:a=`Unknown tool: ${r}`;break}}catch(l){a=`Error: ${l.message}`}pi(Es(t,{content:[{type:"text",text:a}]}));break}default:t!==void 0&&pi(ih(t,-32601,`Method not found: ${i}`));break}}function ko(){nt.existsSync(Ao)?process.stderr.write(`[hyv-mcp] voice profile: ${Ao}
|
|
221
|
+
`):process.stderr.write(`[hyv-mcp] no voice.md found \u2014 run hyv init first
|
|
222
|
+
`);let n="";process.stdin.setEncoding("utf-8"),process.stdin.on("data",e=>{n+=e;let t=n.split(`
|
|
223
|
+
`);n=t.pop()||"";for(let i of t)i.trim()&&lh(i.trim()).catch(s=>{process.stderr.write(`[hyv-mcp] error: ${s.message}
|
|
224
|
+
`)})}),process.stdin.on("end",()=>{process.exit(0)}),process.stderr.write(`[hyv-mcp] server started
|
|
225
|
+
`)}var U=new Vs;U.name("hyv").description("hold your voice \u2014 voice gate layer for ai workflows").version("0.6.0");U.command("init").description("authenticate and set up your project").option("-p, --profile <name>","set default voice profile").option("-k, --key <key>","use a license key directly").option("-q, --quiet","minimal output (for CI)").action(n=>zn(n.profile,{key:n.key,quiet:n.quiet}));U.command("scan").description("scan local .md files for ai patterns and voice drift").argument("[paths...]","files or directories to scan").option("--json","output as json").option("--fail-on-hit","exit with code 1 if issues found").action((n,e)=>ro(n,e));U.command("rewrite").description("generate a rewrite prompt for your ai agent").argument("[profile-or-file]","voice profile name or .md file").argument("[file]",".md file to rewrite").option("-o, --output <file>","write prompt to file instead of stdout").option("-t, --text <text>","inline text to rewrite (instead of file/stdin)").option("--json","output as json").action((n,e,t)=>bo(n,e,t));U.command("profiles").description("list your voice profiles").option("--json","output as json").action(n=>xo(n));U.command("status").description("show account and cli status").option("--json","output as json").option("-q, --quiet","minimal output (for CI)").action(n=>So(n));U.command("reinforce").description("send learning signals from an edited draft").argument("<original>","original .md file").argument("<edited>","edited .md file").option("--json","output as json").action((n,e,t)=>_o(n,e,t));U.command("add").description("add a writing sample to your voice profile").argument("<file>",".md file to add as sample").option("-p, --profile <name>","target profile").option("--json","output as json").action((n,e)=>Co(n,e));U.command("validate").description("validate text against your voice profile").argument("[file]",".md file to validate").option("-p, --profile <name>","voice profile to validate against").option("-t, --text <text>","inline text to validate").option("--json","output as json").action((n,e)=>wo(n,e));U.command("export").description("export voice profile as system prompt for AI apps").argument("<format>","target format: claude, chatgpt, generic, cursor").option("-o, --output <file>","write to file (use {name} for profile name)").option("--json","output as json").action((n,e)=>$o(n,e));U.command("plan").description("show or manage your subscription").option("--upgrade","open checkout to upgrade").option("--manage","open billing portal").option("--json","output as json").action(n=>Oo(n));U.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(Le()))).default;console.log(`
|
|
226
|
+
${E()} ${f.dim("chatgpt setup")}
|
|
227
|
+
`),console.log(" opening chatgpt connector settings..."),console.log(` ${f.dim("add this server url:")} ${f.cyan("https://holdyourvoice.com/mcp")}`),console.log(` ${f.dim('authentication: select "OAuth" or "API Key"')}`),console.log(` ${f.dim("your CLI key will be used for auth")}
|
|
228
|
+
`),await e("https://chatgpt.com/#settings/Connectors");return}ko()});U.command("learn").description("manage learning signals").option("--sync","sync pending learning events to server").option("--consolidate","consolidate old learnings into summary").option("--stats","show learning statistics").option("--show","show consolidated learnings").option("--suggestions","show proactive suggestions").option("--dismiss <ruleId>","dismiss a suggestion").option("--json","output as json").action(async n=>{if(n.sync){console.log(`
|
|
229
|
+
${E()} ${f.dim("learn sync")}
|
|
230
|
+
`);let i=await so();console.log(` ${f.green("\u2713")} synced ${i.synced} events`),i.errors>0&&console.log(` ${f.yellow("\u26A0")} ${i.errors} errors`);return}if(n.consolidate){console.log(`
|
|
231
|
+
${E()} ${f.dim("learn consolidate")}
|
|
232
|
+
`),console.log(` ${f.dim("consolidating old learnings...")}`);let i=await to();console.log(` ${f.green("\u2713")} consolidated ${i.consolidated} events`);return}if(n.show){let i=io();i?(console.log(`
|
|
233
|
+
${E()} ${f.dim("consolidated learnings")}
|
|
234
|
+
`),console.log(i)):(console.log(`
|
|
235
|
+
${f.dim("no consolidated learnings yet")}`),console.log(` ${f.dim("run:")} hyv learn --consolidate`));return}if(n.dismiss){Qr(n.dismiss),console.log(` ${f.green("\u2713")} dismissed suggestion for ${f.bold(n.dismiss)}`);return}if(n.suggestions){let i=At();if(i.length===0){console.log(`
|
|
218
236
|
${f.dim("no suggestions yet \u2014 keep scanning!")}
|
|
219
237
|
`);return}console.log(`
|
|
220
|
-
${
|
|
221
|
-
`);for(let
|
|
222
|
-
${
|
|
223
|
-
`),console.log(` ${f.bold("Pending:")} ${e.total} events`);for(let[s
|
|
224
|
-
${f.yellow("\u{1F4A1}")} ${t.length} suggestions \u2014 run ${f.dim("hyv learn --suggestions")}`)});
|
|
238
|
+
${E()} ${f.dim("suggestions")}
|
|
239
|
+
`);for(let s of i)console.log(` ${f.yellow("\u2192")} ${s.suggestion}`),console.log(` ${f.dim("dismiss:")} hyv learn --dismiss ${s.ruleId}`);console.log("");return}let e=no();if(n.json){console.log(JSON.stringify(e,null,2));return}console.log(`
|
|
240
|
+
${E()} ${f.dim("learn stats")}
|
|
241
|
+
`),console.log(` ${f.bold("Pending:")} ${e.total} events`);for(let[i,s]of Object.entries(e.byType))console.log(` ${i}: ${s}`);e.lastSync&&console.log(` ${f.dim("Last sync:")} ${e.lastSync}`);let t=At();t.length>0&&console.log(`
|
|
242
|
+
${f.yellow("\u{1F4A1}")} ${t.length} suggestions \u2014 run ${f.dim("hyv learn --suggestions")}`)});U.parse();
|