@rajbos/ai-engineering-fluency 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/cli.js +20 -20
  2. package/package.json +4 -4
package/dist/cli.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- "use strict";var Cr=Object.create;var rs=Object.defineProperty;var wr=Object.getOwnPropertyDescriptor;var vr=Object.getOwnPropertyNames;var kr=Object.getPrototypeOf,Sr=Object.prototype.hasOwnProperty;var ce=(i,e)=>()=>(e||i((e={exports:{}}).exports,e),e.exports);var xr=(i,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of vr(e))!Sr.call(i,o)&&o!==t&&rs(i,o,{get:()=>e[o],enumerable:!(n=wr(e,o))||n.enumerable});return i};var ye=(i,e,t)=>(t=i!=null?Cr(kr(i)):{},xr(e||!i||!i.__esModule?rs(t,"default",{value:i,enumerable:!0}):t,i));var Et=ce(zo=>{var to=class extends Error{constructor(e,t,n){super(n),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=t,this.exitCode=e,this.nestedError=void 0}},Wo=class extends to{constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};zo.CommanderError=to;zo.InvalidArgumentError=Wo});var oo=ce(Ho=>{var{InvalidArgumentError:Pr}=Et(),Vo=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,n)=>{if(!this.argChoices.includes(t))throw new Pr(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(t,n):t},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function Tr(i){let e=i.name()+(i.variadic===!0?"...":"");return i.required?"<"+e+">":"["+e+"]"}Ho.Argument=Vo;Ho.humanReadableArgName=Tr});var Ko=ce(Jo=>{var{humanReadableArgName:Mr}=oo(),Bo=class{constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}prepareContext(e){this.helpWidth=this.helpWidth??e.helpWidth??80}visibleCommands(e){let t=e.commands.filter(o=>!o._hidden),n=e._getHelpCommand();return n&&!n._hidden&&t.push(n),this.sortSubcommands&&t.sort((o,r)=>o.name().localeCompare(r.name())),t}compareOptions(e,t){let n=o=>o.short?o.short.replace(/^-/,""):o.long.replace(/^--/,"");return n(e).localeCompare(n(t))}visibleOptions(e){let t=e.options.filter(o=>!o.hidden),n=e._getHelpOption();if(n&&!n.hidden){let o=n.short&&e._findOption(n.short),r=n.long&&e._findOption(n.long);!o&&!r?t.push(n):n.long&&!r?t.push(e.createOption(n.long,n.description)):n.short&&!o&&t.push(e.createOption(n.short,n.description))}return this.sortOptions&&t.sort(this.compareOptions),t}visibleGlobalOptions(e){if(!this.showGlobalOptions)return[];let t=[];for(let n=e.parent;n;n=n.parent){let o=n.options.filter(r=>!r.hidden);t.push(...o)}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(n=>Mr(n)).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((n,o)=>Math.max(n,this.displayWidth(t.styleSubcommandTerm(t.subcommandTerm(o)))),0)}longestOptionTermLength(e,t){return t.visibleOptions(e).reduce((n,o)=>Math.max(n,this.displayWidth(t.styleOptionTerm(t.optionTerm(o)))),0)}longestGlobalOptionTermLength(e,t){return t.visibleGlobalOptions(e).reduce((n,o)=>Math.max(n,this.displayWidth(t.styleOptionTerm(t.optionTerm(o)))),0)}longestArgumentTermLength(e,t){return t.visibleArguments(e).reduce((n,o)=>Math.max(n,this.displayWidth(t.styleArgumentTerm(t.argumentTerm(o)))),0)}commandUsage(e){let t=e._name;e._aliases[0]&&(t=t+"|"+e._aliases[0]);let n="";for(let o=e.parent;o;o=o.parent)n=o.name()+" "+n;return n+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(n=>JSON.stringify(n)).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(n=>JSON.stringify(n)).join(", ")}`),e.defaultValue!==void 0&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),t.length>0){let n=`(${t.join(", ")})`;return e.description?`${e.description} ${n}`:n}return e.description}formatHelp(e,t){let n=t.padWidth(e,t),o=t.helpWidth??80;function r(h,y){return t.formatItem(h,n,y,t)}let c=[`${t.styleTitle("Usage:")} ${t.styleUsage(t.commandUsage(e))}`,""],u=t.commandDescription(e);u.length>0&&(c=c.concat([t.boxWrap(t.styleCommandDescription(u),o),""]));let d=t.visibleArguments(e).map(h=>r(t.styleArgumentTerm(t.argumentTerm(h)),t.styleArgumentDescription(t.argumentDescription(h))));d.length>0&&(c=c.concat([t.styleTitle("Arguments:"),...d,""]));let f=t.visibleOptions(e).map(h=>r(t.styleOptionTerm(t.optionTerm(h)),t.styleOptionDescription(t.optionDescription(h))));if(f.length>0&&(c=c.concat([t.styleTitle("Options:"),...f,""])),t.showGlobalOptions){let h=t.visibleGlobalOptions(e).map(y=>r(t.styleOptionTerm(t.optionTerm(y)),t.styleOptionDescription(t.optionDescription(y))));h.length>0&&(c=c.concat([t.styleTitle("Global Options:"),...h,""]))}let m=t.visibleCommands(e).map(h=>r(t.styleSubcommandTerm(t.subcommandTerm(h)),t.styleSubcommandDescription(t.subcommandDescription(h))));return m.length>0&&(c=c.concat([t.styleTitle("Commands:"),...m,""])),c.join(`
2
+ "use strict";var Cr=Object.create;var rs=Object.defineProperty;var wr=Object.getOwnPropertyDescriptor;var vr=Object.getOwnPropertyNames;var kr=Object.getPrototypeOf,Sr=Object.prototype.hasOwnProperty;var ce=(i,e)=>()=>(e||i((e={exports:{}}).exports,e),e.exports);var xr=(i,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of vr(e))!Sr.call(i,o)&&o!==t&&rs(i,o,{get:()=>e[o],enumerable:!(n=wr(e,o))||n.enumerable});return i};var ye=(i,e,t)=>(t=i!=null?Cr(kr(i)):{},xr(e||!i||!i.__esModule?rs(t,"default",{value:i,enumerable:!0}):t,i));var Et=ce(zo=>{var to=class extends Error{constructor(e,t,n){super(n),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=t,this.exitCode=e,this.nestedError=void 0}},Wo=class extends to{constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};zo.CommanderError=to;zo.InvalidArgumentError=Wo});var oo=ce(Ho=>{var{InvalidArgumentError:Tr}=Et(),Vo=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,n)=>{if(!this.argChoices.includes(t))throw new Tr(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(t,n):t},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function Pr(i){let e=i.name()+(i.variadic===!0?"...":"");return i.required?"<"+e+">":"["+e+"]"}Ho.Argument=Vo;Ho.humanReadableArgName=Pr});var Ko=ce(Jo=>{var{humanReadableArgName:Mr}=oo(),Bo=class{constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}prepareContext(e){this.helpWidth=this.helpWidth??e.helpWidth??80}visibleCommands(e){let t=e.commands.filter(o=>!o._hidden),n=e._getHelpCommand();return n&&!n._hidden&&t.push(n),this.sortSubcommands&&t.sort((o,r)=>o.name().localeCompare(r.name())),t}compareOptions(e,t){let n=o=>o.short?o.short.replace(/^-/,""):o.long.replace(/^--/,"");return n(e).localeCompare(n(t))}visibleOptions(e){let t=e.options.filter(o=>!o.hidden),n=e._getHelpOption();if(n&&!n.hidden){let o=n.short&&e._findOption(n.short),r=n.long&&e._findOption(n.long);!o&&!r?t.push(n):n.long&&!r?t.push(e.createOption(n.long,n.description)):n.short&&!o&&t.push(e.createOption(n.short,n.description))}return this.sortOptions&&t.sort(this.compareOptions),t}visibleGlobalOptions(e){if(!this.showGlobalOptions)return[];let t=[];for(let n=e.parent;n;n=n.parent){let o=n.options.filter(r=>!r.hidden);t.push(...o)}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(n=>Mr(n)).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((n,o)=>Math.max(n,this.displayWidth(t.styleSubcommandTerm(t.subcommandTerm(o)))),0)}longestOptionTermLength(e,t){return t.visibleOptions(e).reduce((n,o)=>Math.max(n,this.displayWidth(t.styleOptionTerm(t.optionTerm(o)))),0)}longestGlobalOptionTermLength(e,t){return t.visibleGlobalOptions(e).reduce((n,o)=>Math.max(n,this.displayWidth(t.styleOptionTerm(t.optionTerm(o)))),0)}longestArgumentTermLength(e,t){return t.visibleArguments(e).reduce((n,o)=>Math.max(n,this.displayWidth(t.styleArgumentTerm(t.argumentTerm(o)))),0)}commandUsage(e){let t=e._name;e._aliases[0]&&(t=t+"|"+e._aliases[0]);let n="";for(let o=e.parent;o;o=o.parent)n=o.name()+" "+n;return n+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(n=>JSON.stringify(n)).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(n=>JSON.stringify(n)).join(", ")}`),e.defaultValue!==void 0&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),t.length>0){let n=`(${t.join(", ")})`;return e.description?`${e.description} ${n}`:n}return e.description}formatHelp(e,t){let n=t.padWidth(e,t),o=t.helpWidth??80;function r(h,y){return t.formatItem(h,n,y,t)}let c=[`${t.styleTitle("Usage:")} ${t.styleUsage(t.commandUsage(e))}`,""],u=t.commandDescription(e);u.length>0&&(c=c.concat([t.boxWrap(t.styleCommandDescription(u),o),""]));let d=t.visibleArguments(e).map(h=>r(t.styleArgumentTerm(t.argumentTerm(h)),t.styleArgumentDescription(t.argumentDescription(h))));d.length>0&&(c=c.concat([t.styleTitle("Arguments:"),...d,""]));let f=t.visibleOptions(e).map(h=>r(t.styleOptionTerm(t.optionTerm(h)),t.styleOptionDescription(t.optionDescription(h))));if(f.length>0&&(c=c.concat([t.styleTitle("Options:"),...f,""])),t.showGlobalOptions){let h=t.visibleGlobalOptions(e).map(y=>r(t.styleOptionTerm(t.optionTerm(y)),t.styleOptionDescription(t.optionDescription(y))));h.length>0&&(c=c.concat([t.styleTitle("Global Options:"),...h,""]))}let m=t.visibleCommands(e).map(h=>r(t.styleSubcommandTerm(t.subcommandTerm(h)),t.styleSubcommandDescription(t.subcommandDescription(h))));return m.length>0&&(c=c.concat([t.styleTitle("Commands:"),...m,""])),c.join(`
3
3
  `)}displayWidth(e){return as(e).length}styleTitle(e){return e}styleUsage(e){return e.split(" ").map(t=>t==="[options]"?this.styleOptionText(t):t==="[command]"?this.styleSubcommandText(t):t[0]==="["||t[0]==="<"?this.styleArgumentText(t):this.styleCommandText(t)).join(" ")}styleCommandDescription(e){return this.styleDescriptionText(e)}styleOptionDescription(e){return this.styleDescriptionText(e)}styleSubcommandDescription(e){return this.styleDescriptionText(e)}styleArgumentDescription(e){return this.styleDescriptionText(e)}styleDescriptionText(e){return e}styleOptionTerm(e){return this.styleOptionText(e)}styleSubcommandTerm(e){return e.split(" ").map(t=>t==="[options]"?this.styleOptionText(t):t[0]==="["||t[0]==="<"?this.styleArgumentText(t):this.styleSubcommandText(t)).join(" ")}styleArgumentTerm(e){return this.styleArgumentText(e)}styleOptionText(e){return e}styleArgumentText(e){return e}styleSubcommandText(e){return e}styleCommandText(e){return e}padWidth(e,t){return Math.max(t.longestOptionTermLength(e,t),t.longestGlobalOptionTermLength(e,t),t.longestSubcommandTermLength(e,t),t.longestArgumentTermLength(e,t))}preformatted(e){return/\n[^\S\r\n]/.test(e)}formatItem(e,t,n,o){let c=" ".repeat(2);if(!n)return c+e;let u=e.padEnd(t+e.length-o.displayWidth(e)),d=2,m=(this.helpWidth??80)-t-d-2,h;return m<this.minWidthToWrap||o.preformatted(n)?h=n:h=o.boxWrap(n,m).replace(/\n/g,`
4
4
  `+" ".repeat(t+d)),c+u+" ".repeat(d)+h.replace(/\n/g,`
5
5
  ${c}`)}boxWrap(e,t){if(t<this.minWidthToWrap)return e;let n=e.split(/\r\n|\n/),o=/[\s]*[^\s]+/g,r=[];return n.forEach(c=>{let u=c.match(o);if(u===null){r.push("");return}let d=[u.shift()],f=this.displayWidth(d[0]);u.forEach(m=>{let h=this.displayWidth(m);if(f+h<=t){d.push(m),f+=h;return}r.push(d.join(""));let y=m.trimStart();d=[y],f=this.displayWidth(y)}),r.push(d.join(""))}),r.join(`
@@ -11,8 +11,8 @@ ${c}`)}boxWrap(e,t){if(t<this.minWidthToWrap)return e;let n=e.split(/\r\n|\n/),o
11
11
  - too many long flags`):new Error(`${u}
12
12
  - unrecognised flag format`)}if(e===void 0&&t===void 0)throw new Error(`option creation failed due to no flags found in '${i}'.`);return{shortFlag:e,longFlag:t}}Xo.Option=Yo;Xo.DualOptions=Qo});var us=ce(cs=>{function Er(i,e){if(Math.abs(i.length-e.length)>3)return Math.max(i.length,e.length);let t=[];for(let n=0;n<=i.length;n++)t[n]=[n];for(let n=0;n<=e.length;n++)t[0][n]=n;for(let n=1;n<=e.length;n++)for(let o=1;o<=i.length;o++){let r=1;i[o-1]===e[n-1]?r=0:r=1,t[o][n]=Math.min(t[o-1][n]+1,t[o][n-1]+1,t[o-1][n-1]+r),o>1&&n>1&&i[o-1]===e[n-2]&&i[o-2]===e[n-1]&&(t[o][n]=Math.min(t[o][n],t[o-2][n-2]+1))}return t[i.length][e.length]}function Rr(i,e){if(!e||e.length===0)return"";e=Array.from(new Set(e));let t=i.startsWith("--");t&&(i=i.slice(2),e=e.map(c=>c.slice(2)));let n=[],o=3,r=.4;return e.forEach(c=>{if(c.length<=1)return;let u=Er(i,c),d=Math.max(i.length,c.length);(d-u)/d>r&&(u<o?(o=u,n=[c]):u===o&&n.push(c))}),n.sort((c,u)=>c.localeCompare(u)),t&&(n=n.map(c=>`--${c}`)),n.length>1?`
13
13
  (Did you mean one of ${n.join(", ")}?)`:n.length===1?`
14
- (Did you mean ${n[0]}?)`:""}cs.suggestSimilar=Rr});var hs=ce(sn=>{var Dr=require("node:events").EventEmitter,en=require("node:child_process"),Ve=require("node:path"),no=require("node:fs"),H=require("node:process"),{Argument:$r,humanReadableArgName:Fr}=oo(),{CommanderError:tn}=Et(),{Help:Ur,stripColor:Ir}=Ko(),{Option:ds,DualOptions:Nr}=Zo(),{suggestSimilar:ps}=us(),on=class i extends Dr{constructor(e){super(),this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=!1,this._allowExcessArguments=!1,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._savedState=null,this._outputConfiguration={writeOut:t=>H.stdout.write(t),writeErr:t=>H.stderr.write(t),outputError:(t,n)=>n(t),getOutHelpWidth:()=>H.stdout.isTTY?H.stdout.columns:void 0,getErrHelpWidth:()=>H.stderr.isTTY?H.stderr.columns:void 0,getOutHasColors:()=>nn()??(H.stdout.isTTY&&H.stdout.hasColors?.()),getErrHasColors:()=>nn()??(H.stderr.isTTY&&H.stderr.hasColors?.()),stripColor:t=>Ir(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,n){let o=t,r=n;typeof o=="object"&&o!==null&&(r=o,o=null),r=r||{};let[,c,u]=e.match(/([^ ]+) *(.*)/),d=this.createCommand(c);return o&&(d.description(o),d._executableHandler=!0),r.isDefault&&(this._defaultCommandName=d._name),d._hidden=!!(r.noHelp||r.hidden),d._executableFile=r.executableFile||null,u&&d.arguments(u),this._registerCommand(d),d.parent=this,d.copyInheritedSettings(this),o?this:d}createCommand(e){return new i(e)}createHelp(){return Object.assign(new Ur,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
15
- - 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 $r(e,t)}argument(e,t,n,o){let r=this.createArgument(e,t);return typeof n=="function"?r.default(o).argParser(n):r.default(n),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[,n,o]=e.match(/([^ ]+) *(.*)/),r=t??"display help for command",c=this.createCommand(n);return c.helpOption(!1),o&&c.arguments(o),r&&c.description(r),this._addImplicitHelpCommand=!0,this._helpCommand=c,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 n=["preSubcommand","preAction","postAction"];if(!n.includes(e))throw new Error(`Unexpected value for event passed to hook : '${e}'.
14
+ (Did you mean ${n[0]}?)`:""}cs.suggestSimilar=Rr});var hs=ce(sn=>{var $r=require("node:events").EventEmitter,en=require("node:child_process"),Ve=require("node:path"),no=require("node:fs"),H=require("node:process"),{Argument:Dr,humanReadableArgName:Fr}=oo(),{CommanderError:tn}=Et(),{Help:Ur,stripColor:Ir}=Ko(),{Option:ds,DualOptions:Nr}=Zo(),{suggestSimilar:ps}=us(),on=class i extends $r{constructor(e){super(),this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=!1,this._allowExcessArguments=!1,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._savedState=null,this._outputConfiguration={writeOut:t=>H.stdout.write(t),writeErr:t=>H.stderr.write(t),outputError:(t,n)=>n(t),getOutHelpWidth:()=>H.stdout.isTTY?H.stdout.columns:void 0,getErrHelpWidth:()=>H.stderr.isTTY?H.stderr.columns:void 0,getOutHasColors:()=>nn()??(H.stdout.isTTY&&H.stdout.hasColors?.()),getErrHasColors:()=>nn()??(H.stderr.isTTY&&H.stderr.hasColors?.()),stripColor:t=>Ir(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,n){let o=t,r=n;typeof o=="object"&&o!==null&&(r=o,o=null),r=r||{};let[,c,u]=e.match(/([^ ]+) *(.*)/),d=this.createCommand(c);return o&&(d.description(o),d._executableHandler=!0),r.isDefault&&(this._defaultCommandName=d._name),d._hidden=!!(r.noHelp||r.hidden),d._executableFile=r.executableFile||null,u&&d.arguments(u),this._registerCommand(d),d.parent=this,d.copyInheritedSettings(this),o?this:d}createCommand(e){return new i(e)}createHelp(){return Object.assign(new Ur,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
15
+ - 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 Dr(e,t)}argument(e,t,n,o){let r=this.createArgument(e,t);return typeof n=="function"?r.default(o).argParser(n):r.default(n),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[,n,o]=e.match(/([^ ]+) *(.*)/),r=t??"display help for command",c=this.createCommand(n);return c.helpOption(!1),o&&c.arguments(o),r&&c.description(r),this._addImplicitHelpCommand=!0,this._helpCommand=c,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 n=["preSubcommand","preAction","postAction"];if(!n.includes(e))throw new Error(`Unexpected value for event passed to hook : '${e}'.
16
16
  Expecting one of '${n.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,n){this._exitCallback&&this._exitCallback(new tn(e,t,n)),H.exit(e)}action(e){let t=n=>{let o=this.registeredArguments.length,r=n.slice(0,o);return this._storeOptionsAsProperties?r[o]=this:r[o]=this.opts(),r.push(this),e.apply(this,r)};return this._actionHandler=t,this}createOption(e,t){return new ds(e,t)}_callParseArg(e,t,n,o){try{return e.parseArg(t,n)}catch(r){if(r.code==="commander.invalidArgument"){let c=`${o} ${r.message}`;this.error(c,{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 n=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 '${n}'
17
17
  - already used by option '${t.flags}'`)}this.options.push(e)}_registerCommand(e){let t=o=>[o.name()].concat(o.aliases()),n=t(e).find(o=>this._findCommand(o));if(n){let o=t(this._findCommand(n)).join("|"),r=t(e).join("|");throw new Error(`cannot add command '${r}' as already have command '${o}'`)}this.commands.push(e)}addOption(e){this._registerOption(e);let t=e.name(),n=e.attributeName();if(e.negate){let r=e.long.replace(/^--no-/,"--");this._findOption(r)||this.setOptionValueWithSource(n,e.defaultValue===void 0?!0:e.defaultValue,"default")}else e.defaultValue!==void 0&&this.setOptionValueWithSource(n,e.defaultValue,"default");let o=(r,c,u)=>{r==null&&e.presetArg!==void 0&&(r=e.presetArg);let d=this.getOptionValue(n);r!==null&&e.parseArg?r=this._callParseArg(e,r,d,c):r!==null&&e.variadic&&(r=e._concatValue(r,d)),r==null&&(e.negate?r=!1:e.isBoolean()||e.optional?r=!0:r=""),this.setOptionValueWithSource(n,r,u)};return this.on("option:"+t,r=>{let c=`error: option '${e.flags}' argument '${r}' is invalid.`;o(r,c,"cli")}),e.envVar&&this.on("optionEnv:"+t,r=>{let c=`error: option '${e.flags}' value '${r}' from env '${e.envVar}' is invalid.`;o(r,c,"env")}),this}_optionEx(e,t,n,o,r){if(typeof t=="object"&&t instanceof ds)throw new Error("To add an Option object use addOption() instead of option() or requiredOption()");let c=this.createOption(t,n);if(c.makeOptionMandatory(!!e.mandatory),typeof o=="function")c.default(r).argParser(o);else if(o instanceof RegExp){let u=o;o=(d,f)=>{let m=u.exec(d);return m?m[0]:f},c.default(r).argParser(o)}else c.default(o);return this.addOption(c)}option(e,t,n,o){return this._optionEx({},e,t,n,o)}requiredOption(e,t,n,o){return this._optionEx({mandatory:!0},e,t,n,o)}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,n){return this._storeOptionsAsProperties?this[e]=t:this._optionValues[e]=t,this._optionValueSources[e]=n,this}getOptionValueSource(e){return this._optionValueSources[e]}getOptionValueSourceWithGlobals(e){let t;return this._getCommandAndAncestors().forEach(n=>{n.getOptionValueSource(e)!==void 0&&(t=n.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){H.versions?.electron&&(t.from="electron");let o=H.execArgv??[];(o.includes("-e")||o.includes("--eval")||o.includes("-p")||o.includes("--print"))&&(t.from="eval")}e===void 0&&(e=H.argv),this.rawArgs=e.slice();let n;switch(t.from){case void 0:case"node":this._scriptPath=e[1],n=e.slice(2);break;case"electron":H.defaultApp?(this._scriptPath=e[1],n=e.slice(2)):n=e.slice(1);break;case"user":n=e.slice(0);break;case"eval":n=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",n}parse(e,t){this._prepareForParse();let n=this._prepareUserArgs(e,t);return this._parseCommand([],n),this}async parseAsync(e,t){this._prepareForParse();let n=this._prepareUserArgs(e,t);return await this._parseCommand([],n),this}_prepareForParse(){this._savedState===null?this.saveStateBeforeParse():this.restoreStateBeforeParse()}saveStateBeforeParse(){this._savedState={_name:this._name,_optionValues:{...this._optionValues},_optionValueSources:{...this._optionValueSources}}}restoreStateBeforeParse(){if(this._storeOptionsAsProperties)throw new Error(`Can not call parse again when storeOptionsAsProperties is true.
18
18
  - either make a new Command for each call to parse, or stop storing options as properties`);this._name=this._savedState._name,this._scriptPath=null,this.rawArgs=[],this._optionValues={...this._savedState._optionValues},this._optionValueSources={...this._savedState._optionValueSources},this.args=[],this.processedArgs=[]}_checkForMissingExecutable(e,t,n){if(no.existsSync(e))return;let o=t?`searched for local subcommand relative to directory '${t}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",r=`'${e}' does not exist
@@ -24,37 +24,37 @@ Expecting one of '${n.join("', '")}'`);return this._lifeCycleHooks[e]?this._life
24
24
  `),this.outputHelp({error:!0}));let n=t||{},o=n.exitCode||1,r=n.code||"commander.error";this._exit(o,r,e)}_parseOptionsEnv(){this.options.forEach(e=>{if(e.envVar&&e.envVar in H.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()}`,H.env[e.envVar]):this.emit(`optionEnv:${e.name()}`))}})}_parseOptionsImplied(){let e=new Nr(this.options),t=n=>this.getOptionValue(n)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(n));this.options.filter(n=>n.implied!==void 0&&t(n.attributeName())&&e.valueFromOption(this.getOptionValue(n.attributeName()),n)).forEach(n=>{Object.keys(n.implied).filter(o=>!t(o)).forEach(o=>{this.setOptionValueWithSource(o,n.implied[o],"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 n=c=>{let u=c.attributeName(),d=this.getOptionValue(u),f=this.options.find(h=>h.negate&&u===h.attributeName()),m=this.options.find(h=>!h.negate&&u===h.attributeName());return f&&(f.presetArg===void 0&&d===!1||f.presetArg!==void 0&&d===f.presetArg)?f:m||c},o=c=>{let u=n(c),d=u.attributeName();return this.getOptionValueSource(d)==="env"?`environment variable '${u.envVar}'`:`option '${u.flags}'`},r=`error: ${o(e)} cannot be used with ${o(t)}`;this.error(r,{code:"commander.conflictingOption"})}unknownOption(e){if(this._allowUnknownOption)return;let t="";if(e.startsWith("--")&&this._showSuggestionAfterError){let o=[],r=this;do{let c=r.createHelp().visibleOptions(r).filter(u=>u.long).map(u=>u.long);o=o.concat(c),r=r.parent}while(r&&!r._enablePositionalOptions);t=ps(e,o)}let n=`error: unknown option '${e}'${t}`;this.error(n,{code:"commander.unknownOption"})}_excessArguments(e){if(this._allowExcessArguments)return;let t=this.registeredArguments.length,n=t===1?"":"s",r=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${t} argument${n} but got ${e.length}.`;this.error(r,{code:"commander.excessArguments"})}unknownCommand(){let e=this.args[0],t="";if(this._showSuggestionAfterError){let o=[];this.createHelp().visibleCommands(this).forEach(r=>{o.push(r.name()),r.alias()&&o.push(r.alias())}),t=ps(e,o)}let n=`error: unknown command '${e}'${t}`;this.error(n,{code:"commander.unknownCommand"})}version(e,t,n){if(e===void 0)return this._version;this._version=e,t=t||"-V, --version",n=n||"output the version number";let o=this.createOption(t,n);return this._versionOptionName=o.attributeName(),this._registerOption(o),this.on("option:"+o.name(),()=>{this._outputConfiguration.writeOut(`${e}
25
25
  `),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 n=this.parent?._findCommand(e);if(n){let o=[n.name()].concat(n.aliases()).join("|");throw new Error(`cannot add alias '${e}' to command '${this.name()}' as already have command '${o}'`)}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(n=>Fr(n));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=Ve.basename(e,Ve.extname(e)),this}executableDir(e){return e===void 0?this._executableDir:(this._executableDir=e,this)}helpInformation(e){let t=this.createHelp(),n=this._getOutputContext(e);t.prepareContext({error:n.error,helpWidth:n.helpWidth,outputHasColors:n.hasColors});let o=t.formatHelp(this,t);return n.hasColors?o:this._outputConfiguration.stripColor(o)}_getOutputContext(e){e=e||{};let t=!!e.error,n,o,r;return t?(n=u=>this._outputConfiguration.writeErr(u),o=this._outputConfiguration.getErrHasColors(),r=this._outputConfiguration.getErrHelpWidth()):(n=u=>this._outputConfiguration.writeOut(u),o=this._outputConfiguration.getOutHasColors(),r=this._outputConfiguration.getOutHelpWidth()),{error:t,write:u=>(o||(u=this._outputConfiguration.stripColor(u)),n(u)),hasColors:o,helpWidth:r}}outputHelp(e){let t;typeof e=="function"&&(t=e,e=void 0);let n=this._getOutputContext(e),o={error:n.error,write:n.write,command:this};this._getCommandAndAncestors().reverse().forEach(c=>c.emit("beforeAllHelp",o)),this.emit("beforeHelp",o);let r=this.helpInformation({error:n.error});if(t&&(r=t(r),typeof r!="string"&&!Buffer.isBuffer(r)))throw new Error("outputHelp callback must return a string or a Buffer");n.write(r),this._getHelpOption()?.long&&this.emit(this._getHelpOption().long),this.emit("afterHelp",o),this._getCommandAndAncestors().forEach(c=>c.emit("afterAllHelp",o))}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=Number(H.exitCode??0);t===0&&e&&typeof e!="function"&&e.error&&(t=1),this._exit(t,"commander.help","(outputHelp)")}addHelpText(e,t){let n=["beforeAll","before","after","afterAll"];if(!n.includes(e))throw new Error(`Unexpected value for position to addHelpText.
26
26
  Expecting one of '${n.join("', '")}'`);let o=`${e}Help`;return this.on(o,r=>{let c;typeof t=="function"?c=t({error:r.error,command:r.command}):c=t,c&&r.write(`${c}
27
- `)}),this}_outputHelpIfRequested(e){let t=this._getHelpOption();t&&e.find(o=>t.is(o))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}};function ms(i){return i.map(e=>{if(!e.startsWith("--inspect"))return e;let t,n="127.0.0.1",o="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])?o=r[3]:n=r[3]):(r=e.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(t=r[1],n=r[3],o=r[4]),t&&o!=="0"?`${t}=${n}:${parseInt(o)+1}`:e})}function nn(){if(H.env.NO_COLOR||H.env.FORCE_COLOR==="0"||H.env.FORCE_COLOR==="false")return!1;if(H.env.FORCE_COLOR||H.env.CLICOLOR_FORCE!==void 0)return!0}sn.Command=on;sn.useColor=nn});var bs=ce(Oe=>{var{Argument:fs}=oo(),{Command:rn}=hs(),{CommanderError:qr,InvalidArgumentError:gs}=Et(),{Help:jr}=Ko(),{Option:ys}=Zo();Oe.program=new rn;Oe.createCommand=i=>new rn(i);Oe.createOption=(i,e)=>new ys(i,e);Oe.createArgument=(i,e)=>new fs(i,e);Oe.Command=rn;Oe.Option=ys;Oe.Argument=fs;Oe.Help=jr;Oe.CommanderError=qr;Oe.InvalidArgumentError=gs;Oe.InvalidOptionArgumentError=gs});var ws=ce((Qa,Cs)=>{"use strict";Cs.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 an=ce((Xa,ks)=>{var Rt=ws(),vs={};for(let i of Object.keys(Rt))vs[Rt[i]]=i;var O={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"]}};ks.exports=O;for(let i of Object.keys(O)){if(!("channels"in O[i]))throw new Error("missing channels property: "+i);if(!("labels"in O[i]))throw new Error("missing channel labels property: "+i);if(O[i].labels.length!==O[i].channels)throw new Error("channel and label counts mismatch: "+i);let{channels:e,labels:t}=O[i];delete O[i].channels,delete O[i].labels,Object.defineProperty(O[i],"channels",{value:e}),Object.defineProperty(O[i],"labels",{value:t})}O.rgb.hsl=function(i){let e=i[0]/255,t=i[1]/255,n=i[2]/255,o=Math.min(e,t,n),r=Math.max(e,t,n),c=r-o,u,d;r===o?u=0:e===r?u=(t-n)/c:t===r?u=2+(n-e)/c:n===r&&(u=4+(e-t)/c),u=Math.min(u*60,360),u<0&&(u+=360);let f=(o+r)/2;return r===o?d=0:f<=.5?d=c/(r+o):d=c/(2-r-o),[u,d*100,f*100]};O.rgb.hsv=function(i){let e,t,n,o,r,c=i[0]/255,u=i[1]/255,d=i[2]/255,f=Math.max(c,u,d),m=f-Math.min(c,u,d),h=function(y){return(f-y)/6/m+1/2};return m===0?(o=0,r=0):(r=m/f,e=h(c),t=h(u),n=h(d),c===f?o=n-t:u===f?o=1/3+e-n:d===f&&(o=2/3+t-e),o<0?o+=1:o>1&&(o-=1)),[o*360,r*100,f*100]};O.rgb.hwb=function(i){let e=i[0],t=i[1],n=i[2],o=O.rgb.hsl(i)[0],r=1/255*Math.min(e,Math.min(t,n));return n=1-1/255*Math.max(e,Math.max(t,n)),[o,r*100,n*100]};O.rgb.cmyk=function(i){let e=i[0]/255,t=i[1]/255,n=i[2]/255,o=Math.min(1-e,1-t,1-n),r=(1-e-o)/(1-o)||0,c=(1-t-o)/(1-o)||0,u=(1-n-o)/(1-o)||0;return[r*100,c*100,u*100,o*100]};function Lr(i,e){return(i[0]-e[0])**2+(i[1]-e[1])**2+(i[2]-e[2])**2}O.rgb.keyword=function(i){let e=vs[i];if(e)return e;let t=1/0,n;for(let o of Object.keys(Rt)){let r=Rt[o],c=Lr(i,r);c<t&&(t=c,n=o)}return n};O.keyword.rgb=function(i){return Rt[i]};O.rgb.xyz=function(i){let e=i[0]/255,t=i[1]/255,n=i[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,n=n>.04045?((n+.055)/1.055)**2.4:n/12.92;let o=e*.4124+t*.3576+n*.1805,r=e*.2126+t*.7152+n*.0722,c=e*.0193+t*.1192+n*.9505;return[o*100,r*100,c*100]};O.rgb.lab=function(i){let e=O.rgb.xyz(i),t=e[0],n=e[1],o=e[2];t/=95.047,n/=100,o/=108.883,t=t>.008856?t**(1/3):7.787*t+16/116,n=n>.008856?n**(1/3):7.787*n+16/116,o=o>.008856?o**(1/3):7.787*o+16/116;let r=116*n-16,c=500*(t-n),u=200*(n-o);return[r,c,u]};O.hsl.rgb=function(i){let e=i[0]/360,t=i[1]/100,n=i[2]/100,o,r,c;if(t===0)return c=n*255,[c,c,c];n<.5?o=n*(1+t):o=n+t-n*t;let u=2*n-o,d=[0,0,0];for(let f=0;f<3;f++)r=e+1/3*-(f-1),r<0&&r++,r>1&&r--,6*r<1?c=u+(o-u)*6*r:2*r<1?c=o:3*r<2?c=u+(o-u)*(2/3-r)*6:c=u,d[f]=c*255;return d};O.hsl.hsv=function(i){let e=i[0],t=i[1]/100,n=i[2]/100,o=t,r=Math.max(n,.01);n*=2,t*=n<=1?n:2-n,o*=r<=1?r:2-r;let c=(n+t)/2,u=n===0?2*o/(r+o):2*t/(n+t);return[e,u*100,c*100]};O.hsv.rgb=function(i){let e=i[0]/60,t=i[1]/100,n=i[2]/100,o=Math.floor(e)%6,r=e-Math.floor(e),c=255*n*(1-t),u=255*n*(1-t*r),d=255*n*(1-t*(1-r));switch(n*=255,o){case 0:return[n,d,c];case 1:return[u,n,c];case 2:return[c,n,d];case 3:return[c,u,n];case 4:return[d,c,n];case 5:return[n,c,u]}};O.hsv.hsl=function(i){let e=i[0],t=i[1]/100,n=i[2]/100,o=Math.max(n,.01),r,c;c=(2-t)*n;let u=(2-t)*o;return r=t*o,r/=u<=1?u:2-u,r=r||0,c/=2,[e,r*100,c*100]};O.hwb.rgb=function(i){let e=i[0]/360,t=i[1]/100,n=i[2]/100,o=t+n,r;o>1&&(t/=o,n/=o);let c=Math.floor(6*e),u=1-n;r=6*e-c,(c&1)!==0&&(r=1-r);let d=t+r*(u-t),f,m,h;switch(c){default:case 6:case 0:f=u,m=d,h=t;break;case 1:f=d,m=u,h=t;break;case 2:f=t,m=u,h=d;break;case 3:f=t,m=d,h=u;break;case 4:f=d,m=t,h=u;break;case 5:f=u,m=t,h=d;break}return[f*255,m*255,h*255]};O.cmyk.rgb=function(i){let e=i[0]/100,t=i[1]/100,n=i[2]/100,o=i[3]/100,r=1-Math.min(1,e*(1-o)+o),c=1-Math.min(1,t*(1-o)+o),u=1-Math.min(1,n*(1-o)+o);return[r*255,c*255,u*255]};O.xyz.rgb=function(i){let e=i[0]/100,t=i[1]/100,n=i[2]/100,o,r,c;return o=e*3.2406+t*-1.5372+n*-.4986,r=e*-.9689+t*1.8758+n*.0415,c=e*.0557+t*-.204+n*1.057,o=o>.0031308?1.055*o**(1/2.4)-.055:o*12.92,r=r>.0031308?1.055*r**(1/2.4)-.055:r*12.92,c=c>.0031308?1.055*c**(1/2.4)-.055:c*12.92,o=Math.min(Math.max(0,o),1),r=Math.min(Math.max(0,r),1),c=Math.min(Math.max(0,c),1),[o*255,r*255,c*255]};O.xyz.lab=function(i){let e=i[0],t=i[1],n=i[2];e/=95.047,t/=100,n/=108.883,e=e>.008856?e**(1/3):7.787*e+16/116,t=t>.008856?t**(1/3):7.787*t+16/116,n=n>.008856?n**(1/3):7.787*n+16/116;let o=116*t-16,r=500*(e-t),c=200*(t-n);return[o,r,c]};O.lab.xyz=function(i){let e=i[0],t=i[1],n=i[2],o,r,c;r=(e+16)/116,o=t/500+r,c=r-n/200;let u=r**3,d=o**3,f=c**3;return r=u>.008856?u:(r-16/116)/7.787,o=d>.008856?d:(o-16/116)/7.787,c=f>.008856?f:(c-16/116)/7.787,o*=95.047,r*=100,c*=108.883,[o,r,c]};O.lab.lch=function(i){let e=i[0],t=i[1],n=i[2],o;o=Math.atan2(n,t)*360/2/Math.PI,o<0&&(o+=360);let c=Math.sqrt(t*t+n*n);return[e,c,o]};O.lch.lab=function(i){let e=i[0],t=i[1],o=i[2]/360*2*Math.PI,r=t*Math.cos(o),c=t*Math.sin(o);return[e,r,c]};O.rgb.ansi16=function(i,e=null){let[t,n,o]=i,r=e===null?O.rgb.hsv(i)[2]:e;if(r=Math.round(r/50),r===0)return 30;let c=30+(Math.round(o/255)<<2|Math.round(n/255)<<1|Math.round(t/255));return r===2&&(c+=60),c};O.hsv.ansi16=function(i){return O.rgb.ansi16(O.hsv.rgb(i),i[2])};O.rgb.ansi256=function(i){let e=i[0],t=i[1],n=i[2];return e===t&&t===n?e<8?16:e>248?231:Math.round((e-8)/247*24)+232:16+36*Math.round(e/255*5)+6*Math.round(t/255*5)+Math.round(n/255*5)};O.ansi16.rgb=function(i){let e=i%10;if(e===0||e===7)return i>50&&(e+=3.5),e=e/10.5*255,[e,e,e];let t=(~~(i>50)+1)*.5,n=(e&1)*t*255,o=(e>>1&1)*t*255,r=(e>>2&1)*t*255;return[n,o,r]};O.ansi256.rgb=function(i){if(i>=232){let r=(i-232)*10+8;return[r,r,r]}i-=16;let e,t=Math.floor(i/36)/5*255,n=Math.floor((e=i%36)/6)/5*255,o=e%6/5*255;return[t,n,o]};O.rgb.hex=function(i){let t=(((Math.round(i[0])&255)<<16)+((Math.round(i[1])&255)<<8)+(Math.round(i[2])&255)).toString(16).toUpperCase();return"000000".substring(t.length)+t};O.hex.rgb=function(i){let e=i.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(u=>u+u).join(""));let n=parseInt(t,16),o=n>>16&255,r=n>>8&255,c=n&255;return[o,r,c]};O.rgb.hcg=function(i){let e=i[0]/255,t=i[1]/255,n=i[2]/255,o=Math.max(Math.max(e,t),n),r=Math.min(Math.min(e,t),n),c=o-r,u,d;return c<1?u=r/(1-c):u=0,c<=0?d=0:o===e?d=(t-n)/c%6:o===t?d=2+(n-e)/c:d=4+(e-t)/c,d/=6,d%=1,[d*360,c*100,u*100]};O.hsl.hcg=function(i){let e=i[1]/100,t=i[2]/100,n=t<.5?2*e*t:2*e*(1-t),o=0;return n<1&&(o=(t-.5*n)/(1-n)),[i[0],n*100,o*100]};O.hsv.hcg=function(i){let e=i[1]/100,t=i[2]/100,n=e*t,o=0;return n<1&&(o=(t-n)/(1-n)),[i[0],n*100,o*100]};O.hcg.rgb=function(i){let e=i[0]/360,t=i[1]/100,n=i[2]/100;if(t===0)return[n*255,n*255,n*255];let o=[0,0,0],r=e%1*6,c=r%1,u=1-c,d=0;switch(Math.floor(r)){case 0:o[0]=1,o[1]=c,o[2]=0;break;case 1:o[0]=u,o[1]=1,o[2]=0;break;case 2:o[0]=0,o[1]=1,o[2]=c;break;case 3:o[0]=0,o[1]=u,o[2]=1;break;case 4:o[0]=c,o[1]=0,o[2]=1;break;default:o[0]=1,o[1]=0,o[2]=u}return d=(1-t)*n,[(t*o[0]+d)*255,(t*o[1]+d)*255,(t*o[2]+d)*255]};O.hcg.hsv=function(i){let e=i[1]/100,t=i[2]/100,n=e+t*(1-e),o=0;return n>0&&(o=e/n),[i[0],o*100,n*100]};O.hcg.hsl=function(i){let e=i[1]/100,n=i[2]/100*(1-e)+.5*e,o=0;return n>0&&n<.5?o=e/(2*n):n>=.5&&n<1&&(o=e/(2*(1-n))),[i[0],o*100,n*100]};O.hcg.hwb=function(i){let e=i[1]/100,t=i[2]/100,n=e+t*(1-e);return[i[0],(n-e)*100,(1-n)*100]};O.hwb.hcg=function(i){let e=i[1]/100,n=1-i[2]/100,o=n-e,r=0;return o<1&&(r=(n-o)/(1-o)),[i[0],o*100,r*100]};O.apple.rgb=function(i){return[i[0]/65535*255,i[1]/65535*255,i[2]/65535*255]};O.rgb.apple=function(i){return[i[0]/255*65535,i[1]/255*65535,i[2]/255*65535]};O.gray.rgb=function(i){return[i[0]/100*255,i[0]/100*255,i[0]/100*255]};O.gray.hsl=function(i){return[0,0,i[0]]};O.gray.hsv=O.gray.hsl;O.gray.hwb=function(i){return[0,100,i[0]]};O.gray.cmyk=function(i){return[0,0,0,i[0]]};O.gray.lab=function(i){return[i[0],0,0]};O.gray.hex=function(i){let e=Math.round(i[0]/100*255)&255,n=((e<<16)+(e<<8)+e).toString(16).toUpperCase();return"000000".substring(n.length)+n};O.rgb.gray=function(i){return[(i[0]+i[1]+i[2])/3/255*100]}});var xs=ce((Za,Ss)=>{var so=an();function Gr(){let i={},e=Object.keys(so);for(let t=e.length,n=0;n<t;n++)i[e[n]]={distance:-1,parent:null};return i}function Wr(i){let e=Gr(),t=[i];for(e[i].distance=0;t.length;){let n=t.pop(),o=Object.keys(so[n]);for(let r=o.length,c=0;c<r;c++){let u=o[c],d=e[u];d.distance===-1&&(d.distance=e[n].distance+1,d.parent=n,t.unshift(u))}}return e}function zr(i,e){return function(t){return e(i(t))}}function Vr(i,e){let t=[e[i].parent,i],n=so[e[i].parent][i],o=e[i].parent;for(;e[o].parent;)t.unshift(e[o].parent),n=zr(so[e[o].parent][o],n),o=e[o].parent;return n.conversion=t,n}Ss.exports=function(i){let e=Wr(i),t={},n=Object.keys(e);for(let o=n.length,r=0;r<o;r++){let c=n[r];e[c].parent!==null&&(t[c]=Vr(c,e))}return t}});var Ts=ce((el,Ps)=>{var ln=an(),Hr=xs(),Ct={},Br=Object.keys(ln);function Jr(i){let e=function(...t){let n=t[0];return n==null?n:(n.length>1&&(t=n),i(t))};return"conversion"in i&&(e.conversion=i.conversion),e}function Kr(i){let e=function(...t){let n=t[0];if(n==null)return n;n.length>1&&(t=n);let o=i(t);if(typeof o=="object")for(let r=o.length,c=0;c<r;c++)o[c]=Math.round(o[c]);return o};return"conversion"in i&&(e.conversion=i.conversion),e}Br.forEach(i=>{Ct[i]={},Object.defineProperty(Ct[i],"channels",{value:ln[i].channels}),Object.defineProperty(Ct[i],"labels",{value:ln[i].labels});let e=Hr(i);Object.keys(e).forEach(n=>{let o=e[n];Ct[i][n]=Kr(o),Ct[i][n].raw=Jr(o)})});Ps.exports=Ct});var Ds=ce((tl,Rs)=>{"use strict";var Ms=(i,e)=>(...t)=>`\x1B[${i(...t)+e}m`,As=(i,e)=>(...t)=>{let n=i(...t);return`\x1B[${38+e};5;${n}m`},Os=(i,e)=>(...t)=>{let n=i(...t);return`\x1B[${38+e};2;${n[0]};${n[1]};${n[2]}m`},io=i=>i,Es=(i,e,t)=>[i,e,t],wt=(i,e,t)=>{Object.defineProperty(i,e,{get:()=>{let n=t();return Object.defineProperty(i,e,{value:n,enumerable:!0,configurable:!0}),n},enumerable:!0,configurable:!0})},cn,vt=(i,e,t,n)=>{cn===void 0&&(cn=Ts());let o=n?10:0,r={};for(let[c,u]of Object.entries(cn)){let d=c==="ansi16"?"ansi":c;c===e?r[d]=i(t,o):typeof u=="object"&&(r[d]=i(u[e],o))}return r};function Yr(){let i=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,n]of Object.entries(e)){for(let[o,r]of Object.entries(n))e[o]={open:`\x1B[${r[0]}m`,close:`\x1B[${r[1]}m`},n[o]=e[o],i.set(r[0],r[1]);Object.defineProperty(e,t,{value:n,enumerable:!1})}return Object.defineProperty(e,"codes",{value:i,enumerable:!1}),e.color.close="\x1B[39m",e.bgColor.close="\x1B[49m",wt(e.color,"ansi",()=>vt(Ms,"ansi16",io,!1)),wt(e.color,"ansi256",()=>vt(As,"ansi256",io,!1)),wt(e.color,"ansi16m",()=>vt(Os,"rgb",Es,!1)),wt(e.bgColor,"ansi",()=>vt(Ms,"ansi16",io,!0)),wt(e.bgColor,"ansi256",()=>vt(As,"ansi256",io,!0)),wt(e.bgColor,"ansi16m",()=>vt(Os,"rgb",Es,!0)),e}Object.defineProperty(Rs,"exports",{enumerable:!0,get:Yr})});var Fs=ce((ol,$s)=>{"use strict";$s.exports=(i,e=process.argv)=>{let t=i.startsWith("-")?"":i.length===1?"-":"--",n=e.indexOf(t+i),o=e.indexOf("--");return n!==-1&&(o===-1||n<o)}});var Ns=ce((nl,Is)=>{"use strict";var Qr=require("os"),Us=require("tty"),Re=Fs(),{env:de}=process,Xe;Re("no-color")||Re("no-colors")||Re("color=false")||Re("color=never")?Xe=0:(Re("color")||Re("colors")||Re("color=true")||Re("color=always"))&&(Xe=1);"FORCE_COLOR"in de&&(de.FORCE_COLOR==="true"?Xe=1:de.FORCE_COLOR==="false"?Xe=0:Xe=de.FORCE_COLOR.length===0?1:Math.min(parseInt(de.FORCE_COLOR,10),3));function un(i){return i===0?!1:{level:i,hasBasic:!0,has256:i>=2,has16m:i>=3}}function dn(i,e){if(Xe===0)return 0;if(Re("color=16m")||Re("color=full")||Re("color=truecolor"))return 3;if(Re("color=256"))return 2;if(i&&!e&&Xe===void 0)return 0;let t=Xe||0;if(de.TERM==="dumb")return t;if(process.platform==="win32"){let n=Qr.release().split(".");return Number(n[0])>=10&&Number(n[2])>=10586?Number(n[2])>=14931?3:2:1}if("CI"in de)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some(n=>n in de)||de.CI_NAME==="codeship"?1:t;if("TEAMCITY_VERSION"in de)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(de.TEAMCITY_VERSION)?1:0;if(de.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in de){let n=parseInt((de.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(de.TERM_PROGRAM){case"iTerm.app":return n>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(de.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(de.TERM)||"COLORTERM"in de?1:t}function Xr(i){let e=dn(i,i&&i.isTTY);return un(e)}Is.exports={supportsColor:Xr,stdout:un(dn(!0,Us.isatty(1))),stderr:un(dn(!0,Us.isatty(2)))}});var js=ce((sl,qs)=>{"use strict";var Zr=(i,e,t)=>{let n=i.indexOf(e);if(n===-1)return i;let o=e.length,r=0,c="";do c+=i.substr(r,n-r)+e+t,r=n+o,n=i.indexOf(e,r);while(n!==-1);return c+=i.substr(r),c},ea=(i,e,t,n)=>{let o=0,r="";do{let c=i[n-1]==="\r";r+=i.substr(o,(c?n-1:n)-o)+e+(c?`\r
27
+ `)}),this}_outputHelpIfRequested(e){let t=this._getHelpOption();t&&e.find(o=>t.is(o))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}};function ms(i){return i.map(e=>{if(!e.startsWith("--inspect"))return e;let t,n="127.0.0.1",o="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])?o=r[3]:n=r[3]):(r=e.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(t=r[1],n=r[3],o=r[4]),t&&o!=="0"?`${t}=${n}:${parseInt(o)+1}`:e})}function nn(){if(H.env.NO_COLOR||H.env.FORCE_COLOR==="0"||H.env.FORCE_COLOR==="false")return!1;if(H.env.FORCE_COLOR||H.env.CLICOLOR_FORCE!==void 0)return!0}sn.Command=on;sn.useColor=nn});var bs=ce(Oe=>{var{Argument:fs}=oo(),{Command:rn}=hs(),{CommanderError:qr,InvalidArgumentError:gs}=Et(),{Help:jr}=Ko(),{Option:ys}=Zo();Oe.program=new rn;Oe.createCommand=i=>new rn(i);Oe.createOption=(i,e)=>new ys(i,e);Oe.createArgument=(i,e)=>new fs(i,e);Oe.Command=rn;Oe.Option=ys;Oe.Argument=fs;Oe.Help=jr;Oe.CommanderError=qr;Oe.InvalidArgumentError=gs;Oe.InvalidOptionArgumentError=gs});var ws=ce((Qa,Cs)=>{"use strict";Cs.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 an=ce((Xa,ks)=>{var Rt=ws(),vs={};for(let i of Object.keys(Rt))vs[Rt[i]]=i;var O={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"]}};ks.exports=O;for(let i of Object.keys(O)){if(!("channels"in O[i]))throw new Error("missing channels property: "+i);if(!("labels"in O[i]))throw new Error("missing channel labels property: "+i);if(O[i].labels.length!==O[i].channels)throw new Error("channel and label counts mismatch: "+i);let{channels:e,labels:t}=O[i];delete O[i].channels,delete O[i].labels,Object.defineProperty(O[i],"channels",{value:e}),Object.defineProperty(O[i],"labels",{value:t})}O.rgb.hsl=function(i){let e=i[0]/255,t=i[1]/255,n=i[2]/255,o=Math.min(e,t,n),r=Math.max(e,t,n),c=r-o,u,d;r===o?u=0:e===r?u=(t-n)/c:t===r?u=2+(n-e)/c:n===r&&(u=4+(e-t)/c),u=Math.min(u*60,360),u<0&&(u+=360);let f=(o+r)/2;return r===o?d=0:f<=.5?d=c/(r+o):d=c/(2-r-o),[u,d*100,f*100]};O.rgb.hsv=function(i){let e,t,n,o,r,c=i[0]/255,u=i[1]/255,d=i[2]/255,f=Math.max(c,u,d),m=f-Math.min(c,u,d),h=function(y){return(f-y)/6/m+1/2};return m===0?(o=0,r=0):(r=m/f,e=h(c),t=h(u),n=h(d),c===f?o=n-t:u===f?o=1/3+e-n:d===f&&(o=2/3+t-e),o<0?o+=1:o>1&&(o-=1)),[o*360,r*100,f*100]};O.rgb.hwb=function(i){let e=i[0],t=i[1],n=i[2],o=O.rgb.hsl(i)[0],r=1/255*Math.min(e,Math.min(t,n));return n=1-1/255*Math.max(e,Math.max(t,n)),[o,r*100,n*100]};O.rgb.cmyk=function(i){let e=i[0]/255,t=i[1]/255,n=i[2]/255,o=Math.min(1-e,1-t,1-n),r=(1-e-o)/(1-o)||0,c=(1-t-o)/(1-o)||0,u=(1-n-o)/(1-o)||0;return[r*100,c*100,u*100,o*100]};function Lr(i,e){return(i[0]-e[0])**2+(i[1]-e[1])**2+(i[2]-e[2])**2}O.rgb.keyword=function(i){let e=vs[i];if(e)return e;let t=1/0,n;for(let o of Object.keys(Rt)){let r=Rt[o],c=Lr(i,r);c<t&&(t=c,n=o)}return n};O.keyword.rgb=function(i){return Rt[i]};O.rgb.xyz=function(i){let e=i[0]/255,t=i[1]/255,n=i[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,n=n>.04045?((n+.055)/1.055)**2.4:n/12.92;let o=e*.4124+t*.3576+n*.1805,r=e*.2126+t*.7152+n*.0722,c=e*.0193+t*.1192+n*.9505;return[o*100,r*100,c*100]};O.rgb.lab=function(i){let e=O.rgb.xyz(i),t=e[0],n=e[1],o=e[2];t/=95.047,n/=100,o/=108.883,t=t>.008856?t**(1/3):7.787*t+16/116,n=n>.008856?n**(1/3):7.787*n+16/116,o=o>.008856?o**(1/3):7.787*o+16/116;let r=116*n-16,c=500*(t-n),u=200*(n-o);return[r,c,u]};O.hsl.rgb=function(i){let e=i[0]/360,t=i[1]/100,n=i[2]/100,o,r,c;if(t===0)return c=n*255,[c,c,c];n<.5?o=n*(1+t):o=n+t-n*t;let u=2*n-o,d=[0,0,0];for(let f=0;f<3;f++)r=e+1/3*-(f-1),r<0&&r++,r>1&&r--,6*r<1?c=u+(o-u)*6*r:2*r<1?c=o:3*r<2?c=u+(o-u)*(2/3-r)*6:c=u,d[f]=c*255;return d};O.hsl.hsv=function(i){let e=i[0],t=i[1]/100,n=i[2]/100,o=t,r=Math.max(n,.01);n*=2,t*=n<=1?n:2-n,o*=r<=1?r:2-r;let c=(n+t)/2,u=n===0?2*o/(r+o):2*t/(n+t);return[e,u*100,c*100]};O.hsv.rgb=function(i){let e=i[0]/60,t=i[1]/100,n=i[2]/100,o=Math.floor(e)%6,r=e-Math.floor(e),c=255*n*(1-t),u=255*n*(1-t*r),d=255*n*(1-t*(1-r));switch(n*=255,o){case 0:return[n,d,c];case 1:return[u,n,c];case 2:return[c,n,d];case 3:return[c,u,n];case 4:return[d,c,n];case 5:return[n,c,u]}};O.hsv.hsl=function(i){let e=i[0],t=i[1]/100,n=i[2]/100,o=Math.max(n,.01),r,c;c=(2-t)*n;let u=(2-t)*o;return r=t*o,r/=u<=1?u:2-u,r=r||0,c/=2,[e,r*100,c*100]};O.hwb.rgb=function(i){let e=i[0]/360,t=i[1]/100,n=i[2]/100,o=t+n,r;o>1&&(t/=o,n/=o);let c=Math.floor(6*e),u=1-n;r=6*e-c,(c&1)!==0&&(r=1-r);let d=t+r*(u-t),f,m,h;switch(c){default:case 6:case 0:f=u,m=d,h=t;break;case 1:f=d,m=u,h=t;break;case 2:f=t,m=u,h=d;break;case 3:f=t,m=d,h=u;break;case 4:f=d,m=t,h=u;break;case 5:f=u,m=t,h=d;break}return[f*255,m*255,h*255]};O.cmyk.rgb=function(i){let e=i[0]/100,t=i[1]/100,n=i[2]/100,o=i[3]/100,r=1-Math.min(1,e*(1-o)+o),c=1-Math.min(1,t*(1-o)+o),u=1-Math.min(1,n*(1-o)+o);return[r*255,c*255,u*255]};O.xyz.rgb=function(i){let e=i[0]/100,t=i[1]/100,n=i[2]/100,o,r,c;return o=e*3.2406+t*-1.5372+n*-.4986,r=e*-.9689+t*1.8758+n*.0415,c=e*.0557+t*-.204+n*1.057,o=o>.0031308?1.055*o**(1/2.4)-.055:o*12.92,r=r>.0031308?1.055*r**(1/2.4)-.055:r*12.92,c=c>.0031308?1.055*c**(1/2.4)-.055:c*12.92,o=Math.min(Math.max(0,o),1),r=Math.min(Math.max(0,r),1),c=Math.min(Math.max(0,c),1),[o*255,r*255,c*255]};O.xyz.lab=function(i){let e=i[0],t=i[1],n=i[2];e/=95.047,t/=100,n/=108.883,e=e>.008856?e**(1/3):7.787*e+16/116,t=t>.008856?t**(1/3):7.787*t+16/116,n=n>.008856?n**(1/3):7.787*n+16/116;let o=116*t-16,r=500*(e-t),c=200*(t-n);return[o,r,c]};O.lab.xyz=function(i){let e=i[0],t=i[1],n=i[2],o,r,c;r=(e+16)/116,o=t/500+r,c=r-n/200;let u=r**3,d=o**3,f=c**3;return r=u>.008856?u:(r-16/116)/7.787,o=d>.008856?d:(o-16/116)/7.787,c=f>.008856?f:(c-16/116)/7.787,o*=95.047,r*=100,c*=108.883,[o,r,c]};O.lab.lch=function(i){let e=i[0],t=i[1],n=i[2],o;o=Math.atan2(n,t)*360/2/Math.PI,o<0&&(o+=360);let c=Math.sqrt(t*t+n*n);return[e,c,o]};O.lch.lab=function(i){let e=i[0],t=i[1],o=i[2]/360*2*Math.PI,r=t*Math.cos(o),c=t*Math.sin(o);return[e,r,c]};O.rgb.ansi16=function(i,e=null){let[t,n,o]=i,r=e===null?O.rgb.hsv(i)[2]:e;if(r=Math.round(r/50),r===0)return 30;let c=30+(Math.round(o/255)<<2|Math.round(n/255)<<1|Math.round(t/255));return r===2&&(c+=60),c};O.hsv.ansi16=function(i){return O.rgb.ansi16(O.hsv.rgb(i),i[2])};O.rgb.ansi256=function(i){let e=i[0],t=i[1],n=i[2];return e===t&&t===n?e<8?16:e>248?231:Math.round((e-8)/247*24)+232:16+36*Math.round(e/255*5)+6*Math.round(t/255*5)+Math.round(n/255*5)};O.ansi16.rgb=function(i){let e=i%10;if(e===0||e===7)return i>50&&(e+=3.5),e=e/10.5*255,[e,e,e];let t=(~~(i>50)+1)*.5,n=(e&1)*t*255,o=(e>>1&1)*t*255,r=(e>>2&1)*t*255;return[n,o,r]};O.ansi256.rgb=function(i){if(i>=232){let r=(i-232)*10+8;return[r,r,r]}i-=16;let e,t=Math.floor(i/36)/5*255,n=Math.floor((e=i%36)/6)/5*255,o=e%6/5*255;return[t,n,o]};O.rgb.hex=function(i){let t=(((Math.round(i[0])&255)<<16)+((Math.round(i[1])&255)<<8)+(Math.round(i[2])&255)).toString(16).toUpperCase();return"000000".substring(t.length)+t};O.hex.rgb=function(i){let e=i.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(u=>u+u).join(""));let n=parseInt(t,16),o=n>>16&255,r=n>>8&255,c=n&255;return[o,r,c]};O.rgb.hcg=function(i){let e=i[0]/255,t=i[1]/255,n=i[2]/255,o=Math.max(Math.max(e,t),n),r=Math.min(Math.min(e,t),n),c=o-r,u,d;return c<1?u=r/(1-c):u=0,c<=0?d=0:o===e?d=(t-n)/c%6:o===t?d=2+(n-e)/c:d=4+(e-t)/c,d/=6,d%=1,[d*360,c*100,u*100]};O.hsl.hcg=function(i){let e=i[1]/100,t=i[2]/100,n=t<.5?2*e*t:2*e*(1-t),o=0;return n<1&&(o=(t-.5*n)/(1-n)),[i[0],n*100,o*100]};O.hsv.hcg=function(i){let e=i[1]/100,t=i[2]/100,n=e*t,o=0;return n<1&&(o=(t-n)/(1-n)),[i[0],n*100,o*100]};O.hcg.rgb=function(i){let e=i[0]/360,t=i[1]/100,n=i[2]/100;if(t===0)return[n*255,n*255,n*255];let o=[0,0,0],r=e%1*6,c=r%1,u=1-c,d=0;switch(Math.floor(r)){case 0:o[0]=1,o[1]=c,o[2]=0;break;case 1:o[0]=u,o[1]=1,o[2]=0;break;case 2:o[0]=0,o[1]=1,o[2]=c;break;case 3:o[0]=0,o[1]=u,o[2]=1;break;case 4:o[0]=c,o[1]=0,o[2]=1;break;default:o[0]=1,o[1]=0,o[2]=u}return d=(1-t)*n,[(t*o[0]+d)*255,(t*o[1]+d)*255,(t*o[2]+d)*255]};O.hcg.hsv=function(i){let e=i[1]/100,t=i[2]/100,n=e+t*(1-e),o=0;return n>0&&(o=e/n),[i[0],o*100,n*100]};O.hcg.hsl=function(i){let e=i[1]/100,n=i[2]/100*(1-e)+.5*e,o=0;return n>0&&n<.5?o=e/(2*n):n>=.5&&n<1&&(o=e/(2*(1-n))),[i[0],o*100,n*100]};O.hcg.hwb=function(i){let e=i[1]/100,t=i[2]/100,n=e+t*(1-e);return[i[0],(n-e)*100,(1-n)*100]};O.hwb.hcg=function(i){let e=i[1]/100,n=1-i[2]/100,o=n-e,r=0;return o<1&&(r=(n-o)/(1-o)),[i[0],o*100,r*100]};O.apple.rgb=function(i){return[i[0]/65535*255,i[1]/65535*255,i[2]/65535*255]};O.rgb.apple=function(i){return[i[0]/255*65535,i[1]/255*65535,i[2]/255*65535]};O.gray.rgb=function(i){return[i[0]/100*255,i[0]/100*255,i[0]/100*255]};O.gray.hsl=function(i){return[0,0,i[0]]};O.gray.hsv=O.gray.hsl;O.gray.hwb=function(i){return[0,100,i[0]]};O.gray.cmyk=function(i){return[0,0,0,i[0]]};O.gray.lab=function(i){return[i[0],0,0]};O.gray.hex=function(i){let e=Math.round(i[0]/100*255)&255,n=((e<<16)+(e<<8)+e).toString(16).toUpperCase();return"000000".substring(n.length)+n};O.rgb.gray=function(i){return[(i[0]+i[1]+i[2])/3/255*100]}});var xs=ce((Za,Ss)=>{var so=an();function Gr(){let i={},e=Object.keys(so);for(let t=e.length,n=0;n<t;n++)i[e[n]]={distance:-1,parent:null};return i}function Wr(i){let e=Gr(),t=[i];for(e[i].distance=0;t.length;){let n=t.pop(),o=Object.keys(so[n]);for(let r=o.length,c=0;c<r;c++){let u=o[c],d=e[u];d.distance===-1&&(d.distance=e[n].distance+1,d.parent=n,t.unshift(u))}}return e}function zr(i,e){return function(t){return e(i(t))}}function Vr(i,e){let t=[e[i].parent,i],n=so[e[i].parent][i],o=e[i].parent;for(;e[o].parent;)t.unshift(e[o].parent),n=zr(so[e[o].parent][o],n),o=e[o].parent;return n.conversion=t,n}Ss.exports=function(i){let e=Wr(i),t={},n=Object.keys(e);for(let o=n.length,r=0;r<o;r++){let c=n[r];e[c].parent!==null&&(t[c]=Vr(c,e))}return t}});var Ps=ce((el,Ts)=>{var ln=an(),Hr=xs(),Ct={},Br=Object.keys(ln);function Jr(i){let e=function(...t){let n=t[0];return n==null?n:(n.length>1&&(t=n),i(t))};return"conversion"in i&&(e.conversion=i.conversion),e}function Kr(i){let e=function(...t){let n=t[0];if(n==null)return n;n.length>1&&(t=n);let o=i(t);if(typeof o=="object")for(let r=o.length,c=0;c<r;c++)o[c]=Math.round(o[c]);return o};return"conversion"in i&&(e.conversion=i.conversion),e}Br.forEach(i=>{Ct[i]={},Object.defineProperty(Ct[i],"channels",{value:ln[i].channels}),Object.defineProperty(Ct[i],"labels",{value:ln[i].labels});let e=Hr(i);Object.keys(e).forEach(n=>{let o=e[n];Ct[i][n]=Kr(o),Ct[i][n].raw=Jr(o)})});Ts.exports=Ct});var $s=ce((tl,Rs)=>{"use strict";var Ms=(i,e)=>(...t)=>`\x1B[${i(...t)+e}m`,As=(i,e)=>(...t)=>{let n=i(...t);return`\x1B[${38+e};5;${n}m`},Os=(i,e)=>(...t)=>{let n=i(...t);return`\x1B[${38+e};2;${n[0]};${n[1]};${n[2]}m`},io=i=>i,Es=(i,e,t)=>[i,e,t],wt=(i,e,t)=>{Object.defineProperty(i,e,{get:()=>{let n=t();return Object.defineProperty(i,e,{value:n,enumerable:!0,configurable:!0}),n},enumerable:!0,configurable:!0})},cn,vt=(i,e,t,n)=>{cn===void 0&&(cn=Ps());let o=n?10:0,r={};for(let[c,u]of Object.entries(cn)){let d=c==="ansi16"?"ansi":c;c===e?r[d]=i(t,o):typeof u=="object"&&(r[d]=i(u[e],o))}return r};function Yr(){let i=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,n]of Object.entries(e)){for(let[o,r]of Object.entries(n))e[o]={open:`\x1B[${r[0]}m`,close:`\x1B[${r[1]}m`},n[o]=e[o],i.set(r[0],r[1]);Object.defineProperty(e,t,{value:n,enumerable:!1})}return Object.defineProperty(e,"codes",{value:i,enumerable:!1}),e.color.close="\x1B[39m",e.bgColor.close="\x1B[49m",wt(e.color,"ansi",()=>vt(Ms,"ansi16",io,!1)),wt(e.color,"ansi256",()=>vt(As,"ansi256",io,!1)),wt(e.color,"ansi16m",()=>vt(Os,"rgb",Es,!1)),wt(e.bgColor,"ansi",()=>vt(Ms,"ansi16",io,!0)),wt(e.bgColor,"ansi256",()=>vt(As,"ansi256",io,!0)),wt(e.bgColor,"ansi16m",()=>vt(Os,"rgb",Es,!0)),e}Object.defineProperty(Rs,"exports",{enumerable:!0,get:Yr})});var Fs=ce((ol,Ds)=>{"use strict";Ds.exports=(i,e=process.argv)=>{let t=i.startsWith("-")?"":i.length===1?"-":"--",n=e.indexOf(t+i),o=e.indexOf("--");return n!==-1&&(o===-1||n<o)}});var Ns=ce((nl,Is)=>{"use strict";var Qr=require("os"),Us=require("tty"),Re=Fs(),{env:de}=process,Xe;Re("no-color")||Re("no-colors")||Re("color=false")||Re("color=never")?Xe=0:(Re("color")||Re("colors")||Re("color=true")||Re("color=always"))&&(Xe=1);"FORCE_COLOR"in de&&(de.FORCE_COLOR==="true"?Xe=1:de.FORCE_COLOR==="false"?Xe=0:Xe=de.FORCE_COLOR.length===0?1:Math.min(parseInt(de.FORCE_COLOR,10),3));function un(i){return i===0?!1:{level:i,hasBasic:!0,has256:i>=2,has16m:i>=3}}function dn(i,e){if(Xe===0)return 0;if(Re("color=16m")||Re("color=full")||Re("color=truecolor"))return 3;if(Re("color=256"))return 2;if(i&&!e&&Xe===void 0)return 0;let t=Xe||0;if(de.TERM==="dumb")return t;if(process.platform==="win32"){let n=Qr.release().split(".");return Number(n[0])>=10&&Number(n[2])>=10586?Number(n[2])>=14931?3:2:1}if("CI"in de)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some(n=>n in de)||de.CI_NAME==="codeship"?1:t;if("TEAMCITY_VERSION"in de)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(de.TEAMCITY_VERSION)?1:0;if(de.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in de){let n=parseInt((de.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(de.TERM_PROGRAM){case"iTerm.app":return n>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(de.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(de.TERM)||"COLORTERM"in de?1:t}function Xr(i){let e=dn(i,i&&i.isTTY);return un(e)}Is.exports={supportsColor:Xr,stdout:un(dn(!0,Us.isatty(1))),stderr:un(dn(!0,Us.isatty(2)))}});var js=ce((sl,qs)=>{"use strict";var Zr=(i,e,t)=>{let n=i.indexOf(e);if(n===-1)return i;let o=e.length,r=0,c="";do c+=i.substr(r,n-r)+e+t,r=n+o,n=i.indexOf(e,r);while(n!==-1);return c+=i.substr(r),c},ea=(i,e,t,n)=>{let o=0,r="";do{let c=i[n-1]==="\r";r+=i.substr(o,(c?n-1:n)-o)+e+(c?`\r
28
28
  `:`
29
29
  `)+t,o=n+1,n=i.indexOf(`
30
30
  `,o)}while(n!==-1);return r+=i.substr(o),r};qs.exports={stringReplaceAll:Zr,stringEncaseCRLFWithFirstIndex:ea}});var Vs=ce((il,zs)=>{"use strict";var ta=/(?:\\(u(?:[a-f\d]{4}|\{[a-f\d]{1,6}\})|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi,Ls=/(?:^|\.)(\w+)(?:\(([^)]*)\))?/g,oa=/^(['"])((?:\\.|(?!\1)[^\\])*)\1$/,na=/\\(u(?:[a-f\d]{4}|{[a-f\d]{1,6}})|x[a-f\d]{2}|.)|([^\\])/gi,sa=new Map([["n",`
31
- `],["r","\r"],["t"," "],["b","\b"],["f","\f"],["v","\v"],["0","\0"],["\\","\\"],["e","\x1B"],["a","\x07"]]);function Ws(i){let e=i[0]==="u",t=i[1]==="{";return e&&!t&&i.length===5||i[0]==="x"&&i.length===3?String.fromCharCode(parseInt(i.slice(1),16)):e&&t?String.fromCodePoint(parseInt(i.slice(2,-1),16)):sa.get(i)||i}function ia(i,e){let t=[],n=e.trim().split(/\s*,\s*/g),o;for(let r of n){let c=Number(r);if(!Number.isNaN(c))t.push(c);else if(o=r.match(oa))t.push(o[2].replace(na,(u,d,f)=>d?Ws(d):f));else throw new Error(`Invalid Chalk template style argument: ${r} (in style '${i}')`)}return t}function ra(i){Ls.lastIndex=0;let e=[],t;for(;(t=Ls.exec(i))!==null;){let n=t[1];if(t[2]){let o=ia(n,t[2]);e.push([n].concat(o))}else e.push([n])}return e}function Gs(i,e){let t={};for(let o of e)for(let r of o.styles)t[r[0]]=o.inverse?null:r.slice(1);let n=i;for(let[o,r]of Object.entries(t))if(Array.isArray(r)){if(!(o in n))throw new Error(`Unknown Chalk style: ${o}`);n=r.length>0?n[o](...r):n[o]}return n}zs.exports=(i,e)=>{let t=[],n=[],o=[];if(e.replace(ta,(r,c,u,d,f,m)=>{if(c)o.push(Ws(c));else if(d){let h=o.join("");o=[],n.push(t.length===0?h:Gs(i,t)(h)),t.push({inverse:u,styles:ra(d)})}else if(f){if(t.length===0)throw new Error("Found extraneous } in Chalk template literal");n.push(Gs(i,t)(o.join(""))),o=[],t.pop()}else o.push(m)}),n.push(o.join("")),t.length>0){let r=`Chalk template literal is missing ${t.length} closing bracket${t.length===1?"":"s"} (\`}\`)`;throw new Error(r)}return n.join("")}});var lt=ce((rl,Qs)=>{"use strict";var Dt=Ds(),{stdout:mn,stderr:hn}=Ns(),{stringReplaceAll:aa,stringEncaseCRLFWithFirstIndex:la}=js(),{isArray:ro}=Array,Bs=["ansi","ansi","ansi256","ansi16m"],kt=Object.create(null),ca=(i,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=mn?mn.level:0;i.level=e.level===void 0?t:e.level},fn=class{constructor(e){return Js(e)}},Js=i=>{let e={};return ca(e,i),e.template=(...t)=>Ys(e.template,...t),Object.setPrototypeOf(e,ao.prototype),Object.setPrototypeOf(e.template,e),e.template.constructor=()=>{throw new Error("`chalk.constructor()` is deprecated. Use `new chalk.Instance()` instead.")},e.template.Instance=fn,e.template};function ao(i){return Js(i)}for(let[i,e]of Object.entries(Dt))kt[i]={get(){let t=lo(this,gn(e.open,e.close,this._styler),this._isEmpty);return Object.defineProperty(this,i,{value:t}),t}};kt.visible={get(){let i=lo(this,this._styler,!0);return Object.defineProperty(this,"visible",{value:i}),i}};var Ks=["rgb","hex","keyword","hsl","hsv","hwb","ansi","ansi256"];for(let i of Ks)kt[i]={get(){let{level:e}=this;return function(...t){let n=gn(Dt.color[Bs[e]][i](...t),Dt.color.close,this._styler);return lo(this,n,this._isEmpty)}}};for(let i of Ks){let e="bg"+i[0].toUpperCase()+i.slice(1);kt[e]={get(){let{level:t}=this;return function(...n){let o=gn(Dt.bgColor[Bs[t]][i](...n),Dt.bgColor.close,this._styler);return lo(this,o,this._isEmpty)}}}}var ua=Object.defineProperties(()=>{},{...kt,level:{enumerable:!0,get(){return this._generator.level},set(i){this._generator.level=i}}}),gn=(i,e,t)=>{let n,o;return t===void 0?(n=i,o=e):(n=t.openAll+i,o=e+t.closeAll),{open:i,close:e,openAll:n,closeAll:o,parent:t}},lo=(i,e,t)=>{let n=(...o)=>ro(o[0])&&ro(o[0].raw)?Hs(n,Ys(n,...o)):Hs(n,o.length===1?""+o[0]:o.join(" "));return Object.setPrototypeOf(n,ua),n._generator=i,n._styler=e,n._isEmpty=t,n},Hs=(i,e)=>{if(i.level<=0||!e)return i._isEmpty?"":e;let t=i._styler;if(t===void 0)return e;let{openAll:n,closeAll:o}=t;if(e.indexOf("\x1B")!==-1)for(;t!==void 0;)e=aa(e,t.close,t.open),t=t.parent;let r=e.indexOf(`
32
- `);return r!==-1&&(e=la(e,o,n,r)),n+e+o},pn,Ys=(i,...e)=>{let[t]=e;if(!ro(t)||!ro(t.raw))return e.join(" ");let n=e.slice(1),o=[t.raw[0]];for(let r=1;r<t.length;r++)o.push(String(n[r-1]).replace(/[{}\\]/g,"\\$&"),String(t.raw[r]));return pn===void 0&&(pn=Vs()),pn(i,o.join(""))};Object.defineProperties(ao.prototype,kt);var co=ao();co.supportsColor=mn;co.stderr=ao({level:hn?hn.level:0});co.stderr.supportsColor=hn;Qs.exports=co});var Zs=ce((ho,ct)=>{var po=void 0,mo=function(i){return po||(po=new Promise(function(e,t){var n=typeof i<"u"?i:{},o=n.onAbort;n.onAbort=function(s){t(new Error(s)),o&&o(s)},n.postRun=n.postRun||[],n.postRun.push(function(){e(n)}),ct=void 0;var r;r||=typeof n<"u"?n:{};var c=!!globalThis.window,u=!!globalThis.WorkerGlobalScope,d=globalThis.process?.versions?.node&&globalThis.process?.type!="renderer";r.onRuntimeInitialized=function(){function s(b,P){switch(typeof P){case"boolean":br(b,P?1:0);break;case"number":fr(b,P);break;case"string":gr(b,P,-1,-1);break;case"object":if(P===null)os(b);else if(P.length!=null){var E=Yt(P.length);D.set(P,E),yr(b,E,P.length,-1),Ot(E)}else eo(b,"Wrong API use : tried to return a value of an unknown type ("+P+").",-1);break;default:os(b)}}function a(b,P){for(var E=[],R=0;R<b;R+=1){var L=Ie(P+4*R,"i32"),J=ur(L);if(J===1||J===2)L=hr(L);else if(J===3)L=pr(L);else if(J===4){J=L,L=dr(J),J=mr(J);for(var De=new Uint8Array(L),Ae=0;Ae<L;Ae+=1)De[Ae]=D[J+Ae];L=De}else L=null;E.push(L)}return E}function l(b,P){this.Qa=b,this.db=P,this.Oa=1,this.mb=[]}function p(b,P){if(this.db=P,this.fb=Kt(b),this.fb===null)throw Error("Unable to allocate memory for the SQL string");this.lb=this.fb,this.$a=this.sb=null}function g(b){if(this.filename="dbfile_"+(4294967295*Math.random()>>>0),b!=null){var P=this.filename,E="/",R=P;if(E&&(E=typeof E=="string"?E:Ao(E),R=P?ot(E+"/"+P):E),P=An(!0,!0),R=qi(R,P),b){if(typeof b=="string"){E=Array(b.length);for(var L=0,J=b.length;L<J;++L)E[L]=b.charCodeAt(L);b=E}Vt(R,P|146),E=_t(R,577),zn(E,b,0,b.length,0),Fo(E),Vt(R,P)}}this.handleError($(this.filename,_)),this.db=Ie(_,"i32"),ss(this.db),this.gb={},this.Sa={}}var _=rt(4),S=r.cwrap,$=S("sqlite3_open","number",["string","number"]),B=S("sqlite3_close_v2","number",["number"]),N=S("sqlite3_exec","number",["number","string","number","number","number"]),te=S("sqlite3_changes","number",["number"]),fe=S("sqlite3_prepare_v2","number",["number","string","number","number","number"]),Qn=S("sqlite3_sql","string",["number"]),Bi=S("sqlite3_normalized_sql","string",["number"]),Xn=S("sqlite3_prepare_v2","number",["number","number","number","number","number"]),Ji=S("sqlite3_bind_text","number",["number","number","number","number","number"]),Zn=S("sqlite3_bind_blob","number",["number","number","number","number","number"]),Ki=S("sqlite3_bind_double","number",["number","number","number"]),Yi=S("sqlite3_bind_int","number",["number","number","number"]),Qi=S("sqlite3_bind_parameter_index","number",["number","string"]),Xi=S("sqlite3_step","number",["number"]),Zi=S("sqlite3_errmsg","string",["number"]),er=S("sqlite3_column_count","number",["number"]),tr=S("sqlite3_data_count","number",["number"]),or=S("sqlite3_column_double","number",["number","number"]),es=S("sqlite3_column_text","string",["number","number"]),nr=S("sqlite3_column_blob","number",["number","number"]),sr=S("sqlite3_column_bytes","number",["number","number"]),ir=S("sqlite3_column_type","number",["number","number"]),rr=S("sqlite3_column_name","string",["number","number"]),ar=S("sqlite3_reset","number",["number"]),lr=S("sqlite3_clear_bindings","number",["number"]),cr=S("sqlite3_finalize","number",["number"]),ts=S("sqlite3_create_function_v2","number","number string number number number number number number number".split(" ")),ur=S("sqlite3_value_type","number",["number"]),dr=S("sqlite3_value_bytes","number",["number"]),pr=S("sqlite3_value_text","string",["number"]),mr=S("sqlite3_value_blob","number",["number"]),hr=S("sqlite3_value_double","number",["number"]),fr=S("sqlite3_result_double","",["number","number"]),os=S("sqlite3_result_null","",["number"]),gr=S("sqlite3_result_text","",["number","string","number","number"]),yr=S("sqlite3_result_blob","",["number","number","number","number"]),br=S("sqlite3_result_int","",["number","number"]),eo=S("sqlite3_result_error","",["number","string","number"]),ns=S("sqlite3_aggregate_context","number",["number","number"]),ss=S("RegisterExtensionFunctions","number",["number"]),is=S("sqlite3_update_hook","number",["number","number","number"]);l.prototype.bind=function(b){if(!this.Qa)throw"Statement closed";return this.reset(),Array.isArray(b)?this.Gb(b):b!=null&&typeof b=="object"?this.Hb(b):!0},l.prototype.step=function(){if(!this.Qa)throw"Statement closed";this.Oa=1;var b=Xi(this.Qa);switch(b){case 100:return!0;case 101:return!1;default:throw this.db.handleError(b)}},l.prototype.Ab=function(b){return b==null&&(b=this.Oa,this.Oa+=1),or(this.Qa,b)},l.prototype.Ob=function(b){if(b==null&&(b=this.Oa,this.Oa+=1),b=es(this.Qa,b),typeof BigInt!="function")throw Error("BigInt is not supported");return BigInt(b)},l.prototype.Tb=function(b){return b==null&&(b=this.Oa,this.Oa+=1),es(this.Qa,b)},l.prototype.getBlob=function(b){b==null&&(b=this.Oa,this.Oa+=1);var P=sr(this.Qa,b);b=nr(this.Qa,b);for(var E=new Uint8Array(P),R=0;R<P;R+=1)E[R]=D[b+R];return E},l.prototype.get=function(b,P){P=P||{},b!=null&&this.bind(b)&&this.step(),b=[];for(var E=tr(this.Qa),R=0;R<E;R+=1)switch(ir(this.Qa,R)){case 1:var L=P.useBigInt?this.Ob(R):this.Ab(R);b.push(L);break;case 2:b.push(this.Ab(R));break;case 3:b.push(this.Tb(R));break;case 4:b.push(this.getBlob(R));break;default:b.push(null)}return b},l.prototype.qb=function(){for(var b=[],P=er(this.Qa),E=0;E<P;E+=1)b.push(rr(this.Qa,E));return b},l.prototype.zb=function(b,P){b=this.get(b,P),P=this.qb();for(var E={},R=0;R<P.length;R+=1)E[P[R]]=b[R];return E},l.prototype.Sb=function(){return Qn(this.Qa)},l.prototype.Pb=function(){return Bi(this.Qa)},l.prototype.run=function(b){return b!=null&&this.bind(b),this.step(),this.reset()},l.prototype.wb=function(b,P){P==null&&(P=this.Oa,this.Oa+=1),b=Kt(b),this.mb.push(b),this.db.handleError(Ji(this.Qa,P,b,-1,0))},l.prototype.Fb=function(b,P){P==null&&(P=this.Oa,this.Oa+=1);var E=Yt(b.length);D.set(b,E),this.mb.push(E),this.db.handleError(Zn(this.Qa,P,E,b.length,0))},l.prototype.vb=function(b,P){P==null&&(P=this.Oa,this.Oa+=1),this.db.handleError((b===(b|0)?Yi:Ki)(this.Qa,P,b))},l.prototype.Ib=function(b){b==null&&(b=this.Oa,this.Oa+=1),Zn(this.Qa,b,0,0,0)},l.prototype.xb=function(b,P){switch(P==null&&(P=this.Oa,this.Oa+=1),typeof b){case"string":this.wb(b,P);return;case"number":this.vb(b,P);return;case"bigint":this.wb(b.toString(),P);return;case"boolean":this.vb(b+0,P);return;case"object":if(b===null){this.Ib(P);return}if(b.length!=null){this.Fb(b,P);return}}throw"Wrong API use : tried to bind a value of an unknown type ("+b+")."},l.prototype.Hb=function(b){var P=this;return Object.keys(b).forEach(function(E){var R=Qi(P.Qa,E);R!==0&&P.xb(b[E],R)}),!0},l.prototype.Gb=function(b){for(var P=0;P<b.length;P+=1)this.xb(b[P],P+1);return!0},l.prototype.reset=function(){return this.freemem(),lr(this.Qa)===0&&ar(this.Qa)===0},l.prototype.freemem=function(){for(var b;(b=this.mb.pop())!==void 0;)Ot(b)},l.prototype.Ya=function(){this.freemem();var b=cr(this.Qa)===0;return delete this.db.gb[this.Qa],this.Qa=0,b},p.prototype.next=function(){if(this.fb===null)return{done:!0};if(this.$a!==null&&(this.$a.Ya(),this.$a=null),!this.db.db)throw this.ob(),Error("Database closed");var b=Xt(),P=rt(4);We(_),We(P);try{this.db.handleError(Xn(this.db.db,this.lb,-1,_,P)),this.lb=Ie(P,"i32");var E=Ie(_,"i32");return E===0?(this.ob(),{done:!0}):(this.$a=new l(E,this.db),this.db.gb[E]=this.$a,{value:this.$a,done:!1})}catch(R){throw this.sb=X(this.lb),this.ob(),R}finally{Qt(b)}},p.prototype.ob=function(){Ot(this.fb),this.fb=null},p.prototype.Qb=function(){return this.sb!==null?this.sb:X(this.lb)},typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"&&(p.prototype[Symbol.iterator]=function(){return this}),g.prototype.run=function(b,P){if(!this.db)throw"Database closed";if(P){b=this.tb(b,P);try{b.step()}finally{b.Ya()}}else this.handleError(N(this.db,b,0,0,_));return this},g.prototype.exec=function(b,P,E){if(!this.db)throw"Database closed";var R=null,L=null,J=null;try{J=L=Kt(b);var De=rt(4);for(b=[];Ie(J,"i8")!==0;){We(_),We(De),this.handleError(Xn(this.db,J,-1,_,De));var Ae=Ie(_,"i32");if(J=Ie(De,"i32"),Ae!==0){var Pe=null;for(R=new l(Ae,this),P!=null&&R.bind(P);R.step();)Pe===null&&(Pe={columns:R.qb(),values:[]},b.push(Pe)),Pe.values.push(R.get(null,E));R.Ya()}}return b}catch($e){throw R&&R.Ya(),$e}finally{L&&Ot(L)}},g.prototype.Mb=function(b,P,E,R,L){typeof P=="function"&&(R=E,E=P,P=void 0),b=this.tb(b,P);try{for(;b.step();)E(b.zb(null,L))}finally{b.Ya()}if(typeof R=="function")return R()},g.prototype.tb=function(b,P){if(We(_),this.handleError(fe(this.db,b,-1,_,0)),b=Ie(_,"i32"),b===0)throw"Nothing to prepare";var E=new l(b,this);return P!=null&&E.bind(P),this.gb[b]=E},g.prototype.Ub=function(b){return new p(b,this)},g.prototype.Nb=function(){Object.values(this.gb).forEach(function(P){P.Ya()}),Object.values(this.Sa).forEach(Ye),this.Sa={},this.handleError(B(this.db));var b=ji(this.filename);return this.handleError($(this.filename,_)),this.db=Ie(_,"i32"),ss(this.db),b},g.prototype.close=function(){this.db!==null&&(Object.values(this.gb).forEach(function(b){b.Ya()}),Object.values(this.Sa).forEach(Ye),this.Sa={},this.Za&&(Ye(this.Za),this.Za=void 0),this.handleError(B(this.db)),qn("/"+this.filename),this.db=null)},g.prototype.handleError=function(b){if(b===0)return null;throw b=Zi(this.db),Error(b)},g.prototype.Rb=function(){return te(this.db)},g.prototype.Kb=function(b,P){Object.prototype.hasOwnProperty.call(this.Sa,b)&&(Ye(this.Sa[b]),delete this.Sa[b]);var E=At(function(R,L,J){L=a(L,J);try{var De=P.apply(null,L)}catch(Ae){eo(R,Ae,-1);return}s(R,De)},"viii");return this.Sa[b]=E,this.handleError(ts(this.db,b,P.length,1,0,E,0,0,0)),this},g.prototype.Jb=function(b,P){var E=P.init||function(){return null},R=P.finalize||function(Pe){return Pe},L=P.step;if(!L)throw"An aggregate function must have a step function in "+b;var J={};Object.hasOwnProperty.call(this.Sa,b)&&(Ye(this.Sa[b]),delete this.Sa[b]),P=b+"__finalize",Object.hasOwnProperty.call(this.Sa,P)&&(Ye(this.Sa[P]),delete this.Sa[P]);var De=At(function(Pe,$e,Go){var at=ns(Pe,1);Object.hasOwnProperty.call(J,at)||(J[at]=E()),$e=a($e,Go),$e=[J[at]].concat($e);try{J[at]=L.apply(null,$e)}catch(_r){delete J[at],eo(Pe,_r,-1)}},"viii"),Ae=At(function(Pe){var $e=ns(Pe,1);try{var Go=R(J[$e])}catch(at){delete J[$e],eo(Pe,at,-1);return}s(Pe,Go),delete J[$e]},"vi");return this.Sa[b]=De,this.Sa[P]=Ae,this.handleError(ts(this.db,b,L.length-1,1,0,0,De,Ae,0)),this},g.prototype.Zb=function(b){return this.Za&&(is(this.db,0,0),Ye(this.Za),this.Za=void 0),b?(this.Za=At(function(P,E,R,L,J){switch(E){case 18:P="insert";break;case 23:P="update";break;case 9:P="delete";break;default:throw"unknown operationCode in updateHook callback: "+E}if(R=X(R),L=X(L),J>Number.MAX_SAFE_INTEGER)throw"rowId too big to fit inside a Number";b(P,R,L,Number(J))},"viiiij"),is(this.db,this.Za,0),this):this},l.prototype.bind=l.prototype.bind,l.prototype.step=l.prototype.step,l.prototype.get=l.prototype.get,l.prototype.getColumnNames=l.prototype.qb,l.prototype.getAsObject=l.prototype.zb,l.prototype.getSQL=l.prototype.Sb,l.prototype.getNormalizedSQL=l.prototype.Pb,l.prototype.run=l.prototype.run,l.prototype.reset=l.prototype.reset,l.prototype.freemem=l.prototype.freemem,l.prototype.free=l.prototype.Ya,p.prototype.next=p.prototype.next,p.prototype.getRemainingSQL=p.prototype.Qb,g.prototype.run=g.prototype.run,g.prototype.exec=g.prototype.exec,g.prototype.each=g.prototype.Mb,g.prototype.prepare=g.prototype.tb,g.prototype.iterateStatements=g.prototype.Ub,g.prototype.export=g.prototype.Nb,g.prototype.close=g.prototype.close,g.prototype.handleError=g.prototype.handleError,g.prototype.getRowsModified=g.prototype.Rb,g.prototype.create_function=g.prototype.Kb,g.prototype.create_aggregate=g.prototype.Jb,g.prototype.updateHook=g.prototype.Zb,r.Database=g};var f="./this.program",m=(s,a)=>{throw a},h=globalThis.document?.currentScript?.src;typeof __filename<"u"?h=__filename:u&&(h=self.location.href);var y="",C,w;if(d){var k=require("node:fs");y=__dirname+"/",w=s=>(s=I(s)?new URL(s):s,k.readFileSync(s)),C=async s=>(s=I(s)?new URL(s):s,k.readFileSync(s,void 0)),1<process.argv.length&&(f=process.argv[1].replace(/\\/g,"/")),process.argv.slice(2),typeof ct<"u"&&(ct.exports=r),m=(s,a)=>{throw process.exitCode=s,a}}else if(c||u){try{y=new URL(".",h).href}catch{}u&&(w=s=>{var a=new XMLHttpRequest;return a.open("GET",s,!1),a.responseType="arraybuffer",a.send(null),new Uint8Array(a.response)}),C=async s=>{if(I(s))return new Promise((l,p)=>{var g=new XMLHttpRequest;g.open("GET",s,!0),g.responseType="arraybuffer",g.onload=()=>{g.status==200||g.status==0&&g.response?l(g.response):p(g.status)},g.onerror=p,g.send(null)});var a=await fetch(s,{credentials:"same-origin"});if(a.ok)return a.arrayBuffer();throw Error(a.status+" : "+a.url)}}var v=console.log.bind(console),x=console.error.bind(console),A,T=!1,q,I=s=>s.startsWith("file://"),D,j,ve,z,G,he,ht,_e;function He(){var s=Zt.buffer;D=new Int8Array(s),ve=new Int16Array(s),j=new Uint8Array(s),new Uint16Array(s),z=new Int32Array(s),G=new Uint32Array(s),he=new Float32Array(s),ht=new Float64Array(s),_e=new BigInt64Array(s),new BigUint64Array(s)}function xe(s){throw r.onAbort?.(s),s="Aborted("+s+")",x(s),T=!0,new WebAssembly.RuntimeError(s+". Build with -sASSERTIONS for more info.")}var Te;async function ue(s){if(!A)try{var a=await C(s);return new Uint8Array(a)}catch{}if(s==Te&&A)s=new Uint8Array(A);else if(w)s=w(s);else throw"both async and sync fetching of the wasm failed";return s}async function St(s,a){try{var l=await ue(s);return await WebAssembly.instantiate(l,a)}catch(p){x(`failed to asynchronously prepare wasm: ${p}`),xe(p)}}async function Ce(s){var a=Te;if(!A&&!I(a)&&!d)try{var l=fetch(a,{credentials:"same-origin"});return await WebAssembly.instantiateStreaming(l,s)}catch(p){x(`wasm streaming compile failed: ${p}`),x("falling back to ArrayBuffer instantiation")}return St(a,s)}class ge{name="ExitStatus";constructor(a){this.message=`Program terminated with exit(${a})`,this.status=a}}var xt=s=>{for(;0<s.length;)s.shift()(r)},tt=[],Fe=[],Be=()=>{var s=r.preRun.shift();Fe.push(s)},ie=0,Ue=null;function Ie(s,a="i8"){switch(a.endsWith("*")&&(a="*"),a){case"i1":return D[s];case"i8":return D[s];case"i16":return ve[s>>1];case"i32":return z[s>>2];case"i64":return _e[s>>3];case"float":return he[s>>2];case"double":return ht[s>>3];case"*":return G[s>>2];default:xe(`invalid type for getValue: ${a}`)}}var Ne=!0;function We(s){var a="i32";switch(a.endsWith("*")&&(a="*"),a){case"i1":D[s]=0;break;case"i8":D[s]=0;break;case"i16":ve[s>>1]=0;break;case"i32":z[s>>2]=0;break;case"i64":_e[s>>3]=BigInt(0);break;case"float":he[s>>2]=0;break;case"double":ht[s>>3]=0;break;case"*":G[s>>2]=0;break;default:xe(`invalid type for setValue: ${a}`)}}var ft=new TextDecoder,V=(s,a,l,p)=>{if(l=a+l,p)return l;for(;s[a]&&!(a>=l);)++a;return a},X=(s,a,l)=>s?ft.decode(j.subarray(s,V(j,s,a,l))):"",ze=(s,a)=>{for(var l=0,p=s.length-1;0<=p;p--){var g=s[p];g==="."?s.splice(p,1):g===".."?(s.splice(p,1),l++):l&&(s.splice(p,1),l--)}if(a)for(;l;l--)s.unshift("..");return s},ot=s=>{var a=s.charAt(0)==="/",l=s.slice(-1)==="/";return(s=ze(s.split("/").filter(p=>!!p),!a).join("/"))||a||(s="."),s&&l&&(s+="/"),(a?"/":"")+s},re=s=>{var a=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(s).slice(1);return s=a[0],a=a[1],!s&&!a?".":(a&&=a.slice(0,-1),s+a)},Z=s=>s&&s.match(/([^\/]+|\/)\/*$/)[1],qe=()=>{if(d){var s=require("node:crypto");return a=>s.randomFillSync(a)}return a=>crypto.getRandomValues(a)},Lt=s=>{(Lt=qe())(s)},Oi=(...s)=>{for(var a="",l=!1,p=s.length-1;-1<=p&&!l;p--){if(l=0<=p?s[p]:"/",typeof l!="string")throw new TypeError("Arguments to path.resolve must be strings");if(!l)return"";a=l+"/"+a,l=l.charAt(0)==="/"}return a=ze(a.split("/").filter(g=>!!g),!l).join("/"),(l?"/":"")+a||"."},Pt=s=>{var a=V(s,0);return ft.decode(s.buffer?s.subarray(0,a):new Uint8Array(s.slice(0,a)))},To=[],gt=s=>{for(var a=0,l=0;l<s.length;++l){var p=s.charCodeAt(l);127>=p?a++:2047>=p?a+=2:55296<=p&&57343>=p?(a+=4,++l):a+=3}return a},je=(s,a,l,p)=>{if(!(0<p))return 0;var g=l;p=l+p-1;for(var _=0;_<s.length;++_){var S=s.codePointAt(_);if(127>=S){if(l>=p)break;a[l++]=S}else if(2047>=S){if(l+1>=p)break;a[l++]=192|S>>6,a[l++]=128|S&63}else if(65535>=S){if(l+2>=p)break;a[l++]=224|S>>12,a[l++]=128|S>>6&63,a[l++]=128|S&63}else{if(l+3>=p)break;a[l++]=240|S>>18,a[l++]=128|S>>12&63,a[l++]=128|S>>6&63,a[l++]=128|S&63,_++}}return a[l]=0,l-g},Tn=[];function Mn(s,a){Tn[s]={input:[],output:[],eb:a},Do(s,Ei)}var Ei={open(s){var a=Tn[s.node.rdev];if(!a)throw new M(43);s.tty=a,s.seekable=!1},close(s){s.tty.eb.fsync(s.tty)},fsync(s){s.tty.eb.fsync(s.tty)},read(s,a,l,p){if(!s.tty||!s.tty.eb.Bb)throw new M(60);for(var g=0,_=0;_<p;_++){try{var S=s.tty.eb.Bb(s.tty)}catch{throw new M(29)}if(S===void 0&&g===0)throw new M(6);if(S==null)break;g++,a[l+_]=S}return g&&(s.node.atime=Date.now()),g},write(s,a,l,p){if(!s.tty||!s.tty.eb.ub)throw new M(60);try{for(var g=0;g<p;g++)s.tty.eb.ub(s.tty,a[l+g])}catch{throw new M(29)}return p&&(s.node.mtime=s.node.ctime=Date.now()),g}},Ri={Bb(){e:{if(!To.length){var s=null;if(d){var a=Buffer.alloc(256),l=0,p=process.stdin.fd;try{l=k.readSync(p,a,0,256)}catch(g){if(g.toString().includes("EOF"))l=0;else throw g}0<l&&(s=a.slice(0,l).toString("utf-8"))}else globalThis.window?.prompt&&(s=window.prompt("Input: "),s!==null&&(s+=`
33
- `));if(!s){s=null;break e}a=Array(gt(s)+1),s=je(s,a,0,a.length),a.length=s,To=a}s=To.shift()}return s},ub(s,a){a===null||a===10?(v(Pt(s.output)),s.output=[]):a!=0&&s.output.push(a)},fsync(s){0<s.output?.length&&(v(Pt(s.output)),s.output=[])},hc(){return{bc:25856,dc:5,ac:191,cc:35387,$b:[3,28,127,21,4,0,1,0,17,19,26,0,18,15,23,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}},ic(){return 0},jc(){return[24,80]}},Di={ub(s,a){a===null||a===10?(x(Pt(s.output)),s.output=[]):a!=0&&s.output.push(a)},fsync(s){0<s.output?.length&&(x(Pt(s.output)),s.output=[])}},F={Wa:null,Xa(){return F.createNode(null,"/",16895,0)},createNode(s,a,l,p){if((l&61440)===24576||(l&61440)===4096)throw new M(63);return F.Wa||(F.Wa={dir:{node:{Ta:F.La.Ta,Ua:F.La.Ua,lookup:F.La.lookup,ib:F.La.ib,rename:F.La.rename,unlink:F.La.unlink,rmdir:F.La.rmdir,readdir:F.La.readdir,symlink:F.La.symlink},stream:{Va:F.Ma.Va}},file:{node:{Ta:F.La.Ta,Ua:F.La.Ua},stream:{Va:F.Ma.Va,read:F.Ma.read,write:F.Ma.write,jb:F.Ma.jb,kb:F.Ma.kb}},link:{node:{Ta:F.La.Ta,Ua:F.La.Ua,readlink:F.La.readlink},stream:{}},yb:{node:{Ta:F.La.Ta,Ua:F.La.Ua},stream:Ni}}),l=Dn(s,a,l,p),ke(l.mode)?(l.La=F.Wa.dir.node,l.Ma=F.Wa.dir.stream,l.Na={}):(l.mode&61440)===32768?(l.La=F.Wa.file.node,l.Ma=F.Wa.file.stream,l.Ra=0,l.Na=null):(l.mode&61440)===40960?(l.La=F.Wa.link.node,l.Ma=F.Wa.link.stream):(l.mode&61440)===8192&&(l.La=F.Wa.yb.node,l.Ma=F.Wa.yb.stream),l.atime=l.mtime=l.ctime=Date.now(),s&&(s.Na[a]=l,s.atime=s.mtime=s.ctime=l.atime),l},fc(s){return s.Na?s.Na.subarray?s.Na.subarray(0,s.Ra):new Uint8Array(s.Na):new Uint8Array(0)},La:{Ta(s){var a={};return a.dev=(s.mode&61440)===8192?s.id:1,a.ino=s.id,a.mode=s.mode,a.nlink=1,a.uid=0,a.gid=0,a.rdev=s.rdev,ke(s.mode)?a.size=4096:(s.mode&61440)===32768?a.size=s.Ra:(s.mode&61440)===40960?a.size=s.link.length:a.size=0,a.atime=new Date(s.atime),a.mtime=new Date(s.mtime),a.ctime=new Date(s.ctime),a.blksize=4096,a.blocks=Math.ceil(a.size/a.blksize),a},Ua(s,a){for(var l of["mode","atime","mtime","ctime"])a[l]!=null&&(s[l]=a[l]);a.size!==void 0&&(a=a.size,s.Ra!=a&&(a==0?(s.Na=null,s.Ra=0):(l=s.Na,s.Na=new Uint8Array(a),l&&s.Na.set(l.subarray(0,Math.min(a,s.Ra))),s.Ra=a)))},lookup(){throw F.nb||(F.nb=new M(44),F.nb.stack="<generic error, no stack>"),F.nb},ib(s,a,l,p){return F.createNode(s,a,l,p)},rename(s,a,l){try{var p=nt(a,l)}catch{}if(p){if(ke(s.mode))for(var g in p.Na)throw new M(55);Eo(p)}delete s.parent.Na[s.name],a.Na[l]=s,s.name=l,a.ctime=a.mtime=s.parent.ctime=s.parent.mtime=Date.now()},unlink(s,a){delete s.Na[a],s.ctime=s.mtime=Date.now()},rmdir(s,a){var l=nt(s,a),p;for(p in l.Na)throw new M(55);delete s.Na[a],s.ctime=s.mtime=Date.now()},readdir(s){return[".","..",...Object.keys(s.Na)]},symlink(s,a,l){return s=F.createNode(s,a,41471,0),s.link=l,s},readlink(s){if((s.mode&61440)!==40960)throw new M(28);return s.link}},Ma:{read(s,a,l,p,g){var _=s.node.Na;if(g>=s.node.Ra)return 0;if(s=Math.min(s.node.Ra-g,p),8<s&&_.subarray)a.set(_.subarray(g,g+s),l);else for(p=0;p<s;p++)a[l+p]=_[g+p];return s},write(s,a,l,p,g,_){if(a.buffer===D.buffer&&(_=!1),!p)return 0;if(s=s.node,s.mtime=s.ctime=Date.now(),a.subarray&&(!s.Na||s.Na.subarray)){if(_)return s.Na=a.subarray(l,l+p),s.Ra=p;if(s.Ra===0&&g===0)return s.Na=a.slice(l,l+p),s.Ra=p;if(g+p<=s.Ra)return s.Na.set(a.subarray(l,l+p),g),p}_=g+p;var S=s.Na?s.Na.length:0;if(S>=_||(_=Math.max(_,S*(1048576>S?2:1.125)>>>0),S!=0&&(_=Math.max(_,256)),S=s.Na,s.Na=new Uint8Array(_),0<s.Ra&&s.Na.set(S.subarray(0,s.Ra),0)),s.Na.subarray&&a.subarray)s.Na.set(a.subarray(l,l+p),g);else for(_=0;_<p;_++)s.Na[g+_]=a[l+_];return s.Ra=Math.max(s.Ra,g+p),p},Va(s,a,l){if(l===1?a+=s.position:l===2&&(s.node.mode&61440)===32768&&(a+=s.node.Ra),0>a)throw new M(28);return a},jb(s,a,l,p,g){if((s.node.mode&61440)!==32768)throw new M(43);if(s=s.node.Na,g&2||!s||s.buffer!==D.buffer){g=!0,p=65536*Math.ceil(a/65536);var _=Kn(65536,p);if(_&&j.fill(0,_,_+p),p=_,!p)throw new M(48);s&&((0<l||l+a<s.length)&&(s.subarray?s=s.subarray(l,l+a):s=Array.prototype.slice.call(s,l,l+a)),D.set(s,p))}else g=!1,p=s.byteOffset;return{Xb:p,Eb:g}},kb(s,a,l,p){return F.Ma.write(s,a,0,p,l,!1),0}}},An=(s,a)=>{var l=0;return s&&(l|=365),a&&(l|=146),l},Mo=null,On={},yt=[],$i=1,Je=null,En=!1,Rn=!0,M=class{name="ErrnoError";constructor(s){this.Pa=s}},Fi=class{hb={};node=null;get flags(){return this.hb.flags}set flags(s){this.hb.flags=s}get position(){return this.hb.position}set position(s){this.hb.position=s}},Ui=class{La={};Ma={};bb=null;constructor(s,a,l,p){s||=this,this.parent=s,this.Xa=s.Xa,this.id=$i++,this.name=a,this.mode=l,this.rdev=p,this.atime=this.mtime=this.ctime=Date.now()}get read(){return(this.mode&365)===365}set read(s){s?this.mode|=365:this.mode&=-366}get write(){return(this.mode&146)===146}set write(s){s?this.mode|=146:this.mode&=-147}};function Me(s,a={}){if(!s)throw new M(44);a.pb??(a.pb=!0),s.charAt(0)==="/"||(s="//"+s);var l=0;e:for(;40>l;l++){s=s.split("/").filter($=>!!$);for(var p=Mo,g="/",_=0;_<s.length;_++){var S=_===s.length-1;if(S&&a.parent)break;if(s[_]!==".")if(s[_]==="..")if(g=re(g),p===p.parent){s=g+"/"+s.slice(_+1).join("/"),l--;continue e}else p=p.parent;else{g=ot(g+"/"+s[_]);try{p=nt(p,s[_])}catch($){if($?.Pa===44&&S&&a.Wb)return{path:g};throw $}if(!p.bb||S&&!a.pb||(p=p.bb.root),(p.mode&61440)===40960&&(!S||a.ab)){if(!p.La.readlink)throw new M(52);p=p.La.readlink(p),p.charAt(0)==="/"||(p=re(g)+"/"+p),s=p+"/"+s.slice(_+1).join("/");continue e}}}return{path:g,node:p}}throw new M(32)}function Ao(s){for(var a;;){if(s===s.parent)return s=s.Xa.Db,a?s[s.length-1]!=="/"?`${s}/${a}`:s+a:s;a=a?`${s.name}/${a}`:s.name,s=s.parent}}function Oo(s,a){for(var l=0,p=0;p<a.length;p++)l=(l<<5)-l+a.charCodeAt(p)|0;return(s+l>>>0)%Je.length}function Eo(s){var a=Oo(s.parent.id,s.name);if(Je[a]===s)Je[a]=s.cb;else for(a=Je[a];a;){if(a.cb===s){a.cb=s.cb;break}a=a.cb}}function nt(s,a){var l=ke(s.mode)?(l=bt(s,"x"))?l:s.La.lookup?0:2:54;if(l)throw new M(l);for(l=Je[Oo(s.id,a)];l;l=l.cb){var p=l.name;if(l.parent.id===s.id&&p===a)return l}return s.La.lookup(s,a)}function Dn(s,a,l,p){return s=new Ui(s,a,l,p),a=Oo(s.parent.id,s.name),s.cb=Je[a],Je[a]=s}function ke(s){return(s&61440)===16384}function bt(s,a){return Rn?0:a.includes("r")&&!(s.mode&292)||a.includes("w")&&!(s.mode&146)||a.includes("x")&&!(s.mode&73)?2:0}function $n(s,a){if(!ke(s.mode))return 54;try{return nt(s,a),20}catch{}return bt(s,"wx")}function Fn(s,a,l){try{var p=nt(s,a)}catch(g){return g.Pa}if(s=bt(s,"wx"))return s;if(l){if(!ke(p.mode))return 54;if(p===p.parent||Ao(p)==="/")return 10}else if(ke(p.mode))return 31;return 0}function Gt(s){if(!s)throw new M(63);return s}function we(s){if(s=yt[s],!s)throw new M(8);return s}function Un(s,a=-1){if(s=Object.assign(new Fi,s),a==-1)e:{for(a=0;4096>=a;a++)if(!yt[a])break e;throw new M(33)}return s.fd=a,yt[a]=s}function Ii(s,a=-1){return s=Un(s,a),s.Ma?.ec?.(s),s}function Ro(s,a,l){var p=s?.Ma.Ua;s=p?s:a,p??=a.La.Ua,Gt(p),p(s,l)}var Ni={open(s){s.Ma=On[s.node.rdev].Ma,s.Ma.open?.(s)},Va(){throw new M(70)}};function Do(s,a){On[s]={Ma:a}}function In(s,a){var l=a==="/";if(l&&Mo)throw new M(10);if(!l&&a){var p=Me(a,{pb:!1});if(a=p.path,p=p.node,p.bb)throw new M(10);if(!ke(p.mode))throw new M(54)}a={type:s,kc:{},Db:a,Vb:[]},s=s.Xa(a),s.Xa=a,a.root=s,l?Mo=s:p&&(p.bb=a,p.Xa&&p.Xa.Vb.push(a))}function Wt(s,a,l){var p=Me(s,{parent:!0}).node;if(s=Z(s),!s)throw new M(28);if(s==="."||s==="..")throw new M(20);var g=$n(p,s);if(g)throw new M(g);if(!p.La.ib)throw new M(63);return p.La.ib(p,s,a,l)}function qi(s,a=438){return Wt(s,a&4095|32768,0)}function Le(s,a=511){return Wt(s,a&1023|16384,0)}function zt(s,a,l){typeof l>"u"&&(l=a,a=438),Wt(s,a|8192,l)}function $o(s,a){if(!Oi(s))throw new M(44);var l=Me(a,{parent:!0}).node;if(!l)throw new M(44);a=Z(a);var p=$n(l,a);if(p)throw new M(p);if(!l.La.symlink)throw new M(63);l.La.symlink(l,a,s)}function Nn(s){var a=Me(s,{parent:!0}).node;s=Z(s);var l=nt(a,s),p=Fn(a,s,!0);if(p)throw new M(p);if(!a.La.rmdir)throw new M(63);if(l.bb)throw new M(10);a.La.rmdir(a,s),Eo(l)}function qn(s){var a=Me(s,{parent:!0}).node;if(!a)throw new M(44);s=Z(s);var l=nt(a,s),p=Fn(a,s,!1);if(p)throw new M(p);if(!a.La.unlink)throw new M(63);if(l.bb)throw new M(10);a.La.unlink(a,s),Eo(l)}function Tt(s,a){return s=Me(s,{ab:!a}).node,Gt(s.La.Ta)(s)}function jn(s,a,l,p){Ro(s,a,{mode:l&4095|a.mode&-4096,ctime:Date.now(),Lb:p})}function Vt(s,a){s=typeof s=="string"?Me(s,{ab:!0}).node:s,jn(null,s,a)}function Ln(s,a,l){if(ke(a.mode))throw new M(31);if((a.mode&61440)!==32768)throw new M(28);var p=bt(a,"w");if(p)throw new M(p);Ro(s,a,{size:l,timestamp:Date.now()})}function _t(s,a,l=438){if(s==="")throw new M(44);if(typeof a=="string"){var p={r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090}[a];if(typeof p>"u")throw Error(`Unknown file open mode: ${a}`);a=p}if(l=a&64?l&4095|32768:0,typeof s=="object")p=s;else{var g=s.endsWith("/"),_=Me(s,{ab:!(a&131072),Wb:!0});p=_.node,s=_.path}if(_=!1,a&64)if(p){if(a&128)throw new M(20)}else{if(g)throw new M(31);p=Wt(s,l|511,0),_=!0}if(!p)throw new M(44);if((p.mode&61440)===8192&&(a&=-513),a&65536&&!ke(p.mode))throw new M(54);if(!_&&(p?(p.mode&61440)===40960?g=32:(g=["r","w","rw"][a&3],a&512&&(g+="w"),g=ke(p.mode)&&(g!=="r"||a&576)?31:bt(p,g)):g=44,g))throw new M(g);return a&512&&!_&&(g=p,g=typeof g=="string"?Me(g,{ab:!0}).node:g,Ln(null,g,0)),a=Un({node:p,path:Ao(p),flags:a&-131713,seekable:!0,position:0,Ma:p.Ma,Yb:[],error:!1}),a.Ma.open&&a.Ma.open(a),_&&Vt(p,l&511),a}function Fo(s){if(s.fd===null)throw new M(8);s.rb&&(s.rb=null);try{s.Ma.close&&s.Ma.close(s)}catch(a){throw a}finally{yt[s.fd]=null}s.fd=null}function Gn(s,a,l){if(s.fd===null)throw new M(8);if(!s.seekable||!s.Ma.Va)throw new M(70);if(l!=0&&l!=1&&l!=2)throw new M(28);s.position=s.Ma.Va(s,a,l),s.Yb=[]}function Wn(s,a,l,p,g){if(0>p||0>g)throw new M(28);if(s.fd===null)throw new M(8);if((s.flags&2097155)===1)throw new M(8);if(ke(s.node.mode))throw new M(31);if(!s.Ma.read)throw new M(28);var _=typeof g<"u";if(!_)g=s.position;else if(!s.seekable)throw new M(70);return a=s.Ma.read(s,a,l,p,g),_||(s.position+=a),a}function zn(s,a,l,p,g){if(0>p||0>g)throw new M(28);if(s.fd===null)throw new M(8);if((s.flags&2097155)===0)throw new M(8);if(ke(s.node.mode))throw new M(31);if(!s.Ma.write)throw new M(28);s.seekable&&s.flags&1024&&Gn(s,0,2);var _=typeof g<"u";if(!_)g=s.position;else if(!s.seekable)throw new M(70);return a=s.Ma.write(s,a,l,p,g,void 0),_||(s.position+=a),a}function ji(s){var a=a||0,l="binary";l!=="utf8"&&l!=="binary"&&xe(`Invalid encoding type "${l}"`),a=_t(s,a),s=Tt(s).size;var p=new Uint8Array(s);return Wn(a,p,0,s,0),l==="utf8"&&(p=Pt(p)),Fo(a),p}function Ke(s,a,l){s=ot("/dev/"+s);var p=An(!!a,!!l);Ke.Cb??(Ke.Cb=64);var g=Ke.Cb++<<8|0;Do(g,{open(_){_.seekable=!1},close(){l?.buffer?.length&&l(10)},read(_,S,$,B){for(var N=0,te=0;te<B;te++){try{var fe=a()}catch{throw new M(29)}if(fe===void 0&&N===0)throw new M(6);if(fe==null)break;N++,S[$+te]=fe}return N&&(_.node.atime=Date.now()),N},write(_,S,$,B){for(var N=0;N<B;N++)try{l(S[$+N])}catch{throw new M(29)}return B&&(_.node.mtime=_.node.ctime=Date.now()),N}}),zt(s,p,g)}var ee={};function st(s,a,l){if(a.charAt(0)==="/")return a;if(s=s===-100?"/":we(s).path,a.length==0){if(!l)throw new M(44);return s}return s+"/"+a}function Ht(s,a){G[s>>2]=a.dev,G[s+4>>2]=a.mode,G[s+8>>2]=a.nlink,G[s+12>>2]=a.uid,G[s+16>>2]=a.gid,G[s+20>>2]=a.rdev,_e[s+24>>3]=BigInt(a.size),z[s+32>>2]=4096,z[s+36>>2]=a.blocks;var l=a.atime.getTime(),p=a.mtime.getTime(),g=a.ctime.getTime();return _e[s+40>>3]=BigInt(Math.floor(l/1e3)),G[s+48>>2]=l%1e3*1e6,_e[s+56>>3]=BigInt(Math.floor(p/1e3)),G[s+64>>2]=p%1e3*1e6,_e[s+72>>3]=BigInt(Math.floor(g/1e3)),G[s+80>>2]=g%1e3*1e6,_e[s+88>>3]=BigInt(a.ino),0}var Bt=void 0,Jt=()=>{var s=z[+Bt>>2];return Bt+=4,s},Uo=0,Li=[0,31,60,91,121,152,182,213,244,274,305,335],Gi=[0,31,59,90,120,151,181,212,243,273,304,334],Mt={},Vn=s=>{q=s,Ne||0<Uo||(r.onExit?.(s),T=!0),m(s,new ge(s))},Wi=s=>{if(!T)try{s()}catch(a){a instanceof ge||a=="unwind"||m(1,a)}finally{if(!(Ne||0<Uo))try{q=s=q,Vn(s)}catch(a){a instanceof ge||a=="unwind"||m(1,a)}}},Io={},Hn=()=>{if(!No){var s={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:(globalThis.navigator?.language??"C").replace("-","_")+".UTF-8",_:f||"./this.program"},a;for(a in Io)Io[a]===void 0?delete s[a]:s[a]=Io[a];var l=[];for(a in s)l.push(`${a}=${s[a]}`);No=l}return No},No,zi=(s,a,l,p)=>{var g={string:N=>{var te=0;if(N!=null&&N!==0){te=gt(N)+1;var fe=rt(te);je(N,j,fe,te),te=fe}return te},array:N=>{var te=rt(N.length);return D.set(N,te),te}};s=r["_"+s];var _=[],S=0;if(p)for(var $=0;$<p.length;$++){var B=g[l[$]];B?(S===0&&(S=Xt()),_[$]=B(p[$])):_[$]=p[$]}return l=s(..._),l=(function(N){return S!==0&&Qt(S),a==="string"?X(N):a==="boolean"?!!N:N})(l)},Kt=s=>{var a=gt(s)+1,l=Yt(a);return l&&je(s,j,l,a),l},it,qo=[],Ye=s=>{it.delete(Qe.get(s)),Qe.set(s,null),qo.push(s)},Bn=s=>{let a=s.length;return[a%128|128,a>>7,...s]},Vi={i:127,p:127,j:126,f:125,d:124,e:111},Jn=s=>Bn(Array.from(s,a=>Vi[a])),At=(s,a)=>{if(!it){it=new WeakMap;var l=Qe.length;if(it)for(var p=0;p<0+l;p++){var g=Qe.get(p);g&&it.set(g,p)}}if(l=it.get(s)||0)return l;l=qo.length?qo.pop():Qe.grow(1);try{Qe.set(l,s)}catch(_){if(!(_ instanceof TypeError))throw _;a=Uint8Array.of(0,97,115,109,1,0,0,0,1,...Bn([1,96,...Jn(a.slice(1)),...Jn(a[0]==="v"?"":a[0])]),2,7,1,1,101,1,102,0,0,7,5,1,1,102,0,0),a=new WebAssembly.Module(a),a=new WebAssembly.Instance(a,{e:{f:s}}).exports.f,Qe.set(l,a)}return it.set(s,l),l};if(Je=Array(4096),In(F,"/"),Le("/tmp"),Le("/home"),Le("/home/web_user"),(function(){Le("/dev"),Do(259,{read:()=>0,write:(p,g,_,S)=>S,Va:()=>0}),zt("/dev/null",259),Mn(1280,Ri),Mn(1536,Di),zt("/dev/tty",1280),zt("/dev/tty1",1536);var s=new Uint8Array(1024),a=0,l=()=>(a===0&&(Lt(s),a=s.byteLength),s[--a]);Ke("random",l),Ke("urandom",l),Le("/dev/shm"),Le("/dev/shm/tmp")})(),(function(){Le("/proc");var s=Le("/proc/self");Le("/proc/self/fd"),In({Xa(){var a=Dn(s,"fd",16895,73);return a.Ma={Va:F.Ma.Va},a.La={lookup(l,p){l=+p;var g=we(l);return l={parent:null,Xa:{Db:"fake"},La:{readlink:()=>g.path},id:l+1},l.parent=l},readdir(){return Array.from(yt.entries()).filter(([,l])=>l).map(([l])=>l.toString())}},a}},"/proc/self/fd")})(),r.noExitRuntime&&(Ne=r.noExitRuntime),r.print&&(v=r.print),r.printErr&&(x=r.printErr),r.wasmBinary&&(A=r.wasmBinary),r.thisProgram&&(f=r.thisProgram),r.preInit)for(typeof r.preInit=="function"&&(r.preInit=[r.preInit]);0<r.preInit.length;)r.preInit.shift()();r.stackSave=()=>Xt(),r.stackRestore=s=>Qt(s),r.stackAlloc=s=>rt(s),r.cwrap=(s,a,l,p)=>{var g=!l||l.every(_=>_==="number"||_==="boolean");return a!=="string"&&g&&!p?r["_"+s]:(..._)=>zi(s,a,l,_)},r.addFunction=At,r.removeFunction=Ye,r.UTF8ToString=X,r.stringToNewUTF8=Kt,r.writeArrayToMemory=(s,a)=>{D.set(s,a)};var Yt,Ot,Kn,Yn,Qt,rt,Xt,Zt,Qe,Hi={a:(s,a,l,p)=>xe(`Assertion failed: ${X(s)}, at: `+[a?X(a):"unknown filename",l,p?X(p):"unknown function"]),i:function(s,a){try{return s=X(s),Vt(s,a),0}catch(l){if(typeof ee>"u"||l.name!=="ErrnoError")throw l;return-l.Pa}},L:function(s,a,l){try{if(a=X(a),a=st(s,a),l&-8)return-28;var p=Me(a,{ab:!0}).node;return p?(s="",l&4&&(s+="r"),l&2&&(s+="w"),l&1&&(s+="x"),s&&bt(p,s)?-2:0):-44}catch(g){if(typeof ee>"u"||g.name!=="ErrnoError")throw g;return-g.Pa}},j:function(s,a){try{var l=we(s);return jn(l,l.node,a,!1),0}catch(p){if(typeof ee>"u"||p.name!=="ErrnoError")throw p;return-p.Pa}},h:function(s){try{var a=we(s);return Ro(a,a.node,{timestamp:Date.now(),Lb:!1}),0}catch(l){if(typeof ee>"u"||l.name!=="ErrnoError")throw l;return-l.Pa}},b:function(s,a,l){Bt=l;try{var p=we(s);switch(a){case 0:var g=Jt();if(0>g)break;for(;yt[g];)g++;return Ii(p,g).fd;case 1:case 2:return 0;case 3:return p.flags;case 4:return g=Jt(),p.flags|=g,0;case 12:return g=Jt(),ve[g+0>>1]=2,0;case 13:case 14:return 0}return-28}catch(_){if(typeof ee>"u"||_.name!=="ErrnoError")throw _;return-_.Pa}},g:function(s,a){try{var l=we(s),p=l.node,g=l.Ma.Ta;s=g?l:p,g??=p.La.Ta,Gt(g);var _=g(s);return Ht(a,_)}catch(S){if(typeof ee>"u"||S.name!=="ErrnoError")throw S;return-S.Pa}},H:function(s,a){a=-9007199254740992>a||9007199254740992<a?NaN:Number(a);try{if(isNaN(a))return-61;var l=we(s);if(0>a||(l.flags&2097155)===0)throw new M(28);return Ln(l,l.node,a),0}catch(p){if(typeof ee>"u"||p.name!=="ErrnoError")throw p;return-p.Pa}},G:function(s,a){try{if(a===0)return-28;var l=gt("/")+1;return a<l?-68:(je("/",j,s,a),l)}catch(p){if(typeof ee>"u"||p.name!=="ErrnoError")throw p;return-p.Pa}},K:function(s,a){try{return s=X(s),Ht(a,Tt(s,!0))}catch(l){if(typeof ee>"u"||l.name!=="ErrnoError")throw l;return-l.Pa}},C:function(s,a,l){try{return a=X(a),a=st(s,a),Le(a,l),0}catch(p){if(typeof ee>"u"||p.name!=="ErrnoError")throw p;return-p.Pa}},J:function(s,a,l,p){try{a=X(a);var g=p&256;return a=st(s,a,p&4096),Ht(l,g?Tt(a,!0):Tt(a))}catch(_){if(typeof ee>"u"||_.name!=="ErrnoError")throw _;return-_.Pa}},x:function(s,a,l,p){Bt=p;try{a=X(a),a=st(s,a);var g=p?Jt():0;return _t(a,l,g).fd}catch(_){if(typeof ee>"u"||_.name!=="ErrnoError")throw _;return-_.Pa}},v:function(s,a,l,p){try{if(a=X(a),a=st(s,a),0>=p)return-28;var g=Me(a).node;if(!g)throw new M(44);if(!g.La.readlink)throw new M(28);var _=g.La.readlink(g),S=Math.min(p,gt(_)),$=D[l+S];return je(_,j,l,p+1),D[l+S]=$,S}catch(B){if(typeof ee>"u"||B.name!=="ErrnoError")throw B;return-B.Pa}},u:function(s){try{return s=X(s),Nn(s),0}catch(a){if(typeof ee>"u"||a.name!=="ErrnoError")throw a;return-a.Pa}},f:function(s,a){try{return s=X(s),Ht(a,Tt(s))}catch(l){if(typeof ee>"u"||l.name!=="ErrnoError")throw l;return-l.Pa}},r:function(s,a,l){try{if(a=X(a),a=st(s,a),l)if(l===512)Nn(a);else return-28;else qn(a);return 0}catch(p){if(typeof ee>"u"||p.name!=="ErrnoError")throw p;return-p.Pa}},q:function(s,a,l){try{a=X(a),a=st(s,a,!0);var p=Date.now(),g,_;if(l){var S=G[l>>2]+4294967296*z[l+4>>2],$=z[l+8>>2];$==1073741823?g=p:$==1073741822?g=null:g=1e3*S+$/1e6,l+=16,S=G[l>>2]+4294967296*z[l+4>>2],$=z[l+8>>2],$==1073741823?_=p:$==1073741822?_=null:_=1e3*S+$/1e6}else _=g=p;if((_??g)!==null){s=g;var B=Me(a,{ab:!0}).node;Gt(B.La.Ua)(B,{atime:s,mtime:_})}return 0}catch(N){if(typeof ee>"u"||N.name!=="ErrnoError")throw N;return-N.Pa}},m:()=>xe(""),l:()=>{Ne=!1,Uo=0},A:function(s,a){s=-9007199254740992>s||9007199254740992<s?NaN:Number(s),s=new Date(1e3*s),z[a>>2]=s.getSeconds(),z[a+4>>2]=s.getMinutes(),z[a+8>>2]=s.getHours(),z[a+12>>2]=s.getDate(),z[a+16>>2]=s.getMonth(),z[a+20>>2]=s.getFullYear()-1900,z[a+24>>2]=s.getDay();var l=s.getFullYear();z[a+28>>2]=(l%4!==0||l%100===0&&l%400!==0?Gi:Li)[s.getMonth()]+s.getDate()-1|0,z[a+36>>2]=-(60*s.getTimezoneOffset()),l=new Date(s.getFullYear(),6,1).getTimezoneOffset();var p=new Date(s.getFullYear(),0,1).getTimezoneOffset();z[a+32>>2]=(l!=p&&s.getTimezoneOffset()==Math.min(p,l))|0},y:function(s,a,l,p,g,_,S){g=-9007199254740992>g||9007199254740992<g?NaN:Number(g);try{var $=we(p);if((a&2)!==0&&(l&2)===0&&($.flags&2097155)!==2)throw new M(2);if(($.flags&2097155)===1)throw new M(2);if(!$.Ma.jb)throw new M(43);if(!s)throw new M(28);var B=$.Ma.jb($,s,g,a,l),N=B.Xb;return z[_>>2]=B.Eb,G[S>>2]=N,0}catch(te){if(typeof ee>"u"||te.name!=="ErrnoError")throw te;return-te.Pa}},z:function(s,a,l,p,g,_){_=-9007199254740992>_||9007199254740992<_?NaN:Number(_);try{var S=we(g);if(l&2){if(l=_,(S.node.mode&61440)!==32768)throw new M(43);if(!(p&2)){var $=j.slice(s,s+a);S.Ma.kb&&S.Ma.kb(S,$,l,a,p)}}}catch(B){if(typeof ee>"u"||B.name!=="ErrnoError")throw B;return-B.Pa}},n:(s,a)=>{if(Mt[s]&&(clearTimeout(Mt[s].id),delete Mt[s]),!a)return 0;var l=setTimeout(()=>{delete Mt[s],Wi(()=>Yn(s,performance.now()))},a);return Mt[s]={id:l,lc:a},0},B:(s,a,l,p)=>{var g=new Date().getFullYear(),_=new Date(g,0,1).getTimezoneOffset();g=new Date(g,6,1).getTimezoneOffset(),G[s>>2]=60*Math.max(_,g),z[a>>2]=+(_!=g),a=S=>{var $=Math.abs(S);return`UTC${0<=S?"-":"+"}${String(Math.floor($/60)).padStart(2,"0")}${String($%60).padStart(2,"0")}`},s=a(_),a=a(g),g<_?(je(s,j,l,17),je(a,j,p,17)):(je(s,j,p,17),je(a,j,l,17))},d:()=>Date.now(),s:()=>2147483648,c:()=>performance.now(),o:s=>{var a=j.length;if(s>>>=0,2147483648<s)return!1;for(var l=1;4>=l;l*=2){var p=a*(1+.2/l);p=Math.min(p,s+100663296);e:{p=(Math.min(2147483648,65536*Math.ceil(Math.max(s,p)/65536))-Zt.buffer.byteLength+65535)/65536|0;try{Zt.grow(p),He();var g=1;break e}catch{}g=void 0}if(g)return!0}return!1},E:(s,a)=>{var l=0,p=0,g;for(g of Hn()){var _=a+l;G[s+p>>2]=_,l+=je(g,j,_,1/0)+1,p+=4}return 0},F:(s,a)=>{var l=Hn();G[s>>2]=l.length,s=0;for(var p of l)s+=gt(p)+1;return G[a>>2]=s,0},e:function(s){try{var a=we(s);return Fo(a),0}catch(l){if(typeof ee>"u"||l.name!=="ErrnoError")throw l;return l.Pa}},p:function(s,a){try{var l=we(s);return D[a]=l.tty?2:ke(l.mode)?3:(l.mode&61440)===40960?7:4,ve[a+2>>1]=0,_e[a+8>>3]=BigInt(0),_e[a+16>>3]=BigInt(0),0}catch(p){if(typeof ee>"u"||p.name!=="ErrnoError")throw p;return p.Pa}},w:function(s,a,l,p){try{e:{var g=we(s);s=a;for(var _,S=a=0;S<l;S++){var $=G[s>>2],B=G[s+4>>2];s+=8;var N=Wn(g,D,$,B,_);if(0>N){var te=-1;break e}if(a+=N,N<B)break;typeof _<"u"&&(_+=N)}te=a}return G[p>>2]=te,0}catch(fe){if(typeof ee>"u"||fe.name!=="ErrnoError")throw fe;return fe.Pa}},D:function(s,a,l,p){a=-9007199254740992>a||9007199254740992<a?NaN:Number(a);try{if(isNaN(a))return 61;var g=we(s);return Gn(g,a,l),_e[p>>3]=BigInt(g.position),g.rb&&a===0&&l===0&&(g.rb=null),0}catch(_){if(typeof ee>"u"||_.name!=="ErrnoError")throw _;return _.Pa}},I:function(s){try{var a=we(s);return a.Ma?.fsync?.(a)}catch(l){if(typeof ee>"u"||l.name!=="ErrnoError")throw l;return l.Pa}},t:function(s,a,l,p){try{e:{var g=we(s);s=a;for(var _,S=a=0;S<l;S++){var $=G[s>>2],B=G[s+4>>2];s+=8;var N=zn(g,D,$,B,_);if(0>N){var te=-1;break e}if(a+=N,N<B)break;typeof _<"u"&&(_+=N)}te=a}return G[p>>2]=te,0}catch(fe){if(typeof ee>"u"||fe.name!=="ErrnoError")throw fe;return fe.Pa}},k:Vn};function jo(){function s(){if(r.calledRun=!0,!T){if(!r.noFSInit&&!En){var a,l;En=!0,a??=r.stdin,l??=r.stdout,p??=r.stderr,a?Ke("stdin",a):$o("/dev/tty","/dev/stdin"),l?Ke("stdout",null,l):$o("/dev/tty","/dev/stdout"),p?Ke("stderr",null,p):$o("/dev/tty1","/dev/stderr"),_t("/dev/stdin",0),_t("/dev/stdout",1),_t("/dev/stderr",1)}if(Lo.N(),Rn=!1,r.onRuntimeInitialized?.(),r.postRun)for(typeof r.postRun=="function"&&(r.postRun=[r.postRun]);r.postRun.length;){var p=r.postRun.shift();tt.push(p)}xt(tt)}}if(0<ie)Ue=jo;else{if(r.preRun)for(typeof r.preRun=="function"&&(r.preRun=[r.preRun]);r.preRun.length;)Be();xt(Fe),0<ie?Ue=jo:r.setStatus?(r.setStatus("Running..."),setTimeout(()=>{setTimeout(()=>r.setStatus(""),1),s()},1)):s()}}var Lo;return(async function(){function s(l){return l=Lo=l.exports,r._sqlite3_free=l.P,r._sqlite3_value_text=l.Q,r._sqlite3_prepare_v2=l.R,r._sqlite3_step=l.S,r._sqlite3_reset=l.T,r._sqlite3_exec=l.U,r._sqlite3_finalize=l.V,r._sqlite3_column_name=l.W,r._sqlite3_column_text=l.X,r._sqlite3_column_type=l.Y,r._sqlite3_errmsg=l.Z,r._sqlite3_clear_bindings=l._,r._sqlite3_value_blob=l.$,r._sqlite3_value_bytes=l.aa,r._sqlite3_value_double=l.ba,r._sqlite3_value_int=l.ca,r._sqlite3_value_type=l.da,r._sqlite3_result_blob=l.ea,r._sqlite3_result_double=l.fa,r._sqlite3_result_error=l.ga,r._sqlite3_result_int=l.ha,r._sqlite3_result_int64=l.ia,r._sqlite3_result_null=l.ja,r._sqlite3_result_text=l.ka,r._sqlite3_aggregate_context=l.la,r._sqlite3_column_count=l.ma,r._sqlite3_data_count=l.na,r._sqlite3_column_blob=l.oa,r._sqlite3_column_bytes=l.pa,r._sqlite3_column_double=l.qa,r._sqlite3_bind_blob=l.ra,r._sqlite3_bind_double=l.sa,r._sqlite3_bind_int=l.ta,r._sqlite3_bind_text=l.ua,r._sqlite3_bind_parameter_index=l.va,r._sqlite3_sql=l.wa,r._sqlite3_normalized_sql=l.xa,r._sqlite3_changes=l.ya,r._sqlite3_close_v2=l.za,r._sqlite3_create_function_v2=l.Aa,r._sqlite3_update_hook=l.Ba,r._sqlite3_open=l.Ca,Yt=r._malloc=l.Da,Ot=r._free=l.Ea,r._RegisterExtensionFunctions=l.Fa,Kn=l.Ga,Yn=l.Ha,Qt=l.Ia,rt=l.Ja,Xt=l.Ka,Zt=l.M,Qe=l.O,He(),ie--,r.monitorRunDependencies?.(ie),ie==0&&Ue&&(l=Ue,Ue=null,l()),Lo}ie++,r.monitorRunDependencies?.(ie);var a={a:Hi};return r.instantiateWasm?new Promise(l=>{r.instantiateWasm(a,(p,g)=>{l(s(p,g))})}):(Te??=r.locateFile?r.locateFile("sql-wasm.wasm",y):y+"sql-wasm.wasm",s((await Ce(a)).instance))})(),jo(),n}),po)};typeof ho=="object"&&typeof ct=="object"?(ct.exports=mo,ct.exports.default=mo):typeof define=="function"&&define.amd?define([],function(){return mo}):typeof ho=="object"&&(ho.Module=mo)});var Ai=ce((Zl,Oa)=>{Oa.exports={name:"@rajbos/ai-engineering-fluency",version:"0.0.1",description:"AI Engineering Fluency - CLI tool to analyze GitHub Copilot token usage from local session files",license:"MIT",author:"RobBos",repository:{type:"git",url:"https://github.com/rajbos/github-copilot-token-usage",directory:"cli"},keywords:["github-copilot","token-usage","copilot","cli","token-tracker"],bin:{"copilot-token-tracker":"./dist/cli.js"},files:["dist/**/*"],scripts:{build:"node esbuild.js","build:production":"node esbuild.js --production",lint:"eslint src","check-types":"tsc --noEmit",test:"node dist/cli.js --help && node dist/cli.js --version"},devDependencies:{commander:"^13.1.0",chalk:"^4.1.2",esbuild:"^0.25.0",typescript:"^5.7.3","@types/node":"^22.12.0","sql.js":"^1.12.0"},engines:{node:">=18.0.0"}}});var _s=ye(bs(),1),{program:ja,createCommand:La,createArgument:Ga,createOption:Wa,CommanderError:za,InvalidArgumentError:Va,InvalidOptionArgumentError:Ha,Command:Ee,Argument:Ba,Option:Ja,Help:Ka}=_s.default;var ne=ye(lt());var So=ye(require("fs")),di=ye(lt());var Xs={getConfiguration:()=>({get:()=>{}})},yn={getExtension:()=>{}},$t=class i{fsPath;scheme;path;constructor(e){this.fsPath=e,this.scheme="file",this.path=e}static file(e){return new i(e)}static joinPath(e,...t){let n=[e.fsPath,...t].join("/");return new i(n)}toString(){return this.fsPath}};var K=ye(require("fs")),W=ye(require("path")),Ze=ye(require("os")),uo=class i{deps;_sessionFilesCache=null;_sessionFilesCacheTime=0;static SESSION_FILES_CACHE_TTL=6e4;constructor(e){this.deps=e}clearCache(){this._sessionFilesCache=null,this._sessionFilesCacheTime=0}getVSCodeUserPaths(){let e=Ze.platform(),t=Ze.homedir(),n=[],o=["Code","Code - Insiders","Code - Exploration","VSCodium","Cursor"];if(e==="win32"){let c=process.env.APPDATA||W.join(t,"AppData","Roaming");for(let u of o)n.push(W.join(c,u,"User"))}else if(e==="darwin")for(let c of o)n.push(W.join(t,"Library","Application Support",c,"User"));else{let c=process.env.XDG_CONFIG_HOME||W.join(t,".config");for(let u of o)n.push(W.join(c,u,"User"))}let r=[W.join(t,".vscode-server","data","User"),W.join(t,".vscode-server-insiders","data","User"),W.join(t,".vscode-remote","data","User"),W.join("/tmp",".vscode-server","data","User"),W.join("/workspace",".vscode-server","data","User")];return n.push(...r),n}getDiagnosticCandidatePaths(){let e=[],t=this.getVSCodeUserPaths();for(let m of t){let h=!1;try{h=K.existsSync(m)}catch{}e.push({path:m,exists:h,source:"VS Code"})}let n=W.join(Ze.homedir(),".copilot","session-state"),o=!1;try{o=K.existsSync(n)}catch{}e.push({path:n,exists:o,source:"Copilot CLI"});let r=this.deps.openCode.getOpenCodeDataDir(),c=W.join(r,"storage","session"),u=!1;try{u=K.existsSync(c)}catch{}e.push({path:c,exists:u,source:"OpenCode (JSON)"});let d=W.join(r,"opencode.db"),f=!1;try{f=K.existsSync(d)}catch{}return e.push({path:d,exists:f,source:"OpenCode (DB)"}),e}checkCopilotExtension(){let e=yn.getExtension("GitHub.copilot"),t=yn.getExtension("GitHub.copilot-chat");if(!e&&!t)this.deps.log("\u26A0\uFE0F GitHub Copilot extensions not found");else{let o=e?e.isActive?"\u2705 Active":"\u23F3 Loading":"\u274C Not found",r=t?t.isActive?"\u2705 Active":"\u23F3 Loading":"\u274C Not found";this.deps.log(`GitHub Copilot: ${o}, Chat: ${r}`)}process.env.CODESPACES==="true"&&(!e?.isActive||!t?.isActive)&&this.deps.warn("\u26A0\uFE0F Running in Codespaces with inactive Copilot extensions")}async getCopilotSessionFiles(){let e=Date.now();if(this._sessionFilesCache&&e-this._sessionFilesCacheTime<i.SESSION_FILES_CACHE_TTL)return this.deps.log(`\u{1F4A8} Using cached session files list (${this._sessionFilesCache.length} files, cached ${Math.round((e-this._sessionFilesCacheTime)/1e3)}s ago)`),this._sessionFilesCache;let t=Xs.getConfiguration("copilot-token-tracker").get("sampleDataDirectory");if(t&&t.trim().length>0){let d=t.trim();try{if(K.existsSync(d)){let f=K.readdirSync(d).filter(m=>m.endsWith(".json")||m.endsWith(".jsonl")).map(m=>W.join(d,m));return this.deps.log(`\u{1F4F8} Sample data mode: using ${f.length} file(s) from ${d}`),this._sessionFilesCache=f,this._sessionFilesCacheTime=e,f}else this.deps.warn(`Sample data directory not found: ${d}`)}catch(f){this.deps.warn(`Error reading sample data directory: ${f}`)}}let n=[],o=Ze.platform(),r=Ze.homedir();this.deps.log(`\u{1F50D} Searching for Copilot session files on ${o}`);let c=this.getVSCodeUserPaths();this.deps.log(`\u{1F4C2} Considering ${c.length} candidate VS Code paths:`);for(let d of c)this.deps.log(` \u{1F4C1} ${d}`);let u=[];for(let d=0;d<c.length;d++){let f=c[d];try{K.existsSync(f)&&u.push(f)}catch(m){this.deps.warn(`Could not check path ${f}: ${m}`)}((d+1)%5===0||d===c.length-1)&&this.deps.log(`\u{1F4C2} Reading local folders [${d+1}/${c.length}]`)}this.deps.log(`\u2705 Found ${u.length} of ${c.length} VS Code paths exist on disk:`);for(let d of u)this.deps.log(` \u2705 ${d}`);try{for(let y=0;y<u.length;y++){let C=u[y],w=W.basename(W.dirname(C)),k=W.join(C,"workspaceStorage");try{if(K.existsSync(k))try{let A=K.readdirSync(k);for(let T of A){let q=W.join(k,T,"chatSessions");try{if(K.existsSync(q))try{let I=K.readdirSync(q).filter(D=>D.endsWith(".json")||D.endsWith(".jsonl")).map(D=>W.join(q,D));I.length>0&&(this.deps.log(`\u{1F4C4} Found ${I.length} session files in ${w}/workspaceStorage/${T}`),n.push(...I))}catch(I){this.deps.warn(`Could not read chat sessions in ${q}: ${I}`)}}catch(I){this.deps.warn(`Could not check chat sessions path ${q}: ${I}`)}}}catch(A){this.deps.warn(`Could not read workspace storage in ${k}: ${A}`)}}catch(A){this.deps.warn(`Could not check workspace storage path ${k}: ${A}`)}let v=W.join(C,"globalStorage","emptyWindowChatSessions");try{if(K.existsSync(v))try{let A=K.readdirSync(v).filter(T=>T.endsWith(".json")||T.endsWith(".jsonl")).map(T=>W.join(v,T));A.length>0&&(this.deps.log(`\u{1F4C4} Found ${A.length} session files in ${w}/globalStorage/emptyWindowChatSessions`),n.push(...A))}catch(A){this.deps.warn(`Could not read global storage in ${v}: ${A}`)}}catch(A){this.deps.warn(`Could not check global storage path ${v}: ${A}`)}let x=W.join(C,"globalStorage","github.copilot-chat");try{K.existsSync(x)&&(this.deps.log(`\u{1F4C4} Scanning ${w}/globalStorage/github.copilot-chat`),this.scanDirectoryForSessionFiles(x,n))}catch(A){this.deps.warn(`Could not check Copilot Chat global storage path ${x}: ${A}`)}}let d=W.join(Ze.homedir(),".copilot","session-state");this.deps.log(`\u{1F4C1} Checking Copilot CLI path: ${d} (exists: ${K.existsSync(d)})`);try{if(K.existsSync(d))try{let y=K.readdirSync(d,{withFileTypes:!0}),C=y.filter(v=>!v.isDirectory()&&(v.name.endsWith(".json")||v.name.endsWith(".jsonl"))).map(v=>W.join(d,v.name));C.length>0&&(this.deps.log(`\u{1F4C4} Found ${C.length} session files in Copilot CLI directory`),n.push(...C));let w=y.filter(v=>v.isDirectory()),k=0;for(let v of w){let x=W.join(d,v.name,"events.jsonl");try{K.existsSync(x)&&K.statSync(x).size>0&&(n.push(x),k++)}catch{}}k>0&&this.deps.log(`\u{1F4C4} Found ${k} session files in Copilot CLI subdirectories`)}catch(y){this.deps.warn(`Could not read Copilot CLI session path in ${d}: ${y}`)}}catch(y){this.deps.warn(`Could not check Copilot CLI session path ${d}: ${y}`)}let f=this.deps.openCode.getOpenCodeDataDir(),m=W.join(f,"storage","session"),h=W.join(f,"opencode.db");this.deps.log(`\u{1F4C1} Checking OpenCode JSON path: ${m} (exists: ${K.existsSync(m)})`),this.deps.log(`\u{1F4C1} Checking OpenCode DB path: ${h} (exists: ${K.existsSync(h)})`);try{if(K.existsSync(m)){let y=w=>{try{let k=K.readdirSync(w,{withFileTypes:!0});for(let v of k)if(v.isDirectory())y(W.join(w,v.name));else if(v.name.startsWith("ses_")&&v.name.endsWith(".json")){let x=W.join(w,v.name);try{K.statSync(x).size>0&&n.push(x)}catch{}}}catch{}};y(m);let C=n.length-n.filter(w=>!this.deps.openCode.isOpenCodeSessionFile(w)).length;C>0&&this.deps.log(`\u{1F4C4} Found ${C} session files in OpenCode storage`)}}catch(y){this.deps.warn(`Could not check OpenCode session path: ${y}`)}try{if(K.existsSync(h)){let y=new Set(n.filter(k=>this.deps.openCode.isOpenCodeSessionFile(k)).map(k=>this.deps.openCode.getOpenCodeSessionId(k)).filter(Boolean)),C=await this.deps.openCode.discoverOpenCodeDbSessions(),w=0;for(let k of C)y.has(k)||(n.push(W.join(f,`opencode.db#${k}`)),w++);w>0&&this.deps.log(`\u{1F4C4} Found ${w} additional session(s) in OpenCode database`)}}catch(y){this.deps.warn(`Could not read OpenCode database: ${y}`)}this.deps.log(`\u2728 Total: ${n.length} session file(s) discovered`),n.length===0&&this.deps.warn("\u26A0\uFE0F No session files found - Have you used GitHub Copilot Chat yet?"),this._sessionFilesCache=n,this._sessionFilesCacheTime=Date.now()}catch(d){this.deps.error("Error getting session files:",d)}return n}scanDirectoryForSessionFiles(e,t){try{let n=K.readdirSync(e,{withFileTypes:!0});for(let o of n){let r=W.join(e,o.name);if(o.isDirectory())this.scanDirectoryForSessionFiles(r,t);else if(o.name.endsWith(".json")||o.name.endsWith(".jsonl")){if(this.isNonSessionFile(o.name))continue;try{K.statSync(r).size>0&&t.push(r)}catch{}}}}catch(n){this.deps.warn(`Could not scan directory ${e}: ${n}`)}}isNonSessionFile(e){let t=["embeddings","index","cache","preferences","settings","config","workspacesessions","globalsessions","api.json"],n=e.toLowerCase();return t.some(o=>n.includes(o))}};var se=ye(require("fs")),be=ye(require("path")),go=ye(require("os")),ei=ye(Zs()),fo=class{_sqlJsModule=null;extensionUri;constructor(e){this.extensionUri=e}getOpenCodeDataDir(){let e=go.platform(),t=go.homedir();if(e==="win32")return be.join(t,".local","share","opencode");let n=process.env.XDG_DATA_HOME||be.join(t,".local","share");return be.join(n,"opencode")}isOpenCodeSessionFile(e){let t=e.toLowerCase().replace(/\\/g,"/");return t.includes("/opencode/storage/session/")||t.includes("/opencode/opencode.db#ses_")}isOpenCodeDbSession(e){return e.includes("opencode.db#ses_")}async initSqlJs(){if(this._sqlJsModule)return this._sqlJsModule;let e=be.join(__dirname,"sql-wasm.wasm"),t;return se.existsSync(e)&&(t=se.readFileSync(e)),this._sqlJsModule=await(0,ei.default)(t?{wasmBinary:t}:void 0),this._sqlJsModule}async readOpenCodeDbSession(e){let t=be.join(this.getOpenCodeDataDir(),"opencode.db");if(!se.existsSync(t))return null;try{let n=await this.initSqlJs(),o=se.readFileSync(t),r=new n.Database(o);try{let c=r.exec("SELECT id, slug, title, time_created, time_updated, project_id, directory FROM session WHERE id = ?",[e]);if(c.length===0||c[0].values.length===0)return null;let u=c[0].values[0],d=c[0].columns,f={};for(let m=0;m<d.length;m++)f[d[m]]=u[m];return{id:f.id,slug:f.slug,title:f.title,projectID:f.project_id,directory:f.directory,time:{created:f.time_created,updated:f.time_updated}}}finally{r.close()}}catch{return null}}async readOpenCodeDbMessages(e){let t=be.join(this.getOpenCodeDataDir(),"opencode.db");if(!se.existsSync(t))return[];try{let n=await this.initSqlJs(),o=se.readFileSync(t),r=new n.Database(o);try{let c=r.exec("SELECT id, data, time_created FROM message WHERE session_id = ? ORDER BY time_created ASC",[e]);return c.length===0?[]:c[0].values.map(u=>{let d=JSON.parse(u[1]);return d.id=u[0],d.time=d.time||{},d.time.created=d.time.created||u[2],d})}finally{r.close()}}catch{return[]}}async readOpenCodeDbParts(e){let t=be.join(this.getOpenCodeDataDir(),"opencode.db");if(!se.existsSync(t))return[];try{let n=await this.initSqlJs(),o=se.readFileSync(t),r=new n.Database(o);try{let c=r.exec("SELECT id, data, time_created FROM part WHERE message_id = ? ORDER BY time_created ASC",[e]);return c.length===0?[]:c[0].values.map(u=>{let d=JSON.parse(u[1]);return d.id=u[0],d.time=d.time||{},d.time.created=d.time.created||u[2],d})}finally{r.close()}}catch{return[]}}async discoverOpenCodeDbSessions(){let e=be.join(this.getOpenCodeDataDir(),"opencode.db");if(!se.existsSync(e))return[];try{let t=await this.initSqlJs(),n=se.readFileSync(e),o=new t.Database(n);try{let r=o.exec("SELECT id FROM session");return r.length===0?[]:r[0].values.map(c=>c[0])}finally{o.close()}}catch{return[]}}async statSessionFile(e){if(this.isOpenCodeDbSession(e)){let t=be.join(this.getOpenCodeDataDir(),"opencode.db");return se.promises.stat(t)}return se.promises.stat(e)}readOpenCodeMessages(e){let t=this.getOpenCodeDataDir(),n=be.join(t,"storage","message",e),o=[];try{if(!se.existsSync(n))return o;let r=se.readdirSync(n,{withFileTypes:!0});for(let c of r)if(!(!c.isFile()||!c.name.endsWith(".json")))try{let u=se.readFileSync(be.join(n,c.name),"utf8"),d=JSON.parse(u);o.push(d)}catch{}}catch{}return o.sort((r,c)=>(r.time?.created||0)-(c.time?.created||0)),o}readOpenCodeParts(e){let t=this.getOpenCodeDataDir(),n=be.join(t,"storage","part",e),o=[];try{if(!se.existsSync(n))return o;let r=se.readdirSync(n,{withFileTypes:!0});for(let c of r)if(!(!c.isFile()||!c.name.endsWith(".json")))try{let u=se.readFileSync(be.join(n,c.name),"utf8"),d=JSON.parse(u);o.push(d)}catch{}}catch{}return o.sort((r,c)=>(r.time?.start||0)-(c.time?.start||0)),o}getOpenCodeSessionId(e){let t=e.indexOf("opencode.db#");if(t!==-1)return e.substring(t+12);let n=be.basename(e,".json");return n.startsWith("ses_")?n:null}async getOpenCodeMessagesForSession(e){let t=this.getOpenCodeSessionId(e);if(!t)return[];if(this.isOpenCodeDbSession(e))return this.readOpenCodeDbMessages(t);let n=await this.readOpenCodeDbMessages(t);return n.length>0?n:this.readOpenCodeMessages(t)}async getOpenCodePartsForMessage(e){let t=await this.readOpenCodeDbParts(e);return t.length>0?t:this.readOpenCodeParts(e)}async getTokensFromOpenCodeSession(e){let t=await this.getOpenCodeMessagesForSession(e),n=0,o=0;for(let r of t)r.role==="assistant"&&r.tokens&&(typeof r.tokens.total=="number"&&(o=r.tokens.total),n+=r.tokens.reasoning||0);return{tokens:o,thinkingTokens:n}}async countOpenCodeInteractions(e){return(await this.getOpenCodeMessagesForSession(e)).filter(n=>n.role==="user").length}async getOpenCodeModelUsage(e){let t={},n=await this.getOpenCodeMessagesForSession(e),o=0;for(let r=0;r<n.length;r++){let c=n[r];if(c.role!=="user")continue;let u=n.filter((C,w)=>w>r&&C.role==="assistant"&&C.parentID===c.id);if(u.length===0)continue;let d=o;for(let C of u)typeof C.tokens?.total=="number"&&(d=Math.max(d,C.tokens.total));let f=d-o;if(f<=0){o=d;continue}let m=u[0].modelID||u[0].model?.modelID||"unknown";t[m]||(t[m]={inputTokens:0,outputTokens:0});let h=u.reduce((C,w)=>C+(w.tokens?.output||0)+(w.tokens?.reasoning||0),0),y=Math.max(0,f-h);t[m].inputTokens+=y,t[m].outputTokens+=h,o=d}return t}async getOpenCodeSessionData(e){let t=await this.getOpenCodeMessagesForSession(e),n=Date.now();t.length>0&&t[0].time_created&&(n=t[0].time_created);let{tokens:o}=await this.getTokensFromOpenCodeSession(e),r=await this.countOpenCodeInteractions(e),c=await this.getOpenCodeModelUsage(e),u={},d=0;for(let m=0;m<t.length;m++){let h=t[m];if(h.role!=="user")continue;let y=t.filter((w,k)=>k>m&&w.role==="assistant"&&w.parentID===h.id);if(y.length===0)continue;let C=y[0].modelID||y[0].model?.modelID||"unknown";u[C]=(u[C]||0)+1}let f={};for(let[m,h]of Object.entries(c))f[m]={...h,interactions:u[m]||0};return{tokens:o,interactions:r,modelUsage:f,timestamp:n}}};function Se(i){return typeof i=="object"&&i!==null}function da(i){return typeof i!="string"?!1:!["__proto__","prototype","constructor","hasOwnProperty"].includes(i)&&!i.startsWith("__")}function Ft(i){return/^\d+$/.test(i)}function _n(i,e){if(typeof i!="string")return e;let t=i.trim();return t?t.startsWith("copilot/")?t.substring(8):t:e}function pa(i,e){if(!Se(e))return i;let t=e.kind,n=e.k,o=e.v;if(t===0)return o;if(!Array.isArray(n)||n.length===0)return i;let r=n.map(String);for(let m of r)if(!da(m))return i;let c=Se(i)?i:Object.create(null),u=c,d=(m,h,y)=>{let C=Ft(y),w=m[h];return Se(w)||(w=C?[]:Object.create(null),m[h]=w),w};for(let m=0;m<r.length-1;m++){let h=r[m],y=r[m+1];if(Array.isArray(u)&&Ft(h)){let C=Number(h),w=u[C];Se(w)||(w=Ft(y)?[]:Object.create(null),u[C]=w),u=w;continue}if(!Se(u))return c;u=d(u,h,y)}let f=r[r.length-1];if(t===1)return Array.isArray(u)&&Ft(f)?(u[Number(f)]=o,c):(Se(u)&&Object.defineProperty(u,f,{value:o,writable:!0,enumerable:!0,configurable:!0}),c);if(t===2){let m;if(Array.isArray(u)&&Ft(f)){let h=Number(f);Array.isArray(u[h])||(u[h]=[]),m=u[h]}else Se(u)&&(Array.isArray(u[f])||Object.defineProperty(u,f,{value:[],writable:!0,enumerable:!0,configurable:!0}),m=u[f]);return Array.isArray(m)&&(Array.isArray(o)?m.push(...o):m.push(o)),c}return c}function ma(i){if(!Array.isArray(i))return{responseText:"",thinkingText:""};let e="",t="";for(let n of i){if(!Se(n))continue;if(n.kind==="thinking"){let c=n.value;typeof c=="string"&&c&&(t+=c);continue}let o=Se(n.content)?n.content.value:void 0,r=n.value;if(typeof o=="string"&&o){e+=o;continue}typeof r=="string"&&r&&(e+=r)}return{responseText:e,thinkingText:t}}function ti(i,e,t,n){let o={},r=0,c=0,u=0,d=0,f,m="gpt-4o",h=k=>typeof k=="string"&&k?k:m,y=(k,v)=>{let x=h(k);o[x]||(o[x]={inputTokens:0,outputTokens:0});let A=t(v,x);o[x].inputTokens+=A,c+=A},C=(k,v)=>{let x=h(k);o[x]||(o[x]={inputTokens:0,outputTokens:0});let A=t(v,x);o[x].outputTokens+=A,u+=A};if(i.endsWith(".jsonl")){let k=e.split(/\r?\n/).filter(x=>x.trim()),v=!1;if(k.length>0)try{let x=JSON.parse(k[0]);x&&typeof x.kind=="number"&&(v=!0)}catch{}if(v){let x=Object.create(null);for(let T of k)try{let q=JSON.parse(T);x=pa(x,q)}catch{}let A=Se(x)&&Array.isArray(x.requests)?x.requests:[];if(A.length>0){r=A.filter(T=>Se(T)&&Se(T.message)&&typeof T.message.text=="string"&&T.message.text.trim()).length;for(let T of A){if(!Se(T))continue;let q=_n(T.modelId??T.selectedModel?.identifier??T.model,m),I=n?n(T):void 0,D=_n(I,""),j=D&&D!==m?D:q,ve=T.message;Se(ve)&&typeof ve.text=="string"&&y(j,ve.text);let{responseText:z,thinkingText:G}=ma(T.response);z&&C(j,z),G&&(d+=t(G,j))}}return{tokens:c+u+d,interactions:r,modelUsage:o,thinkingTokens:d}}try{f=JSON.parse(e.trim())}catch{return{tokens:0,interactions:0,modelUsage:{},thinkingTokens:0}}}if(!f)try{f=JSON.parse(e)}catch{return{tokens:0,interactions:0,modelUsage:{},thinkingTokens:0}}let w=Array.isArray(f.requests)?f.requests:Array.isArray(f.history)?f.history:[];r=w.length;for(let k of w){let v=n?n(k):k?.model||m,x=_n(v,m);if(o[x]||(o[x]={inputTokens:0,outputTokens:0}),k?.message?.parts){for(let T of k.message.parts)if(typeof T?.text=="string"&&T.text){let q=t(T.text,x);o[x].inputTokens+=q,c+=q}}else if(typeof k?.message?.text=="string"){let T=t(k.message.text,x);o[x].inputTokens+=T,c+=T}let A=Array.isArray(k?.response)?k.response:Array.isArray(k?.responses)?k.responses:[];for(let T of A){if(T?.kind==="thinking"&&typeof T?.value=="string"&&T.value){d+=t(T.value,x);continue}if(typeof T?.value=="string"&&T.value){let q=t(T.value,x);o[x].outputTokens+=q,u+=q}if(T?.message?.parts){for(let q of T.message.parts)if(typeof q?.text=="string"&&q.text){let I=t(q.text,x);o[x].outputTokens+=I,u+=I}}}}return{tokens:c+u+d,interactions:r,modelUsage:o,thinkingTokens:d}}function pe(i,e="gpt-4",t={}){let n=.25;for(let[o,r]of Object.entries(t))if(e.includes(o)||e.includes(o.replace("-",""))){n=r;break}return Math.ceil(i.length*n)}function oi(i){let e=0,t=0,n=i.trim().split(`
34
- `),o={},r=!1,c=0,u=0;for(let m of n)if(m.trim())try{let h=JSON.parse(m);if(typeof h.kind=="number"&&(r=!0,o=Ut(o,h)),h.type==="session.shutdown"&&h.data?.modelMetrics)for(let y of Object.values(h.data.modelMetrics)){let C=y?.usage;C&&(u+=(typeof C.inputTokens=="number"?C.inputTokens:0)+(typeof C.outputTokens=="number"?C.outputTokens:0))}if(h.type==="user.message"&&h.data?.content||h.type==="assistant.message"&&h.data?.content?e+=pe(h.data.content):h.type==="tool.result"&&h.data?.output?e+=pe(h.data.output):h.content&&(e+=pe(h.content)),h.kind===2&&h.k?.[0]==="requests"&&Array.isArray(h.v))for(let y of h.v)y.message?.text&&(e+=pe(y.message.text));if(h.kind===2&&h.k?.includes("response")&&Array.isArray(h.v))for(let y of h.v){if(y.kind==="thinking"&&y.value){t+=pe(y.value);continue}y.value?e+=pe(y.value):y.kind==="markdownContent"&&y.content?.value&&(e+=pe(y.content.value))}}catch{c++}let d=0;if(r){let m=c>0?Cn(n):new Map,h=o.requests&&Array.isArray(o.requests)?o.requests:[],y=h.length;for(let C of m.keys())C+1>y&&(y=C+1);for(let C=0;C<y;C++){let w=h[C],k=!1;if(w?.result){let v=w.result;if(typeof v.promptTokens=="number"&&typeof v.outputTokens=="number")d+=v.promptTokens+v.outputTokens,k=!0;else if(v.metadata&&typeof v.metadata.promptTokens=="number"&&typeof v.metadata.outputTokens=="number")d+=v.metadata.promptTokens+v.metadata.outputTokens,k=!0;else if(v.usage){let x=v.usage,A=typeof x.promptTokens=="number"?x.promptTokens:0,T=typeof x.completionTokens=="number"?x.completionTokens:0;d+=A+T,k=!0}}if(!k){let v=m.get(C);v&&(d+=v.promptTokens+v.outputTokens)}}}let f=!r&&u>0?u:d;return{tokens:e+t,thinkingTokens:t,actualTokens:f}}function Cn(i){let e=new Map;for(let t of i){if(!t.includes('"result"'))continue;let n=t.match(/"k":\s*\["requests",\s*(\d+),\s*"result"\]/);if(!n)continue;let o=parseInt(n[1],10),r=t.match(/"promptTokens":(\d+)/),c=t.match(/"outputTokens":(\d+)/),u=t.match(/"completionTokens":(\d+)/);r&&(c||u)&&e.set(o,{promptTokens:parseInt(r[1],10),outputTokens:parseInt(c?.[1]||u[1],10)})}return e}function ut(i,e={}){if(i.modelId)return i.modelId.replace(/^copilot\//,"");if(i.result&&i.result.metadata&&i.result.metadata.modelId)return i.result.metadata.modelId.replace(/^copilot\//,"");if(i.result&&i.result.details){let t={};for(let[o,r]of Object.entries(e))if(r.displayNames)for(let c of r.displayNames)t[c]=o;let n=Object.keys(t).sort((o,r)=>r.length-o.length);for(let o of n)if(i.result.details.includes(o))return t[o]}return"gpt-4"}function dt(i){let e=i.trim();if(!e.includes(`
31
+ `],["r","\r"],["t"," "],["b","\b"],["f","\f"],["v","\v"],["0","\0"],["\\","\\"],["e","\x1B"],["a","\x07"]]);function Ws(i){let e=i[0]==="u",t=i[1]==="{";return e&&!t&&i.length===5||i[0]==="x"&&i.length===3?String.fromCharCode(parseInt(i.slice(1),16)):e&&t?String.fromCodePoint(parseInt(i.slice(2,-1),16)):sa.get(i)||i}function ia(i,e){let t=[],n=e.trim().split(/\s*,\s*/g),o;for(let r of n){let c=Number(r);if(!Number.isNaN(c))t.push(c);else if(o=r.match(oa))t.push(o[2].replace(na,(u,d,f)=>d?Ws(d):f));else throw new Error(`Invalid Chalk template style argument: ${r} (in style '${i}')`)}return t}function ra(i){Ls.lastIndex=0;let e=[],t;for(;(t=Ls.exec(i))!==null;){let n=t[1];if(t[2]){let o=ia(n,t[2]);e.push([n].concat(o))}else e.push([n])}return e}function Gs(i,e){let t={};for(let o of e)for(let r of o.styles)t[r[0]]=o.inverse?null:r.slice(1);let n=i;for(let[o,r]of Object.entries(t))if(Array.isArray(r)){if(!(o in n))throw new Error(`Unknown Chalk style: ${o}`);n=r.length>0?n[o](...r):n[o]}return n}zs.exports=(i,e)=>{let t=[],n=[],o=[];if(e.replace(ta,(r,c,u,d,f,m)=>{if(c)o.push(Ws(c));else if(d){let h=o.join("");o=[],n.push(t.length===0?h:Gs(i,t)(h)),t.push({inverse:u,styles:ra(d)})}else if(f){if(t.length===0)throw new Error("Found extraneous } in Chalk template literal");n.push(Gs(i,t)(o.join(""))),o=[],t.pop()}else o.push(m)}),n.push(o.join("")),t.length>0){let r=`Chalk template literal is missing ${t.length} closing bracket${t.length===1?"":"s"} (\`}\`)`;throw new Error(r)}return n.join("")}});var lt=ce((rl,Qs)=>{"use strict";var $t=$s(),{stdout:mn,stderr:hn}=Ns(),{stringReplaceAll:aa,stringEncaseCRLFWithFirstIndex:la}=js(),{isArray:ro}=Array,Bs=["ansi","ansi","ansi256","ansi16m"],kt=Object.create(null),ca=(i,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=mn?mn.level:0;i.level=e.level===void 0?t:e.level},fn=class{constructor(e){return Js(e)}},Js=i=>{let e={};return ca(e,i),e.template=(...t)=>Ys(e.template,...t),Object.setPrototypeOf(e,ao.prototype),Object.setPrototypeOf(e.template,e),e.template.constructor=()=>{throw new Error("`chalk.constructor()` is deprecated. Use `new chalk.Instance()` instead.")},e.template.Instance=fn,e.template};function ao(i){return Js(i)}for(let[i,e]of Object.entries($t))kt[i]={get(){let t=lo(this,gn(e.open,e.close,this._styler),this._isEmpty);return Object.defineProperty(this,i,{value:t}),t}};kt.visible={get(){let i=lo(this,this._styler,!0);return Object.defineProperty(this,"visible",{value:i}),i}};var Ks=["rgb","hex","keyword","hsl","hsv","hwb","ansi","ansi256"];for(let i of Ks)kt[i]={get(){let{level:e}=this;return function(...t){let n=gn($t.color[Bs[e]][i](...t),$t.color.close,this._styler);return lo(this,n,this._isEmpty)}}};for(let i of Ks){let e="bg"+i[0].toUpperCase()+i.slice(1);kt[e]={get(){let{level:t}=this;return function(...n){let o=gn($t.bgColor[Bs[t]][i](...n),$t.bgColor.close,this._styler);return lo(this,o,this._isEmpty)}}}}var ua=Object.defineProperties(()=>{},{...kt,level:{enumerable:!0,get(){return this._generator.level},set(i){this._generator.level=i}}}),gn=(i,e,t)=>{let n,o;return t===void 0?(n=i,o=e):(n=t.openAll+i,o=e+t.closeAll),{open:i,close:e,openAll:n,closeAll:o,parent:t}},lo=(i,e,t)=>{let n=(...o)=>ro(o[0])&&ro(o[0].raw)?Hs(n,Ys(n,...o)):Hs(n,o.length===1?""+o[0]:o.join(" "));return Object.setPrototypeOf(n,ua),n._generator=i,n._styler=e,n._isEmpty=t,n},Hs=(i,e)=>{if(i.level<=0||!e)return i._isEmpty?"":e;let t=i._styler;if(t===void 0)return e;let{openAll:n,closeAll:o}=t;if(e.indexOf("\x1B")!==-1)for(;t!==void 0;)e=aa(e,t.close,t.open),t=t.parent;let r=e.indexOf(`
32
+ `);return r!==-1&&(e=la(e,o,n,r)),n+e+o},pn,Ys=(i,...e)=>{let[t]=e;if(!ro(t)||!ro(t.raw))return e.join(" ");let n=e.slice(1),o=[t.raw[0]];for(let r=1;r<t.length;r++)o.push(String(n[r-1]).replace(/[{}\\]/g,"\\$&"),String(t.raw[r]));return pn===void 0&&(pn=Vs()),pn(i,o.join(""))};Object.defineProperties(ao.prototype,kt);var co=ao();co.supportsColor=mn;co.stderr=ao({level:hn?hn.level:0});co.stderr.supportsColor=hn;Qs.exports=co});var Zs=ce((ho,ct)=>{var po=void 0,mo=function(i){return po||(po=new Promise(function(e,t){var n=typeof i<"u"?i:{},o=n.onAbort;n.onAbort=function(s){t(new Error(s)),o&&o(s)},n.postRun=n.postRun||[],n.postRun.push(function(){e(n)}),ct=void 0;var r;r||=typeof n<"u"?n:{};var c=!!globalThis.window,u=!!globalThis.WorkerGlobalScope,d=globalThis.process?.versions?.node&&globalThis.process?.type!="renderer";r.onRuntimeInitialized=function(){function s(b,T){switch(typeof T){case"boolean":br(b,T?1:0);break;case"number":fr(b,T);break;case"string":gr(b,T,-1,-1);break;case"object":if(T===null)os(b);else if(T.length!=null){var E=Yt(T.length);$.set(T,E),yr(b,E,T.length,-1),Ot(E)}else eo(b,"Wrong API use : tried to return a value of an unknown type ("+T+").",-1);break;default:os(b)}}function a(b,T){for(var E=[],R=0;R<b;R+=1){var L=Ie(T+4*R,"i32"),J=ur(L);if(J===1||J===2)L=hr(L);else if(J===3)L=pr(L);else if(J===4){J=L,L=dr(J),J=mr(J);for(var $e=new Uint8Array(L),Ae=0;Ae<L;Ae+=1)$e[Ae]=$[J+Ae];L=$e}else L=null;E.push(L)}return E}function l(b,T){this.Qa=b,this.db=T,this.Oa=1,this.mb=[]}function p(b,T){if(this.db=T,this.fb=Kt(b),this.fb===null)throw Error("Unable to allocate memory for the SQL string");this.lb=this.fb,this.$a=this.sb=null}function g(b){if(this.filename="dbfile_"+(4294967295*Math.random()>>>0),b!=null){var T=this.filename,E="/",R=T;if(E&&(E=typeof E=="string"?E:Ao(E),R=T?ot(E+"/"+T):E),T=An(!0,!0),R=qi(R,T),b){if(typeof b=="string"){E=Array(b.length);for(var L=0,J=b.length;L<J;++L)E[L]=b.charCodeAt(L);b=E}Vt(R,T|146),E=_t(R,577),zn(E,b,0,b.length,0),Fo(E),Vt(R,T)}}this.handleError(D(this.filename,_)),this.db=Ie(_,"i32"),ss(this.db),this.gb={},this.Sa={}}var _=rt(4),S=r.cwrap,D=S("sqlite3_open","number",["string","number"]),B=S("sqlite3_close_v2","number",["number"]),N=S("sqlite3_exec","number",["number","string","number","number","number"]),te=S("sqlite3_changes","number",["number"]),fe=S("sqlite3_prepare_v2","number",["number","string","number","number","number"]),Qn=S("sqlite3_sql","string",["number"]),Bi=S("sqlite3_normalized_sql","string",["number"]),Xn=S("sqlite3_prepare_v2","number",["number","number","number","number","number"]),Ji=S("sqlite3_bind_text","number",["number","number","number","number","number"]),Zn=S("sqlite3_bind_blob","number",["number","number","number","number","number"]),Ki=S("sqlite3_bind_double","number",["number","number","number"]),Yi=S("sqlite3_bind_int","number",["number","number","number"]),Qi=S("sqlite3_bind_parameter_index","number",["number","string"]),Xi=S("sqlite3_step","number",["number"]),Zi=S("sqlite3_errmsg","string",["number"]),er=S("sqlite3_column_count","number",["number"]),tr=S("sqlite3_data_count","number",["number"]),or=S("sqlite3_column_double","number",["number","number"]),es=S("sqlite3_column_text","string",["number","number"]),nr=S("sqlite3_column_blob","number",["number","number"]),sr=S("sqlite3_column_bytes","number",["number","number"]),ir=S("sqlite3_column_type","number",["number","number"]),rr=S("sqlite3_column_name","string",["number","number"]),ar=S("sqlite3_reset","number",["number"]),lr=S("sqlite3_clear_bindings","number",["number"]),cr=S("sqlite3_finalize","number",["number"]),ts=S("sqlite3_create_function_v2","number","number string number number number number number number number".split(" ")),ur=S("sqlite3_value_type","number",["number"]),dr=S("sqlite3_value_bytes","number",["number"]),pr=S("sqlite3_value_text","string",["number"]),mr=S("sqlite3_value_blob","number",["number"]),hr=S("sqlite3_value_double","number",["number"]),fr=S("sqlite3_result_double","",["number","number"]),os=S("sqlite3_result_null","",["number"]),gr=S("sqlite3_result_text","",["number","string","number","number"]),yr=S("sqlite3_result_blob","",["number","number","number","number"]),br=S("sqlite3_result_int","",["number","number"]),eo=S("sqlite3_result_error","",["number","string","number"]),ns=S("sqlite3_aggregate_context","number",["number","number"]),ss=S("RegisterExtensionFunctions","number",["number"]),is=S("sqlite3_update_hook","number",["number","number","number"]);l.prototype.bind=function(b){if(!this.Qa)throw"Statement closed";return this.reset(),Array.isArray(b)?this.Gb(b):b!=null&&typeof b=="object"?this.Hb(b):!0},l.prototype.step=function(){if(!this.Qa)throw"Statement closed";this.Oa=1;var b=Xi(this.Qa);switch(b){case 100:return!0;case 101:return!1;default:throw this.db.handleError(b)}},l.prototype.Ab=function(b){return b==null&&(b=this.Oa,this.Oa+=1),or(this.Qa,b)},l.prototype.Ob=function(b){if(b==null&&(b=this.Oa,this.Oa+=1),b=es(this.Qa,b),typeof BigInt!="function")throw Error("BigInt is not supported");return BigInt(b)},l.prototype.Tb=function(b){return b==null&&(b=this.Oa,this.Oa+=1),es(this.Qa,b)},l.prototype.getBlob=function(b){b==null&&(b=this.Oa,this.Oa+=1);var T=sr(this.Qa,b);b=nr(this.Qa,b);for(var E=new Uint8Array(T),R=0;R<T;R+=1)E[R]=$[b+R];return E},l.prototype.get=function(b,T){T=T||{},b!=null&&this.bind(b)&&this.step(),b=[];for(var E=tr(this.Qa),R=0;R<E;R+=1)switch(ir(this.Qa,R)){case 1:var L=T.useBigInt?this.Ob(R):this.Ab(R);b.push(L);break;case 2:b.push(this.Ab(R));break;case 3:b.push(this.Tb(R));break;case 4:b.push(this.getBlob(R));break;default:b.push(null)}return b},l.prototype.qb=function(){for(var b=[],T=er(this.Qa),E=0;E<T;E+=1)b.push(rr(this.Qa,E));return b},l.prototype.zb=function(b,T){b=this.get(b,T),T=this.qb();for(var E={},R=0;R<T.length;R+=1)E[T[R]]=b[R];return E},l.prototype.Sb=function(){return Qn(this.Qa)},l.prototype.Pb=function(){return Bi(this.Qa)},l.prototype.run=function(b){return b!=null&&this.bind(b),this.step(),this.reset()},l.prototype.wb=function(b,T){T==null&&(T=this.Oa,this.Oa+=1),b=Kt(b),this.mb.push(b),this.db.handleError(Ji(this.Qa,T,b,-1,0))},l.prototype.Fb=function(b,T){T==null&&(T=this.Oa,this.Oa+=1);var E=Yt(b.length);$.set(b,E),this.mb.push(E),this.db.handleError(Zn(this.Qa,T,E,b.length,0))},l.prototype.vb=function(b,T){T==null&&(T=this.Oa,this.Oa+=1),this.db.handleError((b===(b|0)?Yi:Ki)(this.Qa,T,b))},l.prototype.Ib=function(b){b==null&&(b=this.Oa,this.Oa+=1),Zn(this.Qa,b,0,0,0)},l.prototype.xb=function(b,T){switch(T==null&&(T=this.Oa,this.Oa+=1),typeof b){case"string":this.wb(b,T);return;case"number":this.vb(b,T);return;case"bigint":this.wb(b.toString(),T);return;case"boolean":this.vb(b+0,T);return;case"object":if(b===null){this.Ib(T);return}if(b.length!=null){this.Fb(b,T);return}}throw"Wrong API use : tried to bind a value of an unknown type ("+b+")."},l.prototype.Hb=function(b){var T=this;return Object.keys(b).forEach(function(E){var R=Qi(T.Qa,E);R!==0&&T.xb(b[E],R)}),!0},l.prototype.Gb=function(b){for(var T=0;T<b.length;T+=1)this.xb(b[T],T+1);return!0},l.prototype.reset=function(){return this.freemem(),lr(this.Qa)===0&&ar(this.Qa)===0},l.prototype.freemem=function(){for(var b;(b=this.mb.pop())!==void 0;)Ot(b)},l.prototype.Ya=function(){this.freemem();var b=cr(this.Qa)===0;return delete this.db.gb[this.Qa],this.Qa=0,b},p.prototype.next=function(){if(this.fb===null)return{done:!0};if(this.$a!==null&&(this.$a.Ya(),this.$a=null),!this.db.db)throw this.ob(),Error("Database closed");var b=Xt(),T=rt(4);We(_),We(T);try{this.db.handleError(Xn(this.db.db,this.lb,-1,_,T)),this.lb=Ie(T,"i32");var E=Ie(_,"i32");return E===0?(this.ob(),{done:!0}):(this.$a=new l(E,this.db),this.db.gb[E]=this.$a,{value:this.$a,done:!1})}catch(R){throw this.sb=X(this.lb),this.ob(),R}finally{Qt(b)}},p.prototype.ob=function(){Ot(this.fb),this.fb=null},p.prototype.Qb=function(){return this.sb!==null?this.sb:X(this.lb)},typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"&&(p.prototype[Symbol.iterator]=function(){return this}),g.prototype.run=function(b,T){if(!this.db)throw"Database closed";if(T){b=this.tb(b,T);try{b.step()}finally{b.Ya()}}else this.handleError(N(this.db,b,0,0,_));return this},g.prototype.exec=function(b,T,E){if(!this.db)throw"Database closed";var R=null,L=null,J=null;try{J=L=Kt(b);var $e=rt(4);for(b=[];Ie(J,"i8")!==0;){We(_),We($e),this.handleError(Xn(this.db,J,-1,_,$e));var Ae=Ie(_,"i32");if(J=Ie($e,"i32"),Ae!==0){var Te=null;for(R=new l(Ae,this),T!=null&&R.bind(T);R.step();)Te===null&&(Te={columns:R.qb(),values:[]},b.push(Te)),Te.values.push(R.get(null,E));R.Ya()}}return b}catch(De){throw R&&R.Ya(),De}finally{L&&Ot(L)}},g.prototype.Mb=function(b,T,E,R,L){typeof T=="function"&&(R=E,E=T,T=void 0),b=this.tb(b,T);try{for(;b.step();)E(b.zb(null,L))}finally{b.Ya()}if(typeof R=="function")return R()},g.prototype.tb=function(b,T){if(We(_),this.handleError(fe(this.db,b,-1,_,0)),b=Ie(_,"i32"),b===0)throw"Nothing to prepare";var E=new l(b,this);return T!=null&&E.bind(T),this.gb[b]=E},g.prototype.Ub=function(b){return new p(b,this)},g.prototype.Nb=function(){Object.values(this.gb).forEach(function(T){T.Ya()}),Object.values(this.Sa).forEach(Ye),this.Sa={},this.handleError(B(this.db));var b=ji(this.filename);return this.handleError(D(this.filename,_)),this.db=Ie(_,"i32"),ss(this.db),b},g.prototype.close=function(){this.db!==null&&(Object.values(this.gb).forEach(function(b){b.Ya()}),Object.values(this.Sa).forEach(Ye),this.Sa={},this.Za&&(Ye(this.Za),this.Za=void 0),this.handleError(B(this.db)),qn("/"+this.filename),this.db=null)},g.prototype.handleError=function(b){if(b===0)return null;throw b=Zi(this.db),Error(b)},g.prototype.Rb=function(){return te(this.db)},g.prototype.Kb=function(b,T){Object.prototype.hasOwnProperty.call(this.Sa,b)&&(Ye(this.Sa[b]),delete this.Sa[b]);var E=At(function(R,L,J){L=a(L,J);try{var $e=T.apply(null,L)}catch(Ae){eo(R,Ae,-1);return}s(R,$e)},"viii");return this.Sa[b]=E,this.handleError(ts(this.db,b,T.length,1,0,E,0,0,0)),this},g.prototype.Jb=function(b,T){var E=T.init||function(){return null},R=T.finalize||function(Te){return Te},L=T.step;if(!L)throw"An aggregate function must have a step function in "+b;var J={};Object.hasOwnProperty.call(this.Sa,b)&&(Ye(this.Sa[b]),delete this.Sa[b]),T=b+"__finalize",Object.hasOwnProperty.call(this.Sa,T)&&(Ye(this.Sa[T]),delete this.Sa[T]);var $e=At(function(Te,De,Go){var at=ns(Te,1);Object.hasOwnProperty.call(J,at)||(J[at]=E()),De=a(De,Go),De=[J[at]].concat(De);try{J[at]=L.apply(null,De)}catch(_r){delete J[at],eo(Te,_r,-1)}},"viii"),Ae=At(function(Te){var De=ns(Te,1);try{var Go=R(J[De])}catch(at){delete J[De],eo(Te,at,-1);return}s(Te,Go),delete J[De]},"vi");return this.Sa[b]=$e,this.Sa[T]=Ae,this.handleError(ts(this.db,b,L.length-1,1,0,0,$e,Ae,0)),this},g.prototype.Zb=function(b){return this.Za&&(is(this.db,0,0),Ye(this.Za),this.Za=void 0),b?(this.Za=At(function(T,E,R,L,J){switch(E){case 18:T="insert";break;case 23:T="update";break;case 9:T="delete";break;default:throw"unknown operationCode in updateHook callback: "+E}if(R=X(R),L=X(L),J>Number.MAX_SAFE_INTEGER)throw"rowId too big to fit inside a Number";b(T,R,L,Number(J))},"viiiij"),is(this.db,this.Za,0),this):this},l.prototype.bind=l.prototype.bind,l.prototype.step=l.prototype.step,l.prototype.get=l.prototype.get,l.prototype.getColumnNames=l.prototype.qb,l.prototype.getAsObject=l.prototype.zb,l.prototype.getSQL=l.prototype.Sb,l.prototype.getNormalizedSQL=l.prototype.Pb,l.prototype.run=l.prototype.run,l.prototype.reset=l.prototype.reset,l.prototype.freemem=l.prototype.freemem,l.prototype.free=l.prototype.Ya,p.prototype.next=p.prototype.next,p.prototype.getRemainingSQL=p.prototype.Qb,g.prototype.run=g.prototype.run,g.prototype.exec=g.prototype.exec,g.prototype.each=g.prototype.Mb,g.prototype.prepare=g.prototype.tb,g.prototype.iterateStatements=g.prototype.Ub,g.prototype.export=g.prototype.Nb,g.prototype.close=g.prototype.close,g.prototype.handleError=g.prototype.handleError,g.prototype.getRowsModified=g.prototype.Rb,g.prototype.create_function=g.prototype.Kb,g.prototype.create_aggregate=g.prototype.Jb,g.prototype.updateHook=g.prototype.Zb,r.Database=g};var f="./this.program",m=(s,a)=>{throw a},h=globalThis.document?.currentScript?.src;typeof __filename<"u"?h=__filename:u&&(h=self.location.href);var y="",C,w;if(d){var k=require("node:fs");y=__dirname+"/",w=s=>(s=I(s)?new URL(s):s,k.readFileSync(s)),C=async s=>(s=I(s)?new URL(s):s,k.readFileSync(s,void 0)),1<process.argv.length&&(f=process.argv[1].replace(/\\/g,"/")),process.argv.slice(2),typeof ct<"u"&&(ct.exports=r),m=(s,a)=>{throw process.exitCode=s,a}}else if(c||u){try{y=new URL(".",h).href}catch{}u&&(w=s=>{var a=new XMLHttpRequest;return a.open("GET",s,!1),a.responseType="arraybuffer",a.send(null),new Uint8Array(a.response)}),C=async s=>{if(I(s))return new Promise((l,p)=>{var g=new XMLHttpRequest;g.open("GET",s,!0),g.responseType="arraybuffer",g.onload=()=>{g.status==200||g.status==0&&g.response?l(g.response):p(g.status)},g.onerror=p,g.send(null)});var a=await fetch(s,{credentials:"same-origin"});if(a.ok)return a.arrayBuffer();throw Error(a.status+" : "+a.url)}}var v=console.log.bind(console),x=console.error.bind(console),A,P=!1,q,I=s=>s.startsWith("file://"),$,j,ve,z,G,he,ht,_e;function He(){var s=Zt.buffer;$=new Int8Array(s),ve=new Int16Array(s),j=new Uint8Array(s),new Uint16Array(s),z=new Int32Array(s),G=new Uint32Array(s),he=new Float32Array(s),ht=new Float64Array(s),_e=new BigInt64Array(s),new BigUint64Array(s)}function xe(s){throw r.onAbort?.(s),s="Aborted("+s+")",x(s),P=!0,new WebAssembly.RuntimeError(s+". Build with -sASSERTIONS for more info.")}var Pe;async function ue(s){if(!A)try{var a=await C(s);return new Uint8Array(a)}catch{}if(s==Pe&&A)s=new Uint8Array(A);else if(w)s=w(s);else throw"both async and sync fetching of the wasm failed";return s}async function St(s,a){try{var l=await ue(s);return await WebAssembly.instantiate(l,a)}catch(p){x(`failed to asynchronously prepare wasm: ${p}`),xe(p)}}async function Ce(s){var a=Pe;if(!A&&!I(a)&&!d)try{var l=fetch(a,{credentials:"same-origin"});return await WebAssembly.instantiateStreaming(l,s)}catch(p){x(`wasm streaming compile failed: ${p}`),x("falling back to ArrayBuffer instantiation")}return St(a,s)}class ge{name="ExitStatus";constructor(a){this.message=`Program terminated with exit(${a})`,this.status=a}}var xt=s=>{for(;0<s.length;)s.shift()(r)},tt=[],Fe=[],Be=()=>{var s=r.preRun.shift();Fe.push(s)},ie=0,Ue=null;function Ie(s,a="i8"){switch(a.endsWith("*")&&(a="*"),a){case"i1":return $[s];case"i8":return $[s];case"i16":return ve[s>>1];case"i32":return z[s>>2];case"i64":return _e[s>>3];case"float":return he[s>>2];case"double":return ht[s>>3];case"*":return G[s>>2];default:xe(`invalid type for getValue: ${a}`)}}var Ne=!0;function We(s){var a="i32";switch(a.endsWith("*")&&(a="*"),a){case"i1":$[s]=0;break;case"i8":$[s]=0;break;case"i16":ve[s>>1]=0;break;case"i32":z[s>>2]=0;break;case"i64":_e[s>>3]=BigInt(0);break;case"float":he[s>>2]=0;break;case"double":ht[s>>3]=0;break;case"*":G[s>>2]=0;break;default:xe(`invalid type for setValue: ${a}`)}}var ft=new TextDecoder,V=(s,a,l,p)=>{if(l=a+l,p)return l;for(;s[a]&&!(a>=l);)++a;return a},X=(s,a,l)=>s?ft.decode(j.subarray(s,V(j,s,a,l))):"",ze=(s,a)=>{for(var l=0,p=s.length-1;0<=p;p--){var g=s[p];g==="."?s.splice(p,1):g===".."?(s.splice(p,1),l++):l&&(s.splice(p,1),l--)}if(a)for(;l;l--)s.unshift("..");return s},ot=s=>{var a=s.charAt(0)==="/",l=s.slice(-1)==="/";return(s=ze(s.split("/").filter(p=>!!p),!a).join("/"))||a||(s="."),s&&l&&(s+="/"),(a?"/":"")+s},re=s=>{var a=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(s).slice(1);return s=a[0],a=a[1],!s&&!a?".":(a&&=a.slice(0,-1),s+a)},Z=s=>s&&s.match(/([^\/]+|\/)\/*$/)[1],qe=()=>{if(d){var s=require("node:crypto");return a=>s.randomFillSync(a)}return a=>crypto.getRandomValues(a)},Lt=s=>{(Lt=qe())(s)},Oi=(...s)=>{for(var a="",l=!1,p=s.length-1;-1<=p&&!l;p--){if(l=0<=p?s[p]:"/",typeof l!="string")throw new TypeError("Arguments to path.resolve must be strings");if(!l)return"";a=l+"/"+a,l=l.charAt(0)==="/"}return a=ze(a.split("/").filter(g=>!!g),!l).join("/"),(l?"/":"")+a||"."},Tt=s=>{var a=V(s,0);return ft.decode(s.buffer?s.subarray(0,a):new Uint8Array(s.slice(0,a)))},Po=[],gt=s=>{for(var a=0,l=0;l<s.length;++l){var p=s.charCodeAt(l);127>=p?a++:2047>=p?a+=2:55296<=p&&57343>=p?(a+=4,++l):a+=3}return a},je=(s,a,l,p)=>{if(!(0<p))return 0;var g=l;p=l+p-1;for(var _=0;_<s.length;++_){var S=s.codePointAt(_);if(127>=S){if(l>=p)break;a[l++]=S}else if(2047>=S){if(l+1>=p)break;a[l++]=192|S>>6,a[l++]=128|S&63}else if(65535>=S){if(l+2>=p)break;a[l++]=224|S>>12,a[l++]=128|S>>6&63,a[l++]=128|S&63}else{if(l+3>=p)break;a[l++]=240|S>>18,a[l++]=128|S>>12&63,a[l++]=128|S>>6&63,a[l++]=128|S&63,_++}}return a[l]=0,l-g},Pn=[];function Mn(s,a){Pn[s]={input:[],output:[],eb:a},$o(s,Ei)}var Ei={open(s){var a=Pn[s.node.rdev];if(!a)throw new M(43);s.tty=a,s.seekable=!1},close(s){s.tty.eb.fsync(s.tty)},fsync(s){s.tty.eb.fsync(s.tty)},read(s,a,l,p){if(!s.tty||!s.tty.eb.Bb)throw new M(60);for(var g=0,_=0;_<p;_++){try{var S=s.tty.eb.Bb(s.tty)}catch{throw new M(29)}if(S===void 0&&g===0)throw new M(6);if(S==null)break;g++,a[l+_]=S}return g&&(s.node.atime=Date.now()),g},write(s,a,l,p){if(!s.tty||!s.tty.eb.ub)throw new M(60);try{for(var g=0;g<p;g++)s.tty.eb.ub(s.tty,a[l+g])}catch{throw new M(29)}return p&&(s.node.mtime=s.node.ctime=Date.now()),g}},Ri={Bb(){e:{if(!Po.length){var s=null;if(d){var a=Buffer.alloc(256),l=0,p=process.stdin.fd;try{l=k.readSync(p,a,0,256)}catch(g){if(g.toString().includes("EOF"))l=0;else throw g}0<l&&(s=a.slice(0,l).toString("utf-8"))}else globalThis.window?.prompt&&(s=window.prompt("Input: "),s!==null&&(s+=`
33
+ `));if(!s){s=null;break e}a=Array(gt(s)+1),s=je(s,a,0,a.length),a.length=s,Po=a}s=Po.shift()}return s},ub(s,a){a===null||a===10?(v(Tt(s.output)),s.output=[]):a!=0&&s.output.push(a)},fsync(s){0<s.output?.length&&(v(Tt(s.output)),s.output=[])},hc(){return{bc:25856,dc:5,ac:191,cc:35387,$b:[3,28,127,21,4,0,1,0,17,19,26,0,18,15,23,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}},ic(){return 0},jc(){return[24,80]}},$i={ub(s,a){a===null||a===10?(x(Tt(s.output)),s.output=[]):a!=0&&s.output.push(a)},fsync(s){0<s.output?.length&&(x(Tt(s.output)),s.output=[])}},F={Wa:null,Xa(){return F.createNode(null,"/",16895,0)},createNode(s,a,l,p){if((l&61440)===24576||(l&61440)===4096)throw new M(63);return F.Wa||(F.Wa={dir:{node:{Ta:F.La.Ta,Ua:F.La.Ua,lookup:F.La.lookup,ib:F.La.ib,rename:F.La.rename,unlink:F.La.unlink,rmdir:F.La.rmdir,readdir:F.La.readdir,symlink:F.La.symlink},stream:{Va:F.Ma.Va}},file:{node:{Ta:F.La.Ta,Ua:F.La.Ua},stream:{Va:F.Ma.Va,read:F.Ma.read,write:F.Ma.write,jb:F.Ma.jb,kb:F.Ma.kb}},link:{node:{Ta:F.La.Ta,Ua:F.La.Ua,readlink:F.La.readlink},stream:{}},yb:{node:{Ta:F.La.Ta,Ua:F.La.Ua},stream:Ni}}),l=$n(s,a,l,p),ke(l.mode)?(l.La=F.Wa.dir.node,l.Ma=F.Wa.dir.stream,l.Na={}):(l.mode&61440)===32768?(l.La=F.Wa.file.node,l.Ma=F.Wa.file.stream,l.Ra=0,l.Na=null):(l.mode&61440)===40960?(l.La=F.Wa.link.node,l.Ma=F.Wa.link.stream):(l.mode&61440)===8192&&(l.La=F.Wa.yb.node,l.Ma=F.Wa.yb.stream),l.atime=l.mtime=l.ctime=Date.now(),s&&(s.Na[a]=l,s.atime=s.mtime=s.ctime=l.atime),l},fc(s){return s.Na?s.Na.subarray?s.Na.subarray(0,s.Ra):new Uint8Array(s.Na):new Uint8Array(0)},La:{Ta(s){var a={};return a.dev=(s.mode&61440)===8192?s.id:1,a.ino=s.id,a.mode=s.mode,a.nlink=1,a.uid=0,a.gid=0,a.rdev=s.rdev,ke(s.mode)?a.size=4096:(s.mode&61440)===32768?a.size=s.Ra:(s.mode&61440)===40960?a.size=s.link.length:a.size=0,a.atime=new Date(s.atime),a.mtime=new Date(s.mtime),a.ctime=new Date(s.ctime),a.blksize=4096,a.blocks=Math.ceil(a.size/a.blksize),a},Ua(s,a){for(var l of["mode","atime","mtime","ctime"])a[l]!=null&&(s[l]=a[l]);a.size!==void 0&&(a=a.size,s.Ra!=a&&(a==0?(s.Na=null,s.Ra=0):(l=s.Na,s.Na=new Uint8Array(a),l&&s.Na.set(l.subarray(0,Math.min(a,s.Ra))),s.Ra=a)))},lookup(){throw F.nb||(F.nb=new M(44),F.nb.stack="<generic error, no stack>"),F.nb},ib(s,a,l,p){return F.createNode(s,a,l,p)},rename(s,a,l){try{var p=nt(a,l)}catch{}if(p){if(ke(s.mode))for(var g in p.Na)throw new M(55);Eo(p)}delete s.parent.Na[s.name],a.Na[l]=s,s.name=l,a.ctime=a.mtime=s.parent.ctime=s.parent.mtime=Date.now()},unlink(s,a){delete s.Na[a],s.ctime=s.mtime=Date.now()},rmdir(s,a){var l=nt(s,a),p;for(p in l.Na)throw new M(55);delete s.Na[a],s.ctime=s.mtime=Date.now()},readdir(s){return[".","..",...Object.keys(s.Na)]},symlink(s,a,l){return s=F.createNode(s,a,41471,0),s.link=l,s},readlink(s){if((s.mode&61440)!==40960)throw new M(28);return s.link}},Ma:{read(s,a,l,p,g){var _=s.node.Na;if(g>=s.node.Ra)return 0;if(s=Math.min(s.node.Ra-g,p),8<s&&_.subarray)a.set(_.subarray(g,g+s),l);else for(p=0;p<s;p++)a[l+p]=_[g+p];return s},write(s,a,l,p,g,_){if(a.buffer===$.buffer&&(_=!1),!p)return 0;if(s=s.node,s.mtime=s.ctime=Date.now(),a.subarray&&(!s.Na||s.Na.subarray)){if(_)return s.Na=a.subarray(l,l+p),s.Ra=p;if(s.Ra===0&&g===0)return s.Na=a.slice(l,l+p),s.Ra=p;if(g+p<=s.Ra)return s.Na.set(a.subarray(l,l+p),g),p}_=g+p;var S=s.Na?s.Na.length:0;if(S>=_||(_=Math.max(_,S*(1048576>S?2:1.125)>>>0),S!=0&&(_=Math.max(_,256)),S=s.Na,s.Na=new Uint8Array(_),0<s.Ra&&s.Na.set(S.subarray(0,s.Ra),0)),s.Na.subarray&&a.subarray)s.Na.set(a.subarray(l,l+p),g);else for(_=0;_<p;_++)s.Na[g+_]=a[l+_];return s.Ra=Math.max(s.Ra,g+p),p},Va(s,a,l){if(l===1?a+=s.position:l===2&&(s.node.mode&61440)===32768&&(a+=s.node.Ra),0>a)throw new M(28);return a},jb(s,a,l,p,g){if((s.node.mode&61440)!==32768)throw new M(43);if(s=s.node.Na,g&2||!s||s.buffer!==$.buffer){g=!0,p=65536*Math.ceil(a/65536);var _=Kn(65536,p);if(_&&j.fill(0,_,_+p),p=_,!p)throw new M(48);s&&((0<l||l+a<s.length)&&(s.subarray?s=s.subarray(l,l+a):s=Array.prototype.slice.call(s,l,l+a)),$.set(s,p))}else g=!1,p=s.byteOffset;return{Xb:p,Eb:g}},kb(s,a,l,p){return F.Ma.write(s,a,0,p,l,!1),0}}},An=(s,a)=>{var l=0;return s&&(l|=365),a&&(l|=146),l},Mo=null,On={},yt=[],Di=1,Je=null,En=!1,Rn=!0,M=class{name="ErrnoError";constructor(s){this.Pa=s}},Fi=class{hb={};node=null;get flags(){return this.hb.flags}set flags(s){this.hb.flags=s}get position(){return this.hb.position}set position(s){this.hb.position=s}},Ui=class{La={};Ma={};bb=null;constructor(s,a,l,p){s||=this,this.parent=s,this.Xa=s.Xa,this.id=Di++,this.name=a,this.mode=l,this.rdev=p,this.atime=this.mtime=this.ctime=Date.now()}get read(){return(this.mode&365)===365}set read(s){s?this.mode|=365:this.mode&=-366}get write(){return(this.mode&146)===146}set write(s){s?this.mode|=146:this.mode&=-147}};function Me(s,a={}){if(!s)throw new M(44);a.pb??(a.pb=!0),s.charAt(0)==="/"||(s="//"+s);var l=0;e:for(;40>l;l++){s=s.split("/").filter(D=>!!D);for(var p=Mo,g="/",_=0;_<s.length;_++){var S=_===s.length-1;if(S&&a.parent)break;if(s[_]!==".")if(s[_]==="..")if(g=re(g),p===p.parent){s=g+"/"+s.slice(_+1).join("/"),l--;continue e}else p=p.parent;else{g=ot(g+"/"+s[_]);try{p=nt(p,s[_])}catch(D){if(D?.Pa===44&&S&&a.Wb)return{path:g};throw D}if(!p.bb||S&&!a.pb||(p=p.bb.root),(p.mode&61440)===40960&&(!S||a.ab)){if(!p.La.readlink)throw new M(52);p=p.La.readlink(p),p.charAt(0)==="/"||(p=re(g)+"/"+p),s=p+"/"+s.slice(_+1).join("/");continue e}}}return{path:g,node:p}}throw new M(32)}function Ao(s){for(var a;;){if(s===s.parent)return s=s.Xa.Db,a?s[s.length-1]!=="/"?`${s}/${a}`:s+a:s;a=a?`${s.name}/${a}`:s.name,s=s.parent}}function Oo(s,a){for(var l=0,p=0;p<a.length;p++)l=(l<<5)-l+a.charCodeAt(p)|0;return(s+l>>>0)%Je.length}function Eo(s){var a=Oo(s.parent.id,s.name);if(Je[a]===s)Je[a]=s.cb;else for(a=Je[a];a;){if(a.cb===s){a.cb=s.cb;break}a=a.cb}}function nt(s,a){var l=ke(s.mode)?(l=bt(s,"x"))?l:s.La.lookup?0:2:54;if(l)throw new M(l);for(l=Je[Oo(s.id,a)];l;l=l.cb){var p=l.name;if(l.parent.id===s.id&&p===a)return l}return s.La.lookup(s,a)}function $n(s,a,l,p){return s=new Ui(s,a,l,p),a=Oo(s.parent.id,s.name),s.cb=Je[a],Je[a]=s}function ke(s){return(s&61440)===16384}function bt(s,a){return Rn?0:a.includes("r")&&!(s.mode&292)||a.includes("w")&&!(s.mode&146)||a.includes("x")&&!(s.mode&73)?2:0}function Dn(s,a){if(!ke(s.mode))return 54;try{return nt(s,a),20}catch{}return bt(s,"wx")}function Fn(s,a,l){try{var p=nt(s,a)}catch(g){return g.Pa}if(s=bt(s,"wx"))return s;if(l){if(!ke(p.mode))return 54;if(p===p.parent||Ao(p)==="/")return 10}else if(ke(p.mode))return 31;return 0}function Gt(s){if(!s)throw new M(63);return s}function we(s){if(s=yt[s],!s)throw new M(8);return s}function Un(s,a=-1){if(s=Object.assign(new Fi,s),a==-1)e:{for(a=0;4096>=a;a++)if(!yt[a])break e;throw new M(33)}return s.fd=a,yt[a]=s}function Ii(s,a=-1){return s=Un(s,a),s.Ma?.ec?.(s),s}function Ro(s,a,l){var p=s?.Ma.Ua;s=p?s:a,p??=a.La.Ua,Gt(p),p(s,l)}var Ni={open(s){s.Ma=On[s.node.rdev].Ma,s.Ma.open?.(s)},Va(){throw new M(70)}};function $o(s,a){On[s]={Ma:a}}function In(s,a){var l=a==="/";if(l&&Mo)throw new M(10);if(!l&&a){var p=Me(a,{pb:!1});if(a=p.path,p=p.node,p.bb)throw new M(10);if(!ke(p.mode))throw new M(54)}a={type:s,kc:{},Db:a,Vb:[]},s=s.Xa(a),s.Xa=a,a.root=s,l?Mo=s:p&&(p.bb=a,p.Xa&&p.Xa.Vb.push(a))}function Wt(s,a,l){var p=Me(s,{parent:!0}).node;if(s=Z(s),!s)throw new M(28);if(s==="."||s==="..")throw new M(20);var g=Dn(p,s);if(g)throw new M(g);if(!p.La.ib)throw new M(63);return p.La.ib(p,s,a,l)}function qi(s,a=438){return Wt(s,a&4095|32768,0)}function Le(s,a=511){return Wt(s,a&1023|16384,0)}function zt(s,a,l){typeof l>"u"&&(l=a,a=438),Wt(s,a|8192,l)}function Do(s,a){if(!Oi(s))throw new M(44);var l=Me(a,{parent:!0}).node;if(!l)throw new M(44);a=Z(a);var p=Dn(l,a);if(p)throw new M(p);if(!l.La.symlink)throw new M(63);l.La.symlink(l,a,s)}function Nn(s){var a=Me(s,{parent:!0}).node;s=Z(s);var l=nt(a,s),p=Fn(a,s,!0);if(p)throw new M(p);if(!a.La.rmdir)throw new M(63);if(l.bb)throw new M(10);a.La.rmdir(a,s),Eo(l)}function qn(s){var a=Me(s,{parent:!0}).node;if(!a)throw new M(44);s=Z(s);var l=nt(a,s),p=Fn(a,s,!1);if(p)throw new M(p);if(!a.La.unlink)throw new M(63);if(l.bb)throw new M(10);a.La.unlink(a,s),Eo(l)}function Pt(s,a){return s=Me(s,{ab:!a}).node,Gt(s.La.Ta)(s)}function jn(s,a,l,p){Ro(s,a,{mode:l&4095|a.mode&-4096,ctime:Date.now(),Lb:p})}function Vt(s,a){s=typeof s=="string"?Me(s,{ab:!0}).node:s,jn(null,s,a)}function Ln(s,a,l){if(ke(a.mode))throw new M(31);if((a.mode&61440)!==32768)throw new M(28);var p=bt(a,"w");if(p)throw new M(p);Ro(s,a,{size:l,timestamp:Date.now()})}function _t(s,a,l=438){if(s==="")throw new M(44);if(typeof a=="string"){var p={r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090}[a];if(typeof p>"u")throw Error(`Unknown file open mode: ${a}`);a=p}if(l=a&64?l&4095|32768:0,typeof s=="object")p=s;else{var g=s.endsWith("/"),_=Me(s,{ab:!(a&131072),Wb:!0});p=_.node,s=_.path}if(_=!1,a&64)if(p){if(a&128)throw new M(20)}else{if(g)throw new M(31);p=Wt(s,l|511,0),_=!0}if(!p)throw new M(44);if((p.mode&61440)===8192&&(a&=-513),a&65536&&!ke(p.mode))throw new M(54);if(!_&&(p?(p.mode&61440)===40960?g=32:(g=["r","w","rw"][a&3],a&512&&(g+="w"),g=ke(p.mode)&&(g!=="r"||a&576)?31:bt(p,g)):g=44,g))throw new M(g);return a&512&&!_&&(g=p,g=typeof g=="string"?Me(g,{ab:!0}).node:g,Ln(null,g,0)),a=Un({node:p,path:Ao(p),flags:a&-131713,seekable:!0,position:0,Ma:p.Ma,Yb:[],error:!1}),a.Ma.open&&a.Ma.open(a),_&&Vt(p,l&511),a}function Fo(s){if(s.fd===null)throw new M(8);s.rb&&(s.rb=null);try{s.Ma.close&&s.Ma.close(s)}catch(a){throw a}finally{yt[s.fd]=null}s.fd=null}function Gn(s,a,l){if(s.fd===null)throw new M(8);if(!s.seekable||!s.Ma.Va)throw new M(70);if(l!=0&&l!=1&&l!=2)throw new M(28);s.position=s.Ma.Va(s,a,l),s.Yb=[]}function Wn(s,a,l,p,g){if(0>p||0>g)throw new M(28);if(s.fd===null)throw new M(8);if((s.flags&2097155)===1)throw new M(8);if(ke(s.node.mode))throw new M(31);if(!s.Ma.read)throw new M(28);var _=typeof g<"u";if(!_)g=s.position;else if(!s.seekable)throw new M(70);return a=s.Ma.read(s,a,l,p,g),_||(s.position+=a),a}function zn(s,a,l,p,g){if(0>p||0>g)throw new M(28);if(s.fd===null)throw new M(8);if((s.flags&2097155)===0)throw new M(8);if(ke(s.node.mode))throw new M(31);if(!s.Ma.write)throw new M(28);s.seekable&&s.flags&1024&&Gn(s,0,2);var _=typeof g<"u";if(!_)g=s.position;else if(!s.seekable)throw new M(70);return a=s.Ma.write(s,a,l,p,g,void 0),_||(s.position+=a),a}function ji(s){var a=a||0,l="binary";l!=="utf8"&&l!=="binary"&&xe(`Invalid encoding type "${l}"`),a=_t(s,a),s=Pt(s).size;var p=new Uint8Array(s);return Wn(a,p,0,s,0),l==="utf8"&&(p=Tt(p)),Fo(a),p}function Ke(s,a,l){s=ot("/dev/"+s);var p=An(!!a,!!l);Ke.Cb??(Ke.Cb=64);var g=Ke.Cb++<<8|0;$o(g,{open(_){_.seekable=!1},close(){l?.buffer?.length&&l(10)},read(_,S,D,B){for(var N=0,te=0;te<B;te++){try{var fe=a()}catch{throw new M(29)}if(fe===void 0&&N===0)throw new M(6);if(fe==null)break;N++,S[D+te]=fe}return N&&(_.node.atime=Date.now()),N},write(_,S,D,B){for(var N=0;N<B;N++)try{l(S[D+N])}catch{throw new M(29)}return B&&(_.node.mtime=_.node.ctime=Date.now()),N}}),zt(s,p,g)}var ee={};function st(s,a,l){if(a.charAt(0)==="/")return a;if(s=s===-100?"/":we(s).path,a.length==0){if(!l)throw new M(44);return s}return s+"/"+a}function Ht(s,a){G[s>>2]=a.dev,G[s+4>>2]=a.mode,G[s+8>>2]=a.nlink,G[s+12>>2]=a.uid,G[s+16>>2]=a.gid,G[s+20>>2]=a.rdev,_e[s+24>>3]=BigInt(a.size),z[s+32>>2]=4096,z[s+36>>2]=a.blocks;var l=a.atime.getTime(),p=a.mtime.getTime(),g=a.ctime.getTime();return _e[s+40>>3]=BigInt(Math.floor(l/1e3)),G[s+48>>2]=l%1e3*1e6,_e[s+56>>3]=BigInt(Math.floor(p/1e3)),G[s+64>>2]=p%1e3*1e6,_e[s+72>>3]=BigInt(Math.floor(g/1e3)),G[s+80>>2]=g%1e3*1e6,_e[s+88>>3]=BigInt(a.ino),0}var Bt=void 0,Jt=()=>{var s=z[+Bt>>2];return Bt+=4,s},Uo=0,Li=[0,31,60,91,121,152,182,213,244,274,305,335],Gi=[0,31,59,90,120,151,181,212,243,273,304,334],Mt={},Vn=s=>{q=s,Ne||0<Uo||(r.onExit?.(s),P=!0),m(s,new ge(s))},Wi=s=>{if(!P)try{s()}catch(a){a instanceof ge||a=="unwind"||m(1,a)}finally{if(!(Ne||0<Uo))try{q=s=q,Vn(s)}catch(a){a instanceof ge||a=="unwind"||m(1,a)}}},Io={},Hn=()=>{if(!No){var s={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:(globalThis.navigator?.language??"C").replace("-","_")+".UTF-8",_:f||"./this.program"},a;for(a in Io)Io[a]===void 0?delete s[a]:s[a]=Io[a];var l=[];for(a in s)l.push(`${a}=${s[a]}`);No=l}return No},No,zi=(s,a,l,p)=>{var g={string:N=>{var te=0;if(N!=null&&N!==0){te=gt(N)+1;var fe=rt(te);je(N,j,fe,te),te=fe}return te},array:N=>{var te=rt(N.length);return $.set(N,te),te}};s=r["_"+s];var _=[],S=0;if(p)for(var D=0;D<p.length;D++){var B=g[l[D]];B?(S===0&&(S=Xt()),_[D]=B(p[D])):_[D]=p[D]}return l=s(..._),l=(function(N){return S!==0&&Qt(S),a==="string"?X(N):a==="boolean"?!!N:N})(l)},Kt=s=>{var a=gt(s)+1,l=Yt(a);return l&&je(s,j,l,a),l},it,qo=[],Ye=s=>{it.delete(Qe.get(s)),Qe.set(s,null),qo.push(s)},Bn=s=>{let a=s.length;return[a%128|128,a>>7,...s]},Vi={i:127,p:127,j:126,f:125,d:124,e:111},Jn=s=>Bn(Array.from(s,a=>Vi[a])),At=(s,a)=>{if(!it){it=new WeakMap;var l=Qe.length;if(it)for(var p=0;p<0+l;p++){var g=Qe.get(p);g&&it.set(g,p)}}if(l=it.get(s)||0)return l;l=qo.length?qo.pop():Qe.grow(1);try{Qe.set(l,s)}catch(_){if(!(_ instanceof TypeError))throw _;a=Uint8Array.of(0,97,115,109,1,0,0,0,1,...Bn([1,96,...Jn(a.slice(1)),...Jn(a[0]==="v"?"":a[0])]),2,7,1,1,101,1,102,0,0,7,5,1,1,102,0,0),a=new WebAssembly.Module(a),a=new WebAssembly.Instance(a,{e:{f:s}}).exports.f,Qe.set(l,a)}return it.set(s,l),l};if(Je=Array(4096),In(F,"/"),Le("/tmp"),Le("/home"),Le("/home/web_user"),(function(){Le("/dev"),$o(259,{read:()=>0,write:(p,g,_,S)=>S,Va:()=>0}),zt("/dev/null",259),Mn(1280,Ri),Mn(1536,$i),zt("/dev/tty",1280),zt("/dev/tty1",1536);var s=new Uint8Array(1024),a=0,l=()=>(a===0&&(Lt(s),a=s.byteLength),s[--a]);Ke("random",l),Ke("urandom",l),Le("/dev/shm"),Le("/dev/shm/tmp")})(),(function(){Le("/proc");var s=Le("/proc/self");Le("/proc/self/fd"),In({Xa(){var a=$n(s,"fd",16895,73);return a.Ma={Va:F.Ma.Va},a.La={lookup(l,p){l=+p;var g=we(l);return l={parent:null,Xa:{Db:"fake"},La:{readlink:()=>g.path},id:l+1},l.parent=l},readdir(){return Array.from(yt.entries()).filter(([,l])=>l).map(([l])=>l.toString())}},a}},"/proc/self/fd")})(),r.noExitRuntime&&(Ne=r.noExitRuntime),r.print&&(v=r.print),r.printErr&&(x=r.printErr),r.wasmBinary&&(A=r.wasmBinary),r.thisProgram&&(f=r.thisProgram),r.preInit)for(typeof r.preInit=="function"&&(r.preInit=[r.preInit]);0<r.preInit.length;)r.preInit.shift()();r.stackSave=()=>Xt(),r.stackRestore=s=>Qt(s),r.stackAlloc=s=>rt(s),r.cwrap=(s,a,l,p)=>{var g=!l||l.every(_=>_==="number"||_==="boolean");return a!=="string"&&g&&!p?r["_"+s]:(..._)=>zi(s,a,l,_)},r.addFunction=At,r.removeFunction=Ye,r.UTF8ToString=X,r.stringToNewUTF8=Kt,r.writeArrayToMemory=(s,a)=>{$.set(s,a)};var Yt,Ot,Kn,Yn,Qt,rt,Xt,Zt,Qe,Hi={a:(s,a,l,p)=>xe(`Assertion failed: ${X(s)}, at: `+[a?X(a):"unknown filename",l,p?X(p):"unknown function"]),i:function(s,a){try{return s=X(s),Vt(s,a),0}catch(l){if(typeof ee>"u"||l.name!=="ErrnoError")throw l;return-l.Pa}},L:function(s,a,l){try{if(a=X(a),a=st(s,a),l&-8)return-28;var p=Me(a,{ab:!0}).node;return p?(s="",l&4&&(s+="r"),l&2&&(s+="w"),l&1&&(s+="x"),s&&bt(p,s)?-2:0):-44}catch(g){if(typeof ee>"u"||g.name!=="ErrnoError")throw g;return-g.Pa}},j:function(s,a){try{var l=we(s);return jn(l,l.node,a,!1),0}catch(p){if(typeof ee>"u"||p.name!=="ErrnoError")throw p;return-p.Pa}},h:function(s){try{var a=we(s);return Ro(a,a.node,{timestamp:Date.now(),Lb:!1}),0}catch(l){if(typeof ee>"u"||l.name!=="ErrnoError")throw l;return-l.Pa}},b:function(s,a,l){Bt=l;try{var p=we(s);switch(a){case 0:var g=Jt();if(0>g)break;for(;yt[g];)g++;return Ii(p,g).fd;case 1:case 2:return 0;case 3:return p.flags;case 4:return g=Jt(),p.flags|=g,0;case 12:return g=Jt(),ve[g+0>>1]=2,0;case 13:case 14:return 0}return-28}catch(_){if(typeof ee>"u"||_.name!=="ErrnoError")throw _;return-_.Pa}},g:function(s,a){try{var l=we(s),p=l.node,g=l.Ma.Ta;s=g?l:p,g??=p.La.Ta,Gt(g);var _=g(s);return Ht(a,_)}catch(S){if(typeof ee>"u"||S.name!=="ErrnoError")throw S;return-S.Pa}},H:function(s,a){a=-9007199254740992>a||9007199254740992<a?NaN:Number(a);try{if(isNaN(a))return-61;var l=we(s);if(0>a||(l.flags&2097155)===0)throw new M(28);return Ln(l,l.node,a),0}catch(p){if(typeof ee>"u"||p.name!=="ErrnoError")throw p;return-p.Pa}},G:function(s,a){try{if(a===0)return-28;var l=gt("/")+1;return a<l?-68:(je("/",j,s,a),l)}catch(p){if(typeof ee>"u"||p.name!=="ErrnoError")throw p;return-p.Pa}},K:function(s,a){try{return s=X(s),Ht(a,Pt(s,!0))}catch(l){if(typeof ee>"u"||l.name!=="ErrnoError")throw l;return-l.Pa}},C:function(s,a,l){try{return a=X(a),a=st(s,a),Le(a,l),0}catch(p){if(typeof ee>"u"||p.name!=="ErrnoError")throw p;return-p.Pa}},J:function(s,a,l,p){try{a=X(a);var g=p&256;return a=st(s,a,p&4096),Ht(l,g?Pt(a,!0):Pt(a))}catch(_){if(typeof ee>"u"||_.name!=="ErrnoError")throw _;return-_.Pa}},x:function(s,a,l,p){Bt=p;try{a=X(a),a=st(s,a);var g=p?Jt():0;return _t(a,l,g).fd}catch(_){if(typeof ee>"u"||_.name!=="ErrnoError")throw _;return-_.Pa}},v:function(s,a,l,p){try{if(a=X(a),a=st(s,a),0>=p)return-28;var g=Me(a).node;if(!g)throw new M(44);if(!g.La.readlink)throw new M(28);var _=g.La.readlink(g),S=Math.min(p,gt(_)),D=$[l+S];return je(_,j,l,p+1),$[l+S]=D,S}catch(B){if(typeof ee>"u"||B.name!=="ErrnoError")throw B;return-B.Pa}},u:function(s){try{return s=X(s),Nn(s),0}catch(a){if(typeof ee>"u"||a.name!=="ErrnoError")throw a;return-a.Pa}},f:function(s,a){try{return s=X(s),Ht(a,Pt(s))}catch(l){if(typeof ee>"u"||l.name!=="ErrnoError")throw l;return-l.Pa}},r:function(s,a,l){try{if(a=X(a),a=st(s,a),l)if(l===512)Nn(a);else return-28;else qn(a);return 0}catch(p){if(typeof ee>"u"||p.name!=="ErrnoError")throw p;return-p.Pa}},q:function(s,a,l){try{a=X(a),a=st(s,a,!0);var p=Date.now(),g,_;if(l){var S=G[l>>2]+4294967296*z[l+4>>2],D=z[l+8>>2];D==1073741823?g=p:D==1073741822?g=null:g=1e3*S+D/1e6,l+=16,S=G[l>>2]+4294967296*z[l+4>>2],D=z[l+8>>2],D==1073741823?_=p:D==1073741822?_=null:_=1e3*S+D/1e6}else _=g=p;if((_??g)!==null){s=g;var B=Me(a,{ab:!0}).node;Gt(B.La.Ua)(B,{atime:s,mtime:_})}return 0}catch(N){if(typeof ee>"u"||N.name!=="ErrnoError")throw N;return-N.Pa}},m:()=>xe(""),l:()=>{Ne=!1,Uo=0},A:function(s,a){s=-9007199254740992>s||9007199254740992<s?NaN:Number(s),s=new Date(1e3*s),z[a>>2]=s.getSeconds(),z[a+4>>2]=s.getMinutes(),z[a+8>>2]=s.getHours(),z[a+12>>2]=s.getDate(),z[a+16>>2]=s.getMonth(),z[a+20>>2]=s.getFullYear()-1900,z[a+24>>2]=s.getDay();var l=s.getFullYear();z[a+28>>2]=(l%4!==0||l%100===0&&l%400!==0?Gi:Li)[s.getMonth()]+s.getDate()-1|0,z[a+36>>2]=-(60*s.getTimezoneOffset()),l=new Date(s.getFullYear(),6,1).getTimezoneOffset();var p=new Date(s.getFullYear(),0,1).getTimezoneOffset();z[a+32>>2]=(l!=p&&s.getTimezoneOffset()==Math.min(p,l))|0},y:function(s,a,l,p,g,_,S){g=-9007199254740992>g||9007199254740992<g?NaN:Number(g);try{var D=we(p);if((a&2)!==0&&(l&2)===0&&(D.flags&2097155)!==2)throw new M(2);if((D.flags&2097155)===1)throw new M(2);if(!D.Ma.jb)throw new M(43);if(!s)throw new M(28);var B=D.Ma.jb(D,s,g,a,l),N=B.Xb;return z[_>>2]=B.Eb,G[S>>2]=N,0}catch(te){if(typeof ee>"u"||te.name!=="ErrnoError")throw te;return-te.Pa}},z:function(s,a,l,p,g,_){_=-9007199254740992>_||9007199254740992<_?NaN:Number(_);try{var S=we(g);if(l&2){if(l=_,(S.node.mode&61440)!==32768)throw new M(43);if(!(p&2)){var D=j.slice(s,s+a);S.Ma.kb&&S.Ma.kb(S,D,l,a,p)}}}catch(B){if(typeof ee>"u"||B.name!=="ErrnoError")throw B;return-B.Pa}},n:(s,a)=>{if(Mt[s]&&(clearTimeout(Mt[s].id),delete Mt[s]),!a)return 0;var l=setTimeout(()=>{delete Mt[s],Wi(()=>Yn(s,performance.now()))},a);return Mt[s]={id:l,lc:a},0},B:(s,a,l,p)=>{var g=new Date().getFullYear(),_=new Date(g,0,1).getTimezoneOffset();g=new Date(g,6,1).getTimezoneOffset(),G[s>>2]=60*Math.max(_,g),z[a>>2]=+(_!=g),a=S=>{var D=Math.abs(S);return`UTC${0<=S?"-":"+"}${String(Math.floor(D/60)).padStart(2,"0")}${String(D%60).padStart(2,"0")}`},s=a(_),a=a(g),g<_?(je(s,j,l,17),je(a,j,p,17)):(je(s,j,p,17),je(a,j,l,17))},d:()=>Date.now(),s:()=>2147483648,c:()=>performance.now(),o:s=>{var a=j.length;if(s>>>=0,2147483648<s)return!1;for(var l=1;4>=l;l*=2){var p=a*(1+.2/l);p=Math.min(p,s+100663296);e:{p=(Math.min(2147483648,65536*Math.ceil(Math.max(s,p)/65536))-Zt.buffer.byteLength+65535)/65536|0;try{Zt.grow(p),He();var g=1;break e}catch{}g=void 0}if(g)return!0}return!1},E:(s,a)=>{var l=0,p=0,g;for(g of Hn()){var _=a+l;G[s+p>>2]=_,l+=je(g,j,_,1/0)+1,p+=4}return 0},F:(s,a)=>{var l=Hn();G[s>>2]=l.length,s=0;for(var p of l)s+=gt(p)+1;return G[a>>2]=s,0},e:function(s){try{var a=we(s);return Fo(a),0}catch(l){if(typeof ee>"u"||l.name!=="ErrnoError")throw l;return l.Pa}},p:function(s,a){try{var l=we(s);return $[a]=l.tty?2:ke(l.mode)?3:(l.mode&61440)===40960?7:4,ve[a+2>>1]=0,_e[a+8>>3]=BigInt(0),_e[a+16>>3]=BigInt(0),0}catch(p){if(typeof ee>"u"||p.name!=="ErrnoError")throw p;return p.Pa}},w:function(s,a,l,p){try{e:{var g=we(s);s=a;for(var _,S=a=0;S<l;S++){var D=G[s>>2],B=G[s+4>>2];s+=8;var N=Wn(g,$,D,B,_);if(0>N){var te=-1;break e}if(a+=N,N<B)break;typeof _<"u"&&(_+=N)}te=a}return G[p>>2]=te,0}catch(fe){if(typeof ee>"u"||fe.name!=="ErrnoError")throw fe;return fe.Pa}},D:function(s,a,l,p){a=-9007199254740992>a||9007199254740992<a?NaN:Number(a);try{if(isNaN(a))return 61;var g=we(s);return Gn(g,a,l),_e[p>>3]=BigInt(g.position),g.rb&&a===0&&l===0&&(g.rb=null),0}catch(_){if(typeof ee>"u"||_.name!=="ErrnoError")throw _;return _.Pa}},I:function(s){try{var a=we(s);return a.Ma?.fsync?.(a)}catch(l){if(typeof ee>"u"||l.name!=="ErrnoError")throw l;return l.Pa}},t:function(s,a,l,p){try{e:{var g=we(s);s=a;for(var _,S=a=0;S<l;S++){var D=G[s>>2],B=G[s+4>>2];s+=8;var N=zn(g,$,D,B,_);if(0>N){var te=-1;break e}if(a+=N,N<B)break;typeof _<"u"&&(_+=N)}te=a}return G[p>>2]=te,0}catch(fe){if(typeof ee>"u"||fe.name!=="ErrnoError")throw fe;return fe.Pa}},k:Vn};function jo(){function s(){if(r.calledRun=!0,!P){if(!r.noFSInit&&!En){var a,l;En=!0,a??=r.stdin,l??=r.stdout,p??=r.stderr,a?Ke("stdin",a):Do("/dev/tty","/dev/stdin"),l?Ke("stdout",null,l):Do("/dev/tty","/dev/stdout"),p?Ke("stderr",null,p):Do("/dev/tty1","/dev/stderr"),_t("/dev/stdin",0),_t("/dev/stdout",1),_t("/dev/stderr",1)}if(Lo.N(),Rn=!1,r.onRuntimeInitialized?.(),r.postRun)for(typeof r.postRun=="function"&&(r.postRun=[r.postRun]);r.postRun.length;){var p=r.postRun.shift();tt.push(p)}xt(tt)}}if(0<ie)Ue=jo;else{if(r.preRun)for(typeof r.preRun=="function"&&(r.preRun=[r.preRun]);r.preRun.length;)Be();xt(Fe),0<ie?Ue=jo:r.setStatus?(r.setStatus("Running..."),setTimeout(()=>{setTimeout(()=>r.setStatus(""),1),s()},1)):s()}}var Lo;return(async function(){function s(l){return l=Lo=l.exports,r._sqlite3_free=l.P,r._sqlite3_value_text=l.Q,r._sqlite3_prepare_v2=l.R,r._sqlite3_step=l.S,r._sqlite3_reset=l.T,r._sqlite3_exec=l.U,r._sqlite3_finalize=l.V,r._sqlite3_column_name=l.W,r._sqlite3_column_text=l.X,r._sqlite3_column_type=l.Y,r._sqlite3_errmsg=l.Z,r._sqlite3_clear_bindings=l._,r._sqlite3_value_blob=l.$,r._sqlite3_value_bytes=l.aa,r._sqlite3_value_double=l.ba,r._sqlite3_value_int=l.ca,r._sqlite3_value_type=l.da,r._sqlite3_result_blob=l.ea,r._sqlite3_result_double=l.fa,r._sqlite3_result_error=l.ga,r._sqlite3_result_int=l.ha,r._sqlite3_result_int64=l.ia,r._sqlite3_result_null=l.ja,r._sqlite3_result_text=l.ka,r._sqlite3_aggregate_context=l.la,r._sqlite3_column_count=l.ma,r._sqlite3_data_count=l.na,r._sqlite3_column_blob=l.oa,r._sqlite3_column_bytes=l.pa,r._sqlite3_column_double=l.qa,r._sqlite3_bind_blob=l.ra,r._sqlite3_bind_double=l.sa,r._sqlite3_bind_int=l.ta,r._sqlite3_bind_text=l.ua,r._sqlite3_bind_parameter_index=l.va,r._sqlite3_sql=l.wa,r._sqlite3_normalized_sql=l.xa,r._sqlite3_changes=l.ya,r._sqlite3_close_v2=l.za,r._sqlite3_create_function_v2=l.Aa,r._sqlite3_update_hook=l.Ba,r._sqlite3_open=l.Ca,Yt=r._malloc=l.Da,Ot=r._free=l.Ea,r._RegisterExtensionFunctions=l.Fa,Kn=l.Ga,Yn=l.Ha,Qt=l.Ia,rt=l.Ja,Xt=l.Ka,Zt=l.M,Qe=l.O,He(),ie--,r.monitorRunDependencies?.(ie),ie==0&&Ue&&(l=Ue,Ue=null,l()),Lo}ie++,r.monitorRunDependencies?.(ie);var a={a:Hi};return r.instantiateWasm?new Promise(l=>{r.instantiateWasm(a,(p,g)=>{l(s(p,g))})}):(Pe??=r.locateFile?r.locateFile("sql-wasm.wasm",y):y+"sql-wasm.wasm",s((await Ce(a)).instance))})(),jo(),n}),po)};typeof ho=="object"&&typeof ct=="object"?(ct.exports=mo,ct.exports.default=mo):typeof define=="function"&&define.amd?define([],function(){return mo}):typeof ho=="object"&&(ho.Module=mo)});var Ai=ce((Zl,Oa)=>{Oa.exports={name:"@rajbos/ai-engineering-fluency",version:"0.0.2",description:"AI Engineering Fluency - CLI tool to analyze GitHub Copilot token usage from local session files",license:"MIT",author:"RobBos",repository:{type:"git",url:"git+https://github.com/rajbos/github-copilot-token-usage.git",directory:"cli"},keywords:["github-copilot","token-usage","copilot","cli","token-tracker"],bin:{"ai-engineering-fluency":"dist/cli.js"},files:["dist/**/*"],scripts:{build:"node esbuild.js","build:production":"node esbuild.js --production",lint:"eslint src","check-types":"tsc --noEmit",test:"node dist/cli.js --help && node dist/cli.js --version"},devDependencies:{commander:"^13.1.0",chalk:"^4.1.2",esbuild:"^0.25.0",typescript:"^5.7.3","@types/node":"^22.12.0","sql.js":"^1.12.0"},engines:{node:">=22.14.0"}}});var _s=ye(bs(),1),{program:ja,createCommand:La,createArgument:Ga,createOption:Wa,CommanderError:za,InvalidArgumentError:Va,InvalidOptionArgumentError:Ha,Command:Ee,Argument:Ba,Option:Ja,Help:Ka}=_s.default;var ne=ye(lt());var So=ye(require("fs")),di=ye(lt());var Xs={getConfiguration:()=>({get:()=>{}})},yn={getExtension:()=>{}},Dt=class i{fsPath;scheme;path;constructor(e){this.fsPath=e,this.scheme="file",this.path=e}static file(e){return new i(e)}static joinPath(e,...t){let n=[e.fsPath,...t].join("/");return new i(n)}toString(){return this.fsPath}};var K=ye(require("fs")),W=ye(require("path")),Ze=ye(require("os")),uo=class i{deps;_sessionFilesCache=null;_sessionFilesCacheTime=0;static SESSION_FILES_CACHE_TTL=6e4;constructor(e){this.deps=e}clearCache(){this._sessionFilesCache=null,this._sessionFilesCacheTime=0}getVSCodeUserPaths(){let e=Ze.platform(),t=Ze.homedir(),n=[],o=["Code","Code - Insiders","Code - Exploration","VSCodium","Cursor"];if(e==="win32"){let c=process.env.APPDATA||W.join(t,"AppData","Roaming");for(let u of o)n.push(W.join(c,u,"User"))}else if(e==="darwin")for(let c of o)n.push(W.join(t,"Library","Application Support",c,"User"));else{let c=process.env.XDG_CONFIG_HOME||W.join(t,".config");for(let u of o)n.push(W.join(c,u,"User"))}let r=[W.join(t,".vscode-server","data","User"),W.join(t,".vscode-server-insiders","data","User"),W.join(t,".vscode-remote","data","User"),W.join("/tmp",".vscode-server","data","User"),W.join("/workspace",".vscode-server","data","User")];return n.push(...r),n}getDiagnosticCandidatePaths(){let e=[],t=this.getVSCodeUserPaths();for(let m of t){let h=!1;try{h=K.existsSync(m)}catch{}e.push({path:m,exists:h,source:"VS Code"})}let n=W.join(Ze.homedir(),".copilot","session-state"),o=!1;try{o=K.existsSync(n)}catch{}e.push({path:n,exists:o,source:"Copilot CLI"});let r=this.deps.openCode.getOpenCodeDataDir(),c=W.join(r,"storage","session"),u=!1;try{u=K.existsSync(c)}catch{}e.push({path:c,exists:u,source:"OpenCode (JSON)"});let d=W.join(r,"opencode.db"),f=!1;try{f=K.existsSync(d)}catch{}return e.push({path:d,exists:f,source:"OpenCode (DB)"}),e}checkCopilotExtension(){let e=yn.getExtension("GitHub.copilot"),t=yn.getExtension("GitHub.copilot-chat");if(!e&&!t)this.deps.log("\u26A0\uFE0F GitHub Copilot extensions not found");else{let o=e?e.isActive?"\u2705 Active":"\u23F3 Loading":"\u274C Not found",r=t?t.isActive?"\u2705 Active":"\u23F3 Loading":"\u274C Not found";this.deps.log(`GitHub Copilot: ${o}, Chat: ${r}`)}process.env.CODESPACES==="true"&&(!e?.isActive||!t?.isActive)&&this.deps.warn("\u26A0\uFE0F Running in Codespaces with inactive Copilot extensions")}async getCopilotSessionFiles(){let e=Date.now();if(this._sessionFilesCache&&e-this._sessionFilesCacheTime<i.SESSION_FILES_CACHE_TTL)return this.deps.log(`\u{1F4A8} Using cached session files list (${this._sessionFilesCache.length} files, cached ${Math.round((e-this._sessionFilesCacheTime)/1e3)}s ago)`),this._sessionFilesCache;let t=Xs.getConfiguration("copilot-token-tracker").get("sampleDataDirectory");if(t&&t.trim().length>0){let d=t.trim();try{if(K.existsSync(d)){let f=K.readdirSync(d).filter(m=>m.endsWith(".json")||m.endsWith(".jsonl")).map(m=>W.join(d,m));return this.deps.log(`\u{1F4F8} Sample data mode: using ${f.length} file(s) from ${d}`),this._sessionFilesCache=f,this._sessionFilesCacheTime=e,f}else this.deps.warn(`Sample data directory not found: ${d}`)}catch(f){this.deps.warn(`Error reading sample data directory: ${f}`)}}let n=[],o=Ze.platform(),r=Ze.homedir();this.deps.log(`\u{1F50D} Searching for Copilot session files on ${o}`);let c=this.getVSCodeUserPaths();this.deps.log(`\u{1F4C2} Considering ${c.length} candidate VS Code paths:`);for(let d of c)this.deps.log(` \u{1F4C1} ${d}`);let u=[];for(let d=0;d<c.length;d++){let f=c[d];try{K.existsSync(f)&&u.push(f)}catch(m){this.deps.warn(`Could not check path ${f}: ${m}`)}((d+1)%5===0||d===c.length-1)&&this.deps.log(`\u{1F4C2} Reading local folders [${d+1}/${c.length}]`)}this.deps.log(`\u2705 Found ${u.length} of ${c.length} VS Code paths exist on disk:`);for(let d of u)this.deps.log(` \u2705 ${d}`);try{for(let y=0;y<u.length;y++){let C=u[y],w=W.basename(W.dirname(C)),k=W.join(C,"workspaceStorage");try{if(K.existsSync(k))try{let A=K.readdirSync(k);for(let P of A){let q=W.join(k,P,"chatSessions");try{if(K.existsSync(q))try{let I=K.readdirSync(q).filter($=>$.endsWith(".json")||$.endsWith(".jsonl")).map($=>W.join(q,$));I.length>0&&(this.deps.log(`\u{1F4C4} Found ${I.length} session files in ${w}/workspaceStorage/${P}`),n.push(...I))}catch(I){this.deps.warn(`Could not read chat sessions in ${q}: ${I}`)}}catch(I){this.deps.warn(`Could not check chat sessions path ${q}: ${I}`)}}}catch(A){this.deps.warn(`Could not read workspace storage in ${k}: ${A}`)}}catch(A){this.deps.warn(`Could not check workspace storage path ${k}: ${A}`)}let v=W.join(C,"globalStorage","emptyWindowChatSessions");try{if(K.existsSync(v))try{let A=K.readdirSync(v).filter(P=>P.endsWith(".json")||P.endsWith(".jsonl")).map(P=>W.join(v,P));A.length>0&&(this.deps.log(`\u{1F4C4} Found ${A.length} session files in ${w}/globalStorage/emptyWindowChatSessions`),n.push(...A))}catch(A){this.deps.warn(`Could not read global storage in ${v}: ${A}`)}}catch(A){this.deps.warn(`Could not check global storage path ${v}: ${A}`)}let x=W.join(C,"globalStorage","github.copilot-chat");try{K.existsSync(x)&&(this.deps.log(`\u{1F4C4} Scanning ${w}/globalStorage/github.copilot-chat`),this.scanDirectoryForSessionFiles(x,n))}catch(A){this.deps.warn(`Could not check Copilot Chat global storage path ${x}: ${A}`)}}let d=W.join(Ze.homedir(),".copilot","session-state");this.deps.log(`\u{1F4C1} Checking Copilot CLI path: ${d} (exists: ${K.existsSync(d)})`);try{if(K.existsSync(d))try{let y=K.readdirSync(d,{withFileTypes:!0}),C=y.filter(v=>!v.isDirectory()&&(v.name.endsWith(".json")||v.name.endsWith(".jsonl"))).map(v=>W.join(d,v.name));C.length>0&&(this.deps.log(`\u{1F4C4} Found ${C.length} session files in Copilot CLI directory`),n.push(...C));let w=y.filter(v=>v.isDirectory()),k=0;for(let v of w){let x=W.join(d,v.name,"events.jsonl");try{K.existsSync(x)&&K.statSync(x).size>0&&(n.push(x),k++)}catch{}}k>0&&this.deps.log(`\u{1F4C4} Found ${k} session files in Copilot CLI subdirectories`)}catch(y){this.deps.warn(`Could not read Copilot CLI session path in ${d}: ${y}`)}}catch(y){this.deps.warn(`Could not check Copilot CLI session path ${d}: ${y}`)}let f=this.deps.openCode.getOpenCodeDataDir(),m=W.join(f,"storage","session"),h=W.join(f,"opencode.db");this.deps.log(`\u{1F4C1} Checking OpenCode JSON path: ${m} (exists: ${K.existsSync(m)})`),this.deps.log(`\u{1F4C1} Checking OpenCode DB path: ${h} (exists: ${K.existsSync(h)})`);try{if(K.existsSync(m)){let y=w=>{try{let k=K.readdirSync(w,{withFileTypes:!0});for(let v of k)if(v.isDirectory())y(W.join(w,v.name));else if(v.name.startsWith("ses_")&&v.name.endsWith(".json")){let x=W.join(w,v.name);try{K.statSync(x).size>0&&n.push(x)}catch{}}}catch{}};y(m);let C=n.length-n.filter(w=>!this.deps.openCode.isOpenCodeSessionFile(w)).length;C>0&&this.deps.log(`\u{1F4C4} Found ${C} session files in OpenCode storage`)}}catch(y){this.deps.warn(`Could not check OpenCode session path: ${y}`)}try{if(K.existsSync(h)){let y=new Set(n.filter(k=>this.deps.openCode.isOpenCodeSessionFile(k)).map(k=>this.deps.openCode.getOpenCodeSessionId(k)).filter(Boolean)),C=await this.deps.openCode.discoverOpenCodeDbSessions(),w=0;for(let k of C)y.has(k)||(n.push(W.join(f,`opencode.db#${k}`)),w++);w>0&&this.deps.log(`\u{1F4C4} Found ${w} additional session(s) in OpenCode database`)}}catch(y){this.deps.warn(`Could not read OpenCode database: ${y}`)}this.deps.log(`\u2728 Total: ${n.length} session file(s) discovered`),n.length===0&&this.deps.warn("\u26A0\uFE0F No session files found - Have you used GitHub Copilot Chat yet?"),this._sessionFilesCache=n,this._sessionFilesCacheTime=Date.now()}catch(d){this.deps.error("Error getting session files:",d)}return n}scanDirectoryForSessionFiles(e,t){try{let n=K.readdirSync(e,{withFileTypes:!0});for(let o of n){let r=W.join(e,o.name);if(o.isDirectory())this.scanDirectoryForSessionFiles(r,t);else if(o.name.endsWith(".json")||o.name.endsWith(".jsonl")){if(this.isNonSessionFile(o.name))continue;try{K.statSync(r).size>0&&t.push(r)}catch{}}}}catch(n){this.deps.warn(`Could not scan directory ${e}: ${n}`)}}isNonSessionFile(e){let t=["embeddings","index","cache","preferences","settings","config","workspacesessions","globalsessions","api.json"],n=e.toLowerCase();return t.some(o=>n.includes(o))}};var se=ye(require("fs")),be=ye(require("path")),go=ye(require("os")),ei=ye(Zs()),fo=class{_sqlJsModule=null;extensionUri;constructor(e){this.extensionUri=e}getOpenCodeDataDir(){let e=go.platform(),t=go.homedir();if(e==="win32")return be.join(t,".local","share","opencode");let n=process.env.XDG_DATA_HOME||be.join(t,".local","share");return be.join(n,"opencode")}isOpenCodeSessionFile(e){let t=e.toLowerCase().replace(/\\/g,"/");return t.includes("/opencode/storage/session/")||t.includes("/opencode/opencode.db#ses_")}isOpenCodeDbSession(e){return e.includes("opencode.db#ses_")}async initSqlJs(){if(this._sqlJsModule)return this._sqlJsModule;let e=be.join(__dirname,"sql-wasm.wasm"),t;return se.existsSync(e)&&(t=se.readFileSync(e)),this._sqlJsModule=await(0,ei.default)(t?{wasmBinary:t}:void 0),this._sqlJsModule}async readOpenCodeDbSession(e){let t=be.join(this.getOpenCodeDataDir(),"opencode.db");if(!se.existsSync(t))return null;try{let n=await this.initSqlJs(),o=se.readFileSync(t),r=new n.Database(o);try{let c=r.exec("SELECT id, slug, title, time_created, time_updated, project_id, directory FROM session WHERE id = ?",[e]);if(c.length===0||c[0].values.length===0)return null;let u=c[0].values[0],d=c[0].columns,f={};for(let m=0;m<d.length;m++)f[d[m]]=u[m];return{id:f.id,slug:f.slug,title:f.title,projectID:f.project_id,directory:f.directory,time:{created:f.time_created,updated:f.time_updated}}}finally{r.close()}}catch{return null}}async readOpenCodeDbMessages(e){let t=be.join(this.getOpenCodeDataDir(),"opencode.db");if(!se.existsSync(t))return[];try{let n=await this.initSqlJs(),o=se.readFileSync(t),r=new n.Database(o);try{let c=r.exec("SELECT id, data, time_created FROM message WHERE session_id = ? ORDER BY time_created ASC",[e]);return c.length===0?[]:c[0].values.map(u=>{let d=JSON.parse(u[1]);return d.id=u[0],d.time=d.time||{},d.time.created=d.time.created||u[2],d})}finally{r.close()}}catch{return[]}}async readOpenCodeDbParts(e){let t=be.join(this.getOpenCodeDataDir(),"opencode.db");if(!se.existsSync(t))return[];try{let n=await this.initSqlJs(),o=se.readFileSync(t),r=new n.Database(o);try{let c=r.exec("SELECT id, data, time_created FROM part WHERE message_id = ? ORDER BY time_created ASC",[e]);return c.length===0?[]:c[0].values.map(u=>{let d=JSON.parse(u[1]);return d.id=u[0],d.time=d.time||{},d.time.created=d.time.created||u[2],d})}finally{r.close()}}catch{return[]}}async discoverOpenCodeDbSessions(){let e=be.join(this.getOpenCodeDataDir(),"opencode.db");if(!se.existsSync(e))return[];try{let t=await this.initSqlJs(),n=se.readFileSync(e),o=new t.Database(n);try{let r=o.exec("SELECT id FROM session");return r.length===0?[]:r[0].values.map(c=>c[0])}finally{o.close()}}catch{return[]}}async statSessionFile(e){if(this.isOpenCodeDbSession(e)){let t=be.join(this.getOpenCodeDataDir(),"opencode.db");return se.promises.stat(t)}return se.promises.stat(e)}readOpenCodeMessages(e){let t=this.getOpenCodeDataDir(),n=be.join(t,"storage","message",e),o=[];try{if(!se.existsSync(n))return o;let r=se.readdirSync(n,{withFileTypes:!0});for(let c of r)if(!(!c.isFile()||!c.name.endsWith(".json")))try{let u=se.readFileSync(be.join(n,c.name),"utf8"),d=JSON.parse(u);o.push(d)}catch{}}catch{}return o.sort((r,c)=>(r.time?.created||0)-(c.time?.created||0)),o}readOpenCodeParts(e){let t=this.getOpenCodeDataDir(),n=be.join(t,"storage","part",e),o=[];try{if(!se.existsSync(n))return o;let r=se.readdirSync(n,{withFileTypes:!0});for(let c of r)if(!(!c.isFile()||!c.name.endsWith(".json")))try{let u=se.readFileSync(be.join(n,c.name),"utf8"),d=JSON.parse(u);o.push(d)}catch{}}catch{}return o.sort((r,c)=>(r.time?.start||0)-(c.time?.start||0)),o}getOpenCodeSessionId(e){let t=e.indexOf("opencode.db#");if(t!==-1)return e.substring(t+12);let n=be.basename(e,".json");return n.startsWith("ses_")?n:null}async getOpenCodeMessagesForSession(e){let t=this.getOpenCodeSessionId(e);if(!t)return[];if(this.isOpenCodeDbSession(e))return this.readOpenCodeDbMessages(t);let n=await this.readOpenCodeDbMessages(t);return n.length>0?n:this.readOpenCodeMessages(t)}async getOpenCodePartsForMessage(e){let t=await this.readOpenCodeDbParts(e);return t.length>0?t:this.readOpenCodeParts(e)}async getTokensFromOpenCodeSession(e){let t=await this.getOpenCodeMessagesForSession(e),n=0,o=0;for(let r of t)r.role==="assistant"&&r.tokens&&(typeof r.tokens.total=="number"&&(o=r.tokens.total),n+=r.tokens.reasoning||0);return{tokens:o,thinkingTokens:n}}async countOpenCodeInteractions(e){return(await this.getOpenCodeMessagesForSession(e)).filter(n=>n.role==="user").length}async getOpenCodeModelUsage(e){let t={},n=await this.getOpenCodeMessagesForSession(e),o=0;for(let r=0;r<n.length;r++){let c=n[r];if(c.role!=="user")continue;let u=n.filter((C,w)=>w>r&&C.role==="assistant"&&C.parentID===c.id);if(u.length===0)continue;let d=o;for(let C of u)typeof C.tokens?.total=="number"&&(d=Math.max(d,C.tokens.total));let f=d-o;if(f<=0){o=d;continue}let m=u[0].modelID||u[0].model?.modelID||"unknown";t[m]||(t[m]={inputTokens:0,outputTokens:0});let h=u.reduce((C,w)=>C+(w.tokens?.output||0)+(w.tokens?.reasoning||0),0),y=Math.max(0,f-h);t[m].inputTokens+=y,t[m].outputTokens+=h,o=d}return t}async getOpenCodeSessionData(e){let t=await this.getOpenCodeMessagesForSession(e),n=Date.now();t.length>0&&t[0].time_created&&(n=t[0].time_created);let{tokens:o}=await this.getTokensFromOpenCodeSession(e),r=await this.countOpenCodeInteractions(e),c=await this.getOpenCodeModelUsage(e),u={},d=0;for(let m=0;m<t.length;m++){let h=t[m];if(h.role!=="user")continue;let y=t.filter((w,k)=>k>m&&w.role==="assistant"&&w.parentID===h.id);if(y.length===0)continue;let C=y[0].modelID||y[0].model?.modelID||"unknown";u[C]=(u[C]||0)+1}let f={};for(let[m,h]of Object.entries(c))f[m]={...h,interactions:u[m]||0};return{tokens:o,interactions:r,modelUsage:f,timestamp:n}}};function Se(i){return typeof i=="object"&&i!==null}function da(i){return typeof i!="string"?!1:!["__proto__","prototype","constructor","hasOwnProperty"].includes(i)&&!i.startsWith("__")}function Ft(i){return/^\d+$/.test(i)}function _n(i,e){if(typeof i!="string")return e;let t=i.trim();return t?t.startsWith("copilot/")?t.substring(8):t:e}function pa(i,e){if(!Se(e))return i;let t=e.kind,n=e.k,o=e.v;if(t===0)return o;if(!Array.isArray(n)||n.length===0)return i;let r=n.map(String);for(let m of r)if(!da(m))return i;let c=Se(i)?i:Object.create(null),u=c,d=(m,h,y)=>{let C=Ft(y),w=m[h];return Se(w)||(w=C?[]:Object.create(null),m[h]=w),w};for(let m=0;m<r.length-1;m++){let h=r[m],y=r[m+1];if(Array.isArray(u)&&Ft(h)){let C=Number(h),w=u[C];Se(w)||(w=Ft(y)?[]:Object.create(null),u[C]=w),u=w;continue}if(!Se(u))return c;u=d(u,h,y)}let f=r[r.length-1];if(t===1)return Array.isArray(u)&&Ft(f)?(u[Number(f)]=o,c):(Se(u)&&Object.defineProperty(u,f,{value:o,writable:!0,enumerable:!0,configurable:!0}),c);if(t===2){let m;if(Array.isArray(u)&&Ft(f)){let h=Number(f);Array.isArray(u[h])||(u[h]=[]),m=u[h]}else Se(u)&&(Array.isArray(u[f])||Object.defineProperty(u,f,{value:[],writable:!0,enumerable:!0,configurable:!0}),m=u[f]);return Array.isArray(m)&&(Array.isArray(o)?m.push(...o):m.push(o)),c}return c}function ma(i){if(!Array.isArray(i))return{responseText:"",thinkingText:""};let e="",t="";for(let n of i){if(!Se(n))continue;if(n.kind==="thinking"){let c=n.value;typeof c=="string"&&c&&(t+=c);continue}let o=Se(n.content)?n.content.value:void 0,r=n.value;if(typeof o=="string"&&o){e+=o;continue}typeof r=="string"&&r&&(e+=r)}return{responseText:e,thinkingText:t}}function ti(i,e,t,n){let o={},r=0,c=0,u=0,d=0,f,m="gpt-4o",h=k=>typeof k=="string"&&k?k:m,y=(k,v)=>{let x=h(k);o[x]||(o[x]={inputTokens:0,outputTokens:0});let A=t(v,x);o[x].inputTokens+=A,c+=A},C=(k,v)=>{let x=h(k);o[x]||(o[x]={inputTokens:0,outputTokens:0});let A=t(v,x);o[x].outputTokens+=A,u+=A};if(i.endsWith(".jsonl")){let k=e.split(/\r?\n/).filter(x=>x.trim()),v=!1;if(k.length>0)try{let x=JSON.parse(k[0]);x&&typeof x.kind=="number"&&(v=!0)}catch{}if(v){let x=Object.create(null);for(let P of k)try{let q=JSON.parse(P);x=pa(x,q)}catch{}let A=Se(x)&&Array.isArray(x.requests)?x.requests:[];if(A.length>0){r=A.filter(P=>Se(P)&&Se(P.message)&&typeof P.message.text=="string"&&P.message.text.trim()).length;for(let P of A){if(!Se(P))continue;let q=_n(P.modelId??P.selectedModel?.identifier??P.model,m),I=n?n(P):void 0,$=_n(I,""),j=$&&$!==m?$:q,ve=P.message;Se(ve)&&typeof ve.text=="string"&&y(j,ve.text);let{responseText:z,thinkingText:G}=ma(P.response);z&&C(j,z),G&&(d+=t(G,j))}}return{tokens:c+u+d,interactions:r,modelUsage:o,thinkingTokens:d}}try{f=JSON.parse(e.trim())}catch{return{tokens:0,interactions:0,modelUsage:{},thinkingTokens:0}}}if(!f)try{f=JSON.parse(e)}catch{return{tokens:0,interactions:0,modelUsage:{},thinkingTokens:0}}let w=Array.isArray(f.requests)?f.requests:Array.isArray(f.history)?f.history:[];r=w.length;for(let k of w){let v=n?n(k):k?.model||m,x=_n(v,m);if(o[x]||(o[x]={inputTokens:0,outputTokens:0}),k?.message?.parts){for(let P of k.message.parts)if(typeof P?.text=="string"&&P.text){let q=t(P.text,x);o[x].inputTokens+=q,c+=q}}else if(typeof k?.message?.text=="string"){let P=t(k.message.text,x);o[x].inputTokens+=P,c+=P}let A=Array.isArray(k?.response)?k.response:Array.isArray(k?.responses)?k.responses:[];for(let P of A){if(P?.kind==="thinking"&&typeof P?.value=="string"&&P.value){d+=t(P.value,x);continue}if(typeof P?.value=="string"&&P.value){let q=t(P.value,x);o[x].outputTokens+=q,u+=q}if(P?.message?.parts){for(let q of P.message.parts)if(typeof q?.text=="string"&&q.text){let I=t(q.text,x);o[x].outputTokens+=I,u+=I}}}}return{tokens:c+u+d,interactions:r,modelUsage:o,thinkingTokens:d}}function pe(i,e="gpt-4",t={}){let n=.25;for(let[o,r]of Object.entries(t))if(e.includes(o)||e.includes(o.replace("-",""))){n=r;break}return Math.ceil(i.length*n)}function oi(i){let e=0,t=0,n=i.trim().split(`
34
+ `),o={},r=!1,c=0,u=0;for(let m of n)if(m.trim())try{let h=JSON.parse(m);if(typeof h.kind=="number"&&(r=!0,o=Ut(o,h)),h.type==="session.shutdown"&&h.data?.modelMetrics)for(let y of Object.values(h.data.modelMetrics)){let C=y?.usage;C&&(u+=(typeof C.inputTokens=="number"?C.inputTokens:0)+(typeof C.outputTokens=="number"?C.outputTokens:0))}if(h.type==="user.message"&&h.data?.content||h.type==="assistant.message"&&h.data?.content?e+=pe(h.data.content):h.type==="tool.result"&&h.data?.output?e+=pe(h.data.output):h.content&&(e+=pe(h.content)),h.kind===2&&h.k?.[0]==="requests"&&Array.isArray(h.v))for(let y of h.v)y.message?.text&&(e+=pe(y.message.text));if(h.kind===2&&h.k?.includes("response")&&Array.isArray(h.v))for(let y of h.v){if(y.kind==="thinking"&&y.value){t+=pe(y.value);continue}y.value?e+=pe(y.value):y.kind==="markdownContent"&&y.content?.value&&(e+=pe(y.content.value))}}catch{c++}let d=0;if(r){let m=c>0?Cn(n):new Map,h=o.requests&&Array.isArray(o.requests)?o.requests:[],y=h.length;for(let C of m.keys())C+1>y&&(y=C+1);for(let C=0;C<y;C++){let w=h[C],k=!1;if(w?.result){let v=w.result;if(typeof v.promptTokens=="number"&&typeof v.outputTokens=="number")d+=v.promptTokens+v.outputTokens,k=!0;else if(v.metadata&&typeof v.metadata.promptTokens=="number"&&typeof v.metadata.outputTokens=="number")d+=v.metadata.promptTokens+v.metadata.outputTokens,k=!0;else if(v.usage){let x=v.usage,A=typeof x.promptTokens=="number"?x.promptTokens:0,P=typeof x.completionTokens=="number"?x.completionTokens:0;d+=A+P,k=!0}}if(!k){let v=m.get(C);v&&(d+=v.promptTokens+v.outputTokens)}}}let f=!r&&u>0?u:d;return{tokens:e+t,thinkingTokens:t,actualTokens:f}}function Cn(i){let e=new Map;for(let t of i){if(!t.includes('"result"'))continue;let n=t.match(/"k":\s*\["requests",\s*(\d+),\s*"result"\]/);if(!n)continue;let o=parseInt(n[1],10),r=t.match(/"promptTokens":(\d+)/),c=t.match(/"outputTokens":(\d+)/),u=t.match(/"completionTokens":(\d+)/);r&&(c||u)&&e.set(o,{promptTokens:parseInt(r[1],10),outputTokens:parseInt(c?.[1]||u[1],10)})}return e}function ut(i,e={}){if(i.modelId)return i.modelId.replace(/^copilot\//,"");if(i.result&&i.result.metadata&&i.result.metadata.modelId)return i.result.metadata.modelId.replace(/^copilot\//,"");if(i.result&&i.result.details){let t={};for(let[o,r]of Object.entries(e))if(r.displayNames)for(let c of r.displayNames)t[c]=o;let n=Object.keys(t).sort((o,r)=>r.length-o.length);for(let o of n)if(i.result.details.includes(o))return t[o]}return"gpt-4"}function dt(i){let e=i.trim();if(!e.includes(`
35
35
  `))return!1;let t=e.split(`
36
36
  `).filter(r=>r.trim());if(t.length<2)return!1;let n=t[0].trim(),o=t[1].trim();return n.startsWith("{")&&n.endsWith("}")&&o.startsWith("{")&&o.endsWith("}")}function yo(i){let e=i.trim();return/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/i.test(e)}function Ut(i,e){if(typeof e!="object"||e===null)return i;let{kind:t,k:n,v:o}=e;if(t===0)return o;if(!Array.isArray(n)||n.length===0)return i;let r=n.map(String),c=typeof i=="object"&&i!==null?i:{},u=c;for(let f=0;f<r.length-1;f++){let m=r[f],h=r[f+1],y=/^\d+$/.test(h);if(Array.isArray(u)){let C=Number(m);(!u[C]||typeof u[C]!="object")&&(u[C]=y?[]:{}),u=u[C]}else(!u[m]||typeof u[m]!="object")&&(u[m]=y?[]:{}),u=u[m]}let d=r[r.length-1];if(t===1)return Array.isArray(u)?u[Number(d)]=o:u[d]=o,c;if(t===2){let f;if(Array.isArray(u)){let m=Number(d);Array.isArray(u[m])||(u[m]=[]),f=u[m]}else Array.isArray(u[d])||(u[d]=[]),f=u[d];return Array.isArray(o)?f.push(...o):f.push(o),c}return c}function pt(i,e={}){let t=e[i];if(t&&typeof t.multiplier=="number")return t.multiplier===0?"standard":"premium";for(let[n,o]of Object.entries(e))if((i.includes(n)||n.includes(i))&&typeof o.multiplier=="number")return o.multiplier===0?"standard":"premium";return"unknown"}function ni(i,e={}){let t=0;for(let[n,o]of Object.entries(i)){let r=e[n];if(r){let c=o.inputTokens/1e6*r.inputCostPerMillion,u=o.outputTokens/1e6*r.outputCostPerMillion;t+=c+u}else{let c=e["gpt-4o-mini"],u=o.inputTokens/1e6*c.inputCostPerMillion,d=o.outputTokens/1e6*c.outputCostPerMillion;t+=u+d}}return t}function si(){return{file:0,selection:0,implicitSelection:0,symbol:0,codebase:0,workspace:0,terminal:0,vscode:0,terminalLastCommand:0,terminalSelection:0,clipboard:0,changes:0,outputPanel:0,problemsPanel:0,byKind:{},copilotInstructions:0,agentsMd:0,byPath:{}}}var Nt=ye(require("fs"));function bo(i){return!i||!i.kind?"ask":i.kind==="edit"?"edit":i.kind==="ask"?"ask":i.kind==="agent"?!i.id||i.id==="agent"?"agent":typeof i.id=="string"&&i.id.includes("plan-agent/Plan.agent.md")?"plan":typeof i.id=="string"&&i.id.includes(".agent.md")?"customAgent":"agent":"ask"}function _o(i){return i.startsWith("mcp.")||i.startsWith("mcp_")}function It(i){return i.startsWith("mcp_github_github_")?"mcp_io_github_git_"+i.substring(18):i.startsWith("mcp.github.github.")?"mcp.io.github.git."+i.substring(18):i}function Co(i,e={}){let t=e[i];return t&&t.includes(":")?t.split(":")[0].trim():i.startsWith("mcp_io_github_git_")||i.startsWith("mcp.io.github.git.")?"GitHub MCP (Local)":i.startsWith("mcp_github_github_")||i.startsWith("mcp.github.github.")?"GitHub MCP (Remote)":i.replace(/^mcp[._]/,"").split(/[._]/)[0]||"unknown"}function wo(i,e){i.toolCalls.total+=e.toolCalls.total;for(let[t,n]of Object.entries(e.toolCalls.byTool))i.toolCalls.byTool[t]=(i.toolCalls.byTool[t]||0)+n;i.modeUsage.ask+=e.modeUsage.ask,i.modeUsage.edit+=e.modeUsage.edit,i.modeUsage.agent+=e.modeUsage.agent,i.modeUsage.plan+=e.modeUsage.plan,i.modeUsage.customAgent+=e.modeUsage.customAgent,i.contextReferences.file+=e.contextReferences.file,i.contextReferences.selection+=e.contextReferences.selection,i.contextReferences.implicitSelection+=e.contextReferences.implicitSelection||0,i.contextReferences.symbol+=e.contextReferences.symbol,i.contextReferences.codebase+=e.contextReferences.codebase,i.contextReferences.workspace+=e.contextReferences.workspace,i.contextReferences.terminal+=e.contextReferences.terminal,i.contextReferences.vscode+=e.contextReferences.vscode,i.contextReferences.terminalLastCommand+=e.contextReferences.terminalLastCommand||0,i.contextReferences.terminalSelection+=e.contextReferences.terminalSelection||0,i.contextReferences.clipboard+=e.contextReferences.clipboard||0,i.contextReferences.changes+=e.contextReferences.changes||0,i.contextReferences.outputPanel+=e.contextReferences.outputPanel||0,i.contextReferences.problemsPanel+=e.contextReferences.problemsPanel||0,i.contextReferences.copilotInstructions+=e.contextReferences.copilotInstructions||0,i.contextReferences.agentsMd+=e.contextReferences.agentsMd||0;for(let[t,n]of Object.entries(e.contextReferences.byKind||{}))i.contextReferences.byKind[t]=(i.contextReferences.byKind[t]||0)+n;for(let[t,n]of Object.entries(e.contextReferences.byPath||{}))i.contextReferences.byPath[t]=(i.contextReferences.byPath[t]||0)+n;i.mcpTools.total+=e.mcpTools.total;for(let[t,n]of Object.entries(e.mcpTools.byServer))i.mcpTools.byServer[t]=(i.mcpTools.byServer[t]||0)+n;for(let[t,n]of Object.entries(e.mcpTools.byTool))i.mcpTools.byTool[t]=(i.mcpTools.byTool[t]||0)+n;if(e.modelSwitching||(e.modelSwitching={uniqueModels:[],modelCount:0,switchCount:0,tiers:{standard:[],premium:[],unknown:[]},hasMixedTiers:!1,standardRequests:0,premiumRequests:0,unknownRequests:0,totalRequests:0}),e.modelSwitching.modelCount>0){i.modelSwitching.totalSessions++,i.modelSwitching.modelsPerSession.push(e.modelSwitching.modelCount);for(let t of e.modelSwitching.tiers.standard)i.modelSwitching.standardModels.includes(t)||i.modelSwitching.standardModels.push(t);for(let t of e.modelSwitching.tiers.premium)i.modelSwitching.premiumModels.includes(t)||i.modelSwitching.premiumModels.push(t);for(let t of e.modelSwitching.tiers.unknown)i.modelSwitching.unknownModels.includes(t)||i.modelSwitching.unknownModels.push(t);if(e.modelSwitching.hasMixedTiers&&i.modelSwitching.mixedTierSessions++,i.modelSwitching.standardRequests+=e.modelSwitching.standardRequests||0,i.modelSwitching.premiumRequests+=e.modelSwitching.premiumRequests||0,i.modelSwitching.unknownRequests+=e.modelSwitching.unknownRequests||0,i.modelSwitching.totalRequests+=e.modelSwitching.totalRequests||0,i.modelSwitching.modelsPerSession.length>0){let t=i.modelSwitching.modelsPerSession;i.modelSwitching.averageModelsPerSession=t.reduce((n,o)=>n+o,0)/t.length,i.modelSwitching.maxModelsPerSession=Math.max(...t),i.modelSwitching.minModelsPerSession=Math.min(...t),i.modelSwitching.switchingFrequency=t.filter(n=>n>1).length/t.length*100}}if(e.editScope){i.editScope.singleFileEdits+=e.editScope.singleFileEdits,i.editScope.multiFileEdits+=e.editScope.multiFileEdits,i.editScope.totalEditedFiles+=e.editScope.totalEditedFiles;let t=i.editScope.singleFileEdits+i.editScope.multiFileEdits;i.editScope.avgFilesPerSession=t>0?i.editScope.totalEditedFiles/t:0}if(e.applyUsage&&(i.applyUsage.totalApplies+=e.applyUsage.totalApplies,i.applyUsage.totalCodeBlocks+=e.applyUsage.totalCodeBlocks,i.applyUsage.applyRate=i.applyUsage.totalCodeBlocks>0?i.applyUsage.totalApplies/i.applyUsage.totalCodeBlocks*100:0),e.sessionDuration){i.sessionDuration.totalDurationMs+=e.sessionDuration.totalDurationMs;let t=i.sessions;if(t>0){i.sessionDuration.avgDurationMs=i.sessionDuration.totalDurationMs/t;let n=i.sessionDuration.avgFirstProgressMs*(t-1);i.sessionDuration.avgFirstProgressMs=(n+e.sessionDuration.avgFirstProgressMs)/t;let o=i.sessionDuration.avgTotalElapsedMs*(t-1);i.sessionDuration.avgTotalElapsedMs=(o+e.sessionDuration.avgTotalElapsedMs)/t;let r=i.sessionDuration.avgWaitTimeMs*(t-1);i.sessionDuration.avgWaitTimeMs=(r+e.sessionDuration.avgWaitTimeMs)/t}}if(e.conversationPatterns){i.conversationPatterns.multiTurnSessions+=e.conversationPatterns.multiTurnSessions,i.conversationPatterns.singleTurnSessions+=e.conversationPatterns.singleTurnSessions,i.conversationPatterns.maxTurnsInSession=Math.max(i.conversationPatterns.maxTurnsInSession,e.conversationPatterns.maxTurnsInSession);let t=i.conversationPatterns.multiTurnSessions+i.conversationPatterns.singleTurnSessions;if(t>0){let o=i.conversationPatterns.avgTurnsPerSession*(t-1)+e.conversationPatterns.avgTurnsPerSession;i.conversationPatterns.avgTurnsPerSession=o/t}}e.agentTypes&&(i.agentTypes.editsAgent+=e.agentTypes.editsAgent,i.agentTypes.defaultAgent+=e.agentTypes.defaultAgent,i.agentTypes.workspaceAgent+=e.agentTypes.workspaceAgent,i.agentTypes.other+=e.agentTypes.other)}function ii(i,e){let t=i.match(/#file/gi);t&&(e.file+=t.length);let n=i.match(/#selection/gi);n&&(e.selection+=n.length);let o=i.match(/#symbol/gi),r=i.match(/#sym(?![:\w])/gi);o&&(e.symbol+=o.length),r&&(e.symbol+=r.length);let c=i.match(/#codebase/gi);c&&(e.codebase+=c.length);let u=i.match(/#terminalLastCommand/gi);u&&(e.terminalLastCommand+=u.length);let d=i.match(/#terminalSelection/gi);d&&(e.terminalSelection+=d.length);let f=i.match(/#clipboard/gi);f&&(e.clipboard+=f.length);let m=i.match(/#changes/gi);m&&(e.changes+=m.length);let h=i.match(/#outputPanel/gi);h&&(e.outputPanel+=h.length);let y=i.match(/#problemsPanel/gi);y&&(e.problemsPanel+=y.length);let C=i.match(/@workspace/gi);C&&(e.workspace+=C.length);let w=i.match(/@terminal/gi);w&&(e.terminal+=w.length);let k=i.match(/@vscode/gi);k&&(e.vscode+=k.length)}function kn(i,e){if(Array.isArray(i))for(let t of i){if(!t||typeof t!="object")continue;let n=t.kind;typeof n=="string"&&(e.byKind[n]=(e.byKind[n]||0)+1);let o=null;if(n==="reference"&&t.reference?o=t.reference:n==="inlineReference"&&t.inlineReference&&(o=t.inlineReference),o){let r=o.fsPath||o.path;if(typeof r=="string"){let u=r.replace(/\\/g,"/").toLowerCase();u.endsWith("/.github/copilot-instructions.md")||u.includes(".github/copilot-instructions.md")?e.copilotInstructions++:u.endsWith("/agents.md")||u.match(/\/agents\.md$/i)?e.agentsMd++:u.endsWith(".instructions.md")||u.includes(".instructions.md")?e.copilotInstructions++:e.file++;let d=r.length>100?"..."+r.substring(r.length-97):r;e.byPath[d]=(e.byPath[d]||0)+1}let c=o.name;if(typeof c=="string"&&n==="reference"){e.symbol++;let u=`#sym:${c}`;e.byPath[u]=(e.byPath[u]||0)+1}}}}function ri(i,e){if(!(!i||!Array.isArray(i.variables)))for(let t of i.variables){if(!t||typeof t!="object")continue;let n=t.kind;if(typeof n=="string"&&(e.byKind[n]=(e.byKind[n]||0)+1),n==="generic"&&typeof t.name=="string"&&t.name.startsWith("sym:")){e.symbol++;let o=`#${t.name}`;e.byPath[o]=(e.byPath[o]||0)+1}if(n==="promptFile"&&t.value){let o=t.value,r=o.fsPath||o.path||o.external;if(typeof r=="string"){let c=r.replace(/\\/g,"/").toLowerCase();c.endsWith("/.github/copilot-instructions.md")||c.includes(".github/copilot-instructions.md")||c.endsWith("/agents.md")||c.match(/\/agents\.md$/i)}}}}function Sn(i){let e=i.modeUsage.ask+i.modeUsage.edit+i.modeUsage.agent;i.conversationPatterns={multiTurnSessions:e>1?1:0,singleTurnSessions:e===1?1:0,avgTurnsPerSession:e,maxTurnsInSession:e}}function wn(i,e){if(i.message&&(i.message.text&&ii(i.message.text,e),i.message.parts))for(let t of i.message.parts)t.text&&ii(t.text,e);i.contentReferences&&Array.isArray(i.contentReferences)&&kn(i.contentReferences,e),i.variableData&&ri(i.variableData,e)}async function vn(i,e,t){try{let n=await fa(i,e),o=n?Object.keys(n).length:0;if(!n||o===0)return;let r=Object.keys(n);t.modelSwitching.uniqueModels=r,t.modelSwitching.modelCount=r.length;let c=[],u=[],d=[];for(let h of r){let y=pt(h,i.modelPricing);y==="standard"?c.push(h):y==="premium"?u.push(h):d.push(h)}t.modelSwitching.tiers={standard:c,premium:u,unknown:d},t.modelSwitching.hasMixedTiers=c.length>0&&u.length>0;let f=await Nt.promises.readFile(e,"utf8");if(yo(f))return;if(e.endsWith(".jsonl")||dt(f)){let h=f.trim().split(`
37
37
  `),y={standard:0,premium:0,unknown:0},C="gpt-4o";for(let w of h)if(w.trim())try{let k=JSON.parse(w);if(k.kind===0){let v=k.v?.selectedModel?.identifier||k.v?.selectedModel?.metadata?.id||k.v?.inputState?.selectedModel?.metadata?.id;v&&(C=v.replace(/^copilot\//,""))}if(k.kind===2&&k.k?.[0]==="selectedModel"){let v=k.v?.identifier||k.v?.metadata?.id;v&&(C=v.replace(/^copilot\//,""))}if(k.type==="user.message"){let v=k.model||C,x=pt(v,i.modelPricing);x==="standard"?y.standard++:x==="premium"?y.premium++:y.unknown++}if(k.kind===2&&k.k?.[0]==="requests"&&Array.isArray(k.v))for(let v of k.v){let x=C;v.modelId?x=v.modelId.replace(/^copilot\//,""):v.result?.metadata?.modelId?x=v.result.metadata.modelId.replace(/^copilot\//,""):v.result?.details&&(x=ut(v,i.modelPricing));let A=pt(x,i.modelPricing);A==="standard"?y.standard++:A==="premium"?y.premium++:y.unknown++}}catch{}t.modelSwitching.standardRequests=y.standard,t.modelSwitching.premiumRequests=y.premium,t.modelSwitching.unknownRequests=y.unknown,t.modelSwitching.totalRequests=y.standard+y.premium+y.unknown}else{let h=JSON.parse(f);if(h.requests&&Array.isArray(h.requests)){let y=null,C=0,w={standard:0,premium:0,unknown:0};for(let k of h.requests){let v=ut(k,i.modelPricing);y&&v!==y&&C++,y=v;let x=pt(v,i.modelPricing);x==="standard"?w.standard++:x==="premium"?w.premium++:w.unknown++}t.modelSwitching.switchCount=C,t.modelSwitching.standardRequests=w.standard,t.modelSwitching.premiumRequests=w.premium,t.modelSwitching.unknownRequests=w.unknown,t.modelSwitching.totalRequests=w.standard+w.premium+w.unknown}}}catch(n){i.warn(`Error calculating model switching for ${e}: ${n}`)}}async function ha(i,e,t){try{let n=await Nt.promises.readFile(e,"utf8");if(yo(n))return;let o=e.endsWith(".jsonl")||dt(n),r=new Set,c=0,u=0,d=[],f=[],m=[],h={editsAgent:0,defaultAgent:0,workspaceAgent:0,other:0};if(o){let x=n.trim().split(`
38
- `).filter(T=>T.trim()),A=!1;if(x.length>0)try{let T=JSON.parse(x[0]);T&&typeof T.kind=="number"&&(A=!0)}catch{}if(A){let T={};for(let I of x)try{let D=JSON.parse(I);T=Ut(T,D)}catch{}T.creationDate&&d.push(T.creationDate),T.lastMessageDate&&d.push(T.lastMessageDate);let q=T.requests||[];for(let I of q)if(I){if(I.timestamp&&d.push(I.timestamp),I.result?.timings&&f.push(I.result.timings),I.timeSpentWaiting!==void 0&&m.push(I.timeSpentWaiting),I.agent?.id){let D=I.agent.id;D.includes("edit")?h.editsAgent++:D.includes("default")?h.defaultAgent++:D.includes("workspace")?h.workspaceAgent++:h.other++}if(I.response&&Array.isArray(I.response))for(let D of I.response){if(D.kind==="textEditGroup"&&D.uri){let j=D.uri.path||JSON.stringify(D.uri);r.add(j)}D.kind==="codeblockUri"&&(u++,D.isEdit===!0&&c++)}}}}else{let x=JSON.parse(n);if(x.creationDate&&d.push(x.creationDate),x.lastMessageDate&&d.push(x.lastMessageDate),x.requests&&Array.isArray(x.requests))for(let A of x.requests){if(A.timestamp&&d.push(A.timestamp),A.result?.timings&&f.push(A.result.timings),A.timeSpentWaiting!==void 0&&m.push(A.timeSpentWaiting),A.agent?.id){let T=A.agent.id;T.includes("edit")?h.editsAgent++:T.includes("default")?h.defaultAgent++:T.includes("workspace")?h.workspaceAgent++:h.other++}if(A.response&&Array.isArray(A.response))for(let T of A.response){if(T.kind==="textEditGroup"&&T.uri){let q=T.uri.path||JSON.stringify(T.uri);r.add(q)}T.kind==="codeblockUri"&&(u++,T.isEdit===!0&&c++)}}}let y=r.size>0?1:0;t.editScope={singleFileEdits:r.size===1?1:0,multiFileEdits:r.size>1?1:0,totalEditedFiles:r.size,avgFilesPerSession:y>0?r.size/y:0},t.applyUsage={totalApplies:c,totalCodeBlocks:u,applyRate:u>0?c/u*100:0};let C=d.length>=2?Math.max(...d)-Math.min(...d):0,w=f.length>0?f.reduce((x,A)=>x+(A.firstProgress||0),0)/f.length:0,k=f.length>0?f.reduce((x,A)=>x+(A.totalElapsed||0),0)/f.length:0,v=m.length>0?m.reduce((x,A)=>x+A,0)/m.length:0;t.sessionDuration={totalDurationMs:C,avgDurationMs:C,avgFirstProgressMs:w,avgTotalElapsedMs:k,avgWaitTimeMs:v},Sn(t),t.agentTypes=h}catch(n){i.warn(`Error tracking enhanced metrics from ${e}: ${n}`)}}async function ai(i,e){let t={toolCalls:{total:0,byTool:{}},modeUsage:{ask:0,edit:0,agent:0,plan:0,customAgent:0},contextReferences:{file:0,selection:0,implicitSelection:0,symbol:0,codebase:0,workspace:0,terminal:0,vscode:0,terminalLastCommand:0,terminalSelection:0,clipboard:0,changes:0,outputPanel:0,problemsPanel:0,byKind:{},copilotInstructions:0,agentsMd:0,byPath:{}},mcpTools:{total:0,byServer:{},byTool:{}},modelSwitching:{uniqueModels:[],modelCount:0,switchCount:0,tiers:{standard:[],premium:[],unknown:[]},hasMixedTiers:!1,standardRequests:0,premiumRequests:0,unknownRequests:0,totalRequests:0}};try{if(i.openCode.isOpenCodeSessionFile(e)){let c=await i.openCode.getOpenCodeMessagesForSession(e);if(c.length>0){let u=[];for(let m of c){if(m.role==="user"){let h=m.agent||"agent";h==="build"||h==="agent"?t.modeUsage.agent++:h==="ask"?t.modeUsage.ask++:h==="edit"?t.modeUsage.edit++:t.modeUsage.agent++}if(m.role==="assistant"){let h=m.modelID||"unknown";u.push(h);let y=await i.openCode.getOpenCodePartsForMessage(m.id);for(let C of y)if(C.type==="tool"&&C.tool){t.toolCalls.total++;let w=C.tool;t.toolCalls.byTool[w]=(t.toolCalls.byTool[w]||0)+1}}}let d=[...new Set(u)];t.modelSwitching.uniqueModels=d,t.modelSwitching.modelCount=d.length,t.modelSwitching.totalRequests=u.length;let f=0;for(let m=1;m<u.length;m++)u[m]!==u[m-1]&&f++;t.modelSwitching.switchCount=f}return t}let n=await Nt.promises.readFile(e,"utf8");if(e.endsWith(".jsonl")||dt(n)){let c=n.trim().split(`
38
+ `).filter(P=>P.trim()),A=!1;if(x.length>0)try{let P=JSON.parse(x[0]);P&&typeof P.kind=="number"&&(A=!0)}catch{}if(A){let P={};for(let I of x)try{let $=JSON.parse(I);P=Ut(P,$)}catch{}P.creationDate&&d.push(P.creationDate),P.lastMessageDate&&d.push(P.lastMessageDate);let q=P.requests||[];for(let I of q)if(I){if(I.timestamp&&d.push(I.timestamp),I.result?.timings&&f.push(I.result.timings),I.timeSpentWaiting!==void 0&&m.push(I.timeSpentWaiting),I.agent?.id){let $=I.agent.id;$.includes("edit")?h.editsAgent++:$.includes("default")?h.defaultAgent++:$.includes("workspace")?h.workspaceAgent++:h.other++}if(I.response&&Array.isArray(I.response))for(let $ of I.response){if($.kind==="textEditGroup"&&$.uri){let j=$.uri.path||JSON.stringify($.uri);r.add(j)}$.kind==="codeblockUri"&&(u++,$.isEdit===!0&&c++)}}}}else{let x=JSON.parse(n);if(x.creationDate&&d.push(x.creationDate),x.lastMessageDate&&d.push(x.lastMessageDate),x.requests&&Array.isArray(x.requests))for(let A of x.requests){if(A.timestamp&&d.push(A.timestamp),A.result?.timings&&f.push(A.result.timings),A.timeSpentWaiting!==void 0&&m.push(A.timeSpentWaiting),A.agent?.id){let P=A.agent.id;P.includes("edit")?h.editsAgent++:P.includes("default")?h.defaultAgent++:P.includes("workspace")?h.workspaceAgent++:h.other++}if(A.response&&Array.isArray(A.response))for(let P of A.response){if(P.kind==="textEditGroup"&&P.uri){let q=P.uri.path||JSON.stringify(P.uri);r.add(q)}P.kind==="codeblockUri"&&(u++,P.isEdit===!0&&c++)}}}let y=r.size>0?1:0;t.editScope={singleFileEdits:r.size===1?1:0,multiFileEdits:r.size>1?1:0,totalEditedFiles:r.size,avgFilesPerSession:y>0?r.size/y:0},t.applyUsage={totalApplies:c,totalCodeBlocks:u,applyRate:u>0?c/u*100:0};let C=d.length>=2?Math.max(...d)-Math.min(...d):0,w=f.length>0?f.reduce((x,A)=>x+(A.firstProgress||0),0)/f.length:0,k=f.length>0?f.reduce((x,A)=>x+(A.totalElapsed||0),0)/f.length:0,v=m.length>0?m.reduce((x,A)=>x+A,0)/m.length:0;t.sessionDuration={totalDurationMs:C,avgDurationMs:C,avgFirstProgressMs:w,avgTotalElapsedMs:k,avgWaitTimeMs:v},Sn(t),t.agentTypes=h}catch(n){i.warn(`Error tracking enhanced metrics from ${e}: ${n}`)}}async function ai(i,e){let t={toolCalls:{total:0,byTool:{}},modeUsage:{ask:0,edit:0,agent:0,plan:0,customAgent:0},contextReferences:{file:0,selection:0,implicitSelection:0,symbol:0,codebase:0,workspace:0,terminal:0,vscode:0,terminalLastCommand:0,terminalSelection:0,clipboard:0,changes:0,outputPanel:0,problemsPanel:0,byKind:{},copilotInstructions:0,agentsMd:0,byPath:{}},mcpTools:{total:0,byServer:{},byTool:{}},modelSwitching:{uniqueModels:[],modelCount:0,switchCount:0,tiers:{standard:[],premium:[],unknown:[]},hasMixedTiers:!1,standardRequests:0,premiumRequests:0,unknownRequests:0,totalRequests:0}};try{if(i.openCode.isOpenCodeSessionFile(e)){let c=await i.openCode.getOpenCodeMessagesForSession(e);if(c.length>0){let u=[];for(let m of c){if(m.role==="user"){let h=m.agent||"agent";h==="build"||h==="agent"?t.modeUsage.agent++:h==="ask"?t.modeUsage.ask++:h==="edit"?t.modeUsage.edit++:t.modeUsage.agent++}if(m.role==="assistant"){let h=m.modelID||"unknown";u.push(h);let y=await i.openCode.getOpenCodePartsForMessage(m.id);for(let C of y)if(C.type==="tool"&&C.tool){t.toolCalls.total++;let w=C.tool;t.toolCalls.byTool[w]=(t.toolCalls.byTool[w]||0)+1}}}let d=[...new Set(u)];t.modelSwitching.uniqueModels=d,t.modelSwitching.modelCount=d.length,t.modelSwitching.totalRequests=u.length;let f=0;for(let m=1;m<u.length;m++)u[m]!==u[m-1]&&f++;t.modelSwitching.switchCount=f}return t}let n=await Nt.promises.readFile(e,"utf8");if(e.endsWith(".jsonl")||dt(n)){let c=n.trim().split(`
39
39
  `).filter(f=>f.trim()),u=!1;if(c.length>0)try{let f=JSON.parse(c[0]);f&&typeof f.kind=="number"&&(u=!0)}catch{}if(u){let f={};for(let y of c)try{let C=JSON.parse(y);f=Ut(f,C)}catch{}let m=f.inputState?.mode?bo(f.inputState.mode):"ask";if(f.inputState?.selections&&Array.isArray(f.inputState.selections)){for(let y of f.inputState.selections)if(y&&(y.startLineNumber!==y.endLineNumber||y.startColumn!==y.endColumn)){t.contextReferences.implicitSelection++;break}}let h=f.requests||[];for(let y of h)if(!(!y||!y.requestId)){if(m==="agent"?t.modeUsage.agent++:m==="edit"?t.modeUsage.edit++:m==="plan"?t.modeUsage.plan++:m==="customAgent"?t.modeUsage.customAgent++:t.modeUsage.ask++,y.agent?.id){let C=y.agent.id;t.toolCalls.total++,t.toolCalls.byTool[C]=(t.toolCalls.byTool[C]||0)+1}if(wn(y,t.contextReferences),y.response&&Array.isArray(y.response)){for(let C of y.response)if(C.kind==="toolInvocationSerialized"||C.kind==="prepareToolInvocation"){let w=C.toolId||C.toolName||C.invocationMessage?.toolName||C.toolSpecificData?.kind||"unknown";if(_o(w)){t.mcpTools.total++;let k=Co(w,i.toolNameMap);t.mcpTools.byServer[k]=(t.mcpTools.byServer[k]||0)+1;let v=It(w);t.mcpTools.byTool[v]=(t.mcpTools.byTool[v]||0)+1}else t.toolCalls.total++,t.toolCalls.byTool[w]=(t.toolCalls.byTool[w]||0)+1}}}return await vn(i,e,t),Sn(t),t}let d="ask";for(let f of c)if(f.trim())try{let m=JSON.parse(f);if(m.kind===0&&m.v?.inputState?.mode&&(d=bo(m.v.inputState.mode),m.v?.inputState?.selections&&Array.isArray(m.v.inputState.selections))){for(let h of m.v.inputState.selections)if(h.startLineNumber!==h.endLineNumber||h.startColumn!==h.endColumn){t.contextReferences.implicitSelection++;break}}if(m.kind===1&&m.k?.includes("mode")&&m.v&&(d=bo(m.v)),m.kind===1&&m.k?.includes("selections")&&Array.isArray(m.v)){for(let h of m.v)if(h&&(h.startLineNumber!==h.endLineNumber||h.startColumn!==h.endColumn)){t.contextReferences.implicitSelection++;break}}if(m.kind===1&&m.k?.includes("contentReferences")&&Array.isArray(m.v)&&kn(m.v,t.contextReferences),m.kind===1&&m.k?.includes("variableData")&&m.v&&ri(m.v,t.contextReferences),m.kind===2&&m.k?.[0]==="requests"&&Array.isArray(m.v))for(let h of m.v){if(h.requestId&&(d==="agent"?t.modeUsage.agent++:d==="edit"?t.modeUsage.edit++:d==="plan"?t.modeUsage.plan++:d==="customAgent"?t.modeUsage.customAgent++:t.modeUsage.ask++),h.agent?.id){let y=h.agent.id;t.toolCalls.total++,t.toolCalls.byTool[y]=(t.toolCalls.byTool[y]||0)+1}if(wn(h,t.contextReferences),h.response&&Array.isArray(h.response)){for(let y of h.response)if(y.kind==="toolInvocationSerialized"||y.kind==="prepareToolInvocation"){t.toolCalls.total++;let C=y.toolId||y.toolName||y.invocationMessage?.toolName||y.toolSpecificData?.kind||"unknown";t.toolCalls.byTool[C]=(t.toolCalls.byTool[C]||0)+1}}}if(m.kind===2&&m.k?.includes("response")&&Array.isArray(m.v)){for(let h of m.v)if(h.kind==="toolInvocationSerialized"){t.toolCalls.total++;let y=h.toolId||h.toolName||h.invocationMessage?.toolName||h.toolSpecificData?.kind||"unknown";t.toolCalls.byTool[y]=(t.toolCalls.byTool[y]||0)+1}}if(m.type==="user.message"&&t.modeUsage.ask++,(m.type==="tool.call"||m.type==="tool.result")&&t.modeUsage.ask>0&&(t.modeUsage.ask--,t.modeUsage.agent++),m.type==="tool.call"||m.type==="tool.result"){let h=m.data?.toolName||m.toolName||"unknown";if(_o(h)){t.mcpTools.total++;let y=Co(h,i.toolNameMap);t.mcpTools.byServer[y]=(t.mcpTools.byServer[y]||0)+1;let C=It(h);t.mcpTools.byTool[C]=(t.mcpTools.byTool[C]||0)+1}else t.toolCalls.total++,t.toolCalls.byTool[h]=(t.toolCalls.byTool[h]||0)+1}if(m.type==="mcp.tool.call"||m.data?.mcpServer){t.mcpTools.total++;let h=m.data?.mcpServer||"unknown",y=m.data?.toolName||m.toolName||"unknown";t.mcpTools.byServer[h]=(t.mcpTools.byServer[h]||0)+1;let C=It(y);t.mcpTools.byTool[C]=(t.mcpTools.byTool[C]||0)+1}}catch{}return await vn(i,e,t),Sn(t),t}let r=JSON.parse(n);if(r.requests&&Array.isArray(r.requests))for(let c of r.requests){let u="ask";if(c.agent?.id){let d=c.agent.id.toLowerCase();d.includes("edit")?u="edit":d.includes("agent")&&(u="agent")}else if(r.mode?.id){let d=r.mode.id.toLowerCase();d.includes("agent")?u="agent":d.includes("edit")&&(u="edit")}if(u==="agent"?t.modeUsage.agent++:u==="edit"?t.modeUsage.edit++:t.modeUsage.ask++,wn(c,t.contextReferences),c.response&&Array.isArray(c.response))for(let d of c.response){if(d.kind==="toolInvocationSerialized"||d.kind==="prepareToolInvocation"){let f=d.toolId||d.toolName||d.invocationMessage?.toolName||"unknown";if(_o(f)){t.mcpTools.total++;let m=Co(f,i.toolNameMap);t.mcpTools.byServer[m]=(t.mcpTools.byServer[m]||0)+1;let h=It(f);t.mcpTools.byTool[h]=(t.mcpTools.byTool[h]||0)+1}else t.toolCalls.total++,t.toolCalls.byTool[f]=(t.toolCalls.byTool[f]||0)+1}if(d.kind==="mcpServersStarting"&&d.didStartServerIds)for(let f of d.didStartServerIds)t.mcpTools.total++,t.mcpTools.byServer[f]=(t.mcpTools.byServer[f]||0)+1;d.kind==="inlineReference"&&d.inlineReference&&kn([d],t.contextReferences)}}}catch(n){i.warn(`Error analyzing session usage from ${e}: ${n}`)}return await vn(i,e,t),await ha(i,e,t),t}async function fa(i,e){let t={};if(i.openCode.isOpenCodeSessionFile(e))return await i.openCode.getOpenCodeModelUsage(e);let n=e.split(/[/\\]/).pop()||e;try{let o=await Nt.promises.readFile(e,"utf8");if(yo(o))return t;if(e.endsWith(".jsonl")||dt(o)){let u=o.trim().split(`
40
- `),d="gpt-4o",f={},m=!1,h=null;for(let C of u)if(C.trim())try{let w=JSON.parse(C);if(typeof w.kind=="number"&&(m=!0,f=Ut(f,w)),w.kind===0){let v=w.v?.selectedModel?.identifier||w.v?.selectedModel?.metadata?.id||w.v?.inputState?.selectedModel?.metadata?.id;v&&(d=v.replace(/^copilot\//,""))}if(w.kind===2&&w.k?.[0]==="selectedModel"){let v=w.v?.identifier||w.v?.metadata?.id;v&&(d=v.replace(/^copilot\//,""))}let k=w.model||d;if(t[k]||(t[k]={inputTokens:0,outputTokens:0}),!m)if(w.type==="session.shutdown"&&w.data?.modelMetrics){h={};for(let[v,x]of Object.entries(w.data.modelMetrics)){let A=x?.usage;A&&(h[v]={inputTokens:typeof A.inputTokens=="number"?A.inputTokens:0,outputTokens:typeof A.outputTokens=="number"?A.outputTokens:0})}}else w.type==="user.message"&&w.data?.content?t[k].inputTokens+=pe(w.data.content,k,i.tokenEstimators):w.type==="assistant.message"&&w.data?.content?t[k].outputTokens+=pe(w.data.content,k,i.tokenEstimators):w.type==="tool.result"&&w.data?.output&&(t[k].inputTokens+=pe(w.data.output,k,i.tokenEstimators))}catch{}if(!m&&h)return h;if(m&&f.requests&&Array.isArray(f.requests))for(let C of f.requests){if(!C||!C.requestId)continue;let w=d;if(C.modelId?w=C.modelId.replace(/^copilot\//,""):C.result?.metadata?.modelId?w=C.result.metadata.modelId.replace(/^copilot\//,""):C.result?.details&&(w=ut(C,i.modelPricing)),t[w]||(t[w]={inputTokens:0,outputTokens:0}),C.result?.usage){let k=C.result.usage;t[w].inputTokens+=typeof k.promptTokens=="number"?k.promptTokens:0,t[w].outputTokens+=typeof k.completionTokens=="number"?k.completionTokens:0}else if(typeof C.result?.promptTokens=="number"&&typeof C.result?.outputTokens=="number")t[w].inputTokens+=C.result.promptTokens,t[w].outputTokens+=C.result.outputTokens;else if(C.message?.text&&(t[w].inputTokens+=pe(C.message.text,w,i.tokenEstimators)),C.response&&Array.isArray(C.response))for(let k of C.response)k.value&&(t[w].outputTokens+=pe(k.value,w,i.tokenEstimators))}let y=Cn(u);for(let[C,w]of y){let k=f.requests?.[C];if(!k||k.result?.usage||typeof k.result?.promptTokens=="number"||k.result?.metadata&&typeof k.result.metadata.promptTokens=="number")continue;let v=d;k.modelId&&(v=k.modelId.replace(/^copilot\//,"")),t[v]||(t[v]={inputTokens:0,outputTokens:0}),t[v].inputTokens+=w.promptTokens,t[v].outputTokens+=w.outputTokens}return t}let c=JSON.parse(o);if(c.requests&&Array.isArray(c.requests))for(let u of c.requests){let d=ut(u,i.modelPricing);if(t[d]||(t[d]={inputTokens:0,outputTokens:0}),u.result?.usage){let f=u.result.usage;t[d].inputTokens+=typeof f.promptTokens=="number"?f.promptTokens:0,t[d].outputTokens+=typeof f.completionTokens=="number"?f.completionTokens:0}else if(typeof u.result?.promptTokens=="number"&&typeof u.result?.outputTokens=="number")t[d].inputTokens+=u.result.promptTokens,t[d].outputTokens+=u.result.outputTokens;else if(u.result?.metadata&&typeof u.result.metadata.promptTokens=="number"&&typeof u.result.metadata.outputTokens=="number")t[d].inputTokens+=u.result.metadata.promptTokens,t[d].outputTokens+=u.result.metadata.outputTokens;else{if(u.message&&u.message.parts){for(let f of u.message.parts)if(f.text){let m=pe(f.text,d,i.tokenEstimators);t[d].inputTokens+=m}}if(u.response&&Array.isArray(u.response)){for(let f of u.response)if(f.value){let m=pe(f.value,d,i.tokenEstimators);t[d].outputTokens+=m}}}}}catch(o){i.warn(`Error getting model usage from ${e}: ${o}`)}return t}var li={$schema:"http://json-schema.org/draft-07/schema#",description:"Character-to-token ratio estimators for different AI models. Used to estimate token counts from text length.",estimators:{"gpt-4":.25,"gpt-4.1":.25,"gpt-4.1-mini":.25,"gpt-4o":.25,"gpt-4o-mini":.25,"gpt-4-turbo":.25,"gpt-3.5-turbo":.25,"gpt-5":.25,"gpt-5-codex":.25,"gpt-5-mini":.25,"gpt-5.1":.25,"gpt-5.1-codex":.25,"gpt-5.1-codex-max":.25,"gpt-5.1-codex-mini":.25,"gpt-5.2":.25,"gpt-5.2-codex":.25,"gpt-5.2-pro":.25,"gpt-5.3-codex":.25,"gpt-5.4":.25,"gpt-4.1-nano":.25,"gemini-2.0-flash":.25,"gemini-2.0-flash-lite":.25,"gemini-2.5-flash":.25,"gemini-2.5-flash-lite":.25,"claude-sonnet-3.5":.24,"claude-sonnet-3.7":.24,"claude-sonnet-4":.24,"claude-sonnet-4.5":.24,"claude-sonnet-4.6":.24,"claude-haiku":.24,"claude-haiku-4.5":.24,"claude-opus-4.1":.24,"claude-opus-4.5":.24,"claude-opus-4.6":.24,"claude-opus-4.6-(fast-mode)-(preview)":.24,"claude-opus-4.6-fast":.24,"gemini-2.5-pro":.25,"gemini-3-flash":.25,"gemini-3-pro":.25,"gemini-3-pro-preview":.25,"gemini-3.1-pro":.25,"grok-code-fast-1":.25,"raptor-mini":.25,goldeneye:.25,"o1-preview":.25,"o1-mini":.25,"o3-mini":.25,"o4-mini":.25}};var ci={$schema:"http://json-schema.org/draft-07/schema#",description:"Model pricing data - costs per million tokens for input and output",metadata:{lastUpdated:"2026-03-09",sources:[{name:"OpenAI API Pricing",url:"https://openai.com/api/pricing/",retrievedDate:"2026-01-16"},{name:"Anthropic Claude Pricing",url:"https://www.anthropic.com/pricing",note:"Standard rates",retrievedDate:"2026-01-16"},{name:"Google AI Gemini API Pricing",url:"https://ai.google.dev/pricing",retrievedDate:"2026-01-16"},{name:"GitHub Copilot Supported Models",url:"https://docs.github.com/en/copilot/reference/ai-models/supported-models",retrievedDate:"2026-01-30",note:"Source for tier/multiplier data"}],disclaimer:"GitHub Copilot uses these models but pricing may differ from direct API usage. These are reference prices for cost estimation purposes only."},pricing:{"gpt-5":{inputCostPerMillion:1.25,outputCostPerMillion:10,category:"GPT-5 models",tier:"premium",multiplier:1,displayNames:["GPT-5"]},"gpt-5-codex":{inputCostPerMillion:1.25,outputCostPerMillion:10,category:"GPT-5 models",tier:"premium",multiplier:1},"gpt-5-mini":{inputCostPerMillion:.25,outputCostPerMillion:2,category:"GPT-5 models",tier:"standard",multiplier:0},"gpt-5.1":{inputCostPerMillion:1.25,outputCostPerMillion:10,category:"GPT-5 models",tier:"premium",multiplier:1},"gpt-5.1-codex":{inputCostPerMillion:1.25,outputCostPerMillion:10,category:"GPT-5 models",tier:"premium",multiplier:1},"gpt-5.1-codex-max":{inputCostPerMillion:1.75,outputCostPerMillion:14,category:"GPT-5 models",tier:"premium",multiplier:1},"gpt-5.1-codex-mini":{inputCostPerMillion:.25,outputCostPerMillion:2,category:"GPT-5 models",tier:"premium",multiplier:.33},"gpt-5.2":{inputCostPerMillion:1.75,outputCostPerMillion:14,category:"GPT-5 models",tier:"premium",multiplier:1},"gpt-5.2-codex":{inputCostPerMillion:1.75,outputCostPerMillion:14,category:"GPT-5 models",tier:"premium",multiplier:1},"gpt-5.3-codex":{inputCostPerMillion:0,outputCostPerMillion:0,category:"GPT-5 models",tier:"premium",multiplier:1},"gpt-5.2-pro":{inputCostPerMillion:21,outputCostPerMillion:168,category:"GPT-5 models",tier:"premium",multiplier:1},"gpt-5.3-codex":{inputCostPerMillion:1.75,outputCostPerMillion:14,category:"GPT-5 models",tier:"premium",multiplier:1},"gpt-5.4":{inputCostPerMillion:0,outputCostPerMillion:0,category:"GPT-5 models",tier:"premium",multiplier:1},"gpt-4":{inputCostPerMillion:3,outputCostPerMillion:12,category:"GPT-4 models",tier:"unknown",multiplier:1,displayNames:["GPT-4"]},"gpt-4.1":{inputCostPerMillion:3,outputCostPerMillion:12,category:"GPT-4 models",tier:"standard",multiplier:0,displayNames:["GPT-4.1"]},"gpt-4.1-mini":{inputCostPerMillion:.8,outputCostPerMillion:3.2,category:"GPT-4 models",tier:"standard",multiplier:0},"gpt-4.1-nano":{inputCostPerMillion:.2,outputCostPerMillion:.8,category:"GPT-4 models",tier:"standard",multiplier:0},"gpt-4o":{inputCostPerMillion:2.5,outputCostPerMillion:10,category:"GPT-4 models",tier:"standard",multiplier:0,displayNames:["GPT-4o"]},"gpt-4o-mini":{inputCostPerMillion:.15,outputCostPerMillion:.6,category:"GPT-4 models",tier:"standard",multiplier:0,displayNames:["GPT-4o-mini","GPT-4o Mini"]},"gpt-4-turbo":{inputCostPerMillion:10,outputCostPerMillion:30,category:"GPT-4 models",tier:"standard",multiplier:0,displayNames:["GPT-4 Turbo"]},"claude-sonnet-3.5":{inputCostPerMillion:3,outputCostPerMillion:15,category:"Claude models (Anthropic)",tier:"unknown",multiplier:1,displayNames:["Claude Sonnet 3.5"]},"claude-sonnet-3.7":{inputCostPerMillion:3,outputCostPerMillion:15,category:"Claude models (Anthropic)",tier:"unknown",multiplier:1,displayNames:["Claude Sonnet 3.7"]},"claude-sonnet-4":{inputCostPerMillion:3,outputCostPerMillion:15,category:"Claude models (Anthropic)",tier:"premium",multiplier:1,displayNames:["Claude Sonnet 4"]},"claude-sonnet-4.5":{inputCostPerMillion:3,outputCostPerMillion:15,category:"Claude models (Anthropic)",tier:"premium",multiplier:1},"claude-sonnet-4.6":{inputCostPerMillion:0,outputCostPerMillion:0,category:"Claude models (Anthropic)",tier:"premium",multiplier:3},"claude-haiku":{inputCostPerMillion:.25,outputCostPerMillion:1.25,category:"Claude models (Anthropic)",tier:"standard",multiplier:0},"claude-haiku-4.5":{inputCostPerMillion:1,outputCostPerMillion:5,category:"Claude models (Anthropic)",tier:"premium",multiplier:.33},"claude-opus-4.1":{inputCostPerMillion:15,outputCostPerMillion:75,category:"Claude models (Anthropic)",tier:"premium",multiplier:10},"claude-opus-4.5":{inputCostPerMillion:5,outputCostPerMillion:25,category:"Claude models (Anthropic)",tier:"premium",multiplier:3},"claude-opus-4.6":{inputCostPerMillion:5,outputCostPerMillion:25,category:"Claude models (Anthropic)",tier:"premium",multiplier:3},"claude-opus-4.6-(fast-mode)-(preview)":{inputCostPerMillion:5,outputCostPerMillion:25,category:"Claude models (Anthropic)",tier:"premium",multiplier:30},"claude-opus-4.6-fast":{inputCostPerMillion:5,outputCostPerMillion:25,category:"Claude models (Anthropic)",tier:"premium",multiplier:30},"o3-mini":{inputCostPerMillion:4,outputCostPerMillion:16,category:"OpenAI reasoning models",tier:"premium",multiplier:1,displayNames:["o3-mini"]},"o4-mini":{inputCostPerMillion:4,outputCostPerMillion:16,category:"OpenAI reasoning models",tier:"premium",multiplier:1,displayNames:["o4-mini"]},"o1-preview":{inputCostPerMillion:15,outputCostPerMillion:60,category:"OpenAI reasoning models",tier:"premium",multiplier:1,displayNames:["o1-preview"]},"o1-mini":{inputCostPerMillion:3,outputCostPerMillion:12,category:"OpenAI reasoning models",tier:"premium",multiplier:1,displayNames:["o1-mini"]},"gpt-3.5-turbo":{inputCostPerMillion:.5,outputCostPerMillion:1.5,category:"Legacy models",tier:"standard",multiplier:0,displayNames:["GPT-3.5-Turbo","GPT-3.5 Turbo"]},"gemini-2.5-pro":{inputCostPerMillion:1.25,outputCostPerMillion:10,category:"Google Gemini models",tier:"premium",multiplier:1,displayNames:["Gemini 2.5 Pro"]},"gemini-2.5-flash":{inputCostPerMillion:.3,outputCostPerMillion:2.5,category:"Google Gemini models",tier:"unknown",multiplier:1},"gemini-2.5-flash-lite":{inputCostPerMillion:.1,outputCostPerMillion:.4,category:"Google Gemini models",tier:"unknown",multiplier:1},"gemini-2.0-flash":{inputCostPerMillion:.1,outputCostPerMillion:.4,category:"Google Gemini models",tier:"standard",multiplier:0},"gemini-2.0-flash-lite":{inputCostPerMillion:.075,outputCostPerMillion:.3,category:"Google Gemini models",tier:"standard",multiplier:0},"gemini-3-flash":{inputCostPerMillion:.5,outputCostPerMillion:3,category:"Google Gemini models",tier:"premium",multiplier:.33},"gemini-3-pro":{inputCostPerMillion:2,outputCostPerMillion:12,category:"Google Gemini models",tier:"premium",multiplier:1,displayNames:["Gemini 3 Pro"]},"gemini-3-pro-preview":{inputCostPerMillion:2,outputCostPerMillion:12,category:"Google Gemini models",tier:"premium",multiplier:1,displayNames:["Gemini 3 Pro (Preview)"]},"gemini-3.1-pro":{inputCostPerMillion:2,outputCostPerMillion:12,category:"Google Gemini models",tier:"premium",multiplier:1,displayNames:["Gemini 3.1 Pro","Gemini 3.1 Pro (Preview)"]},"grok-code-fast-1":{inputCostPerMillion:.2,outputCostPerMillion:1.5,category:"xAI Grok models",tier:"premium",multiplier:.25},"raptor-mini":{inputCostPerMillion:.25,outputCostPerMillion:2,category:"GitHub Copilot fine-tuned models",tier:"standard",multiplier:0},goldeneye:{inputCostPerMillion:0,outputCostPerMillion:0,category:"GitHub Copilot fine-tuned models",tier:"standard",multiplier:0}}};var ui={unknown:"Unknown",run_in_terminal:"Run In Terminal","mcp.io.github.git.assign_copilot_to_issue":"GitHub MCP (Local): Assign Copilot to Issue","mcp.io.github.git.create_or_update_file":"GitHub MCP (Local): Create/Update File",mcp_io_github_git_create_or_update_file:"GitHub MCP (Local): Create/Update File",mcp_io_github_git_assign_copilot_to_issue:"GitHub MCP (Local): Assign Copilot to Issue",mcp_io_github_git_pull_request_read:"GitHub MCP (Local): Pull Request Read",mcp_io_github_git_issue_read:"GitHub MCP (Local): Issue Read",mcp_io_github_git_issue_write:"GitHub MCP (Local): Issue Write",mcp_io_github_git_list_issues:"GitHub MCP (Local): List Issues",mcp_io_github_git_create_pull_request:"GitHub MCP (Local): Create Pull Request",mcp_io_github_git_get_file_contents:"GitHub MCP (Local): Get File Contents",mcp_io_github_git_search_code:"GitHub MCP (Local): Search Code",mcp_io_github_git_search_pull_requests:"GitHub MCP (Local): Search Pull Requests",mcp_io_github_git_get_release_by_tag:"GitHub MCP (Local): Get Release By Tag",mcp_io_github_git_search_issues:"GitHub MCP (Local): Search Issues",mcp_io_github_git_add_issue_comment:"GitHub MCP (Local): Add Issue Comment",mcp_io_github_git_list_pull_requests:"GitHub MCP (Local): List Pull Requests",mcp_github_github_assign_copilot_to_issue:"GitHub MCP (Remote): Assign Copilot to Issue",mcp_github_github_issue_read:"GitHub MCP (Remote): Issue Read",mcp_github_github_issue_write:"GitHub MCP (Remote): Issue Write",mcp_github_github_list_issues:"GitHub MCP (Remote): List Issues",mcp_github_get_file_contents:"GitHub MCP (Remote): Get File Contents",mcp_github_get_latest_release:"GitHub MCP (Remote): Get Latest Release",mcp_github_get_release_by_tag:"GitHub MCP (Remote): Get Release By Tag",mcp_github_list_releases:"GitHub MCP (Remote): List Releases",mcp_github_list_tags:"GitHub MCP (Remote): List Tags",mcp_github_search_code:"GitHub MCP (Remote): Search Code",mcp_github_search_issues:"GitHub MCP (Remote): Search Issues",mcp_github_create_pull_request:"GitHub MCP (Remote): Create Pull Request","mcp_github-code-s_get_code_scanning_alert":"GitHub MCP (Code Scanning): Get Alert","mcp_github-code-s_list_code_scanning_alerts":"GitHub MCP (Code Scanning): List Alerts",mcp_com_microsoft_get_bestpractices:"GitHub MCP: Get Best Practices",mcp_microsoft_doc_microsoft_code_sample_search:"Microsoft Docs MCP: Code Sample Search",mcp_microsoft_doc_microsoft_docs_search:"Microsoft Docs MCP: Docs Search",mcp_gitkraken_git_add_or_commit:"GitKraken MCP: Git Add or Commit",mcp_gitkraken_git_status:"GitKraken MCP: Git Status",mcp_gitkraken_git_branch:"GitKraken MCP: Git Branch",mcp_gitkraken_git_checkout:"GitKraken MCP: Git Checkout",mcp_gitkraken_gitkraken_workspace_list:"GitKraken MCP: List Workspaces",mcp_azure_aks:"Azure MCP: AKS",mcp_azure_mcp_azureterraformbestpractices:"Azure MCP: Azure Terraform Best Practices",mcp_azure_mcp_documentation:"Azure MCP: Documentation",mcp_bicep_format_bicep_file:"Bicep MCP: Format Bicep File",mcp_bicep_get_az_resource_type_schema:"Bicep MCP: Get Az Resource Type Schema",mcp_bicep_get_bicep_best_practices:"Bicep MCP: Get Bicep Best Practices",mcp_bicep_get_bicep_file_diagnostics:"Bicep MCP: Get Bicep File Diagnostics",mcp_bicep_list_az_resource_types_for_provider:"Bicep MCP: List Az Resource Types For Provider","azure_bicep-get_azure_verified_module":"Azure Bicep: Get Azure Verified Module","azure_development-recommend_custom_modes":"Azure Development: Recommend Custom Modes","azure_resources-query_azure_resource_graph":"Azure Resources: Query Azure Resource Graph",manage_todo_list:"Manage TODO List",copilot_readFile:"Read File",copilot_viewImage:"Copilot View Image",opilot_findFiles:"Find Files",copilot_writeFile:"Write File",copilot_applyPatch:"Apply Patch",copilot_findTextInFiles:"Find Text In Files",copilot_findFiles:"Find Files",copilot_replaceString:"Replace String",copilot_createFile:"Create File",copilot_listDirectory:"List Directory",copilot_fetchWebPage:"Fetch Web Page",copilot_getErrors:"Get Errors",copilot_multiReplaceString:"Multi Replace String",copilot_searchCodebase:"Search Codebase",get_terminal_output:"Get Terminal Output",run_task:"Run Task: Investigate",await_terminal:"Await Terminal command","github.copilot.editsAgent":"GitHub Copilot Edits Agent",todoList:"TODO List",terminal:"Terminal",terminal_last_command:"Terminal Last Command",github_pull_request:"GitHub Pull Request",github_repo:"GitHub Repository",editFiles:"Edit Files",listFiles:"List Files",search_subagent:"Search Subagent",apply_patch:"Apply Patch",ask_questions:"Ask Questions",copilot_askQuestions:"Ask Questions",copilot_createAndRunTask:"Create And Run Task",copilot_createDirectory:"Create Directory",copilot_createNewJupyterNotebook:"Create New Jupyter Notebook",copilot_createNewWorkspace:"Create New Workspace",copilot_editFiles:"Edit Files",copilot_editNotebook:"Edit Notebook",copilot_findTestFiles:"Find Test Files",copilot_getChangedFiles:"Get Changed Files",copilot_getDocInfo:"Get Doc Info",copilot_getNotebookSummary:"Get Notebook Summary",copilot_getProjectSetupInfo:"Get Project Setup Info",copilot_getSearchResults:"Get Search Results",copilot_getVSCodeAPI:"Get VSCode API",copilot_githubRepo:"GitHub Repository",copilot_insertEdit:"Insert Edit",copilot_installExtension:"Install Extension",copilot_memory:"Memory",copilot_openIntegratedBrowser:"Open Integrated Browser",copilot_openSimpleBrowser:"Open Simple Browser",copilot_readNotebookCellOutput:"Read Notebook Cell Output",copilot_readProjectStructure:"Read Project Structure",copilot_runNotebookCell:"Run Notebook Cell",copilot_runTests1:"Run Tests",copilot_runVscodeCommand:"Run VSCode Command",copilot_searchWorkspaceSymbols:"Search Workspace Symbols",copilot_switchAgent:"Switch Agent",copilot_testFailure:"Test Failure",copilot_toolReplay:"Tool Replay",create_and_run_task:"Create And Run Task",create_directory:"Create Directory",create_file:"Create File",create_new_jupyter_notebook:"Create New Jupyter Notebook",create_new_workspace:"Create New Workspace",create_virtual_environment:"Create Virtual Environment",edit_files:"Edit Files",edit_notebook_file:"Edit Notebook File",fetch_webpage:"Fetch Webpage",file_search:"File Search",get_changed_files:"Get Changed Files",get_doc_info:"Get Doc Info",get_errors:"Get Errors",get_project_setup_info:"Get Project Setup Info",configure_python_environment:"Configure Python Environment",get_search_view_results:"Get Search View Results",get_task_output:"Get Task Output",get_vscode_api:"Get VSCode API",grep_search:"Grep Search",insert_edit_into_file:"Insert Edit Into File",install_extension:"Install Extension",install_python_packages:"Install Python Packages",list_dir:"List Dir",memory:"Memory",multi_replace_string_in_file:"Multi Replace String In File",open_integrated_browser:"Open Integrated Browser",open_simple_browser:"Open Simple Browser",read_file:"Read File",view_image:"View Image",read_notebook_cell_output:"Read Notebook Cell Output",read_project_structure:"Read Project Structure",replace_string_in_file:"Replace String In File","setup.agent":"Setup Agent",selectEnvironment:"Select Environment",run_notebook_cell:"Run Notebook Cell",run_vscode_command:"Run VSCode Command",runSubagent:"Run Subagent",renderMermaidDiagram:"Render Mermaid Diagram",runTests:"Run Tests",search_workspace_symbols:"Search Workspace Symbols",semantic_search:"Semantic Search",switch_agent:"Switch Agent",terminal_selection:"Terminal Selection",test_failure:"Test Failure",test_search:"Test Search",tool_replay:"Tool Replay",tool_search:"Tool Search",vscode_askQuestions:"VSCode Ask Questions",vscode_get_confirmation:"VSCode Get Confirmation",vscode_get_confirmation_with_options:"VSCode Get Confirmation With Options",vscode_get_terminal_confirmation:"VSCode Get Terminal Confirmation",vscode_listCodeUsages:"VSCode List Code Usages",vscode_renameSymbol:"VSCode Rename Symbol","mcp_io_github_ups_get-library-docs":"Context7 MCP: Get Library Docs","mcp_io_github_ups_query-docs":"Context7 MCP: Query Docs","mcp_io_github_ups_resolve-library-id":"Context7 MCP: Resolve Library ID","mcp_context7_query-docs":"Context7 MCP: Query Docs","mcp_context7_resolve-library-id":"Context7 MCP: Resolve Library ID",mcp_microsoft_pla_browser_evaluate:"Playwright MCP: Browser Evaluate",mcp_microsoft_pla_browser_install:"Playwright MCP: Browser Install",mcp_microsoft_pla_browser_navigate:"Playwright MCP: Browser Navigate",mcp_microsoft_pla_browser_run_code:"Playwright MCP: Browser Run Code",mcp_microsoft_pla_browser_click:"Playwright MCP: Browser Click",mcp_microsoft_pla_browser_fill_form:"Playwright MCP: Browser Fill Form",mcp_microsoft_pla_browser_press_key:"Playwright MCP: Browser Press Key",mcp_microsoft_pla_browser_resize:"Playwright MCP: Browser Resize",mcp_microsoft_pla_browser_snapshot:"Playwright MCP: Browser Snapshot",mcp_microsoft_pla_browser_tabs:"Playwright MCP: Browser Tabs",mcp_microsoft_pla_browser_take_screenshot:"Playwright MCP: Browser Take Screenshot",mcp_microsoft_pla_browser_type:"Playwright MCP: Browser Type",mcp_playwright_browser_click:"Playwright MCP: Browser Click",mcp_playwright_browser_navigate:"Playwright MCP: Browser Navigate",mcp_playwright_browser_snapshot:"Playwright MCP: Browser Snapshot",mcp_playwright_browser_take_screenshot:"Playwright MCP: Browser Take Screenshot",mcp_pylance_mcp_s_pylanceDocString:"Pylance MCP: Pylance Doc String","mcp_chrome-devtoo_click":"Chrome DevTools MCP: Click","mcp_chrome-devtoo_evaluate_script":"Chrome DevTools MCP: Evaluate Script","mcp_chrome-devtoo_fill":"Chrome DevTools MCP: Fill","mcp_chrome-devtoo_get_network_request":"Chrome DevTools MCP: Get Network Request","mcp_chrome-devtoo_list_console_messages":"Chrome DevTools MCP: List Console Messages","mcp_chrome-devtoo_list_pages":"Chrome DevTools MCP: List Pages","mcp_chrome-devtoo_navigate_page":"Chrome DevTools MCP: Navigate Page","mcp_chrome-devtoo_new_page":"Chrome DevTools MCP: New Page","mcp_chrome-devtoo_select_page":"Chrome DevTools MCP: Select Page","mcp_chrome-devtoo_take_screenshot":"Chrome DevTools MCP: Take Screenshot","mcp_chrome-devtoo_fill_form":"Chrome DevTools MCP: Fill Form","mcp_chrome-devtoo_hover":"Chrome DevTools MCP: Hover","mcp_chrome-devtoo_list_network_requests":"Chrome DevTools MCP: List Network Requests","mcp_chrome-devtoo_press_key":"Chrome DevTools MCP: Press Key","mcp_chrome-devtoo_take_snapshot":"Chrome DevTools MCP: Take Snapshot",mcp_chrome_devtoo_click:"Chrome DevTools MCP: Click",mcp_chrome_devtoo_evaluate_script:"Chrome DevTools MCP: Evaluate Script",mcp_chrome_devtoo_fill:"Chrome DevTools MCP: Fill",mcp_chrome_devtoo_get_console_message:"Chrome DevTools MCP: Get Console Message",mcp_chrome_devtoo_get_network_request:"Chrome DevTools MCP: Get Network Request",mcp_chrome_devtoo_list_console_messages:"Chrome DevTools MCP: List Console Messages",mcp_chrome_devtoo_list_network_requests:"Chrome DevTools MCP: List Network Requests",mcp_chrome_devtoo_list_pages:"Chrome DevTools MCP: List Pages",mcp_chrome_devtoo_navigate_page:"Chrome DevTools MCP: Navigate Page",mcp_chrome_devtoo_new_page:"Chrome DevTools MCP: New Page",mcp_chrome_devtoo_take_snapshot:"Chrome DevTools MCP: Take Snapshot",mcp_chrome_devtoo_wait_for:"Chrome DevTools MCP: Wait For",mcp_io_github_chr_click:"Chrome DevTools MCP: Click",mcp_io_github_chr_emulate:"Chrome DevTools MCP: Emulate",mcp_io_github_chr_evaluate_script:"Chrome DevTools MCP: Evaluate Script",mcp_io_github_chr_list_network_requests:"Chrome DevTools MCP: List Network Requests",mcp_io_github_chr_list_pages:"Chrome DevTools MCP: List Pages",mcp_io_github_chr_navigate_page:"Chrome DevTools MCP: Navigate Page",mcp_io_github_chr_new_page:"Chrome DevTools MCP: New Page",mcp_io_github_chr_resize_page:"Chrome DevTools MCP: Resize Page",mcp_io_github_chr_select_page:"Chrome DevTools MCP: Select Page",mcp_io_github_chr_take_snapshot:"Chrome DevTools MCP: Take Snapshot",mcp_oraios_serena_activate_project:"Serena: Activate Project",mcp_oraios_serena_check_onboarding_performed:"Serena: Check Onboarding Performed",mcp_oraios_serena_create_text_file:"Serena: Create Text File",mcp_oraios_serena_delete_lines:"Serena: Delete Lines",mcp_oraios_serena_delete_memory:"Serena: Delete Memory",mcp_oraios_serena_edit_memory:"Serena: Edit Memory",mcp_oraios_serena_execute_shell_command:"Serena: Execute Shell Command",mcp_oraios_serena_find_file:"Serena: Find File",mcp_oraios_serena_find_referencing_symbols:"Serena: Find Referencing Symbols",mcp_oraios_serena_find_symbol:"Serena: Find Symbol",mcp_oraios_serena_get_current_config:"Serena: Get Current Config",mcp_oraios_serena_get_symbols_overview:"Serena: Get Symbols Overview",mcp_oraios_serena_initial_instructions:"Serena: Initial Instructions",mcp_oraios_serena_insert_after_symbol:"Serena: Insert After Symbol",mcp_oraios_serena_insert_at_line:"Serena: Insert At Line",mcp_oraios_serena_insert_before_symbol:"Serena: Insert Before Symbol",mcp_oraios_serena_jet_brains_find_referencing_symbols:"Serena: JetBrains Find Referencing Symbols",mcp_oraios_serena_jet_brains_find_symbol:"Serena: JetBrains Find Symbol",mcp_oraios_serena_jet_brains_get_symbols_overview:"Serena: JetBrains Get Symbols Overview",mcp_oraios_serena_jet_brains_type_hierarchy:"Serena: JetBrains Type Hierarchy",mcp_oraios_serena_list_dir:"Serena: List Dir",mcp_oraios_serena_list_memories:"Serena: List Memories",mcp_oraios_serena_onboarding:"Serena: Onboarding",mcp_oraios_serena_open_dashboard:"Serena: Open Dashboard",mcp_oraios_serena_prepare_for_new_conversation:"Serena: Prepare For New Conversation",mcp_oraios_serena_read_file:"Serena: Read File",mcp_oraios_serena_read_memory:"Serena: Read Memory",mcp_oraios_serena_remove_project:"Serena: Remove Project",mcp_oraios_serena_rename_symbol:"Serena: Rename Symbol",mcp_oraios_serena_replace_content:"Serena: Replace Content",mcp_oraios_serena_replace_lines:"Serena: Replace Lines",mcp_oraios_serena_replace_symbol_body:"Serena: Replace Symbol Body",mcp_oraios_serena_restart_language_server:"Serena: Restart Language Server",mcp_oraios_serena_search_for_pattern:"Serena: Search For Pattern",mcp_oraios_serena_summarize_changes:"Serena: Summarize Changes",mcp_oraios_serena_switch_modes:"Serena: Switch Modes",mcp_oraios_serena_think_about_collected_information:"Serena: Think About Collected Information",mcp_oraios_serena_think_about_task_adherence:"Serena: Think About Task Adherence",mcp_oraios_serena_think_about_whether_you_are_done:"Serena: Think About Whether You Are Done",mcp_oraios_serena_write_memory:"Serena: Write Memory","mcp_visuals-mcp_display_image":"Visuals MCP: Display Image",bash:"Bash","claude-code":"Claude Code","copilot-cloud-agent":"Copilot Cloud Agent",copilotcli:"Copilot CLI","github.copilot.default":"GitHub Copilot Default","github.copilot.workspace":"GitHub Copilot Workspace","github.copilot.vscode":"GitHub Copilot VSCode",glob:"Glob",grep:"Grep",kill_terminal:"Kill Terminal",read:"Read",vscode_editFile_internal:"VSCode Edit File (Internal)",vscode_fetchWebPage_internal:"VSCode Fetch Web Page (Internal)",vscode_searchExtensions_internal:"VSCode Search Extensions (Internal)","vscode-websearchforcopilot_webSearch":"VSCode WebSearch for Copilot: Web Search",webfetch:"Web Fetch",write:"Write",edit:"Edit",question:"Question",skill:"Skill",task:"Task",todowrite:"Todo Write",websearch:"Web Search",navigate_page:"Navigate Page",open_browser_page:"Open Browser Page",read_page:"Read Page",run_playwright_code:"Run Playwright Code",screenshot_page:"Screenshot Page",task_complete:"Task Complete","pdf-utilities.pdf":"PDF Utilities: PDF"};var pi=.2,mi=21e3,hi=.3,fi=li.estimators,qt=ci.pricing,_a=ui,Ca=i=>{},gi=i=>{},wa=(i,e)=>console.error(di.default.red(i),e||"");function yi(){let i=$t.file(__dirname);return new fo(i)}function bi(){let i=yi();return new uo({log:Ca,warn:gi,error:wa,openCode:i})}async function Ge(){return bi().getCopilotSessionFiles()}function xo(){return bi().getDiagnosticCandidatePaths()}function va(i,e){return pe(i,e||"gpt-4",fi)}function ka(i){return ut(i,qt)}function _i(i){return i.includes("opencode.db#ses_")}async function Ci(i){if(_i(i)){let e=i.split("#")[0];return So.promises.stat(e)}return So.promises.stat(i)}function Sa(i){let e=i.toLowerCase().replace(/\\/g,"/");return e.includes("/cursor/")?"cursor":e.includes("/code - insiders/")?"vscode-insiders":e.includes("/code - exploration/")?"vscode-exploration":e.includes("/vscodium/")?"vscodium":e.includes("/.copilot/")?"copilot-cli":e.includes("/opencode/")?"opencode":e.includes(".vscode-server")?"vscode-remote":"vscode"}async function jt(i){try{let e=await Ci(i),t=_i(i)?"":await So.promises.readFile(i,"utf-8");if(!t.trim())return null;let n=i.endsWith(".jsonl")||dt(t),o=0,r=0,c=0,u={};if(n){let d=oi(t);o=d.tokens,r=d.thinkingTokens;let f=t.trim().split(`
41
- `);for(let m of f)try{let h=JSON.parse(m);(h.type==="user.message"||h.kind===2&&h.k?.[0]==="requests")&&c++}catch{}}else{let d=ti(i,t,va,ka);o=d.tokens,r=d.thinkingTokens,c=d.interactions,u=d.modelUsage}return{file:i,tokens:o,thinkingTokens:r,interactions:c,modelUsage:u,lastModified:e.mtime,editorSource:Sa(i)}}catch{return null}}async function Po(i,e){let t=new Date,n=new Date(t.getFullYear(),t.getMonth(),t.getDate()),o=new Date(t.getFullYear(),t.getMonth(),1),r=new Date(t.getFullYear(),t.getMonth()-1,1),c=new Date(t.getFullYear(),t.getMonth(),0,23,59,59),u=new Date(t.getTime()-720*60*60*1e3),d={today:vo(),month:vo(),lastMonth:vo(),last30Days:vo()},f=0;for(let m of i){let h=await jt(m);if(f++,e&&e(f,i.length),!h||h.tokens===0)continue;let y=h.lastModified;y<r||(y>=n&&ko(d.today,h),y>=o&&ko(d.month,h),y>=r&&y<=c&&ko(d.lastMonth,h),y>=u&&ko(d.last30Days,h))}for(let m of Object.values(d))m.sessions>0&&(m.avgTokensPerSession=Math.round(m.tokens/m.sessions)),m.co2=m.tokens/1e3*pi,m.treesEquivalent=m.co2/mi,m.waterUsage=m.tokens/1e3*hi,m.estimatedCost=ni(m.modelUsage,qt);return{...d,lastUpdated:t}}function vo(){return{tokens:0,thinkingTokens:0,estimatedTokens:0,actualTokens:0,sessions:0,avgInteractionsPerSession:0,avgTokensPerSession:0,modelUsage:{},editorUsage:{},co2:0,treesEquivalent:0,waterUsage:0,estimatedCost:0}}function ko(i,e){i.tokens+=e.tokens,i.thinkingTokens+=e.thinkingTokens,i.estimatedTokens+=e.tokens,i.sessions++;for(let[n,o]of Object.entries(e.modelUsage))i.modelUsage[n]||(i.modelUsage[n]={inputTokens:0,outputTokens:0}),i.modelUsage[n].inputTokens+=o.inputTokens,i.modelUsage[n].outputTokens+=o.outputTokens;let t=i.avgInteractionsPerSession*(i.sessions-1)+e.interactions;i.avgInteractionsPerSession=i.sessions>0?t/i.sessions:0,i.editorUsage[e.editorSource]||(i.editorUsage[e.editorSource]={tokens:0,sessions:0}),i.editorUsage[e.editorSource].tokens+=e.tokens,i.editorUsage[e.editorSource].sessions++}async function wi(i){let e=yi(),t={warn:gi,openCode:e,tokenEstimators:fi,modelPricing:qt,toolNameMap:_a},n=new Date,o=new Date(n.getFullYear(),n.getMonth(),n.getDate()),r=new Date(n.getTime()-720*60*60*1e3),c=new Date(n.getFullYear(),n.getMonth(),1),u=xn(),d=xn(),f=xn();for(let m of i)try{let y=(await Ci(m)).mtime;if(y<r)continue;let C=await ai(t,m);y>=r&&(wo(d,C),d.sessions++),y>=c&&(wo(f,C),f.sessions++),y>=o&&(wo(u,C),u.sessions++)}catch{}return{today:u,last30Days:d,month:f,lastUpdated:n}}function xn(){return{sessions:0,toolCalls:{total:0,byTool:{}},modeUsage:{ask:0,edit:0,agent:0,plan:0,customAgent:0},contextReferences:si(),mcpTools:{total:0,byServer:{},byTool:{}},modelSwitching:{modelsPerSession:[],totalSessions:0,averageModelsPerSession:0,maxModelsPerSession:0,minModelsPerSession:0,switchingFrequency:0,standardModels:[],premiumModels:[],unknownModels:[],mixedTierSessions:0,standardRequests:0,premiumRequests:0,unknownRequests:0,totalRequests:0},repositories:[],repositoriesWithCustomization:[],editScope:{singleFileEdits:0,multiFileEdits:0,totalEditedFiles:0,avgFilesPerSession:0},applyUsage:{totalApplies:0,totalCodeBlocks:0,applyRate:0},sessionDuration:{totalDurationMs:0,avgDurationMs:0,avgFirstProgressMs:0,avgTotalElapsedMs:0,avgWaitTimeMs:0},conversationPatterns:{multiTurnSessions:0,singleTurnSessions:0,avgTurnsPerSession:0,maxTurnsInSession:0},agentTypes:{editsAgent:0,defaultAgent:0,workspaceAgent:0,other:0}}}function Y(i){return i.toLocaleString("en-US")}function me(i){return i>=1e6?`${(i/1e6).toFixed(1)}M`:i>=1e3?`${(i/1e3).toFixed(1)}K`:i.toString()}var et={CO2_PER_1K_TOKENS:pi,CO2_ABSORPTION_PER_TREE_PER_YEAR:mi,WATER_USAGE_PER_1K_TOKENS:hi,CO2_PER_KM_DRIVING:120,CO2_PER_PHONE_CHARGE:8.22,WATER_PER_COFFEE_CUP:140,CO2_PER_LED_HOUR:20};var vi=new Ee("stats").description("Show overview of discovered session files, sessions, chat turns, and tokens").option("-v, --verbose","Show detailed per-folder breakdown").action(async i=>{if(console.log(ne.default.bold.cyan(`
40
+ `),d="gpt-4o",f={},m=!1,h=null;for(let C of u)if(C.trim())try{let w=JSON.parse(C);if(typeof w.kind=="number"&&(m=!0,f=Ut(f,w)),w.kind===0){let v=w.v?.selectedModel?.identifier||w.v?.selectedModel?.metadata?.id||w.v?.inputState?.selectedModel?.metadata?.id;v&&(d=v.replace(/^copilot\//,""))}if(w.kind===2&&w.k?.[0]==="selectedModel"){let v=w.v?.identifier||w.v?.metadata?.id;v&&(d=v.replace(/^copilot\//,""))}let k=w.model||d;if(t[k]||(t[k]={inputTokens:0,outputTokens:0}),!m)if(w.type==="session.shutdown"&&w.data?.modelMetrics){h={};for(let[v,x]of Object.entries(w.data.modelMetrics)){let A=x?.usage;A&&(h[v]={inputTokens:typeof A.inputTokens=="number"?A.inputTokens:0,outputTokens:typeof A.outputTokens=="number"?A.outputTokens:0})}}else w.type==="user.message"&&w.data?.content?t[k].inputTokens+=pe(w.data.content,k,i.tokenEstimators):w.type==="assistant.message"&&w.data?.content?t[k].outputTokens+=pe(w.data.content,k,i.tokenEstimators):w.type==="tool.result"&&w.data?.output&&(t[k].inputTokens+=pe(w.data.output,k,i.tokenEstimators))}catch{}if(!m&&h)return h;if(m&&f.requests&&Array.isArray(f.requests))for(let C of f.requests){if(!C||!C.requestId)continue;let w=d;if(C.modelId?w=C.modelId.replace(/^copilot\//,""):C.result?.metadata?.modelId?w=C.result.metadata.modelId.replace(/^copilot\//,""):C.result?.details&&(w=ut(C,i.modelPricing)),t[w]||(t[w]={inputTokens:0,outputTokens:0}),C.result?.usage){let k=C.result.usage;t[w].inputTokens+=typeof k.promptTokens=="number"?k.promptTokens:0,t[w].outputTokens+=typeof k.completionTokens=="number"?k.completionTokens:0}else if(typeof C.result?.promptTokens=="number"&&typeof C.result?.outputTokens=="number")t[w].inputTokens+=C.result.promptTokens,t[w].outputTokens+=C.result.outputTokens;else if(C.message?.text&&(t[w].inputTokens+=pe(C.message.text,w,i.tokenEstimators)),C.response&&Array.isArray(C.response))for(let k of C.response)k.value&&(t[w].outputTokens+=pe(k.value,w,i.tokenEstimators))}let y=Cn(u);for(let[C,w]of y){let k=f.requests?.[C];if(!k||k.result?.usage||typeof k.result?.promptTokens=="number"||k.result?.metadata&&typeof k.result.metadata.promptTokens=="number")continue;let v=d;k.modelId&&(v=k.modelId.replace(/^copilot\//,"")),t[v]||(t[v]={inputTokens:0,outputTokens:0}),t[v].inputTokens+=w.promptTokens,t[v].outputTokens+=w.outputTokens}return t}let c=JSON.parse(o);if(c.requests&&Array.isArray(c.requests))for(let u of c.requests){let d=ut(u,i.modelPricing);if(t[d]||(t[d]={inputTokens:0,outputTokens:0}),u.result?.usage){let f=u.result.usage;t[d].inputTokens+=typeof f.promptTokens=="number"?f.promptTokens:0,t[d].outputTokens+=typeof f.completionTokens=="number"?f.completionTokens:0}else if(typeof u.result?.promptTokens=="number"&&typeof u.result?.outputTokens=="number")t[d].inputTokens+=u.result.promptTokens,t[d].outputTokens+=u.result.outputTokens;else if(u.result?.metadata&&typeof u.result.metadata.promptTokens=="number"&&typeof u.result.metadata.outputTokens=="number")t[d].inputTokens+=u.result.metadata.promptTokens,t[d].outputTokens+=u.result.metadata.outputTokens;else{if(u.message&&u.message.parts){for(let f of u.message.parts)if(f.text){let m=pe(f.text,d,i.tokenEstimators);t[d].inputTokens+=m}}if(u.response&&Array.isArray(u.response)){for(let f of u.response)if(f.value){let m=pe(f.value,d,i.tokenEstimators);t[d].outputTokens+=m}}}}}catch(o){i.warn(`Error getting model usage from ${e}: ${o}`)}return t}var li={$schema:"http://json-schema.org/draft-07/schema#",description:"Character-to-token ratio estimators for different AI models. Used to estimate token counts from text length.",estimators:{"gpt-4":.25,"gpt-4.1":.25,"gpt-4.1-mini":.25,"gpt-4o":.25,"gpt-4o-mini":.25,"gpt-4-turbo":.25,"gpt-3.5-turbo":.25,"gpt-5":.25,"gpt-5-codex":.25,"gpt-5-mini":.25,"gpt-5.1":.25,"gpt-5.1-codex":.25,"gpt-5.1-codex-max":.25,"gpt-5.1-codex-mini":.25,"gpt-5.2":.25,"gpt-5.2-codex":.25,"gpt-5.2-pro":.25,"gpt-5.3-codex":.25,"gpt-5.4":.25,"gpt-4.1-nano":.25,"gemini-2.0-flash":.25,"gemini-2.0-flash-lite":.25,"gemini-2.5-flash":.25,"gemini-2.5-flash-lite":.25,"claude-sonnet-3.5":.24,"claude-sonnet-3.7":.24,"claude-sonnet-4":.24,"claude-sonnet-4.5":.24,"claude-sonnet-4.6":.24,"claude-haiku":.24,"claude-haiku-4.5":.24,"claude-opus-4.1":.24,"claude-opus-4.5":.24,"claude-opus-4.6":.24,"claude-opus-4.6-(fast-mode)-(preview)":.24,"claude-opus-4.6-fast":.24,"gemini-2.5-pro":.25,"gemini-3-flash":.25,"gemini-3-pro":.25,"gemini-3-pro-preview":.25,"gemini-3.1-pro":.25,"grok-code-fast-1":.25,"raptor-mini":.25,goldeneye:.25,"o1-preview":.25,"o1-mini":.25,"o3-mini":.25,"o4-mini":.25}};var ci={$schema:"http://json-schema.org/draft-07/schema#",description:"Model pricing data - costs per million tokens for input and output",metadata:{lastUpdated:"2026-03-09",sources:[{name:"OpenAI API Pricing",url:"https://openai.com/api/pricing/",retrievedDate:"2026-01-16"},{name:"Anthropic Claude Pricing",url:"https://www.anthropic.com/pricing",note:"Standard rates",retrievedDate:"2026-01-16"},{name:"Google AI Gemini API Pricing",url:"https://ai.google.dev/pricing",retrievedDate:"2026-01-16"},{name:"GitHub Copilot Supported Models",url:"https://docs.github.com/en/copilot/reference/ai-models/supported-models",retrievedDate:"2026-01-30",note:"Source for tier/multiplier data"}],disclaimer:"GitHub Copilot uses these models but pricing may differ from direct API usage. These are reference prices for cost estimation purposes only."},pricing:{"gpt-5":{inputCostPerMillion:1.25,outputCostPerMillion:10,category:"GPT-5 models",tier:"premium",multiplier:1,displayNames:["GPT-5"]},"gpt-5-codex":{inputCostPerMillion:1.25,outputCostPerMillion:10,category:"GPT-5 models",tier:"premium",multiplier:1},"gpt-5-mini":{inputCostPerMillion:.25,outputCostPerMillion:2,category:"GPT-5 models",tier:"standard",multiplier:0},"gpt-5.1":{inputCostPerMillion:1.25,outputCostPerMillion:10,category:"GPT-5 models",tier:"premium",multiplier:1},"gpt-5.1-codex":{inputCostPerMillion:1.25,outputCostPerMillion:10,category:"GPT-5 models",tier:"premium",multiplier:1},"gpt-5.1-codex-max":{inputCostPerMillion:1.75,outputCostPerMillion:14,category:"GPT-5 models",tier:"premium",multiplier:1},"gpt-5.1-codex-mini":{inputCostPerMillion:.25,outputCostPerMillion:2,category:"GPT-5 models",tier:"premium",multiplier:.33},"gpt-5.2":{inputCostPerMillion:1.75,outputCostPerMillion:14,category:"GPT-5 models",tier:"premium",multiplier:1},"gpt-5.2-codex":{inputCostPerMillion:1.75,outputCostPerMillion:14,category:"GPT-5 models",tier:"premium",multiplier:1},"gpt-5.3-codex":{inputCostPerMillion:0,outputCostPerMillion:0,category:"GPT-5 models",tier:"premium",multiplier:1},"gpt-5.2-pro":{inputCostPerMillion:21,outputCostPerMillion:168,category:"GPT-5 models",tier:"premium",multiplier:1},"gpt-5.3-codex":{inputCostPerMillion:1.75,outputCostPerMillion:14,category:"GPT-5 models",tier:"premium",multiplier:1},"gpt-5.4":{inputCostPerMillion:0,outputCostPerMillion:0,category:"GPT-5 models",tier:"premium",multiplier:1},"gpt-4":{inputCostPerMillion:3,outputCostPerMillion:12,category:"GPT-4 models",tier:"unknown",multiplier:1,displayNames:["GPT-4"]},"gpt-4.1":{inputCostPerMillion:3,outputCostPerMillion:12,category:"GPT-4 models",tier:"standard",multiplier:0,displayNames:["GPT-4.1"]},"gpt-4.1-mini":{inputCostPerMillion:.8,outputCostPerMillion:3.2,category:"GPT-4 models",tier:"standard",multiplier:0},"gpt-4.1-nano":{inputCostPerMillion:.2,outputCostPerMillion:.8,category:"GPT-4 models",tier:"standard",multiplier:0},"gpt-4o":{inputCostPerMillion:2.5,outputCostPerMillion:10,category:"GPT-4 models",tier:"standard",multiplier:0,displayNames:["GPT-4o"]},"gpt-4o-mini":{inputCostPerMillion:.15,outputCostPerMillion:.6,category:"GPT-4 models",tier:"standard",multiplier:0,displayNames:["GPT-4o-mini","GPT-4o Mini"]},"gpt-4-turbo":{inputCostPerMillion:10,outputCostPerMillion:30,category:"GPT-4 models",tier:"standard",multiplier:0,displayNames:["GPT-4 Turbo"]},"claude-sonnet-3.5":{inputCostPerMillion:3,outputCostPerMillion:15,category:"Claude models (Anthropic)",tier:"unknown",multiplier:1,displayNames:["Claude Sonnet 3.5"]},"claude-sonnet-3.7":{inputCostPerMillion:3,outputCostPerMillion:15,category:"Claude models (Anthropic)",tier:"unknown",multiplier:1,displayNames:["Claude Sonnet 3.7"]},"claude-sonnet-4":{inputCostPerMillion:3,outputCostPerMillion:15,category:"Claude models (Anthropic)",tier:"premium",multiplier:1,displayNames:["Claude Sonnet 4"]},"claude-sonnet-4.5":{inputCostPerMillion:3,outputCostPerMillion:15,category:"Claude models (Anthropic)",tier:"premium",multiplier:1},"claude-sonnet-4.6":{inputCostPerMillion:0,outputCostPerMillion:0,category:"Claude models (Anthropic)",tier:"premium",multiplier:3},"claude-haiku":{inputCostPerMillion:.25,outputCostPerMillion:1.25,category:"Claude models (Anthropic)",tier:"standard",multiplier:0},"claude-haiku-4.5":{inputCostPerMillion:1,outputCostPerMillion:5,category:"Claude models (Anthropic)",tier:"premium",multiplier:.33},"claude-opus-4.1":{inputCostPerMillion:15,outputCostPerMillion:75,category:"Claude models (Anthropic)",tier:"premium",multiplier:10},"claude-opus-4.5":{inputCostPerMillion:5,outputCostPerMillion:25,category:"Claude models (Anthropic)",tier:"premium",multiplier:3},"claude-opus-4.6":{inputCostPerMillion:5,outputCostPerMillion:25,category:"Claude models (Anthropic)",tier:"premium",multiplier:3},"claude-opus-4.6-(fast-mode)-(preview)":{inputCostPerMillion:5,outputCostPerMillion:25,category:"Claude models (Anthropic)",tier:"premium",multiplier:30},"claude-opus-4.6-fast":{inputCostPerMillion:5,outputCostPerMillion:25,category:"Claude models (Anthropic)",tier:"premium",multiplier:30},"o3-mini":{inputCostPerMillion:4,outputCostPerMillion:16,category:"OpenAI reasoning models",tier:"premium",multiplier:1,displayNames:["o3-mini"]},"o4-mini":{inputCostPerMillion:4,outputCostPerMillion:16,category:"OpenAI reasoning models",tier:"premium",multiplier:1,displayNames:["o4-mini"]},"o1-preview":{inputCostPerMillion:15,outputCostPerMillion:60,category:"OpenAI reasoning models",tier:"premium",multiplier:1,displayNames:["o1-preview"]},"o1-mini":{inputCostPerMillion:3,outputCostPerMillion:12,category:"OpenAI reasoning models",tier:"premium",multiplier:1,displayNames:["o1-mini"]},"gpt-3.5-turbo":{inputCostPerMillion:.5,outputCostPerMillion:1.5,category:"Legacy models",tier:"standard",multiplier:0,displayNames:["GPT-3.5-Turbo","GPT-3.5 Turbo"]},"gemini-2.5-pro":{inputCostPerMillion:1.25,outputCostPerMillion:10,category:"Google Gemini models",tier:"premium",multiplier:1,displayNames:["Gemini 2.5 Pro"]},"gemini-2.5-flash":{inputCostPerMillion:.3,outputCostPerMillion:2.5,category:"Google Gemini models",tier:"unknown",multiplier:1},"gemini-2.5-flash-lite":{inputCostPerMillion:.1,outputCostPerMillion:.4,category:"Google Gemini models",tier:"unknown",multiplier:1},"gemini-2.0-flash":{inputCostPerMillion:.1,outputCostPerMillion:.4,category:"Google Gemini models",tier:"standard",multiplier:0},"gemini-2.0-flash-lite":{inputCostPerMillion:.075,outputCostPerMillion:.3,category:"Google Gemini models",tier:"standard",multiplier:0},"gemini-3-flash":{inputCostPerMillion:.5,outputCostPerMillion:3,category:"Google Gemini models",tier:"premium",multiplier:.33},"gemini-3-pro":{inputCostPerMillion:2,outputCostPerMillion:12,category:"Google Gemini models",tier:"premium",multiplier:1,displayNames:["Gemini 3 Pro"]},"gemini-3-pro-preview":{inputCostPerMillion:2,outputCostPerMillion:12,category:"Google Gemini models",tier:"premium",multiplier:1,displayNames:["Gemini 3 Pro (Preview)"]},"gemini-3.1-pro":{inputCostPerMillion:2,outputCostPerMillion:12,category:"Google Gemini models",tier:"premium",multiplier:1,displayNames:["Gemini 3.1 Pro","Gemini 3.1 Pro (Preview)"]},"grok-code-fast-1":{inputCostPerMillion:.2,outputCostPerMillion:1.5,category:"xAI Grok models",tier:"premium",multiplier:.25},"raptor-mini":{inputCostPerMillion:.25,outputCostPerMillion:2,category:"GitHub Copilot fine-tuned models",tier:"standard",multiplier:0},goldeneye:{inputCostPerMillion:0,outputCostPerMillion:0,category:"GitHub Copilot fine-tuned models",tier:"standard",multiplier:0}}};var ui={unknown:"Unknown",run_in_terminal:"Run In Terminal","mcp.io.github.git.assign_copilot_to_issue":"GitHub MCP (Local): Assign Copilot to Issue","mcp.io.github.git.create_or_update_file":"GitHub MCP (Local): Create/Update File",mcp_io_github_git_create_or_update_file:"GitHub MCP (Local): Create/Update File",mcp_io_github_git_assign_copilot_to_issue:"GitHub MCP (Local): Assign Copilot to Issue",mcp_io_github_git_pull_request_read:"GitHub MCP (Local): Pull Request Read",mcp_io_github_git_issue_read:"GitHub MCP (Local): Issue Read",mcp_io_github_git_issue_write:"GitHub MCP (Local): Issue Write",mcp_io_github_git_list_issues:"GitHub MCP (Local): List Issues",mcp_io_github_git_create_pull_request:"GitHub MCP (Local): Create Pull Request",mcp_io_github_git_get_file_contents:"GitHub MCP (Local): Get File Contents",mcp_io_github_git_search_code:"GitHub MCP (Local): Search Code",mcp_io_github_git_search_pull_requests:"GitHub MCP (Local): Search Pull Requests",mcp_io_github_git_get_release_by_tag:"GitHub MCP (Local): Get Release By Tag",mcp_io_github_git_search_issues:"GitHub MCP (Local): Search Issues",mcp_io_github_git_add_issue_comment:"GitHub MCP (Local): Add Issue Comment",mcp_io_github_git_list_pull_requests:"GitHub MCP (Local): List Pull Requests",mcp_github_github_assign_copilot_to_issue:"GitHub MCP (Remote): Assign Copilot to Issue",mcp_github_github_issue_read:"GitHub MCP (Remote): Issue Read",mcp_github_github_issue_write:"GitHub MCP (Remote): Issue Write",mcp_github_github_list_issues:"GitHub MCP (Remote): List Issues",mcp_github_get_file_contents:"GitHub MCP (Remote): Get File Contents",mcp_github_get_latest_release:"GitHub MCP (Remote): Get Latest Release",mcp_github_get_release_by_tag:"GitHub MCP (Remote): Get Release By Tag",mcp_github_list_releases:"GitHub MCP (Remote): List Releases",mcp_github_list_tags:"GitHub MCP (Remote): List Tags",mcp_github_search_code:"GitHub MCP (Remote): Search Code",mcp_github_search_issues:"GitHub MCP (Remote): Search Issues","mcp_github-code-s_get_code_scanning_alert":"GitHub MCP (Code Scanning): Get Alert","mcp_github-code-s_list_code_scanning_alerts":"GitHub MCP (Code Scanning): List Alerts",mcp_com_microsoft_get_bestpractices:"GitHub MCP: Get Best Practices",mcp_gitkraken_git_add_or_commit:"GitKraken MCP: Git Add or Commit",mcp_gitkraken_git_status:"GitKraken MCP: Git Status",mcp_gitkraken_git_branch:"GitKraken MCP: Git Branch",mcp_gitkraken_git_checkout:"GitKraken MCP: Git Checkout",mcp_gitkraken_gitkraken_workspace_list:"GitKraken MCP: List Workspaces",mcp_azure_aks:"Azure MCP: AKS",manage_todo_list:"Manage TODO List",copilot_readFile:"Read File",copilot_viewImage:"Copilot View Image",opilot_findFiles:"Find Files",copilot_writeFile:"Write File",copilot_applyPatch:"Apply Patch",copilot_findTextInFiles:"Find Text In Files",copilot_findFiles:"Find Files",copilot_replaceString:"Replace String",copilot_createFile:"Create File",copilot_listDirectory:"List Directory",copilot_fetchWebPage:"Fetch Web Page",copilot_getErrors:"Get Errors",copilot_multiReplaceString:"Multi Replace String",copilot_searchCodebase:"Search Codebase",get_terminal_output:"Get Terminal Output",run_task:"Run Task: Investigate",await_terminal:"Await Terminal command","github.copilot.editsAgent":"GitHub Copilot Edits Agent",todoList:"TODO List",terminal:"Terminal",terminal_last_command:"Terminal Last Command",github_pull_request:"GitHub Pull Request",github_repo:"GitHub Repository",editFiles:"Edit Files",listFiles:"List Files",search_subagent:"Search Subagent",apply_patch:"Apply Patch",ask_questions:"Ask Questions",copilot_askQuestions:"Ask Questions",copilot_createAndRunTask:"Create And Run Task",copilot_createDirectory:"Create Directory",copilot_createNewJupyterNotebook:"Create New Jupyter Notebook",copilot_createNewWorkspace:"Create New Workspace",copilot_editFiles:"Edit Files",copilot_editNotebook:"Edit Notebook",copilot_findTestFiles:"Find Test Files",copilot_getChangedFiles:"Get Changed Files",copilot_getDocInfo:"Get Doc Info",copilot_getNotebookSummary:"Get Notebook Summary",copilot_getProjectSetupInfo:"Get Project Setup Info",copilot_getSearchResults:"Get Search Results",copilot_getVSCodeAPI:"Get VSCode API",copilot_githubRepo:"GitHub Repository",copilot_insertEdit:"Insert Edit",copilot_installExtension:"Install Extension",copilot_memory:"Memory",copilot_openIntegratedBrowser:"Open Integrated Browser",copilot_openSimpleBrowser:"Open Simple Browser",copilot_readNotebookCellOutput:"Read Notebook Cell Output",copilot_readProjectStructure:"Read Project Structure",copilot_runNotebookCell:"Run Notebook Cell",copilot_runTests1:"Run Tests",copilot_runVscodeCommand:"Run VSCode Command",copilot_searchWorkspaceSymbols:"Search Workspace Symbols",copilot_switchAgent:"Switch Agent",copilot_testFailure:"Test Failure",copilot_toolReplay:"Tool Replay",create_and_run_task:"Create And Run Task",create_directory:"Create Directory",create_file:"Create File",create_new_jupyter_notebook:"Create New Jupyter Notebook",create_new_workspace:"Create New Workspace",create_virtual_environment:"Create Virtual Environment",edit_files:"Edit Files",edit_notebook_file:"Edit Notebook File",fetch_webpage:"Fetch Webpage",file_search:"File Search",get_changed_files:"Get Changed Files",get_doc_info:"Get Doc Info",get_errors:"Get Errors",get_project_setup_info:"Get Project Setup Info",configure_python_environment:"Configure Python Environment",get_search_view_results:"Get Search View Results",get_task_output:"Get Task Output",get_vscode_api:"Get VSCode API",grep_search:"Grep Search",insert_edit_into_file:"Insert Edit Into File",install_extension:"Install Extension",install_python_packages:"Install Python Packages",list_dir:"List Dir",memory:"Memory",multi_replace_string_in_file:"Multi Replace String In File",open_integrated_browser:"Open Integrated Browser",open_simple_browser:"Open Simple Browser",read_file:"Read File",view_image:"View Image",read_notebook_cell_output:"Read Notebook Cell Output",read_project_structure:"Read Project Structure",replace_string_in_file:"Replace String In File","setup.agent":"Setup Agent",selectEnvironment:"Select Environment",run_notebook_cell:"Run Notebook Cell",run_vscode_command:"Run VSCode Command",runSubagent:"Run Subagent",renderMermaidDiagram:"Render Mermaid Diagram",runTests:"Run Tests",search_workspace_symbols:"Search Workspace Symbols",semantic_search:"Semantic Search",switch_agent:"Switch Agent",terminal_selection:"Terminal Selection",test_failure:"Test Failure",test_search:"Test Search",tool_replay:"Tool Replay",tool_search:"Tool Search",vscode_askQuestions:"VSCode Ask Questions",vscode_get_confirmation:"VSCode Get Confirmation",vscode_get_confirmation_with_options:"VSCode Get Confirmation With Options",vscode_get_terminal_confirmation:"VSCode Get Terminal Confirmation",vscode_listCodeUsages:"VSCode List Code Usages",vscode_renameSymbol:"VSCode Rename Symbol","mcp_io_github_ups_get-library-docs":"Context7 MCP: Get Library Docs","mcp_io_github_ups_query-docs":"Context7 MCP: Query Docs","mcp_io_github_ups_resolve-library-id":"Context7 MCP: Resolve Library ID","mcp_context7_query-docs":"Context7 MCP: Query Docs","mcp_context7_resolve-library-id":"Context7 MCP: Resolve Library ID",mcp_microsoft_pla_browser_evaluate:"Playwright MCP: Browser Evaluate",mcp_microsoft_pla_browser_install:"Playwright MCP: Browser Install",mcp_microsoft_pla_browser_navigate:"Playwright MCP: Browser Navigate",mcp_microsoft_pla_browser_run_code:"Playwright MCP: Browser Run Code",mcp_playwright_browser_click:"Playwright MCP: Browser Click",mcp_playwright_browser_navigate:"Playwright MCP: Browser Navigate",mcp_playwright_browser_snapshot:"Playwright MCP: Browser Snapshot",mcp_playwright_browser_take_screenshot:"Playwright MCP: Browser Take Screenshot","mcp_chrome-devtoo_click":"Chrome DevTools MCP: Click","mcp_chrome-devtoo_evaluate_script":"Chrome DevTools MCP: Evaluate Script","mcp_chrome-devtoo_fill":"Chrome DevTools MCP: Fill","mcp_chrome-devtoo_get_network_request":"Chrome DevTools MCP: Get Network Request","mcp_chrome-devtoo_list_console_messages":"Chrome DevTools MCP: List Console Messages","mcp_chrome-devtoo_list_pages":"Chrome DevTools MCP: List Pages","mcp_chrome-devtoo_navigate_page":"Chrome DevTools MCP: Navigate Page","mcp_chrome-devtoo_new_page":"Chrome DevTools MCP: New Page","mcp_chrome-devtoo_select_page":"Chrome DevTools MCP: Select Page","mcp_chrome-devtoo_take_screenshot":"Chrome DevTools MCP: Take Screenshot","mcp_chrome-devtoo_fill_form":"Chrome DevTools MCP: Fill Form","mcp_chrome-devtoo_hover":"Chrome DevTools MCP: Hover","mcp_chrome-devtoo_list_network_requests":"Chrome DevTools MCP: List Network Requests","mcp_chrome-devtoo_press_key":"Chrome DevTools MCP: Press Key","mcp_chrome-devtoo_take_snapshot":"Chrome DevTools MCP: Take Snapshot",mcp_chrome_devtoo_click:"Chrome DevTools MCP: Click",mcp_chrome_devtoo_evaluate_script:"Chrome DevTools MCP: Evaluate Script",mcp_chrome_devtoo_fill:"Chrome DevTools MCP: Fill",mcp_chrome_devtoo_get_console_message:"Chrome DevTools MCP: Get Console Message",mcp_chrome_devtoo_get_network_request:"Chrome DevTools MCP: Get Network Request",mcp_chrome_devtoo_list_console_messages:"Chrome DevTools MCP: List Console Messages",mcp_chrome_devtoo_list_network_requests:"Chrome DevTools MCP: List Network Requests",mcp_chrome_devtoo_list_pages:"Chrome DevTools MCP: List Pages",mcp_chrome_devtoo_navigate_page:"Chrome DevTools MCP: Navigate Page",mcp_chrome_devtoo_new_page:"Chrome DevTools MCP: New Page",mcp_chrome_devtoo_take_snapshot:"Chrome DevTools MCP: Take Snapshot",mcp_chrome_devtoo_wait_for:"Chrome DevTools MCP: Wait For",mcp_oraios_serena_activate_project:"Serena: Activate Project",mcp_oraios_serena_check_onboarding_performed:"Serena: Check Onboarding Performed",mcp_oraios_serena_create_text_file:"Serena: Create Text File",mcp_oraios_serena_delete_lines:"Serena: Delete Lines",mcp_oraios_serena_delete_memory:"Serena: Delete Memory",mcp_oraios_serena_edit_memory:"Serena: Edit Memory",mcp_oraios_serena_execute_shell_command:"Serena: Execute Shell Command",mcp_oraios_serena_find_file:"Serena: Find File",mcp_oraios_serena_find_referencing_symbols:"Serena: Find Referencing Symbols",mcp_oraios_serena_find_symbol:"Serena: Find Symbol",mcp_oraios_serena_get_current_config:"Serena: Get Current Config",mcp_oraios_serena_get_symbols_overview:"Serena: Get Symbols Overview",mcp_oraios_serena_initial_instructions:"Serena: Initial Instructions",mcp_oraios_serena_insert_after_symbol:"Serena: Insert After Symbol",mcp_oraios_serena_insert_at_line:"Serena: Insert At Line",mcp_oraios_serena_insert_before_symbol:"Serena: Insert Before Symbol",mcp_oraios_serena_jet_brains_find_referencing_symbols:"Serena: JetBrains Find Referencing Symbols",mcp_oraios_serena_jet_brains_find_symbol:"Serena: JetBrains Find Symbol",mcp_oraios_serena_jet_brains_get_symbols_overview:"Serena: JetBrains Get Symbols Overview",mcp_oraios_serena_jet_brains_type_hierarchy:"Serena: JetBrains Type Hierarchy",mcp_oraios_serena_list_dir:"Serena: List Dir",mcp_oraios_serena_list_memories:"Serena: List Memories",mcp_oraios_serena_onboarding:"Serena: Onboarding",mcp_oraios_serena_open_dashboard:"Serena: Open Dashboard",mcp_oraios_serena_prepare_for_new_conversation:"Serena: Prepare For New Conversation",mcp_oraios_serena_read_file:"Serena: Read File",mcp_oraios_serena_read_memory:"Serena: Read Memory",mcp_oraios_serena_remove_project:"Serena: Remove Project",mcp_oraios_serena_rename_symbol:"Serena: Rename Symbol",mcp_oraios_serena_replace_content:"Serena: Replace Content",mcp_oraios_serena_replace_lines:"Serena: Replace Lines",mcp_oraios_serena_replace_symbol_body:"Serena: Replace Symbol Body",mcp_oraios_serena_restart_language_server:"Serena: Restart Language Server",mcp_oraios_serena_search_for_pattern:"Serena: Search For Pattern",mcp_oraios_serena_summarize_changes:"Serena: Summarize Changes",mcp_oraios_serena_switch_modes:"Serena: Switch Modes",mcp_oraios_serena_think_about_collected_information:"Serena: Think About Collected Information",mcp_oraios_serena_think_about_task_adherence:"Serena: Think About Task Adherence",mcp_oraios_serena_think_about_whether_you_are_done:"Serena: Think About Whether You Are Done",mcp_oraios_serena_write_memory:"Serena: Write Memory","mcp_visuals-mcp_display_image":"Visuals MCP: Display Image",bash:"Bash","claude-code":"Claude Code","copilot-cloud-agent":"Copilot Cloud Agent",copilotcli:"Copilot CLI","github.copilot.default":"GitHub Copilot Default","github.copilot.workspace":"GitHub Copilot Workspace","github.copilot.vscode":"GitHub Copilot VSCode",glob:"Glob",grep:"Grep",kill_terminal:"Kill Terminal",read:"Read",vscode_editFile_internal:"VSCode Edit File (Internal)",vscode_fetchWebPage_internal:"VSCode Fetch Web Page (Internal)","vscode-websearchforcopilot_webSearch":"VSCode WebSearch for Copilot: Web Search",webfetch:"Web Fetch",write:"Write",edit:"Edit",question:"Question",skill:"Skill",task:"Task",todowrite:"Todo Write",websearch:"Web Search",navigate_page:"Navigate Page",open_browser_page:"Open Browser Page",read_page:"Read Page",run_playwright_code:"Run Playwright Code",screenshot_page:"Screenshot Page",task_complete:"Task Complete","pdf-utilities.pdf":"PDF Utilities: PDF"};var pi=.2,mi=21e3,hi=.3,fi=li.estimators,qt=ci.pricing,_a=ui,Ca=i=>{},gi=i=>{},wa=(i,e)=>console.error(di.default.red(i),e||"");function yi(){let i=Dt.file(__dirname);return new fo(i)}function bi(){let i=yi();return new uo({log:Ca,warn:gi,error:wa,openCode:i})}async function Ge(){return bi().getCopilotSessionFiles()}function xo(){return bi().getDiagnosticCandidatePaths()}function va(i,e){return pe(i,e||"gpt-4",fi)}function ka(i){return ut(i,qt)}function _i(i){return i.includes("opencode.db#ses_")}async function Ci(i){if(_i(i)){let e=i.split("#")[0];return So.promises.stat(e)}return So.promises.stat(i)}function Sa(i){let e=i.toLowerCase().replace(/\\/g,"/");return e.includes("/cursor/")?"cursor":e.includes("/code - insiders/")?"vscode-insiders":e.includes("/code - exploration/")?"vscode-exploration":e.includes("/vscodium/")?"vscodium":e.includes("/.copilot/")?"copilot-cli":e.includes("/opencode/")?"opencode":e.includes(".vscode-server")?"vscode-remote":"vscode"}async function jt(i){try{let e=await Ci(i),t=_i(i)?"":await So.promises.readFile(i,"utf-8");if(!t.trim())return null;let n=i.endsWith(".jsonl")||dt(t),o=0,r=0,c=0,u={};if(n){let d=oi(t);o=d.tokens,r=d.thinkingTokens;let f=t.trim().split(`
41
+ `);for(let m of f)try{let h=JSON.parse(m);(h.type==="user.message"||h.kind===2&&h.k?.[0]==="requests")&&c++}catch{}}else{let d=ti(i,t,va,ka);o=d.tokens,r=d.thinkingTokens,c=d.interactions,u=d.modelUsage}return{file:i,tokens:o,thinkingTokens:r,interactions:c,modelUsage:u,lastModified:e.mtime,editorSource:Sa(i)}}catch{return null}}async function To(i,e){let t=new Date,n=new Date(t.getFullYear(),t.getMonth(),t.getDate()),o=new Date(t.getFullYear(),t.getMonth(),1),r=new Date(t.getFullYear(),t.getMonth()-1,1),c=new Date(t.getFullYear(),t.getMonth(),0,23,59,59),u=new Date(t.getTime()-720*60*60*1e3),d={today:vo(),month:vo(),lastMonth:vo(),last30Days:vo()},f=0;for(let m of i){let h=await jt(m);if(f++,e&&e(f,i.length),!h||h.tokens===0)continue;let y=h.lastModified;y<r||(y>=n&&ko(d.today,h),y>=o&&ko(d.month,h),y>=r&&y<=c&&ko(d.lastMonth,h),y>=u&&ko(d.last30Days,h))}for(let m of Object.values(d))m.sessions>0&&(m.avgTokensPerSession=Math.round(m.tokens/m.sessions)),m.co2=m.tokens/1e3*pi,m.treesEquivalent=m.co2/mi,m.waterUsage=m.tokens/1e3*hi,m.estimatedCost=ni(m.modelUsage,qt);return{...d,lastUpdated:t}}function vo(){return{tokens:0,thinkingTokens:0,estimatedTokens:0,actualTokens:0,sessions:0,avgInteractionsPerSession:0,avgTokensPerSession:0,modelUsage:{},editorUsage:{},co2:0,treesEquivalent:0,waterUsage:0,estimatedCost:0}}function ko(i,e){i.tokens+=e.tokens,i.thinkingTokens+=e.thinkingTokens,i.estimatedTokens+=e.tokens,i.sessions++;for(let[n,o]of Object.entries(e.modelUsage))i.modelUsage[n]||(i.modelUsage[n]={inputTokens:0,outputTokens:0}),i.modelUsage[n].inputTokens+=o.inputTokens,i.modelUsage[n].outputTokens+=o.outputTokens;let t=i.avgInteractionsPerSession*(i.sessions-1)+e.interactions;i.avgInteractionsPerSession=i.sessions>0?t/i.sessions:0,i.editorUsage[e.editorSource]||(i.editorUsage[e.editorSource]={tokens:0,sessions:0}),i.editorUsage[e.editorSource].tokens+=e.tokens,i.editorUsage[e.editorSource].sessions++}async function wi(i){let e=yi(),t={warn:gi,openCode:e,tokenEstimators:fi,modelPricing:qt,toolNameMap:_a},n=new Date,o=new Date(n.getFullYear(),n.getMonth(),n.getDate()),r=new Date(n.getTime()-720*60*60*1e3),c=new Date(n.getFullYear(),n.getMonth(),1),u=xn(),d=xn(),f=xn();for(let m of i)try{let y=(await Ci(m)).mtime;if(y<r)continue;let C=await ai(t,m);y>=r&&(wo(d,C),d.sessions++),y>=c&&(wo(f,C),f.sessions++),y>=o&&(wo(u,C),u.sessions++)}catch{}return{today:u,last30Days:d,month:f,lastUpdated:n}}function xn(){return{sessions:0,toolCalls:{total:0,byTool:{}},modeUsage:{ask:0,edit:0,agent:0,plan:0,customAgent:0},contextReferences:si(),mcpTools:{total:0,byServer:{},byTool:{}},modelSwitching:{modelsPerSession:[],totalSessions:0,averageModelsPerSession:0,maxModelsPerSession:0,minModelsPerSession:0,switchingFrequency:0,standardModels:[],premiumModels:[],unknownModels:[],mixedTierSessions:0,standardRequests:0,premiumRequests:0,unknownRequests:0,totalRequests:0},repositories:[],repositoriesWithCustomization:[],editScope:{singleFileEdits:0,multiFileEdits:0,totalEditedFiles:0,avgFilesPerSession:0},applyUsage:{totalApplies:0,totalCodeBlocks:0,applyRate:0},sessionDuration:{totalDurationMs:0,avgDurationMs:0,avgFirstProgressMs:0,avgTotalElapsedMs:0,avgWaitTimeMs:0},conversationPatterns:{multiTurnSessions:0,singleTurnSessions:0,avgTurnsPerSession:0,maxTurnsInSession:0},agentTypes:{editsAgent:0,defaultAgent:0,workspaceAgent:0,other:0}}}function Y(i){return i.toLocaleString("en-US")}function me(i){return i>=1e6?`${(i/1e6).toFixed(1)}M`:i>=1e3?`${(i/1e3).toFixed(1)}K`:i.toString()}var et={CO2_PER_1K_TOKENS:pi,CO2_ABSORPTION_PER_TREE_PER_YEAR:mi,WATER_USAGE_PER_1K_TOKENS:hi,CO2_PER_KM_DRIVING:120,CO2_PER_PHONE_CHARGE:8.22,WATER_PER_COFFEE_CUP:140,CO2_PER_LED_HOUR:20};var vi=new Ee("stats").description("Show overview of discovered session files, sessions, chat turns, and tokens").option("-v, --verbose","Show detailed per-folder breakdown").action(async i=>{if(console.log(ne.default.bold.cyan(`
42
42
  \u{1F50D} Copilot Token Tracker - Session Statistics
43
43
  `)),i.verbose){let m=xo();console.log(ne.default.dim("Search paths:"));for(let h of m){let y=h.exists?ne.default.green("\u2705"):ne.default.dim("\u274C");console.log(` ${y} ${ne.default.dim(h.source)}: ${h.path}`)}console.log()}process.stdout.write(ne.default.dim("Scanning for session files..."));let e=await Ge();if(process.stdout.write("\r"+" ".repeat(50)+"\r"),e.length===0){console.log(ne.default.yellow("\u26A0\uFE0F No session files found.")),console.log(ne.default.dim("Have you used GitHub Copilot Chat in VS Code yet?"));return}console.log(ne.default.green(`\u{1F4C2} Found ${ne.default.bold(Y(e.length))} session file(s)
44
- `));let t=0,n=0,o=0,r=0,c=0,u={},d={};for(let m=0;m<e.length;m++){let h=await jt(e[m]);if(!h||h.tokens===0){c++;continue}if(r++,t+=h.tokens,n+=h.thinkingTokens,o+=h.interactions,u[h.editorSource]||(u[h.editorSource]={files:0,tokens:0,interactions:0}),u[h.editorSource].files++,u[h.editorSource].tokens+=h.tokens,u[h.editorSource].interactions+=h.interactions,i.verbose){let y=Pa(e[m]);d[y]||(d[y]={files:0,tokens:0}),d[y].files++,d[y].tokens+=h.tokens}((m+1)%50===0||m===e.length-1)&&process.stdout.write(`\r${ne.default.dim(`Processing: ${m+1}/${e.length}`)}`)}process.stdout.write("\r"+" ".repeat(50)+"\r"),console.log(ne.default.bold("\u{1F4CA} Summary")),console.log(ne.default.dim("\u2500".repeat(50))),console.log(` Session files (with data): ${ne.default.bold(Y(r))}`),c>0&&console.log(` Empty/skipped files: ${ne.default.dim(Y(c))}`),console.log(` Total chat turns: ${ne.default.bold(Y(o))}`),console.log(` Total estimated tokens: ${ne.default.bold.yellow(me(t))}`),n>0&&console.log(` Thinking tokens (included): ${ne.default.dim(me(n))}`),console.log();let f=Object.entries(u).sort((m,h)=>h[1].tokens-m[1].tokens);if(f.length>0){console.log(ne.default.bold("\u{1F5A5}\uFE0F By Editor")),console.log(ne.default.dim("\u2500".repeat(50)));for(let[m,h]of f){let y=xa(m);console.log(` ${y.padEnd(25)} ${Y(h.files).padStart(5)} files ${me(h.tokens).padStart(8)} tokens ${Y(h.interactions).padStart(6)} turns`)}console.log()}if(i.verbose&&Object.keys(d).length>0){let m=Object.entries(d).sort((h,y)=>y[1].tokens-h[1].tokens);console.log(ne.default.bold("\u{1F4C1} By Folder")),console.log(ne.default.dim("\u2500".repeat(70)));for(let[h,y]of m.slice(0,20))console.log(` ${h.substring(0,50).padEnd(50)} ${Y(y.files).padStart(5)} files ${me(y.tokens).padStart(8)} tokens`);m.length>20&&console.log(ne.default.dim(` ... and ${m.length-20} more folders`)),console.log()}});function xa(i){return{vscode:"VS Code","vscode-insiders":"VS Code Insiders","vscode-exploration":"VS Code Exploration","vscode-remote":"VS Code Remote",vscodium:"VSCodium",cursor:"Cursor","copilot-cli":"Copilot CLI",opencode:"OpenCode"}[i]||i}function Pa(i){let e=i.split(/[/\\]/),t=e.indexOf("chatSessions");return t>=2?e.slice(t-1,t+1).join("/"):e.slice(-3,-1).join("/")}var ae=ye(lt());var ki=new Ee("usage").description("Show token usage for today, current month, last month, and last 30 days").option("-m, --models","Show per-model token breakdown").option("-c, --cost","Show estimated cost breakdown").action(async i=>{console.log(ae.default.bold.cyan(`
44
+ `));let t=0,n=0,o=0,r=0,c=0,u={},d={};for(let m=0;m<e.length;m++){let h=await jt(e[m]);if(!h||h.tokens===0){c++;continue}if(r++,t+=h.tokens,n+=h.thinkingTokens,o+=h.interactions,u[h.editorSource]||(u[h.editorSource]={files:0,tokens:0,interactions:0}),u[h.editorSource].files++,u[h.editorSource].tokens+=h.tokens,u[h.editorSource].interactions+=h.interactions,i.verbose){let y=Ta(e[m]);d[y]||(d[y]={files:0,tokens:0}),d[y].files++,d[y].tokens+=h.tokens}((m+1)%50===0||m===e.length-1)&&process.stdout.write(`\r${ne.default.dim(`Processing: ${m+1}/${e.length}`)}`)}process.stdout.write("\r"+" ".repeat(50)+"\r"),console.log(ne.default.bold("\u{1F4CA} Summary")),console.log(ne.default.dim("\u2500".repeat(50))),console.log(` Session files (with data): ${ne.default.bold(Y(r))}`),c>0&&console.log(` Empty/skipped files: ${ne.default.dim(Y(c))}`),console.log(` Total chat turns: ${ne.default.bold(Y(o))}`),console.log(` Total estimated tokens: ${ne.default.bold.yellow(me(t))}`),n>0&&console.log(` Thinking tokens (included): ${ne.default.dim(me(n))}`),console.log();let f=Object.entries(u).sort((m,h)=>h[1].tokens-m[1].tokens);if(f.length>0){console.log(ne.default.bold("\u{1F5A5}\uFE0F By Editor")),console.log(ne.default.dim("\u2500".repeat(50)));for(let[m,h]of f){let y=xa(m);console.log(` ${y.padEnd(25)} ${Y(h.files).padStart(5)} files ${me(h.tokens).padStart(8)} tokens ${Y(h.interactions).padStart(6)} turns`)}console.log()}if(i.verbose&&Object.keys(d).length>0){let m=Object.entries(d).sort((h,y)=>y[1].tokens-h[1].tokens);console.log(ne.default.bold("\u{1F4C1} By Folder")),console.log(ne.default.dim("\u2500".repeat(70)));for(let[h,y]of m.slice(0,20))console.log(` ${h.substring(0,50).padEnd(50)} ${Y(y.files).padStart(5)} files ${me(y.tokens).padStart(8)} tokens`);m.length>20&&console.log(ne.default.dim(` ... and ${m.length-20} more folders`)),console.log()}});function xa(i){return{vscode:"VS Code","vscode-insiders":"VS Code Insiders","vscode-exploration":"VS Code Exploration","vscode-remote":"VS Code Remote",vscodium:"VSCodium",cursor:"Cursor","copilot-cli":"Copilot CLI",opencode:"OpenCode"}[i]||i}function Ta(i){let e=i.split(/[/\\]/),t=e.indexOf("chatSessions");return t>=2?e.slice(t-1,t+1).join("/"):e.slice(-3,-1).join("/")}var ae=ye(lt());var ki=new Ee("usage").description("Show token usage for today, current month, last month, and last 30 days").option("-m, --models","Show per-model token breakdown").option("-c, --cost","Show estimated cost breakdown").action(async i=>{console.log(ae.default.bold.cyan(`
45
45
  \u{1F4CA} Copilot Token Tracker - Usage Report
46
- `)),process.stdout.write(ae.default.dim("Scanning for session files..."));let e=await Ge();if(process.stdout.write("\r"+" ".repeat(50)+"\r"),e.length===0){console.log(ae.default.yellow("\u26A0\uFE0F No session files found."));return}process.stdout.write(ae.default.dim("Calculating token usage..."));let t=await Po(e,(o,r)=>{process.stdout.write(`\r${ae.default.dim(`Processing: ${o}/${r} files`)}`)});process.stdout.write("\r"+" ".repeat(50)+"\r");let n=[{label:"Today",emoji:"\u{1F4C5}",stats:t.today},{label:"This Month",emoji:"\u{1F4C6}",stats:t.month},{label:"Last Month",emoji:"\u{1F5D3}\uFE0F",stats:t.lastMonth},{label:"Last 30 Days",emoji:"\u{1F4C8}",stats:t.last30Days}];for(let o of n)Ta(o.label,o.emoji,o.stats,i);console.log(ae.default.dim(`Last updated: ${t.lastUpdated.toLocaleString()}
47
- `))});function Ta(i,e,t,n){if(console.log(ae.default.bold(`${e} ${i}`)),console.log(ae.default.dim("\u2500".repeat(55))),t.sessions===0){console.log(ae.default.dim(" No activity in this period")),console.log();return}if(console.log(` Sessions: ${ae.default.bold(Y(t.sessions))}`),console.log(` Avg interactions/sess: ${ae.default.bold(t.avgInteractionsPerSession.toFixed(1))}`),console.log(` Total tokens: ${ae.default.bold.yellow(me(t.tokens))}`),t.thinkingTokens>0&&console.log(` Thinking tokens: ${ae.default.dim(me(t.thinkingTokens))} (included in total)`),console.log(` Avg tokens/session: ${ae.default.bold(me(t.avgTokensPerSession))}`),n.cost&&t.estimatedCost>0&&console.log(` Estimated cost: ${ae.default.green("$"+t.estimatedCost.toFixed(4))}`),n.models&&Object.keys(t.modelUsage).length>0){console.log(),console.log(ae.default.dim(" Model Breakdown:"));let o=Object.entries(t.modelUsage).sort((r,c)=>c[1].inputTokens+c[1].outputTokens-(r[1].inputTokens+r[1].outputTokens));for(let[r,c]of o){let u=c.inputTokens+c.outputTokens,d=pt(r,qt),f=d==="premium"?ae.default.yellow(" \u2B50"):d==="standard"?ae.default.dim(" \u25CB"):"";console.log(` ${(r+f).padEnd(35)} ${me(c.inputTokens).padStart(8)} in ${me(c.outputTokens).padStart(8)} out ${me(u).padStart(8)} total`)}}if(Object.keys(t.editorUsage).length>1){console.log(),console.log(ae.default.dim(" Editor Breakdown:"));let o=Object.entries(t.editorUsage).sort((r,c)=>c[1].tokens-r[1].tokens);for(let[r,c]of o)console.log(` ${r.padEnd(25)} ${Y(c.sessions).padStart(5)} sessions ${me(c.tokens).padStart(8)} tokens`)}console.log()}var le=ye(lt());var Si=new Ee("environmental").alias("env").description("Show environmental impact of your Copilot usage (CO2, water, trees)").action(async()=>{console.log(le.default.bold.cyan(`
46
+ `)),process.stdout.write(ae.default.dim("Scanning for session files..."));let e=await Ge();if(process.stdout.write("\r"+" ".repeat(50)+"\r"),e.length===0){console.log(ae.default.yellow("\u26A0\uFE0F No session files found."));return}process.stdout.write(ae.default.dim("Calculating token usage..."));let t=await To(e,(o,r)=>{process.stdout.write(`\r${ae.default.dim(`Processing: ${o}/${r} files`)}`)});process.stdout.write("\r"+" ".repeat(50)+"\r");let n=[{label:"Today",emoji:"\u{1F4C5}",stats:t.today},{label:"This Month",emoji:"\u{1F4C6}",stats:t.month},{label:"Last Month",emoji:"\u{1F5D3}\uFE0F",stats:t.lastMonth},{label:"Last 30 Days",emoji:"\u{1F4C8}",stats:t.last30Days}];for(let o of n)Pa(o.label,o.emoji,o.stats,i);console.log(ae.default.dim(`Last updated: ${t.lastUpdated.toLocaleString()}
47
+ `))});function Pa(i,e,t,n){if(console.log(ae.default.bold(`${e} ${i}`)),console.log(ae.default.dim("\u2500".repeat(55))),t.sessions===0){console.log(ae.default.dim(" No activity in this period")),console.log();return}if(console.log(` Sessions: ${ae.default.bold(Y(t.sessions))}`),console.log(` Avg interactions/sess: ${ae.default.bold(t.avgInteractionsPerSession.toFixed(1))}`),console.log(` Total tokens: ${ae.default.bold.yellow(me(t.tokens))}`),t.thinkingTokens>0&&console.log(` Thinking tokens: ${ae.default.dim(me(t.thinkingTokens))} (included in total)`),console.log(` Avg tokens/session: ${ae.default.bold(me(t.avgTokensPerSession))}`),n.cost&&t.estimatedCost>0&&console.log(` Estimated cost: ${ae.default.green("$"+t.estimatedCost.toFixed(4))}`),n.models&&Object.keys(t.modelUsage).length>0){console.log(),console.log(ae.default.dim(" Model Breakdown:"));let o=Object.entries(t.modelUsage).sort((r,c)=>c[1].inputTokens+c[1].outputTokens-(r[1].inputTokens+r[1].outputTokens));for(let[r,c]of o){let u=c.inputTokens+c.outputTokens,d=pt(r,qt),f=d==="premium"?ae.default.yellow(" \u2B50"):d==="standard"?ae.default.dim(" \u25CB"):"";console.log(` ${(r+f).padEnd(35)} ${me(c.inputTokens).padStart(8)} in ${me(c.outputTokens).padStart(8)} out ${me(u).padStart(8)} total`)}}if(Object.keys(t.editorUsage).length>1){console.log(),console.log(ae.default.dim(" Editor Breakdown:"));let o=Object.entries(t.editorUsage).sort((r,c)=>c[1].tokens-r[1].tokens);for(let[r,c]of o)console.log(` ${r.padEnd(25)} ${Y(c.sessions).padStart(5)} sessions ${me(c.tokens).padStart(8)} tokens`)}console.log()}var le=ye(lt());var Si=new Ee("environmental").alias("env").description("Show environmental impact of your Copilot usage (CO2, water, trees)").action(async()=>{console.log(le.default.bold.cyan(`
48
48
  \u{1F30D} Copilot Token Tracker - Environmental Impact
49
- `)),process.stdout.write(le.default.dim("Scanning for session files..."));let i=await Ge();if(process.stdout.write("\r"+" ".repeat(50)+"\r"),i.length===0){console.log(le.default.yellow("\u26A0\uFE0F No session files found."));return}process.stdout.write(le.default.dim("Calculating usage..."));let e=await Po(i,(o,r)=>{process.stdout.write(`\r${le.default.dim(`Processing: ${o}/${r} files`)}`)});process.stdout.write("\r"+" ".repeat(50)+"\r");let t=[{label:"Today",emoji:"\u{1F4C5}",stats:e.today},{label:"This Month",emoji:"\u{1F4C6}",stats:e.month},{label:"Last Month",emoji:"\u{1F5D3}\uFE0F",stats:e.lastMonth},{label:"Last 30 Days",emoji:"\u{1F4C8}",stats:e.last30Days}];console.log(le.default.dim("Methodology: Estimates based on industry averages for AI inference")),console.log(le.default.dim(` CO\u2082: ${et.CO2_PER_1K_TOKENS} gCO\u2082e per 1K tokens`)),console.log(le.default.dim(` Water: ${et.WATER_USAGE_PER_1K_TOKENS} L per 1K tokens`)),console.log(le.default.dim(` Tree absorption: ${Y(et.CO2_ABSORPTION_PER_TREE_PER_YEAR)} g CO\u2082/year
49
+ `)),process.stdout.write(le.default.dim("Scanning for session files..."));let i=await Ge();if(process.stdout.write("\r"+" ".repeat(50)+"\r"),i.length===0){console.log(le.default.yellow("\u26A0\uFE0F No session files found."));return}process.stdout.write(le.default.dim("Calculating usage..."));let e=await To(i,(o,r)=>{process.stdout.write(`\r${le.default.dim(`Processing: ${o}/${r} files`)}`)});process.stdout.write("\r"+" ".repeat(50)+"\r");let t=[{label:"Today",emoji:"\u{1F4C5}",stats:e.today},{label:"This Month",emoji:"\u{1F4C6}",stats:e.month},{label:"Last Month",emoji:"\u{1F5D3}\uFE0F",stats:e.lastMonth},{label:"Last 30 Days",emoji:"\u{1F4C8}",stats:e.last30Days}];console.log(le.default.dim("Methodology: Estimates based on industry averages for AI inference")),console.log(le.default.dim(` CO\u2082: ${et.CO2_PER_1K_TOKENS} gCO\u2082e per 1K tokens`)),console.log(le.default.dim(` Water: ${et.WATER_USAGE_PER_1K_TOKENS} L per 1K tokens`)),console.log(le.default.dim(` Tree absorption: ${Y(et.CO2_ABSORPTION_PER_TREE_PER_YEAR)} g CO\u2082/year
50
50
  `));for(let o of t)Ma(o.label,o.emoji,o.stats);let n=e.last30Days;if(n.tokens>0){console.log(le.default.bold("\u{1F504} Context Comparisons (Last 30 Days)")),console.log(le.default.dim("\u2500".repeat(55)));let o=n.co2,r=n.waterUsage,c=o/et.CO2_PER_KM_DRIVING;console.log(` \u{1F697} Equivalent to driving: ${c.toFixed(3)} km`);let u=o/et.CO2_PER_PHONE_CHARGE;console.log(` \u{1F4F1} Smartphone charges: ${u.toFixed(1)}`);let d=r/et.WATER_PER_COFFEE_CUP;console.log(` \u2615 Cups of coffee (water): ${d.toFixed(4)}`);let f=o/et.CO2_PER_LED_HOUR;console.log(` \u{1F4A1} LED bulb hours: ${f.toFixed(2)}`),console.log()}console.log(le.default.dim(`Last updated: ${e.lastUpdated.toLocaleString()}
51
- `))});function Ma(i,e,t){if(console.log(le.default.bold(`${e} ${i}`)),console.log(le.default.dim("\u2500".repeat(55))),t.sessions===0){console.log(le.default.dim(" No activity in this period")),console.log();return}if(console.log(` Tokens used: ${le.default.bold.yellow(me(t.tokens))}`),console.log(` CO\u2082 emissions: ${le.default.bold(t.co2.toFixed(3))} gCO\u2082e`),console.log(` Water usage: ${le.default.bold(t.waterUsage.toFixed(3))} liters`),t.treesEquivalent>0){let n=t.treesEquivalent<.001?t.treesEquivalent.toExponential(2):t.treesEquivalent.toFixed(6);console.log(` Trees to offset: ${le.default.green(n)} trees/year`)}console.log()}var Q=ye(lt());function U(i){return i.toLocaleString("en-US")}async function xi(i,e,t=!0){let n=await e(t),o=n.last30Days,r={1:"Stage 1: Copilot Skeptic",2:"Stage 2: Copilot Explorer",3:"Stage 3: Copilot Collaborator",4:"Stage 4: Copilot Strategist"},c=[],u=[],d=1,f=o.modeUsage.ask+o.modeUsage.edit+o.modeUsage.agent;if(f>0&&c.push(`${U(f)} total interactions`),o.modeUsage.ask>0&&c.push(`${U(o.modeUsage.ask)} ask-mode conversations`),o.modeUsage.agent>0&&c.push(`${U(o.modeUsage.agent)} agent-mode interactions`),o.conversationPatterns){let V=o.sessions>0?Math.round(o.conversationPatterns.multiTurnSessions/o.sessions*100):0;o.conversationPatterns.multiTurnSessions>0&&c.push(`${U(o.conversationPatterns.multiTurnSessions)} multi-turn sessions (${V}%)`),o.conversationPatterns.avgTurnsPerSession>=3&&(c.push(`Avg ${o.conversationPatterns.avgTurnsPerSession.toFixed(1)} exchanges per session`),d=Math.max(d,2)),o.conversationPatterns.avgTurnsPerSession>=5&&(d=Math.max(d,3))}f>=5&&(d=2);let h=["explain","fix","tests","doc","generate","optimize","new","newNotebook","search","fixTestFailure","setupTests"].filter(V=>(o.toolCalls.byTool[V]||0)>0);h.length>0&&c.push(`Used slash commands: /${h.join(", /")}`);let y=o.modelSwitching.mixedTierSessions>0||o.modelSwitching.switchingFrequency>0,C=o.modeUsage.agent>0;f>=30&&(h.length>=2||C)&&(d=3),f>=100&&C&&(y||h.length>=3)&&(d=4),y&&(c.push(`Switched models in ${Math.round(o.modelSwitching.switchingFrequency)}% of sessions`),d<4&&o.modelSwitching.mixedTierSessions>0&&(d=Math.max(d,3))),d<2&&u.push("Try asking Copilot a question using the Chat panel"),d<3&&(C||u.push("Try [agent mode](https://code.visualstudio.com/docs/copilot/agents/overview) for multi-file changes"),h.length<2&&u.push("Use [slash commands](https://code.visualstudio.com/docs/copilot/chat/copilot-chat#_add-context-to-your-prompts) like /explain, /fix, or /tests to give structured prompts")),d<4&&(C||u.push("Try [agent mode](https://code.visualstudio.com/docs/copilot/agents/overview) for autonomous, multi-step coding tasks"),y||u.push("Experiment with [different models](https://code.visualstudio.com/docs/copilot/chat/copilot-chat#_choose-a-language-model) for different tasks - use fast models for simple queries and reasoning models for complex problems"),h.length<3&&C&&y&&u.push("Explore more [slash commands](https://code.visualstudio.com/docs/copilot/chat/copilot-chat#_add-context-to-your-prompts) like /explain, /tests, or /doc to diversify your prompting"));let w=[],k=[],v=1,x=o.contextReferences.file+o.contextReferences.selection+o.contextReferences.symbol+o.contextReferences.codebase+o.contextReferences.workspace,T=[o.contextReferences.file>0,o.contextReferences.selection>0,o.contextReferences.symbol>0,o.contextReferences.codebase>0,o.contextReferences.workspace>0,o.contextReferences.terminal>0,o.contextReferences.vscode>0,o.contextReferences.clipboard>0,o.contextReferences.changes>0,o.contextReferences.problemsPanel>0,o.contextReferences.outputPanel>0,o.contextReferences.terminalLastCommand>0,o.contextReferences.terminalSelection>0].filter(Boolean).length;o.contextReferences.file>0&&w.push(`${U(o.contextReferences.file)} #file references`),o.contextReferences.selection>0&&w.push(`${U(o.contextReferences.selection)} #selection references`),o.contextReferences.codebase>0&&w.push(`${U(o.contextReferences.codebase)} #codebase references`),o.contextReferences.workspace>0&&w.push(`${U(o.contextReferences.workspace)} @workspace references`),o.contextReferences.terminal>0&&w.push(`${U(o.contextReferences.terminal)} @terminal references`),o.contextReferences.vscode>0&&w.push(`${U(o.contextReferences.vscode)} @vscode references`),o.contextReferences.clipboard>0&&w.push(`${U(o.contextReferences.clipboard)} #clipboard references`),o.contextReferences.changes>0&&w.push(`${U(o.contextReferences.changes)} #changes references`),o.contextReferences.problemsPanel>0&&w.push(`${U(o.contextReferences.problemsPanel)} #problemsPanel references`),o.contextReferences.outputPanel>0&&w.push(`${U(o.contextReferences.outputPanel)} #outputPanel references`),o.contextReferences.terminalLastCommand>0&&w.push(`${U(o.contextReferences.terminalLastCommand)} #terminalLastCommand references`),o.contextReferences.terminalSelection>0&&w.push(`${U(o.contextReferences.terminalSelection)} #terminalSelection references`),x>=1&&(v=2),T>=3&&x>=10&&(v=3),T>=5&&x>=30&&(v=4);let q=o.contextReferences.byKind["copilot.image"]||0;if(q>0&&(w.push(`${U(q)} image references (vision)`),v=Math.max(v,3)),v<2&&k.push("Try adding [#file or #selection](https://code.visualstudio.com/docs/copilot/chat/copilot-chat#_add-context-to-your-prompts) references to give Copilot more context"),v<3&&k.push("Explore [@workspace, #codebase, and @terminal](https://code.visualstudio.com/docs/copilot/chat/copilot-chat#_add-context-to-your-prompts) for broader context"),v<4){let V=Math.max(0,5-T),X=Math.max(0,30-x),ze=[{name:"image attachments",used:q>0},{name:"#changes",used:o.contextReferences.changes>0},{name:"#problemsPanel",used:o.contextReferences.problemsPanel>0},{name:"#outputPanel",used:o.contextReferences.outputPanel>0},{name:"#terminalLastCommand",used:o.contextReferences.terminalLastCommand>0},{name:"#terminalSelection",used:o.contextReferences.terminalSelection>0},{name:"#clipboard",used:o.contextReferences.clipboard>0},{name:"@vscode",used:o.contextReferences.vscode>0}];if(ze.filter(re=>re.used).length>=2){let re=[{name:"#symbol",used:o.contextReferences.symbol>0},{name:"@workspace",used:o.contextReferences.workspace>0},{name:"#codebase",used:o.contextReferences.codebase>0},{name:"@terminal",used:o.contextReferences.terminal>0},...ze].filter(qe=>!qe.used).map(qe=>qe.name),Z=[];if(V>0&&Z.push(`${U(T)} of 5 different reference types used`),X>0&&Z.push(`${U(x)} of 30 total references`),Z.length>0){let qe=re.slice(0,3),Lt=qe.length>0?` \u2014 try ${qe.join(", ")}`:"";k.push(`Stage 4 needs ${Z.join(" and ")}${Lt}`)}}else{let re=ze.filter(Z=>!Z.used).map(Z=>Z.name);if(re.length>0){let Z=re.slice(0,3),qe=re.length>3?` and ${re.length-3} more`:"";k.push(`Try ${Z.join(", ")}${qe} \u2014 see [specialized context variables](https://code.visualstudio.com/docs/copilot/chat/copilot-chat#_add-context-to-your-prompts) to reach Stage 4`)}}}let I=[],D=[],j=1;if(o.modeUsage.agent>0&&(I.push(`${U(o.modeUsage.agent)} agent-mode interactions`),j=2),o.toolCalls.total>0&&I.push(`${U(o.toolCalls.total)} tool calls executed`),o.modeUsage.edit>0&&I.push(`${U(o.modeUsage.edit)} edit-mode interactions`),o.editScope){let V=o.editScope.totalEditedFiles>0?Math.round(o.editScope.multiFileEdits/(o.editScope.singleFileEdits+o.editScope.multiFileEdits)*100):0;o.editScope.multiFileEdits>0&&(I.push(`${U(o.editScope.multiFileEdits)} multi-file edit sessions (${V}%)`),j=Math.max(j,2)),o.editScope.avgFilesPerSession>=3&&(I.push(`Avg ${o.editScope.avgFilesPerSession.toFixed(1)} files per edit session`),j=Math.max(j,3))}o.agentTypes&&o.agentTypes.editsAgent>0&&(I.push(`${U(o.agentTypes.editsAgent)} edits agent sessions`),j=Math.max(j,2));let ve=Object.keys(o.toolCalls.byTool).length;o.modeUsage.agent>=10&&ve>=3&&(j=3),o.modeUsage.agent>=50&&ve>=5&&(j=4),o.editScope&&o.editScope.multiFileEdits>=20&&o.editScope.avgFilesPerSession>=3&&(j=Math.max(j,4)),j<2&&D.push("Try [agent mode](https://code.visualstudio.com/docs/copilot/agents/overview) \u2014 it can run terminal commands, edit files, and explore your codebase autonomously"),j<3&&D.push("Use [agent mode](https://code.visualstudio.com/docs/copilot/agents/overview) for multi-step tasks; let it chain tools like file search, terminal, and code edits"),j<4&&D.push("Tackle complex refactoring or debugging tasks in [agent mode](https://code.visualstudio.com/docs/copilot/agents/overview) for deeper autonomous workflows");let z=[],G=[],he=1;ve>0&&(z.push(`${U(ve)} unique tools used`),he=2),o.agentTypes&&o.agentTypes.workspaceAgent>0&&(z.push(`${U(o.agentTypes.workspaceAgent)} @workspace agent sessions`),he=Math.max(he,3));let ht={github_pull_request:"GitHub Pull Request",github_repo:"GitHub Repository",run_in_terminal:"Run In Terminal",editFiles:"Edit Files",listFiles:"List Files"},_e=Object.keys(ht).filter(V=>(o.toolCalls.byTool[V]||0)>0);_e.length>0&&(z.push(`Advanced tools: ${_e.map(V=>ht[V]).join(", ")}`),_e.length>=2&&(he=Math.max(he,3)));let He=Object.keys(o.mcpTools.byServer);o.mcpTools.total>0&&(z.push(`${U(o.mcpTools.total)} MCP tool calls across ${He.length} server(s)`),he=Math.max(he,3),He.length>=2&&(he=4)),he<2&&G.push("Try [agent mode](https://code.visualstudio.com/docs/copilot/agents/overview) to let Copilot use built-in tools for file operations and terminal commands"),he<3&&(He.length===0?G.push("Set up [MCP servers](https://code.visualstudio.com/docs/copilot/customization/mcp-servers) to connect Copilot to external tools (databases, APIs, cloud services)"):G.push("Explore [GitHub integrations](https://code.visualstudio.com/docs/copilot/agents/agent-tools) and advanced tools like editFiles and run_in_terminal")),he<4&&(He.length===1?G.push("Add more [MCP servers](https://code.visualstudio.com/docs/copilot/customization/mcp-servers) to expand Copilot's capabilities - check the VS Code MCP registry"):He.length===0?G.push("Explore the [VS Code MCP registry](https://code.visualstudio.com/docs/copilot/customization/mcp-servers) for tools that integrate with your workflow"):G.push("You're using multiple MCP servers - keep exploring advanced tool combinations"));let xe=[],Te=[],ue=1,St=i,Ce=St?.totalWorkspaces??0,ge=Ce-(St?.workspacesWithIssues??0),xt=Ce>0?ge/Ce:0;Ce>0&&xe.push(`Worked in ${Ce} repositor${Ce===1?"y":"ies"}`),ge>0&&(ue=2),xt>=.3&&ge>=2&&(ue=3),xt>=.7&&ge>=3&&(ue=4);let tt=[...new Set([...o.modelSwitching.standardModels,...o.modelSwitching.premiumModels])];if(tt.length>=3){let V=tt.length>=5&&ge>=3;xe.push(`Used ${tt.length} different models`),V?ue=4:(tt.length>=5,ue=Math.max(ue,3))}if(ue>=4?xe.push(`${U(ge)} of ${U(Ce)} repos customized (70%+ with 3+ repos \u2192 Stage 4)`):ue>=3?xe.push(`${U(ge)} of ${U(Ce)} repos customized (30%+ with 2+ repos \u2192 Stage 3)`):ge>0&&xe.push(`${U(ge)} of ${U(Ce)} repos with custom instructions or agents.md`),ue<2&&Te.push("Create a [.github/copilot-instructions.md](https://code.visualstudio.com/docs/copilot/customization/custom-instructions) file with project-specific guidelines"),ue<3&&Te.push("Add [custom instructions](https://code.visualstudio.com/docs/copilot/customization/custom-instructions) to more repositories to standardize your Copilot experience"),ue<4){let V=Ce-ge;Ce>0&&V>0?Te.push(`${U(ge)} of ${U(Ce)} repos have customization \u2014 add [instructions and agents.md](https://code.visualstudio.com/docs/copilot/customization/custom-instructions) to the remaining ${U(V)} repo${V===1?"":"s"} for Stage 4`):Te.push("Aim for consistent customization across all projects with [instructions and agents.md](https://code.visualstudio.com/docs/copilot/customization/custom-instructions)")}if(ue>=4){let V=Ce-ge;if(V>0){let ze=(St?.workspaces||[]).filter(re=>Object.values(re.typeStatuses).every(Z=>Z==="\u274C")).filter(re=>!re.workspacePath.startsWith("<unresolved:")).sort((re,Z)=>Z.interactionCount!==re.interactionCount?Z.interactionCount-re.interactionCount:Z.sessionCount-re.sessionCount).slice(0,3),ot=`${U(V)} repo${V===1?"":"s"} still missing customization \u2014 add [instructions](https://code.visualstudio.com/docs/copilot/customization/custom-instructions), [agents.md](https://code.visualstudio.com/docs/copilot/customization/custom-instructions), or [MCP configs](https://code.visualstudio.com/docs/copilot/customization/mcp-servers) for full coverage.`;if(ze.length>0){let re=ze.map(Z=>`${Z.workspaceName} (${U(Z.interactionCount)} interaction${Z.interactionCount===1?"":"s"})`).join(`
52
- `);Te.push(`${ot}
51
+ `))});function Ma(i,e,t){if(console.log(le.default.bold(`${e} ${i}`)),console.log(le.default.dim("\u2500".repeat(55))),t.sessions===0){console.log(le.default.dim(" No activity in this period")),console.log();return}if(console.log(` Tokens used: ${le.default.bold.yellow(me(t.tokens))}`),console.log(` CO\u2082 emissions: ${le.default.bold(t.co2.toFixed(3))} gCO\u2082e`),console.log(` Water usage: ${le.default.bold(t.waterUsage.toFixed(3))} liters`),t.treesEquivalent>0){let n=t.treesEquivalent<.001?t.treesEquivalent.toExponential(2):t.treesEquivalent.toFixed(6);console.log(` Trees to offset: ${le.default.green(n)} trees/year`)}console.log()}var Q=ye(lt());function U(i){return i.toLocaleString("en-US")}async function xi(i,e,t=!0){let n=await e(t),o=n.last30Days,r={1:"Stage 1: Copilot Skeptic",2:"Stage 2: Copilot Explorer",3:"Stage 3: Copilot Collaborator",4:"Stage 4: Copilot Strategist"},c=[],u=[],d=1,f=o.modeUsage.ask+o.modeUsage.edit+o.modeUsage.agent;if(f>0&&c.push(`${U(f)} total interactions`),o.modeUsage.ask>0&&c.push(`${U(o.modeUsage.ask)} ask-mode conversations`),o.modeUsage.agent>0&&c.push(`${U(o.modeUsage.agent)} agent-mode interactions`),o.conversationPatterns){let V=o.sessions>0?Math.round(o.conversationPatterns.multiTurnSessions/o.sessions*100):0;o.conversationPatterns.multiTurnSessions>0&&c.push(`${U(o.conversationPatterns.multiTurnSessions)} multi-turn sessions (${V}%)`),o.conversationPatterns.avgTurnsPerSession>=3&&(c.push(`Avg ${o.conversationPatterns.avgTurnsPerSession.toFixed(1)} exchanges per session`),d=Math.max(d,2)),o.conversationPatterns.avgTurnsPerSession>=5&&(d=Math.max(d,3))}f>=5&&(d=2);let h=["explain","fix","tests","doc","generate","optimize","new","newNotebook","search","fixTestFailure","setupTests"].filter(V=>(o.toolCalls.byTool[V]||0)>0);h.length>0&&c.push(`Used slash commands: /${h.join(", /")}`);let y=o.modelSwitching.mixedTierSessions>0||o.modelSwitching.switchingFrequency>0,C=o.modeUsage.agent>0;f>=30&&(h.length>=2||C)&&(d=3),f>=100&&C&&(y||h.length>=3)&&(d=4),y&&(c.push(`Switched models in ${Math.round(o.modelSwitching.switchingFrequency)}% of sessions`),d<4&&o.modelSwitching.mixedTierSessions>0&&(d=Math.max(d,3))),d<2&&u.push("Try asking Copilot a question using the Chat panel"),d<3&&(C||u.push("Try [agent mode](https://code.visualstudio.com/docs/copilot/agents/overview) for multi-file changes"),h.length<2&&u.push("Use [slash commands](https://code.visualstudio.com/docs/copilot/chat/copilot-chat#_add-context-to-your-prompts) like /explain, /fix, or /tests to give structured prompts")),d<4&&(C||u.push("Try [agent mode](https://code.visualstudio.com/docs/copilot/agents/overview) for autonomous, multi-step coding tasks"),y||u.push("Experiment with [different models](https://code.visualstudio.com/docs/copilot/chat/copilot-chat#_choose-a-language-model) for different tasks - use fast models for simple queries and reasoning models for complex problems"),h.length<3&&C&&y&&u.push("Explore more [slash commands](https://code.visualstudio.com/docs/copilot/chat/copilot-chat#_add-context-to-your-prompts) like /explain, /tests, or /doc to diversify your prompting"));let w=[],k=[],v=1,x=o.contextReferences.file+o.contextReferences.selection+o.contextReferences.symbol+o.contextReferences.codebase+o.contextReferences.workspace,P=[o.contextReferences.file>0,o.contextReferences.selection>0,o.contextReferences.symbol>0,o.contextReferences.codebase>0,o.contextReferences.workspace>0,o.contextReferences.terminal>0,o.contextReferences.vscode>0,o.contextReferences.clipboard>0,o.contextReferences.changes>0,o.contextReferences.problemsPanel>0,o.contextReferences.outputPanel>0,o.contextReferences.terminalLastCommand>0,o.contextReferences.terminalSelection>0].filter(Boolean).length;o.contextReferences.file>0&&w.push(`${U(o.contextReferences.file)} #file references`),o.contextReferences.selection>0&&w.push(`${U(o.contextReferences.selection)} #selection references`),o.contextReferences.codebase>0&&w.push(`${U(o.contextReferences.codebase)} #codebase references`),o.contextReferences.workspace>0&&w.push(`${U(o.contextReferences.workspace)} @workspace references`),o.contextReferences.terminal>0&&w.push(`${U(o.contextReferences.terminal)} @terminal references`),o.contextReferences.vscode>0&&w.push(`${U(o.contextReferences.vscode)} @vscode references`),o.contextReferences.clipboard>0&&w.push(`${U(o.contextReferences.clipboard)} #clipboard references`),o.contextReferences.changes>0&&w.push(`${U(o.contextReferences.changes)} #changes references`),o.contextReferences.problemsPanel>0&&w.push(`${U(o.contextReferences.problemsPanel)} #problemsPanel references`),o.contextReferences.outputPanel>0&&w.push(`${U(o.contextReferences.outputPanel)} #outputPanel references`),o.contextReferences.terminalLastCommand>0&&w.push(`${U(o.contextReferences.terminalLastCommand)} #terminalLastCommand references`),o.contextReferences.terminalSelection>0&&w.push(`${U(o.contextReferences.terminalSelection)} #terminalSelection references`),x>=1&&(v=2),P>=3&&x>=10&&(v=3),P>=5&&x>=30&&(v=4);let q=o.contextReferences.byKind["copilot.image"]||0;if(q>0&&(w.push(`${U(q)} image references (vision)`),v=Math.max(v,3)),v<2&&k.push("Try adding [#file or #selection](https://code.visualstudio.com/docs/copilot/chat/copilot-chat#_add-context-to-your-prompts) references to give Copilot more context"),v<3&&k.push("Explore [@workspace, #codebase, and @terminal](https://code.visualstudio.com/docs/copilot/chat/copilot-chat#_add-context-to-your-prompts) for broader context"),v<4){let V=Math.max(0,5-P),X=Math.max(0,30-x),ze=[{name:"image attachments",used:q>0},{name:"#changes",used:o.contextReferences.changes>0},{name:"#problemsPanel",used:o.contextReferences.problemsPanel>0},{name:"#outputPanel",used:o.contextReferences.outputPanel>0},{name:"#terminalLastCommand",used:o.contextReferences.terminalLastCommand>0},{name:"#terminalSelection",used:o.contextReferences.terminalSelection>0},{name:"#clipboard",used:o.contextReferences.clipboard>0},{name:"@vscode",used:o.contextReferences.vscode>0}];if(ze.filter(re=>re.used).length>=2){let re=[{name:"#symbol",used:o.contextReferences.symbol>0},{name:"@workspace",used:o.contextReferences.workspace>0},{name:"#codebase",used:o.contextReferences.codebase>0},{name:"@terminal",used:o.contextReferences.terminal>0},...ze].filter(qe=>!qe.used).map(qe=>qe.name),Z=[];if(V>0&&Z.push(`${U(P)} of 5 different reference types used`),X>0&&Z.push(`${U(x)} of 30 total references`),Z.length>0){let qe=re.slice(0,3),Lt=qe.length>0?` \u2014 try ${qe.join(", ")}`:"";k.push(`Stage 4 needs ${Z.join(" and ")}${Lt}`)}}else{let re=ze.filter(Z=>!Z.used).map(Z=>Z.name);if(re.length>0){let Z=re.slice(0,3),qe=re.length>3?` and ${re.length-3} more`:"";k.push(`Try ${Z.join(", ")}${qe} \u2014 see [specialized context variables](https://code.visualstudio.com/docs/copilot/chat/copilot-chat#_add-context-to-your-prompts) to reach Stage 4`)}}}let I=[],$=[],j=1;if(o.modeUsage.agent>0&&(I.push(`${U(o.modeUsage.agent)} agent-mode interactions`),j=2),o.toolCalls.total>0&&I.push(`${U(o.toolCalls.total)} tool calls executed`),o.modeUsage.edit>0&&I.push(`${U(o.modeUsage.edit)} edit-mode interactions`),o.editScope){let V=o.editScope.totalEditedFiles>0?Math.round(o.editScope.multiFileEdits/(o.editScope.singleFileEdits+o.editScope.multiFileEdits)*100):0;o.editScope.multiFileEdits>0&&(I.push(`${U(o.editScope.multiFileEdits)} multi-file edit sessions (${V}%)`),j=Math.max(j,2)),o.editScope.avgFilesPerSession>=3&&(I.push(`Avg ${o.editScope.avgFilesPerSession.toFixed(1)} files per edit session`),j=Math.max(j,3))}o.agentTypes&&o.agentTypes.editsAgent>0&&(I.push(`${U(o.agentTypes.editsAgent)} edits agent sessions`),j=Math.max(j,2));let ve=Object.keys(o.toolCalls.byTool).length;o.modeUsage.agent>=10&&ve>=3&&(j=3),o.modeUsage.agent>=50&&ve>=5&&(j=4),o.editScope&&o.editScope.multiFileEdits>=20&&o.editScope.avgFilesPerSession>=3&&(j=Math.max(j,4)),j<2&&$.push("Try [agent mode](https://code.visualstudio.com/docs/copilot/agents/overview) \u2014 it can run terminal commands, edit files, and explore your codebase autonomously"),j<3&&$.push("Use [agent mode](https://code.visualstudio.com/docs/copilot/agents/overview) for multi-step tasks; let it chain tools like file search, terminal, and code edits"),j<4&&$.push("Tackle complex refactoring or debugging tasks in [agent mode](https://code.visualstudio.com/docs/copilot/agents/overview) for deeper autonomous workflows");let z=[],G=[],he=1;ve>0&&(z.push(`${U(ve)} unique tools used`),he=2),o.agentTypes&&o.agentTypes.workspaceAgent>0&&(z.push(`${U(o.agentTypes.workspaceAgent)} @workspace agent sessions`),he=Math.max(he,3));let ht={github_pull_request:"GitHub Pull Request",github_repo:"GitHub Repository",run_in_terminal:"Run In Terminal",editFiles:"Edit Files",listFiles:"List Files"},_e=Object.keys(ht).filter(V=>(o.toolCalls.byTool[V]||0)>0);_e.length>0&&(z.push(`Advanced tools: ${_e.map(V=>ht[V]).join(", ")}`),_e.length>=2&&(he=Math.max(he,3)));let He=Object.keys(o.mcpTools.byServer);o.mcpTools.total>0&&(z.push(`${U(o.mcpTools.total)} MCP tool calls across ${He.length} server(s)`),he=Math.max(he,3),He.length>=2&&(he=4)),he<2&&G.push("Try [agent mode](https://code.visualstudio.com/docs/copilot/agents/overview) to let Copilot use built-in tools for file operations and terminal commands"),he<3&&(He.length===0?G.push("Set up [MCP servers](https://code.visualstudio.com/docs/copilot/customization/mcp-servers) to connect Copilot to external tools (databases, APIs, cloud services)"):G.push("Explore [GitHub integrations](https://code.visualstudio.com/docs/copilot/agents/agent-tools) and advanced tools like editFiles and run_in_terminal")),he<4&&(He.length===1?G.push("Add more [MCP servers](https://code.visualstudio.com/docs/copilot/customization/mcp-servers) to expand Copilot's capabilities - check the VS Code MCP registry"):He.length===0?G.push("Explore the [VS Code MCP registry](https://code.visualstudio.com/docs/copilot/customization/mcp-servers) for tools that integrate with your workflow"):G.push("You're using multiple MCP servers - keep exploring advanced tool combinations"));let xe=[],Pe=[],ue=1,St=i,Ce=St?.totalWorkspaces??0,ge=Ce-(St?.workspacesWithIssues??0),xt=Ce>0?ge/Ce:0;Ce>0&&xe.push(`Worked in ${Ce} repositor${Ce===1?"y":"ies"}`),ge>0&&(ue=2),xt>=.3&&ge>=2&&(ue=3),xt>=.7&&ge>=3&&(ue=4);let tt=[...new Set([...o.modelSwitching.standardModels,...o.modelSwitching.premiumModels])];if(tt.length>=3){let V=tt.length>=5&&ge>=3;xe.push(`Used ${tt.length} different models`),V?ue=4:(tt.length>=5,ue=Math.max(ue,3))}if(ue>=4?xe.push(`${U(ge)} of ${U(Ce)} repos customized (70%+ with 3+ repos \u2192 Stage 4)`):ue>=3?xe.push(`${U(ge)} of ${U(Ce)} repos customized (30%+ with 2+ repos \u2192 Stage 3)`):ge>0&&xe.push(`${U(ge)} of ${U(Ce)} repos with custom instructions or agents.md`),ue<2&&Pe.push("Create a [.github/copilot-instructions.md](https://code.visualstudio.com/docs/copilot/customization/custom-instructions) file with project-specific guidelines"),ue<3&&Pe.push("Add [custom instructions](https://code.visualstudio.com/docs/copilot/customization/custom-instructions) to more repositories to standardize your Copilot experience"),ue<4){let V=Ce-ge;Ce>0&&V>0?Pe.push(`${U(ge)} of ${U(Ce)} repos have customization \u2014 add [instructions and agents.md](https://code.visualstudio.com/docs/copilot/customization/custom-instructions) to the remaining ${U(V)} repo${V===1?"":"s"} for Stage 4`):Pe.push("Aim for consistent customization across all projects with [instructions and agents.md](https://code.visualstudio.com/docs/copilot/customization/custom-instructions)")}if(ue>=4){let V=Ce-ge;if(V>0){let ze=(St?.workspaces||[]).filter(re=>Object.values(re.typeStatuses).every(Z=>Z==="\u274C")).filter(re=>!re.workspacePath.startsWith("<unresolved:")).sort((re,Z)=>Z.interactionCount!==re.interactionCount?Z.interactionCount-re.interactionCount:Z.sessionCount-re.sessionCount).slice(0,3),ot=`${U(V)} repo${V===1?"":"s"} still missing customization \u2014 add [instructions](https://code.visualstudio.com/docs/copilot/customization/custom-instructions), [agents.md](https://code.visualstudio.com/docs/copilot/customization/custom-instructions), or [MCP configs](https://code.visualstudio.com/docs/copilot/customization/mcp-servers) for full coverage.`;if(ze.length>0){let re=ze.map(Z=>`${Z.workspaceName} (${U(Z.interactionCount)} interaction${Z.interactionCount===1?"":"s"})`).join(`
52
+ `);Pe.push(`${ot}
53
53
 
54
54
  Top repos to customize first:
55
- ${re}`)}else Te.push(ot)}else Te.push("All repos customized! Keep instructions up to date and add [skill files](https://code.visualstudio.com/docs/copilot/customization/agent-skills) or [MCP server configs](https://code.visualstudio.com/docs/copilot/customization/mcp-servers) for deeper integration")}let Fe=[],Be=[],ie=1;if(o.sessions>=3&&(Fe.push(`${U(o.sessions)} sessions in the last 30 days`),ie=2),o.applyUsage&&o.applyUsage.totalCodeBlocks>0){let V=Math.round(o.applyUsage.applyRate);Fe.push(`${V}% code block apply rate (${U(o.applyUsage.totalApplies)}/${U(o.applyUsage.totalCodeBlocks)})`),V>=50&&(ie=Math.max(ie,2))}if(o.sessionDuration&&o.sessionDuration.avgDurationMs>0){let V=Math.round(o.sessionDuration.avgDurationMs/6e4);Fe.push(`Avg ${V}min session duration`)}let Ue=[o.modeUsage.ask>0,o.modeUsage.agent>0].filter(Boolean).length;Ue>=2&&(Fe.push(`Uses ${Ue} modes (ask/agent)`),ie=Math.max(ie,3)),x>=10&&(Fe.push(`${U(x)} explicit context references`),x>=20&&(ie=Math.max(ie,3))),o.sessions>=15&&Ue>=2&&x>=20&&(ie=4,Fe.push("Deep integration: regular usage with multi-mode and explicit context")),ie<2&&Be.push("Use Copilot more regularly - even for quick questions"),ie<3&&(Ue<2&&Be.push("Combine [ask mode with agent mode](https://code.visualstudio.com/docs/copilot/agents/overview) in your daily workflow"),x<10&&Be.push("Use explicit [context references](https://code.visualstudio.com/docs/copilot/chat/copilot-chat#_add-context-to-your-prompts) like #file, @workspace, and #selection")),ie<4&&(x<20&&Be.push("Make explicit context a habit - use [#file, @workspace, and other references](https://code.visualstudio.com/docs/copilot/chat/copilot-chat#_add-context-to-your-prompts) consistently"),Be.push("Make Copilot part of every coding task: planning, coding, testing, and reviewing"));let Ne=[d,v,j,he,ue,ie].sort((V,X)=>V-X),We=Math.floor(Ne.length/2),ft=Ne.length%2===0?Math.round((Ne[We-1]+Ne[We])/2):Ne[We];return{overallStage:ft,overallLabel:r[ft]||`Stage ${ft}`,categories:[{category:"Prompt Engineering",icon:"\u{1F4AC}",stage:d,evidence:c,tips:u},{category:"Context Engineering",icon:"\u{1F4CE}",stage:v,evidence:w,tips:k},{category:"Agentic",icon:"\u{1F916}",stage:j,evidence:I,tips:D},{category:"Tool Usage",icon:"\u{1F527}",stage:he,evidence:z,tips:G},{category:"Customization",icon:"\u2699\uFE0F",stage:ue,evidence:xe,tips:Te},{category:"Workflow Integration",icon:"\u{1F504}",stage:ie,evidence:Fe,tips:Be}],period:o,lastUpdated:n.lastUpdated.toISOString()}}var Pi=new Ee("fluency").description("Show your Copilot Fluency Score and improvement tips").option("-t, --tips","Show improvement tips for each category").action(async i=>{console.log(Q.default.bold.cyan(`
55
+ ${re}`)}else Pe.push(ot)}else Pe.push("All repos customized! Keep instructions up to date and add [skill files](https://code.visualstudio.com/docs/copilot/customization/agent-skills) or [MCP server configs](https://code.visualstudio.com/docs/copilot/customization/mcp-servers) for deeper integration")}let Fe=[],Be=[],ie=1;if(o.sessions>=3&&(Fe.push(`${U(o.sessions)} sessions in the last 30 days`),ie=2),o.applyUsage&&o.applyUsage.totalCodeBlocks>0){let V=Math.round(o.applyUsage.applyRate);Fe.push(`${V}% code block apply rate (${U(o.applyUsage.totalApplies)}/${U(o.applyUsage.totalCodeBlocks)})`),V>=50&&(ie=Math.max(ie,2))}if(o.sessionDuration&&o.sessionDuration.avgDurationMs>0){let V=Math.round(o.sessionDuration.avgDurationMs/6e4);Fe.push(`Avg ${V}min session duration`)}let Ue=[o.modeUsage.ask>0,o.modeUsage.agent>0].filter(Boolean).length;Ue>=2&&(Fe.push(`Uses ${Ue} modes (ask/agent)`),ie=Math.max(ie,3)),x>=10&&(Fe.push(`${U(x)} explicit context references`),x>=20&&(ie=Math.max(ie,3))),o.sessions>=15&&Ue>=2&&x>=20&&(ie=4,Fe.push("Deep integration: regular usage with multi-mode and explicit context")),ie<2&&Be.push("Use Copilot more regularly - even for quick questions"),ie<3&&(Ue<2&&Be.push("Combine [ask mode with agent mode](https://code.visualstudio.com/docs/copilot/agents/overview) in your daily workflow"),x<10&&Be.push("Use explicit [context references](https://code.visualstudio.com/docs/copilot/chat/copilot-chat#_add-context-to-your-prompts) like #file, @workspace, and #selection")),ie<4&&(x<20&&Be.push("Make explicit context a habit - use [#file, @workspace, and other references](https://code.visualstudio.com/docs/copilot/chat/copilot-chat#_add-context-to-your-prompts) consistently"),Be.push("Make Copilot part of every coding task: planning, coding, testing, and reviewing"));let Ne=[d,v,j,he,ue,ie].sort((V,X)=>V-X),We=Math.floor(Ne.length/2),ft=Ne.length%2===0?Math.round((Ne[We-1]+Ne[We])/2):Ne[We];return{overallStage:ft,overallLabel:r[ft]||`Stage ${ft}`,categories:[{category:"Prompt Engineering",icon:"\u{1F4AC}",stage:d,evidence:c,tips:u},{category:"Context Engineering",icon:"\u{1F4CE}",stage:v,evidence:w,tips:k},{category:"Agentic",icon:"\u{1F916}",stage:j,evidence:I,tips:$},{category:"Tool Usage",icon:"\u{1F527}",stage:he,evidence:z,tips:G},{category:"Customization",icon:"\u2699\uFE0F",stage:ue,evidence:xe,tips:Pe},{category:"Workflow Integration",icon:"\u{1F504}",stage:ie,evidence:Fe,tips:Be}],period:o,lastUpdated:n.lastUpdated.toISOString()}}var Ti=new Ee("fluency").description("Show your Copilot Fluency Score and improvement tips").option("-t, --tips","Show improvement tips for each category").action(async i=>{console.log(Q.default.bold.cyan(`
56
56
  \u{1F3AF} Copilot Token Tracker - Fluency Score
57
57
  `)),process.stdout.write(Q.default.dim("Scanning for session files..."));let e=await Ge();if(process.stdout.write("\r"+" ".repeat(50)+"\r"),e.length===0){console.log(Q.default.yellow("\u26A0\uFE0F No session files found."));return}process.stdout.write(Q.default.dim("Analyzing usage patterns..."));let t=await wi(e);process.stdout.write("\r"+" ".repeat(50)+"\r");let n=await xi(void 0,async()=>t,!1),o={1:Q.default.red,2:Q.default.yellow,3:Q.default.blue,4:Q.default.green},r=m=>{let h="\u2588".repeat(m),y="\u2591".repeat(4-m);return h+y};console.log(Q.default.bold("Overall Fluency Score")),console.log(Q.default.dim("\u2500".repeat(55)));let c=o[n.overallStage]||Q.default.white;console.log(` ${c(r(n.overallStage))} ${Q.default.bold(n.overallLabel)}`),console.log(),console.log(Q.default.bold("Category Breakdown")),console.log(Q.default.dim("\u2500".repeat(55)));for(let m of n.categories){let h=o[m.stage]||Q.default.white;if(console.log(` ${m.icon} ${Q.default.bold(m.category)}`),console.log(` ${h(r(m.stage))} Stage ${m.stage}/4`),m.evidence.length>0){let y=m.evidence.slice(0,3);for(let C of y)console.log(Q.default.dim(` \u2713 ${C}`));m.evidence.length>3&&console.log(Q.default.dim(` ... and ${m.evidence.length-3} more`))}if(m.tips.length>0&&m.stage<4){console.log(Q.default.yellow(" \u{1F4A1} Tips:"));for(let y of m.tips.slice(0,2)){let C=y.replace(/\[([^\]]+)\]\([^)]+\)/g,"$1").replace(/\[▶ [^\]]+\]\([^)]+\)/g,"").trim();console.log(Q.default.yellow(` \u2192 ${C}`))}}console.log()}let u=n.period;console.log(Q.default.bold("\u{1F4CA} Analysis Period (Last 30 Days)")),console.log(Q.default.dim("\u2500".repeat(55))),console.log(` Sessions analyzed: ${Q.default.bold(Y(u.sessions))}`);let d=u.modeUsage.ask+u.modeUsage.edit+u.modeUsage.agent;console.log(` Total interactions: ${Q.default.bold(Y(d))}`),u.modeUsage.ask>0&&console.log(` Ask mode: ${Y(u.modeUsage.ask)}`),u.modeUsage.edit>0&&console.log(` Edit mode: ${Y(u.modeUsage.edit)}`),u.modeUsage.agent>0&&console.log(` Agent mode: ${Y(u.modeUsage.agent)}`),u.toolCalls.total>0&&console.log(` Tool calls: ${Y(u.toolCalls.total)}`),u.mcpTools.total>0&&console.log(` MCP tool calls: ${Y(u.mcpTools.total)}`);let f=u.contextReferences.file+u.contextReferences.selection+u.contextReferences.codebase+u.contextReferences.workspace+u.contextReferences.terminal+u.contextReferences.vscode;f>0&&console.log(` Context references: ${Y(f)}`),console.log(),console.log(Q.default.dim(`Last updated: ${n.lastUpdated}
58
- `))});var oe=ye(lt());function Aa(i,e){let t=i.replace(/\\/g,"/"),n=t.includes("opencode.db#")?t.split("#")[0]:t,o=null,r=0;for(let c of e){let u=c.path.replace(/\\/g,"/");n.startsWith(u)&&u.length>r&&(o={path:c.path,source:c.source},r=u.length)}return o}function Pn(i,e=55){if(i.length<=e)return i;let t=i.replace(/\\/g,"/").split("/"),n=i;for(let o=t.length-1;o>1&&(n="\u2026/"+t.slice(-o).join("/"),!(n.length<=e));o--);return n}function Ti(i,e,t){let n=oe.default.dim("\u2500".repeat(t.reduce((r,c)=>r+c+3,-1))),o=i.map((r,c)=>oe.default.bold(r.padEnd(t[c]))).join(" \u2502 ");console.log(" "+o),console.log(" "+n);for(let r of e){let c=r.map((u,d)=>{let f=u.padEnd(t[d]);return d===0?oe.default.dim(f):f}).join(oe.default.dim(" \u2502 "));console.log(" "+c)}console.log(" "+n)}var Mi=new Ee("diagnostics").description("Show session file search locations and per-location usage stats").action(async()=>{console.log(oe.default.bold.cyan(`
58
+ `))});var oe=ye(lt());function Aa(i,e){let t=i.replace(/\\/g,"/"),n=t.includes("opencode.db#")?t.split("#")[0]:t,o=null,r=0;for(let c of e){let u=c.path.replace(/\\/g,"/");n.startsWith(u)&&u.length>r&&(o={path:c.path,source:c.source},r=u.length)}return o}function Tn(i,e=55){if(i.length<=e)return i;let t=i.replace(/\\/g,"/").split("/"),n=i;for(let o=t.length-1;o>1&&(n="\u2026/"+t.slice(-o).join("/"),!(n.length<=e));o--);return n}function Pi(i,e,t){let n=oe.default.dim("\u2500".repeat(t.reduce((r,c)=>r+c+3,-1))),o=i.map((r,c)=>oe.default.bold(r.padEnd(t[c]))).join(" \u2502 ");console.log(" "+o),console.log(" "+n);for(let r of e){let c=r.map((u,d)=>{let f=u.padEnd(t[d]);return d===0?oe.default.dim(f):f}).join(oe.default.dim(" \u2502 "));console.log(" "+c)}console.log(" "+n)}var Mi=new Ee("diagnostics").description("Show session file search locations and per-location usage stats").action(async()=>{console.log(oe.default.bold.cyan(`
59
59
  \u{1F52C} Copilot Token Tracker - Diagnostics
60
- `));let i=xo(),e=i.filter(v=>v.exists),t=i.filter(v=>!v.exists);console.log(oe.default.bold(`\u{1F4C2} Search Locations (${e.length} found / ${i.length} total)`)),console.log(oe.default.dim("\u2500".repeat(65)));let n=["Source","Exists","Path"],o=[18,6,55],r=i.map(v=>[v.source,v.exists?oe.default.green("yes"):oe.default.dim("no"),Pn(v.path,55)]);if(Ti(n,r,o),console.log(),e.length===0){console.log(oe.default.yellow("\u26A0\uFE0F No search paths exist on this machine.")),console.log(oe.default.dim("Have you used GitHub Copilot Chat in VS Code yet?"));return}process.stdout.write(oe.default.dim("Scanning for session files..."));let c=await Ge();if(process.stdout.write("\r"+" ".repeat(60)+"\r"),c.length===0){console.log(oe.default.yellow("\u26A0\uFE0F No session files found in any search path."));return}let u=new Map;for(let v of e)u.set(v.path,{label:Pn(v.path,45),source:v.source,files:0,sessions:0,interactions:0,tokens:0});let d=0,f=0,m=0,h=0;for(let v=0;v<c.length;v++){((v+1)%25===0||v===c.length-1)&&process.stdout.write(`\r${oe.default.dim(`Processing: ${v+1}/${c.length} files...`)}`);let x=Aa(c[v],i),A=x?x.path:"__unknown__";u.has(A)||u.set(A,{label:x?Pn(x.path,45):"(unknown)",source:x?x.source:"unknown",files:0,sessions:0,interactions:0,tokens:0});let T=u.get(A);T.files++,d++;let q=await jt(c[v]);q&&q.tokens>0&&(T.sessions++,T.interactions+=q.interactions,T.tokens+=q.tokens,f++,m+=q.interactions,h+=q.tokens)}process.stdout.write("\r"+" ".repeat(60)+"\r"),console.log(oe.default.bold("\u{1F4CA} Stats per Search Location")),console.log(oe.default.dim("\u2500".repeat(65)));let y=["Source","Files","Sessions","Turns","Tokens"],C=[18,6,9,8,14],w=[],k=[...u.values()].filter(v=>v.files>0).sort((v,x)=>x.tokens-v.tokens||v.source.localeCompare(x.source));for(let v of k)w.push([v.source,Y(v.files),Y(v.sessions),Y(v.interactions),me(v.tokens)]);w.length===0?console.log(oe.default.dim(" No session data found in any location.")):Ti(y,w,C),console.log(),console.log(oe.default.bold("\u{1F4C8} Totals (all time)")),console.log(oe.default.dim("\u2500".repeat(65))),console.log(` Total files found: ${oe.default.bold(Y(d))}`),console.log(` Files with data: ${oe.default.bold(Y(f))}`),console.log(` Total chat turns: ${oe.default.bold(Y(m))}`),console.log(` Total tokens (est.): ${oe.default.bold.yellow(me(h))}`),t.length>0&&(console.log(),console.log(oe.default.dim(`\u2139\uFE0F ${t.length} search path(s) not present on this machine \u2014 this is normal if you don't use all VS Code variants.`))),console.log()});var Ea=Ai(),mt=new Ee;mt.name("copilot-token-tracker").description("Analyze GitHub Copilot token usage from local session files").version(Ea.version);mt.addCommand(vi);mt.addCommand(ki);mt.addCommand(Si);mt.addCommand(Pi);mt.addCommand(Mi);mt.parse();
60
+ `));let i=xo(),e=i.filter(v=>v.exists),t=i.filter(v=>!v.exists);console.log(oe.default.bold(`\u{1F4C2} Search Locations (${e.length} found / ${i.length} total)`)),console.log(oe.default.dim("\u2500".repeat(65)));let n=["Source","Exists","Path"],o=[18,6,55],r=i.map(v=>[v.source,v.exists?oe.default.green("yes"):oe.default.dim("no"),Tn(v.path,55)]);if(Pi(n,r,o),console.log(),e.length===0){console.log(oe.default.yellow("\u26A0\uFE0F No search paths exist on this machine.")),console.log(oe.default.dim("Have you used GitHub Copilot Chat in VS Code yet?"));return}process.stdout.write(oe.default.dim("Scanning for session files..."));let c=await Ge();if(process.stdout.write("\r"+" ".repeat(60)+"\r"),c.length===0){console.log(oe.default.yellow("\u26A0\uFE0F No session files found in any search path."));return}let u=new Map;for(let v of e)u.set(v.path,{label:Tn(v.path,45),source:v.source,files:0,sessions:0,interactions:0,tokens:0});let d=0,f=0,m=0,h=0;for(let v=0;v<c.length;v++){((v+1)%25===0||v===c.length-1)&&process.stdout.write(`\r${oe.default.dim(`Processing: ${v+1}/${c.length} files...`)}`);let x=Aa(c[v],i),A=x?x.path:"__unknown__";u.has(A)||u.set(A,{label:x?Tn(x.path,45):"(unknown)",source:x?x.source:"unknown",files:0,sessions:0,interactions:0,tokens:0});let P=u.get(A);P.files++,d++;let q=await jt(c[v]);q&&q.tokens>0&&(P.sessions++,P.interactions+=q.interactions,P.tokens+=q.tokens,f++,m+=q.interactions,h+=q.tokens)}process.stdout.write("\r"+" ".repeat(60)+"\r"),console.log(oe.default.bold("\u{1F4CA} Stats per Search Location")),console.log(oe.default.dim("\u2500".repeat(65)));let y=["Source","Files","Sessions","Turns","Tokens"],C=[18,6,9,8,14],w=[],k=[...u.values()].filter(v=>v.files>0).sort((v,x)=>x.tokens-v.tokens||v.source.localeCompare(x.source));for(let v of k)w.push([v.source,Y(v.files),Y(v.sessions),Y(v.interactions),me(v.tokens)]);w.length===0?console.log(oe.default.dim(" No session data found in any location.")):Pi(y,w,C),console.log(),console.log(oe.default.bold("\u{1F4C8} Totals (all time)")),console.log(oe.default.dim("\u2500".repeat(65))),console.log(` Total files found: ${oe.default.bold(Y(d))}`),console.log(` Files with data: ${oe.default.bold(Y(f))}`),console.log(` Total chat turns: ${oe.default.bold(Y(m))}`),console.log(` Total tokens (est.): ${oe.default.bold.yellow(me(h))}`),t.length>0&&(console.log(),console.log(oe.default.dim(`\u2139\uFE0F ${t.length} search path(s) not present on this machine \u2014 this is normal if you don't use all VS Code variants.`))),console.log()});var Ea=Ai(),mt=new Ee;mt.name("copilot-token-tracker").description("Analyze GitHub Copilot token usage from local session files").version(Ea.version);mt.addCommand(vi);mt.addCommand(ki);mt.addCommand(Si);mt.addCommand(Ti);mt.addCommand(Mi);mt.parse();
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@rajbos/ai-engineering-fluency",
3
- "version": "0.0.2",
3
+ "version": "0.0.3",
4
4
  "description": "AI Engineering Fluency - CLI tool to analyze GitHub Copilot token usage from local session files",
5
5
  "license": "MIT",
6
6
  "author": "RobBos",
7
7
  "repository": {
8
8
  "type": "git",
9
- "url": "https://github.com/rajbos/github-copilot-token-usage",
9
+ "url": "git+https://github.com/rajbos/github-copilot-token-usage.git",
10
10
  "directory": "cli"
11
11
  },
12
12
  "keywords": [
@@ -17,7 +17,7 @@
17
17
  "token-tracker"
18
18
  ],
19
19
  "bin": {
20
- "copilot-token-tracker": "./dist/cli.js"
20
+ "ai-engineering-fluency": "dist/cli.js"
21
21
  },
22
22
  "files": [
23
23
  "dist/**/*"
@@ -38,6 +38,6 @@
38
38
  "sql.js": "^1.12.0"
39
39
  },
40
40
  "engines": {
41
- "node": ">=18.0.0"
41
+ "node": ">=22.14.0"
42
42
  }
43
43
  }