diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 9666a58e..00000000 --- a/.gitignore +++ /dev/null @@ -1,13 +0,0 @@ -# Binaries (distributed via GitHub releases) -*.exe -*.app -claude-mem -claude-mem-* - -# Temporary files -*.tmp -*.log -.DS_Store - -# Node modules (if any) -node_modules/ diff --git a/INSTALL.md b/INSTALL.md deleted file mode 100644 index 5d4eacee..00000000 --- a/INSTALL.md +++ /dev/null @@ -1,58 +0,0 @@ -# Installation Guide - -## Quick Install (Recommended) - -### Via NPM -```bash -npm install -g claude-mem -``` - -### Via curl -```bash -curl -fsSL https://raw.githubusercontent.com/thedotmack/claude-mem/main/install.sh | bash -``` - -## Manual Installation - -1. Download the appropriate binary for your platform from [Releases](https://github.com/thedotmack/claude-mem/releases/latest): - - **Windows**: `claude-mem.exe` - - **Linux x64**: `claude-mem-linux` - - **Linux ARM64**: `claude-mem-linux-arm64` - - **macOS Intel**: `claude-mem-macos-x64` - - **macOS Apple Silicon**: `claude-mem-macos-arm64` - -2. Make it executable (Unix-based systems): - ```bash - chmod +x claude-mem-* - ``` - -3. Move to your PATH: - ```bash - sudo mv claude-mem-* /usr/local/bin/claude-mem - ``` - -## After Installation - -Once the binary is installed, set up Claude Code integration: - -```bash -claude-mem install -``` - -This will: -- Install the Chroma MCP server -- Configure Claude Code hooks -- Set up the memory system - -## Platform Detection - -The `claude-mem` command automatically detects your platform and runs the correct binary. No manual selection needed! - -## Troubleshooting - -If you get a "command not found" error: -1. Ensure the binary is in your PATH -2. Try running with full path: `./claude-mem` -3. Check binary permissions: `ls -la claude-mem*` - -For other issues, please check our [Issues](https://github.com/thedotmack/claude-mem/issues) page. \ No newline at end of file diff --git a/LICENSE b/LICENSE index 9c41c425..fbe7401f 100644 --- a/LICENSE +++ b/LICENSE @@ -1,43 +1,31 @@ -# Claude Mem License +CLAUDE-MEM SOFTWARE LICENSE -Copyright (c) 2024 Alex Newman (@thedotmack) - -## Binary Distribution License - -The compiled binaries (claude-mem, claude-mem.exe, etc.) are provided free of charge for personal and commercial use under the following terms: - -1. **USE**: You may use the binaries for any purpose. -2. **DISTRIBUTION**: You may redistribute the unmodified binaries. -3. **NO REVERSE ENGINEERING**: You may not decompile, disassemble, or reverse engineer the binaries. -4. **NO MODIFICATION**: You may not modify the binary files. -5. **NO WARRANTY**: The software is provided "as is" without warranty of any kind. - -## Hook Files License (MIT) - -The hook files in the `/hooks` directory are licensed under the MIT License: +Copyright (c) 2024 Alex Newman (@thedotmack). All rights reserved. Permission is hereby granted, free of charge, to any person obtaining a copy -of these hook files and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: +of this software in its compiled/distributed form via npm, to use the software +for any purpose, subject to the following conditions: -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. +1. USE RIGHTS: You may use the claude-mem CLI tool for personal or commercial + purposes without restriction. -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. +2. NO SOURCE CODE RIGHTS: This license does NOT grant access to source code, + modification rights, or redistribution rights. The software is provided + as-is in its compiled form only. -## Contributions +3. NO REVERSE ENGINEERING: You may not reverse engineer, decompile, or + disassemble the software. -By submitting pull requests for hook files or documentation, you agree to license your contributions under the MIT License. +4. NO REDISTRIBUTION: You may not redistribute, repackage, or resell this + software. Users must install it from the official npm registry. -## Trademark +5. NO WARRANTY: THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -"Claude Mem" is a trademark of Alex Newman. You may use the name when referring to this software, but not in a way that implies endorsement or affiliation. \ No newline at end of file +6. LIMITATION OF LIABILITY: IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT + OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR + THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +For questions about this license, contact: thedotmack@gmail.com \ No newline at end of file diff --git a/README.md b/README.md index 7be0d6f2..7632c15a 100644 --- a/README.md +++ b/README.md @@ -50,12 +50,17 @@ Transform your Claude Code experience from forgetful to persistent, from isolate ## 🛠 Installation & Setup +### Prerequisites +- Node.js 18+ +- Claude Code CLI installed +- uv (Python package manager) - automatically installed if missing + ### Quick Install ```bash # Install globally npm install -g claude-mem -# Set up Claude Code integration +# Set up Claude Code integration (installs uv if needed) claude-mem install # Restart Claude Code to activate @@ -67,6 +72,8 @@ claude-mem install npx claude-mem install ``` +The `claude-mem install` command will automatically install [uv](https://docs.astral.sh/uv/) if it's not already present on your system. uv is required for the Chroma MCP server that powers the memory system. + ### Verification ```bash # Check installation status diff --git a/RELEASE.md b/RELEASE.md deleted file mode 100644 index d9edc49b..00000000 --- a/RELEASE.md +++ /dev/null @@ -1,40 +0,0 @@ -# Claude Mem v3.3.8 - -## 🚀 Installation - -### Quick Install (Recommended) -```bash -curl -fsSL https://raw.githubusercontent.com/thedotmack/claude-mem/main/install.sh | bash -``` - -### Manual Download -Download the appropriate binary for your platform from the [releases page](https://github.com/thedotmack/claude-mem/releases/latest): - -- **Windows x64**: `claude-mem.exe` -- **Linux x64**: `claude-mem-linux` -- **Linux ARM64**: `claude-mem-linux-arm64` -- **macOS ARM64** (Apple Silicon): `claude-mem-macos-arm64` -- **macOS x64** (Intel): `claude-mem-macos-x64` - -## 📦 What's Included - -- Multi-platform binaries for Windows, Linux, and macOS -- Hook system for customization -- Full documentation -- MCP server integration for Claude Code - -## 🔧 Supported Platforms - -| Platform | Architecture | Binary Name | -|----------|--------------|-------------| -| Windows | x64 | claude-mem.exe | -| Linux | x64 | claude-mem-linux | -| Linux | ARM64 | claude-mem-linux-arm64 | -| macOS | ARM64 (Apple Silicon) | claude-mem-macos-arm64 | -| macOS | x64 (Intel) | claude-mem-macos-x64 | - -## 📝 License - -Binary distribution under proprietary license (free to use). -Hook files under MIT license (open source). -See LICENSE file for details. diff --git a/commands/remember.md b/commands/remember.md new file mode 100644 index 00000000..c21e6157 --- /dev/null +++ b/commands/remember.md @@ -0,0 +1 @@ +Search claude-mem for #$ARGUMENTS and look up relevant context to help clarify what we are working on. \ No newline at end of file diff --git a/commands/save.md b/commands/save.md new file mode 100644 index 00000000..03097988 --- /dev/null +++ b/commands/save.md @@ -0,0 +1,3 @@ +Write an overview of the current conversation context and: +1. Add it to claude-mem using the chroma MCP tools +2. Save the overview using the claude-mem CLI tool: `claude-mem save "your overview message"` \ No newline at end of file diff --git a/dist/claude-mem.min.js b/dist/claude-mem.min.js new file mode 100755 index 00000000..466ef5eb --- /dev/null +++ b/dist/claude-mem.min.js @@ -0,0 +1,444 @@ +#!/usr/bin/env node +import{createRequire as U$}from"node:module";var B$=Object.create;var{getPrototypeOf:t$,defineProperty:x7,getOwnPropertyNames:e$}=Object;var F$=Object.prototype.hasOwnProperty;var o6=(q,_,j)=>{j=q!=null?B$(t$(q)):{};let K=_||!q||!q.__esModule?x7(j,"default",{value:q,enumerable:!0}):j;for(let Y of e$(q))if(!F$.call(K,Y))x7(K,Y,{get:()=>q[Y],enumerable:!0});return K};var q8=(q,_)=>()=>(_||q((_={exports:{}}).exports,_),_.exports);var uK=(q,_)=>{for(var j in _)x7(q,j,{get:_[j],enumerable:!0,configurable:!0,set:(K)=>_[j]=()=>K})};var Y6=(q,_)=>()=>(q&&(_=q(q=0)),_);var u6=U$(import.meta.url);var hK=q8((s$)=>{class c7 extends Error{constructor(q,_,j){super(j);Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=_,this.exitCode=q,this.nestedError=void 0}}class c9 extends c7{constructor(q){super(1,"commander.invalidArgument",q);Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}}s$.CommanderError=c7;s$.InvalidArgumentError=c9});var V3=q8((jw)=>{var{InvalidArgumentError:_w}=hK();class r9{constructor(q,_){switch(this.description=_||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,q[0]){case"<":this.required=!0,this._name=q.slice(1,-1);break;case"[":this.required=!1,this._name=q.slice(1,-1);break;default:this.required=!0,this._name=q;break}if(this._name.length>3&&this._name.slice(-3)==="...")this.variadic=!0,this._name=this._name.slice(0,-3)}name(){return this._name}_concatValue(q,_){if(_===this.defaultValue||!Array.isArray(_))return[q];return _.concat(q)}default(q,_){return this.defaultValue=q,this.defaultValueDescription=_,this}argParser(q){return this.parseArg=q,this}choices(q){return this.argChoices=q.slice(),this.parseArg=(_,j)=>{if(!this.argChoices.includes(_))throw new _w(`Allowed choices are ${this.argChoices.join(", ")}.`);if(this.variadic)return this._concatValue(_,j);return _},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}}function Kw(q){let _=q.name()+(q.variadic===!0?"...":"");return q.required?"<"+_+">":"["+_+"]"}jw.Argument=r9;jw.humanReadableArgName=Kw});var r7=q8(($w)=>{var{humanReadableArgName:fw}=V3();class i9{constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}prepareContext(q){this.helpWidth=this.helpWidth??q.helpWidth??80}visibleCommands(q){let _=q.commands.filter((K)=>!K._hidden),j=q._getHelpCommand();if(j&&!j._hidden)_.push(j);if(this.sortSubcommands)_.sort((K,Y)=>{return K.name().localeCompare(Y.name())});return _}compareOptions(q,_){let j=(K)=>{return K.short?K.short.replace(/^-/,""):K.long.replace(/^--/,"")};return j(q).localeCompare(j(_))}visibleOptions(q){let _=q.options.filter((K)=>!K.hidden),j=q._getHelpOption();if(j&&!j.hidden){let K=j.short&&q._findOption(j.short),Y=j.long&&q._findOption(j.long);if(!K&&!Y)_.push(j);else if(j.long&&!Y)_.push(q.createOption(j.long,j.description));else if(j.short&&!K)_.push(q.createOption(j.short,j.description))}if(this.sortOptions)_.sort(this.compareOptions);return _}visibleGlobalOptions(q){if(!this.showGlobalOptions)return[];let _=[];for(let j=q.parent;j;j=j.parent){let K=j.options.filter((Y)=>!Y.hidden);_.push(...K)}if(this.sortOptions)_.sort(this.compareOptions);return _}visibleArguments(q){if(q._argsDescription)q.registeredArguments.forEach((_)=>{_.description=_.description||q._argsDescription[_.name()]||""});if(q.registeredArguments.find((_)=>_.description))return q.registeredArguments;return[]}subcommandTerm(q){let _=q.registeredArguments.map((j)=>fw(j)).join(" ");return q._name+(q._aliases[0]?"|"+q._aliases[0]:"")+(q.options.length?" [options]":"")+(_?" "+_:"")}optionTerm(q){return q.flags}argumentTerm(q){return q.name()}longestSubcommandTermLength(q,_){return _.visibleCommands(q).reduce((j,K)=>{return Math.max(j,this.displayWidth(_.styleSubcommandTerm(_.subcommandTerm(K))))},0)}longestOptionTermLength(q,_){return _.visibleOptions(q).reduce((j,K)=>{return Math.max(j,this.displayWidth(_.styleOptionTerm(_.optionTerm(K))))},0)}longestGlobalOptionTermLength(q,_){return _.visibleGlobalOptions(q).reduce((j,K)=>{return Math.max(j,this.displayWidth(_.styleOptionTerm(_.optionTerm(K))))},0)}longestArgumentTermLength(q,_){return _.visibleArguments(q).reduce((j,K)=>{return Math.max(j,this.displayWidth(_.styleArgumentTerm(_.argumentTerm(K))))},0)}commandUsage(q){let _=q._name;if(q._aliases[0])_=_+"|"+q._aliases[0];let j="";for(let K=q.parent;K;K=K.parent)j=K.name()+" "+j;return j+_+" "+q.usage()}commandDescription(q){return q.description()}subcommandDescription(q){return q.summary()||q.description()}optionDescription(q){let _=[];if(q.argChoices)_.push(`choices: ${q.argChoices.map((j)=>JSON.stringify(j)).join(", ")}`);if(q.defaultValue!==void 0){if(q.required||q.optional||q.isBoolean()&&typeof q.defaultValue==="boolean")_.push(`default: ${q.defaultValueDescription||JSON.stringify(q.defaultValue)}`)}if(q.presetArg!==void 0&&q.optional)_.push(`preset: ${JSON.stringify(q.presetArg)}`);if(q.envVar!==void 0)_.push(`env: ${q.envVar}`);if(_.length>0){let j=`(${_.join(", ")})`;if(q.description)return`${q.description} ${j}`;return j}return q.description}argumentDescription(q){let _=[];if(q.argChoices)_.push(`choices: ${q.argChoices.map((j)=>JSON.stringify(j)).join(", ")}`);if(q.defaultValue!==void 0)_.push(`default: ${q.defaultValueDescription||JSON.stringify(q.defaultValue)}`);if(_.length>0){let j=`(${_.join(", ")})`;if(q.description)return`${q.description} ${j}`;return j}return q.description}formatItemList(q,_,j){if(_.length===0)return[];return[j.styleTitle(q),..._,""]}groupItems(q,_,j){let K=new Map;return q.forEach((Y)=>{let f=j(Y);if(!K.has(f))K.set(f,[])}),_.forEach((Y)=>{let f=j(Y);if(!K.has(f))K.set(f,[]);K.get(f).push(Y)}),K}formatHelp(q,_){let j=_.padWidth(q,_),K=_.helpWidth??80;function Y(v,z){return _.formatItem(v,j,z,_)}let f=[`${_.styleTitle("Usage:")} ${_.styleUsage(_.commandUsage(q))}`,""],P=_.commandDescription(q);if(P.length>0)f=f.concat([_.boxWrap(_.styleCommandDescription(P),K),""]);let $=_.visibleArguments(q).map((v)=>{return Y(_.styleArgumentTerm(_.argumentTerm(v)),_.styleArgumentDescription(_.argumentDescription(v)))});if(f=f.concat(this.formatItemList("Arguments:",$,_)),this.groupItems(q.options,_.visibleOptions(q),(v)=>v.helpGroupHeading??"Options:").forEach((v,z)=>{let W=v.map((J)=>{return Y(_.styleOptionTerm(_.optionTerm(J)),_.styleOptionDescription(_.optionDescription(J)))});f=f.concat(this.formatItemList(z,W,_))}),_.showGlobalOptions){let v=_.visibleGlobalOptions(q).map((z)=>{return Y(_.styleOptionTerm(_.optionTerm(z)),_.styleOptionDescription(_.optionDescription(z)))});f=f.concat(this.formatItemList("Global Options:",v,_))}return this.groupItems(q.commands,_.visibleCommands(q),(v)=>v.helpGroup()||"Commands:").forEach((v,z)=>{let W=v.map((J)=>{return Y(_.styleSubcommandTerm(_.subcommandTerm(J)),_.styleSubcommandDescription(_.subcommandDescription(J)))});f=f.concat(this.formatItemList(z,W,_))}),f.join(` +`)}displayWidth(q){return o9(q).length}styleTitle(q){return q}styleUsage(q){return q.split(" ").map((_)=>{if(_==="[options]")return this.styleOptionText(_);if(_==="[command]")return this.styleSubcommandText(_);if(_[0]==="["||_[0]==="<")return this.styleArgumentText(_);return this.styleCommandText(_)}).join(" ")}styleCommandDescription(q){return this.styleDescriptionText(q)}styleOptionDescription(q){return this.styleDescriptionText(q)}styleSubcommandDescription(q){return this.styleDescriptionText(q)}styleArgumentDescription(q){return this.styleDescriptionText(q)}styleDescriptionText(q){return q}styleOptionTerm(q){return this.styleOptionText(q)}styleSubcommandTerm(q){return q.split(" ").map((_)=>{if(_==="[options]")return this.styleOptionText(_);if(_[0]==="["||_[0]==="<")return this.styleArgumentText(_);return this.styleSubcommandText(_)}).join(" ")}styleArgumentTerm(q){return this.styleArgumentText(q)}styleOptionText(q){return q}styleArgumentText(q){return q}styleSubcommandText(q){return q}styleCommandText(q){return q}padWidth(q,_){return Math.max(_.longestOptionTermLength(q,_),_.longestGlobalOptionTermLength(q,_),_.longestSubcommandTermLength(q,_),_.longestArgumentTermLength(q,_))}preformatted(q){return/\n[^\S\r\n]/.test(q)}formatItem(q,_,j,K){let f=" ".repeat(2);if(!j)return f+q;let P=q.padEnd(_+q.length-K.displayWidth(q)),$=2,w=(this.helpWidth??80)-_-$-2,v;if(w{let P=f.match(K);if(P===null){Y.push("");return}let $=[P.shift()],O=this.displayWidth($[0]);P.forEach((w)=>{let v=this.displayWidth(w);if(O+v<=_){$.push(w),O+=v;return}Y.push($.join(""));let z=w.trimStart();$=[z],O=this.displayWidth(z)}),Y.push($.join(""))}),Y.join(` +`)}}function o9(q){let _=/\x1b\[\d*(;\d*)*m/g;return q.replace(_,"")}$w.Help=i9;$w.stripColor=o9});var i7=q8((Ww)=>{var{InvalidArgumentError:vw}=hK();class B9{constructor(q,_){this.flags=q,this.description=_||"",this.required=q.includes("<"),this.optional=q.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test(q),this.mandatory=!1;let j=zw(q);if(this.short=j.shortFlag,this.long=j.longFlag,this.negate=!1,this.long)this.negate=this.long.startsWith("--no-");this.defaultValue=void 0,this.defaultValueDescription=void 0,this.presetArg=void 0,this.envVar=void 0,this.parseArg=void 0,this.hidden=!1,this.argChoices=void 0,this.conflictsWith=[],this.implied=void 0,this.helpGroupHeading=void 0}default(q,_){return this.defaultValue=q,this.defaultValueDescription=_,this}preset(q){return this.presetArg=q,this}conflicts(q){return this.conflictsWith=this.conflictsWith.concat(q),this}implies(q){let _=q;if(typeof q==="string")_={[q]:!0};return this.implied=Object.assign(this.implied||{},_),this}env(q){return this.envVar=q,this}argParser(q){return this.parseArg=q,this}makeOptionMandatory(q=!0){return this.mandatory=!!q,this}hideHelp(q=!0){return this.hidden=!!q,this}_concatValue(q,_){if(_===this.defaultValue||!Array.isArray(_))return[q];return _.concat(q)}choices(q){return this.argChoices=q.slice(),this.parseArg=(_,j)=>{if(!this.argChoices.includes(_))throw new vw(`Allowed choices are ${this.argChoices.join(", ")}.`);if(this.variadic)return this._concatValue(_,j);return _},this}name(){if(this.long)return this.long.replace(/^--/,"");return this.short.replace(/^-/,"")}attributeName(){if(this.negate)return a9(this.name().replace(/^no-/,""));return a9(this.name())}helpGroup(q){return this.helpGroupHeading=q,this}is(q){return this.short===q||this.long===q}isBoolean(){return!this.required&&!this.optional&&!this.negate}}class t9{constructor(q){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,q.forEach((_)=>{if(_.negate)this.negativeOptions.set(_.attributeName(),_);else this.positiveOptions.set(_.attributeName(),_)}),this.negativeOptions.forEach((_,j)=>{if(this.positiveOptions.has(j))this.dualOptions.add(j)})}valueFromOption(q,_){let j=_.attributeName();if(!this.dualOptions.has(j))return!0;let K=this.negativeOptions.get(j).presetArg,Y=K!==void 0?K:!1;return _.negate===(Y===q)}}function a9(q){return q.split("-").reduce((_,j)=>{return _+j[0].toUpperCase()+j.slice(1)})}function zw(q){let _,j,K=/^-[^-]$/,Y=/^--[^-]/,f=q.split(/[ |,]+/).concat("guard");if(K.test(f[0]))_=f.shift();if(Y.test(f[0]))j=f.shift();if(!_&&K.test(f[0]))_=f.shift();if(!_&&Y.test(f[0]))_=j,j=f.shift();if(f[0].startsWith("-")){let P=f[0],$=`option creation failed due to '${P}' in option flags '${q}'`;if(/^-[^-][^-]/.test(P))throw new Error(`${$} +- a short flag is a single dash and a single character + - either use a single dash and a single character (for a short flag) + - or use a double dash for a long option (and can have two, like '--ws, --workspace')`);if(K.test(P))throw new Error(`${$} +- too many short flags`);if(Y.test(P))throw new Error(`${$} +- too many long flags`);throw new Error(`${$} +- unrecognised flag format`)}if(_===void 0&&j===void 0)throw new Error(`option creation failed due to no flags found in '${q}'.`);return{shortFlag:_,longFlag:j}}Ww.Option=B9;Ww.DualOptions=t9});var e9=q8((kw)=>{function Tw(q,_){if(Math.abs(q.length-_.length)>3)return Math.max(q.length,_.length);let j=[];for(let K=0;K<=q.length;K++)j[K]=[K];for(let K=0;K<=_.length;K++)j[0][K]=K;for(let K=1;K<=_.length;K++)for(let Y=1;Y<=q.length;Y++){let f=1;if(q[Y-1]===_[K-1])f=0;else f=1;if(j[Y][K]=Math.min(j[Y-1][K]+1,j[Y][K-1]+1,j[Y-1][K-1]+f),Y>1&&K>1&&q[Y-1]===_[K-2]&&q[Y-2]===_[K-1])j[Y][K]=Math.min(j[Y][K],j[Y-2][K-2]+1)}return j[q.length][_.length]}function Zw(q,_){if(!_||_.length===0)return"";_=Array.from(new Set(_));let j=q.startsWith("--");if(j)q=q.slice(2),_=_.map((P)=>P.slice(2));let K=[],Y=3,f=0.4;if(_.forEach((P)=>{if(P.length<=1)return;let $=Tw(q,P),O=Math.max(q.length,P.length);if((O-$)/O>f){if($P.localeCompare($)),j)K=K.map((P)=>`--${P}`);if(K.length>1)return` +(Did you mean one of ${K.join(", ")}?)`;if(K.length===1)return` +(Did you mean ${K[0]}?)`;return""}kw.suggestSimilar=Zw});var Q9=q8((Vw)=>{var Aw=u6("node:events").EventEmitter,o7=u6("node:child_process"),Vq=u6("node:path"),M3=u6("node:fs"),M8=u6("node:process"),{Argument:Gw,humanReadableArgName:uw}=V3(),{CommanderError:a7}=hK(),{Help:hw,stripColor:Dw}=r7(),{Option:F9,DualOptions:Cw}=i7(),{suggestSimilar:U9}=e9();class t7 extends Aw{constructor(q){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=q||"",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:(_)=>M8.stdout.write(_),writeErr:(_)=>M8.stderr.write(_),outputError:(_,j)=>j(_),getOutHelpWidth:()=>M8.stdout.isTTY?M8.stdout.columns:void 0,getErrHelpWidth:()=>M8.stderr.isTTY?M8.stderr.columns:void 0,getOutHasColors:()=>B7()??(M8.stdout.isTTY&&M8.stdout.hasColors?.()),getErrHasColors:()=>B7()??(M8.stderr.isTTY&&M8.stderr.hasColors?.()),stripColor:(_)=>Dw(_)},this._hidden=!1,this._helpOption=void 0,this._addImplicitHelpCommand=void 0,this._helpCommand=void 0,this._helpConfiguration={},this._helpGroupHeading=void 0,this._defaultCommandGroup=void 0,this._defaultOptionGroup=void 0}copyInheritedSettings(q){return this._outputConfiguration=q._outputConfiguration,this._helpOption=q._helpOption,this._helpCommand=q._helpCommand,this._helpConfiguration=q._helpConfiguration,this._exitCallback=q._exitCallback,this._storeOptionsAsProperties=q._storeOptionsAsProperties,this._combineFlagAndOptionalValue=q._combineFlagAndOptionalValue,this._allowExcessArguments=q._allowExcessArguments,this._enablePositionalOptions=q._enablePositionalOptions,this._showHelpAfterError=q._showHelpAfterError,this._showSuggestionAfterError=q._showSuggestionAfterError,this}_getCommandAndAncestors(){let q=[];for(let _=this;_;_=_.parent)q.push(_);return q}command(q,_,j){let K=_,Y=j;if(typeof K==="object"&&K!==null)Y=K,K=null;Y=Y||{};let[,f,P]=q.match(/([^ ]+) *(.*)/),$=this.createCommand(f);if(K)$.description(K),$._executableHandler=!0;if(Y.isDefault)this._defaultCommandName=$._name;if($._hidden=!!(Y.noHelp||Y.hidden),$._executableFile=Y.executableFile||null,P)$.arguments(P);if(this._registerCommand($),$.parent=this,$.copyInheritedSettings(this),K)return this;return $}createCommand(q){return new t7(q)}createHelp(){return Object.assign(new hw,this.configureHelp())}configureHelp(q){if(q===void 0)return this._helpConfiguration;return this._helpConfiguration=q,this}configureOutput(q){if(q===void 0)return this._outputConfiguration;return this._outputConfiguration=Object.assign({},this._outputConfiguration,q),this}showHelpAfterError(q=!0){if(typeof q!=="string")q=!!q;return this._showHelpAfterError=q,this}showSuggestionAfterError(q=!0){return this._showSuggestionAfterError=!!q,this}addCommand(q,_){if(!q._name)throw new Error(`Command passed to .addCommand() must have a name +- specify the name in Command constructor or using .name()`);if(_=_||{},_.isDefault)this._defaultCommandName=q._name;if(_.noHelp||_.hidden)q._hidden=!0;return this._registerCommand(q),q.parent=this,q._checkForBrokenPassThrough(),this}createArgument(q,_){return new Gw(q,_)}argument(q,_,j,K){let Y=this.createArgument(q,_);if(typeof j==="function")Y.default(K).argParser(j);else Y.default(j);return this.addArgument(Y),this}arguments(q){return q.trim().split(/ +/).forEach((_)=>{this.argument(_)}),this}addArgument(q){let _=this.registeredArguments.slice(-1)[0];if(_&&_.variadic)throw new Error(`only the last argument can be variadic '${_.name()}'`);if(q.required&&q.defaultValue!==void 0&&q.parseArg===void 0)throw new Error(`a default value for a required argument is never used: '${q.name()}'`);return this.registeredArguments.push(q),this}helpCommand(q,_){if(typeof q==="boolean"){if(this._addImplicitHelpCommand=q,q&&this._defaultCommandGroup)this._initCommandGroup(this._getHelpCommand());return this}let j=q??"help [command]",[,K,Y]=j.match(/([^ ]+) *(.*)/),f=_??"display help for command",P=this.createCommand(K);if(P.helpOption(!1),Y)P.arguments(Y);if(f)P.description(f);if(this._addImplicitHelpCommand=!0,this._helpCommand=P,q||_)this._initCommandGroup(P);return this}addHelpCommand(q,_){if(typeof q!=="object")return this.helpCommand(q,_),this;return this._addImplicitHelpCommand=!0,this._helpCommand=q,this._initCommandGroup(q),this}_getHelpCommand(){if(this._addImplicitHelpCommand??(this.commands.length&&!this._actionHandler&&!this._findCommand("help"))){if(this._helpCommand===void 0)this.helpCommand(void 0,void 0);return this._helpCommand}return null}hook(q,_){let j=["preSubcommand","preAction","postAction"];if(!j.includes(q))throw new Error(`Unexpected value for event passed to hook : '${q}'. +Expecting one of '${j.join("', '")}'`);if(this._lifeCycleHooks[q])this._lifeCycleHooks[q].push(_);else this._lifeCycleHooks[q]=[_];return this}exitOverride(q){if(q)this._exitCallback=q;else this._exitCallback=(_)=>{if(_.code!=="commander.executeSubCommandAsync")throw _};return this}_exit(q,_,j){if(this._exitCallback)this._exitCallback(new a7(q,_,j));M8.exit(q)}action(q){let _=(j)=>{let K=this.registeredArguments.length,Y=j.slice(0,K);if(this._storeOptionsAsProperties)Y[K]=this;else Y[K]=this.opts();return Y.push(this),q.apply(this,Y)};return this._actionHandler=_,this}createOption(q,_){return new F9(q,_)}_callParseArg(q,_,j,K){try{return q.parseArg(_,j)}catch(Y){if(Y.code==="commander.invalidArgument"){let f=`${K} ${Y.message}`;this.error(f,{exitCode:Y.exitCode,code:Y.code})}throw Y}}_registerOption(q){let _=q.short&&this._findOption(q.short)||q.long&&this._findOption(q.long);if(_){let j=q.long&&this._findOption(q.long)?q.long:q.short;throw new Error(`Cannot add option '${q.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${j}' +- already used by option '${_.flags}'`)}this._initOptionGroup(q),this.options.push(q)}_registerCommand(q){let _=(K)=>{return[K.name()].concat(K.aliases())},j=_(q).find((K)=>this._findCommand(K));if(j){let K=_(this._findCommand(j)).join("|"),Y=_(q).join("|");throw new Error(`cannot add command '${Y}' as already have command '${K}'`)}this._initCommandGroup(q),this.commands.push(q)}addOption(q){this._registerOption(q);let _=q.name(),j=q.attributeName();if(q.negate){let Y=q.long.replace(/^--no-/,"--");if(!this._findOption(Y))this.setOptionValueWithSource(j,q.defaultValue===void 0?!0:q.defaultValue,"default")}else if(q.defaultValue!==void 0)this.setOptionValueWithSource(j,q.defaultValue,"default");let K=(Y,f,P)=>{if(Y==null&&q.presetArg!==void 0)Y=q.presetArg;let $=this.getOptionValue(j);if(Y!==null&&q.parseArg)Y=this._callParseArg(q,Y,$,f);else if(Y!==null&&q.variadic)Y=q._concatValue(Y,$);if(Y==null)if(q.negate)Y=!1;else if(q.isBoolean()||q.optional)Y=!0;else Y="";this.setOptionValueWithSource(j,Y,P)};if(this.on("option:"+_,(Y)=>{let f=`error: option '${q.flags}' argument '${Y}' is invalid.`;K(Y,f,"cli")}),q.envVar)this.on("optionEnv:"+_,(Y)=>{let f=`error: option '${q.flags}' value '${Y}' from env '${q.envVar}' is invalid.`;K(Y,f,"env")});return this}_optionEx(q,_,j,K,Y){if(typeof _==="object"&&_ instanceof F9)throw new Error("To add an Option object use addOption() instead of option() or requiredOption()");let f=this.createOption(_,j);if(f.makeOptionMandatory(!!q.mandatory),typeof K==="function")f.default(Y).argParser(K);else if(K instanceof RegExp){let P=K;K=($,O)=>{let w=P.exec($);return w?w[0]:O},f.default(Y).argParser(K)}else f.default(K);return this.addOption(f)}option(q,_,j,K){return this._optionEx({},q,_,j,K)}requiredOption(q,_,j,K){return this._optionEx({mandatory:!0},q,_,j,K)}combineFlagAndOptionalValue(q=!0){return this._combineFlagAndOptionalValue=!!q,this}allowUnknownOption(q=!0){return this._allowUnknownOption=!!q,this}allowExcessArguments(q=!0){return this._allowExcessArguments=!!q,this}enablePositionalOptions(q=!0){return this._enablePositionalOptions=!!q,this}passThroughOptions(q=!0){return this._passThroughOptions=!!q,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(q=!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=!!q,this}getOptionValue(q){if(this._storeOptionsAsProperties)return this[q];return this._optionValues[q]}setOptionValue(q,_){return this.setOptionValueWithSource(q,_,void 0)}setOptionValueWithSource(q,_,j){if(this._storeOptionsAsProperties)this[q]=_;else this._optionValues[q]=_;return this._optionValueSources[q]=j,this}getOptionValueSource(q){return this._optionValueSources[q]}getOptionValueSourceWithGlobals(q){let _;return this._getCommandAndAncestors().forEach((j)=>{if(j.getOptionValueSource(q)!==void 0)_=j.getOptionValueSource(q)}),_}_prepareUserArgs(q,_){if(q!==void 0&&!Array.isArray(q))throw new Error("first parameter to parse must be array or undefined");if(_=_||{},q===void 0&&_.from===void 0){if(M8.versions?.electron)_.from="electron";let K=M8.execArgv??[];if(K.includes("-e")||K.includes("--eval")||K.includes("-p")||K.includes("--print"))_.from="eval"}if(q===void 0)q=M8.argv;this.rawArgs=q.slice();let j;switch(_.from){case void 0:case"node":this._scriptPath=q[1],j=q.slice(2);break;case"electron":if(M8.defaultApp)this._scriptPath=q[1],j=q.slice(2);else j=q.slice(1);break;case"user":j=q.slice(0);break;case"eval":j=q.slice(1);break;default:throw new Error(`unexpected parse option { from: '${_.from}' }`)}if(!this._name&&this._scriptPath)this.nameFromFilename(this._scriptPath);return this._name=this._name||"program",j}parse(q,_){this._prepareForParse();let j=this._prepareUserArgs(q,_);return this._parseCommand([],j),this}async parseAsync(q,_){this._prepareForParse();let j=this._prepareUserArgs(q,_);return await this._parseCommand([],j),this}_prepareForParse(){if(this._savedState===null)this.saveStateBeforeParse();else 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. +- 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(q,_,j){if(M3.existsSync(q))return;let K=_?`searched for local subcommand relative to directory '${_}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",Y=`'${q}' does not exist + - if '${j}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead + - if the default executable name is not suitable, use the executableFile option to supply a custom name or path + - ${K}`;throw new Error(Y)}_executeSubCommand(q,_){_=_.slice();let j=!1,K=[".js",".ts",".tsx",".mjs",".cjs"];function Y(w,v){let z=Vq.resolve(w,v);if(M3.existsSync(z))return z;if(K.includes(Vq.extname(v)))return;let W=K.find((J)=>M3.existsSync(`${z}${J}`));if(W)return`${z}${W}`;return}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let f=q._executableFile||`${this._name}-${q._name}`,P=this._executableDir||"";if(this._scriptPath){let w;try{w=M3.realpathSync(this._scriptPath)}catch{w=this._scriptPath}P=Vq.resolve(Vq.dirname(w),P)}if(P){let w=Y(P,f);if(!w&&!q._executableFile&&this._scriptPath){let v=Vq.basename(this._scriptPath,Vq.extname(this._scriptPath));if(v!==this._name)w=Y(P,`${v}-${q._name}`)}f=w||f}j=K.includes(Vq.extname(f));let $;if(M8.platform!=="win32")if(j)_.unshift(f),_=s9(M8.execArgv).concat(_),$=o7.spawn(M8.argv[0],_,{stdio:"inherit"});else $=o7.spawn(f,_,{stdio:"inherit"});else this._checkForMissingExecutable(f,P,q._name),_.unshift(f),_=s9(M8.execArgv).concat(_),$=o7.spawn(M8.execPath,_,{stdio:"inherit"});if(!$.killed)["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach((v)=>{M8.on(v,()=>{if($.killed===!1&&$.exitCode===null)$.kill(v)})});let O=this._exitCallback;$.on("close",(w)=>{if(w=w??1,!O)M8.exit(w);else O(new a7(w,"commander.executeSubCommandAsync","(close)"))}),$.on("error",(w)=>{if(w.code==="ENOENT")this._checkForMissingExecutable(f,P,q._name);else if(w.code==="EACCES")throw new Error(`'${f}' not executable`);if(!O)M8.exit(1);else{let v=new a7(1,"commander.executeSubCommandAsync","(error)");v.nestedError=w,O(v)}}),this.runningCommand=$}_dispatchSubcommand(q,_,j){let K=this._findCommand(q);if(!K)this.help({error:!0});K._prepareForParse();let Y;return Y=this._chainOrCallSubCommandHook(Y,K,"preSubcommand"),Y=this._chainOrCall(Y,()=>{if(K._executableHandler)this._executeSubCommand(K,_.concat(j));else return K._parseCommand(_,j)}),Y}_dispatchHelpCommand(q){if(!q)this.help();let _=this._findCommand(q);if(_&&!_._executableHandler)_.help();return this._dispatchSubcommand(q,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){if(this.registeredArguments.forEach((q,_)=>{if(q.required&&this.args[_]==null)this.missingArgument(q.name())}),this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic)return;if(this.args.length>this.registeredArguments.length)this._excessArguments(this.args)}_processArguments(){let q=(j,K,Y)=>{let f=K;if(K!==null&&j.parseArg){let P=`error: command-argument value '${K}' is invalid for argument '${j.name()}'.`;f=this._callParseArg(j,K,Y,P)}return f};this._checkNumberOfArguments();let _=[];this.registeredArguments.forEach((j,K)=>{let Y=j.defaultValue;if(j.variadic){if(K{return q(j,P,f)},j.defaultValue)}else if(Y===void 0)Y=[]}else if(K_());return _()}_chainOrCallHooks(q,_){let j=q,K=[];if(this._getCommandAndAncestors().reverse().filter((Y)=>Y._lifeCycleHooks[_]!==void 0).forEach((Y)=>{Y._lifeCycleHooks[_].forEach((f)=>{K.push({hookedCommand:Y,callback:f})})}),_==="postAction")K.reverse();return K.forEach((Y)=>{j=this._chainOrCall(j,()=>{return Y.callback(Y.hookedCommand,this)})}),j}_chainOrCallSubCommandHook(q,_,j){let K=q;if(this._lifeCycleHooks[j]!==void 0)this._lifeCycleHooks[j].forEach((Y)=>{K=this._chainOrCall(K,()=>{return Y(this,_)})});return K}_parseCommand(q,_){let j=this.parseOptions(_);if(this._parseOptionsEnv(),this._parseOptionsImplied(),q=q.concat(j.operands),_=j.unknown,this.args=q.concat(_),q&&this._findCommand(q[0]))return this._dispatchSubcommand(q[0],q.slice(1),_);if(this._getHelpCommand()&&q[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(q[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(_),this._dispatchSubcommand(this._defaultCommandName,q,_);if(this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName)this.help({error:!0});this._outputHelpIfRequested(j.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let K=()=>{if(j.unknown.length>0)this.unknownOption(j.unknown[0])},Y=`command:${this.name()}`;if(this._actionHandler){K(),this._processArguments();let f;if(f=this._chainOrCallHooks(f,"preAction"),f=this._chainOrCall(f,()=>this._actionHandler(this.processedArgs)),this.parent)f=this._chainOrCall(f,()=>{this.parent.emit(Y,q,_)});return f=this._chainOrCallHooks(f,"postAction"),f}if(this.parent&&this.parent.listenerCount(Y))K(),this._processArguments(),this.parent.emit(Y,q,_);else if(q.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",q,_);if(this.listenerCount("command:*"))this.emit("command:*",q,_);else if(this.commands.length)this.unknownCommand();else K(),this._processArguments()}else if(this.commands.length)K(),this.help({error:!0});else K(),this._processArguments()}_findCommand(q){if(!q)return;return this.commands.find((_)=>_._name===q||_._aliases.includes(q))}_findOption(q){return this.options.find((_)=>_.is(q))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach((q)=>{q.options.forEach((_)=>{if(_.mandatory&&q.getOptionValue(_.attributeName())===void 0)q.missingMandatoryOptionValue(_)})})}_checkForConflictingLocalOptions(){let q=this.options.filter((j)=>{let K=j.attributeName();if(this.getOptionValue(K)===void 0)return!1;return this.getOptionValueSource(K)!=="default"});q.filter((j)=>j.conflictsWith.length>0).forEach((j)=>{let K=q.find((Y)=>j.conflictsWith.includes(Y.attributeName()));if(K)this._conflictingOption(j,K)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach((q)=>{q._checkForConflictingLocalOptions()})}parseOptions(q){let _=[],j=[],K=_,Y=q.slice();function f(O){return O.length>1&&O[0]==="-"}let P=(O)=>{if(!/^-\d*\.?\d+(e[+-]?\d+)?$/.test(O))return!1;return!this._getCommandAndAncestors().some((w)=>w.options.map((v)=>v.short).some((v)=>/^-\d$/.test(v)))},$=null;while(Y.length){let O=Y.shift();if(O==="--"){if(K===j)K.push(O);K.push(...Y);break}if($&&(!f(O)||P(O))){this.emit(`option:${$.name()}`,O);continue}if($=null,f(O)){let w=this._findOption(O);if(w){if(w.required){let v=Y.shift();if(v===void 0)this.optionMissingArgument(w);this.emit(`option:${w.name()}`,v)}else if(w.optional){let v=null;if(Y.length>0&&(!f(Y[0])||P(Y[0])))v=Y.shift();this.emit(`option:${w.name()}`,v)}else this.emit(`option:${w.name()}`);$=w.variadic?w:null;continue}}if(O.length>2&&O[0]==="-"&&O[1]!=="-"){let w=this._findOption(`-${O[1]}`);if(w){if(w.required||w.optional&&this._combineFlagAndOptionalValue)this.emit(`option:${w.name()}`,O.slice(2));else this.emit(`option:${w.name()}`),Y.unshift(`-${O.slice(2)}`);continue}}if(/^--[^=]+=/.test(O)){let w=O.indexOf("="),v=this._findOption(O.slice(0,w));if(v&&(v.required||v.optional)){this.emit(`option:${v.name()}`,O.slice(w+1));continue}}if(K===_&&f(O)&&!(this.commands.length===0&&P(O)))K=j;if((this._enablePositionalOptions||this._passThroughOptions)&&_.length===0&&j.length===0){if(this._findCommand(O)){if(_.push(O),Y.length>0)j.push(...Y);break}else if(this._getHelpCommand()&&O===this._getHelpCommand().name()){if(_.push(O),Y.length>0)_.push(...Y);break}else if(this._defaultCommandName){if(j.push(O),Y.length>0)j.push(...Y);break}}if(this._passThroughOptions){if(K.push(O),Y.length>0)K.push(...Y);break}K.push(O)}return{operands:_,unknown:j}}opts(){if(this._storeOptionsAsProperties){let q={},_=this.options.length;for(let j=0;j<_;j++){let K=this.options[j].attributeName();q[K]=K===this._versionOptionName?this._version:this[K]}return q}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce((q,_)=>Object.assign(q,_.opts()),{})}error(q,_){if(this._outputConfiguration.outputError(`${q} +`,this._outputConfiguration.writeErr),typeof this._showHelpAfterError==="string")this._outputConfiguration.writeErr(`${this._showHelpAfterError} +`);else if(this._showHelpAfterError)this._outputConfiguration.writeErr(` +`),this.outputHelp({error:!0});let j=_||{},K=j.exitCode||1,Y=j.code||"commander.error";this._exit(K,Y,q)}_parseOptionsEnv(){this.options.forEach((q)=>{if(q.envVar&&q.envVar in M8.env){let _=q.attributeName();if(this.getOptionValue(_)===void 0||["default","config","env"].includes(this.getOptionValueSource(_)))if(q.required||q.optional)this.emit(`optionEnv:${q.name()}`,M8.env[q.envVar]);else this.emit(`optionEnv:${q.name()}`)}})}_parseOptionsImplied(){let q=new Cw(this.options),_=(j)=>{return this.getOptionValue(j)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(j))};this.options.filter((j)=>j.implied!==void 0&&_(j.attributeName())&&q.valueFromOption(this.getOptionValue(j.attributeName()),j)).forEach((j)=>{Object.keys(j.implied).filter((K)=>!_(K)).forEach((K)=>{this.setOptionValueWithSource(K,j.implied[K],"implied")})})}missingArgument(q){let _=`error: missing required argument '${q}'`;this.error(_,{code:"commander.missingArgument"})}optionMissingArgument(q){let _=`error: option '${q.flags}' argument missing`;this.error(_,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(q){let _=`error: required option '${q.flags}' not specified`;this.error(_,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(q,_){let j=(f)=>{let P=f.attributeName(),$=this.getOptionValue(P),O=this.options.find((v)=>v.negate&&P===v.attributeName()),w=this.options.find((v)=>!v.negate&&P===v.attributeName());if(O&&(O.presetArg===void 0&&$===!1||O.presetArg!==void 0&&$===O.presetArg))return O;return w||f},K=(f)=>{let P=j(f),$=P.attributeName();if(this.getOptionValueSource($)==="env")return`environment variable '${P.envVar}'`;return`option '${P.flags}'`},Y=`error: ${K(q)} cannot be used with ${K(_)}`;this.error(Y,{code:"commander.conflictingOption"})}unknownOption(q){if(this._allowUnknownOption)return;let _="";if(q.startsWith("--")&&this._showSuggestionAfterError){let K=[],Y=this;do{let f=Y.createHelp().visibleOptions(Y).filter((P)=>P.long).map((P)=>P.long);K=K.concat(f),Y=Y.parent}while(Y&&!Y._enablePositionalOptions);_=U9(q,K)}let j=`error: unknown option '${q}'${_}`;this.error(j,{code:"commander.unknownOption"})}_excessArguments(q){if(this._allowExcessArguments)return;let _=this.registeredArguments.length,j=_===1?"":"s",Y=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${_} argument${j} but got ${q.length}.`;this.error(Y,{code:"commander.excessArguments"})}unknownCommand(){let q=this.args[0],_="";if(this._showSuggestionAfterError){let K=[];this.createHelp().visibleCommands(this).forEach((Y)=>{if(K.push(Y.name()),Y.alias())K.push(Y.alias())}),_=U9(q,K)}let j=`error: unknown command '${q}'${_}`;this.error(j,{code:"commander.unknownCommand"})}version(q,_,j){if(q===void 0)return this._version;this._version=q,_=_||"-V, --version",j=j||"output the version number";let K=this.createOption(_,j);return this._versionOptionName=K.attributeName(),this._registerOption(K),this.on("option:"+K.name(),()=>{this._outputConfiguration.writeOut(`${q} +`),this._exit(0,"commander.version",q)}),this}description(q,_){if(q===void 0&&_===void 0)return this._description;if(this._description=q,_)this._argsDescription=_;return this}summary(q){if(q===void 0)return this._summary;return this._summary=q,this}alias(q){if(q===void 0)return this._aliases[0];let _=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler)_=this.commands[this.commands.length-1];if(q===_._name)throw new Error("Command alias can't be the same as its name");let j=this.parent?._findCommand(q);if(j){let K=[j.name()].concat(j.aliases()).join("|");throw new Error(`cannot add alias '${q}' to command '${this.name()}' as already have command '${K}'`)}return _._aliases.push(q),this}aliases(q){if(q===void 0)return this._aliases;return q.forEach((_)=>this.alias(_)),this}usage(q){if(q===void 0){if(this._usage)return this._usage;let _=this.registeredArguments.map((j)=>{return uw(j)});return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?_:[]).join(" ")}return this._usage=q,this}name(q){if(q===void 0)return this._name;return this._name=q,this}helpGroup(q){if(q===void 0)return this._helpGroupHeading??"";return this._helpGroupHeading=q,this}commandsGroup(q){if(q===void 0)return this._defaultCommandGroup??"";return this._defaultCommandGroup=q,this}optionsGroup(q){if(q===void 0)return this._defaultOptionGroup??"";return this._defaultOptionGroup=q,this}_initOptionGroup(q){if(this._defaultOptionGroup&&!q.helpGroupHeading)q.helpGroup(this._defaultOptionGroup)}_initCommandGroup(q){if(this._defaultCommandGroup&&!q.helpGroup())q.helpGroup(this._defaultCommandGroup)}nameFromFilename(q){return this._name=Vq.basename(q,Vq.extname(q)),this}executableDir(q){if(q===void 0)return this._executableDir;return this._executableDir=q,this}helpInformation(q){let _=this.createHelp(),j=this._getOutputContext(q);_.prepareContext({error:j.error,helpWidth:j.helpWidth,outputHasColors:j.hasColors});let K=_.formatHelp(this,_);if(j.hasColors)return K;return this._outputConfiguration.stripColor(K)}_getOutputContext(q){q=q||{};let _=!!q.error,j,K,Y;if(_)j=(P)=>this._outputConfiguration.writeErr(P),K=this._outputConfiguration.getErrHasColors(),Y=this._outputConfiguration.getErrHelpWidth();else j=(P)=>this._outputConfiguration.writeOut(P),K=this._outputConfiguration.getOutHasColors(),Y=this._outputConfiguration.getOutHelpWidth();return{error:_,write:(P)=>{if(!K)P=this._outputConfiguration.stripColor(P);return j(P)},hasColors:K,helpWidth:Y}}outputHelp(q){let _;if(typeof q==="function")_=q,q=void 0;let j=this._getOutputContext(q),K={error:j.error,write:j.write,command:this};this._getCommandAndAncestors().reverse().forEach((f)=>f.emit("beforeAllHelp",K)),this.emit("beforeHelp",K);let Y=this.helpInformation({error:j.error});if(_){if(Y=_(Y),typeof Y!=="string"&&!Buffer.isBuffer(Y))throw new Error("outputHelp callback must return a string or a Buffer")}if(j.write(Y),this._getHelpOption()?.long)this.emit(this._getHelpOption().long);this.emit("afterHelp",K),this._getCommandAndAncestors().forEach((f)=>f.emit("afterAllHelp",K))}helpOption(q,_){if(typeof q==="boolean"){if(q){if(this._helpOption===null)this._helpOption=void 0;if(this._defaultOptionGroup)this._initOptionGroup(this._getHelpOption())}else this._helpOption=null;return this}if(this._helpOption=this.createOption(q??"-h, --help",_??"display help for command"),q||_)this._initOptionGroup(this._helpOption);return this}_getHelpOption(){if(this._helpOption===void 0)this.helpOption(void 0,void 0);return this._helpOption}addHelpOption(q){return this._helpOption=q,this._initOptionGroup(q),this}help(q){this.outputHelp(q);let _=Number(M8.exitCode??0);if(_===0&&q&&typeof q!=="function"&&q.error)_=1;this._exit(_,"commander.help","(outputHelp)")}addHelpText(q,_){let j=["beforeAll","before","after","afterAll"];if(!j.includes(q))throw new Error(`Unexpected value for position to addHelpText. +Expecting one of '${j.join("', '")}'`);let K=`${q}Help`;return this.on(K,(Y)=>{let f;if(typeof _==="function")f=_({error:Y.error,command:Y.command});else f=_;if(f)Y.write(`${f} +`)}),this}_outputHelpIfRequested(q){let _=this._getHelpOption();if(_&&q.find((K)=>_.is(K)))this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)")}}function s9(q){return q.map((_)=>{if(!_.startsWith("--inspect"))return _;let j,K="127.0.0.1",Y="9229",f;if((f=_.match(/^(--inspect(-brk)?)$/))!==null)j=f[1];else if((f=_.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null)if(j=f[1],/^\d+$/.test(f[3]))Y=f[3];else K=f[3];else if((f=_.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null)j=f[1],K=f[3],Y=f[4];if(j&&Y!=="0")return`${j}=${K}:${parseInt(Y)+1}`;return _})}function B7(){if(M8.env.NO_COLOR||M8.env.FORCE_COLOR==="0"||M8.env.FORCE_COLOR==="false")return!1;if(M8.env.FORCE_COLOR||M8.env.CLICOLOR_FORCE!==void 0)return!0;return}Vw.Command=t7;Vw.useColor=B7});var j5=q8((Ew)=>{var{Argument:q5}=V3(),{Command:e7}=Q9(),{CommanderError:bw,InvalidArgumentError:_5}=hK(),{Help:Sw}=r7(),{Option:K5}=i7();Ew.program=new e7;Ew.createCommand=(q)=>new e7(q);Ew.createOption=(q,_)=>new K5(q,_);Ew.createArgument=(q,_)=>new q5(q,_);Ew.Command=e7;Ew.Option=K5;Ew.Argument=q5;Ew.Help=Sw;Ew.CommanderError=bw;Ew.InvalidArgumentError=_5;Ew.InvalidOptionArgumentError=_5});var h6=q8((jO)=>{jO.__esModule=!0;jO.extend=H5;jO.indexOf=Uw;jO.escapeExpression=sw;jO.isEmpty=Qw;jO.createFrame=qO;jO.blockParams=_O;jO.appendContextPath=KO;var Bw={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`","=":"="},tw=/[&<>"'`=]/g,ew=/[&<>"'`=]/;function Fw(q){return Bw[q]}function H5(q){for(var _=1;_{Z5.__esModule=!0;var s7=["description","fileName","lineNumber","endLineNumber","message","name","number","stack"];function Q7(q,_){var j=_&&_.loc,K=void 0,Y=void 0,f=void 0,P=void 0;if(j)K=j.start.line,Y=j.end.line,f=j.start.column,P=j.end.column,q+=" - "+K+":"+f;var $=Error.prototype.constructor.call(this,q);for(var O=0;O{X5.__esModule=!0;var q4=h6();X5.default=function(q){q.registerHelper("blockHelperMissing",function(_,j){var{inverse:K,fn:Y}=j;if(_===!0)return Y(this);else if(_===!1||_==null)return K(this);else if(q4.isArray(_))if(_.length>0){if(j.ids)j.ids=[j.name];return q.helpers.each(_,j)}else return K(this);else{if(j.data&&j.ids){var f=q4.createFrame(j.data);f.contextPath=q4.appendContextPath(j.data.contextPath,j.name),j={data:f}}return Y(_,j)}})};A5.exports=X5.default});var D5=q8((u5,h5)=>{u5.__esModule=!0;function AO(q){return q&&q.__esModule?q:{default:q}}var DK=h6(),GO=a6(),uO=AO(GO);u5.default=function(q){q.registerHelper("each",function(_,j){if(!j)throw new uO.default("Must pass iterator to #each");var{fn:K,inverse:Y}=j,f=0,P="",$=void 0,O=void 0;if(j.data&&j.ids)O=DK.appendContextPath(j.data.contextPath,j.ids[0])+".";if(DK.isFunction(_))_=_.call(this);if(j.data)$=DK.createFrame(j.data);function w(k,H,X){if($){if($.key=k,$.index=H,$.first=H===0,$.last=!!X,O)$.contextPath=O+k}P=P+K(_[k],{data:$,blockParams:DK.blockParams([_[k],k],[O+k,null])})}if(_&&typeof _==="object")if(DK.isArray(_)){for(var v=_.length;f{C5.__esModule=!0;function CO(q){return q&&q.__esModule?q:{default:q}}var VO=a6(),MO=CO(VO);C5.default=function(q){q.registerHelper("helperMissing",function(){if(arguments.length===1)return;else throw new MO.default('Missing helper: "'+arguments[arguments.length-1].name+'"')})};V5.exports=C5.default});var R5=q8((S5,E5)=>{S5.__esModule=!0;function SO(q){return q&&q.__esModule?q:{default:q}}var N5=h6(),EO=a6(),b5=SO(EO);S5.default=function(q){q.registerHelper("if",function(_,j){if(arguments.length!=2)throw new b5.default("#if requires exactly one argument");if(N5.isFunction(_))_=_.call(this);if(!j.hash.includeZero&&!_||N5.isEmpty(_))return j.inverse(this);else return j.fn(this)}),q.registerHelper("unless",function(_,j){if(arguments.length!=2)throw new b5.default("#unless requires exactly one argument");return q.helpers.if.call(this,_,{fn:j.inverse,inverse:j.fn,hash:j.hash})})};E5.exports=S5.default});var g5=q8((m5,I5)=>{m5.__esModule=!0;m5.default=function(q){q.registerHelper("log",function(){var _=[void 0],j=arguments[arguments.length-1];for(var K=0;K{y5.__esModule=!0;y5.default=function(q){q.registerHelper("lookup",function(_,j,K){if(!_)return _;return K.lookupProperty(_,j)})};d5.exports=y5.default});var n5=q8((L5,l5)=>{L5.__esModule=!0;function pO(q){return q&&q.__esModule?q:{default:q}}var CK=h6(),LO=a6(),lO=pO(LO);L5.default=function(q){q.registerHelper("with",function(_,j){if(arguments.length!=2)throw new lO.default("#with requires exactly one argument");if(CK.isFunction(_))_=_.call(this);var K=j.fn;if(!CK.isEmpty(_)){var Y=j.data;if(j.data&&j.ids)Y=CK.createFrame(j.data),Y.contextPath=CK.appendContextPath(j.data.contextPath,j.ids[0]);return K(_,{data:Y,blockParams:CK.blockParams([_],[Y&&Y.contextPath])})}else return j.inverse(this)})};l5.exports=L5.default});var _4=q8((Pv)=>{Pv.__esModule=!0;Pv.registerDefaultHelpers=Kv;Pv.moveHelperToHooks=jv;function sq(q){return q&&q.__esModule?q:{default:q}}var cO=G5(),rO=sq(cO),iO=D5(),oO=sq(iO),aO=M5(),BO=sq(aO),tO=R5(),eO=sq(tO),FO=g5(),UO=sq(FO),sO=p5(),QO=sq(sO),qv=n5(),_v=sq(qv);function Kv(q){rO.default(q),oO.default(q),BO.default(q),eO.default(q),UO.default(q),QO.default(q),_v.default(q)}function jv(q,_,j){if(q.helpers[_]){if(q.hooks[_]=q.helpers[_],!j)delete q.helpers[_]}}});var r5=q8((x5,c5)=>{x5.__esModule=!0;var wv=h6();x5.default=function(q){q.registerDecorator("inline",function(_,j,K,Y){var f=_;if(!j.partials)j.partials={},f=function(P,$){var O=K.partials;K.partials=wv.extend({},O,j.partials);var w=_(P,$);return K.partials=O,w};return j.partials[Y.args[0]]=Y.fn,f})};c5.exports=x5.default});var i5=q8((Tv)=>{Tv.__esModule=!0;Tv.registerDefaultDecorators=Hv;function zv(q){return q&&q.__esModule?q:{default:q}}var Wv=r5(),Jv=zv(Wv);function Hv(q){Jv.default(q)}});var K4=q8((o5,a5)=>{o5.__esModule=!0;var Xv=h6(),N_={methodMap:["debug","info","warn","error"],level:"info",lookupLevel:function q(_){if(typeof _==="string"){var j=Xv.indexOf(N_.methodMap,_.toLowerCase());if(j>=0)_=j;else _=parseInt(_,10)}return _},log:function q(_){if(_=N_.lookupLevel(_),typeof console!=="undefined"&&N_.lookupLevel(N_.level)<=_){var j=N_.methodMap[_];if(!console[j])j="log";for(var K=arguments.length,Y=Array(K>1?K-1:0),f=1;f{Dv.__esModule=!0;Dv.createNewLookupObject=hv;var uv=h6();function hv(){for(var q=arguments.length,_=Array(q),j=0;j{Iv.__esModule=!0;Iv.createProtoAccessControl=Sv;Iv.resultIsAllowed=Ev;Iv.resetLoggedProperties=mv;function Mv(q){return q&&q.__esModule?q:{default:q}}var t5=B5(),Nv=K4(),bv=Mv(Nv),N3=Object.create(null);function Sv(q){var _=Object.create(null);_.constructor=!1,_.__defineGetter__=!1,_.__defineSetter__=!1,_.__lookupGetter__=!1;var j=Object.create(null);return j.__proto__=!1,{properties:{whitelist:t5.createNewLookupObject(j,q.allowedProtoProperties),defaultValue:q.allowProtoPropertiesByDefault},methods:{whitelist:t5.createNewLookupObject(_,q.allowedProtoMethods),defaultValue:q.allowProtoMethodsByDefault}}}function Ev(q,_,j){if(typeof q==="function")return e5(_.methods,j);else return e5(_.properties,j)}function e5(q,_){if(q.whitelist[_]!==void 0)return q.whitelist[_]===!0;if(q.defaultValue!==void 0)return q.defaultValue;return Rv(_),!1}function Rv(q){if(N3[q]!==!0)N3[q]=!0,bv.default.log("error",'Handlebars: Access has been denied to resolve the property "'+q+`" because it is not an "own property" of its parent. +You can add a runtime option to disable the check or this warning: +See https://handlebarsjs.com/api-reference/runtime-options.html#options-to-control-prototype-access for details`)}function mv(){Object.keys(N3).forEach(function(q){delete N3[q]})}});var S3=q8((tv)=>{tv.__esModule=!0;tv.HandlebarsEnvironment=f4;function F5(q){return q&&q.__esModule?q:{default:q}}var Qq=h6(),Lv=a6(),P4=F5(Lv),lv=_4(),nv=i5(),xv=K4(),b3=F5(xv),cv=j4(),rv="4.7.8";tv.VERSION=rv;var iv=8;tv.COMPILER_REVISION=iv;var ov=7;tv.LAST_COMPATIBLE_COMPILER_REVISION=ov;var av={1:"<= 1.0.rc.2",2:"== 1.0.0-rc.3",3:"== 1.0.0-rc.4",4:"== 1.x.x",5:"== 2.0.0-alpha.x",6:">= 2.0.0-beta.1",7:">= 4.0.0 <4.3.0",8:">= 4.3.0"};tv.REVISION_CHANGES=av;var Y4="[object Object]";function f4(q,_,j){this.helpers=q||{},this.partials=_||{},this.decorators=j||{},lv.registerDefaultHelpers(this),nv.registerDefaultDecorators(this)}f4.prototype={constructor:f4,logger:b3.default,log:b3.default.log,registerHelper:function q(_,j){if(Qq.toString.call(_)===Y4){if(j)throw new P4.default("Arg not supported with multiple helpers");Qq.extend(this.helpers,_)}else this.helpers[_]=j},unregisterHelper:function q(_){delete this.helpers[_]},registerPartial:function q(_,j){if(Qq.toString.call(_)===Y4)Qq.extend(this.partials,_);else{if(typeof j==="undefined")throw new P4.default('Attempting to register a partial called "'+_+'" as undefined');this.partials[_]=j}},unregisterPartial:function q(_){delete this.partials[_]},registerDecorator:function q(_,j){if(Qq.toString.call(_)===Y4){if(j)throw new P4.default("Arg not supported with multiple decorators");Qq.extend(this.decorators,_)}else this.decorators[_]=j},unregisterDecorator:function q(_){delete this.decorators[_]},resetLoggedPropertyAccesses:function q(){cv.resetLoggedProperties()}};var Bv=b3.default.log;tv.log=Bv;tv.createFrame=Qq.createFrame;tv.logger=b3.default});var Q5=q8((U5,s5)=>{U5.__esModule=!0;function $4(q){this.string=q}$4.prototype.toString=$4.prototype.toHTML=function(){return""+this.string};U5.default=$4;s5.exports=U5.default});var qj=q8(($z)=>{$z.__esModule=!0;$z.wrapHelper=fz;function fz(q,_){if(typeof q!=="function")return q;var j=function K(){var Y=arguments[arguments.length-1];return arguments[arguments.length-1]=_(Y),q.apply(this,arguments)};return j}});var Yj=q8((hz)=>{hz.__esModule=!0;hz.checkRevision=Tz;hz.template=Zz;hz.wrapProgram=E3;hz.resolvePartial=kz;hz.invokePartial=Xz;hz.noop=jj;function vz(q){return q&&q.__esModule?q:{default:q}}function zz(q){if(q&&q.__esModule)return q;else{var _={};if(q!=null){for(var j in q)if(Object.prototype.hasOwnProperty.call(q,j))_[j]=q[j]}return _.default=q,_}}var Wz=h6(),Mq=zz(Wz),Jz=a6(),Nq=vz(Jz),bq=S3(),_j=_4(),Hz=qj(),Kj=j4();function Tz(q){var _=q&&q[0]||1,j=bq.COMPILER_REVISION;if(_>=bq.LAST_COMPATIBLE_COMPILER_REVISION&&_<=bq.COMPILER_REVISION)return;if(_{fj.__esModule=!0;fj.default=function(q){(function(){if(typeof globalThis==="object")return;Object.prototype.__defineGetter__("__magic__",function(){return this}),__magic__.globalThis=__magic__,delete Object.prototype.__magic__})();var _=globalThis.Handlebars;q.noConflict=function(){if(globalThis.Handlebars===q)globalThis.Handlebars=_;return q}};$j.exports=fj.default});var Jj=q8((zj,Wj)=>{zj.__esModule=!0;function v4(q){return q&&q.__esModule?q:{default:q}}function z4(q){if(q&&q.__esModule)return q;else{var _={};if(q!=null){for(var j in q)if(Object.prototype.hasOwnProperty.call(q,j))_[j]=q[j]}return _.default=q,_}}var mz=S3(),wj=z4(mz),Iz=Q5(),gz=v4(Iz),yz=a6(),dz=v4(yz),pz=h6(),O4=z4(pz),Lz=Yj(),Oj=z4(Lz),lz=w4(),nz=v4(lz);function vj(){var q=new wj.HandlebarsEnvironment;return O4.extend(q,wj),q.SafeString=gz.default,q.Exception=dz.default,q.Utils=O4,q.escapeExpression=O4.escapeExpression,q.VM=Oj,q.template=function(_){return Oj.template(_,q)},q}var VK=vj();VK.create=vj;nz.default(VK);VK.default=VK;zj.default=VK;Wj.exports=zj.default});var W4=q8((Tj,Zj)=>{Tj.__esModule=!0;var Hj={helpers:{helperExpression:function q(_){return _.type==="SubExpression"||(_.type==="MustacheStatement"||_.type==="BlockStatement")&&!!(_.params&&_.params.length||_.hash)},scopedId:function q(_){return/^\.|this\b/.test(_.original)},simpleId:function q(_){return _.parts.length===1&&!Hj.helpers.scopedId(_)&&!_.depth}}};Tj.default=Hj;Zj.exports=Tj.default});var Aj=q8((kj,Xj)=>{kj.__esModule=!0;var oz=function(){var q={trace:function K(){},yy:{},symbols_:{error:2,root:3,program:4,EOF:5,program_repetition0:6,statement:7,mustache:8,block:9,rawBlock:10,partial:11,partialBlock:12,content:13,COMMENT:14,CONTENT:15,openRawBlock:16,rawBlock_repetition0:17,END_RAW_BLOCK:18,OPEN_RAW_BLOCK:19,helperName:20,openRawBlock_repetition0:21,openRawBlock_option0:22,CLOSE_RAW_BLOCK:23,openBlock:24,block_option0:25,closeBlock:26,openInverse:27,block_option1:28,OPEN_BLOCK:29,openBlock_repetition0:30,openBlock_option0:31,openBlock_option1:32,CLOSE:33,OPEN_INVERSE:34,openInverse_repetition0:35,openInverse_option0:36,openInverse_option1:37,openInverseChain:38,OPEN_INVERSE_CHAIN:39,openInverseChain_repetition0:40,openInverseChain_option0:41,openInverseChain_option1:42,inverseAndProgram:43,INVERSE:44,inverseChain:45,inverseChain_option0:46,OPEN_ENDBLOCK:47,OPEN:48,mustache_repetition0:49,mustache_option0:50,OPEN_UNESCAPED:51,mustache_repetition1:52,mustache_option1:53,CLOSE_UNESCAPED:54,OPEN_PARTIAL:55,partialName:56,partial_repetition0:57,partial_option0:58,openPartialBlock:59,OPEN_PARTIAL_BLOCK:60,openPartialBlock_repetition0:61,openPartialBlock_option0:62,param:63,sexpr:64,OPEN_SEXPR:65,sexpr_repetition0:66,sexpr_option0:67,CLOSE_SEXPR:68,hash:69,hash_repetition_plus0:70,hashSegment:71,ID:72,EQUALS:73,blockParams:74,OPEN_BLOCK_PARAMS:75,blockParams_repetition_plus0:76,CLOSE_BLOCK_PARAMS:77,path:78,dataName:79,STRING:80,NUMBER:81,BOOLEAN:82,UNDEFINED:83,NULL:84,DATA:85,pathSegments:86,SEP:87,$accept:0,$end:1},terminals_:{2:"error",5:"EOF",14:"COMMENT",15:"CONTENT",18:"END_RAW_BLOCK",19:"OPEN_RAW_BLOCK",23:"CLOSE_RAW_BLOCK",29:"OPEN_BLOCK",33:"CLOSE",34:"OPEN_INVERSE",39:"OPEN_INVERSE_CHAIN",44:"INVERSE",47:"OPEN_ENDBLOCK",48:"OPEN",51:"OPEN_UNESCAPED",54:"CLOSE_UNESCAPED",55:"OPEN_PARTIAL",60:"OPEN_PARTIAL_BLOCK",65:"OPEN_SEXPR",68:"CLOSE_SEXPR",72:"ID",73:"EQUALS",75:"OPEN_BLOCK_PARAMS",77:"CLOSE_BLOCK_PARAMS",80:"STRING",81:"NUMBER",82:"BOOLEAN",83:"UNDEFINED",84:"NULL",85:"DATA",87:"SEP"},productions_:[0,[3,2],[4,1],[7,1],[7,1],[7,1],[7,1],[7,1],[7,1],[7,1],[13,1],[10,3],[16,5],[9,4],[9,4],[24,6],[27,6],[38,6],[43,2],[45,3],[45,1],[26,3],[8,5],[8,5],[11,5],[12,3],[59,5],[63,1],[63,1],[64,5],[69,1],[71,3],[74,3],[20,1],[20,1],[20,1],[20,1],[20,1],[20,1],[20,1],[56,1],[56,1],[79,2],[78,1],[86,3],[86,1],[6,0],[6,2],[17,0],[17,2],[21,0],[21,2],[22,0],[22,1],[25,0],[25,1],[28,0],[28,1],[30,0],[30,2],[31,0],[31,1],[32,0],[32,1],[35,0],[35,2],[36,0],[36,1],[37,0],[37,1],[40,0],[40,2],[41,0],[41,1],[42,0],[42,1],[46,0],[46,1],[49,0],[49,2],[50,0],[50,1],[52,0],[52,2],[53,0],[53,1],[57,0],[57,2],[58,0],[58,1],[61,0],[61,2],[62,0],[62,1],[66,0],[66,2],[67,0],[67,1],[70,1],[70,2],[76,1],[76,2]],performAction:function K(Y,f,P,$,O,w,v){var z=w.length-1;switch(O){case 1:return w[z-1];case 2:this.$=$.prepareProgram(w[z]);break;case 3:this.$=w[z];break;case 4:this.$=w[z];break;case 5:this.$=w[z];break;case 6:this.$=w[z];break;case 7:this.$=w[z];break;case 8:this.$=w[z];break;case 9:this.$={type:"CommentStatement",value:$.stripComment(w[z]),strip:$.stripFlags(w[z],w[z]),loc:$.locInfo(this._$)};break;case 10:this.$={type:"ContentStatement",original:w[z],value:w[z],loc:$.locInfo(this._$)};break;case 11:this.$=$.prepareRawBlock(w[z-2],w[z-1],w[z],this._$);break;case 12:this.$={path:w[z-3],params:w[z-2],hash:w[z-1]};break;case 13:this.$=$.prepareBlock(w[z-3],w[z-2],w[z-1],w[z],!1,this._$);break;case 14:this.$=$.prepareBlock(w[z-3],w[z-2],w[z-1],w[z],!0,this._$);break;case 15:this.$={open:w[z-5],path:w[z-4],params:w[z-3],hash:w[z-2],blockParams:w[z-1],strip:$.stripFlags(w[z-5],w[z])};break;case 16:this.$={path:w[z-4],params:w[z-3],hash:w[z-2],blockParams:w[z-1],strip:$.stripFlags(w[z-5],w[z])};break;case 17:this.$={path:w[z-4],params:w[z-3],hash:w[z-2],blockParams:w[z-1],strip:$.stripFlags(w[z-5],w[z])};break;case 18:this.$={strip:$.stripFlags(w[z-1],w[z-1]),program:w[z]};break;case 19:var W=$.prepareBlock(w[z-2],w[z-1],w[z],w[z],!1,this._$),J=$.prepareProgram([W],w[z-1].loc);J.chained=!0,this.$={strip:w[z-2].strip,program:J,chain:!0};break;case 20:this.$=w[z];break;case 21:this.$={path:w[z-1],strip:$.stripFlags(w[z-2],w[z])};break;case 22:this.$=$.prepareMustache(w[z-3],w[z-2],w[z-1],w[z-4],$.stripFlags(w[z-4],w[z]),this._$);break;case 23:this.$=$.prepareMustache(w[z-3],w[z-2],w[z-1],w[z-4],$.stripFlags(w[z-4],w[z]),this._$);break;case 24:this.$={type:"PartialStatement",name:w[z-3],params:w[z-2],hash:w[z-1],indent:"",strip:$.stripFlags(w[z-4],w[z]),loc:$.locInfo(this._$)};break;case 25:this.$=$.preparePartialBlock(w[z-2],w[z-1],w[z],this._$);break;case 26:this.$={path:w[z-3],params:w[z-2],hash:w[z-1],strip:$.stripFlags(w[z-4],w[z])};break;case 27:this.$=w[z];break;case 28:this.$=w[z];break;case 29:this.$={type:"SubExpression",path:w[z-3],params:w[z-2],hash:w[z-1],loc:$.locInfo(this._$)};break;case 30:this.$={type:"Hash",pairs:w[z],loc:$.locInfo(this._$)};break;case 31:this.$={type:"HashPair",key:$.id(w[z-2]),value:w[z],loc:$.locInfo(this._$)};break;case 32:this.$=$.id(w[z-1]);break;case 33:this.$=w[z];break;case 34:this.$=w[z];break;case 35:this.$={type:"StringLiteral",value:w[z],original:w[z],loc:$.locInfo(this._$)};break;case 36:this.$={type:"NumberLiteral",value:Number(w[z]),original:Number(w[z]),loc:$.locInfo(this._$)};break;case 37:this.$={type:"BooleanLiteral",value:w[z]==="true",original:w[z]==="true",loc:$.locInfo(this._$)};break;case 38:this.$={type:"UndefinedLiteral",original:void 0,value:void 0,loc:$.locInfo(this._$)};break;case 39:this.$={type:"NullLiteral",original:null,value:null,loc:$.locInfo(this._$)};break;case 40:this.$=w[z];break;case 41:this.$=w[z];break;case 42:this.$=$.preparePath(!0,w[z],this._$);break;case 43:this.$=$.preparePath(!1,w[z],this._$);break;case 44:w[z-2].push({part:$.id(w[z]),original:w[z],separator:w[z-1]}),this.$=w[z-2];break;case 45:this.$=[{part:$.id(w[z]),original:w[z]}];break;case 46:this.$=[];break;case 47:w[z-1].push(w[z]);break;case 48:this.$=[];break;case 49:w[z-1].push(w[z]);break;case 50:this.$=[];break;case 51:w[z-1].push(w[z]);break;case 58:this.$=[];break;case 59:w[z-1].push(w[z]);break;case 64:this.$=[];break;case 65:w[z-1].push(w[z]);break;case 70:this.$=[];break;case 71:w[z-1].push(w[z]);break;case 78:this.$=[];break;case 79:w[z-1].push(w[z]);break;case 82:this.$=[];break;case 83:w[z-1].push(w[z]);break;case 86:this.$=[];break;case 87:w[z-1].push(w[z]);break;case 90:this.$=[];break;case 91:w[z-1].push(w[z]);break;case 94:this.$=[];break;case 95:w[z-1].push(w[z]);break;case 98:this.$=[w[z]];break;case 99:w[z-1].push(w[z]);break;case 100:this.$=[w[z]];break;case 101:w[z-1].push(w[z]);break}},table:[{3:1,4:2,5:[2,46],6:3,14:[2,46],15:[2,46],19:[2,46],29:[2,46],34:[2,46],48:[2,46],51:[2,46],55:[2,46],60:[2,46]},{1:[3]},{5:[1,4]},{5:[2,2],7:5,8:6,9:7,10:8,11:9,12:10,13:11,14:[1,12],15:[1,20],16:17,19:[1,23],24:15,27:16,29:[1,21],34:[1,22],39:[2,2],44:[2,2],47:[2,2],48:[1,13],51:[1,14],55:[1,18],59:19,60:[1,24]},{1:[2,1]},{5:[2,47],14:[2,47],15:[2,47],19:[2,47],29:[2,47],34:[2,47],39:[2,47],44:[2,47],47:[2,47],48:[2,47],51:[2,47],55:[2,47],60:[2,47]},{5:[2,3],14:[2,3],15:[2,3],19:[2,3],29:[2,3],34:[2,3],39:[2,3],44:[2,3],47:[2,3],48:[2,3],51:[2,3],55:[2,3],60:[2,3]},{5:[2,4],14:[2,4],15:[2,4],19:[2,4],29:[2,4],34:[2,4],39:[2,4],44:[2,4],47:[2,4],48:[2,4],51:[2,4],55:[2,4],60:[2,4]},{5:[2,5],14:[2,5],15:[2,5],19:[2,5],29:[2,5],34:[2,5],39:[2,5],44:[2,5],47:[2,5],48:[2,5],51:[2,5],55:[2,5],60:[2,5]},{5:[2,6],14:[2,6],15:[2,6],19:[2,6],29:[2,6],34:[2,6],39:[2,6],44:[2,6],47:[2,6],48:[2,6],51:[2,6],55:[2,6],60:[2,6]},{5:[2,7],14:[2,7],15:[2,7],19:[2,7],29:[2,7],34:[2,7],39:[2,7],44:[2,7],47:[2,7],48:[2,7],51:[2,7],55:[2,7],60:[2,7]},{5:[2,8],14:[2,8],15:[2,8],19:[2,8],29:[2,8],34:[2,8],39:[2,8],44:[2,8],47:[2,8],48:[2,8],51:[2,8],55:[2,8],60:[2,8]},{5:[2,9],14:[2,9],15:[2,9],19:[2,9],29:[2,9],34:[2,9],39:[2,9],44:[2,9],47:[2,9],48:[2,9],51:[2,9],55:[2,9],60:[2,9]},{20:25,72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{20:36,72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{4:37,6:3,14:[2,46],15:[2,46],19:[2,46],29:[2,46],34:[2,46],39:[2,46],44:[2,46],47:[2,46],48:[2,46],51:[2,46],55:[2,46],60:[2,46]},{4:38,6:3,14:[2,46],15:[2,46],19:[2,46],29:[2,46],34:[2,46],44:[2,46],47:[2,46],48:[2,46],51:[2,46],55:[2,46],60:[2,46]},{15:[2,48],17:39,18:[2,48]},{20:41,56:40,64:42,65:[1,43],72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{4:44,6:3,14:[2,46],15:[2,46],19:[2,46],29:[2,46],34:[2,46],47:[2,46],48:[2,46],51:[2,46],55:[2,46],60:[2,46]},{5:[2,10],14:[2,10],15:[2,10],18:[2,10],19:[2,10],29:[2,10],34:[2,10],39:[2,10],44:[2,10],47:[2,10],48:[2,10],51:[2,10],55:[2,10],60:[2,10]},{20:45,72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{20:46,72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{20:47,72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{20:41,56:48,64:42,65:[1,43],72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{33:[2,78],49:49,65:[2,78],72:[2,78],80:[2,78],81:[2,78],82:[2,78],83:[2,78],84:[2,78],85:[2,78]},{23:[2,33],33:[2,33],54:[2,33],65:[2,33],68:[2,33],72:[2,33],75:[2,33],80:[2,33],81:[2,33],82:[2,33],83:[2,33],84:[2,33],85:[2,33]},{23:[2,34],33:[2,34],54:[2,34],65:[2,34],68:[2,34],72:[2,34],75:[2,34],80:[2,34],81:[2,34],82:[2,34],83:[2,34],84:[2,34],85:[2,34]},{23:[2,35],33:[2,35],54:[2,35],65:[2,35],68:[2,35],72:[2,35],75:[2,35],80:[2,35],81:[2,35],82:[2,35],83:[2,35],84:[2,35],85:[2,35]},{23:[2,36],33:[2,36],54:[2,36],65:[2,36],68:[2,36],72:[2,36],75:[2,36],80:[2,36],81:[2,36],82:[2,36],83:[2,36],84:[2,36],85:[2,36]},{23:[2,37],33:[2,37],54:[2,37],65:[2,37],68:[2,37],72:[2,37],75:[2,37],80:[2,37],81:[2,37],82:[2,37],83:[2,37],84:[2,37],85:[2,37]},{23:[2,38],33:[2,38],54:[2,38],65:[2,38],68:[2,38],72:[2,38],75:[2,38],80:[2,38],81:[2,38],82:[2,38],83:[2,38],84:[2,38],85:[2,38]},{23:[2,39],33:[2,39],54:[2,39],65:[2,39],68:[2,39],72:[2,39],75:[2,39],80:[2,39],81:[2,39],82:[2,39],83:[2,39],84:[2,39],85:[2,39]},{23:[2,43],33:[2,43],54:[2,43],65:[2,43],68:[2,43],72:[2,43],75:[2,43],80:[2,43],81:[2,43],82:[2,43],83:[2,43],84:[2,43],85:[2,43],87:[1,50]},{72:[1,35],86:51},{23:[2,45],33:[2,45],54:[2,45],65:[2,45],68:[2,45],72:[2,45],75:[2,45],80:[2,45],81:[2,45],82:[2,45],83:[2,45],84:[2,45],85:[2,45],87:[2,45]},{52:52,54:[2,82],65:[2,82],72:[2,82],80:[2,82],81:[2,82],82:[2,82],83:[2,82],84:[2,82],85:[2,82]},{25:53,38:55,39:[1,57],43:56,44:[1,58],45:54,47:[2,54]},{28:59,43:60,44:[1,58],47:[2,56]},{13:62,15:[1,20],18:[1,61]},{33:[2,86],57:63,65:[2,86],72:[2,86],80:[2,86],81:[2,86],82:[2,86],83:[2,86],84:[2,86],85:[2,86]},{33:[2,40],65:[2,40],72:[2,40],80:[2,40],81:[2,40],82:[2,40],83:[2,40],84:[2,40],85:[2,40]},{33:[2,41],65:[2,41],72:[2,41],80:[2,41],81:[2,41],82:[2,41],83:[2,41],84:[2,41],85:[2,41]},{20:64,72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{26:65,47:[1,66]},{30:67,33:[2,58],65:[2,58],72:[2,58],75:[2,58],80:[2,58],81:[2,58],82:[2,58],83:[2,58],84:[2,58],85:[2,58]},{33:[2,64],35:68,65:[2,64],72:[2,64],75:[2,64],80:[2,64],81:[2,64],82:[2,64],83:[2,64],84:[2,64],85:[2,64]},{21:69,23:[2,50],65:[2,50],72:[2,50],80:[2,50],81:[2,50],82:[2,50],83:[2,50],84:[2,50],85:[2,50]},{33:[2,90],61:70,65:[2,90],72:[2,90],80:[2,90],81:[2,90],82:[2,90],83:[2,90],84:[2,90],85:[2,90]},{20:74,33:[2,80],50:71,63:72,64:75,65:[1,43],69:73,70:76,71:77,72:[1,78],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{72:[1,79]},{23:[2,42],33:[2,42],54:[2,42],65:[2,42],68:[2,42],72:[2,42],75:[2,42],80:[2,42],81:[2,42],82:[2,42],83:[2,42],84:[2,42],85:[2,42],87:[1,50]},{20:74,53:80,54:[2,84],63:81,64:75,65:[1,43],69:82,70:76,71:77,72:[1,78],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{26:83,47:[1,66]},{47:[2,55]},{4:84,6:3,14:[2,46],15:[2,46],19:[2,46],29:[2,46],34:[2,46],39:[2,46],44:[2,46],47:[2,46],48:[2,46],51:[2,46],55:[2,46],60:[2,46]},{47:[2,20]},{20:85,72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{4:86,6:3,14:[2,46],15:[2,46],19:[2,46],29:[2,46],34:[2,46],47:[2,46],48:[2,46],51:[2,46],55:[2,46],60:[2,46]},{26:87,47:[1,66]},{47:[2,57]},{5:[2,11],14:[2,11],15:[2,11],19:[2,11],29:[2,11],34:[2,11],39:[2,11],44:[2,11],47:[2,11],48:[2,11],51:[2,11],55:[2,11],60:[2,11]},{15:[2,49],18:[2,49]},{20:74,33:[2,88],58:88,63:89,64:75,65:[1,43],69:90,70:76,71:77,72:[1,78],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{65:[2,94],66:91,68:[2,94],72:[2,94],80:[2,94],81:[2,94],82:[2,94],83:[2,94],84:[2,94],85:[2,94]},{5:[2,25],14:[2,25],15:[2,25],19:[2,25],29:[2,25],34:[2,25],39:[2,25],44:[2,25],47:[2,25],48:[2,25],51:[2,25],55:[2,25],60:[2,25]},{20:92,72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{20:74,31:93,33:[2,60],63:94,64:75,65:[1,43],69:95,70:76,71:77,72:[1,78],75:[2,60],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{20:74,33:[2,66],36:96,63:97,64:75,65:[1,43],69:98,70:76,71:77,72:[1,78],75:[2,66],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{20:74,22:99,23:[2,52],63:100,64:75,65:[1,43],69:101,70:76,71:77,72:[1,78],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{20:74,33:[2,92],62:102,63:103,64:75,65:[1,43],69:104,70:76,71:77,72:[1,78],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{33:[1,105]},{33:[2,79],65:[2,79],72:[2,79],80:[2,79],81:[2,79],82:[2,79],83:[2,79],84:[2,79],85:[2,79]},{33:[2,81]},{23:[2,27],33:[2,27],54:[2,27],65:[2,27],68:[2,27],72:[2,27],75:[2,27],80:[2,27],81:[2,27],82:[2,27],83:[2,27],84:[2,27],85:[2,27]},{23:[2,28],33:[2,28],54:[2,28],65:[2,28],68:[2,28],72:[2,28],75:[2,28],80:[2,28],81:[2,28],82:[2,28],83:[2,28],84:[2,28],85:[2,28]},{23:[2,30],33:[2,30],54:[2,30],68:[2,30],71:106,72:[1,107],75:[2,30]},{23:[2,98],33:[2,98],54:[2,98],68:[2,98],72:[2,98],75:[2,98]},{23:[2,45],33:[2,45],54:[2,45],65:[2,45],68:[2,45],72:[2,45],73:[1,108],75:[2,45],80:[2,45],81:[2,45],82:[2,45],83:[2,45],84:[2,45],85:[2,45],87:[2,45]},{23:[2,44],33:[2,44],54:[2,44],65:[2,44],68:[2,44],72:[2,44],75:[2,44],80:[2,44],81:[2,44],82:[2,44],83:[2,44],84:[2,44],85:[2,44],87:[2,44]},{54:[1,109]},{54:[2,83],65:[2,83],72:[2,83],80:[2,83],81:[2,83],82:[2,83],83:[2,83],84:[2,83],85:[2,83]},{54:[2,85]},{5:[2,13],14:[2,13],15:[2,13],19:[2,13],29:[2,13],34:[2,13],39:[2,13],44:[2,13],47:[2,13],48:[2,13],51:[2,13],55:[2,13],60:[2,13]},{38:55,39:[1,57],43:56,44:[1,58],45:111,46:110,47:[2,76]},{33:[2,70],40:112,65:[2,70],72:[2,70],75:[2,70],80:[2,70],81:[2,70],82:[2,70],83:[2,70],84:[2,70],85:[2,70]},{47:[2,18]},{5:[2,14],14:[2,14],15:[2,14],19:[2,14],29:[2,14],34:[2,14],39:[2,14],44:[2,14],47:[2,14],48:[2,14],51:[2,14],55:[2,14],60:[2,14]},{33:[1,113]},{33:[2,87],65:[2,87],72:[2,87],80:[2,87],81:[2,87],82:[2,87],83:[2,87],84:[2,87],85:[2,87]},{33:[2,89]},{20:74,63:115,64:75,65:[1,43],67:114,68:[2,96],69:116,70:76,71:77,72:[1,78],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{33:[1,117]},{32:118,33:[2,62],74:119,75:[1,120]},{33:[2,59],65:[2,59],72:[2,59],75:[2,59],80:[2,59],81:[2,59],82:[2,59],83:[2,59],84:[2,59],85:[2,59]},{33:[2,61],75:[2,61]},{33:[2,68],37:121,74:122,75:[1,120]},{33:[2,65],65:[2,65],72:[2,65],75:[2,65],80:[2,65],81:[2,65],82:[2,65],83:[2,65],84:[2,65],85:[2,65]},{33:[2,67],75:[2,67]},{23:[1,123]},{23:[2,51],65:[2,51],72:[2,51],80:[2,51],81:[2,51],82:[2,51],83:[2,51],84:[2,51],85:[2,51]},{23:[2,53]},{33:[1,124]},{33:[2,91],65:[2,91],72:[2,91],80:[2,91],81:[2,91],82:[2,91],83:[2,91],84:[2,91],85:[2,91]},{33:[2,93]},{5:[2,22],14:[2,22],15:[2,22],19:[2,22],29:[2,22],34:[2,22],39:[2,22],44:[2,22],47:[2,22],48:[2,22],51:[2,22],55:[2,22],60:[2,22]},{23:[2,99],33:[2,99],54:[2,99],68:[2,99],72:[2,99],75:[2,99]},{73:[1,108]},{20:74,63:125,64:75,65:[1,43],72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{5:[2,23],14:[2,23],15:[2,23],19:[2,23],29:[2,23],34:[2,23],39:[2,23],44:[2,23],47:[2,23],48:[2,23],51:[2,23],55:[2,23],60:[2,23]},{47:[2,19]},{47:[2,77]},{20:74,33:[2,72],41:126,63:127,64:75,65:[1,43],69:128,70:76,71:77,72:[1,78],75:[2,72],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{5:[2,24],14:[2,24],15:[2,24],19:[2,24],29:[2,24],34:[2,24],39:[2,24],44:[2,24],47:[2,24],48:[2,24],51:[2,24],55:[2,24],60:[2,24]},{68:[1,129]},{65:[2,95],68:[2,95],72:[2,95],80:[2,95],81:[2,95],82:[2,95],83:[2,95],84:[2,95],85:[2,95]},{68:[2,97]},{5:[2,21],14:[2,21],15:[2,21],19:[2,21],29:[2,21],34:[2,21],39:[2,21],44:[2,21],47:[2,21],48:[2,21],51:[2,21],55:[2,21],60:[2,21]},{33:[1,130]},{33:[2,63]},{72:[1,132],76:131},{33:[1,133]},{33:[2,69]},{15:[2,12],18:[2,12]},{14:[2,26],15:[2,26],19:[2,26],29:[2,26],34:[2,26],47:[2,26],48:[2,26],51:[2,26],55:[2,26],60:[2,26]},{23:[2,31],33:[2,31],54:[2,31],68:[2,31],72:[2,31],75:[2,31]},{33:[2,74],42:134,74:135,75:[1,120]},{33:[2,71],65:[2,71],72:[2,71],75:[2,71],80:[2,71],81:[2,71],82:[2,71],83:[2,71],84:[2,71],85:[2,71]},{33:[2,73],75:[2,73]},{23:[2,29],33:[2,29],54:[2,29],65:[2,29],68:[2,29],72:[2,29],75:[2,29],80:[2,29],81:[2,29],82:[2,29],83:[2,29],84:[2,29],85:[2,29]},{14:[2,15],15:[2,15],19:[2,15],29:[2,15],34:[2,15],39:[2,15],44:[2,15],47:[2,15],48:[2,15],51:[2,15],55:[2,15],60:[2,15]},{72:[1,137],77:[1,136]},{72:[2,100],77:[2,100]},{14:[2,16],15:[2,16],19:[2,16],29:[2,16],34:[2,16],44:[2,16],47:[2,16],48:[2,16],51:[2,16],55:[2,16],60:[2,16]},{33:[1,138]},{33:[2,75]},{33:[2,32]},{72:[2,101],77:[2,101]},{14:[2,17],15:[2,17],19:[2,17],29:[2,17],34:[2,17],39:[2,17],44:[2,17],47:[2,17],48:[2,17],51:[2,17],55:[2,17],60:[2,17]}],defaultActions:{4:[2,1],54:[2,55],56:[2,20],60:[2,57],73:[2,81],82:[2,85],86:[2,18],90:[2,89],101:[2,53],104:[2,93],110:[2,19],111:[2,77],116:[2,97],119:[2,63],122:[2,69],135:[2,75],136:[2,32]},parseError:function K(Y,f){throw new Error(Y)},parse:function K(Y){var f=this,P=[0],$=[null],O=[],w=this.table,v="",z=0,W=0,J=0,k=2,H=1;if(this.lexer.setInput(Y),this.lexer.yy=this.yy,this.yy.lexer=this.lexer,this.yy.parser=this,typeof this.lexer.yylloc=="undefined")this.lexer.yylloc={};var X=this.lexer.yylloc;O.push(X);var A=this.lexer.options&&this.lexer.options.ranges;if(typeof this.yy.parseError==="function")this.parseError=this.yy.parseError;function G(B){P.length=P.length-2*B,$.length=$.length-B,O.length=O.length-B}function h(){var B=f.lexer.lex()||1;if(typeof B!=="number")B=f.symbols_[B]||B;return B}var V,E,M,b,g,y,c={},L,m,I,d;while(!0){if(M=P[P.length-1],this.defaultActions[M])b=this.defaultActions[M];else{if(V===null||typeof V=="undefined")V=h();b=w[M]&&w[M][V]}if(typeof b==="undefined"||!b.length||!b[0]){var r="";if(!J){d=[];for(L in w[M])if(this.terminals_[L]&&L>2)d.push("'"+this.terminals_[L]+"'");if(this.lexer.showPosition)r="Parse error on line "+(z+1)+`: +`+this.lexer.showPosition()+` +Expecting `+d.join(", ")+", got '"+(this.terminals_[V]||V)+"'";else r="Parse error on line "+(z+1)+": Unexpected "+(V==1?"end of input":"'"+(this.terminals_[V]||V)+"'");this.parseError(r,{text:this.lexer.match,token:this.terminals_[V]||V,line:this.lexer.yylineno,loc:X,expected:d})}}if(b[0]instanceof Array&&b.length>1)throw new Error("Parse Error: multiple actions possible at state: "+M+", token: "+V);switch(b[0]){case 1:if(P.push(V),$.push(this.lexer.yytext),O.push(this.lexer.yylloc),P.push(b[1]),V=null,!E){if(W=this.lexer.yyleng,v=this.lexer.yytext,z=this.lexer.yylineno,X=this.lexer.yylloc,J>0)J--}else V=E,E=null;break;case 2:if(m=this.productions_[b[1]][1],c.$=$[$.length-m],c._$={first_line:O[O.length-(m||1)].first_line,last_line:O[O.length-1].last_line,first_column:O[O.length-(m||1)].first_column,last_column:O[O.length-1].last_column},A)c._$.range=[O[O.length-(m||1)].range[0],O[O.length-1].range[1]];if(y=this.performAction.call(c,v,W,z,this.yy,b[1],$,O),typeof y!=="undefined")return y;if(m)P=P.slice(0,-1*m*2),$=$.slice(0,-1*m),O=O.slice(0,-1*m);P.push(this.productions_[b[1]][0]),$.push(c.$),O.push(c._$),I=w[P[P.length-2]][P[P.length-1]],P.push(I);break;case 3:return!0}}return!0}},_=function(){var K={EOF:1,parseError:function Y(f,P){if(this.yy.parser)this.yy.parser.parseError(f,P);else throw new Error(f)},setInput:function Y(f){if(this._input=f,this._more=this._less=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges)this.yylloc.range=[0,0];return this.offset=0,this},input:function Y(){var f=this._input[0];this.yytext+=f,this.yyleng++,this.offset++,this.match+=f,this.matched+=f;var P=f.match(/(?:\r\n?|\n).*/g);if(P)this.yylineno++,this.yylloc.last_line++;else this.yylloc.last_column++;if(this.options.ranges)this.yylloc.range[1]++;return this._input=this._input.slice(1),f},unput:function Y(f){var P=f.length,$=f.split(/(?:\r\n?|\n)/g);this._input=f+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-P-1),this.offset-=P;var O=this.match.split(/(?:\r\n?|\n)/g);if(this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),$.length-1)this.yylineno-=$.length-1;var w=this.yylloc.range;if(this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:$?($.length===O.length?this.yylloc.first_column:0)+O[O.length-$.length].length-$[0].length:this.yylloc.first_column-P},this.options.ranges)this.yylloc.range=[w[0],w[0]+this.yyleng-P];return this},more:function Y(){return this._more=!0,this},less:function Y(f){this.unput(this.match.slice(f))},pastInput:function Y(){var f=this.matched.substr(0,this.matched.length-this.match.length);return(f.length>20?"...":"")+f.substr(-20).replace(/\n/g,"")},upcomingInput:function Y(){var f=this.match;if(f.length<20)f+=this._input.substr(0,20-f.length);return(f.substr(0,20)+(f.length>20?"...":"")).replace(/\n/g,"")},showPosition:function Y(){var f=this.pastInput(),P=new Array(f.length+1).join("-");return f+this.upcomingInput()+` +`+P+"^"},next:function Y(){if(this.done)return this.EOF;if(!this._input)this.done=!0;var f,P,$,O,w,v;if(!this._more)this.yytext="",this.match="";var z=this._currentRules();for(var W=0;WP[0].length)){if(P=$,O=W,!this.options.flex)break}if(P){if(v=P[0].match(/(?:\r\n?|\n).*/g),v)this.yylineno+=v.length;if(this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:v?v[v.length-1].length-v[v.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+P[0].length},this.yytext+=P[0],this.match+=P[0],this.matches=P,this.yyleng=this.yytext.length,this.options.ranges)this.yylloc.range=[this.offset,this.offset+=this.yyleng];if(this._more=!1,this._input=this._input.slice(P[0].length),this.matched+=P[0],f=this.performAction.call(this,this.yy,this,z[O],this.conditionStack[this.conditionStack.length-1]),this.done&&this._input)this.done=!1;if(f)return f;else return}if(this._input==="")return this.EOF;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text. +`+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function Y(){var f=this.next();if(typeof f!=="undefined")return f;else return this.lex()},begin:function Y(f){this.conditionStack.push(f)},popState:function Y(){return this.conditionStack.pop()},_currentRules:function Y(){return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules},topState:function Y(){return this.conditionStack[this.conditionStack.length-2]},pushState:function Y(f){this.begin(f)}};return K.options={},K.performAction=function Y(f,P,$,O){function w(z,W){return P.yytext=P.yytext.substring(z,P.yyleng-W+z)}var v=O;switch($){case 0:if(P.yytext.slice(-2)==="\\\\")w(0,1),this.begin("mu");else if(P.yytext.slice(-1)==="\\")w(0,1),this.begin("emu");else this.begin("mu");if(P.yytext)return 15;break;case 1:return 15;case 2:return this.popState(),15;break;case 3:return this.begin("raw"),15;break;case 4:if(this.popState(),this.conditionStack[this.conditionStack.length-1]==="raw")return 15;else return w(5,9),"END_RAW_BLOCK";break;case 5:return 15;case 6:return this.popState(),14;break;case 7:return 65;case 8:return 68;case 9:return 19;case 10:return this.popState(),this.begin("raw"),23;break;case 11:return 55;case 12:return 60;case 13:return 29;case 14:return 47;case 15:return this.popState(),44;break;case 16:return this.popState(),44;break;case 17:return 34;case 18:return 39;case 19:return 51;case 20:return 48;case 21:this.unput(P.yytext),this.popState(),this.begin("com");break;case 22:return this.popState(),14;break;case 23:return 48;case 24:return 73;case 25:return 72;case 26:return 72;case 27:return 87;case 28:break;case 29:return this.popState(),54;break;case 30:return this.popState(),33;break;case 31:return P.yytext=w(1,2).replace(/\\"/g,'"'),80;break;case 32:return P.yytext=w(1,2).replace(/\\'/g,"'"),80;break;case 33:return 85;case 34:return 82;case 35:return 82;case 36:return 83;case 37:return 84;case 38:return 81;case 39:return 75;case 40:return 77;case 41:return 72;case 42:return P.yytext=P.yytext.replace(/\\([\\\]])/g,"$1"),72;break;case 43:return"INVALID";case 44:return 5}},K.rules=[/^(?:[^\x00]*?(?=(\{\{)))/,/^(?:[^\x00]+)/,/^(?:[^\x00]{2,}?(?=(\{\{|\\\{\{|\\\\\{\{|$)))/,/^(?:\{\{\{\{(?=[^/]))/,/^(?:\{\{\{\{\/[^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=[=}\s\/.])\}\}\}\})/,/^(?:[^\x00]+?(?=(\{\{\{\{)))/,/^(?:[\s\S]*?--(~)?\}\})/,/^(?:\()/,/^(?:\))/,/^(?:\{\{\{\{)/,/^(?:\}\}\}\})/,/^(?:\{\{(~)?>)/,/^(?:\{\{(~)?#>)/,/^(?:\{\{(~)?#\*?)/,/^(?:\{\{(~)?\/)/,/^(?:\{\{(~)?\^\s*(~)?\}\})/,/^(?:\{\{(~)?\s*else\s*(~)?\}\})/,/^(?:\{\{(~)?\^)/,/^(?:\{\{(~)?\s*else\b)/,/^(?:\{\{(~)?\{)/,/^(?:\{\{(~)?&)/,/^(?:\{\{(~)?!--)/,/^(?:\{\{(~)?![\s\S]*?\}\})/,/^(?:\{\{(~)?\*?)/,/^(?:=)/,/^(?:\.\.)/,/^(?:\.(?=([=~}\s\/.)|])))/,/^(?:[\/.])/,/^(?:\s+)/,/^(?:\}(~)?\}\})/,/^(?:(~)?\}\})/,/^(?:"(\\["]|[^"])*")/,/^(?:'(\\[']|[^'])*')/,/^(?:@)/,/^(?:true(?=([~}\s)])))/,/^(?:false(?=([~}\s)])))/,/^(?:undefined(?=([~}\s)])))/,/^(?:null(?=([~}\s)])))/,/^(?:-?[0-9]+(?:\.[0-9]+)?(?=([~}\s)])))/,/^(?:as\s+\|)/,/^(?:\|)/,/^(?:([^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=([=~}\s\/.)|]))))/,/^(?:\[(\\\]|[^\]])*\])/,/^(?:.)/,/^(?:$)/],K.conditions={mu:{rules:[7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44],inclusive:!1},emu:{rules:[2],inclusive:!1},com:{rules:[6],inclusive:!1},raw:{rules:[3,4,5],inclusive:!1},INITIAL:{rules:[0,1,44],inclusive:!0}},K}();q.lexer=_;function j(){this.yy={}}return j.prototype=q,q.Parser=j,new j}();kj.default=oz;Xj.exports=kj.default});var I3=q8((hj,Dj)=>{hj.__esModule=!0;function tz(q){return q&&q.__esModule?q:{default:q}}var ez=a6(),J4=tz(ez);function R3(){this.parents=[]}R3.prototype={constructor:R3,mutating:!1,acceptKey:function q(_,j){var K=this.accept(_[j]);if(this.mutating){if(K&&!R3.prototype[K.type])throw new J4.default('Unexpected node type "'+K.type+'" found when accepting '+j+" on "+_.type);_[j]=K}},acceptRequired:function q(_,j){if(this.acceptKey(_,j),!_[j])throw new J4.default(_.type+" requires "+j)},acceptArray:function q(_){for(var j=0,K=_.length;j{Cj.__esModule=!0;function sz(q){return q&&q.__esModule?q:{default:q}}var Qz=I3(),qW=sz(Qz);function Tq(){var q=arguments.length<=0||arguments[0]===void 0?{}:arguments[0];this.options=q}Tq.prototype=new qW.default;Tq.prototype.Program=function(q){var _=!this.options.ignoreStandalone,j=!this.isRootSeen;this.isRootSeen=!0;var K=q.body;for(var Y=0,f=K.length;Y{TW.__esModule=!0;TW.SourceLocation=YW;TW.id=fW;TW.stripFlags=$W;TW.stripComment=wW;TW.preparePath=OW;TW.prepareMustache=vW;TW.prepareRawBlock=zW;TW.prepareBlock=WW;TW.prepareProgram=JW;TW.preparePartialBlock=HW;function jW(q){return q&&q.__esModule?q:{default:q}}var PW=a6(),Z4=jW(PW);function k4(q,_){if(_=_.path?_.path.original:_,q.path.original!==_){var j={loc:q.path.loc};throw new Z4.default(q.path.original+" doesn't match "+_,j)}}function YW(q,_){this.source=q,this.start={line:_.first_line,column:_.first_column},this.end={line:_.last_line,column:_.last_column}}function fW(q){if(/^\[.*\]$/.test(q))return q.substring(1,q.length-1);else return q}function $W(q,_){return{open:q.charAt(2)==="~",close:_.charAt(_.length-3)==="~"}}function wW(q){return q.replace(/^\{\{~?!-?-?/,"").replace(/-?-?~?\}\}$/,"")}function OW(q,_,j){j=this.locInfo(j);var K=q?"@":"",Y=[],f=0;for(var P=0,$=_.length;P<$;P++){var O=_[P].part,w=_[P].original!==O;if(K+=(_[P].separator||"")+O,!w&&(O===".."||O==="."||O==="this")){if(Y.length>0)throw new Z4.default("Invalid path: "+K,{loc:j});else if(O==="..")f++}else Y.push(O)}return{type:"PathExpression",data:q,depth:f,parts:Y,original:K,loc:j}}function vW(q,_,j,K,Y,f){var P=K.charAt(3)||K.charAt(2),$=P!=="{"&&P!=="&",O=/\*/.test(K);return{type:O?"Decorator":"MustacheStatement",path:q,params:_,hash:j,escaped:$,strip:Y,loc:this.locInfo(f)}}function zW(q,_,j,K){k4(q,j),K=this.locInfo(K);var Y={type:"Program",body:_,strip:{},loc:K};return{type:"BlockStatement",path:q.path,params:q.params,hash:q.hash,program:Y,openStrip:{},inverseStrip:{},closeStrip:{},loc:K}}function WW(q,_,j,K,Y,f){if(K&&K.path)k4(q,K);var P=/\*/.test(q.open);_.blockParams=q.blockParams;var $=void 0,O=void 0;if(j){if(P)throw new Z4.default("Unexpected inverse block on decorator",j);if(j.chain)j.program.body[0].closeStrip=K.strip;O=j.strip,$=j.program}if(Y)Y=$,$=_,_=Y;return{type:P?"DecoratorBlock":"BlockStatement",path:q.path,params:q.params,hash:q.hash,program:_,inverse:$,openStrip:q.strip,inverseStrip:O,closeStrip:K&&K.strip,loc:this.locInfo(f)}}function JW(q,_){if(!_&&q.length){var j=q[0].loc,K=q[q.length-1].loc;if(j&&K)_={source:j.source,start:{line:j.start.line,column:j.start.column},end:{line:K.end.line,column:K.end.column}}}return{type:"Program",body:q,strip:{},loc:_}}function HW(q,_,j,K){return k4(q,j),{type:"PartialBlockStatement",name:q.path,params:q.params,hash:q.hash,program:_,openStrip:q.strip,closeStrip:j&&j.strip,loc:this.locInfo(K)}}});var Ej=q8((yW)=>{yW.__esModule=!0;yW.parseWithoutProcessing=Sj;yW.parse=gW;function NW(q){if(q&&q.__esModule)return q;else{var _={};if(q!=null){for(var j in q)if(Object.prototype.hasOwnProperty.call(q,j))_[j]=q[j]}return _.default=q,_}}function bj(q){return q&&q.__esModule?q:{default:q}}var bW=Aj(),X4=bj(bW),SW=Mj(),EW=bj(SW),RW=Nj(),mW=NW(RW),IW=h6();yW.parser=X4.default;var g3={};IW.extend(g3,mW);function Sj(q,_){if(q.type==="Program")return q;X4.default.yy=g3,g3.locInfo=function(K){return new g3.SourceLocation(_&&_.srcName,K)};var j=X4.default.parse(q);return j}function gW(q,_){var j=Sj(q,_),K=new EW.default(_);return K.accept(j)}});var gj=q8((oW)=>{oW.__esModule=!0;oW.Compiler=A4;oW.precompile=rW;oW.compile=iW;function mj(q){return q&&q.__esModule?q:{default:q}}var nW=a6(),NK=mj(nW),bK=h6(),xW=W4(),MK=mj(xW),cW=[].slice;function A4(){}A4.prototype={compiler:A4,equals:function q(_){var j=this.opcodes.length;if(_.opcodes.length!==j)return!1;for(var K=0;K1)throw new NK.default("Unsupported number of partial arguments: "+K.length,_);else if(!K.length)if(this.options.explicitPartialContext)this.opcode("pushLiteral","undefined");else K.push({type:"PathExpression",parts:[],depth:0});var Y=_.name.original,f=_.name.type==="SubExpression";if(f)this.accept(_.name);this.setupFullMustacheParams(_,j,void 0,!0);var P=_.indent||"";if(this.options.preventIndent&&P)this.opcode("appendContent",P),P="";this.opcode("invokePartial",f,Y,P),this.opcode("append")},PartialBlockStatement:function q(_){this.PartialStatement(_)},MustacheStatement:function q(_){if(this.SubExpression(_),_.escaped&&!this.options.noEscape)this.opcode("appendEscaped");else this.opcode("append")},Decorator:function q(_){this.DecoratorBlock(_)},ContentStatement:function q(_){if(_.value)this.opcode("appendContent",_.value)},CommentStatement:function q(){},SubExpression:function q(_){Rj(_);var j=this.classifySexpr(_);if(j==="simple")this.simpleSexpr(_);else if(j==="helper")this.helperSexpr(_);else this.ambiguousSexpr(_)},ambiguousSexpr:function q(_,j,K){var Y=_.path,f=Y.parts[0],P=j!=null||K!=null;this.opcode("getContext",Y.depth),this.opcode("pushProgram",j),this.opcode("pushProgram",K),Y.strict=!0,this.accept(Y),this.opcode("invokeAmbiguous",f,P)},simpleSexpr:function q(_){var j=_.path;j.strict=!0,this.accept(j),this.opcode("resolvePossibleLambda")},helperSexpr:function q(_,j,K){var Y=this.setupFullMustacheParams(_,j,K),f=_.path,P=f.parts[0];if(this.options.knownHelpers[P])this.opcode("invokeKnownHelper",Y.length,P);else if(this.options.knownHelpersOnly)throw new NK.default("You specified knownHelpersOnly, but used the unknown helper "+P,_);else f.strict=!0,f.falsy=!0,this.accept(f),this.opcode("invokeHelper",Y.length,f.original,MK.default.helpers.simpleId(f))},PathExpression:function q(_){this.addDepth(_.depth),this.opcode("getContext",_.depth);var j=_.parts[0],K=MK.default.helpers.scopedId(_),Y=!_.depth&&!K&&this.blockParamIndex(j);if(Y)this.opcode("lookupBlockParam",Y,_.parts);else if(!j)this.opcode("pushContext");else if(_.data)this.options.data=!0,this.opcode("lookupData",_.depth,_.parts,_.strict);else this.opcode("lookupOnContext",_.parts,_.falsy,_.strict,K)},StringLiteral:function q(_){this.opcode("pushString",_.value)},NumberLiteral:function q(_){this.opcode("pushLiteral",_.value)},BooleanLiteral:function q(_){this.opcode("pushLiteral",_.value)},UndefinedLiteral:function q(){this.opcode("pushLiteral","undefined")},NullLiteral:function q(){this.opcode("pushLiteral","null")},Hash:function q(_){var j=_.pairs,K=0,Y=j.length;this.opcode("pushHash");for(;K=0)return[j,f]}}};function rW(q,_,j){if(q==null||typeof q!=="string"&&q.type!=="Program")throw new NK.default("You must pass a string or Handlebars AST to Handlebars.precompile. You passed "+q);if(_=_||{},!("data"in _))_.data=!0;if(_.compat)_.useDepths=!0;var K=j.parse(q,_),Y=new j.Compiler().compile(K,_);return new j.JavaScriptCompiler().compile(Y,_)}function iW(q,_,j){if(_===void 0)_={};if(q==null||typeof q!=="string"&&q.type!=="Program")throw new NK.default("You must pass a string or Handlebars AST to Handlebars.compile. You passed "+q);if(_=bK.extend({},_),!("data"in _))_.data=!0;if(_.compat)_.useDepths=!0;var K=void 0;function Y(){var P=j.parse(q,_),$=new j.Compiler().compile(P,_),O=new j.JavaScriptCompiler().compile($,_,void 0,!0);return j.template(O)}function f(P,$){if(!K)K=Y();return K.call(this,P,$)}return f._setup=function(P){if(!K)K=Y();return K._setup(P)},f._child=function(P,$,O,w){if(!K)K=Y();return K._child(P,$,O,w)},f}function Ij(q,_){if(q===_)return!0;if(bK.isArray(q)&&bK.isArray(_)&&q.length===_.length){for(var j=0;j{var yj="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");FW.encode=function(q){if(0<=q&&q{var pj=dj(),G4=5,Lj=1<>1;return _?-j:j}_J.encode=function q(_){var j="",K,Y=QW(_);do{if(K=Y&lj,Y>>>=G4,Y>0)K|=nj;j+=pj.encode(K)}while(Y>0);return j};_J.decode=function q(_,j,K){var Y=_.length,f=0,P=0,$,O;do{if(j>=Y)throw new Error("Expected more digits in base 64 VLQ value.");if(O=pj.decode(_.charCodeAt(j++)),O===-1)throw new Error("Invalid base64 digit: "+_.charAt(j-1));$=!!(O&nj),O&=lj,f=f+(O<{function PJ(q,_,j){if(_ in q)return q[_];else if(arguments.length===3)return j;else throw new Error('"'+_+'" is a required argument.')}HJ.getArg=PJ;var xj=/^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.-]*)(?::(\d+))?(.*)$/,YJ=/^data:.+\,.+$/;function SK(q){var _=q.match(xj);if(!_)return null;return{scheme:_[1],auth:_[2],host:_[3],port:_[4],path:_[5]}}HJ.urlParse=SK;function b_(q){var _="";if(q.scheme)_+=q.scheme+":";if(_+="//",q.auth)_+=q.auth+"@";if(q.host)_+=q.host;if(q.port)_+=":"+q.port;if(q.path)_+=q.path;return _}HJ.urlGenerate=b_;function h4(q){var _=q,j=SK(q);if(j){if(!j.path)return q;_=j.path}var K=HJ.isAbsolute(_),Y=_.split(/\/+/);for(var f,P=0,$=Y.length-1;$>=0;$--)if(f=Y[$],f===".")Y.splice($,1);else if(f==="..")P++;else if(P>0)if(f==="")Y.splice($+1,P),P=0;else Y.splice($,2),P--;if(_=Y.join("/"),_==="")_=K?"/":".";if(j)return j.path=_,b_(j);return _}HJ.normalize=h4;function cj(q,_){if(q==="")q=".";if(_==="")_=".";var j=SK(_),K=SK(q);if(K)q=K.path||"/";if(j&&!j.scheme){if(K)j.scheme=K.scheme;return b_(j)}if(j||_.match(YJ))return _;if(K&&!K.host&&!K.path)return K.host=_,b_(K);var Y=_.charAt(0)==="/"?_:h4(q.replace(/\/+$/,"")+"/"+_);if(K)return K.path=Y,b_(K);return Y}HJ.join=cj;HJ.isAbsolute=function(q){return q.charAt(0)==="/"||xj.test(q)};function fJ(q,_){if(q==="")q=".";q=q.replace(/\/$/,"");var j=0;while(_.indexOf(q+"/")!==0){var K=q.lastIndexOf("/");if(K<0)return _;if(q=q.slice(0,K),q.match(/^([^\/]+:\/)?\/*$/))return _;++j}return Array(j+1).join("../")+_.substr(q.length+1)}HJ.relative=fJ;var rj=function(){var q=Object.create(null);return!("__proto__"in q)}();function ij(q){return q}function $J(q){if(oj(q))return"$"+q;return q}HJ.toSetString=rj?ij:$J;function wJ(q){if(oj(q))return q.slice(1);return q}HJ.fromSetString=rj?ij:wJ;function oj(q){if(!q)return!1;var _=q.length;if(_<9)return!1;if(q.charCodeAt(_-1)!==95||q.charCodeAt(_-2)!==95||q.charCodeAt(_-3)!==111||q.charCodeAt(_-4)!==116||q.charCodeAt(_-5)!==111||q.charCodeAt(_-6)!==114||q.charCodeAt(_-7)!==112||q.charCodeAt(_-8)!==95||q.charCodeAt(_-9)!==95)return!1;for(var j=_-10;j>=0;j--)if(q.charCodeAt(j)!==36)return!1;return!0}function OJ(q,_,j){var K=S_(q.source,_.source);if(K!==0)return K;if(K=q.originalLine-_.originalLine,K!==0)return K;if(K=q.originalColumn-_.originalColumn,K!==0||j)return K;if(K=q.generatedColumn-_.generatedColumn,K!==0)return K;if(K=q.generatedLine-_.generatedLine,K!==0)return K;return S_(q.name,_.name)}HJ.compareByOriginalPositions=OJ;function vJ(q,_,j){var K=q.generatedLine-_.generatedLine;if(K!==0)return K;if(K=q.generatedColumn-_.generatedColumn,K!==0||j)return K;if(K=S_(q.source,_.source),K!==0)return K;if(K=q.originalLine-_.originalLine,K!==0)return K;if(K=q.originalColumn-_.originalColumn,K!==0)return K;return S_(q.name,_.name)}HJ.compareByGeneratedPositionsDeflated=vJ;function S_(q,_){if(q===_)return 0;if(q===null)return 1;if(_===null)return-1;if(q>_)return 1;return-1}function zJ(q,_){var j=q.generatedLine-_.generatedLine;if(j!==0)return j;if(j=q.generatedColumn-_.generatedColumn,j!==0)return j;if(j=S_(q.source,_.source),j!==0)return j;if(j=q.originalLine-_.originalLine,j!==0)return j;if(j=q.originalColumn-_.originalColumn,j!==0)return j;return S_(q.name,_.name)}HJ.compareByGeneratedPositionsInflated=zJ;function WJ(q){return JSON.parse(q.replace(/^\)]}'[^\n]*\n/,""))}HJ.parseSourceMapInput=WJ;function JJ(q,_,j){if(_=_||"",q){if(q[q.length-1]!=="/"&&_[0]!=="/")q+="/";_=q+_}if(j){var K=SK(j);if(!K)throw new Error("sourceMapURL could not be parsed");if(K.path){var Y=K.path.lastIndexOf("/");if(Y>=0)K.path=K.path.substring(0,Y+1)}_=cj(b_(K),_)}return h4(_)}HJ.computeSourceURL=JJ});var V4=q8((SJ)=>{var D4=E_(),C4=Object.prototype.hasOwnProperty,__=typeof Map!=="undefined";function Sq(){this._array=[],this._set=__?new Map:Object.create(null)}Sq.fromArray=function q(_,j){var K=new Sq;for(var Y=0,f=_.length;Y=0)return j}else{var K=D4.toSetString(_);if(C4.call(this._set,K))return this._set[K]}throw new Error('"'+_+'" is not in the set.')};Sq.prototype.at=function q(_){if(_>=0&&_{var aj=E_();function RJ(q,_){var j=q.generatedLine,K=_.generatedLine,Y=q.generatedColumn,f=_.generatedColumn;return K>j||K==j&&f>=Y||aj.compareByGeneratedPositionsInflated(q,_)<=0}function y3(){this._array=[],this._sorted=!0,this._last={generatedLine:-1,generatedColumn:0}}y3.prototype.unsortedForEach=function q(_,j){this._array.forEach(_,j)};y3.prototype.add=function q(_){if(RJ(this._last,_))this._last=_,this._array.push(_);else this._sorted=!1,this._array.push(_)};y3.prototype.toArray=function q(){if(!this._sorted)this._array.sort(aj.compareByGeneratedPositionsInflated),this._sorted=!0;return this._array};mJ.MappingList=y3});var M4=q8((yJ)=>{var EK=u4(),s8=E_(),d3=V4().ArraySet,gJ=Bj().MappingList;function B6(q){if(!q)q={};this._file=s8.getArg(q,"file",null),this._sourceRoot=s8.getArg(q,"sourceRoot",null),this._skipValidation=s8.getArg(q,"skipValidation",!1),this._sources=new d3,this._names=new d3,this._mappings=new gJ,this._sourcesContents=null}B6.prototype._version=3;B6.fromSourceMap=function q(_){var j=_.sourceRoot,K=new B6({file:_.file,sourceRoot:j});return _.eachMapping(function(Y){var f={generated:{line:Y.generatedLine,column:Y.generatedColumn}};if(Y.source!=null){if(f.source=Y.source,j!=null)f.source=s8.relative(j,f.source);if(f.original={line:Y.originalLine,column:Y.originalColumn},Y.name!=null)f.name=Y.name}K.addMapping(f)}),_.sources.forEach(function(Y){var f=Y;if(j!==null)f=s8.relative(j,Y);if(!K._sources.has(f))K._sources.add(f);var P=_.sourceContentFor(Y);if(P!=null)K.setSourceContent(Y,P)}),K};B6.prototype.addMapping=function q(_){var j=s8.getArg(_,"generated"),K=s8.getArg(_,"original",null),Y=s8.getArg(_,"source",null),f=s8.getArg(_,"name",null);if(!this._skipValidation)this._validateMapping(j,K,Y,f);if(Y!=null){if(Y=String(Y),!this._sources.has(Y))this._sources.add(Y)}if(f!=null){if(f=String(f),!this._names.has(f))this._names.add(f)}this._mappings.add({generatedLine:j.line,generatedColumn:j.column,originalLine:K!=null&&K.line,originalColumn:K!=null&&K.column,source:Y,name:f})};B6.prototype.setSourceContent=function q(_,j){var K=_;if(this._sourceRoot!=null)K=s8.relative(this._sourceRoot,K);if(j!=null){if(!this._sourcesContents)this._sourcesContents=Object.create(null);this._sourcesContents[s8.toSetString(K)]=j}else if(this._sourcesContents){if(delete this._sourcesContents[s8.toSetString(K)],Object.keys(this._sourcesContents).length===0)this._sourcesContents=null}};B6.prototype.applySourceMap=function q(_,j,K){var Y=j;if(j==null){if(_.file==null)throw new Error(`SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, or the source map's "file" property. Both were omitted.`);Y=_.file}var f=this._sourceRoot;if(f!=null)Y=s8.relative(f,Y);var P=new d3,$=new d3;this._mappings.unsortedForEach(function(O){if(O.source===Y&&O.originalLine!=null){var w=_.originalPositionFor({line:O.originalLine,column:O.originalColumn});if(w.source!=null){if(O.source=w.source,K!=null)O.source=s8.join(K,O.source);if(f!=null)O.source=s8.relative(f,O.source);if(O.originalLine=w.line,O.originalColumn=w.column,w.name!=null)O.name=w.name}}var v=O.source;if(v!=null&&!P.has(v))P.add(v);var z=O.name;if(z!=null&&!$.has(z))$.add(z)},this),this._sources=P,this._names=$,_.sources.forEach(function(O){var w=_.sourceContentFor(O);if(w!=null){if(K!=null)O=s8.join(K,O);if(f!=null)O=s8.relative(f,O);this.setSourceContent(O,w)}},this)};B6.prototype._validateMapping=function q(_,j,K,Y){if(j&&typeof j.line!=="number"&&typeof j.column!=="number")throw new Error("original.line and original.column are not numbers -- you probably meant to omit the original mapping entirely and only map the generated position. If so, pass null for the original mapping instead of an object with empty or null values.");if(_&&"line"in _&&"column"in _&&_.line>0&&_.column>=0&&!j&&!K&&!Y)return;else if(_&&"line"in _&&"column"in _&&j&&"line"in j&&"column"in j&&_.line>0&&_.column>=0&&j.line>0&&j.column>=0&&K)return;else throw new Error("Invalid mapping: "+JSON.stringify({generated:_,source:K,original:j,name:Y}))};B6.prototype._serializeMappings=function q(){var _=0,j=1,K=0,Y=0,f=0,P=0,$="",O,w,v,z,W=this._mappings.toArray();for(var J=0,k=W.length;J0){if(!s8.compareByGeneratedPositionsInflated(w,W[J-1]))continue;O+=","}if(O+=EK.encode(w.generatedColumn-_),_=w.generatedColumn,w.source!=null){if(z=this._sources.indexOf(w.source),O+=EK.encode(z-P),P=z,O+=EK.encode(w.originalLine-1-Y),Y=w.originalLine-1,O+=EK.encode(w.originalColumn-K),K=w.originalColumn,w.name!=null)v=this._names.indexOf(w.name),O+=EK.encode(v-f),f=v}$+=O}return $};B6.prototype._generateSourcesContent=function q(_,j){return _.map(function(K){if(!this._sourcesContents)return null;if(j!=null)K=s8.relative(j,K);var Y=s8.toSetString(K);return Object.prototype.hasOwnProperty.call(this._sourcesContents,Y)?this._sourcesContents[Y]:null},this)};B6.prototype.toJSON=function q(){var _={version:this._version,sources:this._sources.toArray(),names:this._names.toArray(),mappings:this._serializeMappings()};if(this._file!=null)_.file=this._file;if(this._sourceRoot!=null)_.sourceRoot=this._sourceRoot;if(this._sourcesContents)_.sourcesContent=this._generateSourcesContent(_.sources,_.sourceRoot);return _};B6.prototype.toString=function q(){return JSON.stringify(this.toJSON())};yJ.SourceMapGenerator=B6});var ej=q8((pJ)=>{pJ.GREATEST_LOWER_BOUND=1;pJ.LEAST_UPPER_BOUND=2;function N4(q,_,j,K,Y,f){var P=Math.floor((_-q)/2)+q,$=Y(j,K[P],!0);if($===0)return P;else if($>0){if(_-P>1)return N4(P,_,j,K,Y,f);if(f==pJ.LEAST_UPPER_BOUND)return _1)return N4(q,P,j,K,Y,f);if(f==pJ.LEAST_UPPER_BOUND)return P;else return q<0?-1:q}}pJ.search=function q(_,j,K,Y){if(j.length===0)return-1;var f=N4(-1,j.length,_,j,K,Y||pJ.GREATEST_LOWER_BOUND);if(f<0)return-1;while(f-1>=0){if(K(j[f],j[f-1],!0)!==0)break;--f}return f}});var Fj=q8((nJ)=>{function S4(q,_,j){var K=q[_];q[_]=q[j],q[j]=K}function lJ(q,_){return Math.round(q+Math.random()*(_-q))}function E4(q,_,j,K){if(j{var K8=E_(),R4=ej(),R_=V4().ArraySet,cJ=u4(),RK=Fj().quickSort;function g8(q,_){var j=q;if(typeof q==="string")j=K8.parseSourceMapInput(q);return j.sections!=null?new jq(j,_):new v6(j,_)}g8.fromSourceMap=function(q,_){return v6.fromSourceMap(q,_)};g8.prototype._version=3;g8.prototype.__generatedMappings=null;Object.defineProperty(g8.prototype,"_generatedMappings",{configurable:!0,enumerable:!0,get:function(){if(!this.__generatedMappings)this._parseMappings(this._mappings,this.sourceRoot);return this.__generatedMappings}});g8.prototype.__originalMappings=null;Object.defineProperty(g8.prototype,"_originalMappings",{configurable:!0,enumerable:!0,get:function(){if(!this.__originalMappings)this._parseMappings(this._mappings,this.sourceRoot);return this.__originalMappings}});g8.prototype._charIsMappingSeparator=function q(_,j){var K=_.charAt(j);return K===";"||K===","};g8.prototype._parseMappings=function q(_,j){throw new Error("Subclasses must implement _parseMappings")};g8.GENERATED_ORDER=1;g8.ORIGINAL_ORDER=2;g8.GREATEST_LOWER_BOUND=1;g8.LEAST_UPPER_BOUND=2;g8.prototype.eachMapping=function q(_,j,K){var Y=j||null,f=K||g8.GENERATED_ORDER,P;switch(f){case g8.GENERATED_ORDER:P=this._generatedMappings;break;case g8.ORIGINAL_ORDER:P=this._originalMappings;break;default:throw new Error("Unknown order of iteration.")}var $=this.sourceRoot;P.map(function(O){var w=O.source===null?null:this._sources.at(O.source);return w=K8.computeSourceURL($,w,this._sourceMapURL),{source:w,generatedLine:O.generatedLine,generatedColumn:O.generatedColumn,originalLine:O.originalLine,originalColumn:O.originalColumn,name:O.name===null?null:this._names.at(O.name)}},this).forEach(_,Y)};g8.prototype.allGeneratedPositionsFor=function q(_){var j=K8.getArg(_,"line"),K={source:K8.getArg(_,"source"),originalLine:j,originalColumn:K8.getArg(_,"column",0)};if(K.source=this._findSourceIndex(K.source),K.source<0)return[];var Y=[],f=this._findMapping(K,this._originalMappings,"originalLine","originalColumn",K8.compareByOriginalPositions,R4.LEAST_UPPER_BOUND);if(f>=0){var P=this._originalMappings[f];if(_.column===void 0){var $=P.originalLine;while(P&&P.originalLine===$)Y.push({line:K8.getArg(P,"generatedLine",null),column:K8.getArg(P,"generatedColumn",null),lastColumn:K8.getArg(P,"lastGeneratedColumn",null)}),P=this._originalMappings[++f]}else{var O=P.originalColumn;while(P&&P.originalLine===j&&P.originalColumn==O)Y.push({line:K8.getArg(P,"generatedLine",null),column:K8.getArg(P,"generatedColumn",null),lastColumn:K8.getArg(P,"lastGeneratedColumn",null)}),P=this._originalMappings[++f]}}return Y};rJ.SourceMapConsumer=g8;function v6(q,_){var j=q;if(typeof q==="string")j=K8.parseSourceMapInput(q);var K=K8.getArg(j,"version"),Y=K8.getArg(j,"sources"),f=K8.getArg(j,"names",[]),P=K8.getArg(j,"sourceRoot",null),$=K8.getArg(j,"sourcesContent",null),O=K8.getArg(j,"mappings"),w=K8.getArg(j,"file",null);if(K!=this._version)throw new Error("Unsupported version: "+K);if(P)P=K8.normalize(P);Y=Y.map(String).map(K8.normalize).map(function(v){return P&&K8.isAbsolute(P)&&K8.isAbsolute(v)?K8.relative(P,v):v}),this._names=R_.fromArray(f.map(String),!0),this._sources=R_.fromArray(Y,!0),this._absoluteSources=this._sources.toArray().map(function(v){return K8.computeSourceURL(P,v,_)}),this.sourceRoot=P,this.sourcesContent=$,this._mappings=O,this._sourceMapURL=_,this.file=w}v6.prototype=Object.create(g8.prototype);v6.prototype.consumer=g8;v6.prototype._findSourceIndex=function(q){var _=q;if(this.sourceRoot!=null)_=K8.relative(this.sourceRoot,_);if(this._sources.has(_))return this._sources.indexOf(_);var j;for(j=0;j1){if(H.source=$+A[1],$+=A[1],H.originalLine=f+A[2],f=H.originalLine,H.originalLine+=1,H.originalColumn=P+A[3],P=H.originalColumn,A.length>4)H.name=O+A[4],O+=A[4]}if(k.push(H),typeof H.originalLine==="number")J.push(H)}RK(k,K8.compareByGeneratedPositionsDeflated),this.__generatedMappings=k,RK(J,K8.compareByOriginalPositions),this.__originalMappings=J};v6.prototype._findMapping=function q(_,j,K,Y,f,P){if(_[K]<=0)throw new TypeError("Line must be greater than or equal to 1, got "+_[K]);if(_[Y]<0)throw new TypeError("Column must be greater than or equal to 0, got "+_[Y]);return R4.search(_,j,f,P)};v6.prototype.computeColumnSpans=function q(){for(var _=0;_=0){var Y=this._generatedMappings[K];if(Y.generatedLine===j.generatedLine){var f=K8.getArg(Y,"source",null);if(f!==null)f=this._sources.at(f),f=K8.computeSourceURL(this.sourceRoot,f,this._sourceMapURL);var P=K8.getArg(Y,"name",null);if(P!==null)P=this._names.at(P);return{source:f,line:K8.getArg(Y,"originalLine",null),column:K8.getArg(Y,"originalColumn",null),name:P}}}return{source:null,line:null,column:null,name:null}};v6.prototype.hasContentsOfAllSources=function q(){if(!this.sourcesContent)return!1;return this.sourcesContent.length>=this._sources.size()&&!this.sourcesContent.some(function(_){return _==null})};v6.prototype.sourceContentFor=function q(_,j){if(!this.sourcesContent)return null;var K=this._findSourceIndex(_);if(K>=0)return this.sourcesContent[K];var Y=_;if(this.sourceRoot!=null)Y=K8.relative(this.sourceRoot,Y);var f;if(this.sourceRoot!=null&&(f=K8.urlParse(this.sourceRoot))){var P=Y.replace(/^file:\/\//,"");if(f.scheme=="file"&&this._sources.has(P))return this.sourcesContent[this._sources.indexOf(P)];if((!f.path||f.path=="/")&&this._sources.has("/"+Y))return this.sourcesContent[this._sources.indexOf("/"+Y)]}if(j)return null;else throw new Error('"'+Y+'" is not in the SourceMap.')};v6.prototype.generatedPositionFor=function q(_){var j=K8.getArg(_,"source");if(j=this._findSourceIndex(j),j<0)return{line:null,column:null,lastColumn:null};var K={source:j,originalLine:K8.getArg(_,"line"),originalColumn:K8.getArg(_,"column")},Y=this._findMapping(K,this._originalMappings,"originalLine","originalColumn",K8.compareByOriginalPositions,K8.getArg(_,"bias",g8.GREATEST_LOWER_BOUND));if(Y>=0){var f=this._originalMappings[Y];if(f.source===K.source)return{line:K8.getArg(f,"generatedLine",null),column:K8.getArg(f,"generatedColumn",null),lastColumn:K8.getArg(f,"lastGeneratedColumn",null)}}return{line:null,column:null,lastColumn:null}};rJ.BasicSourceMapConsumer=v6;function jq(q,_){var j=q;if(typeof q==="string")j=K8.parseSourceMapInput(q);var K=K8.getArg(j,"version"),Y=K8.getArg(j,"sections");if(K!=this._version)throw new Error("Unsupported version: "+K);this._sources=new R_,this._names=new R_;var f={line:-1,column:0};this._sections=Y.map(function(P){if(P.url)throw new Error("Support for url field in sections not implemented.");var $=K8.getArg(P,"offset"),O=K8.getArg($,"line"),w=K8.getArg($,"column");if(O{var BJ=M4().SourceMapGenerator,p3=E_(),tJ=/(\r?\n)/,eJ=10,m_="$$$isSourceNode$$$";function I6(q,_,j,K,Y){if(this.children=[],this.sourceContents={},this.line=q==null?null:q,this.column=_==null?null:_,this.source=j==null?null:j,this.name=Y==null?null:Y,this[m_]=!0,K!=null)this.add(K)}I6.fromStringWithSourceMap=function q(_,j,K){var Y=new I6,f=_.split(tJ),P=0,$=function(){var W=k(),J=k()||"";return W+J;function k(){return P=0;j--)this.prepend(_[j]);else if(_[m_]||typeof _==="string")this.children.unshift(_);else throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+_);return this};I6.prototype.walk=function q(_){var j;for(var K=0,Y=this.children.length;K0){j=[];for(K=0;K{sJ.SourceMapGenerator=M4().SourceMapGenerator;sJ.SourceMapConsumer=sj().SourceMapConsumer;sJ.SourceNode=Qj().SourceNode});var P1=q8((K1,j1)=>{K1.__esModule=!0;var I4=h6(),K_=void 0;try{if(typeof define!=="function"||!define.amd)g4=q1(),K_=g4.SourceNode}catch(q){}var g4;if(!K_)K_=function(q,_,j,K){if(this.src="",K)this.add(K)},K_.prototype={add:function q(_){if(I4.isArray(_))_=_.join("");this.src+=_},prepend:function q(_){if(I4.isArray(_))_=_.join("");this.src=_+this.src},toStringWithSourceMap:function q(){return{code:this.toString()}},toString:function q(){return this.src}};function m4(q,_,j){if(I4.isArray(q)){var K=[];for(var Y=0,f=q.length;Y{w1.__esModule=!0;function $1(q){return q&&q.__esModule?q:{default:q}}var Y1=S3(),PH=a6(),y4=$1(PH),YH=h6(),fH=P1(),f1=$1(fH);function I_(q){this.value=q}function g_(){}g_.prototype={nameLookup:function q(_,j){return this.internalNameLookup(_,j)},depthedLookup:function q(_){return[this.aliasable("container.lookup"),"(depths, ",JSON.stringify(_),")"]},compilerInfo:function q(){var _=Y1.COMPILER_REVISION,j=Y1.REVISION_CHANGES[_];return[_,j]},appendToBuffer:function q(_,j,K){if(!YH.isArray(_))_=[_];if(_=this.source.wrap(_,j),this.environment.isSimple)return["return ",_,";"];else if(K)return["buffer += ",_,";"];else return _.appendToBuffer=!0,_},initializeBuffer:function q(){return this.quotedString("")},internalNameLookup:function q(_,j){return this.lookupPropertyFunctionIsUsed=!0,["lookupProperty(",_,",",JSON.stringify(j),")"]},lookupPropertyFunctionIsUsed:!1,compile:function q(_,j,K,Y){this.environment=_,this.options=j,this.stringParams=this.options.stringParams,this.trackIds=this.options.trackIds,this.precompile=!Y,this.name=this.environment.name,this.isChild=!!K,this.context=K||{decorators:[],programs:[],environments:[]},this.preamble(),this.stackSlot=0,this.stackVars=[],this.aliases={},this.registers={list:[]},this.hashes=[],this.compileStack=[],this.inlineStack=[],this.blockParams=[],this.compileChildren(_,j),this.useDepths=this.useDepths||_.useDepths||_.useDecorators||this.options.compat,this.useBlockParams=this.useBlockParams||_.useBlockParams;var f=_.opcodes,P=void 0,$=void 0,O=void 0,w=void 0;for(O=0,w=f.length;O0)K+=", "+Y.join(", ");var f=0;if(Object.keys(this.aliases).forEach(function(O){var w=j.aliases[O];if(w.children&&w.referenceCount>1)K+=", alias"+ ++f+"="+O,w.children[0]="alias"+f}),this.lookupPropertyFunctionIsUsed)K+=", "+this.lookupPropertyFunctionVarDeclaration();var P=["container","depth0","helpers","partials","data"];if(this.useBlockParams||this.useDepths)P.push("blockParams");if(this.useDepths)P.push("depths");var $=this.mergeSource(K);if(_)return P.push($),Function.apply(this,P);else return this.source.wrap(["function(",P.join(","),`) { + `,$,"}"])},mergeSource:function q(_){var j=this.environment.isSimple,K=!this.forceBuffer,Y=void 0,f=void 0,P=void 0,$=void 0;if(this.source.each(function(O){if(O.appendToBuffer){if(P)O.prepend(" + ");else P=O;$=O}else{if(P){if(!f)Y=!0;else P.prepend("buffer += ");$.add(";"),P=$=void 0}if(f=!0,!j)K=!1}}),K){if(P)P.prepend("return "),$.add(";");else if(!f)this.source.push('return "";')}else if(_+=", buffer = "+(Y?"":this.initializeBuffer()),P)P.prepend("return buffer + "),$.add(";");else this.source.push("return buffer;");if(_)this.source.prepend("var "+_.substring(2)+(Y?"":`; +`));return this.source.merge()},lookupPropertyFunctionVarDeclaration:function q(){return` + lookupProperty = container.lookupProperty || function(parent, propertyName) { + if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { + return parent[propertyName]; + } + return undefined + } + `.trim()},blockValue:function q(_){var j=this.aliasable("container.hooks.blockHelperMissing"),K=[this.contextName(0)];this.setupHelperArgs(_,0,K);var Y=this.popStack();K.splice(1,0,Y),this.push(this.source.functionCall(j,"call",K))},ambiguousBlockValue:function q(){var _=this.aliasable("container.hooks.blockHelperMissing"),j=[this.contextName(0)];this.setupHelperArgs("",0,j,!0),this.flushInline();var K=this.topStack();j.splice(1,0,K),this.pushSource(["if (!",this.lastHelper,") { ",K," = ",this.source.functionCall(_,"call",j),"}"])},appendContent:function q(_){if(this.pendingContent)_=this.pendingContent+_;else this.pendingLocation=this.source.currentLocation;this.pendingContent=_},append:function q(){if(this.isInline())this.replaceStack(function(j){return[" != null ? ",j,' : ""']}),this.pushSource(this.appendToBuffer(this.popStack()));else{var _=this.popStack();if(this.pushSource(["if (",_," != null) { ",this.appendToBuffer(_,void 0,!0)," }"]),this.environment.isSimple)this.pushSource(["else { ",this.appendToBuffer("''",void 0,!0)," }"])}},appendEscaped:function q(){this.pushSource(this.appendToBuffer([this.aliasable("container.escapeExpression"),"(",this.popStack(),")"]))},getContext:function q(_){this.lastContext=_},pushContext:function q(){this.pushStackLiteral(this.contextName(this.lastContext))},lookupOnContext:function q(_,j,K,Y){var f=0;if(!Y&&this.options.compat&&!this.lastContext)this.push(this.depthedLookup(_[f++]));else this.pushContext();this.resolvePath("context",_,f,j,K)},lookupBlockParam:function q(_,j){this.useBlockParams=!0,this.push(["blockParams[",_[0],"][",_[1],"]"]),this.resolvePath("context",j,1)},lookupData:function q(_,j,K){if(!_)this.pushStackLiteral("data");else this.pushStackLiteral("container.data(data, "+_+")");this.resolvePath("data",j,0,!0,K)},resolvePath:function q(_,j,K,Y,f){var P=this;if(this.options.strict||this.options.assumeObjects){this.push($H(this.options.strict&&f,this,j,K,_));return}var $=j.length;for(;K<$;K++)this.replaceStack(function(O){var w=P.nameLookup(O,j[K],_);if(!Y)return[" != null ? ",w," : ",O];else return[" && ",w]})},resolvePossibleLambda:function q(){this.push([this.aliasable("container.lambda"),"(",this.popStack(),", ",this.contextName(0),")"])},pushStringParam:function q(_,j){if(this.pushContext(),this.pushString(j),j!=="SubExpression")if(typeof _==="string")this.pushString(_);else this.pushStackLiteral(_)},emptyHash:function q(_){if(this.trackIds)this.push("{}");if(this.stringParams)this.push("{}"),this.push("{}");this.pushStackLiteral(_?"undefined":"{}")},pushHash:function q(){if(this.hash)this.hashes.push(this.hash);this.hash={values:{},types:[],contexts:[],ids:[]}},popHash:function q(){var _=this.hash;if(this.hash=this.hashes.pop(),this.trackIds)this.push(this.objectLiteral(_.ids));if(this.stringParams)this.push(this.objectLiteral(_.contexts)),this.push(this.objectLiteral(_.types));this.push(this.objectLiteral(_.values))},pushString:function q(_){this.pushStackLiteral(this.quotedString(_))},pushLiteral:function q(_){this.pushStackLiteral(_)},pushProgram:function q(_){if(_!=null)this.pushStackLiteral(this.programExpression(_));else this.pushStackLiteral(null)},registerDecorator:function q(_,j){var K=this.nameLookup("decorators",j,"decorator"),Y=this.setupHelperArgs(j,_);this.decorators.push(["fn = ",this.decorators.functionCall(K,"",["fn","props","container",Y])," || fn;"])},invokeHelper:function q(_,j,K){var Y=this.popStack(),f=this.setupHelper(_,j),P=[];if(K)P.push(f.name);if(P.push(Y),!this.options.strict)P.push(this.aliasable("container.hooks.helperMissing"));var $=["(",this.itemsSeparatedBy(P,"||"),")"],O=this.source.functionCall($,"call",f.callParams);this.push(O)},itemsSeparatedBy:function q(_,j){var K=[];K.push(_[0]);for(var Y=1;Y<_.length;Y++)K.push(j,_[Y]);return K},invokeKnownHelper:function q(_,j){var K=this.setupHelper(_,j);this.push(this.source.functionCall(K.name,"call",K.callParams))},invokeAmbiguous:function q(_,j){this.useRegister("helper");var K=this.popStack();this.emptyHash();var Y=this.setupHelper(0,_,j),f=this.lastHelper=this.nameLookup("helpers",_,"helper"),P=["(","(helper = ",f," || ",K,")"];if(!this.options.strict)P[0]="(helper = ",P.push(" != null ? helper : ",this.aliasable("container.hooks.helperMissing"));this.push(["(",P,Y.paramsInit?["),(",Y.paramsInit]:[],"),","(typeof helper === ",this.aliasable('"function"')," ? ",this.source.functionCall("helper","call",Y.callParams)," : helper))"])},invokePartial:function q(_,j,K){var Y=[],f=this.setupParams(j,1,Y);if(_)j=this.popStack(),delete f.name;if(K)f.indent=JSON.stringify(K);if(f.helpers="helpers",f.partials="partials",f.decorators="container.decorators",!_)Y.unshift(this.nameLookup("partials",j,"partial"));else Y.unshift(j);if(this.options.compat)f.depths="depths";f=this.objectLiteral(f),Y.push(f),this.push(this.source.functionCall("container.invokePartial","",Y))},assignToHash:function q(_){var j=this.popStack(),K=void 0,Y=void 0,f=void 0;if(this.trackIds)f=this.popStack();if(this.stringParams)Y=this.popStack(),K=this.popStack();var P=this.hash;if(K)P.contexts[_]=K;if(Y)P.types[_]=Y;if(f)P.ids[_]=f;P.values[_]=j},pushId:function q(_,j,K){if(_==="BlockParam")this.pushStackLiteral("blockParams["+j[0]+"].path["+j[1]+"]"+(K?" + "+JSON.stringify("."+K):""));else if(_==="PathExpression")this.pushString(j);else if(_==="SubExpression")this.pushStackLiteral("true");else this.pushStackLiteral("null")},compiler:g_,compileChildren:function q(_,j){var K=_.children,Y=void 0,f=void 0;for(var P=0,$=K.length;P<$;P++){Y=K[P],f=new this.compiler;var O=this.matchExistingProgram(Y);if(O==null){this.context.programs.push("");var w=this.context.programs.length;Y.index=w,Y.name="program"+w,this.context.programs[w]=f.compile(Y,j,this.context,!this.precompile),this.context.decorators[w]=f.decorators,this.context.environments[w]=Y,this.useDepths=this.useDepths||f.useDepths,this.useBlockParams=this.useBlockParams||f.useBlockParams,Y.useDepths=this.useDepths,Y.useBlockParams=this.useBlockParams}else Y.index=O.index,Y.name="program"+O.index,this.useDepths=this.useDepths||O.useDepths,this.useBlockParams=this.useBlockParams||O.useBlockParams}},matchExistingProgram:function q(_){for(var j=0,K=this.context.environments.length;jthis.stackVars.length)this.stackVars.push("stack"+this.stackSlot);return this.topStackName()},topStackName:function q(){return"stack"+this.stackSlot},flushInline:function q(){var _=this.inlineStack;this.inlineStack=[];for(var j=0,K=_.length;j{W1.__esModule=!0;function mK(q){return q&&q.__esModule?q:{default:q}}var vH=Jj(),zH=mK(vH),WH=W4(),JH=mK(WH),d4=Ej(),p4=gj(),HH=v1(),TH=mK(HH),ZH=I3(),kH=mK(ZH),XH=w4(),AH=mK(XH),GH=zH.default.create;function z1(){var q=GH();return q.compile=function(_,j){return p4.compile(_,j,q)},q.precompile=function(_,j){return p4.precompile(_,j,q)},q.AST=JH.default,q.Compiler=p4.Compiler,q.JavaScriptCompiler=TH.default,q.Parser=d4.parser,q.parse=d4.parse,q.parseWithoutProcessing=d4.parseWithoutProcessing,q}var y_=z1();y_.create=z1;AH.default(y_);y_.Visitor=kH.default;y_.default=y_;W1.default=y_;J1.exports=W1.default});var T1=q8((NH)=>{NH.__esModule=!0;NH.print=MH;NH.PrintVisitor=a8;function DH(q){return q&&q.__esModule?q:{default:q}}var CH=I3(),VH=DH(CH);function MH(q){return new a8().accept(q)}function a8(){this.padding=0}a8.prototype=new VH.default;a8.prototype.pad=function(q){var _="";for(var j=0,K=this.padding;j "+_+" }}")};a8.prototype.PartialBlockStatement=function(q){var _="PARTIAL BLOCK:"+q.name.original;if(q.params[0])_+=" "+this.accept(q.params[0]);if(q.hash)_+=" "+this.accept(q.hash);return _+=" "+this.pad("PROGRAM:"),this.padding++,_+=this.accept(q.program),this.padding--,this.pad("{{> "+_+" }}")};a8.prototype.ContentStatement=function(q){return this.pad("CONTENT[ '"+q.value+"' ]")};a8.prototype.CommentStatement=function(q){return this.pad("{{! '"+q.value+"' }}")};a8.prototype.SubExpression=function(q){var _=q.params,j=[],K=void 0;for(var Y=0,f=_.length;Y1?"s":""} ago`;if(f<24)return`${f} hour${f>1?"s":""} ago`;if(P<7)return`${P} day${P>1?"s":""} ago`;return _.toLocaleDateString()}function D1(q,_){let{count:j,duration:K,details:Y}=_,f=K?` in ${K}ms`:"",P=Y?` - ${Y}`:"";return`\uD83D\uDCCA ${{compress:`Compressed ${j} conversation turns${f}${P}`,load:`Loaded ${j} relevant memories${f}${P}`,search:`Found ${j} matching memories${f}${P}`,archive:`Archived ${j} conversation segments${f}${P}`}[q]}`}function gH(q,_=3,j){let K=q.filter((P)=>P.type==="overview");if(K.length===0)return[];let Y=K;if(j){if(Y=K.filter((P)=>P.project===j),Y.length===0)Y=K}return Y.slice(-_).map((P)=>{let $={content:P.content||""},O=G1(P);if(O)$.timestamp=O,$.timeAgo=A1(O);else $.timeAgo="Recently";return $})}function yH(q){if(q.length===0)return[];return q.filter((_)=>_.type==="memory").map((_)=>{let j={summary:_.text||"",sessionId:_.session_id||""};if(_.keywords)j.keywords=_.keywords;if(_.document_id&&!_.document_id.includes("Session:"))j.location=_.document_id;return j}).filter((_)=>_.summary.length>0)}function dH(q){let _=new Map;return q.forEach((j)=>{let K=j.sessionId;if(K){if(!_.has(K))_.set(K,[]);_.get(K).push(j)}}),Array.from(_.entries()).map(([j,K])=>{let Y=K.map((f,P)=>({...f,number:P+1}));return{sessionId:j,memories:Y}})}function C1(q){let{projectName:_,memoryCount:j,lastSessionTime:K,recentObjects:Y}=q,f=gH(Y,3,_),P=yH(Y);if(P.length>0){let $=dH(P);console.log("\uD83D\uDCDA Recent Context"),console.log("===================================================================="),$.forEach((O)=>{console.log(`\uD83D\uDC40 in ${O.sessionId}:`),console.log(""),O.memories.forEach((w)=>{console.log(`${w.number}. ${w.summary}`),console.log(` — ${w.keywords}`),console.log("")})}),console.log("======================================================================")}if(f.length>0)console.log("\uD83E\uDDE0 What's new:"),console.log("===================================================================="),f.forEach(($)=>{console.log(`\uD83D\uDCC5 ${$.timeAgo}:`),console.log($.content),console.log("")}),console.log("====================================================================");else if(P.length===0)console.log(`\uD83E\uDDE0 No recent context found for ${_}`)}var n4,RH=`\uD83E\uDDE0 What's new: {{dateTime}} +==================================================================== +{{#if overview}}{{overview}}{{/if}} + +\uD83D\uDCDA Recent Context +==================================================================== +{{#if hasMemories}} +{{#each sessionGroups}} +\uD83D\uDC40 in {{sessionId}}: + +{{#each memories}} +{{number}}. {{summary}} + — {{keywords}} + +{{/each}} +====================================================================== +{{/each}} +{{else}} +No relevant memories found - this appears to be your first session or a new project area. + +\uD83D\uDCA1 Getting Started: +• Start working and memories will be automatically created +• At the end of your session, ask to compress and store the conversation +• Next time you return, relevant context will be loaded automatically +{{/if}}`,mH=`\uD83E\uDDE0 What's new: {{dateTime}} +==================================================================== +{{#if hasOverviews}} +{{#each overviews}} +\uD83D\uDCC5 {{timeAgo}}: +{{content}} + +{{/each}} +{{else}} +This appears to be your first session. Context will be automatically captured as you work. + +\uD83D\uDCA1 Getting Started: +• Start working and memories will be automatically created +• At the end of your session, ask to compress and store the conversation +• Next time you return, relevant context will be loaded automatically +{{/if}} +==================================================================== +{{#if hasMemories}}{{/if}}`,JC,HC,IH;var x4=Y6(()=>{n4=o6(L4(),1),JC=n4.default.compile(RH,{noEscape:!0}),HC=n4.default.compile(mH,{noEscape:!0});IH={NO_MEMORIES:(q)=>({message:`No previous memories found for ${q}`,suggestion:"This appears to be your first session. Memories will be created as you work."}),CONNECTION_FAILED:()=>({message:"Could not connect to memory system",suggestion:"Try restarting Claude Code or check if the MCP server is properly configured."}),SEARCH_FAILED:(q)=>({message:`Search for "${q}" didn't return any results`,suggestion:"Try using different keywords or check if memories exist for this project."}),LOAD_TIMEOUT:()=>({message:"Memory loading timed out",suggestion:"The operation is taking longer than expected. You can continue without loaded context."})}});import{join as S1}from"path";import{fileURLToPath as DT}from"url";import{setMaxListeners as CT}from"events";import{spawn as MT}from"child_process";import{createInterface as NT}from"readline";import*as J8 from"fs";import{stat as bT}from"fs/promises";function l1(q=VT){let _=new AbortController;return CT(q,_.signal),_}function RT(){return ET}class n1{options;child;childStdin;childStdout;ready=!1;abortController;exitError;exitListeners=[];processExitHandler;abortHandler;constructor(q){this.options=q,this.abortController=q.abortController||l1(),this.initialize()}initialize(){try{let{prompt:q,additionalDirectories:_=[],cwd:j,executable:K=this.isRunningWithBun()?"bun":"node",executableArgs:Y=[],extraArgs:f={},pathToClaudeCodeExecutable:P,env:$={...process.env},stderr:O,customSystemPrompt:w,appendSystemPrompt:v,maxTurns:z,model:W,fallbackModel:J,permissionMode:k,permissionPromptToolName:H,continueConversation:X,resume:A,allowedTools:G=[],disallowedTools:h=[],mcpServers:V,strictMcpConfig:E,canUseTool:M}=this.options,b=["--output-format","stream-json","--verbose"];if(w)b.push("--system-prompt",w);if(v)b.push("--append-system-prompt",v);if(z)b.push("--max-turns",z.toString());if(W)b.push("--model",W);if($.DEBUG)b.push("--debug-to-stderr");if(M){if(typeof q==="string")throw new Error("canUseTool callback requires --input-format stream-json. Please set prompt as an AsyncIterable.");if(H)throw new Error("canUseTool callback cannot be used with permissionPromptToolName. Please use one or the other.");b.push("--permission-prompt-tool","stdio")}else if(H)b.push("--permission-prompt-tool",H);if(X)b.push("--continue");if(A)b.push("--resume",A);if(G.length>0)b.push("--allowedTools",G.join(","));if(h.length>0)b.push("--disallowedTools",h.join(","));if(V&&Object.keys(V).length>0)b.push("--mcp-config",JSON.stringify({mcpServers:V}));if(E)b.push("--strict-mcp-config");if(k&&k!=="default")b.push("--permission-mode",k);if(J){if(W&&J===W)throw new Error("Fallback model cannot be the same as the main model. Please specify a different model for fallbackModel option.");b.push("--fallback-model",J)}if(typeof q==="string")b.push("--print"),b.push("--",q.trim());else b.push("--input-format","stream-json");for(let d of _)b.push("--add-dir",d);for(let[d,r]of Object.entries(f))if(r===null)b.push(`--${d}`);else b.push(`--${d}`,r);if(!$.CLAUDE_CODE_ENTRYPOINT)$.CLAUDE_CODE_ENTRYPOINT="sdk-ts";if(!RT().existsSync(P)){let d=E1(P)?`Claude Code native binary not found at ${P}. Please ensure Claude Code is installed via native installer or specify a valid path with options.pathToClaudeCodeExecutable.`:`Claude Code executable not found at ${P}. Is options.pathToClaudeCodeExecutable set?`;throw new ReferenceError(d)}let y=E1(P),c=y?P:K,L=y?b:[...Y,P,...b];this.logDebug(y?`Spawning Claude Code native binary: ${P} ${b.join(" ")}`:`Spawning Claude Code process: ${K} ${[...Y,P,...b].join(" ")}`);let m=$.DEBUG||O?"pipe":"ignore";if(this.child=MT(c,L,{cwd:j,stdio:["pipe","pipe",m],signal:this.abortController.signal,env:$}),this.childStdin=this.child.stdin,this.childStdout=this.child.stdout,typeof q==="string")this.childStdin.end(),this.childStdin=void 0;if($.DEBUG||O)this.child.stderr.on("data",(d)=>{if(this.logDebug(`Claude Code stderr: ${d.toString()}`),O)O(d.toString())});let I=()=>{if(this.child&&!this.child.killed)this.child.kill("SIGTERM")};this.processExitHandler=I,this.abortHandler=I,process.on("exit",this.processExitHandler),this.abortController.signal.addEventListener("abort",this.abortHandler),this.child.on("error",(d)=>{if(this.ready=!1,this.abortController.signal.aborted)this.exitError=new L_("Claude Code process aborted by user");else this.exitError=new Error(`Failed to spawn Claude Code process: ${d.message}`),this.logDebug(this.exitError.message)}),this.child.on("close",(d,r)=>{if(this.ready=!1,this.abortController.signal.aborted)this.exitError=new L_("Claude Code process aborted by user");else{let B=this.getProcessExitError(d,r);if(B)this.exitError=B,this.logDebug(B.message)}}),this.ready=!0}catch(q){throw this.ready=!1,q}}getProcessExitError(q,_){if(q!==0&&q!==null)return new Error(`Claude Code process exited with code ${q}`);else if(_)return new Error(`Claude Code process terminated by signal ${_}`);return}isRunningWithBun(){return process.versions.bun!==void 0||process.env.BUN_INSTALL!==void 0}logDebug(q){if(process.env.DEBUG)process.stderr.write(`${q} +`)}write(q){if(this.abortController.signal.aborted)throw new L_("Operation aborted");if(!this.ready||!this.childStdin)throw new Error("ProcessTransport is not ready for writing");if(this.child?.killed||this.child?.exitCode!==null)throw new Error("Cannot write to terminated process");if(this.exitError)throw new Error(`Cannot write to process that exited with error: ${this.exitError.message}`);if(process.env.DEBUG_SDK)process.stderr.write(`[ProcessTransport] Writing to stdin: ${q.substring(0,100)} +`);try{if(!this.childStdin.write(q)&&process.env.DEBUG_SDK)console.warn("[ProcessTransport] Write buffer full, data queued")}catch(_){throw this.ready=!1,new Error(`Failed to write to process stdin: ${_.message}`)}}close(){if(this.childStdin)this.childStdin.end(),this.childStdin=void 0;if(this.processExitHandler)process.off("exit",this.processExitHandler),this.processExitHandler=void 0;if(this.abortHandler)this.abortController.signal.removeEventListener("abort",this.abortHandler),this.abortHandler=void 0;for(let{handler:q}of this.exitListeners)this.child?.off("exit",q);if(this.exitListeners=[],this.child&&!this.child.killed)this.child.kill("SIGTERM"),setTimeout(()=>{if(this.child&&!this.child.killed)this.child.kill("SIGKILL")},5000);this.ready=!1}isReady(){return this.ready}async*readMessages(){if(!this.childStdout)throw new Error("ProcessTransport output stream not available");let q=NT({input:this.childStdout});try{for await(let _ of q)if(_.trim())yield JSON.parse(_);await this.waitForExit()}catch(_){throw _}finally{q.close()}}endInput(){if(this.childStdin)this.childStdin.end()}getInputStream(){return this.childStdin}onExit(q){if(!this.child)return()=>{};let _=(j,K)=>{let Y=this.getProcessExitError(j,K);q(Y)};return this.child.on("exit",_),this.exitListeners.push({callback:q,handler:_}),()=>{if(this.child)this.child.off("exit",_);let j=this.exitListeners.findIndex((K)=>K.handler===_);if(j!==-1)this.exitListeners.splice(j,1)}}async waitForExit(){if(!this.child){if(this.exitError)throw this.exitError;return}if(this.child.exitCode!==null||this.child.killed){if(this.exitError)throw this.exitError;return}return new Promise((q,_)=>{let j=(Y,f)=>{if(this.abortController.signal.aborted){_(new L_("Operation aborted"));return}let P=this.getProcessExitError(Y,f);if(P)_(P);else q()};this.child.once("exit",j);let K=(Y)=>{this.child.off("exit",j),_(Y)};this.child.once("error",K),this.child.once("exit",()=>{this.child.off("error",K)})})}}function E1(q){return![".js",".mjs",".tsx",".ts",".jsx"].some((j)=>q.endsWith(j))}class c1{sendMcpMessage;isClosed=!1;constructor(q){this.sendMcpMessage=q}onclose;onerror;onmessage;async start(){}async send(q){if(this.isClosed)throw new Error("Transport is closed");this.sendMcpMessage(q)}async close(){if(this.isClosed)return;this.isClosed=!0,this.onclose?.()}}function gT(q){i1=q}function n3(){return i1}function F(q,_){let j=n3(),K=x3({issueData:_,data:q.data,path:q.path,errorMaps:[q.common.contextualErrorMap,q.schemaErrorMap,j,j===x_?void 0:x_].filter((Y)=>!!Y)});q.common.issues.push(K)}class H6{constructor(){this.value="valid"}dirty(){if(this.value==="valid")this.value="dirty"}abort(){if(this.value!=="aborted")this.value="aborted"}static mergeArray(q,_){let j=[];for(let K of _){if(K.status==="aborted")return O8;if(K.status==="dirty")q.dirty();j.push(K.value)}return{status:q.value,value:j}}static async mergeObjectAsync(q,_){let j=[];for(let K of _){let Y=await K.key,f=await K.value;j.push({key:Y,value:f})}return H6.mergeObjectSync(q,j)}static mergeObjectSync(q,_){let j={};for(let K of _){let{key:Y,value:f}=K;if(Y.status==="aborted")return O8;if(f.status==="aborted")return O8;if(Y.status==="dirty")q.dirty();if(f.status==="dirty")q.dirty();if(Y.value!=="__proto__"&&(typeof f.value!=="undefined"||K.alwaysSet))j[Y.value]=f.value}return{status:q.value,value:j}}}class $q{constructor(q,_,j,K){this._cachedPath=[],this.parent=q,this.data=_,this._path=j,this._key=K}get path(){if(!this._cachedPath.length)if(Array.isArray(this._key))this._cachedPath.push(...this._path,...this._key);else this._cachedPath.push(...this._path,this._key);return this._cachedPath}}function Z8(q){if(!q)return{};let{errorMap:_,invalid_type_error:j,required_error:K,description:Y}=q;if(_&&(j||K))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);if(_)return{errorMap:_,description:Y};return{errorMap:(P,$)=>{let{message:O}=q;if(P.code==="invalid_enum_value")return{message:O??$.defaultError};if(typeof $.data==="undefined")return{message:O??K??$.defaultError};if(P.code!=="invalid_type")return{message:$.defaultError};return{message:O??j??$.defaultError}},description:Y}}class k8{get description(){return this._def.description}_getType(q){return Rq(q.data)}_getOrReturnCtx(q,_){return _||{common:q.parent.common,data:q.data,parsedType:Rq(q.data),schemaErrorMap:this._def.errorMap,path:q.path,parent:q.parent}}_processInputParams(q){return{status:new H6,ctx:{common:q.parent.common,data:q.data,parsedType:Rq(q.data),schemaErrorMap:this._def.errorMap,path:q.path,parent:q.parent}}}_parseSync(q){let _=this._parse(q);if(gK(_))throw new Error("Synchronous parse encountered promise.");return _}_parseAsync(q){let _=this._parse(q);return Promise.resolve(_)}parse(q,_){let j=this.safeParse(q,_);if(j.success)return j.data;throw j.error}safeParse(q,_){let j={common:{issues:[],async:_?.async??!1,contextualErrorMap:_?.errorMap},path:_?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:q,parsedType:Rq(q)},K=this._parseSync({data:q,path:j.path,parent:j});return R1(j,K)}"~validate"(q){let _={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:q,parsedType:Rq(q)};if(!this["~standard"].async)try{let j=this._parseSync({data:q,path:[],parent:_});return j_(j)?{value:j.value}:{issues:_.common.issues}}catch(j){if(j?.message?.toLowerCase()?.includes("encountered"))this["~standard"].async=!0;_.common={issues:[],async:!0}}return this._parseAsync({data:q,path:[],parent:_}).then((j)=>j_(j)?{value:j.value}:{issues:_.common.issues})}async parseAsync(q,_){let j=await this.safeParseAsync(q,_);if(j.success)return j.data;throw j.error}async safeParseAsync(q,_){let j={common:{issues:[],contextualErrorMap:_?.errorMap,async:!0},path:_?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:q,parsedType:Rq(q)},K=this._parse({data:q,path:j.path,parent:j}),Y=await(gK(K)?K:Promise.resolve(K));return R1(j,Y)}refine(q,_){let j=(K)=>{if(typeof _==="string"||typeof _==="undefined")return{message:_};else if(typeof _==="function")return _(K);else return _};return this._refinement((K,Y)=>{let f=q(K),P=()=>Y.addIssue({code:t.custom,...j(K)});if(typeof Promise!=="undefined"&&f instanceof Promise)return f.then(($)=>{if(!$)return P(),!1;else return!0});if(!f)return P(),!1;else return!0})}refinement(q,_){return this._refinement((j,K)=>{if(!q(j))return K.addIssue(typeof _==="function"?_(j,K):_),!1;else return!0})}_refinement(q){return new t6({schema:this,typeName:z8.ZodEffects,effect:{type:"refinement",refinement:q}})}superRefine(q){return this._refinement(q)}constructor(q){this.spa=this.safeParseAsync,this._def=q,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:(_)=>this["~validate"](_)}}optional(){return fq.create(this,this._def)}nullable(){return mq.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Yq.create(this)}promise(){return $_.create(this,this._def)}or(q){return o_.create([this,q],this._def)}and(q){return a_.create(this,q,this._def)}transform(q){return new t6({...Z8(this._def),schema:this,typeName:z8.ZodEffects,effect:{type:"transform",transform:q}})}default(q){let _=typeof q==="function"?q:()=>q;return new F_({...Z8(this._def),innerType:this,defaultValue:_,typeName:z8.ZodDefault})}brand(){return new r3({typeName:z8.ZodBranded,type:this,...Z8(this._def)})}catch(q){let _=typeof q==="function"?q:()=>q;return new U_({...Z8(this._def),innerType:this,catchValue:_,typeName:z8.ZodCatch})}describe(q){return new this.constructor({...this._def,description:q})}pipe(q){return nK.create(this,q)}readonly(){return s_.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}function a1(q){let _="[0-5]\\d";if(q.precision)_=`${_}\\.\\d{${q.precision}}`;else if(q.precision==null)_=`${_}(\\.\\d+)?`;let j=q.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${_})${j}`}function sT(q){return new RegExp(`^${a1(q)}$`)}function B1(q){let _=`${o1}T${a1(q)}`,j=[];if(j.push(q.local?"Z?":"Z"),q.offset)j.push("([+-]\\d{2}:?\\d{2})");return _=`${_}(${j.join("|")})`,new RegExp(`^${_}$`)}function QT(q,_){if((_==="v4"||!_)&&oT.test(q))return!0;if((_==="v6"||!_)&&BT.test(q))return!0;return!1}function qZ(q,_){if(!xT.test(q))return!1;try{let[j]=q.split(".");if(!j)return!1;let K=j.replace(/-/g,"+").replace(/_/g,"/").padEnd(j.length+(4-j.length%4)%4,"="),Y=JSON.parse(atob(K));if(typeof Y!=="object"||Y===null)return!1;if("typ"in Y&&Y?.typ!=="JWT")return!1;if(!Y.alg)return!1;if(_&&Y.alg!==_)return!1;return!0}catch{return!1}}function _Z(q,_){if((_==="v4"||!_)&&aT.test(q))return!0;if((_==="v6"||!_)&&tT.test(q))return!0;return!1}function KZ(q,_){let j=(q.toString().split(".")[1]||"").length,K=(_.toString().split(".")[1]||"").length,Y=j>K?j:K,f=Number.parseInt(q.toFixed(Y).replace(".","")),P=Number.parseInt(_.toFixed(Y).replace(".",""));return f%P/10**Y}function p_(q){if(q instanceof i8){let _={};for(let j in q.shape){let K=q.shape[j];_[j]=fq.create(p_(K))}return new i8({...q._def,shape:()=>_})}else if(q instanceof Yq)return new Yq({...q._def,type:p_(q.element)});else if(q instanceof fq)return fq.create(p_(q.unwrap()));else if(q instanceof mq)return mq.create(p_(q.unwrap()));else if(q instanceof kq)return kq.create(q.items.map((_)=>p_(_)));else return q}function B4(q,_){let j=Rq(q),K=Rq(_);if(q===_)return{valid:!0,data:q};else if(j===Q.object&&K===Q.object){let Y=u8.objectKeys(_),f=u8.objectKeys(q).filter(($)=>Y.indexOf($)!==-1),P={...q,..._};for(let $ of f){let O=B4(q[$],_[$]);if(!O.valid)return{valid:!1};P[$]=O.data}return{valid:!0,data:P}}else if(j===Q.array&&K===Q.array){if(q.length!==_.length)return{valid:!1};let Y=[];for(let f=0;f{let f=q(K);if(f instanceof Promise)return f.then((P)=>{if(!P){let $=m1(_,K),O=$.fatal??j??!0;Y.addIssue({code:"custom",...$,fatal:O})}});if(!f){let P=m1(_,K),$=P.fatal??j??!0;Y.addIssue({code:"custom",...P,fatal:$})}return});return Y_.create()}function Bk(q){if(!q)return{};let{errorMap:_,invalid_type_error:j,required_error:K,description:Y}=q;if(_&&(j||K))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);if(_)return{errorMap:_,description:Y};return{errorMap:(P,$)=>{var O,w;let{message:v}=q;if(P.code==="invalid_enum_value")return{message:v!==null&&v!==void 0?v:$.defaultError};if(typeof $.data==="undefined")return{message:(O=v!==null&&v!==void 0?v:K)!==null&&O!==void 0?O:$.defaultError};if(P.code!=="invalid_type")return{message:$.defaultError};return{message:(w=v!==null&&v!==void 0?v:j)!==null&&w!==void 0?w:$.defaultError}},description:Y}}function j2({prompt:q,options:{abortController:_=l1(),additionalDirectories:j=[],allowedTools:K=[],appendSystemPrompt:Y,canUseTool:f,continue:P,customSystemPrompt:$,cwd:O,disallowedTools:w=[],env:v,executable:z=tk()?"bun":"node",executableArgs:W=[],extraArgs:J={},fallbackModel:k,hooks:H,maxTurns:X,mcpServers:A,model:G,pathToClaudeCodeExecutable:h,permissionMode:V="default",permissionPromptToolName:E,resume:M,stderr:b,strictMcpConfig:g}={}}){if(!v)v={...process.env};if(!v.CLAUDE_CODE_ENTRYPOINT)v.CLAUDE_CODE_ENTRYPOINT="sdk-ts";if(h===void 0){let d=DT(import.meta.url),r=S1(d,"..");h=S1(r,"cli.js")}let y={},c=new Map;if(A)for(let[d,r]of Object.entries(A))if(r.type==="sdk")c.set(d,r.instance),y[d]={type:"sdk",name:d};else y[d]=r;let L=typeof q!=="string",m=new n1({prompt:q,abortController:_,additionalDirectories:j,cwd:O,executable:z,executableArgs:W,extraArgs:J,pathToClaudeCodeExecutable:h,env:v,stderr:b,customSystemPrompt:$,appendSystemPrompt:Y,maxTurns:X,model:G,fallbackModel:k,permissionMode:V,permissionPromptToolName:E,continueConversation:P,resume:M,allowedTools:K,disallowedTools:w,mcpServers:A,strictMcpConfig:g,canUseTool:!!f,hooks:!!H}),I=new r1(m,L,f,H,_,c);if(typeof q!=="string")I.streamInput(q);return I}function tk(){return process.versions.bun!==void 0||process.env.BUN_INSTALL!==void 0}var pH,LH,r4,lH,nH,xH=(q,_,j)=>{j=q!=null?pH(LH(q)):{};let K=_||!q||!q.__esModule?r4(j,"default",{value:q,enumerable:!0}):j;for(let Y of lH(q))if(!nH.call(K,Y))r4(K,Y,{get:()=>q[Y],enumerable:!0});return K},H8=(q,_)=>()=>(_||q((_={exports:{}}).exports,_),_.exports),cH=(q,_)=>{for(var j in _)r4(q,j,{get:_[j],enumerable:!0,configurable:!0,set:(K)=>_[j]=()=>K})},rH,F4,iH,Q_,y1,oH,U4,s4,d1,p1,aH,BH,tH,eH,FH,UH,sH,QH,qT,_T,KT,jT,PT,YT,V1,M1,N1,b1,fT,$T,wT,OT,vT,zT,WT,JT,HT,TT,ZT,kT,XT,L1,AT,GT,uT,hT,VT=50,ST,ET,L_,x1,r1,Z,u8,i4,Q,Rq=(q)=>{switch(typeof q){case"undefined":return Q.undefined;case"string":return Q.string;case"number":return Number.isNaN(q)?Q.nan:Q.number;case"boolean":return Q.boolean;case"function":return Q.function;case"bigint":return Q.bigint;case"symbol":return Q.symbol;case"object":if(Array.isArray(q))return Q.array;if(q===null)return Q.null;if(q.then&&typeof q.then==="function"&&q.catch&&typeof q.catch==="function")return Q.promise;if(typeof Map!=="undefined"&&q instanceof Map)return Q.map;if(typeof Set!=="undefined"&&q instanceof Set)return Q.set;if(typeof Date!=="undefined"&&q instanceof Date)return Q.date;return Q.object;default:return Q.unknown}},t,mT=(q)=>{return JSON.stringify(q,null,2).replace(/"([^"]+)":/g,"$1:")},g6,IT=(q,_)=>{let j;switch(q.code){case t.invalid_type:if(q.received===Q.undefined)j="Required";else j=`Expected ${q.expected}, received ${q.received}`;break;case t.invalid_literal:j=`Invalid literal value, expected ${JSON.stringify(q.expected,u8.jsonStringifyReplacer)}`;break;case t.unrecognized_keys:j=`Unrecognized key(s) in object: ${u8.joinValues(q.keys,", ")}`;break;case t.invalid_union:j="Invalid input";break;case t.invalid_union_discriminator:j=`Invalid discriminator value. Expected ${u8.joinValues(q.options)}`;break;case t.invalid_enum_value:j=`Invalid enum value. Expected ${u8.joinValues(q.options)}, received '${q.received}'`;break;case t.invalid_arguments:j="Invalid function arguments";break;case t.invalid_return_type:j="Invalid function return type";break;case t.invalid_date:j="Invalid date";break;case t.invalid_string:if(typeof q.validation==="object")if("includes"in q.validation){if(j=`Invalid input: must include "${q.validation.includes}"`,typeof q.validation.position==="number")j=`${j} at one or more positions greater than or equal to ${q.validation.position}`}else if("startsWith"in q.validation)j=`Invalid input: must start with "${q.validation.startsWith}"`;else if("endsWith"in q.validation)j=`Invalid input: must end with "${q.validation.endsWith}"`;else u8.assertNever(q.validation);else if(q.validation!=="regex")j=`Invalid ${q.validation}`;else j="Invalid";break;case t.too_small:if(q.type==="array")j=`Array must contain ${q.exact?"exactly":q.inclusive?"at least":"more than"} ${q.minimum} element(s)`;else if(q.type==="string")j=`String must contain ${q.exact?"exactly":q.inclusive?"at least":"over"} ${q.minimum} character(s)`;else if(q.type==="number")j=`Number must be ${q.exact?"exactly equal to ":q.inclusive?"greater than or equal to ":"greater than "}${q.minimum}`;else if(q.type==="bigint")j=`Number must be ${q.exact?"exactly equal to ":q.inclusive?"greater than or equal to ":"greater than "}${q.minimum}`;else if(q.type==="date")j=`Date must be ${q.exact?"exactly equal to ":q.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(q.minimum))}`;else j="Invalid input";break;case t.too_big:if(q.type==="array")j=`Array must contain ${q.exact?"exactly":q.inclusive?"at most":"less than"} ${q.maximum} element(s)`;else if(q.type==="string")j=`String must contain ${q.exact?"exactly":q.inclusive?"at most":"under"} ${q.maximum} character(s)`;else if(q.type==="number")j=`Number must be ${q.exact?"exactly":q.inclusive?"less than or equal to":"less than"} ${q.maximum}`;else if(q.type==="bigint")j=`BigInt must be ${q.exact?"exactly":q.inclusive?"less than or equal to":"less than"} ${q.maximum}`;else if(q.type==="date")j=`Date must be ${q.exact?"exactly":q.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(q.maximum))}`;else j="Invalid input";break;case t.custom:j="Invalid input";break;case t.invalid_intersection_types:j="Intersection results could not be merged";break;case t.not_multiple_of:j=`Number must be a multiple of ${q.multipleOf}`;break;case t.not_finite:j="Number must be finite";break;default:j=_.defaultError,u8.assertNever(q)}return{message:j}},x_,i1,x3=(q)=>{let{data:_,path:j,errorMaps:K,issueData:Y}=q,f=[...j,...Y.path||[]],P={...Y,path:f};if(Y.message!==void 0)return{...Y,path:f,message:Y.message};let $="",O=K.filter((w)=>!!w).slice().reverse();for(let w of O)$=w(P,{data:_,defaultError:$}).message;return{...Y,path:f,message:$}},yT,O8,l_=(q)=>({status:"dirty",value:q}),D6=(q)=>({status:"valid",value:q}),o4=(q)=>q.status==="aborted",a4=(q)=>q.status==="dirty",j_=(q)=>q.status==="valid",gK=(q)=>typeof Promise!=="undefined"&&q instanceof Promise,P8,R1=(q,_)=>{if(j_(_))return{success:!0,data:_.value};else{if(!q.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let j=new g6(q.common.issues);return this._error=j,this._error}}}},dT,pT,LT,lT,nT,xT,cT,rT,iT="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",c4,oT,aT,BT,tT,eT,FT,o1="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",UT,Pq,nq,xq,c_,P_,yK,r_,i_,Y_,lq,Zq,dK,Yq,i8,o_,Eq=(q)=>{if(q instanceof B_)return Eq(q.schema);else if(q instanceof t6)return Eq(q.innerType());else if(q instanceof t_)return[q.value];else if(q instanceof cq)return q.options;else if(q instanceof e_)return u8.objectValues(q.enum);else if(q instanceof F_)return Eq(q._def.innerType);else if(q instanceof r_)return[void 0];else if(q instanceof i_)return[null];else if(q instanceof fq)return[void 0,...Eq(q.unwrap())];else if(q instanceof mq)return[null,...Eq(q.unwrap())];else if(q instanceof r3)return Eq(q.unwrap());else if(q instanceof s_)return Eq(q.unwrap());else if(q instanceof U_)return Eq(q._def.innerType);else return[]},c3,a_,kq,pK,LK,f_,n_,B_,t_,cq,e_,$_,t6,fq,mq,F_,U_,lK,jZ,r3,nK,s_,PZ,z8,YZ=(q,_={message:`Input not instance of ${q.name}`})=>e1((j)=>j instanceof q,_),F1,U1,fZ,$Z,s1,wZ,OZ,vZ,zZ,WZ,JZ,HZ,TZ,ZZ,kZ,XZ,AZ,GZ,uZ,hZ,DZ,CZ,VZ,MZ,NZ,bZ,SZ,EZ,RZ,I1,mZ,IZ,gZ,yZ,dZ=()=>F1().optional(),pZ=()=>U1().optional(),LZ=()=>s1().optional(),lZ,nZ,i3="2.0",Q1,qP,xZ,e6,S6,xK,Xq,F6,o3,cZ,rZ,iZ,g1,oZ,hC,_P,KP,cK,jP,aZ,BZ,tZ,eZ,FZ,PP,UZ,YP,a3,B3,fP,$P,Q4,wP,OP,sZ,QZ,qk,_k,Kk,jk,Pk,Yk,fk,$k,wk,Ok,vk,zk,Wk,Jk,q2,_2,K2,Hk,Tk,vP,Zk,kk,Xk,Ak,Gk,uk,hk,zP,DC,Dk,Ck,WP,Vk,Mk,Nk,bk,Sk,Ek,Rk,mk,Ik,gk,yk,dk,pk,Lk,lk,nk,xk,ck,rk,ik,ok,ak,CC,VC,MC,NC,bC,SC,EC,RC,mC,t4,e4;var JP=Y6(()=>{pH=Object.create,LH=Object.getPrototypeOf,r4=Object.defineProperty,lH=Object.getOwnPropertyNames,nH=Object.prototype.hasOwnProperty,rH=H8((q,_)=>{(function(j,K){typeof q==="object"&&typeof _!=="undefined"?K(q):typeof define==="function"&&define.amd?define(["exports"],K):K(j.URI=j.URI||{})})(q,function(j){function K(){for(var S=arguments.length,u=Array(S),R=0;R1){u[0]=u[0].slice(0,-1);var p=u.length-1;for(var n=1;n= 0x80 (not a basic code point)","invalid-input":"Invalid input"},L=H-X,m=Math.floor,I=String.fromCharCode;function d(S){throw new RangeError(c[S])}function r(S,u){var R=[],p=S.length;while(p--)R[p]=u(S[p]);return R}function B(S,u){var R=S.split("@"),p="";if(R.length>1)p=R[0]+"@",S=R[1];S=S.replace(y,".");var n=S.split("."),s=r(n,u).join(".");return p+s}function U(S){var u=[],R=0,p=S.length;while(R=55296&&n<=56319&&R>1,u+=m(u/R);for(;u>L*A>>1;n+=H)u=m(u/L);return m(n+(L+1)*u/(u+G))},Y8=function S(u){var R=[],p=u.length,n=0,s=E,X8=V,h8=u.lastIndexOf(M);if(h8<0)h8=0;for(var b8=0;b8=128)d("not-basic");R.push(u.charCodeAt(b8))}for(var F8=h8>0?h8+1:0;F8=p)d("invalid-input");var p8=f8(u.charCodeAt(F8++));if(p8>=H||p8>m((k-n)/c8))d("overflow");n+=p8*c8;var V8=U8<=X8?X:U8>=X8+A?A:U8-X8;if(p8m(k/r8))d("overflow");c8*=r8}var S8=R.length+1;if(X8=v8(n-G8,S8,G8==0),m(n/S8)>k-s)d("overflow");s+=m(n/S8),n%=S8,R.splice(n++,0,s)}return String.fromCodePoint.apply(String,R)},m8=function S(u){var R=[];u=U(u);var p=u.length,n=E,s=0,X8=V,h8=!0,b8=!1,F8=void 0;try{for(var G8=u[Symbol.iterator](),c8;!(h8=(c8=G8.next()).done);h8=!0){var U8=c8.value;if(U8<128)R.push(I(U8))}}catch(Uq){b8=!0,F8=Uq}finally{try{if(!h8&&G8.return)G8.return()}finally{if(b8)throw F8}}var p8=R.length,V8=p8;if(p8)R.push(M);while(V8=n&&m6m((k-s)/i6))d("overflow");s+=(r8-n)*i6,n=r8;var Hq=!0,Fq=!1,hq=void 0;try{for(var ZK=u[Symbol.iterator](),h3;!(Hq=(h3=ZK.next()).done);Hq=!0){var D3=h3.value;if(D3k)d("overflow");if(D3==n){var u_=s;for(var h_=H;;h_+=H){var Dq=h_<=X8?X:h_>=X8+A?A:h_-X8;if(u_>6|192).toString(16).toUpperCase()+"%"+(u&63|128).toString(16).toUpperCase();else R="%"+(u>>12|224).toString(16).toUpperCase()+"%"+(u>>6&63|128).toString(16).toUpperCase()+"%"+(u&63|128).toString(16).toUpperCase();return R}function N(S){var u="",R=0,p=S.length;while(R=194&&n<224){if(p-R>=6){var s=parseInt(S.substr(R+4,2),16);u+=String.fromCharCode((n&31)<<6|s&63)}else u+=S.substr(R,6);R+=6}else if(n>=224){if(p-R>=9){var X8=parseInt(S.substr(R+4,2),16),h8=parseInt(S.substr(R+7,2),16);u+=String.fromCharCode((n&15)<<12|(X8&63)<<6|h8&63)}else u+=S.substr(R,9);R+=9}else u+=S.substr(R,3),R+=3}return u}function l(S,u){function R(p){var n=N(p);return!n.match(u.UNRESERVED)?p:n}if(S.scheme)S.scheme=String(S.scheme).replace(u.PCT_ENCODED,R).toLowerCase().replace(u.NOT_SCHEME,"");if(S.userinfo!==void 0)S.userinfo=String(S.userinfo).replace(u.PCT_ENCODED,R).replace(u.NOT_USERINFO,T).replace(u.PCT_ENCODED,P);if(S.host!==void 0)S.host=String(S.host).replace(u.PCT_ENCODED,R).toLowerCase().replace(u.NOT_HOST,T).replace(u.PCT_ENCODED,P);if(S.path!==void 0)S.path=String(S.path).replace(u.PCT_ENCODED,R).replace(S.scheme?u.NOT_PATH:u.NOT_PATH_NOSCHEME,T).replace(u.PCT_ENCODED,P);if(S.query!==void 0)S.query=String(S.query).replace(u.PCT_ENCODED,R).replace(u.NOT_QUERY,T).replace(u.PCT_ENCODED,P);if(S.fragment!==void 0)S.fragment=String(S.fragment).replace(u.PCT_ENCODED,R).replace(u.NOT_FRAGMENT,T).replace(u.PCT_ENCODED,P);return S}function i(S){return S.replace(/^0*(.*)/,"$1")||"0"}function x(S,u){var R=S.match(u.IPV4ADDRESS)||[],p=W(R,2),n=p[1];if(n)return n.split(".").map(i).join(".");else return S}function o(S,u){var R=S.match(u.IPV6ADDRESS)||[],p=W(R,3),n=p[1],s=p[2];if(n){var X8=n.toLowerCase().split("::").reverse(),h8=W(X8,2),b8=h8[0],F8=h8[1],G8=F8?F8.split(":").map(i):[],c8=b8.split(":").map(i),U8=u.IPV4ADDRESS.test(c8[c8.length-1]),p8=U8?7:8,V8=c8.length-p8,r8=Array(p8);for(var S8=0;S81){var I8=r8.slice(0,R6.index),m6=r8.slice(R6.index+R6.length);r6=I8.join(":")+"::"+m6.join(":")}else r6=r8.join(":");if(s)r6+="%"+s;return r6}else return S}var j8=/^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i,W8="".match(/(){0}/)[1]===void 0;function $8(S){var u=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},R={},p=u.iri!==!1?z:v;if(u.reference==="suffix")S=(u.scheme?u.scheme+":":"")+"//"+S;var n=S.match(j8);if(n){if(W8){if(R.scheme=n[1],R.userinfo=n[3],R.host=n[4],R.port=parseInt(n[5],10),R.path=n[6]||"",R.query=n[7],R.fragment=n[8],isNaN(R.port))R.port=n[5]}else if(R.scheme=n[1]||void 0,R.userinfo=S.indexOf("@")!==-1?n[3]:void 0,R.host=S.indexOf("//")!==-1?n[4]:void 0,R.port=parseInt(n[5],10),R.path=n[6]||"",R.query=S.indexOf("?")!==-1?n[7]:void 0,R.fragment=S.indexOf("#")!==-1?n[8]:void 0,isNaN(R.port))R.port=S.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/)?n[4]:void 0;if(R.host)R.host=o(x(R.host,p),p);if(R.scheme===void 0&&R.userinfo===void 0&&R.host===void 0&&R.port===void 0&&!R.path&&R.query===void 0)R.reference="same-document";else if(R.scheme===void 0)R.reference="relative";else if(R.fragment===void 0)R.reference="absolute";else R.reference="uri";if(u.reference&&u.reference!=="suffix"&&u.reference!==R.reference)R.error=R.error||"URI is not a "+u.reference+" reference.";var s=C[(u.scheme||R.scheme||"").toLowerCase()];if(!u.unicodeSupport&&(!s||!s.unicodeSupport)){if(R.host&&(u.domainHost||s&&s.domainHost))try{R.host=D.toASCII(R.host.replace(p.PCT_ENCODED,N).toLowerCase())}catch(X8){R.error=R.error||"Host's domain name can not be converted to ASCII via punycode: "+X8}l(R,v)}else l(R,p);if(s&&s.parse)s.parse(R,u)}else R.error=R.error||"URI can not be parsed.";return R}function A8(S,u){var R=u.iri!==!1?z:v,p=[];if(S.userinfo!==void 0)p.push(S.userinfo),p.push("@");if(S.host!==void 0)p.push(o(x(String(S.host),R),R).replace(R.IPV6ADDRESS,function(n,s,X8){return"["+s+(X8?"%25"+X8:"")+"]"}));if(typeof S.port==="number"||typeof S.port==="string")p.push(":"),p.push(String(S.port));return p.length?p.join(""):void 0}var y8=/^\.\.?\//,C8=/^\/\.(\/|$)/,O6=/^\/\.\.(\/|$)/,o8=/^\/?(?:.|\n)*?(?=\/|$)/;function G6(S){var u=[];while(S.length)if(S.match(y8))S=S.replace(y8,"");else if(S.match(C8))S=S.replace(C8,"/");else if(S.match(O6))S=S.replace(O6,"/"),u.pop();else if(S==="."||S==="..")S="";else{var R=S.match(o8);if(R){var p=R[0];S=S.slice(p.length),u.push(p)}else throw new Error("Unexpected dot segment condition")}return u.join("")}function d8(S){var u=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},R=u.iri?z:v,p=[],n=C[(u.scheme||S.scheme||"").toLowerCase()];if(n&&n.serialize)n.serialize(S,u);if(S.host){if(R.IPV6ADDRESS.test(S.host));else if(u.domainHost||n&&n.domainHost)try{S.host=!u.iri?D.toASCII(S.host.replace(R.PCT_ENCODED,N).toLowerCase()):D.toUnicode(S.host)}catch(h8){S.error=S.error||"Host's domain name can not be converted to "+(!u.iri?"ASCII":"Unicode")+" via punycode: "+h8}}if(l(S,R),u.reference!=="suffix"&&S.scheme)p.push(S.scheme),p.push(":");var s=A8(S,u);if(s!==void 0){if(u.reference!=="suffix")p.push("//");if(p.push(s),S.path&&S.path.charAt(0)!=="/")p.push("/")}if(S.path!==void 0){var X8=S.path;if(!u.absolutePath&&(!n||!n.absolutePath))X8=G6(X8);if(s===void 0)X8=X8.replace(/^\/\//,"/%2F");p.push(X8)}if(S.query!==void 0)p.push("?"),p.push(S.query);if(S.fragment!==void 0)p.push("#"),p.push(S.fragment);return p.join("")}function P6(S,u){var R=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},p=arguments[3],n={};if(!p)S=$8(d8(S,R),R),u=$8(d8(u,R),R);if(R=R||{},!R.tolerant&&u.scheme)n.scheme=u.scheme,n.userinfo=u.userinfo,n.host=u.host,n.port=u.port,n.path=G6(u.path||""),n.query=u.query;else{if(u.userinfo!==void 0||u.host!==void 0||u.port!==void 0)n.userinfo=u.userinfo,n.host=u.host,n.port=u.port,n.path=G6(u.path||""),n.query=u.query;else{if(!u.path)if(n.path=S.path,u.query!==void 0)n.query=u.query;else n.query=S.query;else{if(u.path.charAt(0)==="/")n.path=G6(u.path);else{if((S.userinfo!==void 0||S.host!==void 0||S.port!==void 0)&&!S.path)n.path="/"+u.path;else if(!S.path)n.path=u.path;else n.path=S.path.slice(0,S.path.lastIndexOf("/")+1)+u.path;n.path=G6(n.path)}n.query=u.query}n.userinfo=S.userinfo,n.host=S.host,n.port=S.port}n.scheme=S.scheme}return n.fragment=u.fragment,n}function c6(S,u,R){var p=O({scheme:"null"},R);return d8(P6($8(S,p),$8(u,p),p,!0),p)}function E6(S,u){if(typeof S==="string")S=d8($8(S,u),u);else if(f(S)==="object")S=$8(d8(S,u),u);return S}function u3(S,u,R){if(typeof S==="string")S=d8($8(S,R),R);else if(f(S)==="object")S=d8(S,R);if(typeof u==="string")u=d8($8(u,R),R);else if(f(u)==="object")u=d8(u,R);return S===u}function p7(S,u){return S&&S.toString().replace(!u||!u.iri?v.ESCAPE:z.ESCAPE,T)}function Kq(S,u){return S&&S.toString().replace(!u||!u.iri?v.PCT_ENCODED:z.PCT_ENCODED,N)}var HK={scheme:"http",domainHost:!0,parse:function S(u,R){if(!u.host)u.error=u.error||"HTTP URIs must have a host.";return u},serialize:function S(u,R){var p=String(u.scheme).toLowerCase()==="https";if(u.port===(p?443:80)||u.port==="")u.port=void 0;if(!u.path)u.path="/";return u}},E9={scheme:"https",domainHost:HK.domainHost,parse:HK.parse,serialize:HK.serialize};function R9(S){return typeof S.secure==="boolean"?S.secure:String(S.scheme).toLowerCase()==="wss"}var TK={scheme:"ws",domainHost:!0,parse:function S(u,R){var p=u;return p.secure=R9(p),p.resourceName=(p.path||"/")+(p.query?"?"+p.query:""),p.path=void 0,p.query=void 0,p},serialize:function S(u,R){if(u.port===(R9(u)?443:80)||u.port==="")u.port=void 0;if(typeof u.secure==="boolean")u.scheme=u.secure?"wss":"ws",u.secure=void 0;if(u.resourceName){var p=u.resourceName.split("?"),n=W(p,2),s=n[0],X8=n[1];u.path=s&&s!=="/"?s:void 0,u.query=X8,u.resourceName=void 0}return u.fragment=void 0,u}},m9={scheme:"wss",domainHost:TK.domainHost,parse:TK.parse,serialize:TK.serialize},b$={},S$=!0,I9="[A-Za-z0-9\\-\\.\\_\\~"+(S$?"\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF":"")+"]",Jq="[0-9A-Fa-f]",E$=Y(Y("%[EFef]"+Jq+"%"+Jq+Jq+"%"+Jq+Jq)+"|"+Y("%[89A-Fa-f]"+Jq+"%"+Jq+Jq)+"|"+Y("%"+Jq+Jq)),R$="[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]",m$="[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]",I$=K(m$,"[\\\"\\\\]"),g$="[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]",y$=new RegExp(I9,"g"),G_=new RegExp(E$,"g"),d$=new RegExp(K("[^]",R$,"[\\.]","[\\\"]",I$),"g"),g9=new RegExp(K("[^]",I9,g$),"g"),p$=g9;function L7(S){var u=N(S);return!u.match(y$)?S:u}var y9={scheme:"mailto",parse:function S(u,R){var p=u,n=p.to=p.path?p.path.split(","):[];if(p.path=void 0,p.query){var s=!1,X8={},h8=p.query.split("&");for(var b8=0,F8=h8.length;b8{_.exports=function j(K,Y){if(K===Y)return!0;if(K&&Y&&typeof K=="object"&&typeof Y=="object"){if(K.constructor!==Y.constructor)return!1;var f,P,$;if(Array.isArray(K)){if(f=K.length,f!=Y.length)return!1;for(P=f;P--!==0;)if(!j(K[P],Y[P]))return!1;return!0}if(K.constructor===RegExp)return K.source===Y.source&&K.flags===Y.flags;if(K.valueOf!==Object.prototype.valueOf)return K.valueOf()===Y.valueOf();if(K.toString!==Object.prototype.toString)return K.toString()===Y.toString();if($=Object.keys(K),f=$.length,f!==Object.keys(Y).length)return!1;for(P=f;P--!==0;)if(!Object.prototype.hasOwnProperty.call(Y,$[P]))return!1;for(P=f;P--!==0;){var O=$[P];if(!j(K[O],Y[O]))return!1}return!0}return K!==K&&Y!==Y}}),iH=H8((q,_)=>{_.exports=function j(K){var Y=0,f=K.length,P=0,$;while(P=55296&&$<=56319&&P{_.exports={copy:j,checkDataType:K,checkDataTypes:Y,coerceToTypes:P,toHash:$,getProperty:v,escapeQuotes:z,equal:F4(),ucs2length:iH(),varOccurences:W,varReplace:J,schemaHasRules:k,schemaHasRulesExcept:H,schemaUnknownRules:X,toQuotedString:A,getPathExpr:G,getPath:h,getData:M,unescapeFragment:g,unescapeJsonPointer:L,escapeFragment:y,escapeJsonPointer:c};function j(m,I){I=I||{};for(var d in m)I[d]=m[d];return I}function K(m,I,d,r){var B=r?" !== ":" === ",U=r?" || ":" && ",w8=r?"!":"",f8=r?"":"!";switch(m){case"null":return I+B+"null";case"array":return w8+"Array.isArray("+I+")";case"object":return"("+w8+I+U+"typeof "+I+B+'"object"'+U+f8+"Array.isArray("+I+"))";case"integer":return"(typeof "+I+B+'"number"'+U+f8+"("+I+" % 1)"+U+I+B+I+(d?U+w8+"isFinite("+I+")":"")+")";case"number":return"(typeof "+I+B+'"'+m+'"'+(d?U+w8+"isFinite("+I+")":"")+")";default:return"typeof "+I+B+'"'+m+'"'}}function Y(m,I,d){switch(m.length){case 1:return K(m[0],I,d,!0);default:var r="",B=$(m);if(B.array&&B.object)r=B.null?"(":"(!"+I+" || ",r+="typeof "+I+' !== "object")',delete B.null,delete B.array,delete B.object;if(B.number)delete B.integer;for(var U in B)r+=(r?" && ":"")+K(U,I,d,!0);return r}}var f=$(["string","number","integer","boolean","null"]);function P(m,I){if(Array.isArray(I)){var d=[];for(var r=0;r=I)throw new Error("Cannot access property/index "+r+" levels up, current level is "+I);return d[I-r]}if(r>I)throw new Error("Cannot access data "+r+" levels up, current level is "+I);if(U="data"+(I-r||""),!B)return U}var f8=U,T8=B.split("/");for(var v8=0;v8{var j=Q_();_.exports=K;function K(Y){j.copy(Y,this)}}),oH=H8((q,_)=>{var j=_.exports=function(f,P,$){if(typeof P=="function")$=P,P={};$=P.cb||$;var O=typeof $=="function"?$:$.pre||function(){},w=$.post||function(){};K(P,O,w,f,"",f)};j.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0},j.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0},j.propsKeywords={definitions:!0,properties:!0,patternProperties:!0,dependencies:!0},j.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};function K(f,P,$,O,w,v,z,W,J,k){if(O&&typeof O=="object"&&!Array.isArray(O)){P(O,w,v,z,W,J,k);for(var H in O){var X=O[H];if(Array.isArray(X)){if(H in j.arrayKeywords)for(var A=0;A{var j=rH(),K=F4(),Y=Q_(),f=y1(),P=oH();_.exports=$,$.normalizeId=h,$.fullPath=X,$.url=V,$.ids=E,$.inlineRef=J,$.schema=O;function $(M,b,g){var y=this._refs[g];if(typeof y=="string")if(this._refs[y])y=this._refs[y];else return $.call(this,M,b,y);if(y=y||this._schemas[g],y instanceof f)return J(y.schema,this._opts.inlineRefs)?y.schema:y.validate||this._compile(y);var c=O.call(this,b,g),L,m,I;if(c)L=c.schema,b=c.root,I=c.baseId;if(L instanceof f)m=L.validate||M.call(this,L.schema,b,void 0,I);else if(L!==void 0)m=J(L,this._opts.inlineRefs)?L:M.call(this,L,b,void 0,I);return m}function O(M,b){var g=j.parse(b),y=A(g),c=X(this._getId(M.schema));if(Object.keys(M.schema).length===0||y!==c){var L=h(y),m=this._refs[L];if(typeof m=="string")return w.call(this,M,m,g);else if(m instanceof f){if(!m.validate)this._compile(m);M=m}else if(m=this._schemas[L],m instanceof f){if(!m.validate)this._compile(m);if(L==h(b))return{schema:m,root:M,baseId:c};M=m}else return;if(!M.schema)return;c=X(this._getId(M.schema))}return z.call(this,g,c,M.schema,M)}function w(M,b,g){var y=O.call(this,M,b);if(y){var{schema:c,baseId:L}=y;M=y.root;var m=this._getId(c);if(m)L=V(L,m);return z.call(this,g,L,c,M)}}var v=Y.toHash(["properties","patternProperties","enum","dependencies","definitions"]);function z(M,b,g,y){if(M.fragment=M.fragment||"",M.fragment.slice(0,1)!="/")return;var c=M.fragment.split("/");for(var L=1;L{var j=U4();_.exports={Validation:f(K),MissingRef:f(Y)};function K(P){this.message="validation failed",this.errors=P,this.ajv=this.validation=!0}Y.message=function(P,$){return"can't resolve reference "+$+" from id "+P};function Y(P,$,O){this.message=O||Y.message(P,$),this.missingRef=j.url(P,$),this.missingSchema=j.normalizeId(j.fullPath(this.missingRef))}function f(P){return P.prototype=Object.create(Error.prototype),P.prototype.constructor=P,P}}),d1=H8((q,_)=>{_.exports=function(j,K){if(!K)K={};if(typeof K==="function")K={cmp:K};var Y=typeof K.cycles==="boolean"?K.cycles:!1,f=K.cmp&&function($){return function(O){return function(w,v){var z={key:w,value:O[w]},W={key:v,value:O[v]};return $(z,W)}}}(K.cmp),P=[];return function $(O){if(O&&O.toJSON&&typeof O.toJSON==="function")O=O.toJSON();if(O===void 0)return;if(typeof O=="number")return isFinite(O)?""+O:"null";if(typeof O!=="object")return JSON.stringify(O);var w,v;if(Array.isArray(O)){v="[";for(w=0;w{_.exports=function j(K,Y,f){var P="",$=K.schema.$async===!0,O=K.util.schemaHasRulesExcept(K.schema,K.RULES.all,"$ref"),w=K.self._getId(K.schema);if(K.opts.strictKeywords){var v=K.util.schemaUnknownRules(K.schema,K.RULES.keywords);if(v){var z="unknown keyword: "+v;if(K.opts.strictKeywords==="log")K.logger.warn(z);else throw new Error(z)}}if(K.isTop){if(P+=" var validate = ",$)K.async=!0,P+="async ";if(P+="function(data, dataPath, parentData, parentDataProperty, rootData) { 'use strict'; ",w&&(K.opts.sourceCode||K.opts.processCode))P+=" "+("/*# sourceURL="+w+" */")+" "}if(typeof K.schema=="boolean"||!(O||K.schema.$ref)){var Y="false schema",W=K.level,J=K.dataLevel,k=K.schema[Y],H=K.schemaPath+K.util.getProperty(Y),X=K.errSchemaPath+"/"+Y,b=!K.opts.allErrors,c,A="data"+(J||""),M="valid"+W;if(K.schema===!1){if(K.isTop)b=!0;else P+=" var "+M+" = false; ";var G=G||[];if(G.push(P),P="",K.createErrors!==!1){if(P+=" { keyword: '"+(c||"false schema")+"' , dataPath: (dataPath || '') + "+K.errorPath+" , schemaPath: "+K.util.toQuotedString(X)+" , params: {} ",K.opts.messages!==!1)P+=" , message: 'boolean schema is false' ";if(K.opts.verbose)P+=" , schema: false , parentSchema: validate.schema"+K.schemaPath+" , data: "+A+" ";P+=" } "}else P+=" {} ";var h=P;if(P=G.pop(),!K.compositeRule&&b)if(K.async)P+=" throw new ValidationError(["+h+"]); ";else P+=" validate.errors = ["+h+"]; return false; ";else P+=" var err = "+h+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}else if(K.isTop)if($)P+=" return data; ";else P+=" validate.errors = null; return true; ";else P+=" var "+M+" = true; ";if(K.isTop)P+=" }; return validate; ";return P}if(K.isTop){var V=K.isTop,W=K.level=0,J=K.dataLevel=0,A="data";if(K.rootId=K.resolve.fullPath(K.self._getId(K.root.schema)),K.baseId=K.baseId||K.rootId,delete K.isTop,K.dataPathArr=[""],K.schema.default!==void 0&&K.opts.useDefaults&&K.opts.strictDefaults){var E="default is ignored in the schema root";if(K.opts.strictDefaults==="log")K.logger.warn(E);else throw new Error(E)}P+=" var vErrors = null; ",P+=" var errors = 0; ",P+=" if (rootData === undefined) rootData = data; "}else{var{level:W,dataLevel:J}=K,A="data"+(J||"");if(w)K.baseId=K.resolve.url(K.baseId,w);if($&&!K.async)throw new Error("async schema in sync schema");P+=" var errs_"+W+" = errors;"}var M="valid"+W,b=!K.opts.allErrors,g="",y="",c,L=K.schema.type,m=Array.isArray(L);if(L&&K.opts.nullable&&K.schema.nullable===!0){if(m){if(L.indexOf("null")==-1)L=L.concat("null")}else if(L!="null")L=[L,"null"],m=!0}if(m&&L.length==1)L=L[0],m=!1;if(K.schema.$ref&&O){if(K.opts.extendRefs=="fail")throw new Error('$ref: validation keywords used in schema at path "'+K.errSchemaPath+'" (see option extendRefs)');else if(K.opts.extendRefs!==!0)O=!1,K.logger.warn('$ref: keywords ignored in schema at path "'+K.errSchemaPath+'"')}if(K.schema.$comment&&K.opts.$comment)P+=" "+K.RULES.all.$comment.code(K,"$comment");if(L){if(K.opts.coerceTypes)var I=K.util.coerceToTypes(K.opts.coerceTypes,L);var d=K.RULES.types[L];if(I||m||d===!0||d&&!o8(d)){var H=K.schemaPath+".type",X=K.errSchemaPath+"/type",H=K.schemaPath+".type",X=K.errSchemaPath+"/type",r=m?"checkDataTypes":"checkDataType";if(P+=" if ("+K.util[r](L,A,K.opts.strictNumbers,!0)+") { ",I){var B="dataType"+W,U="coerced"+W;if(P+=" var "+B+" = typeof "+A+"; var "+U+" = undefined; ",K.opts.coerceTypes=="array")P+=" if ("+B+" == 'object' && Array.isArray("+A+") && "+A+".length == 1) { "+A+" = "+A+"[0]; "+B+" = typeof "+A+"; if ("+K.util.checkDataType(K.schema.type,A,K.opts.strictNumbers)+") "+U+" = "+A+"; } ";P+=" if ("+U+" !== undefined) ; ";var w8=I;if(w8){var f8,T8=-1,v8=w8.length-1;while(T8{var j=U4(),K=Q_(),Y=s4(),f=d1(),P=p1(),$=K.ucs2length,O=F4(),w=Y.Validation;_.exports=v;function v(h,V,E,M){var b=this,g=this._opts,y=[void 0],c={},L=[],m={},I=[],d={},r=[];V=V||{schema:h,refVal:y,refs:c};var B=z.call(this,h,V,M),U=this._compilations[B.index];if(B.compiling)return U.callValidate=Y8;var w8=this._formats,f8=this.RULES;try{var T8=m8(h,V,E,M);U.validate=T8;var v8=U.callValidate;if(v8){if(v8.schema=T8.schema,v8.errors=null,v8.refs=T8.refs,v8.refVal=T8.refVal,v8.root=T8.root,v8.$async=T8.$async,g.sourceCode)v8.source=T8.source}return T8}finally{W.call(this,h,V,M)}function Y8(){var x=U.validate,o=x.apply(this,arguments);return Y8.errors=x.errors,o}function m8(x,o,j8,W8){var $8=!o||o&&o.schema==x;if(o.schema!=V.schema)return v.call(b,x,o,j8,W8);var A8=x.$async===!0,y8=P({isTop:!0,schema:x,isRoot:$8,baseId:W8,root:o,schemaPath:"",errSchemaPath:"#",errorPath:'""',MissingRefError:Y.MissingRef,RULES:f8,validate:P,util:K,resolve:j,resolveRef:j6,usePattern:N,useDefault:l,useCustomRule:i,opts:g,formats:w8,logger:b.logger,self:b});if(y8=G(y,X)+G(L,k)+G(I,H)+G(r,A)+y8,g.processCode)y8=g.processCode(y8,x);var C8;try{var O6=new Function("self","RULES","formats","root","refVal","defaults","customRules","equal","ucs2length","ValidationError",y8);C8=O6(b,f8,w8,V,y,I,r,O,$,w),y[0]=C8}catch(o8){throw b.logger.error("Error compiling schema, function code:",y8),o8}if(C8.schema=x,C8.errors=null,C8.refs=c,C8.refVal=y,C8.root=$8?C8:o,A8)C8.$async=!0;if(g.sourceCode===!0)C8.source={code:y8,patterns:L,defaults:I};return C8}function j6(x,o,j8){o=j.url(x,o);var W8=c[o],$8,A8;if(W8!==void 0)return $8=y[W8],A8="refVal["+W8+"]",T($8,A8);if(!j8&&V.refs){var y8=V.refs[o];if(y8!==void 0)return $8=V.refVal[y8],A8=q6(o,$8),T($8,A8)}A8=q6(o);var C8=j.call(b,m8,V,o);if(C8===void 0){var O6=E&&E[o];if(O6)C8=j.inlineRef(O6,g.inlineRefs)?O6:v.call(b,O6,V,E,x)}if(C8===void 0)D(o);else return C(o,C8),T(C8,A8)}function q6(x,o){var j8=y.length;return y[j8]=o,c[x]=j8,"refVal"+j8}function D(x){delete c[x]}function C(x,o){var j8=c[x];y[j8]=o}function T(x,o){return typeof x=="object"||typeof x=="boolean"?{code:o,schema:x,inline:!0}:{code:o,$async:x&&!!x.$async}}function N(x){var o=m[x];if(o===void 0)o=m[x]=L.length,L[o]=x;return"pattern"+o}function l(x){switch(typeof x){case"boolean":case"number":return""+x;case"string":return K.toQuotedString(x);case"object":if(x===null)return"null";var o=f(x),j8=d[o];if(j8===void 0)j8=d[o]=I.length,I[j8]=x;return"default"+j8}}function i(x,o,j8,W8){if(b._opts.validateSchema!==!1){var $8=x.definition.dependencies;if($8&&!$8.every(function(c6){return Object.prototype.hasOwnProperty.call(j8,c6)}))throw new Error("parent schema must have all required keywords: "+$8.join(","));var A8=x.definition.validateSchema;if(A8){var y8=A8(o);if(!y8){var C8="keyword schema is invalid: "+b.errorsText(A8.errors);if(b._opts.validateSchema=="log")b.logger.error(C8);else throw new Error(C8)}}}var O6=x.definition.compile,o8=x.definition.inline,G6=x.definition.macro,d8;if(O6)d8=O6.call(b,o,j8,W8);else if(G6){if(d8=G6.call(b,o,j8,W8),g.validateSchema!==!1)b.validateSchema(d8,!0)}else if(o8)d8=o8.call(b,W8,x.keyword,o,j8);else if(d8=x.definition.validate,!d8)return;if(d8===void 0)throw new Error('custom keyword "'+x.keyword+'"failed to compile');var P6=r.length;return r[P6]=d8,{code:"customRule"+P6,validate:d8}}}function z(h,V,E){var M=J.call(this,h,V,E);if(M>=0)return{index:M,compiling:!0};return M=this._compilations.length,this._compilations[M]={schema:h,root:V,baseId:E},{index:M,compiling:!1}}function W(h,V,E){var M=J.call(this,h,V,E);if(M>=0)this._compilations.splice(M,1)}function J(h,V,E){for(var M=0;M{var j=_.exports=function K(){this._cache={}};j.prototype.put=function K(Y,f){this._cache[Y]=f},j.prototype.get=function K(Y){return this._cache[Y]},j.prototype.del=function K(Y){delete this._cache[Y]},j.prototype.clear=function K(){this._cache={}}}),tH=H8((q,_)=>{var j=Q_(),K=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,Y=[0,31,28,31,30,31,30,31,31,30,31,30,31],f=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i,P=/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,$=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,O=/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,w=/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,v=/^(?:(?:http[s\u017F]?|ftp):\/\/)(?:(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+(?::(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?@)?(?:(?!10(?:\.[0-9]{1,3}){3})(?!127(?:\.[0-9]{1,3}){3})(?!169\.254(?:\.[0-9]{1,3}){2})(?!192\.168(?:\.[0-9]{1,3}){2})(?!172\.(?:1[6-9]|2[0-9]|3[01])(?:\.[0-9]{1,3}){2})(?:[1-9][0-9]?|1[0-9][0-9]|2[01][0-9]|22[0-3])(?:\.(?:1?[0-9]{1,2}|2[0-4][0-9]|25[0-5])){2}(?:\.(?:[1-9][0-9]?|1[0-9][0-9]|2[0-4][0-9]|25[0-4]))|(?:(?:(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-)*(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)(?:\.(?:(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-)*(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)*(?:\.(?:(?:[a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]){2,})))(?::[0-9]{2,5})?(?:\/(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?$/i,z=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,W=/^(?:\/(?:[^~/]|~0|~1)*)*$/,J=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,k=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/;_.exports=H;function H(y){return y=y=="full"?"full":"fast",j.copy(H[y])}H.fast={date:/^\d\d\d\d-[0-1]\d-[0-3]\d$/,time:/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,"date-time":/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,"uri-template":w,url:v,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i,hostname:P,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,ipv6:/^\s*(?:(?:(?:[0-9a-f]{1,4}:){7}(?:[0-9a-f]{1,4}|:))|(?:(?:[0-9a-f]{1,4}:){6}(?::[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){5}(?:(?:(?::[0-9a-f]{1,4}){1,2})|:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){4}(?:(?:(?::[0-9a-f]{1,4}){1,3})|(?:(?::[0-9a-f]{1,4})?:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){3}(?:(?:(?::[0-9a-f]{1,4}){1,4})|(?:(?::[0-9a-f]{1,4}){0,2}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){2}(?:(?:(?::[0-9a-f]{1,4}){1,5})|(?:(?::[0-9a-f]{1,4}){0,3}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){1}(?:(?:(?::[0-9a-f]{1,4}){1,6})|(?:(?::[0-9a-f]{1,4}){0,4}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?::(?:(?:(?::[0-9a-f]{1,4}){1,7})|(?:(?::[0-9a-f]{1,4}){0,5}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(?:%.+)?\s*$/i,regex:g,uuid:z,"json-pointer":W,"json-pointer-uri-fragment":J,"relative-json-pointer":k},H.full={date:A,time:G,"date-time":V,uri:M,"uri-reference":O,"uri-template":w,url:v,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:P,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,ipv6:/^\s*(?:(?:(?:[0-9a-f]{1,4}:){7}(?:[0-9a-f]{1,4}|:))|(?:(?:[0-9a-f]{1,4}:){6}(?::[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){5}(?:(?:(?::[0-9a-f]{1,4}){1,2})|:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){4}(?:(?:(?::[0-9a-f]{1,4}){1,3})|(?:(?::[0-9a-f]{1,4})?:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){3}(?:(?:(?::[0-9a-f]{1,4}){1,4})|(?:(?::[0-9a-f]{1,4}){0,2}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){2}(?:(?:(?::[0-9a-f]{1,4}){1,5})|(?:(?::[0-9a-f]{1,4}){0,3}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){1}(?:(?:(?::[0-9a-f]{1,4}){1,6})|(?:(?::[0-9a-f]{1,4}){0,4}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?::(?:(?:(?::[0-9a-f]{1,4}){1,7})|(?:(?::[0-9a-f]{1,4}){0,5}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(?:%.+)?\s*$/i,regex:g,uuid:z,"json-pointer":W,"json-pointer-uri-fragment":J,"relative-json-pointer":k};function X(y){return y%4===0&&(y%100!==0||y%400===0)}function A(y){var c=y.match(K);if(!c)return!1;var L=+c[1],m=+c[2],I=+c[3];return m>=1&&m<=12&&I>=1&&I<=(m==2&&X(L)?29:Y[m])}function G(y,c){var L=y.match(f);if(!L)return!1;var m=L[1],I=L[2],d=L[3],r=L[5];return(m<=23&&I<=59&&d<=59||m==23&&I==59&&d==60)&&(!c||r)}var h=/t|\s/i;function V(y){var c=y.split(h);return c.length==2&&A(c[0])&&G(c[1],!0)}var E=/\/|:/;function M(y){return E.test(y)&&$.test(y)}var b=/[^\\]\\Z/;function g(y){if(b.test(y))return!1;try{return new RegExp(y),!0}catch(c){return!1}}}),eH=H8((q,_)=>{_.exports=function j(K,Y,f){var P=" ",$=K.level,O=K.dataLevel,w=K.schema[Y],v=K.errSchemaPath+"/"+Y,z=!K.opts.allErrors,W="data"+(O||""),J="valid"+$,k,H;if(w=="#"||w=="#/")if(K.isRoot)k=K.async,H="validate";else k=K.root.schema.$async===!0,H="root.refVal[0]";else{var X=K.resolveRef(K.baseId,w,K.isRoot);if(X===void 0){var A=K.MissingRefError.message(K.baseId,w);if(K.opts.missingRefs=="fail"){K.logger.error(A);var G=G||[];if(G.push(P),P="",K.createErrors!==!1){if(P+=" { keyword: '$ref' , dataPath: (dataPath || '') + "+K.errorPath+" , schemaPath: "+K.util.toQuotedString(v)+" , params: { ref: '"+K.util.escapeQuotes(w)+"' } ",K.opts.messages!==!1)P+=" , message: 'can\\'t resolve reference "+K.util.escapeQuotes(w)+"' ";if(K.opts.verbose)P+=" , schema: "+K.util.toQuotedString(w)+" , parentSchema: validate.schema"+K.schemaPath+" , data: "+W+" ";P+=" } "}else P+=" {} ";var h=P;if(P=G.pop(),!K.compositeRule&&z)if(K.async)P+=" throw new ValidationError(["+h+"]); ";else P+=" validate.errors = ["+h+"]; return false; ";else P+=" var err = "+h+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(z)P+=" if (false) { "}else if(K.opts.missingRefs=="ignore"){if(K.logger.warn(A),z)P+=" if (true) { "}else throw new K.MissingRefError(K.baseId,w,A)}else if(X.inline){var V=K.util.copy(K);V.level++;var E="valid"+V.level;V.schema=X.schema,V.schemaPath="",V.errSchemaPath=w;var M=K.validate(V).replace(/validate\.schema/g,X.code);if(P+=" "+M+" ",z)P+=" if ("+E+") { "}else k=X.$async===!0||K.async&&X.$async!==!1,H=X.code}if(H){var G=G||[];if(G.push(P),P="",K.opts.passContext)P+=" "+H+".call(this, ";else P+=" "+H+"( ";if(P+=" "+W+", (dataPath || '')",K.errorPath!='""')P+=" + "+K.errorPath;var b=O?"data"+(O-1||""):"parentData",g=O?K.dataPathArr[O]:"parentDataProperty";P+=" , "+b+" , "+g+", rootData) ";var y=P;if(P=G.pop(),k){if(!K.async)throw new Error("async schema referenced by sync schema");if(z)P+=" var "+J+"; ";if(P+=" try { await "+y+"; ",z)P+=" "+J+" = true; ";if(P+=" } catch (e) { if (!(e instanceof ValidationError)) throw e; if (vErrors === null) vErrors = e.errors; else vErrors = vErrors.concat(e.errors); errors = vErrors.length; ",z)P+=" "+J+" = false; ";if(P+=" } ",z)P+=" if ("+J+") { "}else if(P+=" if (!"+y+") { if (vErrors === null) vErrors = "+H+".errors; else vErrors = vErrors.concat("+H+".errors); errors = vErrors.length; } ",z)P+=" else { "}return P}}),FH=H8((q,_)=>{_.exports=function j(K,Y,f){var P=" ",$=K.schema[Y],O=K.schemaPath+K.util.getProperty(Y),w=K.errSchemaPath+"/"+Y,v=!K.opts.allErrors,z=K.util.copy(K),W="";z.level++;var J="valid"+z.level,k=z.baseId,H=!0,X=$;if(X){var A,G=-1,h=X.length-1;while(G0||A===!1:K.util.schemaHasRules(A,K.RULES.all)){if(H=!1,z.schema=A,z.schemaPath=O+"["+G+"]",z.errSchemaPath=w+"/"+G,P+=" "+K.validate(z)+" ",z.baseId=k,v)P+=" if ("+J+") { ",W+="}"}}if(v)if(H)P+=" if (true) { ";else P+=" "+W.slice(0,-1)+" ";return P}}),UH=H8((q,_)=>{_.exports=function j(K,Y,f){var P=" ",$=K.level,O=K.dataLevel,w=K.schema[Y],v=K.schemaPath+K.util.getProperty(Y),z=K.errSchemaPath+"/"+Y,W=!K.opts.allErrors,J="data"+(O||""),k="valid"+$,H="errs__"+$,X=K.util.copy(K),A="";X.level++;var G="valid"+X.level,h=w.every(function(c){return K.opts.strictKeywords?typeof c=="object"&&Object.keys(c).length>0||c===!1:K.util.schemaHasRules(c,K.RULES.all)});if(h){var V=X.baseId;P+=" var "+H+" = errors; var "+k+" = false; ";var E=K.compositeRule;K.compositeRule=X.compositeRule=!0;var M=w;if(M){var b,g=-1,y=M.length-1;while(g{_.exports=function j(K,Y,f){var P=" ",$=K.schema[Y],O=K.errSchemaPath+"/"+Y,w=!K.opts.allErrors,v=K.util.toQuotedString($);if(K.opts.$comment===!0)P+=" console.log("+v+");";else if(typeof K.opts.$comment=="function")P+=" self._opts.$comment("+v+", "+K.util.toQuotedString(O)+", validate.root.schema);";return P}}),QH=H8((q,_)=>{_.exports=function j(K,Y,f){var P=" ",$=K.level,O=K.dataLevel,w=K.schema[Y],v=K.schemaPath+K.util.getProperty(Y),z=K.errSchemaPath+"/"+Y,W=!K.opts.allErrors,J="data"+(O||""),k="valid"+$,H=K.opts.$data&&w&&w.$data,X;if(H)P+=" var schema"+$+" = "+K.util.getData(w.$data,O,K.dataPathArr)+"; ",X="schema"+$;else X=w;if(!H)P+=" var schema"+$+" = validate.schema"+v+";";P+="var "+k+" = equal("+J+", schema"+$+"); if (!"+k+") { ";var A=A||[];if(A.push(P),P="",K.createErrors!==!1){if(P+=" { keyword: 'const' , dataPath: (dataPath || '') + "+K.errorPath+" , schemaPath: "+K.util.toQuotedString(z)+" , params: { allowedValue: schema"+$+" } ",K.opts.messages!==!1)P+=" , message: 'should be equal to constant' ";if(K.opts.verbose)P+=" , schema: validate.schema"+v+" , parentSchema: validate.schema"+K.schemaPath+" , data: "+J+" ";P+=" } "}else P+=" {} ";var G=P;if(P=A.pop(),!K.compositeRule&&W)if(K.async)P+=" throw new ValidationError(["+G+"]); ";else P+=" validate.errors = ["+G+"]; return false; ";else P+=" var err = "+G+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(P+=" }",W)P+=" else { ";return P}}),qT=H8((q,_)=>{_.exports=function j(K,Y,f){var P=" ",$=K.level,O=K.dataLevel,w=K.schema[Y],v=K.schemaPath+K.util.getProperty(Y),z=K.errSchemaPath+"/"+Y,W=!K.opts.allErrors,J="data"+(O||""),k="valid"+$,H="errs__"+$,X=K.util.copy(K),A="";X.level++;var G="valid"+X.level,h="i"+$,V=X.dataLevel=K.dataLevel+1,E="data"+V,M=K.baseId,b=K.opts.strictKeywords?typeof w=="object"&&Object.keys(w).length>0||w===!1:K.util.schemaHasRules(w,K.RULES.all);if(P+="var "+H+" = errors;var "+k+";",b){var g=K.compositeRule;K.compositeRule=X.compositeRule=!0,X.schema=w,X.schemaPath=v,X.errSchemaPath=z,P+=" var "+G+" = false; for (var "+h+" = 0; "+h+" < "+J+".length; "+h+"++) { ",X.errorPath=K.util.getPathExpr(K.errorPath,h,K.opts.jsonPointers,!0);var y=J+"["+h+"]";X.dataPathArr[V]=h;var c=K.validate(X);if(X.baseId=M,K.util.varOccurences(c,E)<2)P+=" "+K.util.varReplace(c,E,y)+" ";else P+=" var "+E+" = "+y+"; "+c+" ";P+=" if ("+G+") break; } ",K.compositeRule=X.compositeRule=g,P+=" "+A+" if (!"+G+") {"}else P+=" if ("+J+".length == 0) {";var L=L||[];if(L.push(P),P="",K.createErrors!==!1){if(P+=" { keyword: 'contains' , dataPath: (dataPath || '') + "+K.errorPath+" , schemaPath: "+K.util.toQuotedString(z)+" , params: {} ",K.opts.messages!==!1)P+=" , message: 'should contain a valid item' ";if(K.opts.verbose)P+=" , schema: validate.schema"+v+" , parentSchema: validate.schema"+K.schemaPath+" , data: "+J+" ";P+=" } "}else P+=" {} ";var m=P;if(P=L.pop(),!K.compositeRule&&W)if(K.async)P+=" throw new ValidationError(["+m+"]); ";else P+=" validate.errors = ["+m+"]; return false; ";else P+=" var err = "+m+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(P+=" } else { ",b)P+=" errors = "+H+"; if (vErrors !== null) { if ("+H+") vErrors.length = "+H+"; else vErrors = null; } ";if(K.opts.allErrors)P+=" } ";return P}}),_T=H8((q,_)=>{_.exports=function j(K,Y,f){var P=" ",$=K.level,O=K.dataLevel,w=K.schema[Y],v=K.schemaPath+K.util.getProperty(Y),z=K.errSchemaPath+"/"+Y,W=!K.opts.allErrors,J="data"+(O||""),k="errs__"+$,H=K.util.copy(K),X="";H.level++;var A="valid"+H.level,G={},h={},V=K.opts.ownProperties;for(g in w){if(g=="__proto__")continue;var E=w[g],M=Array.isArray(E)?h:G;M[g]=E}P+="var "+k+" = errors;";var b=K.errorPath;P+="var missing"+$+";";for(var g in h)if(M=h[g],M.length){if(P+=" if ( "+J+K.util.getProperty(g)+" !== undefined ",V)P+=" && Object.prototype.hasOwnProperty.call("+J+", '"+K.util.escapeQuotes(g)+"') ";if(W){P+=" && ( ";var y=M;if(y){var c,L=-1,m=y.length-1;while(L0||E===!1:K.util.schemaHasRules(E,K.RULES.all)){if(P+=" "+A+" = true; if ( "+J+K.util.getProperty(g)+" !== undefined ",V)P+=" && Object.prototype.hasOwnProperty.call("+J+", '"+K.util.escapeQuotes(g)+"') ";if(P+=") { ",H.schema=E,H.schemaPath=v+K.util.getProperty(g),H.errSchemaPath=z+"/"+K.util.escapeFragment(g),P+=" "+K.validate(H)+" ",H.baseId=Y8,P+=" } ",W)P+=" if ("+A+") { ",X+="}"}}if(W)P+=" "+X+" if ("+k+" == errors) {";return P}}),KT=H8((q,_)=>{_.exports=function j(K,Y,f){var P=" ",$=K.level,O=K.dataLevel,w=K.schema[Y],v=K.schemaPath+K.util.getProperty(Y),z=K.errSchemaPath+"/"+Y,W=!K.opts.allErrors,J="data"+(O||""),k="valid"+$,H=K.opts.$data&&w&&w.$data,X;if(H)P+=" var schema"+$+" = "+K.util.getData(w.$data,O,K.dataPathArr)+"; ",X="schema"+$;else X=w;var A="i"+$,G="schema"+$;if(!H)P+=" var "+G+" = validate.schema"+v+";";if(P+="var "+k+";",H)P+=" if (schema"+$+" === undefined) "+k+" = true; else if (!Array.isArray(schema"+$+")) "+k+" = false; else {";if(P+=""+k+" = false;for (var "+A+"=0; "+A+"<"+G+".length; "+A+"++) if (equal("+J+", "+G+"["+A+"])) { "+k+" = true; break; }",H)P+=" } ";P+=" if (!"+k+") { ";var h=h||[];if(h.push(P),P="",K.createErrors!==!1){if(P+=" { keyword: 'enum' , dataPath: (dataPath || '') + "+K.errorPath+" , schemaPath: "+K.util.toQuotedString(z)+" , params: { allowedValues: schema"+$+" } ",K.opts.messages!==!1)P+=" , message: 'should be equal to one of the allowed values' ";if(K.opts.verbose)P+=" , schema: validate.schema"+v+" , parentSchema: validate.schema"+K.schemaPath+" , data: "+J+" ";P+=" } "}else P+=" {} ";var V=P;if(P=h.pop(),!K.compositeRule&&W)if(K.async)P+=" throw new ValidationError(["+V+"]); ";else P+=" validate.errors = ["+V+"]; return false; ";else P+=" var err = "+V+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(P+=" }",W)P+=" else { ";return P}}),jT=H8((q,_)=>{_.exports=function j(K,Y,f){var P=" ",$=K.level,O=K.dataLevel,w=K.schema[Y],v=K.schemaPath+K.util.getProperty(Y),z=K.errSchemaPath+"/"+Y,W=!K.opts.allErrors,J="data"+(O||"");if(K.opts.format===!1){if(W)P+=" if (true) { ";return P}var k=K.opts.$data&&w&&w.$data,H;if(k)P+=" var schema"+$+" = "+K.util.getData(w.$data,O,K.dataPathArr)+"; ",H="schema"+$;else H=w;var X=K.opts.unknownFormats,A=Array.isArray(X);if(k){var G="format"+$,h="isObject"+$,V="formatType"+$;if(P+=" var "+G+" = formats["+H+"]; var "+h+" = typeof "+G+" == 'object' && !("+G+" instanceof RegExp) && "+G+".validate; var "+V+" = "+h+" && "+G+".type || 'string'; if ("+h+") { ",K.async)P+=" var async"+$+" = "+G+".async; ";if(P+=" "+G+" = "+G+".validate; } if ( ",k)P+=" ("+H+" !== undefined && typeof "+H+" != 'string') || ";if(P+=" (",X!="ignore"){if(P+=" ("+H+" && !"+G+" ",A)P+=" && self._opts.unknownFormats.indexOf("+H+") == -1 ";P+=") || "}if(P+=" ("+G+" && "+V+" == '"+f+"' && !(typeof "+G+" == 'function' ? ",K.async)P+=" (async"+$+" ? await "+G+"("+J+") : "+G+"("+J+")) ";else P+=" "+G+"("+J+") ";P+=" : "+G+".test("+J+"))))) {"}else{var G=K.formats[w];if(!G)if(X=="ignore"){if(K.logger.warn('unknown format "'+w+'" ignored in schema at path "'+K.errSchemaPath+'"'),W)P+=" if (true) { ";return P}else if(A&&X.indexOf(w)>=0){if(W)P+=" if (true) { ";return P}else throw new Error('unknown format "'+w+'" is used in schema at path "'+K.errSchemaPath+'"');var h=typeof G=="object"&&!(G instanceof RegExp)&&G.validate,V=h&&G.type||"string";if(h){var E=G.async===!0;G=G.validate}if(V!=f){if(W)P+=" if (true) { ";return P}if(E){if(!K.async)throw new Error("async format in sync schema");var M="formats"+K.util.getProperty(w)+".validate";P+=" if (!(await "+M+"("+J+"))) { "}else{P+=" if (! ";var M="formats"+K.util.getProperty(w);if(h)M+=".validate";if(typeof G=="function")P+=" "+M+"("+J+") ";else P+=" "+M+".test("+J+") ";P+=") { "}}var b=b||[];if(b.push(P),P="",K.createErrors!==!1){if(P+=" { keyword: 'format' , dataPath: (dataPath || '') + "+K.errorPath+" , schemaPath: "+K.util.toQuotedString(z)+" , params: { format: ",k)P+=""+H;else P+=""+K.util.toQuotedString(w);if(P+=" } ",K.opts.messages!==!1){if(P+=` , message: 'should match format "`,k)P+="' + "+H+" + '";else P+=""+K.util.escapeQuotes(w);P+=`"' `}if(K.opts.verbose){if(P+=" , schema: ",k)P+="validate.schema"+v;else P+=""+K.util.toQuotedString(w);P+=" , parentSchema: validate.schema"+K.schemaPath+" , data: "+J+" "}P+=" } "}else P+=" {} ";var g=P;if(P=b.pop(),!K.compositeRule&&W)if(K.async)P+=" throw new ValidationError(["+g+"]); ";else P+=" validate.errors = ["+g+"]; return false; ";else P+=" var err = "+g+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(P+=" } ",W)P+=" else { ";return P}}),PT=H8((q,_)=>{_.exports=function j(K,Y,f){var P=" ",$=K.level,O=K.dataLevel,w=K.schema[Y],v=K.schemaPath+K.util.getProperty(Y),z=K.errSchemaPath+"/"+Y,W=!K.opts.allErrors,J="data"+(O||""),k="valid"+$,H="errs__"+$,X=K.util.copy(K);X.level++;var A="valid"+X.level,G=K.schema.then,h=K.schema.else,V=G!==void 0&&(K.opts.strictKeywords?typeof G=="object"&&Object.keys(G).length>0||G===!1:K.util.schemaHasRules(G,K.RULES.all)),E=h!==void 0&&(K.opts.strictKeywords?typeof h=="object"&&Object.keys(h).length>0||h===!1:K.util.schemaHasRules(h,K.RULES.all)),M=X.baseId;if(V||E){var b;X.createErrors=!1,X.schema=w,X.schemaPath=v,X.errSchemaPath=z,P+=" var "+H+" = errors; var "+k+" = true; ";var g=K.compositeRule;if(K.compositeRule=X.compositeRule=!0,P+=" "+K.validate(X)+" ",X.baseId=M,X.createErrors=!0,P+=" errors = "+H+"; if (vErrors !== null) { if ("+H+") vErrors.length = "+H+"; else vErrors = null; } ",K.compositeRule=X.compositeRule=g,V){if(P+=" if ("+A+") { ",X.schema=K.schema.then,X.schemaPath=K.schemaPath+".then",X.errSchemaPath=K.errSchemaPath+"/then",P+=" "+K.validate(X)+" ",X.baseId=M,P+=" "+k+" = "+A+"; ",V&&E)b="ifClause"+$,P+=" var "+b+" = 'then'; ";else b="'then'";if(P+=" } ",E)P+=" else { "}else P+=" if (!"+A+") { ";if(E){if(X.schema=K.schema.else,X.schemaPath=K.schemaPath+".else",X.errSchemaPath=K.errSchemaPath+"/else",P+=" "+K.validate(X)+" ",X.baseId=M,P+=" "+k+" = "+A+"; ",V&&E)b="ifClause"+$,P+=" var "+b+" = 'else'; ";else b="'else'";P+=" } "}if(P+=" if (!"+k+") { var err = ",K.createErrors!==!1){if(P+=" { keyword: 'if' , dataPath: (dataPath || '') + "+K.errorPath+" , schemaPath: "+K.util.toQuotedString(z)+" , params: { failingKeyword: "+b+" } ",K.opts.messages!==!1)P+=` , message: 'should match "' + `+b+` + '" schema' `;if(K.opts.verbose)P+=" , schema: validate.schema"+v+" , parentSchema: validate.schema"+K.schemaPath+" , data: "+J+" ";P+=" } "}else P+=" {} ";if(P+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!K.compositeRule&&W)if(K.async)P+=" throw new ValidationError(vErrors); ";else P+=" validate.errors = vErrors; return false; ";if(P+=" } ",W)P+=" else { "}else if(W)P+=" if (true) { ";return P}}),YT=H8((q,_)=>{_.exports=function j(K,Y,f){var P=" ",$=K.level,O=K.dataLevel,w=K.schema[Y],v=K.schemaPath+K.util.getProperty(Y),z=K.errSchemaPath+"/"+Y,W=!K.opts.allErrors,J="data"+(O||""),k="valid"+$,H="errs__"+$,X=K.util.copy(K),A="";X.level++;var G="valid"+X.level,h="i"+$,V=X.dataLevel=K.dataLevel+1,E="data"+V,M=K.baseId;if(P+="var "+H+" = errors;var "+k+";",Array.isArray(w)){var b=K.schema.additionalItems;if(b===!1){P+=" "+k+" = "+J+".length <= "+w.length+"; ";var g=z;z=K.errSchemaPath+"/additionalItems",P+=" if (!"+k+") { ";var y=y||[];if(y.push(P),P="",K.createErrors!==!1){if(P+=" { keyword: 'additionalItems' , dataPath: (dataPath || '') + "+K.errorPath+" , schemaPath: "+K.util.toQuotedString(z)+" , params: { limit: "+w.length+" } ",K.opts.messages!==!1)P+=" , message: 'should NOT have more than "+w.length+" items' ";if(K.opts.verbose)P+=" , schema: false , parentSchema: validate.schema"+K.schemaPath+" , data: "+J+" ";P+=" } "}else P+=" {} ";var c=P;if(P=y.pop(),!K.compositeRule&&W)if(K.async)P+=" throw new ValidationError(["+c+"]); ";else P+=" validate.errors = ["+c+"]; return false; ";else P+=" var err = "+c+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(P+=" } ",z=g,W)A+="}",P+=" else { "}var L=w;if(L){var m,I=-1,d=L.length-1;while(I0||m===!1:K.util.schemaHasRules(m,K.RULES.all)){P+=" "+G+" = true; if ("+J+".length > "+I+") { ";var r=J+"["+I+"]";X.schema=m,X.schemaPath=v+"["+I+"]",X.errSchemaPath=z+"/"+I,X.errorPath=K.util.getPathExpr(K.errorPath,I,K.opts.jsonPointers,!0),X.dataPathArr[V]=I;var B=K.validate(X);if(X.baseId=M,K.util.varOccurences(B,E)<2)P+=" "+K.util.varReplace(B,E,r)+" ";else P+=" var "+E+" = "+r+"; "+B+" ";if(P+=" } ",W)P+=" if ("+G+") { ",A+="}"}}if(typeof b=="object"&&(K.opts.strictKeywords?typeof b=="object"&&Object.keys(b).length>0||b===!1:K.util.schemaHasRules(b,K.RULES.all))){X.schema=b,X.schemaPath=K.schemaPath+".additionalItems",X.errSchemaPath=K.errSchemaPath+"/additionalItems",P+=" "+G+" = true; if ("+J+".length > "+w.length+") { for (var "+h+" = "+w.length+"; "+h+" < "+J+".length; "+h+"++) { ",X.errorPath=K.util.getPathExpr(K.errorPath,h,K.opts.jsonPointers,!0);var r=J+"["+h+"]";X.dataPathArr[V]=h;var B=K.validate(X);if(X.baseId=M,K.util.varOccurences(B,E)<2)P+=" "+K.util.varReplace(B,E,r)+" ";else P+=" var "+E+" = "+r+"; "+B+" ";if(W)P+=" if (!"+G+") break; ";if(P+=" } } ",W)P+=" if ("+G+") { ",A+="}"}}else if(K.opts.strictKeywords?typeof w=="object"&&Object.keys(w).length>0||w===!1:K.util.schemaHasRules(w,K.RULES.all)){X.schema=w,X.schemaPath=v,X.errSchemaPath=z,P+=" for (var "+h+" = 0; "+h+" < "+J+".length; "+h+"++) { ",X.errorPath=K.util.getPathExpr(K.errorPath,h,K.opts.jsonPointers,!0);var r=J+"["+h+"]";X.dataPathArr[V]=h;var B=K.validate(X);if(X.baseId=M,K.util.varOccurences(B,E)<2)P+=" "+K.util.varReplace(B,E,r)+" ";else P+=" var "+E+" = "+r+"; "+B+" ";if(W)P+=" if (!"+G+") break; ";P+=" }"}if(W)P+=" "+A+" if ("+H+" == errors) {";return P}}),V1=H8((q,_)=>{_.exports=function j(K,Y,f){var P=" ",$=K.level,O=K.dataLevel,w=K.schema[Y],v=K.schemaPath+K.util.getProperty(Y),z=K.errSchemaPath+"/"+Y,W=!K.opts.allErrors,M,J="data"+(O||""),k=K.opts.$data&&w&&w.$data,H;if(k)P+=" var schema"+$+" = "+K.util.getData(w.$data,O,K.dataPathArr)+"; ",H="schema"+$;else H=w;var X=Y=="maximum",A=X?"exclusiveMaximum":"exclusiveMinimum",G=K.schema[A],h=K.opts.$data&&G&&G.$data,V=X?"<":">",E=X?">":"<",M=void 0;if(!(k||typeof w=="number"||w===void 0))throw new Error(Y+" must be number");if(!(h||G===void 0||typeof G=="number"||typeof G=="boolean"))throw new Error(A+" must be number or boolean");if(h){var b=K.util.getData(G.$data,O,K.dataPathArr),g="exclusive"+$,y="exclType"+$,c="exclIsNumber"+$,L="op"+$,m="' + "+L+" + '";P+=" var schemaExcl"+$+" = "+b+"; ",b="schemaExcl"+$,P+=" var "+g+"; var "+y+" = typeof "+b+"; if ("+y+" != 'boolean' && "+y+" != 'undefined' && "+y+" != 'number') { ";var M=A,I=I||[];if(I.push(P),P="",K.createErrors!==!1){if(P+=" { keyword: '"+(M||"_exclusiveLimit")+"' , dataPath: (dataPath || '') + "+K.errorPath+" , schemaPath: "+K.util.toQuotedString(z)+" , params: {} ",K.opts.messages!==!1)P+=" , message: '"+A+" should be boolean' ";if(K.opts.verbose)P+=" , schema: validate.schema"+v+" , parentSchema: validate.schema"+K.schemaPath+" , data: "+J+" ";P+=" } "}else P+=" {} ";var d=P;if(P=I.pop(),!K.compositeRule&&W)if(K.async)P+=" throw new ValidationError(["+d+"]); ";else P+=" validate.errors = ["+d+"]; return false; ";else P+=" var err = "+d+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(P+=" } else if ( ",k)P+=" ("+H+" !== undefined && typeof "+H+" != 'number') || ";if(P+=" "+y+" == 'number' ? ( ("+g+" = "+H+" === undefined || "+b+" "+V+"= "+H+") ? "+J+" "+E+"= "+b+" : "+J+" "+E+" "+H+" ) : ( ("+g+" = "+b+" === true) ? "+J+" "+E+"= "+H+" : "+J+" "+E+" "+H+" ) || "+J+" !== "+J+") { var op"+$+" = "+g+" ? '"+V+"' : '"+V+"='; ",w===void 0)M=A,z=K.errSchemaPath+"/"+A,H=b,k=h}else{var c=typeof G=="number",m=V;if(c&&k){var L="'"+m+"'";if(P+=" if ( ",k)P+=" ("+H+" !== undefined && typeof "+H+" != 'number') || ";P+=" ( "+H+" === undefined || "+G+" "+V+"= "+H+" ? "+J+" "+E+"= "+G+" : "+J+" "+E+" "+H+" ) || "+J+" !== "+J+") { "}else{if(c&&w===void 0)g=!0,M=A,z=K.errSchemaPath+"/"+A,H=G,E+="=";else{if(c)H=Math[X?"min":"max"](G,w);if(G===(c?H:!0))g=!0,M=A,z=K.errSchemaPath+"/"+A,E+="=";else g=!1,m+="="}var L="'"+m+"'";if(P+=" if ( ",k)P+=" ("+H+" !== undefined && typeof "+H+" != 'number') || ";P+=" "+J+" "+E+" "+H+" || "+J+" !== "+J+") { "}}M=M||Y;var I=I||[];if(I.push(P),P="",K.createErrors!==!1){if(P+=" { keyword: '"+(M||"_limit")+"' , dataPath: (dataPath || '') + "+K.errorPath+" , schemaPath: "+K.util.toQuotedString(z)+" , params: { comparison: "+L+", limit: "+H+", exclusive: "+g+" } ",K.opts.messages!==!1)if(P+=" , message: 'should be "+m+" ",k)P+="' + "+H;else P+=""+H+"'";if(K.opts.verbose){if(P+=" , schema: ",k)P+="validate.schema"+v;else P+=""+w;P+=" , parentSchema: validate.schema"+K.schemaPath+" , data: "+J+" "}P+=" } "}else P+=" {} ";var d=P;if(P=I.pop(),!K.compositeRule&&W)if(K.async)P+=" throw new ValidationError(["+d+"]); ";else P+=" validate.errors = ["+d+"]; return false; ";else P+=" var err = "+d+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(P+=" } ",W)P+=" else { ";return P}}),M1=H8((q,_)=>{_.exports=function j(K,Y,f){var P=" ",$=K.level,O=K.dataLevel,w=K.schema[Y],v=K.schemaPath+K.util.getProperty(Y),z=K.errSchemaPath+"/"+Y,W=!K.opts.allErrors,A,J="data"+(O||""),k=K.opts.$data&&w&&w.$data,H;if(k)P+=" var schema"+$+" = "+K.util.getData(w.$data,O,K.dataPathArr)+"; ",H="schema"+$;else H=w;if(!(k||typeof w=="number"))throw new Error(Y+" must be number");var X=Y=="maxItems"?">":"<";if(P+="if ( ",k)P+=" ("+H+" !== undefined && typeof "+H+" != 'number') || ";P+=" "+J+".length "+X+" "+H+") { ";var A=Y,G=G||[];if(G.push(P),P="",K.createErrors!==!1){if(P+=" { keyword: '"+(A||"_limitItems")+"' , dataPath: (dataPath || '') + "+K.errorPath+" , schemaPath: "+K.util.toQuotedString(z)+" , params: { limit: "+H+" } ",K.opts.messages!==!1){if(P+=" , message: 'should NOT have ",Y=="maxItems")P+="more";else P+="fewer";if(P+=" than ",k)P+="' + "+H+" + '";else P+=""+w;P+=" items' "}if(K.opts.verbose){if(P+=" , schema: ",k)P+="validate.schema"+v;else P+=""+w;P+=" , parentSchema: validate.schema"+K.schemaPath+" , data: "+J+" "}P+=" } "}else P+=" {} ";var h=P;if(P=G.pop(),!K.compositeRule&&W)if(K.async)P+=" throw new ValidationError(["+h+"]); ";else P+=" validate.errors = ["+h+"]; return false; ";else P+=" var err = "+h+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(P+="} ",W)P+=" else { ";return P}}),N1=H8((q,_)=>{_.exports=function j(K,Y,f){var P=" ",$=K.level,O=K.dataLevel,w=K.schema[Y],v=K.schemaPath+K.util.getProperty(Y),z=K.errSchemaPath+"/"+Y,W=!K.opts.allErrors,A,J="data"+(O||""),k=K.opts.$data&&w&&w.$data,H;if(k)P+=" var schema"+$+" = "+K.util.getData(w.$data,O,K.dataPathArr)+"; ",H="schema"+$;else H=w;if(!(k||typeof w=="number"))throw new Error(Y+" must be number");var X=Y=="maxLength"?">":"<";if(P+="if ( ",k)P+=" ("+H+" !== undefined && typeof "+H+" != 'number') || ";if(K.opts.unicode===!1)P+=" "+J+".length ";else P+=" ucs2length("+J+") ";P+=" "+X+" "+H+") { ";var A=Y,G=G||[];if(G.push(P),P="",K.createErrors!==!1){if(P+=" { keyword: '"+(A||"_limitLength")+"' , dataPath: (dataPath || '') + "+K.errorPath+" , schemaPath: "+K.util.toQuotedString(z)+" , params: { limit: "+H+" } ",K.opts.messages!==!1){if(P+=" , message: 'should NOT be ",Y=="maxLength")P+="longer";else P+="shorter";if(P+=" than ",k)P+="' + "+H+" + '";else P+=""+w;P+=" characters' "}if(K.opts.verbose){if(P+=" , schema: ",k)P+="validate.schema"+v;else P+=""+w;P+=" , parentSchema: validate.schema"+K.schemaPath+" , data: "+J+" "}P+=" } "}else P+=" {} ";var h=P;if(P=G.pop(),!K.compositeRule&&W)if(K.async)P+=" throw new ValidationError(["+h+"]); ";else P+=" validate.errors = ["+h+"]; return false; ";else P+=" var err = "+h+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(P+="} ",W)P+=" else { ";return P}}),b1=H8((q,_)=>{_.exports=function j(K,Y,f){var P=" ",$=K.level,O=K.dataLevel,w=K.schema[Y],v=K.schemaPath+K.util.getProperty(Y),z=K.errSchemaPath+"/"+Y,W=!K.opts.allErrors,A,J="data"+(O||""),k=K.opts.$data&&w&&w.$data,H;if(k)P+=" var schema"+$+" = "+K.util.getData(w.$data,O,K.dataPathArr)+"; ",H="schema"+$;else H=w;if(!(k||typeof w=="number"))throw new Error(Y+" must be number");var X=Y=="maxProperties"?">":"<";if(P+="if ( ",k)P+=" ("+H+" !== undefined && typeof "+H+" != 'number') || ";P+=" Object.keys("+J+").length "+X+" "+H+") { ";var A=Y,G=G||[];if(G.push(P),P="",K.createErrors!==!1){if(P+=" { keyword: '"+(A||"_limitProperties")+"' , dataPath: (dataPath || '') + "+K.errorPath+" , schemaPath: "+K.util.toQuotedString(z)+" , params: { limit: "+H+" } ",K.opts.messages!==!1){if(P+=" , message: 'should NOT have ",Y=="maxProperties")P+="more";else P+="fewer";if(P+=" than ",k)P+="' + "+H+" + '";else P+=""+w;P+=" properties' "}if(K.opts.verbose){if(P+=" , schema: ",k)P+="validate.schema"+v;else P+=""+w;P+=" , parentSchema: validate.schema"+K.schemaPath+" , data: "+J+" "}P+=" } "}else P+=" {} ";var h=P;if(P=G.pop(),!K.compositeRule&&W)if(K.async)P+=" throw new ValidationError(["+h+"]); ";else P+=" validate.errors = ["+h+"]; return false; ";else P+=" var err = "+h+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(P+="} ",W)P+=" else { ";return P}}),fT=H8((q,_)=>{_.exports=function j(K,Y,f){var P=" ",$=K.level,O=K.dataLevel,w=K.schema[Y],v=K.schemaPath+K.util.getProperty(Y),z=K.errSchemaPath+"/"+Y,W=!K.opts.allErrors,J="data"+(O||""),k=K.opts.$data&&w&&w.$data,H;if(k)P+=" var schema"+$+" = "+K.util.getData(w.$data,O,K.dataPathArr)+"; ",H="schema"+$;else H=w;if(!(k||typeof w=="number"))throw new Error(Y+" must be number");if(P+="var division"+$+";if (",k)P+=" "+H+" !== undefined && ( typeof "+H+" != 'number' || ";if(P+=" (division"+$+" = "+J+" / "+H+", ",K.opts.multipleOfPrecision)P+=" Math.abs(Math.round(division"+$+") - division"+$+") > 1e-"+K.opts.multipleOfPrecision+" ";else P+=" division"+$+" !== parseInt(division"+$+") ";if(P+=" ) ",k)P+=" ) ";P+=" ) { ";var X=X||[];if(X.push(P),P="",K.createErrors!==!1){if(P+=" { keyword: 'multipleOf' , dataPath: (dataPath || '') + "+K.errorPath+" , schemaPath: "+K.util.toQuotedString(z)+" , params: { multipleOf: "+H+" } ",K.opts.messages!==!1)if(P+=" , message: 'should be multiple of ",k)P+="' + "+H;else P+=""+H+"'";if(K.opts.verbose){if(P+=" , schema: ",k)P+="validate.schema"+v;else P+=""+w;P+=" , parentSchema: validate.schema"+K.schemaPath+" , data: "+J+" "}P+=" } "}else P+=" {} ";var A=P;if(P=X.pop(),!K.compositeRule&&W)if(K.async)P+=" throw new ValidationError(["+A+"]); ";else P+=" validate.errors = ["+A+"]; return false; ";else P+=" var err = "+A+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(P+="} ",W)P+=" else { ";return P}}),$T=H8((q,_)=>{_.exports=function j(K,Y,f){var P=" ",$=K.level,O=K.dataLevel,w=K.schema[Y],v=K.schemaPath+K.util.getProperty(Y),z=K.errSchemaPath+"/"+Y,W=!K.opts.allErrors,J="data"+(O||""),k="errs__"+$,H=K.util.copy(K);H.level++;var X="valid"+H.level;if(K.opts.strictKeywords?typeof w=="object"&&Object.keys(w).length>0||w===!1:K.util.schemaHasRules(w,K.RULES.all)){H.schema=w,H.schemaPath=v,H.errSchemaPath=z,P+=" var "+k+" = errors; ";var A=K.compositeRule;K.compositeRule=H.compositeRule=!0,H.createErrors=!1;var G;if(H.opts.allErrors)G=H.opts.allErrors,H.opts.allErrors=!1;if(P+=" "+K.validate(H)+" ",H.createErrors=!0,G)H.opts.allErrors=G;K.compositeRule=H.compositeRule=A,P+=" if ("+X+") { ";var h=h||[];if(h.push(P),P="",K.createErrors!==!1){if(P+=" { keyword: 'not' , dataPath: (dataPath || '') + "+K.errorPath+" , schemaPath: "+K.util.toQuotedString(z)+" , params: {} ",K.opts.messages!==!1)P+=" , message: 'should NOT be valid' ";if(K.opts.verbose)P+=" , schema: validate.schema"+v+" , parentSchema: validate.schema"+K.schemaPath+" , data: "+J+" ";P+=" } "}else P+=" {} ";var V=P;if(P=h.pop(),!K.compositeRule&&W)if(K.async)P+=" throw new ValidationError(["+V+"]); ";else P+=" validate.errors = ["+V+"]; return false; ";else P+=" var err = "+V+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(P+=" } else { errors = "+k+"; if (vErrors !== null) { if ("+k+") vErrors.length = "+k+"; else vErrors = null; } ",K.opts.allErrors)P+=" } "}else{if(P+=" var err = ",K.createErrors!==!1){if(P+=" { keyword: 'not' , dataPath: (dataPath || '') + "+K.errorPath+" , schemaPath: "+K.util.toQuotedString(z)+" , params: {} ",K.opts.messages!==!1)P+=" , message: 'should NOT be valid' ";if(K.opts.verbose)P+=" , schema: validate.schema"+v+" , parentSchema: validate.schema"+K.schemaPath+" , data: "+J+" ";P+=" } "}else P+=" {} ";if(P+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",W)P+=" if (false) { "}return P}}),wT=H8((q,_)=>{_.exports=function j(K,Y,f){var P=" ",$=K.level,O=K.dataLevel,w=K.schema[Y],v=K.schemaPath+K.util.getProperty(Y),z=K.errSchemaPath+"/"+Y,W=!K.opts.allErrors,J="data"+(O||""),k="valid"+$,H="errs__"+$,X=K.util.copy(K),A="";X.level++;var G="valid"+X.level,h=X.baseId,V="prevValid"+$,E="passingSchemas"+$;P+="var "+H+" = errors , "+V+" = false , "+k+" = false , "+E+" = null; ";var M=K.compositeRule;K.compositeRule=X.compositeRule=!0;var b=w;if(b){var g,y=-1,c=b.length-1;while(y0||g===!1:K.util.schemaHasRules(g,K.RULES.all))X.schema=g,X.schemaPath=v+"["+y+"]",X.errSchemaPath=z+"/"+y,P+=" "+K.validate(X)+" ",X.baseId=h;else P+=" var "+G+" = true; ";if(y)P+=" if ("+G+" && "+V+") { "+k+" = false; "+E+" = ["+E+", "+y+"]; } else { ",A+="}";P+=" if ("+G+") { "+k+" = "+V+" = true; "+E+" = "+y+"; }"}}if(K.compositeRule=X.compositeRule=M,P+=""+A+"if (!"+k+") { var err = ",K.createErrors!==!1){if(P+=" { keyword: 'oneOf' , dataPath: (dataPath || '') + "+K.errorPath+" , schemaPath: "+K.util.toQuotedString(z)+" , params: { passingSchemas: "+E+" } ",K.opts.messages!==!1)P+=" , message: 'should match exactly one schema in oneOf' ";if(K.opts.verbose)P+=" , schema: validate.schema"+v+" , parentSchema: validate.schema"+K.schemaPath+" , data: "+J+" ";P+=" } "}else P+=" {} ";if(P+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!K.compositeRule&&W)if(K.async)P+=" throw new ValidationError(vErrors); ";else P+=" validate.errors = vErrors; return false; ";if(P+="} else { errors = "+H+"; if (vErrors !== null) { if ("+H+") vErrors.length = "+H+"; else vErrors = null; }",K.opts.allErrors)P+=" } ";return P}}),OT=H8((q,_)=>{_.exports=function j(K,Y,f){var P=" ",$=K.level,O=K.dataLevel,w=K.schema[Y],v=K.schemaPath+K.util.getProperty(Y),z=K.errSchemaPath+"/"+Y,W=!K.opts.allErrors,J="data"+(O||""),k=K.opts.$data&&w&&w.$data,H;if(k)P+=" var schema"+$+" = "+K.util.getData(w.$data,O,K.dataPathArr)+"; ",H="schema"+$;else H=w;var X=k?"(new RegExp("+H+"))":K.usePattern(w);if(P+="if ( ",k)P+=" ("+H+" !== undefined && typeof "+H+" != 'string') || ";P+=" !"+X+".test("+J+") ) { ";var A=A||[];if(A.push(P),P="",K.createErrors!==!1){if(P+=" { keyword: 'pattern' , dataPath: (dataPath || '') + "+K.errorPath+" , schemaPath: "+K.util.toQuotedString(z)+" , params: { pattern: ",k)P+=""+H;else P+=""+K.util.toQuotedString(w);if(P+=" } ",K.opts.messages!==!1){if(P+=` , message: 'should match pattern "`,k)P+="' + "+H+" + '";else P+=""+K.util.escapeQuotes(w);P+=`"' `}if(K.opts.verbose){if(P+=" , schema: ",k)P+="validate.schema"+v;else P+=""+K.util.toQuotedString(w);P+=" , parentSchema: validate.schema"+K.schemaPath+" , data: "+J+" "}P+=" } "}else P+=" {} ";var G=P;if(P=A.pop(),!K.compositeRule&&W)if(K.async)P+=" throw new ValidationError(["+G+"]); ";else P+=" validate.errors = ["+G+"]; return false; ";else P+=" var err = "+G+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(P+="} ",W)P+=" else { ";return P}}),vT=H8((q,_)=>{_.exports=function j(K,Y,f){var P=" ",$=K.level,O=K.dataLevel,w=K.schema[Y],v=K.schemaPath+K.util.getProperty(Y),z=K.errSchemaPath+"/"+Y,W=!K.opts.allErrors,J="data"+(O||""),k="errs__"+$,H=K.util.copy(K),X="";H.level++;var A="valid"+H.level,G="key"+$,h="idx"+$,V=H.dataLevel=K.dataLevel+1,E="data"+V,M="dataProperties"+$,b=Object.keys(w||{}).filter(T8),g=K.schema.patternProperties||{},y=Object.keys(g).filter(T8),c=K.schema.additionalProperties,L=b.length||y.length,m=c===!1,I=typeof c=="object"&&Object.keys(c).length,d=K.opts.removeAdditional,r=m||I||d,B=K.opts.ownProperties,U=K.baseId,w8=K.schema.required;if(w8&&!(K.opts.$data&&w8.$data)&&w8.length8)P+=" || validate.schema"+v+".hasOwnProperty("+G+") ";else{var v8=b;if(v8){var Y8,m8=-1,j6=v8.length-1;while(m80||o8===!1:K.util.schemaHasRules(o8,K.RULES.all)){var G6=K.util.getProperty(Y8),W8=J+G6,d8=A8&&o8.default!==void 0;H.schema=o8,H.schemaPath=v+G6,H.errSchemaPath=z+"/"+K.util.escapeFragment(Y8),H.errorPath=K.util.getPath(K.errorPath,Y8,K.opts.jsonPointers),H.dataPathArr[V]=K.util.toQuotedString(Y8);var $8=K.validate(H);if(H.baseId=U,K.util.varOccurences($8,E)<2){$8=K.util.varReplace($8,E,W8);var P6=W8}else{var P6=E;P+=" var "+E+" = "+W8+"; "}if(d8)P+=" "+$8+" ";else{if(f8&&f8[Y8]){if(P+=" if ( "+P6+" === undefined ",B)P+=" || ! Object.prototype.hasOwnProperty.call("+J+", '"+K.util.escapeQuotes(Y8)+"') ";P+=") { "+A+" = false; ";var N=K.errorPath,i=z,c6=K.util.escapeQuotes(Y8);if(K.opts._errorDataPathProperty)K.errorPath=K.util.getPath(N,Y8,K.opts.jsonPointers);z=K.errSchemaPath+"/required";var x=x||[];if(x.push(P),P="",K.createErrors!==!1){if(P+=" { keyword: 'required' , dataPath: (dataPath || '') + "+K.errorPath+" , schemaPath: "+K.util.toQuotedString(z)+" , params: { missingProperty: '"+c6+"' } ",K.opts.messages!==!1){if(P+=" , message: '",K.opts._errorDataPathProperty)P+="is a required property";else P+="should have required property \\'"+c6+"\\'";P+="' "}if(K.opts.verbose)P+=" , schema: validate.schema"+v+" , parentSchema: validate.schema"+K.schemaPath+" , data: "+J+" ";P+=" } "}else P+=" {} ";var o=P;if(P=x.pop(),!K.compositeRule&&W)if(K.async)P+=" throw new ValidationError(["+o+"]); ";else P+=" validate.errors = ["+o+"]; return false; ";else P+=" var err = "+o+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";z=i,K.errorPath=N,P+=" } else { "}else if(W){if(P+=" if ( "+P6+" === undefined ",B)P+=" || ! Object.prototype.hasOwnProperty.call("+J+", '"+K.util.escapeQuotes(Y8)+"') ";P+=") { "+A+" = true; } else { "}else{if(P+=" if ("+P6+" !== undefined ",B)P+=" && Object.prototype.hasOwnProperty.call("+J+", '"+K.util.escapeQuotes(Y8)+"') ";P+=" ) { "}P+=" "+$8+" } "}}if(W)P+=" if ("+A+") { ",X+="}"}}}if(y.length){var E6=y;if(E6){var D,u3=-1,p7=E6.length-1;while(u30||o8===!1:K.util.schemaHasRules(o8,K.RULES.all)){if(H.schema=o8,H.schemaPath=K.schemaPath+".patternProperties"+K.util.getProperty(D),H.errSchemaPath=K.errSchemaPath+"/patternProperties/"+K.util.escapeFragment(D),B)P+=" "+M+" = "+M+" || Object.keys("+J+"); for (var "+h+"=0; "+h+"<"+M+".length; "+h+"++) { var "+G+" = "+M+"["+h+"]; ";else P+=" for (var "+G+" in "+J+") { ";P+=" if ("+K.usePattern(D)+".test("+G+")) { ",H.errorPath=K.util.getPathExpr(K.errorPath,G,K.opts.jsonPointers);var W8=J+"["+G+"]";H.dataPathArr[V]=G;var $8=K.validate(H);if(H.baseId=U,K.util.varOccurences($8,E)<2)P+=" "+K.util.varReplace($8,E,W8)+" ";else P+=" var "+E+" = "+W8+"; "+$8+" ";if(W)P+=" if (!"+A+") break; ";if(P+=" } ",W)P+=" else "+A+" = true; ";if(P+=" } ",W)P+=" if ("+A+") { ",X+="}"}}}}if(W)P+=" "+X+" if ("+k+" == errors) {";return P}}),zT=H8((q,_)=>{_.exports=function j(K,Y,f){var P=" ",$=K.level,O=K.dataLevel,w=K.schema[Y],v=K.schemaPath+K.util.getProperty(Y),z=K.errSchemaPath+"/"+Y,W=!K.opts.allErrors,J="data"+(O||""),k="errs__"+$,H=K.util.copy(K),X="";H.level++;var A="valid"+H.level;if(P+="var "+k+" = errors;",K.opts.strictKeywords?typeof w=="object"&&Object.keys(w).length>0||w===!1:K.util.schemaHasRules(w,K.RULES.all)){H.schema=w,H.schemaPath=v,H.errSchemaPath=z;var G="key"+$,h="idx"+$,V="i"+$,E="' + "+G+" + '",M=H.dataLevel=K.dataLevel+1,b="data"+M,g="dataProperties"+$,y=K.opts.ownProperties,c=K.baseId;if(y)P+=" var "+g+" = undefined; ";if(y)P+=" "+g+" = "+g+" || Object.keys("+J+"); for (var "+h+"=0; "+h+"<"+g+".length; "+h+"++) { var "+G+" = "+g+"["+h+"]; ";else P+=" for (var "+G+" in "+J+") { ";P+=" var startErrs"+$+" = errors; ";var L=G,m=K.compositeRule;K.compositeRule=H.compositeRule=!0;var I=K.validate(H);if(H.baseId=c,K.util.varOccurences(I,b)<2)P+=" "+K.util.varReplace(I,b,L)+" ";else P+=" var "+b+" = "+L+"; "+I+" ";if(K.compositeRule=H.compositeRule=m,P+=" if (!"+A+") { for (var "+V+"=startErrs"+$+"; "+V+"{_.exports=function j(K,Y,f){var P=" ",$=K.level,O=K.dataLevel,w=K.schema[Y],v=K.schemaPath+K.util.getProperty(Y),z=K.errSchemaPath+"/"+Y,W=!K.opts.allErrors,J="data"+(O||""),k="valid"+$,H=K.opts.$data&&w&&w.$data,X;if(H)P+=" var schema"+$+" = "+K.util.getData(w.$data,O,K.dataPathArr)+"; ",X="schema"+$;else X=w;var A="schema"+$;if(!H)if(w.length0||b===!1:K.util.schemaHasRules(b,K.RULES.all))))G[G.length]=V}}}else var G=w;if(H||G.length){var g=K.errorPath,y=H||G.length>=K.opts.loopRequired,c=K.opts.ownProperties;if(W)if(P+=" var missing"+$+"; ",y){if(!H)P+=" var "+A+" = validate.schema"+v+"; ";var L="i"+$,m="schema"+$+"["+L+"]",I="' + "+m+" + '";if(K.opts._errorDataPathProperty)K.errorPath=K.util.getPathExpr(g,m,K.opts.jsonPointers);if(P+=" var "+k+" = true; ",H)P+=" if (schema"+$+" === undefined) "+k+" = true; else if (!Array.isArray(schema"+$+")) "+k+" = false; else {";if(P+=" for (var "+L+" = 0; "+L+" < "+A+".length; "+L+"++) { "+k+" = "+J+"["+A+"["+L+"]] !== undefined ",c)P+=" && Object.prototype.hasOwnProperty.call("+J+", "+A+"["+L+"]) ";if(P+="; if (!"+k+") break; } ",H)P+=" } ";P+=" if (!"+k+") { ";var d=d||[];if(d.push(P),P="",K.createErrors!==!1){if(P+=" { keyword: 'required' , dataPath: (dataPath || '') + "+K.errorPath+" , schemaPath: "+K.util.toQuotedString(z)+" , params: { missingProperty: '"+I+"' } ",K.opts.messages!==!1){if(P+=" , message: '",K.opts._errorDataPathProperty)P+="is a required property";else P+="should have required property \\'"+I+"\\'";P+="' "}if(K.opts.verbose)P+=" , schema: validate.schema"+v+" , parentSchema: validate.schema"+K.schemaPath+" , data: "+J+" ";P+=" } "}else P+=" {} ";var r=P;if(P=d.pop(),!K.compositeRule&&W)if(K.async)P+=" throw new ValidationError(["+r+"]); ";else P+=" validate.errors = ["+r+"]; return false; ";else P+=" var err = "+r+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";P+=" } else { "}else{P+=" if ( ";var B=G;if(B){var U,L=-1,w8=B.length-1;while(L{_.exports=function j(K,Y,f){var P=" ",$=K.level,O=K.dataLevel,w=K.schema[Y],v=K.schemaPath+K.util.getProperty(Y),z=K.errSchemaPath+"/"+Y,W=!K.opts.allErrors,J="data"+(O||""),k="valid"+$,H=K.opts.$data&&w&&w.$data,X;if(H)P+=" var schema"+$+" = "+K.util.getData(w.$data,O,K.dataPathArr)+"; ",X="schema"+$;else X=w;if((w||H)&&K.opts.uniqueItems!==!1){if(H)P+=" var "+k+"; if ("+X+" === false || "+X+" === undefined) "+k+" = true; else if (typeof "+X+" != 'boolean') "+k+" = false; else { ";P+=" var i = "+J+".length , "+k+" = true , j; if (i > 1) { ";var A=K.schema.items&&K.schema.items.type,G=Array.isArray(A);if(!A||A=="object"||A=="array"||G&&(A.indexOf("object")>=0||A.indexOf("array")>=0))P+=" outer: for (;i--;) { for (j = i; j--;) { if (equal("+J+"[i], "+J+"[j])) { "+k+" = false; break outer; } } } ";else{P+=" var itemIndices = {}, item; for (;i--;) { var item = "+J+"[i]; ";var h="checkDataType"+(G?"s":"");if(P+=" if ("+K.util[h](A,"item",K.opts.strictNumbers,!0)+") continue; ",G)P+=` if (typeof item == 'string') item = '"' + item; `;P+=" if (typeof itemIndices[item] == 'number') { "+k+" = false; j = itemIndices[item]; break; } itemIndices[item] = i; } "}if(P+=" } ",H)P+=" } ";P+=" if (!"+k+") { ";var V=V||[];if(V.push(P),P="",K.createErrors!==!1){if(P+=" { keyword: 'uniqueItems' , dataPath: (dataPath || '') + "+K.errorPath+" , schemaPath: "+K.util.toQuotedString(z)+" , params: { i: i, j: j } ",K.opts.messages!==!1)P+=" , message: 'should NOT have duplicate items (items ## ' + j + ' and ' + i + ' are identical)' ";if(K.opts.verbose){if(P+=" , schema: ",H)P+="validate.schema"+v;else P+=""+w;P+=" , parentSchema: validate.schema"+K.schemaPath+" , data: "+J+" "}P+=" } "}else P+=" {} ";var E=P;if(P=V.pop(),!K.compositeRule&&W)if(K.async)P+=" throw new ValidationError(["+E+"]); ";else P+=" validate.errors = ["+E+"]; return false; ";else P+=" var err = "+E+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(P+=" } ",W)P+=" else { "}else if(W)P+=" if (true) { ";return P}}),HT=H8((q,_)=>{_.exports={$ref:eH(),allOf:FH(),anyOf:UH(),$comment:sH(),const:QH(),contains:qT(),dependencies:_T(),enum:KT(),format:jT(),if:PT(),items:YT(),maximum:V1(),minimum:V1(),maxItems:M1(),minItems:M1(),maxLength:N1(),minLength:N1(),maxProperties:b1(),minProperties:b1(),multipleOf:fT(),not:$T(),oneOf:wT(),pattern:OT(),properties:vT(),propertyNames:zT(),required:WT(),uniqueItems:JT(),validate:p1()}}),TT=H8((q,_)=>{var j=HT(),K=Q_().toHash;_.exports=function Y(){var f=[{type:"number",rules:[{maximum:["exclusiveMaximum"]},{minimum:["exclusiveMinimum"]},"multipleOf","format"]},{type:"string",rules:["maxLength","minLength","pattern","format"]},{type:"array",rules:["maxItems","minItems","items","contains","uniqueItems"]},{type:"object",rules:["maxProperties","minProperties","required","dependencies","propertyNames",{properties:["additionalProperties","patternProperties"]}]},{rules:["$ref","const","enum","not","anyOf","oneOf","allOf","if"]}],P=["type","$comment"],$=["$schema","$id","id","$data","$async","title","description","default","definitions","examples","readOnly","writeOnly","contentMediaType","contentEncoding","additionalItems","then","else"],O=["number","integer","string","array","object","boolean","null"];return f.all=K(P),f.types=K(O),f.forEach(function(w){if(w.rules=w.rules.map(function(v){var z;if(typeof v=="object"){var W=Object.keys(v)[0];z=v[W],v=W,z.forEach(function(k){P.push(k),f.all[k]=!0})}P.push(v);var J=f.all[v]={keyword:v,code:j[v],implements:z};return J}),f.all.$comment={keyword:"$comment",code:j.$comment},w.type)f.types[w.type]=w}),f.keywords=K(P.concat($)),f.custom={},f}}),ZT=H8((q,_)=>{var j=["multipleOf","maximum","exclusiveMaximum","minimum","exclusiveMinimum","maxLength","minLength","pattern","additionalItems","maxItems","minItems","uniqueItems","maxProperties","minProperties","required","additionalProperties","enum","format","const"];_.exports=function(K,Y){for(var f=0;f{var j=s4().MissingRef;_.exports=K;function K(Y,f,P){var $=this;if(typeof this._opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");if(typeof f=="function")P=f,f=void 0;var O=w(Y).then(function(){var z=$._addSchema(Y,void 0,f);return z.validate||v(z)});if(P)O.then(function(z){P(null,z)},P);return O;function w(z){var W=z.$schema;return W&&!$.getSchema(W)?K.call($,{$ref:W},!0):Promise.resolve()}function v(z){try{return $._compile(z)}catch(J){if(J instanceof j)return W(J);throw J}function W(J){var k=J.missingSchema;if(A(k))throw new Error("Schema "+k+" is loaded but "+J.missingRef+" cannot be resolved");var H=$._loadingSchemas[k];if(!H)H=$._loadingSchemas[k]=$._opts.loadSchema(k),H.then(X,X);return H.then(function(G){if(!A(k))return w(G).then(function(){if(!A(k))$.addSchema(G,k,void 0,f)})}).then(function(){return v(z)});function X(){delete $._loadingSchemas[k]}function A(G){return $._refs[G]||$._schemas[G]}}}}}),XT=H8((q,_)=>{_.exports=function j(K,Y,f){var P=" ",$=K.level,O=K.dataLevel,w=K.schema[Y],v=K.schemaPath+K.util.getProperty(Y),z=K.errSchemaPath+"/"+Y,W=!K.opts.allErrors,J,k="data"+(O||""),H="valid"+$,X="errs__"+$,A=K.opts.$data&&w&&w.$data,G;if(A)P+=" var schema"+$+" = "+K.util.getData(w.$data,O,K.dataPathArr)+"; ",G="schema"+$;else G=w;var h=this,V="definition"+$,E=h.definition,M="",b,g,y,c,L;if(A&&E.$data){L="keywordValidate"+$;var m=E.validateSchema;P+=" var "+V+" = RULES.custom['"+Y+"'].definition; var "+L+" = "+V+".validate;"}else{if(c=K.useCustomRule(h,w,K.schema,K),!c)return;G="validate.schema"+v,L=c.code,b=E.compile,g=E.inline,y=E.macro}var I=L+".errors",d="i"+$,r="ruleErr"+$,B=E.async;if(B&&!K.async)throw new Error("async keyword in sync schema");if(!(g||y))P+=""+I+" = null;";if(P+="var "+X+" = errors;var "+H+";",A&&E.$data){if(M+="}",P+=" if ("+G+" === undefined) { "+H+" = true; } else { ",m)M+="}",P+=" "+H+" = "+V+".validateSchema("+G+"); if ("+H+") { "}if(g)if(E.statements)P+=" "+c.validate+" ";else P+=" "+H+" = "+c.validate+"; ";else if(y){var U=K.util.copy(K),M="";U.level++;var w8="valid"+U.level;U.schema=c.validate,U.schemaPath="";var f8=K.compositeRule;K.compositeRule=U.compositeRule=!0;var T8=K.validate(U).replace(/validate\.schema/g,L);K.compositeRule=U.compositeRule=f8,P+=" "+T8}else{var v8=v8||[];if(v8.push(P),P="",P+=" "+L+".call( ",K.opts.passContext)P+="this";else P+="self";if(b||E.schema===!1)P+=" , "+k+" ";else P+=" , "+G+" , "+k+" , validate.schema"+K.schemaPath+" ";if(P+=" , (dataPath || '')",K.errorPath!='""')P+=" + "+K.errorPath;var Y8=O?"data"+(O-1||""):"parentData",m8=O?K.dataPathArr[O]:"parentDataProperty";P+=" , "+Y8+" , "+m8+" , rootData ) ";var j6=P;if(P=v8.pop(),E.errors===!1){if(P+=" "+H+" = ",B)P+="await ";P+=""+j6+"; "}else if(B)I="customErrors"+$,P+=" var "+I+" = null; try { "+H+" = await "+j6+"; } catch (e) { "+H+" = false; if (e instanceof ValidationError) "+I+" = e.errors; else throw e; } ";else P+=" "+I+" = null; "+H+" = "+j6+"; "}if(E.modifying)P+=" if ("+Y8+") "+k+" = "+Y8+"["+m8+"];";if(P+=""+M,E.valid){if(W)P+=" if (true) { "}else{if(P+=" if ( ",E.valid===void 0)if(P+=" !",y)P+=""+w8;else P+=""+H;else P+=" "+!E.valid+" ";P+=") { ",J=h.keyword;var v8=v8||[];v8.push(P),P="";var v8=v8||[];if(v8.push(P),P="",K.createErrors!==!1){if(P+=" { keyword: '"+(J||"custom")+"' , dataPath: (dataPath || '') + "+K.errorPath+" , schemaPath: "+K.util.toQuotedString(z)+" , params: { keyword: '"+h.keyword+"' } ",K.opts.messages!==!1)P+=` , message: 'should pass "`+h.keyword+`" keyword validation' `;if(K.opts.verbose)P+=" , schema: validate.schema"+v+" , parentSchema: validate.schema"+K.schemaPath+" , data: "+k+" ";P+=" } "}else P+=" {} ";var q6=P;if(P=v8.pop(),!K.compositeRule&&W)if(K.async)P+=" throw new ValidationError(["+q6+"]); ";else P+=" validate.errors = ["+q6+"]; return false; ";else P+=" var err = "+q6+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";var D=P;if(P=v8.pop(),g)if(E.errors){if(E.errors!="full"){if(P+=" for (var "+d+"="+X+"; "+d+"{_.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0}}),AT=H8((q,_)=>{var j=L1();_.exports={$id:"https://github.com/ajv-validator/ajv/blob/master/lib/definition_schema.js",definitions:{simpleTypes:j.definitions.simpleTypes},type:"object",dependencies:{schema:["validate"],$data:["validate"],statements:["inline"],valid:{not:{required:["macro"]}}},properties:{type:j.properties.type,schema:{type:"boolean"},statements:{type:"boolean"},dependencies:{type:"array",items:{type:"string"}},metaSchema:{type:"object"},modifying:{type:"boolean"},valid:{type:"boolean"},$data:{type:"boolean"},async:{type:"boolean"},errors:{anyOf:[{type:"boolean"},{const:"full"}]}}}}),GT=H8((q,_)=>{var j=/^[a-z_$][a-z0-9_$-]*$/i,K=XT(),Y=AT();_.exports={add:f,get:P,remove:$,validate:O};function f(w,v){var z=this.RULES;if(z.keywords[w])throw new Error("Keyword "+w+" is already defined");if(!j.test(w))throw new Error("Keyword "+w+" is not a valid identifier");if(v){this.validateKeyword(v,!0);var W=v.type;if(Array.isArray(W))for(var J=0;J{_.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON Schema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1}}),hT=H8((q,_)=>{var j=aH(),K=U4(),Y=BH(),f=y1(),P=d1(),$=tH(),O=TT(),w=ZT(),v=Q_();_.exports=X,X.prototype.validate=A,X.prototype.compile=G,X.prototype.addSchema=h,X.prototype.addMetaSchema=V,X.prototype.validateSchema=E,X.prototype.getSchema=b,X.prototype.removeSchema=c,X.prototype.addFormat=f8,X.prototype.errorsText=w8,X.prototype._addSchema=m,X.prototype._compile=I,X.prototype.compileAsync=kT();var z=GT();X.prototype.addKeyword=z.add,X.prototype.getKeyword=z.get,X.prototype.removeKeyword=z.remove,X.prototype.validateKeyword=z.validate;var W=s4();X.ValidationError=W.Validation,X.MissingRefError=W.MissingRef,X.$dataMetaSchema=w;var J="http://json-schema.org/draft-07/schema",k=["removeAdditional","useDefaults","coerceTypes","strictDefaults"],H=["/properties"];function X(T){if(!(this instanceof X))return new X(T);if(T=this._opts=v.copy(T)||{},D(this),this._schemas={},this._refs={},this._fragments={},this._formats=$(T.format),this._cache=T.cache||new Y,this._loadingSchemas={},this._compilations=[],this.RULES=O(),this._getId=d(T),T.loopRequired=T.loopRequired||1/0,T.errorDataPath=="property")T._errorDataPathProperty=!0;if(T.serialize===void 0)T.serialize=P;if(this._metaOpts=q6(this),T.formats)Y8(this);if(T.keywords)m8(this);if(T8(this),typeof T.meta=="object")this.addMetaSchema(T.meta);if(T.nullable)this.addKeyword("nullable",{metaSchema:{type:"boolean"}});v8(this)}function A(T,N){var l;if(typeof T=="string"){if(l=this.getSchema(T),!l)throw new Error('no schema with key or ref "'+T+'"')}else{var i=this._addSchema(T);l=i.validate||this._compile(i)}var x=l(N);if(l.$async!==!0)this.errors=l.errors;return x}function G(T,N){var l=this._addSchema(T,void 0,N);return l.validate||this._compile(l)}function h(T,N,l,i){if(Array.isArray(T)){for(var x=0;x0)return Promise.resolve({done:!1,value:this.queue.shift()});if(this.isDone)return Promise.resolve({done:!0,value:void 0});if(this.hasError)return Promise.reject(this.hasError);return new Promise((q,_)=>{this.readResolve=q,this.readReject=_})}enqueue(q){if(this.readResolve){let _=this.readResolve;this.readResolve=void 0,this.readReject=void 0,_({done:!1,value:q})}else this.queue.push(q)}done(){if(this.isDone=!0,this.readResolve){let q=this.readResolve;this.readResolve=void 0,this.readReject=void 0,q({done:!0,value:void 0})}}error(q){if(this.hasError=q,this.readReject){let _=this.readReject;this.readResolve=void 0,this.readReject=void 0,_(q)}}return(){if(this.isDone=!0,this.returned)this.returned();return Promise.resolve({done:!0,value:void 0})}};r1=class r1{transport;isStreamingMode;canUseTool;hooks;abortController;pendingControlResponses=new Map;cleanupPerformed=!1;sdkMessages;inputStream=new x1;intialization;cancelControllers=new Map;hookCallbacks=new Map;nextCallbackId=0;sdkMcpTransports=new Map;pendingMcpResponses=new Map;constructor(q,_,j,K,Y,f=new Map){this.transport=q,this.isStreamingMode=_,this.canUseTool=j,this.hooks=K,this.abortController=Y;for(let[P,$]of f){let O=new c1((w)=>this.sendMcpServerMessageToCli(P,w));this.sdkMcpTransports.set(P,O),$.connect(O)}if(this.sdkMessages=this.readSdkMessages(),this.readMessages(),this.isStreamingMode)this.intialization=this.initialize()}setError(q){this.inputStream.error(q)}cleanup(q){if(this.cleanupPerformed)return;this.cleanupPerformed=!0;try{if(this.transport.close(),this.pendingControlResponses.clear(),this.pendingMcpResponses.clear(),q)this.inputStream.error(q);else this.inputStream.done()}catch(_){}}next(...[q]){return this.sdkMessages.next(...[q])}return(q){return this.sdkMessages.return(q)}throw(q){return this.sdkMessages.throw(q)}[Symbol.asyncIterator](){return this.sdkMessages}[Symbol.asyncDispose](){return this.sdkMessages[Symbol.asyncDispose]()}async readMessages(){try{for await(let q of this.transport.readMessages()){if(q.type==="control_response"){let _=this.pendingControlResponses.get(q.response.request_id);if(_)_(q.response);continue}else if(q.type==="control_request"){this.handleControlRequest(q);continue}else if(q.type==="control_cancel_request"){this.handleControlCancelRequest(q);continue}this.inputStream.enqueue(q)}this.inputStream.done(),this.cleanup()}catch(q){this.inputStream.error(q),this.cleanup(q)}}async handleControlRequest(q){let _=new AbortController;this.cancelControllers.set(q.request_id,_);try{let j=await this.processControlRequest(q,_.signal),K={type:"control_response",response:{subtype:"success",request_id:q.request_id,response:j}};await Promise.resolve(this.transport.write(JSON.stringify(K)+` +`))}catch(j){let K={type:"control_response",response:{subtype:"error",request_id:q.request_id,error:j.message||String(j)}};await Promise.resolve(this.transport.write(JSON.stringify(K)+` +`))}finally{this.cancelControllers.delete(q.request_id)}}handleControlCancelRequest(q){let _=this.cancelControllers.get(q.request_id);if(_)_.abort(),this.cancelControllers.delete(q.request_id)}async processControlRequest(q,_){if(q.request.subtype==="can_use_tool"){if(!this.canUseTool)throw new Error("canUseTool callback is not provided.");return this.canUseTool(q.request.tool_name,q.request.input,{signal:_,suggestions:q.request.permission_suggestions})}else if(q.request.subtype==="hook_callback")return await this.handleHookCallbacks(q.request.callback_id,q.request.input,q.request.tool_use_id,_);else if(q.request.subtype==="mcp_message"){let j=q.request,K=this.sdkMcpTransports.get(j.server_name);if(!K)throw new Error(`SDK MCP server not found: ${j.server_name}`);if("method"in j.message&&"id"in j.message&&j.message.id!==null)return{mcp_response:await this.handleMcpControlRequest(j.server_name,j,K)};else{if(K.onmessage)K.onmessage(j.message);return{mcp_response:{jsonrpc:"2.0",result:{},id:0}}}}throw new Error("Unsupported control request subtype: "+q.request.subtype)}async*readSdkMessages(){for await(let q of this.inputStream)yield q}async initialize(){let q;if(this.hooks){q={};for(let[K,Y]of Object.entries(this.hooks))if(Y.length>0)q[K]=Y.map((f)=>{let P=[];for(let $ of f.hooks){let O=`hook_${this.nextCallbackId++}`;this.hookCallbacks.set(O,$),P.push(O)}return{matcher:f.matcher,hookCallbackIds:P}})}let _={subtype:"initialize",hooks:q};return(await this.request(_)).response}async interrupt(){if(!this.isStreamingMode)throw new Error("Interrupt requires --input-format stream-json");await this.request({subtype:"interrupt"})}async setPermissionMode(q){if(!this.isStreamingMode)throw new Error("setPermissionMode requires --input-format stream-json");await this.request({subtype:"set_permission_mode",mode:q})}request(q){let _=Math.random().toString(36).substring(2,15),j={request_id:_,type:"control_request",request:q};return new Promise((K,Y)=>{this.pendingControlResponses.set(_,(f)=>{if(f.subtype==="success")K(f);else Y(new Error(f.error))}),Promise.resolve(this.transport.write(JSON.stringify(j)+` +`))})}async supportedCommands(){if(!this.isStreamingMode)throw new Error("supportedCommands requires --input-format stream-json");if(!this.intialization)throw new Error("supportedCommands requires transport with bidirectional communication");return(await this.intialization).commands}async streamInput(q){try{for await(let _ of q){if(this.abortController?.signal.aborted)break;await Promise.resolve(this.transport.write(JSON.stringify(_)+` +`))}this.transport.endInput()}catch(_){if(!(_ instanceof L_))throw _}}handleHookCallbacks(q,_,j,K){let Y=this.hookCallbacks.get(q);if(!Y)throw new Error(`No hook callback found for ID: ${q}`);return Y(_,j,{signal:K})}sendMcpServerMessageToCli(q,_){if("id"in _&&_.id!==null&&_.id!==void 0){let j=`${q}:${_.id}`,K=this.pendingMcpResponses.get(j);if(K){K.resolve(_),this.pendingMcpResponses.delete(j);return}}throw new Error("No pending request found")}handleMcpControlRequest(q,_,j){let K="id"in _.message?_.message.id:null,Y=`${q}:${K}`;return new Promise((f,P)=>{let $=null,O=()=>{if($)clearTimeout($);this.pendingMcpResponses.delete(Y)},w=(z)=>{O(),f(z)},v=(z)=>{O(),P(z)};if(this.pendingMcpResponses.set(Y,{resolve:w,reject:v}),j.onmessage)j.onmessage(_.message);else{O(),P(new Error("No message handler registered"));return}$=setTimeout(()=>{if(this.pendingMcpResponses.has(Y))O(),P(new Error("Request timeout"))},30000)})}};Z={};cH(Z,{void:()=>TZ,util:()=>u8,unknown:()=>JZ,union:()=>AZ,undefined:()=>vZ,tuple:()=>hZ,transformer:()=>I1,symbol:()=>OZ,string:()=>F1,strictObject:()=>XZ,setErrorMap:()=>gT,set:()=>VZ,record:()=>DZ,quotelessJson:()=>mT,promise:()=>RZ,preprocess:()=>gZ,pipeline:()=>yZ,ostring:()=>dZ,optional:()=>mZ,onumber:()=>pZ,oboolean:()=>LZ,objectUtil:()=>i4,object:()=>kZ,number:()=>U1,nullable:()=>IZ,null:()=>zZ,never:()=>HZ,nativeEnum:()=>EZ,nan:()=>fZ,map:()=>CZ,makeIssue:()=>x3,literal:()=>bZ,lazy:()=>NZ,late:()=>PZ,isValid:()=>j_,isDirty:()=>a4,isAsync:()=>gK,isAborted:()=>o4,intersection:()=>uZ,instanceof:()=>YZ,getParsedType:()=>Rq,getErrorMap:()=>n3,function:()=>MZ,enum:()=>SZ,effect:()=>I1,discriminatedUnion:()=>GZ,defaultErrorMap:()=>x_,datetimeRegex:()=>B1,date:()=>wZ,custom:()=>e1,coerce:()=>lZ,boolean:()=>s1,bigint:()=>$Z,array:()=>ZZ,any:()=>WZ,addIssueToContext:()=>F,ZodVoid:()=>dK,ZodUnknown:()=>lq,ZodUnion:()=>o_,ZodUndefined:()=>r_,ZodType:()=>k8,ZodTuple:()=>kq,ZodTransformer:()=>t6,ZodSymbol:()=>yK,ZodString:()=>Pq,ZodSet:()=>f_,ZodSchema:()=>k8,ZodRecord:()=>pK,ZodReadonly:()=>s_,ZodPromise:()=>$_,ZodPipeline:()=>nK,ZodParsedType:()=>Q,ZodOptional:()=>fq,ZodObject:()=>i8,ZodNumber:()=>nq,ZodNullable:()=>mq,ZodNull:()=>i_,ZodNever:()=>Zq,ZodNativeEnum:()=>e_,ZodNaN:()=>lK,ZodMap:()=>LK,ZodLiteral:()=>t_,ZodLazy:()=>B_,ZodIssueCode:()=>t,ZodIntersection:()=>a_,ZodFunction:()=>n_,ZodFirstPartyTypeKind:()=>z8,ZodError:()=>g6,ZodEnum:()=>cq,ZodEffects:()=>t6,ZodDiscriminatedUnion:()=>c3,ZodDefault:()=>F_,ZodDate:()=>P_,ZodCatch:()=>U_,ZodBranded:()=>r3,ZodBoolean:()=>c_,ZodBigInt:()=>xq,ZodArray:()=>Yq,ZodAny:()=>Y_,Schema:()=>k8,ParseStatus:()=>H6,OK:()=>D6,NEVER:()=>nZ,INVALID:()=>O8,EMPTY_PATH:()=>yT,DIRTY:()=>l_,BRAND:()=>jZ});(function(q){q.assertEqual=(Y)=>{};function _(Y){}q.assertIs=_;function j(Y){throw new Error}q.assertNever=j,q.arrayToEnum=(Y)=>{let f={};for(let P of Y)f[P]=P;return f},q.getValidEnumValues=(Y)=>{let f=q.objectKeys(Y).filter(($)=>typeof Y[Y[$]]!=="number"),P={};for(let $ of f)P[$]=Y[$];return q.objectValues(P)},q.objectValues=(Y)=>{return q.objectKeys(Y).map(function(f){return Y[f]})},q.objectKeys=typeof Object.keys==="function"?(Y)=>Object.keys(Y):(Y)=>{let f=[];for(let P in Y)if(Object.prototype.hasOwnProperty.call(Y,P))f.push(P);return f},q.find=(Y,f)=>{for(let P of Y)if(f(P))return P;return},q.isInteger=typeof Number.isInteger==="function"?(Y)=>Number.isInteger(Y):(Y)=>typeof Y==="number"&&Number.isFinite(Y)&&Math.floor(Y)===Y;function K(Y,f=" | "){return Y.map((P)=>typeof P==="string"?`'${P}'`:P).join(f)}q.joinValues=K,q.jsonStringifyReplacer=(Y,f)=>{if(typeof f==="bigint")return f.toString();return f}})(u8||(u8={}));(function(q){q.mergeShapes=(_,j)=>{return{..._,...j}}})(i4||(i4={}));Q=u8.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),t=u8.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);g6=class g6 extends Error{get errors(){return this.issues}constructor(q){super();this.issues=[],this.addIssue=(j)=>{this.issues=[...this.issues,j]},this.addIssues=(j=[])=>{this.issues=[...this.issues,...j]};let _=new.target.prototype;if(Object.setPrototypeOf)Object.setPrototypeOf(this,_);else this.__proto__=_;this.name="ZodError",this.issues=q}format(q){let _=q||function(Y){return Y.message},j={_errors:[]},K=(Y)=>{for(let f of Y.issues)if(f.code==="invalid_union")f.unionErrors.map(K);else if(f.code==="invalid_return_type")K(f.returnTypeError);else if(f.code==="invalid_arguments")K(f.argumentsError);else if(f.path.length===0)j._errors.push(_(f));else{let P=j,$=0;while($_.message){let _={},j=[];for(let K of this.issues)if(K.path.length>0){let Y=K.path[0];_[Y]=_[Y]||[],_[Y].push(q(K))}else j.push(q(K));return{formErrors:j,fieldErrors:_}}get formErrors(){return this.flatten()}};g6.create=(q)=>{return new g6(q)};x_=IT,i1=x_;yT=[];O8=Object.freeze({status:"aborted"});(function(q){q.errToObj=(_)=>typeof _==="string"?{message:_}:_||{},q.toString=(_)=>typeof _==="string"?_:_?.message})(P8||(P8={}));dT=/^c[^\s-]{8,}$/i,pT=/^[0-9a-z]+$/,LT=/^[0-9A-HJKMNP-TV-Z]{26}$/i,lT=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,nT=/^[a-z0-9_-]{21}$/i,xT=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,cT=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,rT=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,oT=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,aT=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,BT=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,tT=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,eT=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,FT=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,UT=new RegExp(`^${o1}$`);Pq=class Pq extends k8{_parse(q){if(this._def.coerce)q.data=String(q.data);if(this._getType(q)!==Q.string){let Y=this._getOrReturnCtx(q);return F(Y,{code:t.invalid_type,expected:Q.string,received:Y.parsedType}),O8}let j=new H6,K=void 0;for(let Y of this._def.checks)if(Y.kind==="min"){if(q.data.lengthY.value)K=this._getOrReturnCtx(q,K),F(K,{code:t.too_big,maximum:Y.value,type:"string",inclusive:!0,exact:!1,message:Y.message}),j.dirty()}else if(Y.kind==="length"){let f=q.data.length>Y.value,P=q.data.lengthq.test(K),{validation:_,code:t.invalid_string,...P8.errToObj(j)})}_addCheck(q){return new Pq({...this._def,checks:[...this._def.checks,q]})}email(q){return this._addCheck({kind:"email",...P8.errToObj(q)})}url(q){return this._addCheck({kind:"url",...P8.errToObj(q)})}emoji(q){return this._addCheck({kind:"emoji",...P8.errToObj(q)})}uuid(q){return this._addCheck({kind:"uuid",...P8.errToObj(q)})}nanoid(q){return this._addCheck({kind:"nanoid",...P8.errToObj(q)})}cuid(q){return this._addCheck({kind:"cuid",...P8.errToObj(q)})}cuid2(q){return this._addCheck({kind:"cuid2",...P8.errToObj(q)})}ulid(q){return this._addCheck({kind:"ulid",...P8.errToObj(q)})}base64(q){return this._addCheck({kind:"base64",...P8.errToObj(q)})}base64url(q){return this._addCheck({kind:"base64url",...P8.errToObj(q)})}jwt(q){return this._addCheck({kind:"jwt",...P8.errToObj(q)})}ip(q){return this._addCheck({kind:"ip",...P8.errToObj(q)})}cidr(q){return this._addCheck({kind:"cidr",...P8.errToObj(q)})}datetime(q){if(typeof q==="string")return this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:q});return this._addCheck({kind:"datetime",precision:typeof q?.precision==="undefined"?null:q?.precision,offset:q?.offset??!1,local:q?.local??!1,...P8.errToObj(q?.message)})}date(q){return this._addCheck({kind:"date",message:q})}time(q){if(typeof q==="string")return this._addCheck({kind:"time",precision:null,message:q});return this._addCheck({kind:"time",precision:typeof q?.precision==="undefined"?null:q?.precision,...P8.errToObj(q?.message)})}duration(q){return this._addCheck({kind:"duration",...P8.errToObj(q)})}regex(q,_){return this._addCheck({kind:"regex",regex:q,...P8.errToObj(_)})}includes(q,_){return this._addCheck({kind:"includes",value:q,position:_?.position,...P8.errToObj(_?.message)})}startsWith(q,_){return this._addCheck({kind:"startsWith",value:q,...P8.errToObj(_)})}endsWith(q,_){return this._addCheck({kind:"endsWith",value:q,...P8.errToObj(_)})}min(q,_){return this._addCheck({kind:"min",value:q,...P8.errToObj(_)})}max(q,_){return this._addCheck({kind:"max",value:q,...P8.errToObj(_)})}length(q,_){return this._addCheck({kind:"length",value:q,...P8.errToObj(_)})}nonempty(q){return this.min(1,P8.errToObj(q))}trim(){return new Pq({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Pq({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Pq({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find((q)=>q.kind==="datetime")}get isDate(){return!!this._def.checks.find((q)=>q.kind==="date")}get isTime(){return!!this._def.checks.find((q)=>q.kind==="time")}get isDuration(){return!!this._def.checks.find((q)=>q.kind==="duration")}get isEmail(){return!!this._def.checks.find((q)=>q.kind==="email")}get isURL(){return!!this._def.checks.find((q)=>q.kind==="url")}get isEmoji(){return!!this._def.checks.find((q)=>q.kind==="emoji")}get isUUID(){return!!this._def.checks.find((q)=>q.kind==="uuid")}get isNANOID(){return!!this._def.checks.find((q)=>q.kind==="nanoid")}get isCUID(){return!!this._def.checks.find((q)=>q.kind==="cuid")}get isCUID2(){return!!this._def.checks.find((q)=>q.kind==="cuid2")}get isULID(){return!!this._def.checks.find((q)=>q.kind==="ulid")}get isIP(){return!!this._def.checks.find((q)=>q.kind==="ip")}get isCIDR(){return!!this._def.checks.find((q)=>q.kind==="cidr")}get isBase64(){return!!this._def.checks.find((q)=>q.kind==="base64")}get isBase64url(){return!!this._def.checks.find((q)=>q.kind==="base64url")}get minLength(){let q=null;for(let _ of this._def.checks)if(_.kind==="min"){if(q===null||_.value>q)q=_.value}return q}get maxLength(){let q=null;for(let _ of this._def.checks)if(_.kind==="max"){if(q===null||_.value{return new Pq({checks:[],typeName:z8.ZodString,coerce:q?.coerce??!1,...Z8(q)})};nq=class nq extends k8{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(q){if(this._def.coerce)q.data=Number(q.data);if(this._getType(q)!==Q.number){let Y=this._getOrReturnCtx(q);return F(Y,{code:t.invalid_type,expected:Q.number,received:Y.parsedType}),O8}let j=void 0,K=new H6;for(let Y of this._def.checks)if(Y.kind==="int"){if(!u8.isInteger(q.data))j=this._getOrReturnCtx(q,j),F(j,{code:t.invalid_type,expected:"integer",received:"float",message:Y.message}),K.dirty()}else if(Y.kind==="min"){if(Y.inclusive?q.dataY.value:q.data>=Y.value)j=this._getOrReturnCtx(q,j),F(j,{code:t.too_big,maximum:Y.value,type:"number",inclusive:Y.inclusive,exact:!1,message:Y.message}),K.dirty()}else if(Y.kind==="multipleOf"){if(KZ(q.data,Y.value)!==0)j=this._getOrReturnCtx(q,j),F(j,{code:t.not_multiple_of,multipleOf:Y.value,message:Y.message}),K.dirty()}else if(Y.kind==="finite"){if(!Number.isFinite(q.data))j=this._getOrReturnCtx(q,j),F(j,{code:t.not_finite,message:Y.message}),K.dirty()}else u8.assertNever(Y);return{status:K.value,value:q.data}}gte(q,_){return this.setLimit("min",q,!0,P8.toString(_))}gt(q,_){return this.setLimit("min",q,!1,P8.toString(_))}lte(q,_){return this.setLimit("max",q,!0,P8.toString(_))}lt(q,_){return this.setLimit("max",q,!1,P8.toString(_))}setLimit(q,_,j,K){return new nq({...this._def,checks:[...this._def.checks,{kind:q,value:_,inclusive:j,message:P8.toString(K)}]})}_addCheck(q){return new nq({...this._def,checks:[...this._def.checks,q]})}int(q){return this._addCheck({kind:"int",message:P8.toString(q)})}positive(q){return this._addCheck({kind:"min",value:0,inclusive:!1,message:P8.toString(q)})}negative(q){return this._addCheck({kind:"max",value:0,inclusive:!1,message:P8.toString(q)})}nonpositive(q){return this._addCheck({kind:"max",value:0,inclusive:!0,message:P8.toString(q)})}nonnegative(q){return this._addCheck({kind:"min",value:0,inclusive:!0,message:P8.toString(q)})}multipleOf(q,_){return this._addCheck({kind:"multipleOf",value:q,message:P8.toString(_)})}finite(q){return this._addCheck({kind:"finite",message:P8.toString(q)})}safe(q){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:P8.toString(q)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:P8.toString(q)})}get minValue(){let q=null;for(let _ of this._def.checks)if(_.kind==="min"){if(q===null||_.value>q)q=_.value}return q}get maxValue(){let q=null;for(let _ of this._def.checks)if(_.kind==="max"){if(q===null||_.valueq.kind==="int"||q.kind==="multipleOf"&&u8.isInteger(q.value))}get isFinite(){let q=null,_=null;for(let j of this._def.checks)if(j.kind==="finite"||j.kind==="int"||j.kind==="multipleOf")return!0;else if(j.kind==="min"){if(_===null||j.value>_)_=j.value}else if(j.kind==="max"){if(q===null||j.value{return new nq({checks:[],typeName:z8.ZodNumber,coerce:q?.coerce||!1,...Z8(q)})};xq=class xq extends k8{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte}_parse(q){if(this._def.coerce)try{q.data=BigInt(q.data)}catch{return this._getInvalidInput(q)}if(this._getType(q)!==Q.bigint)return this._getInvalidInput(q);let j=void 0,K=new H6;for(let Y of this._def.checks)if(Y.kind==="min"){if(Y.inclusive?q.dataY.value:q.data>=Y.value)j=this._getOrReturnCtx(q,j),F(j,{code:t.too_big,type:"bigint",maximum:Y.value,inclusive:Y.inclusive,message:Y.message}),K.dirty()}else if(Y.kind==="multipleOf"){if(q.data%Y.value!==BigInt(0))j=this._getOrReturnCtx(q,j),F(j,{code:t.not_multiple_of,multipleOf:Y.value,message:Y.message}),K.dirty()}else u8.assertNever(Y);return{status:K.value,value:q.data}}_getInvalidInput(q){let _=this._getOrReturnCtx(q);return F(_,{code:t.invalid_type,expected:Q.bigint,received:_.parsedType}),O8}gte(q,_){return this.setLimit("min",q,!0,P8.toString(_))}gt(q,_){return this.setLimit("min",q,!1,P8.toString(_))}lte(q,_){return this.setLimit("max",q,!0,P8.toString(_))}lt(q,_){return this.setLimit("max",q,!1,P8.toString(_))}setLimit(q,_,j,K){return new xq({...this._def,checks:[...this._def.checks,{kind:q,value:_,inclusive:j,message:P8.toString(K)}]})}_addCheck(q){return new xq({...this._def,checks:[...this._def.checks,q]})}positive(q){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:P8.toString(q)})}negative(q){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:P8.toString(q)})}nonpositive(q){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:P8.toString(q)})}nonnegative(q){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:P8.toString(q)})}multipleOf(q,_){return this._addCheck({kind:"multipleOf",value:q,message:P8.toString(_)})}get minValue(){let q=null;for(let _ of this._def.checks)if(_.kind==="min"){if(q===null||_.value>q)q=_.value}return q}get maxValue(){let q=null;for(let _ of this._def.checks)if(_.kind==="max"){if(q===null||_.value{return new xq({checks:[],typeName:z8.ZodBigInt,coerce:q?.coerce??!1,...Z8(q)})};c_=class c_ extends k8{_parse(q){if(this._def.coerce)q.data=Boolean(q.data);if(this._getType(q)!==Q.boolean){let j=this._getOrReturnCtx(q);return F(j,{code:t.invalid_type,expected:Q.boolean,received:j.parsedType}),O8}return D6(q.data)}};c_.create=(q)=>{return new c_({typeName:z8.ZodBoolean,coerce:q?.coerce||!1,...Z8(q)})};P_=class P_ extends k8{_parse(q){if(this._def.coerce)q.data=new Date(q.data);if(this._getType(q)!==Q.date){let Y=this._getOrReturnCtx(q);return F(Y,{code:t.invalid_type,expected:Q.date,received:Y.parsedType}),O8}if(Number.isNaN(q.data.getTime())){let Y=this._getOrReturnCtx(q);return F(Y,{code:t.invalid_date}),O8}let j=new H6,K=void 0;for(let Y of this._def.checks)if(Y.kind==="min"){if(q.data.getTime()Y.value)K=this._getOrReturnCtx(q,K),F(K,{code:t.too_big,message:Y.message,inclusive:!0,exact:!1,maximum:Y.value,type:"date"}),j.dirty()}else u8.assertNever(Y);return{status:j.value,value:new Date(q.data.getTime())}}_addCheck(q){return new P_({...this._def,checks:[...this._def.checks,q]})}min(q,_){return this._addCheck({kind:"min",value:q.getTime(),message:P8.toString(_)})}max(q,_){return this._addCheck({kind:"max",value:q.getTime(),message:P8.toString(_)})}get minDate(){let q=null;for(let _ of this._def.checks)if(_.kind==="min"){if(q===null||_.value>q)q=_.value}return q!=null?new Date(q):null}get maxDate(){let q=null;for(let _ of this._def.checks)if(_.kind==="max"){if(q===null||_.value{return new P_({checks:[],coerce:q?.coerce||!1,typeName:z8.ZodDate,...Z8(q)})};yK=class yK extends k8{_parse(q){if(this._getType(q)!==Q.symbol){let j=this._getOrReturnCtx(q);return F(j,{code:t.invalid_type,expected:Q.symbol,received:j.parsedType}),O8}return D6(q.data)}};yK.create=(q)=>{return new yK({typeName:z8.ZodSymbol,...Z8(q)})};r_=class r_ extends k8{_parse(q){if(this._getType(q)!==Q.undefined){let j=this._getOrReturnCtx(q);return F(j,{code:t.invalid_type,expected:Q.undefined,received:j.parsedType}),O8}return D6(q.data)}};r_.create=(q)=>{return new r_({typeName:z8.ZodUndefined,...Z8(q)})};i_=class i_ extends k8{_parse(q){if(this._getType(q)!==Q.null){let j=this._getOrReturnCtx(q);return F(j,{code:t.invalid_type,expected:Q.null,received:j.parsedType}),O8}return D6(q.data)}};i_.create=(q)=>{return new i_({typeName:z8.ZodNull,...Z8(q)})};Y_=class Y_ extends k8{constructor(){super(...arguments);this._any=!0}_parse(q){return D6(q.data)}};Y_.create=(q)=>{return new Y_({typeName:z8.ZodAny,...Z8(q)})};lq=class lq extends k8{constructor(){super(...arguments);this._unknown=!0}_parse(q){return D6(q.data)}};lq.create=(q)=>{return new lq({typeName:z8.ZodUnknown,...Z8(q)})};Zq=class Zq extends k8{_parse(q){let _=this._getOrReturnCtx(q);return F(_,{code:t.invalid_type,expected:Q.never,received:_.parsedType}),O8}};Zq.create=(q)=>{return new Zq({typeName:z8.ZodNever,...Z8(q)})};dK=class dK extends k8{_parse(q){if(this._getType(q)!==Q.undefined){let j=this._getOrReturnCtx(q);return F(j,{code:t.invalid_type,expected:Q.void,received:j.parsedType}),O8}return D6(q.data)}};dK.create=(q)=>{return new dK({typeName:z8.ZodVoid,...Z8(q)})};Yq=class Yq extends k8{_parse(q){let{ctx:_,status:j}=this._processInputParams(q),K=this._def;if(_.parsedType!==Q.array)return F(_,{code:t.invalid_type,expected:Q.array,received:_.parsedType}),O8;if(K.exactLength!==null){let f=_.data.length>K.exactLength.value,P=_.data.lengthK.maxLength.value)F(_,{code:t.too_big,maximum:K.maxLength.value,type:"array",inclusive:!0,exact:!1,message:K.maxLength.message}),j.dirty()}if(_.common.async)return Promise.all([..._.data].map((f,P)=>{return K.type._parseAsync(new $q(_,f,_.path,P))})).then((f)=>{return H6.mergeArray(j,f)});let Y=[..._.data].map((f,P)=>{return K.type._parseSync(new $q(_,f,_.path,P))});return H6.mergeArray(j,Y)}get element(){return this._def.type}min(q,_){return new Yq({...this._def,minLength:{value:q,message:P8.toString(_)}})}max(q,_){return new Yq({...this._def,maxLength:{value:q,message:P8.toString(_)}})}length(q,_){return new Yq({...this._def,exactLength:{value:q,message:P8.toString(_)}})}nonempty(q){return this.min(1,q)}};Yq.create=(q,_)=>{return new Yq({type:q,minLength:null,maxLength:null,exactLength:null,typeName:z8.ZodArray,...Z8(_)})};i8=class i8 extends k8{constructor(){super(...arguments);this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let q=this._def.shape(),_=u8.objectKeys(q);return this._cached={shape:q,keys:_},this._cached}_parse(q){if(this._getType(q)!==Q.object){let O=this._getOrReturnCtx(q);return F(O,{code:t.invalid_type,expected:Q.object,received:O.parsedType}),O8}let{status:j,ctx:K}=this._processInputParams(q),{shape:Y,keys:f}=this._getCached(),P=[];if(!(this._def.catchall instanceof Zq&&this._def.unknownKeys==="strip")){for(let O in K.data)if(!f.includes(O))P.push(O)}let $=[];for(let O of f){let w=Y[O],v=K.data[O];$.push({key:{status:"valid",value:O},value:w._parse(new $q(K,v,K.path,O)),alwaysSet:O in K.data})}if(this._def.catchall instanceof Zq){let O=this._def.unknownKeys;if(O==="passthrough")for(let w of P)$.push({key:{status:"valid",value:w},value:{status:"valid",value:K.data[w]}});else if(O==="strict"){if(P.length>0)F(K,{code:t.unrecognized_keys,keys:P}),j.dirty()}else if(O==="strip");else throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let O=this._def.catchall;for(let w of P){let v=K.data[w];$.push({key:{status:"valid",value:w},value:O._parse(new $q(K,v,K.path,w)),alwaysSet:w in K.data})}}if(K.common.async)return Promise.resolve().then(async()=>{let O=[];for(let w of $){let v=await w.key,z=await w.value;O.push({key:v,value:z,alwaysSet:w.alwaysSet})}return O}).then((O)=>{return H6.mergeObjectSync(j,O)});else return H6.mergeObjectSync(j,$)}get shape(){return this._def.shape()}strict(q){return P8.errToObj,new i8({...this._def,unknownKeys:"strict",...q!==void 0?{errorMap:(_,j)=>{let K=this._def.errorMap?.(_,j).message??j.defaultError;if(_.code==="unrecognized_keys")return{message:P8.errToObj(q).message??K};return{message:K}}}:{}})}strip(){return new i8({...this._def,unknownKeys:"strip"})}passthrough(){return new i8({...this._def,unknownKeys:"passthrough"})}extend(q){return new i8({...this._def,shape:()=>({...this._def.shape(),...q})})}merge(q){return new i8({unknownKeys:q._def.unknownKeys,catchall:q._def.catchall,shape:()=>({...this._def.shape(),...q._def.shape()}),typeName:z8.ZodObject})}setKey(q,_){return this.augment({[q]:_})}catchall(q){return new i8({...this._def,catchall:q})}pick(q){let _={};for(let j of u8.objectKeys(q))if(q[j]&&this.shape[j])_[j]=this.shape[j];return new i8({...this._def,shape:()=>_})}omit(q){let _={};for(let j of u8.objectKeys(this.shape))if(!q[j])_[j]=this.shape[j];return new i8({...this._def,shape:()=>_})}deepPartial(){return p_(this)}partial(q){let _={};for(let j of u8.objectKeys(this.shape)){let K=this.shape[j];if(q&&!q[j])_[j]=K;else _[j]=K.optional()}return new i8({...this._def,shape:()=>_})}required(q){let _={};for(let j of u8.objectKeys(this.shape))if(q&&!q[j])_[j]=this.shape[j];else{let Y=this.shape[j];while(Y instanceof fq)Y=Y._def.innerType;_[j]=Y}return new i8({...this._def,shape:()=>_})}keyof(){return t1(u8.objectKeys(this.shape))}};i8.create=(q,_)=>{return new i8({shape:()=>q,unknownKeys:"strip",catchall:Zq.create(),typeName:z8.ZodObject,...Z8(_)})};i8.strictCreate=(q,_)=>{return new i8({shape:()=>q,unknownKeys:"strict",catchall:Zq.create(),typeName:z8.ZodObject,...Z8(_)})};i8.lazycreate=(q,_)=>{return new i8({shape:q,unknownKeys:"strip",catchall:Zq.create(),typeName:z8.ZodObject,...Z8(_)})};o_=class o_ extends k8{_parse(q){let{ctx:_}=this._processInputParams(q),j=this._def.options;function K(Y){for(let P of Y)if(P.result.status==="valid")return P.result;for(let P of Y)if(P.result.status==="dirty")return _.common.issues.push(...P.ctx.common.issues),P.result;let f=Y.map((P)=>new g6(P.ctx.common.issues));return F(_,{code:t.invalid_union,unionErrors:f}),O8}if(_.common.async)return Promise.all(j.map(async(Y)=>{let f={..._,common:{..._.common,issues:[]},parent:null};return{result:await Y._parseAsync({data:_.data,path:_.path,parent:f}),ctx:f}})).then(K);else{let Y=void 0,f=[];for(let $ of j){let O={..._,common:{..._.common,issues:[]},parent:null},w=$._parseSync({data:_.data,path:_.path,parent:O});if(w.status==="valid")return w;else if(w.status==="dirty"&&!Y)Y={result:w,ctx:O};if(O.common.issues.length)f.push(O.common.issues)}if(Y)return _.common.issues.push(...Y.ctx.common.issues),Y.result;let P=f.map(($)=>new g6($));return F(_,{code:t.invalid_union,unionErrors:P}),O8}}get options(){return this._def.options}};o_.create=(q,_)=>{return new o_({options:q,typeName:z8.ZodUnion,...Z8(_)})};c3=class c3 extends k8{_parse(q){let{ctx:_}=this._processInputParams(q);if(_.parsedType!==Q.object)return F(_,{code:t.invalid_type,expected:Q.object,received:_.parsedType}),O8;let j=this.discriminator,K=_.data[j],Y=this.optionsMap.get(K);if(!Y)return F(_,{code:t.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[j]}),O8;if(_.common.async)return Y._parseAsync({data:_.data,path:_.path,parent:_});else return Y._parseSync({data:_.data,path:_.path,parent:_})}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(q,_,j){let K=new Map;for(let Y of _){let f=Eq(Y.shape[q]);if(!f.length)throw new Error(`A discriminator value for key \`${q}\` could not be extracted from all schema options`);for(let P of f){if(K.has(P))throw new Error(`Discriminator property ${String(q)} has duplicate value ${String(P)}`);K.set(P,Y)}}return new c3({typeName:z8.ZodDiscriminatedUnion,discriminator:q,options:_,optionsMap:K,...Z8(j)})}};a_=class a_ extends k8{_parse(q){let{status:_,ctx:j}=this._processInputParams(q),K=(Y,f)=>{if(o4(Y)||o4(f))return O8;let P=B4(Y.value,f.value);if(!P.valid)return F(j,{code:t.invalid_intersection_types}),O8;if(a4(Y)||a4(f))_.dirty();return{status:_.value,value:P.data}};if(j.common.async)return Promise.all([this._def.left._parseAsync({data:j.data,path:j.path,parent:j}),this._def.right._parseAsync({data:j.data,path:j.path,parent:j})]).then(([Y,f])=>K(Y,f));else return K(this._def.left._parseSync({data:j.data,path:j.path,parent:j}),this._def.right._parseSync({data:j.data,path:j.path,parent:j}))}};a_.create=(q,_,j)=>{return new a_({left:q,right:_,typeName:z8.ZodIntersection,...Z8(j)})};kq=class kq extends k8{_parse(q){let{status:_,ctx:j}=this._processInputParams(q);if(j.parsedType!==Q.array)return F(j,{code:t.invalid_type,expected:Q.array,received:j.parsedType}),O8;if(j.data.lengththis._def.items.length)F(j,{code:t.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),_.dirty();let Y=[...j.data].map((f,P)=>{let $=this._def.items[P]||this._def.rest;if(!$)return null;return $._parse(new $q(j,f,j.path,P))}).filter((f)=>!!f);if(j.common.async)return Promise.all(Y).then((f)=>{return H6.mergeArray(_,f)});else return H6.mergeArray(_,Y)}get items(){return this._def.items}rest(q){return new kq({...this._def,rest:q})}};kq.create=(q,_)=>{if(!Array.isArray(q))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new kq({items:q,typeName:z8.ZodTuple,rest:null,...Z8(_)})};pK=class pK extends k8{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(q){let{status:_,ctx:j}=this._processInputParams(q);if(j.parsedType!==Q.object)return F(j,{code:t.invalid_type,expected:Q.object,received:j.parsedType}),O8;let K=[],Y=this._def.keyType,f=this._def.valueType;for(let P in j.data)K.push({key:Y._parse(new $q(j,P,j.path,P)),value:f._parse(new $q(j,j.data[P],j.path,P)),alwaysSet:P in j.data});if(j.common.async)return H6.mergeObjectAsync(_,K);else return H6.mergeObjectSync(_,K)}get element(){return this._def.valueType}static create(q,_,j){if(_ instanceof k8)return new pK({keyType:q,valueType:_,typeName:z8.ZodRecord,...Z8(j)});return new pK({keyType:Pq.create(),valueType:q,typeName:z8.ZodRecord,...Z8(_)})}};LK=class LK extends k8{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(q){let{status:_,ctx:j}=this._processInputParams(q);if(j.parsedType!==Q.map)return F(j,{code:t.invalid_type,expected:Q.map,received:j.parsedType}),O8;let K=this._def.keyType,Y=this._def.valueType,f=[...j.data.entries()].map(([P,$],O)=>{return{key:K._parse(new $q(j,P,j.path,[O,"key"])),value:Y._parse(new $q(j,$,j.path,[O,"value"]))}});if(j.common.async){let P=new Map;return Promise.resolve().then(async()=>{for(let $ of f){let O=await $.key,w=await $.value;if(O.status==="aborted"||w.status==="aborted")return O8;if(O.status==="dirty"||w.status==="dirty")_.dirty();P.set(O.value,w.value)}return{status:_.value,value:P}})}else{let P=new Map;for(let $ of f){let{key:O,value:w}=$;if(O.status==="aborted"||w.status==="aborted")return O8;if(O.status==="dirty"||w.status==="dirty")_.dirty();P.set(O.value,w.value)}return{status:_.value,value:P}}}};LK.create=(q,_,j)=>{return new LK({valueType:_,keyType:q,typeName:z8.ZodMap,...Z8(j)})};f_=class f_ extends k8{_parse(q){let{status:_,ctx:j}=this._processInputParams(q);if(j.parsedType!==Q.set)return F(j,{code:t.invalid_type,expected:Q.set,received:j.parsedType}),O8;let K=this._def;if(K.minSize!==null){if(j.data.sizeK.maxSize.value)F(j,{code:t.too_big,maximum:K.maxSize.value,type:"set",inclusive:!0,exact:!1,message:K.maxSize.message}),_.dirty()}let Y=this._def.valueType;function f($){let O=new Set;for(let w of $){if(w.status==="aborted")return O8;if(w.status==="dirty")_.dirty();O.add(w.value)}return{status:_.value,value:O}}let P=[...j.data.values()].map(($,O)=>Y._parse(new $q(j,$,j.path,O)));if(j.common.async)return Promise.all(P).then(($)=>f($));else return f(P)}min(q,_){return new f_({...this._def,minSize:{value:q,message:P8.toString(_)}})}max(q,_){return new f_({...this._def,maxSize:{value:q,message:P8.toString(_)}})}size(q,_){return this.min(q,_).max(q,_)}nonempty(q){return this.min(1,q)}};f_.create=(q,_)=>{return new f_({valueType:q,minSize:null,maxSize:null,typeName:z8.ZodSet,...Z8(_)})};n_=class n_ extends k8{constructor(){super(...arguments);this.validate=this.implement}_parse(q){let{ctx:_}=this._processInputParams(q);if(_.parsedType!==Q.function)return F(_,{code:t.invalid_type,expected:Q.function,received:_.parsedType}),O8;function j(P,$){return x3({data:P,path:_.path,errorMaps:[_.common.contextualErrorMap,_.schemaErrorMap,n3(),x_].filter((O)=>!!O),issueData:{code:t.invalid_arguments,argumentsError:$}})}function K(P,$){return x3({data:P,path:_.path,errorMaps:[_.common.contextualErrorMap,_.schemaErrorMap,n3(),x_].filter((O)=>!!O),issueData:{code:t.invalid_return_type,returnTypeError:$}})}let Y={errorMap:_.common.contextualErrorMap},f=_.data;if(this._def.returns instanceof $_){let P=this;return D6(async function(...$){let O=new g6([]),w=await P._def.args.parseAsync($,Y).catch((W)=>{throw O.addIssue(j($,W)),O}),v=await Reflect.apply(f,this,w);return await P._def.returns._def.type.parseAsync(v,Y).catch((W)=>{throw O.addIssue(K(v,W)),O})})}else{let P=this;return D6(function(...$){let O=P._def.args.safeParse($,Y);if(!O.success)throw new g6([j($,O.error)]);let w=Reflect.apply(f,this,O.data),v=P._def.returns.safeParse(w,Y);if(!v.success)throw new g6([K(w,v.error)]);return v.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...q){return new n_({...this._def,args:kq.create(q).rest(lq.create())})}returns(q){return new n_({...this._def,returns:q})}implement(q){return this.parse(q)}strictImplement(q){return this.parse(q)}static create(q,_,j){return new n_({args:q?q:kq.create([]).rest(lq.create()),returns:_||lq.create(),typeName:z8.ZodFunction,...Z8(j)})}};B_=class B_ extends k8{get schema(){return this._def.getter()}_parse(q){let{ctx:_}=this._processInputParams(q);return this._def.getter()._parse({data:_.data,path:_.path,parent:_})}};B_.create=(q,_)=>{return new B_({getter:q,typeName:z8.ZodLazy,...Z8(_)})};t_=class t_ extends k8{_parse(q){if(q.data!==this._def.value){let _=this._getOrReturnCtx(q);return F(_,{received:_.data,code:t.invalid_literal,expected:this._def.value}),O8}return{status:"valid",value:q.data}}get value(){return this._def.value}};t_.create=(q,_)=>{return new t_({value:q,typeName:z8.ZodLiteral,...Z8(_)})};cq=class cq extends k8{_parse(q){if(typeof q.data!=="string"){let _=this._getOrReturnCtx(q),j=this._def.values;return F(_,{expected:u8.joinValues(j),received:_.parsedType,code:t.invalid_type}),O8}if(!this._cache)this._cache=new Set(this._def.values);if(!this._cache.has(q.data)){let _=this._getOrReturnCtx(q),j=this._def.values;return F(_,{received:_.data,code:t.invalid_enum_value,options:j}),O8}return D6(q.data)}get options(){return this._def.values}get enum(){let q={};for(let _ of this._def.values)q[_]=_;return q}get Values(){let q={};for(let _ of this._def.values)q[_]=_;return q}get Enum(){let q={};for(let _ of this._def.values)q[_]=_;return q}extract(q,_=this._def){return cq.create(q,{...this._def,..._})}exclude(q,_=this._def){return cq.create(this.options.filter((j)=>!q.includes(j)),{...this._def,..._})}};cq.create=t1;e_=class e_ extends k8{_parse(q){let _=u8.getValidEnumValues(this._def.values),j=this._getOrReturnCtx(q);if(j.parsedType!==Q.string&&j.parsedType!==Q.number){let K=u8.objectValues(_);return F(j,{expected:u8.joinValues(K),received:j.parsedType,code:t.invalid_type}),O8}if(!this._cache)this._cache=new Set(u8.getValidEnumValues(this._def.values));if(!this._cache.has(q.data)){let K=u8.objectValues(_);return F(j,{received:j.data,code:t.invalid_enum_value,options:K}),O8}return D6(q.data)}get enum(){return this._def.values}};e_.create=(q,_)=>{return new e_({values:q,typeName:z8.ZodNativeEnum,...Z8(_)})};$_=class $_ extends k8{unwrap(){return this._def.type}_parse(q){let{ctx:_}=this._processInputParams(q);if(_.parsedType!==Q.promise&&_.common.async===!1)return F(_,{code:t.invalid_type,expected:Q.promise,received:_.parsedType}),O8;let j=_.parsedType===Q.promise?_.data:Promise.resolve(_.data);return D6(j.then((K)=>{return this._def.type.parseAsync(K,{path:_.path,errorMap:_.common.contextualErrorMap})}))}};$_.create=(q,_)=>{return new $_({type:q,typeName:z8.ZodPromise,...Z8(_)})};t6=class t6 extends k8{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===z8.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(q){let{status:_,ctx:j}=this._processInputParams(q),K=this._def.effect||null,Y={addIssue:(f)=>{if(F(j,f),f.fatal)_.abort();else _.dirty()},get path(){return j.path}};if(Y.addIssue=Y.addIssue.bind(Y),K.type==="preprocess"){let f=K.transform(j.data,Y);if(j.common.async)return Promise.resolve(f).then(async(P)=>{if(_.value==="aborted")return O8;let $=await this._def.schema._parseAsync({data:P,path:j.path,parent:j});if($.status==="aborted")return O8;if($.status==="dirty")return l_($.value);if(_.value==="dirty")return l_($.value);return $});else{if(_.value==="aborted")return O8;let P=this._def.schema._parseSync({data:f,path:j.path,parent:j});if(P.status==="aborted")return O8;if(P.status==="dirty")return l_(P.value);if(_.value==="dirty")return l_(P.value);return P}}if(K.type==="refinement"){let f=(P)=>{let $=K.refinement(P,Y);if(j.common.async)return Promise.resolve($);if($ instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return P};if(j.common.async===!1){let P=this._def.schema._parseSync({data:j.data,path:j.path,parent:j});if(P.status==="aborted")return O8;if(P.status==="dirty")_.dirty();return f(P.value),{status:_.value,value:P.value}}else return this._def.schema._parseAsync({data:j.data,path:j.path,parent:j}).then((P)=>{if(P.status==="aborted")return O8;if(P.status==="dirty")_.dirty();return f(P.value).then(()=>{return{status:_.value,value:P.value}})})}if(K.type==="transform")if(j.common.async===!1){let f=this._def.schema._parseSync({data:j.data,path:j.path,parent:j});if(!j_(f))return O8;let P=K.transform(f.value,Y);if(P instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:_.value,value:P}}else return this._def.schema._parseAsync({data:j.data,path:j.path,parent:j}).then((f)=>{if(!j_(f))return O8;return Promise.resolve(K.transform(f.value,Y)).then((P)=>({status:_.value,value:P}))});u8.assertNever(K)}};t6.create=(q,_,j)=>{return new t6({schema:q,typeName:z8.ZodEffects,effect:_,...Z8(j)})};t6.createWithPreprocess=(q,_,j)=>{return new t6({schema:_,effect:{type:"preprocess",transform:q},typeName:z8.ZodEffects,...Z8(j)})};fq=class fq extends k8{_parse(q){if(this._getType(q)===Q.undefined)return D6(void 0);return this._def.innerType._parse(q)}unwrap(){return this._def.innerType}};fq.create=(q,_)=>{return new fq({innerType:q,typeName:z8.ZodOptional,...Z8(_)})};mq=class mq extends k8{_parse(q){if(this._getType(q)===Q.null)return D6(null);return this._def.innerType._parse(q)}unwrap(){return this._def.innerType}};mq.create=(q,_)=>{return new mq({innerType:q,typeName:z8.ZodNullable,...Z8(_)})};F_=class F_ extends k8{_parse(q){let{ctx:_}=this._processInputParams(q),j=_.data;if(_.parsedType===Q.undefined)j=this._def.defaultValue();return this._def.innerType._parse({data:j,path:_.path,parent:_})}removeDefault(){return this._def.innerType}};F_.create=(q,_)=>{return new F_({innerType:q,typeName:z8.ZodDefault,defaultValue:typeof _.default==="function"?_.default:()=>_.default,...Z8(_)})};U_=class U_ extends k8{_parse(q){let{ctx:_}=this._processInputParams(q),j={..._,common:{..._.common,issues:[]}},K=this._def.innerType._parse({data:j.data,path:j.path,parent:{...j}});if(gK(K))return K.then((Y)=>{return{status:"valid",value:Y.status==="valid"?Y.value:this._def.catchValue({get error(){return new g6(j.common.issues)},input:j.data})}});else return{status:"valid",value:K.status==="valid"?K.value:this._def.catchValue({get error(){return new g6(j.common.issues)},input:j.data})}}removeCatch(){return this._def.innerType}};U_.create=(q,_)=>{return new U_({innerType:q,typeName:z8.ZodCatch,catchValue:typeof _.catch==="function"?_.catch:()=>_.catch,...Z8(_)})};lK=class lK extends k8{_parse(q){if(this._getType(q)!==Q.nan){let j=this._getOrReturnCtx(q);return F(j,{code:t.invalid_type,expected:Q.nan,received:j.parsedType}),O8}return{status:"valid",value:q.data}}};lK.create=(q)=>{return new lK({typeName:z8.ZodNaN,...Z8(q)})};jZ=Symbol("zod_brand");r3=class r3 extends k8{_parse(q){let{ctx:_}=this._processInputParams(q),j=_.data;return this._def.type._parse({data:j,path:_.path,parent:_})}unwrap(){return this._def.type}};nK=class nK extends k8{_parse(q){let{status:_,ctx:j}=this._processInputParams(q);if(j.common.async)return(async()=>{let Y=await this._def.in._parseAsync({data:j.data,path:j.path,parent:j});if(Y.status==="aborted")return O8;if(Y.status==="dirty")return _.dirty(),l_(Y.value);else return this._def.out._parseAsync({data:Y.value,path:j.path,parent:j})})();else{let K=this._def.in._parseSync({data:j.data,path:j.path,parent:j});if(K.status==="aborted")return O8;if(K.status==="dirty")return _.dirty(),{status:"dirty",value:K.value};else return this._def.out._parseSync({data:K.value,path:j.path,parent:j})}}static create(q,_){return new nK({in:q,out:_,typeName:z8.ZodPipeline})}};s_=class s_ extends k8{_parse(q){let _=this._def.innerType._parse(q),j=(K)=>{if(j_(K))K.value=Object.freeze(K.value);return K};return gK(_)?_.then((K)=>j(K)):j(_)}unwrap(){return this._def.innerType}};s_.create=(q,_)=>{return new s_({innerType:q,typeName:z8.ZodReadonly,...Z8(_)})};PZ={object:i8.lazycreate};(function(q){q.ZodString="ZodString",q.ZodNumber="ZodNumber",q.ZodNaN="ZodNaN",q.ZodBigInt="ZodBigInt",q.ZodBoolean="ZodBoolean",q.ZodDate="ZodDate",q.ZodSymbol="ZodSymbol",q.ZodUndefined="ZodUndefined",q.ZodNull="ZodNull",q.ZodAny="ZodAny",q.ZodUnknown="ZodUnknown",q.ZodNever="ZodNever",q.ZodVoid="ZodVoid",q.ZodArray="ZodArray",q.ZodObject="ZodObject",q.ZodUnion="ZodUnion",q.ZodDiscriminatedUnion="ZodDiscriminatedUnion",q.ZodIntersection="ZodIntersection",q.ZodTuple="ZodTuple",q.ZodRecord="ZodRecord",q.ZodMap="ZodMap",q.ZodSet="ZodSet",q.ZodFunction="ZodFunction",q.ZodLazy="ZodLazy",q.ZodLiteral="ZodLiteral",q.ZodEnum="ZodEnum",q.ZodEffects="ZodEffects",q.ZodNativeEnum="ZodNativeEnum",q.ZodOptional="ZodOptional",q.ZodNullable="ZodNullable",q.ZodDefault="ZodDefault",q.ZodCatch="ZodCatch",q.ZodPromise="ZodPromise",q.ZodBranded="ZodBranded",q.ZodPipeline="ZodPipeline",q.ZodReadonly="ZodReadonly"})(z8||(z8={}));F1=Pq.create,U1=nq.create,fZ=lK.create,$Z=xq.create,s1=c_.create,wZ=P_.create,OZ=yK.create,vZ=r_.create,zZ=i_.create,WZ=Y_.create,JZ=lq.create,HZ=Zq.create,TZ=dK.create,ZZ=Yq.create,kZ=i8.create,XZ=i8.strictCreate,AZ=o_.create,GZ=c3.create,uZ=a_.create,hZ=kq.create,DZ=pK.create,CZ=LK.create,VZ=f_.create,MZ=n_.create,NZ=B_.create,bZ=t_.create,SZ=cq.create,EZ=e_.create,RZ=$_.create,I1=t6.create,mZ=fq.create,IZ=mq.create,gZ=t6.createWithPreprocess,yZ=nK.create,lZ={string:(q)=>Pq.create({...q,coerce:!0}),number:(q)=>nq.create({...q,coerce:!0}),boolean:(q)=>c_.create({...q,coerce:!0}),bigint:(q)=>xq.create({...q,coerce:!0}),date:(q)=>P_.create({...q,coerce:!0})},nZ=O8,Q1=Z.union([Z.string(),Z.number().int()]),qP=Z.string(),xZ=Z.object({progressToken:Z.optional(Q1)}).passthrough(),e6=Z.object({_meta:Z.optional(xZ)}).passthrough(),S6=Z.object({method:Z.string(),params:Z.optional(e6)}),xK=Z.object({_meta:Z.optional(Z.object({}).passthrough())}).passthrough(),Xq=Z.object({method:Z.string(),params:Z.optional(xK)}),F6=Z.object({_meta:Z.optional(Z.object({}).passthrough())}).passthrough(),o3=Z.union([Z.string(),Z.number().int()]),cZ=Z.object({jsonrpc:Z.literal(i3),id:o3}).merge(S6).strict(),rZ=Z.object({jsonrpc:Z.literal(i3)}).merge(Xq).strict(),iZ=Z.object({jsonrpc:Z.literal(i3),id:o3,result:F6}).strict();(function(q){q[q.ConnectionClosed=-32000]="ConnectionClosed",q[q.RequestTimeout=-32001]="RequestTimeout",q[q.ParseError=-32700]="ParseError",q[q.InvalidRequest=-32600]="InvalidRequest",q[q.MethodNotFound=-32601]="MethodNotFound",q[q.InvalidParams=-32602]="InvalidParams",q[q.InternalError=-32603]="InternalError"})(g1||(g1={}));oZ=Z.object({jsonrpc:Z.literal(i3),id:o3,error:Z.object({code:Z.number().int(),message:Z.string(),data:Z.optional(Z.unknown())})}).strict(),hC=Z.union([cZ,rZ,iZ,oZ]),_P=F6.strict(),KP=Xq.extend({method:Z.literal("notifications/cancelled"),params:xK.extend({requestId:o3,reason:Z.string().optional()})}),cK=Z.object({name:Z.string(),title:Z.optional(Z.string())}).passthrough(),jP=cK.extend({version:Z.string()}),aZ=Z.object({experimental:Z.optional(Z.object({}).passthrough()),sampling:Z.optional(Z.object({}).passthrough()),elicitation:Z.optional(Z.object({}).passthrough()),roots:Z.optional(Z.object({listChanged:Z.optional(Z.boolean())}).passthrough())}).passthrough(),BZ=S6.extend({method:Z.literal("initialize"),params:e6.extend({protocolVersion:Z.string(),capabilities:aZ,clientInfo:jP})}),tZ=Z.object({experimental:Z.optional(Z.object({}).passthrough()),logging:Z.optional(Z.object({}).passthrough()),completions:Z.optional(Z.object({}).passthrough()),prompts:Z.optional(Z.object({listChanged:Z.optional(Z.boolean())}).passthrough()),resources:Z.optional(Z.object({subscribe:Z.optional(Z.boolean()),listChanged:Z.optional(Z.boolean())}).passthrough()),tools:Z.optional(Z.object({listChanged:Z.optional(Z.boolean())}).passthrough())}).passthrough(),eZ=F6.extend({protocolVersion:Z.string(),capabilities:tZ,serverInfo:jP,instructions:Z.optional(Z.string())}),FZ=Xq.extend({method:Z.literal("notifications/initialized")}),PP=S6.extend({method:Z.literal("ping")}),UZ=Z.object({progress:Z.number(),total:Z.optional(Z.number()),message:Z.optional(Z.string())}).passthrough(),YP=Xq.extend({method:Z.literal("notifications/progress"),params:xK.merge(UZ).extend({progressToken:Q1})}),a3=S6.extend({params:e6.extend({cursor:Z.optional(qP)}).optional()}),B3=F6.extend({nextCursor:Z.optional(qP)}),fP=Z.object({uri:Z.string(),mimeType:Z.optional(Z.string()),_meta:Z.optional(Z.object({}).passthrough())}).passthrough(),$P=fP.extend({text:Z.string()}),Q4=Z.string().refine((q)=>{try{return atob(q),!0}catch(_){return!1}},{message:"Invalid Base64 string"}),wP=fP.extend({blob:Q4}),OP=cK.extend({uri:Z.string(),description:Z.optional(Z.string()),mimeType:Z.optional(Z.string()),_meta:Z.optional(Z.object({}).passthrough())}),sZ=cK.extend({uriTemplate:Z.string(),description:Z.optional(Z.string()),mimeType:Z.optional(Z.string()),_meta:Z.optional(Z.object({}).passthrough())}),QZ=a3.extend({method:Z.literal("resources/list")}),qk=B3.extend({resources:Z.array(OP)}),_k=a3.extend({method:Z.literal("resources/templates/list")}),Kk=B3.extend({resourceTemplates:Z.array(sZ)}),jk=S6.extend({method:Z.literal("resources/read"),params:e6.extend({uri:Z.string()})}),Pk=F6.extend({contents:Z.array(Z.union([$P,wP]))}),Yk=Xq.extend({method:Z.literal("notifications/resources/list_changed")}),fk=S6.extend({method:Z.literal("resources/subscribe"),params:e6.extend({uri:Z.string()})}),$k=S6.extend({method:Z.literal("resources/unsubscribe"),params:e6.extend({uri:Z.string()})}),wk=Xq.extend({method:Z.literal("notifications/resources/updated"),params:xK.extend({uri:Z.string()})}),Ok=Z.object({name:Z.string(),description:Z.optional(Z.string()),required:Z.optional(Z.boolean())}).passthrough(),vk=cK.extend({description:Z.optional(Z.string()),arguments:Z.optional(Z.array(Ok)),_meta:Z.optional(Z.object({}).passthrough())}),zk=a3.extend({method:Z.literal("prompts/list")}),Wk=B3.extend({prompts:Z.array(vk)}),Jk=S6.extend({method:Z.literal("prompts/get"),params:e6.extend({name:Z.string(),arguments:Z.optional(Z.record(Z.string()))})}),q2=Z.object({type:Z.literal("text"),text:Z.string(),_meta:Z.optional(Z.object({}).passthrough())}).passthrough(),_2=Z.object({type:Z.literal("image"),data:Q4,mimeType:Z.string(),_meta:Z.optional(Z.object({}).passthrough())}).passthrough(),K2=Z.object({type:Z.literal("audio"),data:Q4,mimeType:Z.string(),_meta:Z.optional(Z.object({}).passthrough())}).passthrough(),Hk=Z.object({type:Z.literal("resource"),resource:Z.union([$P,wP]),_meta:Z.optional(Z.object({}).passthrough())}).passthrough(),Tk=OP.extend({type:Z.literal("resource_link")}),vP=Z.union([q2,_2,K2,Tk,Hk]),Zk=Z.object({role:Z.enum(["user","assistant"]),content:vP}).passthrough(),kk=F6.extend({description:Z.optional(Z.string()),messages:Z.array(Zk)}),Xk=Xq.extend({method:Z.literal("notifications/prompts/list_changed")}),Ak=Z.object({title:Z.optional(Z.string()),readOnlyHint:Z.optional(Z.boolean()),destructiveHint:Z.optional(Z.boolean()),idempotentHint:Z.optional(Z.boolean()),openWorldHint:Z.optional(Z.boolean())}).passthrough(),Gk=cK.extend({description:Z.optional(Z.string()),inputSchema:Z.object({type:Z.literal("object"),properties:Z.optional(Z.object({}).passthrough()),required:Z.optional(Z.array(Z.string()))}).passthrough(),outputSchema:Z.optional(Z.object({type:Z.literal("object"),properties:Z.optional(Z.object({}).passthrough()),required:Z.optional(Z.array(Z.string()))}).passthrough()),annotations:Z.optional(Ak),_meta:Z.optional(Z.object({}).passthrough())}),uk=a3.extend({method:Z.literal("tools/list")}),hk=B3.extend({tools:Z.array(Gk)}),zP=F6.extend({content:Z.array(vP).default([]),structuredContent:Z.object({}).passthrough().optional(),isError:Z.optional(Z.boolean())}),DC=zP.or(F6.extend({toolResult:Z.unknown()})),Dk=S6.extend({method:Z.literal("tools/call"),params:e6.extend({name:Z.string(),arguments:Z.optional(Z.record(Z.unknown()))})}),Ck=Xq.extend({method:Z.literal("notifications/tools/list_changed")}),WP=Z.enum(["debug","info","notice","warning","error","critical","alert","emergency"]),Vk=S6.extend({method:Z.literal("logging/setLevel"),params:e6.extend({level:WP})}),Mk=Xq.extend({method:Z.literal("notifications/message"),params:xK.extend({level:WP,logger:Z.optional(Z.string()),data:Z.unknown()})}),Nk=Z.object({name:Z.string().optional()}).passthrough(),bk=Z.object({hints:Z.optional(Z.array(Nk)),costPriority:Z.optional(Z.number().min(0).max(1)),speedPriority:Z.optional(Z.number().min(0).max(1)),intelligencePriority:Z.optional(Z.number().min(0).max(1))}).passthrough(),Sk=Z.object({role:Z.enum(["user","assistant"]),content:Z.union([q2,_2,K2])}).passthrough(),Ek=S6.extend({method:Z.literal("sampling/createMessage"),params:e6.extend({messages:Z.array(Sk),systemPrompt:Z.optional(Z.string()),includeContext:Z.optional(Z.enum(["none","thisServer","allServers"])),temperature:Z.optional(Z.number()),maxTokens:Z.number().int(),stopSequences:Z.optional(Z.array(Z.string())),metadata:Z.optional(Z.object({}).passthrough()),modelPreferences:Z.optional(bk)})}),Rk=F6.extend({model:Z.string(),stopReason:Z.optional(Z.enum(["endTurn","stopSequence","maxTokens"]).or(Z.string())),role:Z.enum(["user","assistant"]),content:Z.discriminatedUnion("type",[q2,_2,K2])}),mk=Z.object({type:Z.literal("boolean"),title:Z.optional(Z.string()),description:Z.optional(Z.string()),default:Z.optional(Z.boolean())}).passthrough(),Ik=Z.object({type:Z.literal("string"),title:Z.optional(Z.string()),description:Z.optional(Z.string()),minLength:Z.optional(Z.number()),maxLength:Z.optional(Z.number()),format:Z.optional(Z.enum(["email","uri","date","date-time"]))}).passthrough(),gk=Z.object({type:Z.enum(["number","integer"]),title:Z.optional(Z.string()),description:Z.optional(Z.string()),minimum:Z.optional(Z.number()),maximum:Z.optional(Z.number())}).passthrough(),yk=Z.object({type:Z.literal("string"),title:Z.optional(Z.string()),description:Z.optional(Z.string()),enum:Z.array(Z.string()),enumNames:Z.optional(Z.array(Z.string()))}).passthrough(),dk=Z.union([mk,Ik,gk,yk]),pk=S6.extend({method:Z.literal("elicitation/create"),params:e6.extend({message:Z.string(),requestedSchema:Z.object({type:Z.literal("object"),properties:Z.record(Z.string(),dk),required:Z.optional(Z.array(Z.string()))}).passthrough()})}),Lk=F6.extend({action:Z.enum(["accept","decline","cancel"]),content:Z.optional(Z.record(Z.string(),Z.unknown()))}),lk=Z.object({type:Z.literal("ref/resource"),uri:Z.string()}).passthrough(),nk=Z.object({type:Z.literal("ref/prompt"),name:Z.string()}).passthrough(),xk=S6.extend({method:Z.literal("completion/complete"),params:e6.extend({ref:Z.union([nk,lk]),argument:Z.object({name:Z.string(),value:Z.string()}).passthrough(),context:Z.optional(Z.object({arguments:Z.optional(Z.record(Z.string(),Z.string()))}))})}),ck=F6.extend({completion:Z.object({values:Z.array(Z.string()).max(100),total:Z.optional(Z.number().int()),hasMore:Z.optional(Z.boolean())}).passthrough()}),rk=Z.object({uri:Z.string().startsWith("file://"),name:Z.optional(Z.string()),_meta:Z.optional(Z.object({}).passthrough())}).passthrough(),ik=S6.extend({method:Z.literal("roots/list")}),ok=F6.extend({roots:Z.array(rk)}),ak=Xq.extend({method:Z.literal("notifications/roots/list_changed")}),CC=Z.union([PP,BZ,xk,Vk,Jk,zk,QZ,_k,jk,fk,$k,Dk,uk]),VC=Z.union([KP,YP,FZ,ak]),MC=Z.union([_P,Rk,Lk,ok]),NC=Z.union([PP,Ek,pk,ik]),bC=Z.union([KP,YP,Mk,wk,Yk,Ck,Xk]),SC=Z.union([_P,eZ,ck,kk,Wk,qk,Kk,Pk,zP,hk]),EC=xH(hT(),1),RC=Symbol("Let zodToJsonSchema decide on which parser to use"),mC=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");(function(q){q.Completable="McpCompletable"})(t4||(t4={}));e4=class e4 extends k8{_parse(q){let{ctx:_}=this._processInputParams(q),j=_.data;return this._def.type._parse({data:j,path:_.path,parent:_})}unwrap(){return this._def.type}};e4.create=(q,_)=>{return new e4({type:q,typeName:t4.Completable,complete:_.complete,...Bk(_)})}});var HP={};uK(HP,{version:()=>Fk,type:()=>sk,scripts:()=>qX,repository:()=>PX,publishConfig:()=>$X,name:()=>ek,main:()=>Qk,license:()=>jX,keywords:()=>_X,homepage:()=>YX,files:()=>WX,engines:()=>vX,devDependencies:()=>OX,description:()=>Uk,dependencies:()=>wX,default:()=>JX,bugs:()=>fX,bin:()=>zX,author:()=>KX});var ek="claude-mem",Fk="3.5.4",Uk="Memory compression system for Claude Code - persist context across sessions",sk="module",Qk="claude-mem",qX,_X,KX="Alex Newman",jX="SEE LICENSE IN LICENSE",PX,YX="https://github.com/thedotmack/claude-mem#readme",fX,$X,wX,OX,vX,zX,WX,JX;var TP=Y6(()=>{qX={dev:"tsx src/bin/cli.ts","dev:install":"node dist/claude-mem.min.js install --force","dev:status":"node dist/claude-mem.min.js status","dev:compress":"node dist/claude-mem.min.js compress","dev:load":"node dist/claude-mem.min.js load-context","dev:uninstall":"node dist/claude-mem.min.js uninstall",build:"./scripts/build-minified.sh","test:watch":"npm test -- --watch",lint:"eslint 'src/**/*.ts' 'hooks/**/*.ts' 'test/**/*.ts'","lint:fix":"npm run lint -- --fix",format:"prettier --write 'src/**/*.ts' 'hooks/**/*.ts' 'test/**/*.ts'",publish:"./scripts/npm-publish.sh && cd releases/npm-package && npm publish","publish:latest":"npm version patch && ./scripts/npm-publish.sh && cd releases/npm-package && npm publish"},_X=["claude","claude-code","mcp","memory","compression","knowledge-graph","transcript","cli","typescript","bun"],PX={type:"git",url:"https://github.com/thedotmack/claude-mem.git"},fX={url:"https://github.com/thedotmack/claude-mem/issues"},$X={access:"public",registry:"https://registry.npmjs.org/"},wX={"@anthropic-ai/claude-code":"^1.0.88","@clack/prompts":"^0.11.0","@modelcontextprotocol/sdk":"^0.5.0",boxen:"^8.0.1",chalk:"^5.6.0",chromadb:"^3.0.14",commander:"^14.0.0",glob:"^11.0.3","gradient-string":"^3.0.0",handlebars:"^4.7.8","oh-my-logo":"^0.3.2"},OX={"@types/chai":"^4.3.0","@types/handlebars":"^4.0.40","@types/node":"^20.0.0","@typescript-eslint/eslint-plugin":"^6.0.0","@typescript-eslint/parser":"^6.0.0",chai:"^4.3.0",eslint:"^8.0.0",prettier:"^3.0.0","ts-node":"^10.0.0",tsx:"^4.20.5",typescript:"^5.0.0"},vX={node:">=18.0.0",bun:">=1.0.0"},zX={"claude-mem":"dist/claude-mem.min.js"},WX=["dist","hooks","commands","docs"],JX={name:ek,version:Fk,description:Uk,type:sk,main:Qk,scripts:qX,keywords:_X,author:KX,license:jX,repository:PX,homepage:YX,bugs:fX,publishConfig:$X,dependencies:wX,devDependencies:OX,engines:vX,bin:zX,files:WX}});import{join as B8,dirname as t3,sep as HX}from"path";import{homedir as P2}from"os";import{existsSync as rK,statSync as TX}from"fs";import{execSync as ZX}from"child_process";import{fileURLToPath as kX}from"url";class _8{static instance=null;_dataDirectory=null;_packageRoot=null;_claudeConfigDirectory=null;static getInstance(){if(!_8.instance)_8.instance=new _8;return _8.instance}getDataDirectory(){if(this._dataDirectory)return this._dataDirectory;return this._dataDirectory=process.env.CLAUDE_MEM_DATA_DIR||B8(P2(),".claude-mem"),this._dataDirectory}getArchivesDirectory(){return B8(this.getDataDirectory(),"archives")}getHooksDirectory(){return B8(this.getDataDirectory(),"hooks")}getLogsDirectory(){return B8(this.getDataDirectory(),"logs")}getIndexDirectory(){return this.getDataDirectory()}getIndexPath(){return B8(this.getIndexDirectory(),"claude-mem-index.jsonl")}getTrashDirectory(){return B8(this.getDataDirectory(),"trash")}getBackupsDirectory(){return B8(this.getDataDirectory(),"backups")}getChromaDirectory(){return B8(this.getDataDirectory(),"chroma")}getProjectArchiveDirectory(q){return B8(this.getArchivesDirectory(),q)}getUserSettingsPath(){return B8(this.getDataDirectory(),"settings.json")}getClaudeConfigDirectory(){if(this._claudeConfigDirectory)return this._claudeConfigDirectory;return this._claudeConfigDirectory=process.env.CLAUDE_CONFIG_DIR||B8(P2(),".claude"),this._claudeConfigDirectory}getClaudeSettingsPath(){return B8(this.getClaudeConfigDirectory(),"settings.json")}getClaudeCommandsDirectory(){return B8(this.getClaudeConfigDirectory(),"commands")}getClaudeMdPath(){return B8(this.getClaudeConfigDirectory(),"CLAUDE.md")}getMcpConfigPath(){return B8(P2(),".claude.json")}getProjectMcpConfigPath(){return B8(process.cwd(),".mcp.json")}getPackageRoot(){if(this._packageRoot)return this._packageRoot;try{let j=u6.resolve("/Users/alexnewman/Scripts/claude-mem-source/package.json");return this._packageRoot=t3(j),this._packageRoot}catch{}let q=kX(import.meta.url),_=t3(q);for(let j=0;j<10;j++){let K=B8(_,"package.json");if(rK(K))try{if(u6(K).name==="claude-mem")return this._packageRoot=_,this._packageRoot}catch{}let Y=t3(_);if(Y===_)break;_=Y}try{let j=ZX("npm list -g claude-mem --json 2>/dev/null || npm list claude-mem --json 2>/dev/null",{encoding:"utf8"}),K=JSON.parse(j);if(K.dependencies?.["claude-mem"]?.resolved)return this._packageRoot=t3(K.dependencies["claude-mem"].resolved),this._packageRoot}catch{}throw new Error("Cannot locate claude-mem package root. Ensure claude-mem is properly installed.")}findPackageHooksDirectory(){let q=this.getPackageRoot(),_=B8(q,"hooks"),j=["pre-compact.js","session-start.js"];for(let K of j)if(!rK(B8(_,K)))throw new Error(`Package hooks directory missing required file: ${K}`);return _}findPackageCommandsDirectory(){let q=this.getPackageRoot(),_=B8(q,"commands"),j=["save.md"];for(let K of j)if(!rK(B8(_,K)))throw new Error(`Package commands directory missing required file: ${K}`);return _}ensureDirectory(q){if(!rK(q))u6("fs").mkdirSync(q,{recursive:!0})}ensureDirectories(q){q.forEach((_)=>this.ensureDirectory(_))}ensureAllDataDirectories(){this.ensureDirectories([this.getDataDirectory(),this.getArchivesDirectory(),this.getHooksDirectory(),this.getLogsDirectory(),this.getTrashDirectory(),this.getBackupsDirectory(),this.getChromaDirectory()])}ensureAllClaudeDirectories(){this.ensureDirectories([this.getClaudeConfigDirectory(),this.getClaudeCommandsDirectory()])}static extractProjectName(q){let _=q.split(HX),j=["src","lib","app","project","workspace"];for(let K=_.length-1;K>=0;K--)if(j.includes(_[K])&&K>0)return _[K-1];if(_.length>1)return _[_.length-2];return"unknown-project"}static getCurrentProjectName(){return u6("path").basename(process.cwd())}static createBackupFilename(q){let _=new Date().toISOString().replace(/[:.]/g,"-").replace("T","_").slice(0,19);return`${q}.backup.${_}`}static isPathAccessible(q){try{return rK(q)&&TX(q).isDirectory()}catch{return!1}}static getDataDirectory(){return _8.getInstance().getDataDirectory()}static getArchivesDirectory(){return _8.getInstance().getArchivesDirectory()}static getHooksDirectory(){return _8.getInstance().getHooksDirectory()}static getLogsDirectory(){return _8.getInstance().getLogsDirectory()}static getClaudeSettingsPath(){return _8.getInstance().getClaudeSettingsPath()}static getClaudeMdPath(){return _8.getInstance().getClaudeMdPath()}static findPackageHooksDirectory(){return _8.getInstance().findPackageHooksDirectory()}static findPackageCommandsDirectory(){return _8.getInstance().findPackageCommandsDirectory()}}var lC;var C6=Y6(()=>{lC=_8.getInstance()});class Iq{pathDiscovery;constructor(){this.pathDiscovery=_8.getInstance()}getConfigDir(){return this.pathDiscovery.getDataDirectory()}getIndexDir(){return this.pathDiscovery.getIndexDirectory()}getIndexPath(){return this.pathDiscovery.getIndexPath()}getArchiveDir(){return this.pathDiscovery.getArchivesDirectory()}getProjectArchiveDir(q){return this.pathDiscovery.getProjectArchiveDirectory(q)}getLogsDir(){return this.pathDiscovery.getLogsDirectory()}static ensureDirectory(q){_8.getInstance().ensureDirectory(q)}static ensureDirectories(q){_8.getInstance().ensureDirectories(q)}static extractProjectName(q){return _8.extractProjectName(q)}static getCurrentProjectPrefix(){return _8.getCurrentProjectName()}static getCurrentProjectName(){return _8.getCurrentProjectName()}}var Y2=Y6(()=>{C6()});function GX(q,_,j,K){let Y={projectPrefix:q,sessionId:_,timestamp:j||new Date().toISOString(),archiveFilename:K||`${_}.jsonl.archive`};return AX(Y)}function kP(q,_,j,K){let Y=GX(j,_,K),f=` + +RESPONSE FORMAT: +After storing memories in Chroma, return EXACTLY this JSON structure wrapped in tags: + + +{ + "overview": "2-3 sentence summary of session themes and accomplishments. Write for any developer to understand by organically defining jargon.", + "summaries": [ + { + "text": "What was accomplished (start with action verb)", + "document_id": "${j}_${_}_1", + "keywords": "comma, separated, terms", + "timestamp": "${K||new Date().toISOString()}", + "archive": "${_}.jsonl.archive" + } + ] +} + + +IMPORTANT: +- Return 3-10 summaries based on conversation complexity +- Each summary should correspond to a memory you attempted to store +- If tool calls fail, still return the JSON response with summaries +- The JSON must be valid and complete +- Place NOTHING outside the tags +- Do not include any explanatory text before or after the JSON`;return Y+` + +`+q+f}var ZP,XX=`You are analyzing a Claude Code conversation transcript to create memories using the Chroma MCP memory system. + +YOUR TASK: +1. Extract key learnings and accomplishments as natural language memories +2. Store memories using mcp__claude-mem__chroma_add_documents +3. Return a structured JSON response with the extracted summaries + +WHAT TO EXTRACT: +- Technical implementations (functions, classes, APIs, databases) +- Design patterns and architectural decisions +- Bug fixes and problem solutions +- Workflows, processes, and integrations +- Performance optimizations and improvements + +STORAGE INSTRUCTIONS: +Call mcp__claude-mem__chroma_add_documents with: +- collection_name: "claude_memories" +- documents: Array of natural language descriptions +- ids: ["{{projectPrefix}}_{{sessionId}}_1", "{{projectPrefix}}_{{sessionId}}_2", ...] +- metadatas: Array with fields: + * type: component/pattern/workflow/integration/concept/decision/tool/fix + * keywords: Comma-separated search terms + * context: Brief situation description + * timestamp: "{{timestamp}}" + * session_id: "{{sessionId}}" + +ERROR HANDLING: +If you get "IDs already exist" errors, use mcp__claude-mem__chroma_update_documents instead. +If any tool calls fail, continue and return the JSON response anyway. + +Project: {{projectPrefix}} +Session ID: {{sessionId}} + +Conversation to compress:`,AX;var XP=Y6(()=>{ZP=o6(L4(),1),AX=ZP.default.compile(XX,{noEscape:!0})});class f2{projectName;constructor(q="claude-mem"){this.projectName=q}createAnalysisPrompt(q){let _=new Date().toISOString();return{prompt:this.buildAnalysisPrompt(q),context:q,type:"analysis",timestamp:_}}createSessionStartPrompt(q){let _=new Date().toISOString();return{message:this.buildSessionStartMessage(q),context:q,type:"session",timestamp:_}}createHookResponse(q){let _=new Date().toISOString();return{...this.buildHookResponse(q),context:q,type:"hook",timestamp:_}}buildAnalysisPrompt(q){let{transcriptContent:_,sessionId:j,projectName:K=this.projectName}=q,Y=K.replace(/[-\s]/g,"_").toLowerCase();return kP(_,j,Y)}buildSessionStartMessage(q){let{sessionId:_,source:j,projectName:K=this.projectName,additionalContext:Y,transcriptPath:f,cwd:P}=q,$=`## Session Started (${j}) + +**Project**: ${K} +**Session ID**: ${_} `;if(f)$+=`**Transcript**: ${f} `;if(P)$+=`**Working Directory**: ${P} `;if(Y)$+=` +### Additional Context +${Y}`;return $+=` + +Memory system is active and ready to preserve context across sessions.`,$}buildHookResponse(q){let{hookEventName:_,success:j,message:K,data:Y,shouldContinue:f=j,stopReason:P}=q,$={continue:f,suppressOutput:!1};if(!f&&P)$.stopReason=P;if(_==="SessionStart")$.hookSpecificOutput={hookEventName:"SessionStart",additionalContext:K,...Y};else if(Y)$.hookSpecificOutput=Y;return $}validateAnalysisContext(q){return!!(q.transcriptContent&&q.sessionId)}validateSessionContext(q){return!!(q.sessionId&&q.source)}validateHookContext(q){return!!(q.hookEventName&&q.sessionId&&typeof q.success==="boolean")}getProjectName(){return this.projectName}setProjectName(q){this.projectName=q}}function AP(q,_,j={}){return{transcriptContent:q,sessionId:_,...j}}var GP=Y6(()=>{XP()});var w_;var uP=Y6(()=>{w_={COMPRESSION_STARTED:"\uD83D\uDE80 COMPRESSION STARTED",TRANSCRIPT_PATH:(q)=>`\uD83D\uDCC1 Transcript Path: ${q}`,SESSION_ID:(q)=>`\uD83D\uDD0D Session ID: ${q}`,PROJECT_NAME:(q)=>`\uD83D\uDCDD PROJECT NAME: ${q}`,CLAUDE_SDK_CALL:"\uD83E\uDD16 Calling Claude SDK to analyze and populate memory database...",TRANSCRIPT_STATS:(q,_)=>`\uD83D\uDCCA Transcript size: ${q} characters, ${_} messages`,COMPRESSION_COMPLETE:(q)=>`✅ COMPRESSION COMPLETE + Total summaries extracted: ${q}`,CLAUDE_PATH_FOUND:(q)=>`\uD83C\uDFAF Found Claude Code at: ${q}`,MCP_CONFIG_USED:(q)=>`\uD83D\uDCCB Using MCP config: ${q}`}});class hP{level=qK.INFO;setLevel(q){this.level=qK[q]}debug(q,..._){if(this.level<=qK.DEBUG)console.debug(`[DEBUG] ${q}`,..._)}info(q,..._){if(this.level<=qK.INFO)console.info(`[INFO] ${q}`,..._)}warn(q,..._){if(this.level<=qK.WARN)console.warn(`[WARN] ${q}`,..._)}error(q,_,j){if(this.level<=qK.ERROR){if(console.error(`[ERROR] ${q}`),_)console.error(_);if(j)console.error("Context:",j)}}}var qK,E8;var e3=Y6(()=>{qK={DEBUG:0,INFO:1,WARN:2,ERROR:3};E8=new hP});import{readFileSync as uX,existsSync as hX}from"fs";import{join as DX}from"path";function iK(){return DP.getClaudePath()}var DP;var CP=Y6(()=>{Y2();DP=class DP{static settingsPath;static cachedSettings=null;static{let q=new Iq;this.settingsPath=DX(q.getConfigDir(),"settings.json")}static readSettings(){if(this.cachedSettings!==null)return this.cachedSettings;try{if(hX(this.settingsPath)){let _=uX(this.settingsPath,"utf-8"),j=JSON.parse(_);return this.cachedSettings=j,j}}catch{}let q={};return this.cachedSettings=q,q}static getSetting(q,_){return this.readSettings()[q]??_}static getClaudePath(){return this.getSetting("claudePath","claude")}static clearCache(){this.cachedSettings=null}}});class O_{static DEFAULT_MAX_TOKENS=28000;static DEFAULT_MAX_BYTES=98000;static DEFAULT_CONTEXT_OVERLAP=2;static CHARS_PER_TOKEN_ESTIMATE=3.5;options;constructor(q={}){this.options={maxTokensPerChunk:q.maxTokensPerChunk??O_.DEFAULT_MAX_TOKENS,maxBytesPerChunk:q.maxBytesPerChunk??O_.DEFAULT_MAX_BYTES,preserveContext:q.preserveContext??!0,contextOverlap:q.contextOverlap??O_.DEFAULT_CONTEXT_OVERLAP,parallel:q.parallel??!1}}estimateTokenCount(q){return Math.ceil(q.length/O_.CHARS_PER_TOKEN_ESTIMATE)}parseFilteredOutput(q){let _=q.split(` +`).filter((K)=>K.trim()),j=[];for(let K of _)if(K.startsWith("- ")){let Y=K.substring(2);j.push({content:Y,estimatedTokens:this.estimateTokenCount(Y)})}return j}chunkTranscript(q){let _=this.parseFilteredOutput(q),j=[],K=[],Y=0,f=0,P=0;for(let $=0;$<_.length;$++){let O=_[$],w=this.formatMessage(O),v=Buffer.byteLength(w,"utf8"),z=O.estimatedTokens;if(K.length>0&&(Y+z>this.options.maxTokensPerChunk||f+v>this.options.maxBytesPerChunk)){let W=this.formatChunk(K);if(j.push({content:W,metadata:{chunkNumber:j.length+1,totalChunks:0,startIndex:P,endIndex:$-1,messageCount:K.length,estimatedTokens:Y,sizeBytes:f,hasOverlap:!1}}),K=[],Y=0,f=0,P=$,this.options.preserveContext&&j.length>0){let J=Math.max(0,$-this.options.contextOverlap);for(let k=J;k<$;k++){let H=_[k],X=this.formatMessage(H);K.push(H),Y+=H.estimatedTokens,f+=Buffer.byteLength(X,"utf8")}if(K.length>0)P=J}}K.push(O),Y+=z,f+=v}if(K.length>0){let $=this.formatChunk(K);j.push({content:$,metadata:{chunkNumber:j.length+1,totalChunks:0,startIndex:P,endIndex:_.length-1,messageCount:K.length,estimatedTokens:Y,sizeBytes:f,hasOverlap:this.options.preserveContext&&j.length>0}})}return j.forEach(($)=>{$.metadata.totalChunks=j.length}),j}formatMessage(q){return`- ${q.content}`}formatChunk(q){return q.map((_)=>this.formatMessage(_)).join(` +`)}createChunkHeader(q){let _=[];if(q.firstTimestamp&&q.lastTimestamp)_.push(`# ${q.firstTimestamp} to ${q.lastTimestamp} (chunk ${q.chunkNumber}/${q.totalChunks})`);else _.push(`# Chunk ${q.chunkNumber} of ${q.totalChunks}`);return _.join(` +`)+` +`}needsChunking(q){let _=this.estimateTokenCount(q),j=Buffer.byteLength(q,"utf8");return _>this.options.maxTokensPerChunk||j>this.options.maxBytesPerChunk}getChunkingStats(q){let _=q.reduce((Y,f)=>Y+f.metadata.messageCount,0),j=q.reduce((Y,f)=>Y+f.metadata.estimatedTokens,0),K=q.reduce((Y,f)=>Y+f.metadata.sizeBytes,0);return["\uD83D\uDCCA Chunking Statistics:",` • Total chunks: ${q.length}`,` • Total messages: ${_}`,` • Total estimated tokens: ${j.toLocaleString()}`,` • Total size: ${(K/1024).toFixed(1)} KB`,` • Average tokens per chunk: ${Math.round(j/q.length).toLocaleString()}`,` • Average size per chunk: ${(K/q.length/1024).toFixed(1)} KB`].join(` +`)}}var VP={};uK(VP,{TranscriptCompressor:()=>_K});import y6,{createWriteStream as CX}from"fs";import F3,{join as $2}from"path";class _K{paths;logStream=null;logFile=null;promptOrchestrator;chunkManager;constructor(q={}){this.paths=new Iq,this.promptOrchestrator=new f2,this.chunkManager=new O_,this.ensureClaudeMemStructure(),this.initializeLogging(),E8.debug("\uD83E\uDD16 TranscriptCompressor initialized")}ensureClaudeMemStructure(){let q=this.paths.getConfigDir(),_=this.paths.getIndexDir(),j=this.paths.getArchiveDir(),K=this.paths.getLogsDir();Iq.ensureDirectories([q,_,j,K])}initializeLogging(){let q=this.paths.getLogsDir(),_=new Date().toISOString().replace(/[:.]/g,"-");this.logFile=$2(q,`claude-mem-${_}.log`),this.logStream=CX(this.logFile,{flags:"a"}),this.debugLog("\uD83D\uDE80 DEBUG LOG STARTED"),this.debugLog(`\uD83D\uDCC1 Log file: ${this.logFile}`),this.debugLog("═".repeat(60))}debugLog(q){if(!this.logStream)return;let j=`[${new Date().toISOString()}] ${q} +`;this.logStream.write(j)}closeLogging(){if(this.logStream)this.debugLog("✅ DEBUG LOG ENDED"),this.logStream.end()}async compress(q,_,j){this.debugLog(`\uD83D\uDE80 Starting compression for: ${q}`),this.debugLog(`\uD83D\uDCCB Session ID: ${_||"auto-generated"}`);try{let K=j||Iq.getCurrentProjectPrefix();E8.debug(w_.PROJECT_NAME(K)),this.debugLog(`\uD83D\uDCDD PROJECT PREFIX: ${K}`);let Y=y6.readFileSync(q,"utf-8");this.debugLog(`\uD83D\uDCD6 Reading transcript: ${Y.length} bytes`);let f=Y.trim().split(` +`).filter((X)=>X.trim()),P=[],$=0;for(let X=0;X0)E8.debug(`Parse errors: ${$}`);this.debugLog(`\uD83D\uDCCA Transcript loaded: ${f.length} lines, ${P.length} messages, ${$} parse errors`);let O=_||F3.basename(q,".jsonl"),w=new Date().toISOString();for(let X=P.length-1;X>=0;X--){let A=P[X];if(A.timestamp)try{let G=A.timestamp,h;if(typeof G==="string"&&G.includes("T"))h=new Date(G);else{let V=Number(G),E=V<10000000000?V*1000:V;h=new Date(E)}if(!isNaN(h.getTime())){w=h.toISOString(),this.debugLog(`\uD83D\uDCC5 Using timestamp from last message: ${w}`);break}}catch(G){this.debugLog(`⚠️ Invalid timestamp in message: ${A.timestamp}, trying earlier message`)}}let v=`${O}.jsonl.archive`,z=this.formatConversationForPrompt(P),W=this.chunkManager.needsChunking(z),J=[],k=null;if(W){let X=await this.compressInChunks(P,O,K);J=X.summaries,k=X.overview}else{let X=AP(z,O,{projectName:K,trigger:"manual"}),A=this.promptOrchestrator.createAnalysisPrompt(X);E8.debug("\uD83D\uDCE4 Analysis prompt created"),E8.debug(`\uD83D\uDCCA Prompt length: ${A.prompt.length} characters`);let G=F3.join(this.paths.getLogsDir(),`claude-prompt-${Date.now()}.txt`);y6.writeFileSync(G,`=== CLAUDE ANALYSIS PROMPT === +${A.prompt} +`),this.debugLog(`\uD83D\uDCDD Full prompt saved to: ${G}`);let h=iK(),V=this.findMCPConfig();if(E8.debug(w_.CLAUDE_PATH_FOUND(h)),V)E8.debug(w_.MCP_CONFIG_USED(V));this.debugLog("\uD83E\uDD16 Calling Claude SDK with MCP tools...");let E=await j2({prompt:A.prompt,options:{allowedTools:["mcp__claude-mem__chroma_list_collections","mcp__claude-mem__chroma_create_collection","mcp__claude-mem__chroma_peek_collection","mcp__claude-mem__chroma_get_collection_info","mcp__claude-mem__chroma_get_collection_count","mcp__claude-mem__chroma_modify_collection","mcp__claude-mem__chroma_fork_collection","mcp__claude-mem__chroma_delete_collection","mcp__claude-mem__chroma_add_documents","mcp__claude-mem__chroma_query_documents","mcp__claude-mem__chroma_get_documents","mcp__claude-mem__chroma_update_documents","mcp__claude-mem__chroma_delete_documents"],pathToClaudeCodeExecutable:iK()}});this.debugLog("✅ Claude SDK response received"),this.debugLog("\uD83D\uDD04 Processing Claude JSON response...");let M=await this.processClaudeResponse(E);if(this.debugLog(`\uD83D\uDCCB Extracted ${M.summaries.length} summaries from JSON`),M.overview)this.debugLog(`\uD83D\uDCDD Overview: ${M.overview}`);J=M.summaries,k=M.overview}E8.debug(w_.COMPRESSION_COMPLETE(J.length));let H=this.createArchive(q,K,O,Y);return this.debugLog(`\uD83D\uDCE6 Archive created: ${H}`),this.appendToIndex(J,k,K,O,P,H,w),this.debugLog(`\uD83D\uDCE5 Written ${J.length} summaries to index`),E8.debug("✅ SUCCESS"),E8.debug(`Archive created: ${H}`),E8.debug(`Summaries created: ${J.length}`),this.debugLog("✅ Compression completed successfully"),this.closeLogging(),H}catch(K){throw E8.error("COMPRESSION FAILED",K,{transcriptPath:q,sessionId:_}),this.debugLog(`❌ ERROR: ${K instanceof Error?K.message:String(K)}`),this.closeLogging(),K}}findMCPConfig(){let q=_8.getInstance();return[q.getProjectMcpConfigPath(),q.getMcpConfigPath(),$2(q.getClaudeConfigDirectory(),".mcp.json")].find(y6.existsSync)||q.getMcpConfigPath()}async processClaudeResponse(q){let _="";_=await this.extractResponseContent(q,[]),this.debugLog(`\uD83D\uDD0D Claude response content length: ${_.length}`);let j=F3.join(this.paths.getLogsDir(),`claude-response-${Date.now()}.txt`);y6.writeFileSync(j,`=== CLAUDE RAW RESPONSE === +${_} +`),this.debugLog(`\uD83D\uDCDD Raw response saved to: ${j}`);let K=this.extractJSONResponse(_);if(this.debugLog(`\uD83D\uDCCA Extracted ${K.summaries.length} summaries from JSON`),K.summaries.length===0)this.debugLog("⚠️ No summaries found in JSON response");return K}async extractResponseContent(q,_){if(q&&typeof q==="object"&&Symbol.asyncIterator in q){let j="";for await(let K of q){let Y=this.extractMessageContent(K);if(j+=Y,Y)process.stdout.write(Y);if(K?.type==="result"&&K?.result)j=K.result}return j}if(typeof q==="string")return q;if(Array.isArray(q))return q.map((j)=>{if(typeof j==="string")return j;if(j?.text)return j.text;if(j?.content)return j.content;return""}).filter(Boolean).join(` +`);if(typeof q==="object"&&q!==null){if(q?.text)return q.text;if(q?.content)return q.content;if(q?.message)return q.message;return""}return""}extractMessageContent(q){let _="";if(q?.content)_+=q.content;if(q?.text)_+=q.text;if(q?.data)_+=q.data;if(q?.message?.content&&Array.isArray(q.message.content))q.message.content.forEach((j)=>{if(j.type==="text"&&j.text)_+=j.text});return _}extractJSONResponse(q){try{let _=q.match(/([\s\S]*?)<\/JSONResponse>/);if(!_)return this.debugLog("⚠️ No tags found in response"),{overview:null,summaries:[]};let j=_[1].trim();this.debugLog(`✅ Found JSON response: ${j.length} chars`);let K=JSON.parse(j);if(!K.summaries||!Array.isArray(K.summaries))return this.debugLog("⚠️ Invalid JSON structure: missing summaries array"),{overview:null,summaries:[]};let Y=[];if(K.summaries.forEach((f,P)=>{if(!f.text||!f.document_id){this.debugLog(`⚠️ Skipping invalid summary at index ${P}`);return}let $={text:f.text,document_id:f.document_id,keywords:f.keywords||"",timestamp:f.timestamp||new Date().toISOString(),archive:f.archive||`${f.document_id}.jsonl.archive`};Y.push($),this.debugLog(`✅ Valid summary ${P+1}: ${f.document_id}`)}),K.overview)this.debugLog(`\uD83D\uDCDD Session overview: ${K.overview}`);return{overview:K.overview||null,summaries:Y}}catch(_){return this.debugLog(`❌ Failed to parse JSON response: ${_}`),this.debugLog("\uD83D\uDD04 Attempting fallback to pipe-separated format..."),{overview:null,summaries:this.extractLegacyPipeSeparatedLines(q).map((Y,f)=>{let P=Y.split(" | ");return{text:P[0]||"",document_id:P[1]||`legacy_${Date.now()}_${f}`,keywords:P[2]||"",timestamp:P[3]||new Date().toISOString(),archive:P[4]||`legacy_${Date.now()}_${f}.jsonl.archive`}})}}}extractLegacyPipeSeparatedLines(q){let _=q.split(` +`),j=[];return _.forEach((K)=>{let Y=K.trim();if(Y&&Y.includes(" | ")&&Y.split(" | ").length>=3)j.push(Y)}),this.debugLog(`\uD83D\uDCCA Fallback extracted ${j.length} pipe-separated lines`),j}async compressInChunks(q,_,j){this.debugLog("\uD83D\uDCE6 Large transcript detected, processing in chunks...");let K=[];q.forEach((w,v)=>{let W=this.extractContent(w).replace(/\r\n/g,"\\n").replace(/\n/g,"\\n").replace(/\r/g,"\\n");K.push(`- ${W}`)});let Y=K.join(` +`),f=this.chunkManager.chunkTranscript(Y);this.debugLog(this.chunkManager.getChunkingStats(f)),console.log(` +\uD83D\uDCCA Processing ${f.length} chunks...`);let P=[],$=[];for(let w=0;w0)console.log(` ✅ Extracted ${A.summaries.length} memories from chunk ${w+1}`),P.push(...A.summaries);else console.log(` ⚠️ No memories extracted from chunk ${w+1}`);if(A.overview)console.log(` \uD83D\uDCDD Overview extracted from chunk ${w+1}`),$.push(A.overview)}let O=$.length>0?$.join(` + +`):null;return{summaries:P,overview:O}}formatConversationForPrompt(q){let _=[];return q.forEach((j,K)=>{let Y=j.type==="assistant"?"assistant":j.type==="user"?"user":j.type==="result"||j.type==="system"||j.type==="summary"?"system":j.message?.role||j.role,f=this.extractContent(j),P=j.session_id||"",$=this.normalizeTimestamp(j),O=j.uuid||"",v=`${f.replace(/\|/g,"\\|")} | ${P} | ${Y} | ${$} | ${O}`;_.push(v)}),E8.debug(`Field filtering complete: ${_.length} messages processed`),` +${_.join(` +`)} +`}extractContent(q){let _="";if(q.type==="tool_result")return this.extractToolResultContent(q);if(q.type==="assistant"||q.type==="user"){let j=q.message?.content;if(Array.isArray(j))_=j.map((K)=>this.extractContentItem(K)).filter(Boolean).join(" ");else if(j)_=String(j).trim()}else if(q.type==="summary")_=q.summary||"";else if(q.type==="result"){if(q.subtype==="success"&&q.result)_=`[Result: ${q.result}]`;else if(q.subtype==="error_max_turns")_="[Error: Maximum turns reached]";else if(q.subtype==="error_during_execution")_="[Error during execution]"}else if(q.type==="system")if(q.subtype==="init")_=`[System initialized: ${q.model}, tools: ${q.tools?.length||0}, MCP servers: ${q.mcp_servers?.length||0}]`;else _=String(q.content||"").trim();if(!_){if(_=String(q.message?.content||q.content||""),Array.isArray(_))_=_.map((j)=>j.text||j.content||"").filter(Boolean).join(" ")}if(q.toolUseResult){let j=this.summarizeToolResult(q.toolUseResult,_);if(j)_=_?`${_} + +${j}`:j}return String(_).trim()}extractContentItem(q){if(!q||typeof q!=="object")return String(q||"").trim();if(q.type==="text")return q.text||"";else if(q.type==="thinking")return q.thinking||"";else if(q.type==="tool_use"){let _=q.name||"unknown",j=q.id||"";return`[Tool: ${_}${j?` (${j})`:""}]`}else if(q.type==="tool_result"){let _=this.getToolResultSize(q);if(_>1048576)return`[FILTERED: Large tool result ~${Math.round(_/1048576*10)/10}MB - tool output to assistant]`;return this.extractToolResultFromItem(q)}else return q.text||q.content||q.thinking||JSON.stringify(q)}getToolResultSize(q){if(!q.content)return 0;if(Array.isArray(q.content))return q.content.reduce((_,j)=>{return _+(j.text_length||j.text?.length||j.content?.length||0)},0);if(typeof q.content==="string")return q.content.length;return JSON.stringify(q.content).length}extractToolResultContent(q){if(q.content&&Array.isArray(q.content)){let j=q.content.reduce((K,Y)=>{return K+(Y.text_length||Y.text?.length||0)},0);if(j>1048576)return`[FILTERED: Large tool result ~${Math.round(j/1048576*10)/10}MB - tool output to assistant]`;return q.content.map((K)=>this.extractToolResultFromItem(K)).filter(Boolean).join(" ")}if(q.content&&typeof q.content==="string"&&q.content.length>1048576)return`[FILTERED: Large tool result ~${Math.round(q.content.length/1048576*10)/10}MB - tool output to assistant]`;return this.extractToolResultFromItem(q)}extractToolResultFromItem(q){if(q.type==="text"&&q.text)return q.text;if(!q.content)return"[Tool result: no content]";if(Array.isArray(q.content))return q.content.map((_)=>{if(_.type==="text"&&_.text)return _.text;return _.text||_.content||""}).filter(Boolean).join(" ");if(typeof q.content==="string")return q.content;if(typeof q.content==="object")return q.content.text||q.content.content||"[Tool result: complex object]";return String(q.content||"")}createMessageFlowLabel(q,_){if(this.messageContainsToolResult(q))return`Message ${_} (tool → assistant)`;switch(q.type){case"user":return`Message ${_} (user → assistant)`;case"assistant":return`Message ${_} (assistant → user)`;case"system":return`Message ${_} (system)`;case"tool_result":return`Message ${_} (tool → assistant)`;case"summary":return`Message ${_} (session summary)`;case"result":if(q.subtype==="success")return`Message ${_} (session result)`;else if(q.subtype==="error_max_turns")return`Message ${_} (session error: max turns)`;else if(q.subtype==="error_during_execution")return`Message ${_} (session error: execution)`;return`Message ${_} (session result)`;default:return`Message ${_} (${q.type})`}}messageContainsToolResult(q){if(q.type==="user"&&q.message?.content&&Array.isArray(q.message.content))return q.message.content.some((_)=>_.type==="tool_result");if(q.type==="tool_result")return!0;if(q.content&&Array.isArray(q.content))return q.content.some((_)=>_.type==="tool_result");return!1}showFilteredOutput(q,_=!0){let K=y6.readFileSync(q,"utf-8").trim().split(` +`).filter((v)=>v.trim()),Y=[];for(let v of K)try{let z=JSON.parse(v);Y.push(z)}catch(z){continue}let f=[],P=Y.length>0?this.normalizeTimestamp(Y[0]):"",$=Y.length>0?this.normalizeTimestamp(Y[Y.length-1]):"";Y.forEach((v,z)=>{let J=this.extractContent(v).replace(/\r\n/g,"\\n").replace(/\n/g,"\\n").replace(/\r/g,"\\n");f.push(`- ${J}`)});let O=f.join(` +`),w=`/tmp/filtered-transcript-${Date.now()}`;if(_&&this.chunkManager.needsChunking(O)){console.log(` +\uD83D\uDCE6 Large transcript detected, chunking output...`);let v=this.chunkManager.chunkTranscript(O);console.log(this.chunkManager.getChunkingStats(v)),v.forEach((z,W)=>{let J=`${w}-chunk-${W+1}.txt`,k=z.metadata.startIndex,H=Math.min(z.metadata.endIndex,Y.length-1),X=Y[k]?this.normalizeTimestamp(Y[k]):"",A=Y[H]?this.normalizeTimestamp(Y[H]):"";z.metadata.firstTimestamp=X,z.metadata.lastTimestamp=A;let G=this.chunkManager.createChunkHeader(z.metadata)+z.content;y6.writeFileSync(J,G,"utf-8"),console.log(` ✅ Chunk ${W+1}/${v.length} saved to: ${J}`)}),console.log(`Processed ${Y.length} messages from transcript into ${v.length} chunks`),console.log(`\uD83D\uDCC5 Time range: ${P} to ${$}`)}else{let v=`${w}.txt`,z=`# ${P} to ${$} +${O}`;y6.writeFileSync(v,z,"utf-8"),console.log(` +Filtered output saved to: ${v}`),console.log(`Processed ${Y.length} messages from transcript`),console.log(`\uD83D\uDCC5 Time range: ${P} to ${$}`)}}summarizeToolResult(q,_){let j=[];if(q.stdout){let K=String(q.stdout);if(K.length>200){let Y=K.split(` +`).length,f=K.length,P=K.split(` +`),$=P.slice(0,3).join(` +`),O=P.length>6?` +... +${P.slice(-2).join(` +`)}`:"";j.push(`Result: ${$}${O} (${Y} lines, ${f} chars)`)}else j.push(`Result: ${K}`)}if(q.stderr&&q.stderr.trim())j.push(`Error: ${q.stderr}`);if(q.interrupted)j.push("(interrupted)");if(q.isImage)j.push("(image output)");return j.join(` +`)}normalizeTimestamp(q){let _=q.timestamp||q.message?.timestamp||q.created_at||q.message?.created_at;if(!_)return"";try{let j=new Date(_);if(isNaN(j.getTime()))return"";return j.toISOString().replace("T"," ")}catch(j){return E8.debug(`Invalid timestamp format: ${_}`),""}}createArchive(q,_,j,K){let Y=this.paths.getProjectArchiveDir(_);Iq.ensureDirectory(Y);let f=$2(Y,`${j}.jsonl.archive`);return y6.writeFileSync(f,K),E8.debug(`\uD83D\uDCE6 Created archive: ${f}`),f}appendToIndex(q,_,j,K,Y,f,P){let $=this.paths.getIndexPath(),O=this.paths.getConfigDir();Iq.ensureDirectory(O);let w={type:"session",session_id:K,timestamp:P,project:j};if(y6.appendFileSync($,JSON.stringify(w)+` +`),_){let v={type:"overview",content:_,session_id:K,project:j,timestamp:P};y6.appendFileSync($,JSON.stringify(v)+` +`)}if(!q||q.length===0){E8.debug("\uD83D\uDCDD No summaries extracted from JSON response");let v={type:"diagnostic",message:"NO SUMMARIES EXTRACTED - Check logs for valid JSON response",session_id:K,project:j,timestamp:P};y6.appendFileSync($,JSON.stringify(v)+` +`),this.debugLog(`⚠️ No summaries for session ${K} - Check if Claude returned valid JSON in tags`)}else q.forEach((v)=>{let z={type:"memory",text:v.text,document_id:v.document_id,keywords:v.keywords,session_id:K,project:j,timestamp:v.timestamp||P,archive:F3.basename(f)};y6.appendFileSync($,JSON.stringify(z)+` +`)}),E8.debug(`\uD83D\uDCDD Appended ${q.length} summaries to index as JSONL`);E8.debug(`Index path: ${$}`)}}var U3=Y6(()=>{JP();Y2();C6();GP();uP();e3();CP()});import{basename as MP}from"path";async function oK(q,_={}){if(console.log(u1("compressing")),!q){console.log(d_("Compression","No transcript file provided","Please provide a path to a transcript file"));return}try{let j=Date.now(),{TranscriptCompressor:K}=await Promise.resolve().then(() => (U3(),VP)),Y=new K({verbose:_.verbose||!1}),f=_.sessionId||MP(q,".jsonl"),P=await Y.compress(q,f),$=Date.now()-j;console.log(l3("Compression",void 0,`Session archived as ${MP(P)}`)),console.log(D1("compress",{count:1,duration:$,details:`Session: ${f}`}))}catch(j){let K=j instanceof Error?j.message:String(j);throw console.log(d_("Compression",K,"Check that the transcript file exists and you have write permissions")),j}}var w2=Y6(()=>{x4()});var v2=q8((kV,NP)=>{var O2={to(q,_){if(!_)return`\x1B[${q+1}G`;return`\x1B[${_+1};${q+1}H`},move(q,_){let j="";if(q<0)j+=`\x1B[${-q}D`;else if(q>0)j+=`\x1B[${q}C`;if(_<0)j+=`\x1B[${-_}A`;else if(_>0)j+=`\x1B[${_}B`;return j},up:(q=1)=>`\x1B[${q}A`,down:(q=1)=>`\x1B[${q}B`,forward:(q=1)=>`\x1B[${q}C`,backward:(q=1)=>`\x1B[${q}D`,nextLine:(q=1)=>"\x1B[E".repeat(q),prevLine:(q=1)=>"\x1B[F".repeat(q),left:"\x1B[G",hide:"\x1B[?25l",show:"\x1B[?25h",save:"\x1B7",restore:"\x1B8"},VX={up:(q=1)=>"\x1B[S".repeat(q),down:(q=1)=>"\x1B[T".repeat(q)},MX={screen:"\x1B[2J",up:(q=1)=>"\x1B[1J".repeat(q),down:(q=1)=>"\x1B[J".repeat(q),line:"\x1B[2K",lineEnd:"\x1B[K",lineStart:"\x1B[1K",lines(q){let _="";for(let j=0;j{var Q3=process||{},bP=Q3.argv||[],s3=Q3.env||{},NX=!(!!s3.NO_COLOR||bP.includes("--no-color"))&&(!!s3.FORCE_COLOR||bP.includes("--color")||Q3.platform==="win32"||(Q3.stdout||{}).isTTY&&s3.TERM!=="dumb"||!!s3.CI),bX=(q,_,j=q)=>(K)=>{let Y=""+K,f=Y.indexOf(_,q.length);return~f?q+SX(Y,_,j,f)+_:q+Y+_},SX=(q,_,j,K)=>{let Y="",f=0;do Y+=q.substring(f,K)+j,f=K+_.length,K=q.indexOf(_,f);while(~K);return Y+q.substring(f)},SP=(q=NX)=>{let _=q?bX:()=>String;return{isColorSupported:q,reset:_("\x1B[0m","\x1B[0m"),bold:_("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"),dim:_("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"),italic:_("\x1B[3m","\x1B[23m"),underline:_("\x1B[4m","\x1B[24m"),inverse:_("\x1B[7m","\x1B[27m"),hidden:_("\x1B[8m","\x1B[28m"),strikethrough:_("\x1B[9m","\x1B[29m"),black:_("\x1B[30m","\x1B[39m"),red:_("\x1B[31m","\x1B[39m"),green:_("\x1B[32m","\x1B[39m"),yellow:_("\x1B[33m","\x1B[39m"),blue:_("\x1B[34m","\x1B[39m"),magenta:_("\x1B[35m","\x1B[39m"),cyan:_("\x1B[36m","\x1B[39m"),white:_("\x1B[37m","\x1B[39m"),gray:_("\x1B[90m","\x1B[39m"),bgBlack:_("\x1B[40m","\x1B[49m"),bgRed:_("\x1B[41m","\x1B[49m"),bgGreen:_("\x1B[42m","\x1B[49m"),bgYellow:_("\x1B[43m","\x1B[49m"),bgBlue:_("\x1B[44m","\x1B[49m"),bgMagenta:_("\x1B[45m","\x1B[49m"),bgCyan:_("\x1B[46m","\x1B[49m"),bgWhite:_("\x1B[47m","\x1B[49m"),blackBright:_("\x1B[90m","\x1B[39m"),redBright:_("\x1B[91m","\x1B[39m"),greenBright:_("\x1B[92m","\x1B[39m"),yellowBright:_("\x1B[93m","\x1B[39m"),blueBright:_("\x1B[94m","\x1B[39m"),magentaBright:_("\x1B[95m","\x1B[39m"),cyanBright:_("\x1B[96m","\x1B[39m"),whiteBright:_("\x1B[97m","\x1B[39m"),bgBlackBright:_("\x1B[100m","\x1B[49m"),bgRedBright:_("\x1B[101m","\x1B[49m"),bgGreenBright:_("\x1B[102m","\x1B[49m"),bgYellowBright:_("\x1B[103m","\x1B[49m"),bgBlueBright:_("\x1B[104m","\x1B[49m"),bgMagentaBright:_("\x1B[105m","\x1B[49m"),bgCyanBright:_("\x1B[106m","\x1B[49m"),bgWhiteBright:_("\x1B[107m","\x1B[49m")}};z2.exports=SP();z2.exports.createColors=SP});import{stdin as lP,stdout as nP}from"node:process";import*as rq from"node:readline";import EP from"node:readline";import{Writable as EX}from"node:stream";function RX({onlyFirst:q=!1}={}){let _=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");return new RegExp(_,q?void 0:"g")}function cP(q){if(typeof q!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof q}\``);return q.replace(mX,"")}function rP(q){return q&&q.__esModule&&Object.prototype.hasOwnProperty.call(q,"default")?q.default:q}function aK(q,_={}){if(typeof q!="string"||q.length===0||(_={ambiguousIsNarrow:!0,..._},q=cP(q),q.length===0))return 0;q=q.replace(dX()," ");let j=_.ambiguousIsNarrow?1:2,K=0;for(let Y of q){let f=Y.codePointAt(0);if(f<=31||f>=127&&f<=159||f>=768&&f<=879)continue;switch(gX.eastAsianWidth(Y)){case"F":case"W":K+=2;break;case"A":K+=j;break;default:K+=1}}return K}function lX(){let q=new Map;for(let[_,j]of Object.entries(L8)){for(let[K,Y]of Object.entries(j))L8[K]={open:`\x1B[${Y[0]}m`,close:`\x1B[${Y[1]}m`},j[K]=L8[K],q.set(Y[0],Y[1]);Object.defineProperty(L8,_,{value:j,enumerable:!1})}return Object.defineProperty(L8,"codes",{value:q,enumerable:!1}),L8.color.close="\x1B[39m",L8.bgColor.close="\x1B[49m",L8.color.ansi=RP(),L8.color.ansi256=mP(),L8.color.ansi16m=IP(),L8.bgColor.ansi=RP(J2),L8.bgColor.ansi256=mP(J2),L8.bgColor.ansi16m=IP(J2),Object.defineProperties(L8,{rgbToAnsi256:{value:(_,j,K)=>_===j&&j===K?_<8?16:_>248?231:Math.round((_-8)/247*24)+232:16+36*Math.round(_/255*5)+6*Math.round(j/255*5)+Math.round(K/255*5),enumerable:!1},hexToRgb:{value:(_)=>{let j=/[a-f\d]{6}|[a-f\d]{3}/i.exec(_.toString(16));if(!j)return[0,0,0];let[K]=j;K.length===3&&(K=[...K].map((f)=>f+f).join(""));let Y=Number.parseInt(K,16);return[Y>>16&255,Y>>8&255,Y&255]},enumerable:!1},hexToAnsi256:{value:(_)=>L8.rgbToAnsi256(...L8.hexToRgb(_)),enumerable:!1},ansi256ToAnsi:{value:(_)=>{if(_<8)return 30+_;if(_<16)return 90+(_-8);let j,K,Y;if(_>=232)j=((_-232)*10+8)/255,K=j,Y=j;else{_-=16;let $=_%36;j=Math.floor(_/36)/5,K=Math.floor($/6)/5,Y=$%6/5}let f=Math.max(j,K,Y)*2;if(f===0)return 30;let P=30+(Math.round(Y)<<2|Math.round(K)<<1|Math.round(j));return f===2&&(P+=60),P},enumerable:!1},rgbToAnsi:{value:(_,j,K)=>L8.ansi256ToAnsi(L8.rgbToAnsi256(_,j,K)),enumerable:!1},hexToAnsi:{value:(_)=>L8.ansi256ToAnsi(L8.hexToAnsi256(_)),enumerable:!1}}),L8}function dP(q,_,j){return String(q).normalize().replace(/\r\n/g,` +`).split(` +`).map((K)=>oX(K,_,j)).join(` +`)}function X2(q,_){if(typeof q=="string")return _7.aliases.get(q)===_;for(let j of q)if(j!==void 0&&X2(j,_))return!0;return!1}function BX(q,_){if(q===_)return;let j=q.split(` +`),K=_.split(` +`),Y=[];for(let f=0;f{let w=String(P);if(X2([w,$,O],"cancel")){K&&_.write(T6.cursor.show),process.exit(0);return}if(!j)return;rq.moveCursor(_,$==="return"?0:-1,$==="return"?-1:0,()=>{rq.clearLine(_,1,()=>{q.once("keypress",f)})})};return K&&_.write(T6.cursor.hide),q.once("keypress",f),()=>{q.off("keypress",f),K&&_.write(T6.cursor.show),q.isTTY&&!tX&&q.setRawMode(!1),Y.terminal=!1,Y.close()}}class BK{constructor(q,_=!0){d6(this,"input"),d6(this,"output"),d6(this,"_abortSignal"),d6(this,"rl"),d6(this,"opts"),d6(this,"_render"),d6(this,"_track",!1),d6(this,"_prevFrame",""),d6(this,"_subscribers",new Map),d6(this,"_cursor",0),d6(this,"state","initial"),d6(this,"error",""),d6(this,"value");let{input:j=lP,output:K=nP,render:Y,signal:f,...P}=q;this.opts=P,this.onKeypress=this.onKeypress.bind(this),this.close=this.close.bind(this),this.render=this.render.bind(this),this._render=Y.bind(this),this._track=_,this._abortSignal=f,this.input=j,this.output=K}unsubscribe(){this._subscribers.clear()}setSubscriber(q,_){let j=this._subscribers.get(q)??[];j.push(_),this._subscribers.set(q,j)}on(q,_){this.setSubscriber(q,{cb:_})}once(q,_){this.setSubscriber(q,{cb:_,once:!0})}emit(q,..._){let j=this._subscribers.get(q)??[],K=[];for(let Y of j)Y.cb(..._),Y.once&&K.push(()=>j.splice(j.indexOf(Y),1));for(let Y of K)Y()}prompt(){return new Promise((q,_)=>{if(this._abortSignal){if(this._abortSignal.aborted)return this.state="cancel",this.close(),q(T2);this._abortSignal.addEventListener("abort",()=>{this.state="cancel",this.close()},{once:!0})}let j=new EX;j._write=(K,Y,f)=>{this._track&&(this.value=this.rl?.line.replace(/\t/g,""),this._cursor=this.rl?.cursor??0,this.emit("value",this.value)),f()},this.input.pipe(j),this.rl=EP.createInterface({input:this.input,output:j,tabSize:2,prompt:"",escapeCodeTimeout:50,terminal:!0}),EP.emitKeypressEvents(this.input,this.rl),this.rl.prompt(),this.opts.initialValue!==void 0&&this._track&&this.rl.write(this.opts.initialValue),this.input.on("keypress",this.onKeypress),q7(this.input,!0),this.output.on("resize",this.render),this.render(),this.once("submit",()=>{this.output.write(T6.cursor.show),this.output.off("resize",this.render),q7(this.input,!1),q(this.value)}),this.once("cancel",()=>{this.output.write(T6.cursor.show),this.output.off("resize",this.render),q7(this.input,!1),q(T2)})})}onKeypress(q,_){if(this.state==="error"&&(this.state="active"),_?.name&&(!this._track&&_7.aliases.has(_.name)&&this.emit("cursor",_7.aliases.get(_.name)),_7.actions.has(_.name)&&this.emit("cursor",_.name)),q&&(q.toLowerCase()==="y"||q.toLowerCase()==="n")&&this.emit("confirm",q.toLowerCase()==="y"),q==="\t"&&this.opts.placeholder&&(this.value||(this.rl?.write(this.opts.placeholder),this.emit("value",this.opts.placeholder))),q&&this.emit("key",q.toLowerCase()),_?.name==="return"){if(this.opts.validate){let j=this.opts.validate(this.value);j&&(this.error=j instanceof Error?j.message:j,this.state="error",this.rl?.write(this.value))}this.state!=="error"&&(this.state="submit")}X2([q,_?.name,_?.sequence],"cancel")&&(this.state="cancel"),(this.state==="submit"||this.state==="cancel")&&this.emit("finalize"),this.render(),(this.state==="submit"||this.state==="cancel")&&this.close()}close(){this.input.unpipe(),this.input.removeListener("keypress",this.onKeypress),this.output.write(` +`),q7(this.input,!1),this.rl?.close(),this.rl=void 0,this.emit(`${this.state}`,this.value),this.unsubscribe()}restoreCursor(){let q=dP(this._prevFrame,process.stdout.columns,{hard:!0}).split(` +`).length-1;this.output.write(T6.cursor.move(-999,q*-1))}render(){let q=dP(this._render(this)??"",process.stdout.columns,{hard:!0});if(q!==this._prevFrame){if(this.state==="initial")this.output.write(T6.cursor.hide);else{let _=BX(this._prevFrame,q);if(this.restoreCursor(),_&&_?.length===1){let j=_[0];this.output.write(T6.cursor.move(0,j)),this.output.write(T6.erase.lines(1));let K=q.split(` +`);this.output.write(K[j]),this._prevFrame=q,this.output.write(T6.cursor.move(0,K.length-j-1));return}if(_&&_?.length>1){let j=_[0];this.output.write(T6.cursor.move(0,j)),this.output.write(T6.erase.down());let K=q.split(` +`).slice(j);this.output.write(K.join(` +`)),this._prevFrame=q;return}this.output.write(T6.erase.down())}this.output.write(q),this.state==="initial"&&(this.state="active"),this._prevFrame=q}}}var T6,xP,mX,iP,IX,gX,yX=function(){return/\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67)\uDB40\uDC7F|(?:\uD83E\uDDD1\uD83C\uDFFF\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFC-\uDFFF])|\uD83D\uDC68(?:\uD83C\uDFFB(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|[\u2695\u2696\u2708]\uFE0F|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))?|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])\uFE0F|\u200D(?:(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D[\uDC66\uDC67])|\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC)?|(?:\uD83D\uDC69(?:\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69]))|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC69(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83E\uDDD1(?:\u200D(?:\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDE36\u200D\uD83C\uDF2B|\uD83C\uDFF3\uFE0F\u200D\u26A7|\uD83D\uDC3B\u200D\u2744|(?:(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\uD83C\uDFF4\u200D\u2620|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])\u200D[\u2640\u2642]|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u2600-\u2604\u260E\u2611\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26B0\u26B1\u26C8\u26CF\u26D1\u26D3\u26E9\u26F0\u26F1\u26F4\u26F7\u26F8\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u3030\u303D\u3297\u3299]|\uD83C[\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]|\uD83D[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3])\uFE0F|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDE35\u200D\uD83D\uDCAB|\uD83D\uDE2E\u200D\uD83D\uDCA8|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83E\uDDD1(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83D\uDC69(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF6\uD83C\uDDE6|\uD83C\uDDF4\uD83C\uDDF2|\uD83D\uDC08\u200D\u2B1B|\u2764\uFE0F\u200D(?:\uD83D\uDD25|\uD83E\uDE79)|\uD83D\uDC41\uFE0F|\uD83C\uDFF3\uFE0F|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|[#\*0-9]\uFE0F\u20E3|\u2764\uFE0F|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|\uD83C\uDFF4|(?:[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270C\u270D]|\uD83D[\uDD74\uDD90])(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC08\uDC15\uDC3B\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE2E\uDE35\uDE36\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5]|\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD]|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF]|[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0D\uDD0E\uDD10-\uDD17\uDD1D\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78\uDD7A-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCB\uDDD0\uDDE0-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6]|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26A7\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5-\uDED7\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDD77\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g},dX,J2=10,RP=(q=0)=>(_)=>`\x1B[${_+q}m`,mP=(q=0)=>(_)=>`\x1B[${38+q};5;${_}m`,IP=(q=0)=>(_,j,K)=>`\x1B[${38+q};2;${_};${j};${K}m`,L8,pX,LX,nX,K7,xX=39,Z2="\x07",oP="[",cX="]",aP="m",k2,gP=(q)=>`${K7.values().next().value}${oP}${q}${aP}`,yP=(q)=>`${K7.values().next().value}${k2}${q}${Z2}`,rX=(q)=>q.split(" ").map((_)=>aK(_)),H2=(q,_,j)=>{let K=[..._],Y=!1,f=!1,P=aK(cP(q[q.length-1]));for(let[$,O]of K.entries()){let w=aK(O);if(P+w<=j?q[q.length-1]+=O:(q.push(O),P=0),K7.has(O)&&(Y=!0,f=K.slice($+1).join("").startsWith(k2)),Y){f?O===Z2&&(Y=!1,f=!1):O===aP&&(Y=!1);continue}P+=w,P===j&&$0&&q.length>1&&(q[q.length-2]+=q.pop())},iX=(q)=>{let _=q.split(" "),j=_.length;for(;j>0&&!(aK(_[j-1])>0);)j--;return j===_.length?q:_.slice(0,j).join(" ")+_.slice(j).join("")},oX=(q,_,j={})=>{if(j.trim!==!1&&q.trim()==="")return"";let K="",Y,f,P=rX(q),$=[""];for(let[w,v]of q.split(" ").entries()){j.trim!==!1&&($[$.length-1]=$[$.length-1].trimStart());let z=aK($[$.length-1]);if(w!==0&&(z>=_&&(j.wordWrap===!1||j.trim===!1)&&($.push(""),z=0),(z>0||j.trim===!1)&&($[$.length-1]+=" ",z++)),j.hard&&P[w]>_){let W=_-z,J=1+Math.floor((P[w]-W-1)/_);Math.floor((P[w]-1)/_)_&&z>0&&P[w]>0){if(j.wordWrap===!1&&z<_){H2($,v,_);continue}$.push("")}if(z+P[w]>_&&j.wordWrap===!1){H2($,v,_);continue}$[$.length-1]+=v}j.trim!==!1&&($=$.map((w)=>iX(w)));let O=[...$.join(` +`)];for(let[w,v]of O.entries()){if(K+=v,K7.has(v)){let{groups:W}=new RegExp(`(?:\\${oP}(?\\d+)m|\\${k2}(?.*)${Z2})`).exec(O.slice(w).join(""))||{groups:{}};if(W.code!==void 0){let J=Number.parseFloat(W.code);Y=J===xX?void 0:J}else W.uri!==void 0&&(f=W.uri.length===0?void 0:W.uri)}let z=nX.codes.get(Number(Y));O[w+1]===` +`?(f&&(K+=yP("")),Y&&z&&(K+=gP(z))):v===` +`&&(Y&&z&&(K+=gP(Y)),f&&(K+=yP(f)))}return K},aX,_7,tX,T2,eX,FX=(q,_,j)=>(_ in q)?eX(q,_,{enumerable:!0,configurable:!0,writable:!0,value:j}):q[_]=j,d6=(q,_,j)=>(FX(q,typeof _!="symbol"?_+"":_,j),j),A2,UX,sX,QX=(q,_,j)=>(_ in q)?sX(q,_,{enumerable:!0,configurable:!0,writable:!0,value:j}):q[_]=j,pP=(q,_,j)=>(QX(q,typeof _!="symbol"?_+"":_,j),j),tP,qA,_A=(q,_,j)=>(_ in q)?qA(q,_,{enumerable:!0,configurable:!0,writable:!0,value:j}):q[_]=j,LP=(q,_,j)=>(_A(q,typeof _!="symbol"?_+"":_,j),j),G2,u2;var h2=Y6(()=>{T6=o6(v2(),1),xP=o6(W2(),1);mX=RX();iP={exports:{}};(function(q){var _={};q.exports=_,_.eastAsianWidth=function(K){var Y=K.charCodeAt(0),f=K.length==2?K.charCodeAt(1):0,P=Y;return 55296<=Y&&Y<=56319&&56320<=f&&f<=57343&&(Y&=1023,f&=1023,P=Y<<10|f,P+=65536),P==12288||65281<=P&&P<=65376||65504<=P&&P<=65510?"F":P==8361||65377<=P&&P<=65470||65474<=P&&P<=65479||65482<=P&&P<=65487||65490<=P&&P<=65495||65498<=P&&P<=65500||65512<=P&&P<=65518?"H":4352<=P&&P<=4447||4515<=P&&P<=4519||4602<=P&&P<=4607||9001<=P&&P<=9002||11904<=P&&P<=11929||11931<=P&&P<=12019||12032<=P&&P<=12245||12272<=P&&P<=12283||12289<=P&&P<=12350||12353<=P&&P<=12438||12441<=P&&P<=12543||12549<=P&&P<=12589||12593<=P&&P<=12686||12688<=P&&P<=12730||12736<=P&&P<=12771||12784<=P&&P<=12830||12832<=P&&P<=12871||12880<=P&&P<=13054||13056<=P&&P<=19903||19968<=P&&P<=42124||42128<=P&&P<=42182||43360<=P&&P<=43388||44032<=P&&P<=55203||55216<=P&&P<=55238||55243<=P&&P<=55291||63744<=P&&P<=64255||65040<=P&&P<=65049||65072<=P&&P<=65106||65108<=P&&P<=65126||65128<=P&&P<=65131||110592<=P&&P<=110593||127488<=P&&P<=127490||127504<=P&&P<=127546||127552<=P&&P<=127560||127568<=P&&P<=127569||131072<=P&&P<=194367||177984<=P&&P<=196605||196608<=P&&P<=262141?"W":32<=P&&P<=126||162<=P&&P<=163||165<=P&&P<=166||P==172||P==175||10214<=P&&P<=10221||10629<=P&&P<=10630?"Na":P==161||P==164||167<=P&&P<=168||P==170||173<=P&&P<=174||176<=P&&P<=180||182<=P&&P<=186||188<=P&&P<=191||P==198||P==208||215<=P&&P<=216||222<=P&&P<=225||P==230||232<=P&&P<=234||236<=P&&P<=237||P==240||242<=P&&P<=243||247<=P&&P<=250||P==252||P==254||P==257||P==273||P==275||P==283||294<=P&&P<=295||P==299||305<=P&&P<=307||P==312||319<=P&&P<=322||P==324||328<=P&&P<=331||P==333||338<=P&&P<=339||358<=P&&P<=359||P==363||P==462||P==464||P==466||P==468||P==470||P==472||P==474||P==476||P==593||P==609||P==708||P==711||713<=P&&P<=715||P==717||P==720||728<=P&&P<=731||P==733||P==735||768<=P&&P<=879||913<=P&&P<=929||931<=P&&P<=937||945<=P&&P<=961||963<=P&&P<=969||P==1025||1040<=P&&P<=1103||P==1105||P==8208||8211<=P&&P<=8214||8216<=P&&P<=8217||8220<=P&&P<=8221||8224<=P&&P<=8226||8228<=P&&P<=8231||P==8240||8242<=P&&P<=8243||P==8245||P==8251||P==8254||P==8308||P==8319||8321<=P&&P<=8324||P==8364||P==8451||P==8453||P==8457||P==8467||P==8470||8481<=P&&P<=8482||P==8486||P==8491||8531<=P&&P<=8532||8539<=P&&P<=8542||8544<=P&&P<=8555||8560<=P&&P<=8569||P==8585||8592<=P&&P<=8601||8632<=P&&P<=8633||P==8658||P==8660||P==8679||P==8704||8706<=P&&P<=8707||8711<=P&&P<=8712||P==8715||P==8719||P==8721||P==8725||P==8730||8733<=P&&P<=8736||P==8739||P==8741||8743<=P&&P<=8748||P==8750||8756<=P&&P<=8759||8764<=P&&P<=8765||P==8776||P==8780||P==8786||8800<=P&&P<=8801||8804<=P&&P<=8807||8810<=P&&P<=8811||8814<=P&&P<=8815||8834<=P&&P<=8835||8838<=P&&P<=8839||P==8853||P==8857||P==8869||P==8895||P==8978||9312<=P&&P<=9449||9451<=P&&P<=9547||9552<=P&&P<=9587||9600<=P&&P<=9615||9618<=P&&P<=9621||9632<=P&&P<=9633||9635<=P&&P<=9641||9650<=P&&P<=9651||9654<=P&&P<=9655||9660<=P&&P<=9661||9664<=P&&P<=9665||9670<=P&&P<=9672||P==9675||9678<=P&&P<=9681||9698<=P&&P<=9701||P==9711||9733<=P&&P<=9734||P==9737||9742<=P&&P<=9743||9748<=P&&P<=9749||P==9756||P==9758||P==9792||P==9794||9824<=P&&P<=9825||9827<=P&&P<=9829||9831<=P&&P<=9834||9836<=P&&P<=9837||P==9839||9886<=P&&P<=9887||9918<=P&&P<=9919||9924<=P&&P<=9933||9935<=P&&P<=9953||P==9955||9960<=P&&P<=9983||P==10045||P==10071||10102<=P&&P<=10111||11093<=P&&P<=11097||12872<=P&&P<=12879||57344<=P&&P<=63743||65024<=P&&P<=65039||P==65533||127232<=P&&P<=127242||127248<=P&&P<=127277||127280<=P&&P<=127337||127344<=P&&P<=127386||917760<=P&&P<=917999||983040<=P&&P<=1048573||1048576<=P&&P<=1114109?"A":"N"},_.characterLength=function(K){var Y=this.eastAsianWidth(K);return Y=="F"||Y=="W"||Y=="A"?2:1};function j(K){return K.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g)||[]}_.length=function(K){for(var Y=j(K),f=0,P=0;P=Y-(z==2?1:0))if($+z<=f)P+=v;else break;$+=z}return P}})(iP);IX=iP.exports,gX=rP(IX),dX=rP(yX);L8={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};Object.keys(L8.modifier);pX=Object.keys(L8.color),LX=Object.keys(L8.bgColor);[...pX];nX=lX(),K7=new Set(["\x1B","›"]),k2=`${cX}8;;`;aX=["up","down","left","right","space","enter","cancel"],_7={actions:new Set(aX),aliases:new Map([["k","up"],["j","down"],["h","left"],["l","right"],["\x03","cancel"],["escape","cancel"]])};tX=globalThis.process.platform.startsWith("win"),T2=Symbol("clack:cancel");eX=Object.defineProperty;A2=class A2 extends BK{get cursor(){return this.value?0:1}get _value(){return this.cursor===0}constructor(q){super(q,!1),this.value=!!q.initialValue,this.on("value",()=>{this.value=this._value}),this.on("confirm",(_)=>{this.output.write(T6.cursor.move(0,-1)),this.value=_,this.state="submit",this.close()}),this.on("cursor",()=>{this.value=!this.value})}};UX=new WeakMap;sX=Object.defineProperty,tP=class extends BK{constructor(q){super(q,!1),pP(this,"options"),pP(this,"cursor",0),this.options=q.options,this.value=[...q.initialValues??[]],this.cursor=Math.max(this.options.findIndex(({value:_})=>_===q.cursorAt),0),this.on("key",(_)=>{_==="a"&&this.toggleAll()}),this.on("cursor",(_)=>{switch(_){case"left":case"up":this.cursor=this.cursor===0?this.options.length-1:this.cursor-1;break;case"down":case"right":this.cursor=this.cursor===this.options.length-1?0:this.cursor+1;break;case"space":this.toggleValue();break}})}get _value(){return this.options[this.cursor].value}toggleAll(){let q=this.value.length===this.options.length;this.value=q?[]:this.options.map((_)=>_.value)}toggleValue(){let q=this.value.includes(this._value);this.value=q?this.value.filter((_)=>_!==this._value):[...this.value,this._value]}},qA=Object.defineProperty;G2=class G2 extends BK{constructor(q){super(q,!1),LP(this,"options"),LP(this,"cursor",0),this.options=q.options,this.cursor=this.options.findIndex(({value:_})=>_===q.initialValue),this.cursor===-1&&(this.cursor=0),this.changeValue(),this.on("cursor",(_)=>{switch(_){case"left":case"up":this.cursor=this.cursor===0?this.options.length-1:this.cursor-1;break;case"down":case"right":this.cursor=this.cursor===this.options.length-1?0:this.cursor+1;break}this.changeValue()})}get _value(){return this.options[this.cursor]}changeValue(){this.value=this._value.value}};u2=class u2 extends BK{get valueWithCursor(){if(this.state==="submit")return this.value;if(this.cursor>=this.value.length)return`${this.value}█`;let q=this.value.slice(0,this.cursor),[_,...j]=this.value.slice(this.cursor);return`${q}${xP.default.inverse(_)}${j.join("")}`}get cursor(){return this._cursor}constructor(q){super(q),this.on("finalize",()=>{this.value||(this.value=q.defaultValue)})}}});import wq from"node:process";function KA(){return wq.platform!=="win32"?wq.env.TERM!=="linux":!!wq.env.CI||!!wq.env.WT_SESSION||!!wq.env.TERMINUS_SUBLIME||wq.env.ConEmuTask==="{cmd::Cmder}"||wq.env.TERM_PROGRAM==="Terminus-Sublime"||wq.env.TERM_PROGRAM==="vscode"||wq.env.TERM==="xterm-256color"||wq.env.TERM==="alacritty"||wq.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var a,j7,D2,t8=(q,_)=>D2?q:_,jA,FP,UP,N2,EV,N8,iq,C2,V2,PA,eP,YA,RV,mV,IV,gV,yV,fA,$A,wA,OA,P7=(q)=>{switch(q){case"initial":case"active":return a.default.cyan(jA);case"cancel":return a.default.red(FP);case"error":return a.default.yellow(UP);case"submit":return a.default.green(N2)}},M2=(q)=>{let{cursor:_,options:j,style:K}=q,Y=q.maxItems??Number.POSITIVE_INFINITY,f=Math.max(process.stdout.rows-4,0),P=Math.min(f,Math.max(Y,5)),$=0;_>=$+P-3?$=Math.max(Math.min(_-P+3,j.length-P),0):_<$+2&&($=Math.max(_-2,0));let O=P0,w=P{let J=z===0&&O,k=z===W.length-1&&w;return J||k?a.default.dim("..."):K(v,z+$===_)})},sP=(q)=>new u2({validate:q.validate,placeholder:q.placeholder,defaultValue:q.defaultValue,initialValue:q.initialValue,render(){let _=`${a.default.gray(N8)} +${P7(this.state)} ${q.message} +`,j=q.placeholder?a.default.inverse(q.placeholder[0])+a.default.dim(q.placeholder.slice(1)):a.default.inverse(a.default.hidden("_")),K=this.value?this.valueWithCursor:j;switch(this.state){case"error":return`${_.trim()} +${a.default.yellow(N8)} ${K} +${a.default.yellow(iq)} ${a.default.yellow(this.error)} +`;case"submit":return`${_}${a.default.gray(N8)} ${a.default.dim(this.value||q.placeholder)}`;case"cancel":return`${_}${a.default.gray(N8)} ${a.default.strikethrough(a.default.dim(this.value??""))}${this.value?.trim()?` +${a.default.gray(N8)}`:""}`;default:return`${_}${a.default.cyan(N8)} ${K} +${a.default.cyan(iq)} +`}}}).prompt(),gq=(q)=>{let _=q.active??"Yes",j=q.inactive??"No";return new A2({active:_,inactive:j,initialValue:q.initialValue??!0,render(){let K=`${a.default.gray(N8)} +${P7(this.state)} ${q.message} +`,Y=this.value?_:j;switch(this.state){case"submit":return`${K}${a.default.gray(N8)} ${a.default.dim(Y)}`;case"cancel":return`${K}${a.default.gray(N8)} ${a.default.strikethrough(a.default.dim(Y))} +${a.default.gray(N8)}`;default:return`${K}${a.default.cyan(N8)} ${this.value?`${a.default.green(C2)} ${_}`:`${a.default.dim(V2)} ${a.default.dim(_)}`} ${a.default.dim("/")} ${this.value?`${a.default.dim(V2)} ${a.default.dim(j)}`:`${a.default.green(C2)} ${j}`} +${a.default.cyan(iq)} +`}}}).prompt()},oq=(q)=>{let _=(j,K)=>{let Y=j.label??String(j.value);switch(K){case"selected":return`${a.default.dim(Y)}`;case"active":return`${a.default.green(C2)} ${Y} ${j.hint?a.default.dim(`(${j.hint})`):""}`;case"cancelled":return`${a.default.strikethrough(a.default.dim(Y))}`;default:return`${a.default.dim(V2)} ${a.default.dim(Y)}`}};return new G2({options:q.options,initialValue:q.initialValue,render(){let j=`${a.default.gray(N8)} +${P7(this.state)} ${q.message} +`;switch(this.state){case"submit":return`${j}${a.default.gray(N8)} ${_(this.options[this.cursor],"selected")}`;case"cancel":return`${j}${a.default.gray(N8)} ${_(this.options[this.cursor],"cancelled")} +${a.default.gray(N8)}`;default:return`${j}${a.default.cyan(N8)} ${M2({cursor:this.cursor,options:this.options,maxItems:q.maxItems,style:(K,Y)=>_(K,Y?"active":"inactive")}).join(` +${a.default.cyan(N8)} `)} +${a.default.cyan(iq)} +`}}}).prompt()},QP=(q)=>{let _=(j,K)=>{let Y=j.label??String(j.value);return K==="active"?`${a.default.cyan(PA)} ${Y} ${j.hint?a.default.dim(`(${j.hint})`):""}`:K==="selected"?`${a.default.green(eP)} ${a.default.dim(Y)} ${j.hint?a.default.dim(`(${j.hint})`):""}`:K==="cancelled"?`${a.default.strikethrough(a.default.dim(Y))}`:K==="active-selected"?`${a.default.green(eP)} ${Y} ${j.hint?a.default.dim(`(${j.hint})`):""}`:K==="submitted"?`${a.default.dim(Y)}`:`${a.default.dim(YA)} ${a.default.dim(Y)}`};return new tP({options:q.options,initialValues:q.initialValues,required:q.required??!0,cursorAt:q.cursorAt,validate(j){if(this.required&&j.length===0)return`Please select at least one option. +${a.default.reset(a.default.dim(`Press ${a.default.gray(a.default.bgWhite(a.default.inverse(" space ")))} to select, ${a.default.gray(a.default.bgWhite(a.default.inverse(" enter ")))} to submit`))}`},render(){let j=`${a.default.gray(N8)} +${P7(this.state)} ${q.message} +`,K=(Y,f)=>{let P=this.value.includes(Y.value);return f&&P?_(Y,"active-selected"):P?_(Y,"selected"):_(Y,f?"active":"inactive")};switch(this.state){case"submit":return`${j}${a.default.gray(N8)} ${this.options.filter(({value:Y})=>this.value.includes(Y)).map((Y)=>_(Y,"submitted")).join(a.default.dim(", "))||a.default.dim("none")}`;case"cancel":{let Y=this.options.filter(({value:f})=>this.value.includes(f)).map((f)=>_(f,"cancelled")).join(a.default.dim(", "));return`${j}${a.default.gray(N8)} ${Y.trim()?`${Y} +${a.default.gray(N8)}`:""}`}case"error":{let Y=this.error.split(` +`).map((f,P)=>P===0?`${a.default.yellow(iq)} ${a.default.yellow(f)}`:` ${f}`).join(` +`);return`${j+a.default.yellow(N8)} ${M2({options:this.options,cursor:this.cursor,maxItems:q.maxItems,style:K}).join(` +${a.default.yellow(N8)} `)} +${Y} +`}default:return`${j}${a.default.cyan(N8)} ${M2({options:this.options,cursor:this.cursor,maxItems:q.maxItems,style:K}).join(` +${a.default.cyan(N8)} `)} +${a.default.cyan(iq)} +`}}}).prompt()},p6=(q="")=>{process.stdout.write(`${a.default.gray(iq)} ${a.default.red(q)} + +`)},qY=(q="")=>{process.stdout.write(`${a.default.gray(N8)} +${a.default.gray(iq)} ${q} + +`)},Q8,dV,Y7=({indicator:q="dots"}={})=>{let _=D2?["◒","◐","◓","◑"]:["•","o","O","0"],j=D2?80:120,K=process.env.CI==="true",Y,f,P=!1,$="",O,w=performance.now(),v=(V)=>{let E=V>1?"Something went wrong":"Canceled";P&&h(E,V)},z=()=>v(2),W=()=>v(1),J=()=>{process.on("uncaughtExceptionMonitor",z),process.on("unhandledRejection",z),process.on("SIGINT",W),process.on("SIGTERM",W),process.on("exit",v)},k=()=>{process.removeListener("uncaughtExceptionMonitor",z),process.removeListener("unhandledRejection",z),process.removeListener("SIGINT",W),process.removeListener("SIGTERM",W),process.removeListener("exit",v)},H=()=>{if(O===void 0)return;K&&process.stdout.write(` +`);let V=O.split(` +`);process.stdout.write(j7.cursor.move(-999,V.length-1)),process.stdout.write(j7.erase.down(V.length))},X=(V)=>V.replace(/\.+$/,""),A=(V)=>{let E=(performance.now()-V)/1000,M=Math.floor(E/60),b=Math.floor(E%60);return M>0?`[${M}m ${b}s]`:`[${b}s]`},G=(V="")=>{P=!0,Y=BP(),$=X(V),w=performance.now(),process.stdout.write(`${a.default.gray(N8)} +`);let E=0,M=0;J(),f=setInterval(()=>{if(K&&$===O)return;H(),O=$;let b=a.default.magenta(_[E]);if(K)process.stdout.write(`${b} ${$}...`);else if(q==="timer")process.stdout.write(`${b} ${$} ${A(w)}`);else{let g=".".repeat(Math.floor(M)).slice(0,3);process.stdout.write(`${b} ${$}${g}`)}E=E+1<_.length?E+1:0,M=M<_.length?M+0.125:0},j)},h=(V="",E=0)=>{P=!1,clearInterval(f),H();let M=E===0?a.default.green(N2):E===1?a.default.red(FP):a.default.red(UP);$=X(V??$),q==="timer"?process.stdout.write(`${M} ${$} ${A(w)} +`):process.stdout.write(`${M} ${$} +`),k(),Y()};return{start:G,stop:h,message:(V="")=>{$=X(V??$)}}};var KK=Y6(()=>{h2();h2();a=o6(W2(),1),j7=o6(v2(),1);D2=KA(),jA=t8("◆","*"),FP=t8("■","x"),UP=t8("▲","x"),N2=t8("◇","o"),EV=t8("┌","T"),N8=t8("│","|"),iq=t8("└","—"),C2=t8("●",">"),V2=t8("○"," "),PA=t8("◻","[•]"),eP=t8("◼","[+]"),YA=t8("◻","[ ]"),RV=t8("▪","•"),mV=t8("─","-"),IV=t8("╮","+"),gV=t8("├","+"),yV=t8("╯","+"),fA=t8("●","•"),$A=t8("◆","*"),wA=t8("▲","!"),OA=t8("■","x"),Q8={message:(q="",{symbol:_=a.default.gray(N8)}={})=>{let j=[`${a.default.gray(N8)}`];if(q){let[K,...Y]=q.split(` +`);j.push(`${_} ${K}`,...Y.map((f)=>`${a.default.gray(N8)} ${f}`))}process.stdout.write(`${j.join(` +`)} +`)},info:(q)=>{Q8.message(q,{symbol:a.default.blue(fA)})},success:(q)=>{Q8.message(q,{symbol:a.default.green($A)})},step:(q)=>{Q8.message(q,{symbol:a.default.green(N2)})},warn:(q)=>{Q8.message(q,{symbol:a.default.yellow(wA)})},warning:(q)=>{Q8.warn(q)},error:(q)=>{Q8.message(q,{symbol:a.default.red(OA)})}},dV=`${a.default.gray(N8)} `});var WY=q8((m2,I2)=>{(function(q,_){typeof m2==="object"&&typeof I2!=="undefined"?I2.exports=_():typeof define==="function"&&define.amd?define(_):(q=typeof globalThis!=="undefined"?globalThis:q||self,q.tinycolor=_())})(m2,function(){function q(D){return q=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(C){return typeof C}:function(C){return C&&typeof Symbol=="function"&&C.constructor===Symbol&&C!==Symbol.prototype?"symbol":typeof C},q(D)}var _=/^\s+/,j=/\s+$/;function K(D,C){if(D=D?D:"",C=C||{},D instanceof K)return D;if(!(this instanceof K))return new K(D,C);var T=Y(D);if(this._originalInput=D,this._r=T.r,this._g=T.g,this._b=T.b,this._a=T.a,this._roundA=Math.round(100*this._a)/100,this._format=C.format||T.format,this._gradientType=C.gradientType,this._r<1)this._r=Math.round(this._r);if(this._g<1)this._g=Math.round(this._g);if(this._b<1)this._b=Math.round(this._b);this._ok=T.ok}K.prototype={isDark:function D(){return this.getBrightness()<128},isLight:function D(){return!this.isDark()},isValid:function D(){return this._ok},getOriginalInput:function D(){return this._originalInput},getFormat:function D(){return this._format},getAlpha:function D(){return this._a},getBrightness:function D(){var C=this.toRgb();return(C.r*299+C.g*587+C.b*114)/1000},getLuminance:function D(){var C=this.toRgb(),T,N,l,i,x,o;if(T=C.r/255,N=C.g/255,l=C.b/255,T<=0.03928)i=T/12.92;else i=Math.pow((T+0.055)/1.055,2.4);if(N<=0.03928)x=N/12.92;else x=Math.pow((N+0.055)/1.055,2.4);if(l<=0.03928)o=l/12.92;else o=Math.pow((l+0.055)/1.055,2.4);return 0.2126*i+0.7152*x+0.0722*o},setAlpha:function D(C){return this._a=m(C),this._roundA=Math.round(100*this._a)/100,this},toHsv:function D(){var C=O(this._r,this._g,this._b);return{h:C.h*360,s:C.s,v:C.v,a:this._a}},toHsvString:function D(){var C=O(this._r,this._g,this._b),T=Math.round(C.h*360),N=Math.round(C.s*100),l=Math.round(C.v*100);return this._a==1?"hsv("+T+", "+N+"%, "+l+"%)":"hsva("+T+", "+N+"%, "+l+"%, "+this._roundA+")"},toHsl:function D(){var C=P(this._r,this._g,this._b);return{h:C.h*360,s:C.s,l:C.l,a:this._a}},toHslString:function D(){var C=P(this._r,this._g,this._b),T=Math.round(C.h*360),N=Math.round(C.s*100),l=Math.round(C.l*100);return this._a==1?"hsl("+T+", "+N+"%, "+l+"%)":"hsla("+T+", "+N+"%, "+l+"%, "+this._roundA+")"},toHex:function D(C){return v(this._r,this._g,this._b,C)},toHexString:function D(C){return"#"+this.toHex(C)},toHex8:function D(C){return z(this._r,this._g,this._b,this._a,C)},toHex8String:function D(C){return"#"+this.toHex8(C)},toRgb:function D(){return{r:Math.round(this._r),g:Math.round(this._g),b:Math.round(this._b),a:this._a}},toRgbString:function D(){return this._a==1?"rgb("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+")":"rgba("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+", "+this._roundA+")"},toPercentageRgb:function D(){return{r:Math.round(I(this._r,255)*100)+"%",g:Math.round(I(this._g,255)*100)+"%",b:Math.round(I(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function D(){return this._a==1?"rgb("+Math.round(I(this._r,255)*100)+"%, "+Math.round(I(this._g,255)*100)+"%, "+Math.round(I(this._b,255)*100)+"%)":"rgba("+Math.round(I(this._r,255)*100)+"%, "+Math.round(I(this._g,255)*100)+"%, "+Math.round(I(this._b,255)*100)+"%, "+this._roundA+")"},toName:function D(){if(this._a===0)return"transparent";if(this._a<1)return!1;return c[v(this._r,this._g,this._b,!0)]||!1},toFilter:function D(C){var T="#"+W(this._r,this._g,this._b,this._a),N=T,l=this._gradientType?"GradientType = 1, ":"";if(C){var i=K(C);N="#"+W(i._r,i._g,i._b,i._a)}return"progid:DXImageTransform.Microsoft.gradient("+l+"startColorstr="+T+",endColorstr="+N+")"},toString:function D(C){var T=!!C;C=C||this._format;var N=!1,l=this._a<1&&this._a>=0,i=!T&&l&&(C==="hex"||C==="hex6"||C==="hex3"||C==="hex4"||C==="hex8"||C==="name");if(i){if(C==="name"&&this._a===0)return this.toName();return this.toRgbString()}if(C==="rgb")N=this.toRgbString();if(C==="prgb")N=this.toPercentageRgbString();if(C==="hex"||C==="hex6")N=this.toHexString();if(C==="hex3")N=this.toHexString(!0);if(C==="hex4")N=this.toHex8String(!0);if(C==="hex8")N=this.toHex8String();if(C==="name")N=this.toName();if(C==="hsl")N=this.toHslString();if(C==="hsv")N=this.toHsvString();return N||this.toHexString()},clone:function D(){return K(this.toString())},_applyModification:function D(C,T){var N=C.apply(null,[this].concat([].slice.call(T)));return this._r=N._r,this._g=N._g,this._b=N._b,this.setAlpha(N._a),this},lighten:function D(){return this._applyModification(X,arguments)},brighten:function D(){return this._applyModification(A,arguments)},darken:function D(){return this._applyModification(G,arguments)},desaturate:function D(){return this._applyModification(J,arguments)},saturate:function D(){return this._applyModification(k,arguments)},greyscale:function D(){return this._applyModification(H,arguments)},spin:function D(){return this._applyModification(h,arguments)},_applyCombination:function D(C,T){return C.apply(null,[this].concat([].slice.call(T)))},analogous:function D(){return this._applyCombination(b,arguments)},complement:function D(){return this._applyCombination(V,arguments)},monochromatic:function D(){return this._applyCombination(g,arguments)},splitcomplement:function D(){return this._applyCombination(M,arguments)},triad:function D(){return this._applyCombination(E,[3])},tetrad:function D(){return this._applyCombination(E,[4])}},K.fromRatio=function(D,C){if(q(D)=="object"){var T={};for(var N in D)if(D.hasOwnProperty(N))if(N==="a")T[N]=D[N];else T[N]=f8(D[N]);D=T}return K(D,C)};function Y(D){var C={r:0,g:0,b:0},T=1,N=null,l=null,i=null,x=!1,o=!1;if(typeof D=="string")D=j6(D);if(q(D)=="object"){if(m8(D.r)&&m8(D.g)&&m8(D.b))C=f(D.r,D.g,D.b),x=!0,o=String(D.r).substr(-1)==="%"?"prgb":"rgb";else if(m8(D.h)&&m8(D.s)&&m8(D.v))N=f8(D.s),l=f8(D.v),C=w(D.h,N,l),x=!0,o="hsv";else if(m8(D.h)&&m8(D.s)&&m8(D.l))N=f8(D.s),i=f8(D.l),C=$(D.h,N,i),x=!0,o="hsl";if(D.hasOwnProperty("a"))T=D.a}return T=m(T),{ok:x,format:D.format||o,r:Math.min(255,Math.max(C.r,0)),g:Math.min(255,Math.max(C.g,0)),b:Math.min(255,Math.max(C.b,0)),a:T}}function f(D,C,T){return{r:I(D,255)*255,g:I(C,255)*255,b:I(T,255)*255}}function P(D,C,T){D=I(D,255),C=I(C,255),T=I(T,255);var N=Math.max(D,C,T),l=Math.min(D,C,T),i,x,o=(N+l)/2;if(N==l)i=x=0;else{var j8=N-l;switch(x=o>0.5?j8/(2-N-l):j8/(N+l),N){case D:i=(C-T)/j8+(C1)A8-=1;if(A8<0.16666666666666666)return W8+($8-W8)*6*A8;if(A8<0.5)return $8;if(A8<0.6666666666666666)return W8+($8-W8)*(0.6666666666666666-A8)*6;return W8}if(C===0)N=l=i=T;else{var o=T<0.5?T*(1+C):T+C-T*C,j8=2*T-o;N=x(j8,o,D+0.3333333333333333),l=x(j8,o,D),i=x(j8,o,D-0.3333333333333333)}return{r:N*255,g:l*255,b:i*255}}function O(D,C,T){D=I(D,255),C=I(C,255),T=I(T,255);var N=Math.max(D,C,T),l=Math.min(D,C,T),i,x,o=N,j8=N-l;if(x=N===0?0:j8/N,N==l)i=0;else{switch(N){case D:i=(C-T)/j8+(C>1)+720)%360;--C;)N.h=(N.h+l)%360,i.push(K(N));return i}function g(D,C){C=C||6;var T=K(D).toHsv(),N=T.h,l=T.s,i=T.v,x=[],o=1/C;while(C--)x.push(K({h:N,s:l,v:i})),i=(i+o)%1;return x}K.mix=function(D,C,T){T=T===0?0:T||50;var N=K(D).toRgb(),l=K(C).toRgb(),i=T/100,x={r:(l.r-N.r)*i+N.r,g:(l.g-N.g)*i+N.g,b:(l.b-N.b)*i+N.b,a:(l.a-N.a)*i+N.a};return K(x)},K.readability=function(D,C){var T=K(D),N=K(C);return(Math.max(T.getLuminance(),N.getLuminance())+0.05)/(Math.min(T.getLuminance(),N.getLuminance())+0.05)},K.isReadable=function(D,C,T){var N=K.readability(D,C),l,i;switch(i=!1,l=q6(T),l.level+l.size){case"AAsmall":case"AAAlarge":i=N>=4.5;break;case"AAlarge":i=N>=3;break;case"AAAsmall":i=N>=7;break}return i},K.mostReadable=function(D,C,T){var N=null,l=0,i,x,o,j8;T=T||{},x=T.includeFallbackColors,o=T.level,j8=T.size;for(var W8=0;W8l)l=i,N=K(C[W8]);if(K.isReadable(D,N,{level:o,size:j8})||!x)return N;else return T.includeFallbackColors=!1,K.mostReadable(D,["#fff","#000"],T)};var y=K.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},c=K.hexNames=L(y);function L(D){var C={};for(var T in D)if(D.hasOwnProperty(T))C[D[T]]=T;return C}function m(D){if(D=parseFloat(D),isNaN(D)||D<0||D>1)D=1;return D}function I(D,C){if(B(D))D="100%";var T=U(D);if(D=Math.min(C,Math.max(0,parseFloat(D))),T)D=parseInt(D*C,10)/100;if(Math.abs(D-C)<0.000001)return 1;return D%C/parseFloat(C)}function d(D){return Math.min(1,Math.max(0,D))}function r(D){return parseInt(D,16)}function B(D){return typeof D=="string"&&D.indexOf(".")!=-1&&parseFloat(D)===1}function U(D){return typeof D==="string"&&D.indexOf("%")!=-1}function w8(D){return D.length==1?"0"+D:""+D}function f8(D){if(D<=1)D=D*100+"%";return D}function T8(D){return Math.round(parseFloat(D)*255).toString(16)}function v8(D){return r(D)/255}var Y8=function(){var D="[-\\+]?\\d+%?",C="[-\\+]?\\d*\\.\\d+%?",T="(?:"+C+")|(?:"+D+")",N="[\\s|\\(]+("+T+")[,|\\s]+("+T+")[,|\\s]+("+T+")\\s*\\)?",l="[\\s|\\(]+("+T+")[,|\\s]+("+T+")[,|\\s]+("+T+")[,|\\s]+("+T+")\\s*\\)?";return{CSS_UNIT:new RegExp(T),rgb:new RegExp("rgb"+N),rgba:new RegExp("rgba"+l),hsl:new RegExp("hsl"+N),hsla:new RegExp("hsla"+l),hsv:new RegExp("hsv"+N),hsva:new RegExp("hsva"+l),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}}();function m8(D){return!!Y8.CSS_UNIT.exec(D)}function j6(D){D=D.replace(_,"").replace(j,"").toLowerCase();var C=!1;if(y[D])D=y[D],C=!0;else if(D=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var T;if(T=Y8.rgb.exec(D))return{r:T[1],g:T[2],b:T[3]};if(T=Y8.rgba.exec(D))return{r:T[1],g:T[2],b:T[3],a:T[4]};if(T=Y8.hsl.exec(D))return{h:T[1],s:T[2],l:T[3]};if(T=Y8.hsla.exec(D))return{h:T[1],s:T[2],l:T[3],a:T[4]};if(T=Y8.hsv.exec(D))return{h:T[1],s:T[2],v:T[3]};if(T=Y8.hsva.exec(D))return{h:T[1],s:T[2],v:T[3],a:T[4]};if(T=Y8.hex8.exec(D))return{r:r(T[1]),g:r(T[2]),b:r(T[3]),a:v8(T[4]),format:C?"name":"hex8"};if(T=Y8.hex6.exec(D))return{r:r(T[1]),g:r(T[2]),b:r(T[3]),format:C?"name":"hex"};if(T=Y8.hex4.exec(D))return{r:r(T[1]+""+T[1]),g:r(T[2]+""+T[2]),b:r(T[3]+""+T[3]),a:v8(T[4]+""+T[4]),format:C?"name":"hex8"};if(T=Y8.hex3.exec(D))return{r:r(T[1]+""+T[1]),g:r(T[2]+""+T[2]),b:r(T[3]+""+T[3]),format:C?"name":"hex"};return!1}function q6(D){var C,T;if(D=D||{level:"AA",size:"small"},C=(D.level||"AA").toUpperCase(),T=(D.size||"small").toLowerCase(),C!=="AA"&&C!=="AAA")C="AA";if(T!=="small"&&T!=="large")T="small";return{level:C,size:T}}return K})});var AY=q8((UV,XY)=>{var UK=WY(),ZY={r:256,g:256,b:256,a:1},kY={h:360,s:1,v:1,a:1};function y2(q,_,j){let K={};for(let Y in q)if(q.hasOwnProperty(Y))K[Y]=j===0?0:(_[Y]-q[Y])/j;return K}function d2(q,_,j,K){let Y={};for(let f in _)if(_.hasOwnProperty(f))Y[f]=q[f]*j+_[f],Y[f]=Y[f]<0?Y[f]+K[f]:K[f]!==1?Y[f]%K[f]:Y[f];return Y}function g2(q,_,j){let K=q.color.toRgb(),Y=_.color.toRgb(),f=y2(K,Y,j),P=[q.color];for(let $=1;$f.h&&Y.h-f.h>180;P=K==="long"&&v||K==="short"&&!v}let $=y2(Y,f,j),O=[q.color],w;if(Y.h<=f.h&&!P||Y.h>=f.h&&P)w=f.h-Y.h;else if(P)w=360-f.h+Y.h;else w=360-Y.h+f.h;$.h=Math.pow(-1,P?1:0)*Math.abs(w)/j;for(let v=1;v1)throw new Error("Position must be between 0 and 1");let Y,f;for(let O=0,w=q.length;O=q[O].pos&&_{let $=f.pos!==void 0;if(_^$)throw new Error("Cannot mix positionned and not posionned color stops");if($){let O=f.color!==void 0;if(!O&&(Y||P===0||P===j-1))throw new Error("Cannot define two consecutive position-only stops");if(Y=!O,f={color:O?UK(f.color):null,colorLess:!O,pos:f.pos},f.pos<0||f.pos>1)throw new Error("Color stops positions must be between 0 and 1");else if(f.pos{q.push({color:j.color,pos:j.pos/2})}),this.stops.slice(0,-1).forEach((j)=>{_.push({color:j.color,pos:1-j.pos/2})}),new w7(q.concat(_.reverse()))}rgb(q){let _=HY(this.stops,q),j=[];this.stops.forEach((K,Y)=>{if(K.colorLess)K.color=g2(this.stops[Y-1],this.stops[Y+1],2)[1]});for(let K=0,Y=this.stops.length;K{if(Y.colorLess)Y.color=JY(this.stops[f-1],this.stops[f+1],2,_)[1]});for(let Y=0,f=this.stops.length;Y{VY.exports=()=>{return/[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26D3\uFE0F?(?:\u200D\uD83D\uDCA5)?|\u26F9(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF43\uDF45-\uDF4A\uDF4C-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uDDE6\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|\uDDE7\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|\uDDE8\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF7\uDDFA-\uDDFF]|\uDDE9\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|\uDDEA\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|\uDDEB\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|\uDDEC\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|\uDDED\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|\uDDEE\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|\uDDEF\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|\uDDF0\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|\uDDF1\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|\uDDF2\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|\uDDF3\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|\uDDF4\uD83C\uDDF2|\uDDF5\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|\uDDF6\uD83C\uDDE6|\uDDF7\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|\uDDF8\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|\uDDF9\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|\uDDFA\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF]|\uDDFB\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|\uDDFC\uD83C[\uDDEB\uDDF8]|\uDDFD\uD83C\uDDF0|\uDDFE\uD83C[\uDDEA\uDDF9]|\uDDFF\uD83C[\uDDE6\uDDF2\uDDFC]|\uDF44(?:\u200D\uD83D\uDFEB)?|\uDF4B(?:\u200D\uD83D\uDFE9)?|\uDFC3(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\uD83D(?:[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3]\uFE0F?|[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E-\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4\uDEB5](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE41\uDE43\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED8\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC08(?:\u200D\u2B1B)?|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC26(?:\u200D(?:\u2B1B|\uD83D\uDD25))?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])))?))?|\uDD75(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?|\uDE42(?:\u200D[\u2194\u2195]\uFE0F?)?|\uDEB6(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3C-\uDD3E\uDDB8\uDDB9\uDDCD\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE8A\uDE8E-\uDEC2\uDEC6\uDEC8\uDECD-\uDEDC\uDEDF-\uDEEA\uDEEF]|\uDDCE(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1|\uDDD1\u200D\uD83E\uDDD2(?:\u200D\uD83E\uDDD2)?|\uDDD2(?:\u200D\uD83E\uDDD2)?))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g}});var bY=q8((JM,iA)=>{iA.exports={single:{topLeft:"┌",top:"─",topRight:"┐",right:"│",bottomRight:"┘",bottom:"─",bottomLeft:"└",left:"│"},double:{topLeft:"╔",top:"═",topRight:"╗",right:"║",bottomRight:"╝",bottom:"═",bottomLeft:"╚",left:"║"},round:{topLeft:"╭",top:"─",topRight:"╮",right:"│",bottomRight:"╯",bottom:"─",bottomLeft:"╰",left:"│"},bold:{topLeft:"┏",top:"━",topRight:"┓",right:"┃",bottomRight:"┛",bottom:"━",bottomLeft:"┗",left:"┃"},singleDouble:{topLeft:"╓",top:"─",topRight:"╖",right:"║",bottomRight:"╜",bottom:"─",bottomLeft:"╙",left:"║"},doubleSingle:{topLeft:"╒",top:"═",topRight:"╕",right:"│",bottomRight:"╛",bottom:"═",bottomLeft:"╘",left:"│"},classic:{topLeft:"+",top:"-",topRight:"+",right:"|",bottomRight:"+",bottom:"-",bottomLeft:"+",left:"|"},arrow:{topLeft:"↘",top:"↓",topRight:"↙",right:"←",bottomRight:"↖",bottom:"↑",bottomLeft:"↗",left:"→"}}});var c2=q8((HM,x2)=>{var SY=bY();x2.exports=SY;x2.exports.default=SY});var yY=q8((ZM,gY)=>{gY.exports=({onlyFirst:q=!1}={})=>{let _=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))"].join("|");return new RegExp(_,q?void 0:"g")}});var pY=q8((kM,dY)=>{var UA=yY();dY.exports=(q)=>typeof q==="string"?q.replace(UA(),""):q});var lY=q8((XM,o2)=>{var LY=(q)=>{if(Number.isNaN(q))return!1;if(q>=4352&&(q<=4447||q===9001||q===9002||11904<=q&&q<=12871&&q!==12351||12880<=q&&q<=19903||19968<=q&&q<=42182||43360<=q&&q<=43388||44032<=q&&q<=55203||63744<=q&&q<=64255||65040<=q&&q<=65049||65072<=q&&q<=65131||65281<=q&&q<=65376||65504<=q&&q<=65510||110592<=q&&q<=110593||127488<=q&&q<=127569||131072<=q&&q<=262141))return!0;return!1};o2.exports=LY;o2.exports.default=LY});var xY=q8((AM,nY)=>{nY.exports=function(){return/\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F|\uD83D\uDC68(?:\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68\uD83C\uDFFB|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|[\u2695\u2696\u2708]\uFE0F|\uD83D[\uDC66\uDC67]|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708])\uFE0F|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C[\uDFFB-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)\uD83C\uDFFB|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB\uDFFC])|\uD83D\uDC69(?:\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB-\uDFFD])|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|(?:(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)\uFE0F|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\u200D[\u2640\u2642])|\uD83C\uDFF4\u200D\u2620)\uFE0F|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF4\uD83C\uDDF2|\uD83C\uDDF6\uD83C\uDDE6|[#\*0-9]\uFE0F\u20E3|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83D\uDC69(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270A-\u270D]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC70\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDCAA\uDD74\uDD7A\uDD90\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD36\uDDB5\uDDB6\uDDBB\uDDD2-\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5\uDEEB\uDEEC\uDEF4-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g}});var rY=q8((GM,a2)=>{var sA=pY(),QA=lY(),qG=xY(),cY=(q)=>{if(typeof q!=="string"||q.length===0)return 0;if(q=sA(q),q.length===0)return 0;q=q.replace(qG()," ");let _=0;for(let j=0;j=127&&K<=159)continue;if(K>=768&&K<=879)continue;if(K>65535)j++;_+=QA(K)?2:1}return _};a2.exports=cY;a2.exports.default=cY});var oY=q8((uM,iY)=>{var _G=rY();function z_(q,_){if(!q)return q;_=_||{};let j=_.align||"center";if(j==="left")return q;let K=_.split||` +`,Y=_.pad||" ",f=j!=="right"?KG:jG,P=!1;if(!Array.isArray(q))P=!0,q=String(q).split(K);let $,O=0;return q=q.map(function(w){return w=String(w),$=_G(w),O=Math.max($,O),{str:w,width:$}}).map(function(w){return new Array(f(O,w.width)+1).join(Y)+w.str}),P?q.join(K):q}z_.left=function q(_){return z_(_,{align:"left"})};z_.center=function q(_){return z_(_,{align:"center"})};z_.right=function q(_){return z_(_,{align:"right"})};iY.exports=z_;function KG(q,_){return Math.floor((q-_)/2)}function jG(q,_){return q-_}});import j3 from"fs";import{join as FG}from"path";function UG(q){if(q===0)return"0 B";let _=1024,j=["B","KB","MB","GB"],K=Math.floor(Math.log(q)/Math.log(_));return parseFloat((q/Math.pow(_,K)).toFixed(1))+" "+j[K]}function sG(){let q=_8.getInstance().getTrashDirectory();if(!j3.existsSync(q))return{folderCount:0,fileCount:0,totalSize:0,isEmpty:!0};let _=j3.readdirSync(q);if(_.length===0)return{folderCount:0,fileCount:0,totalSize:0,isEmpty:!0};let j=0,K=0,Y=0;for(let f of _){let P=FG(q,f),$=j3.statSync(P);if($.isDirectory())j++;else K++;Y+=$.size}return{folderCount:j,fileCount:K,totalSize:Y,isEmpty:!1}}async function T7(q={}){let j=_8.getInstance().getIndexPath();try{if(!j3.existsSync(j)){if(q.format==="session-start")console.log(IK("NO_MEMORIES",q.project||"this project"));return}let Y=j3.readFileSync(j,"utf-8").trim().split(` +`).filter((w)=>w.trim());if(Y.length===0){if(q.format==="session-start")console.log(IK("NO_MEMORIES",q.project||"this project"));return}let f=[];for(let w of Y)try{if(!w.trim().startsWith("{"))continue;let v=JSON.parse(w);f.push(v)}catch(v){continue}if(f.length===0){if(q.format==="session-start")console.log(IK("NO_MEMORIES",q.project||"this project"));return}let P=f;if(q.project)P=f.filter((w)=>w.project===q.project);let $=q.format==="session-start"?30:10,O=P.slice(-$);if(q.format==="session-start"){let w="recently",v=O.map((z)=>{return z.timestamp?new Date(z.timestamp):null}).filter((z)=>z!==null).sort((z,W)=>W.getTime()-z.getTime());if(v.length>0)w=h1(v[0]);C1({projectName:q.project||"your project",memoryCount:O.length,lastSessionTime:w,recentObjects:O})}else if(q.format==="json")console.log(JSON.stringify(O));else console.log(l3("Context loading",O.length,"recent memories found")),O.forEach((w)=>{if(w.type==="memory")console.log(`${w.text} | ${w.document_id} | ${w.keywords}`);else if(w.type==="overview")console.log(`**Overview:** ${w.content}`);else if(w.type==="session")console.log(`# Session: ${w.session_id} [${w.timestamp}]`);else console.log(JSON.stringify(w))});if(q.format!=="json"){let w=sG();if(!w.isEmpty){let v=UG(w.totalSize);console.log(`\uD83D\uDDD1️ Trash – ${w.folderCount} folders | ${w.fileCount} files | ${v} – use \`$ claude-mem restore\` for more options.`)}}}catch(K){let Y=K instanceof Error?K.message:String(K);if(q.format==="session-start")console.log(IK("CONNECTION_FAILED",Y));else console.log(d_("Context loading",Y,"Check file permissions and try again"))}}var j9=Y6(()=>{C6();x4()});var h$={};uK(h$,{viewTrash:()=>Qh});import{readdirSync as X$,statSync as A$}from"fs";import{join as G$}from"path";function sh(q){let _=q.lastIndexOf(".");if(_===-1)return{name:q,timestamp:0};let j=parseInt(q.substring(_+1));if(isNaN(j))return{name:q,timestamp:0};return{name:q.substring(0,_),timestamp:j}}function k$(q){if(q===0)return"0 B";let _=1024,j=["B","KB","MB","GB"],K=Math.floor(Math.log(q)/Math.log(_));return parseFloat((q/Math.pow(_,K)).toFixed(2))+" "+j[K]}function u$(q){let _=0,j=X$(q);for(let K of j){let Y=G$(q,K),f=A$(Y);if(f.isDirectory())_+=u$(Y);else _+=f.size}return _}async function Qh(){let q=_8.getInstance().getTrashDirectory();try{let _=X$(q);if(_.length===0){Q8.info("\uD83D\uDDD1️ Trash is empty");return}let j=_.map((P)=>{let $=G$(q,P),O=A$($),{name:w,timestamp:v}=sh(P),z=O.isDirectory()?u$($):O.size;return{originalName:w,trashedName:P,size:z,trashedAt:new Date(v),isDirectory:O.isDirectory()}});j.sort((P,$)=>$.trashedAt.getTime()-P.trashedAt.getTime()),console.log(` +\uD83D\uDDD1️ Trash Contents +`),console.log("─".repeat(80));let K=0,Y=0,f=0;for(let P of j){if(K+=P.size,P.isDirectory)Y++;else f++;let $=P.isDirectory?"\uD83D\uDCC1":"\uD83D\uDCC4",O=P.trashedAt.toLocaleString(),w=k$(P.size);console.log(`${$} ${P.originalName}`),console.log(` Size: ${w} | Trashed: ${O}`),console.log(` ID: ${P.trashedName}`),console.log()}console.log("─".repeat(80)),console.log(`Total: ${Y} folders, ${f} files (${k$(K)})`),console.log(` +To restore files: claude-mem restore`),console.log("To empty trash: claude-mem trash empty")}catch(_){if(_.code==="ENOENT")Q8.info("\uD83D\uDDD1️ Trash is empty");else Q8.error("Failed to read trash directory"),console.error(_)}}var D$=Y6(()=>{KK();C6()});var V$={};uK(V$,{emptyTrash:()=>PD});import{rmSync as qD,readdirSync as _D,existsSync as KD,statSync as jD}from"fs";import{join as C$}from"path";async function PD(q={}){let _=_8.getInstance().getTrashDirectory();if(!KD(_)){Q8.info("\uD83D\uDDD1️ Trash is already empty");return}try{let j=_D(_);if(j.length===0){Q8.info("\uD83D\uDDD1️ Trash is already empty");return}let K=0,Y=0;for(let P of j){let $=C$(_,P);if(jD($).isDirectory())K++;else Y++}if(!q.force){let P=await gq({message:`Permanently delete ${K} folders and ${Y} files from trash?`,initialValue:!1});if(K6(P)||!P){Q8.info("Cancelled - trash not emptied");return}}let f=Y7();f.start("Emptying trash...");for(let P of j){let $=C$(_,P);qD($,{recursive:!0,force:!0})}f.stop(`\uD83D\uDDD1️ Trash emptied - permanently deleted ${K} folders and ${Y} files`)}catch(j){Q8.error("Failed to empty trash"),console.error(j),process.exit(1)}}var M$=Y6(()=>{KK();C6()});var y7={};uK(y7,{sessionStartHook:()=>fD,sessionEndHook:()=>$D,preCompactHook:()=>YD});import{basename as N$}from"path";async function YD(){try{let q="";process.stdin.setEncoding("utf8");for await(let j of process.stdin)q+=j;let _;if(q)try{_=JSON.parse(q).transcript_path}catch(j){_=q.trim()}if(!_)_=process.env.TRANSCRIPT_PATH||process.argv[2];if(!_){console.log("\uD83D\uDDDC️ Compressing session transcript..."),console.log("❌ No transcript path provided to pre-compact hook"),console.log("Hook data received:",q||"none"),console.log("Environment TRANSCRIPT_PATH:",process.env.TRANSCRIPT_PATH||"not set"),console.log("Command line args:",process.argv.slice(2));return}await oK(_,{dryRun:!1})}catch(q){console.error("Pre-compact hook failed:",q.message),process.exit(1)}}async function fD(){try{let q="";process.stdin.setEncoding("utf8");for await(let j of process.stdin)q+=j;let _;if(q)try{let j=JSON.parse(q);if(j.cwd)_=N$(j.cwd)}catch(j){console.error("Failed to parse session-start hook data:",j)}if(!_)_=N$(process.cwd());await T7({format:"session-start",count:"10",project:_})}catch(q){console.error("Session-start hook failed:",q.message),process.exit(1)}}async function $D(){try{let q="";process.stdin.setEncoding("utf8");for await(let _ of process.stdin)q+=_;if(q)try{let _=JSON.parse(q);if(_.reason==="clear"&&_.transcript_path)console.log("\uD83D\uDDDC️ Compressing current session before /clear..."),await oK(_.transcript_path,{dryRun:!1})}catch(_){console.error("Failed to parse hook data:",_)}console.log("Session ended successfully")}catch(q){console.error("Session-end hook failed:",q.message),process.exit(1)}}var d7=Y6(()=>{w2();j9()});var P5=o6(j5(),1),{program:VD,createCommand:MD,createArgument:ND,createOption:bD,CommanderError:SD,InvalidArgumentError:ED,InvalidOptionArgumentError:RD,Command:Y5,Argument:mD,Option:ID,Help:gD}=P5.default;import{readFileSync as cw,existsSync as rw}from"fs";import{join as iw,dirname as ow}from"path";import{fileURLToPath as aw}from"url";var f5="claude-mem",$5="3.5.4",w5="Memory compression system for Claude Code - persist context across sessions",O5=f5,v5=$5,z5=w5;try{let q=aw(import.meta.url),_=ow(q),j=iw(_,"..","..","package.json");if(rw(j)){let K=JSON.parse(cw(j,"utf-8"));O5=K.name||f5,v5=K.version||$5,z5=K.description||w5}}catch{}var pq=O5,W5=v5,J5=z5;w2();KK();import{readFileSync as YK,writeFileSync as H_,existsSync as R8,chmodSync as DG,mkdirSync as $K,copyFileSync as J_,statSync as CG,readdirSync as VG}from"fs";import{join as D8,dirname as fK}from"path";import{homedir as Q2}from"os";import{execSync as W_}from"child_process";import{fileURLToPath as ff}from"url";var _Y=(q=0)=>(_)=>`\x1B[${_+q}m`,KY=(q=0)=>(_)=>`\x1B[${38+q};5;${_}m`,jY=(q=0)=>(_,j,K)=>`\x1B[${38+q};2;${_};${j};${K}m`,l8={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}},LV=Object.keys(l8.modifier),vA=Object.keys(l8.color),zA=Object.keys(l8.bgColor),lV=[...vA,...zA];function WA(){let q=new Map;for(let[_,j]of Object.entries(l8)){for(let[K,Y]of Object.entries(j))l8[K]={open:`\x1B[${Y[0]}m`,close:`\x1B[${Y[1]}m`},j[K]=l8[K],q.set(Y[0],Y[1]);Object.defineProperty(l8,_,{value:j,enumerable:!1})}return Object.defineProperty(l8,"codes",{value:q,enumerable:!1}),l8.color.close="\x1B[39m",l8.bgColor.close="\x1B[49m",l8.color.ansi=_Y(),l8.color.ansi256=KY(),l8.color.ansi16m=jY(),l8.bgColor.ansi=_Y(10),l8.bgColor.ansi256=KY(10),l8.bgColor.ansi16m=jY(10),Object.defineProperties(l8,{rgbToAnsi256:{value(_,j,K){if(_===j&&j===K){if(_<8)return 16;if(_>248)return 231;return Math.round((_-8)/247*24)+232}return 16+36*Math.round(_/255*5)+6*Math.round(j/255*5)+Math.round(K/255*5)},enumerable:!1},hexToRgb:{value(_){let j=/[a-f\d]{6}|[a-f\d]{3}/i.exec(_.toString(16));if(!j)return[0,0,0];let[K]=j;if(K.length===3)K=[...K].map((f)=>f+f).join("");let Y=Number.parseInt(K,16);return[Y>>16&255,Y>>8&255,Y&255]},enumerable:!1},hexToAnsi256:{value:(_)=>l8.rgbToAnsi256(...l8.hexToRgb(_)),enumerable:!1},ansi256ToAnsi:{value(_){if(_<8)return 30+_;if(_<16)return 90+(_-8);let j,K,Y;if(_>=232)j=((_-232)*10+8)/255,K=j,Y=j;else{_-=16;let $=_%36;j=Math.floor(_/36)/5,K=Math.floor($/6)/5,Y=$%6/5}let f=Math.max(j,K,Y)*2;if(f===0)return 30;let P=30+(Math.round(Y)<<2|Math.round(K)<<1|Math.round(j));if(f===2)P+=60;return P},enumerable:!1},rgbToAnsi:{value:(_,j,K)=>l8.ansi256ToAnsi(l8.rgbToAnsi256(_,j,K)),enumerable:!1},hexToAnsi:{value:(_)=>l8.ansi256ToAnsi(l8.hexToAnsi256(_)),enumerable:!1}}),l8}var JA=WA(),Oq=JA;import b2 from"node:process";import HA from"node:os";import PY from"node:tty";function U6(q,_=globalThis.Deno?globalThis.Deno.args:b2.argv){let j=q.startsWith("-")?"":q.length===1?"-":"--",K=_.indexOf(j+q),Y=_.indexOf("--");return K!==-1&&(Y===-1||K=2,has16m:q>=3}}function kA(q,{streamIsTTY:_,sniffFlags:j=!0}={}){let K=TA();if(K!==void 0)f7=K;let Y=j?f7:K;if(Y===0)return 0;if(j){if(U6("color=16m")||U6("color=full")||U6("color=truecolor"))return 3;if(U6("color=256"))return 2}if("TF_BUILD"in n8&&"AGENT_NAME"in n8)return 1;if(q&&!_&&Y===void 0)return 0;let f=Y||0;if(n8.TERM==="dumb")return f;if(b2.platform==="win32"){let P=HA.release().split(".");if(Number(P[0])>=10&&Number(P[2])>=10586)return Number(P[2])>=14931?3:2;return 1}if("CI"in n8){if(["GITHUB_ACTIONS","GITEA_ACTIONS","CIRCLECI"].some((P)=>(P in n8)))return 3;if(["TRAVIS","APPVEYOR","GITLAB_CI","BUILDKITE","DRONE"].some((P)=>(P in n8))||n8.CI_NAME==="codeship")return 1;return f}if("TEAMCITY_VERSION"in n8)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(n8.TEAMCITY_VERSION)?1:0;if(n8.COLORTERM==="truecolor")return 3;if(n8.TERM==="xterm-kitty")return 3;if(n8.TERM==="xterm-ghostty")return 3;if(n8.TERM==="wezterm")return 3;if("TERM_PROGRAM"in n8){let P=Number.parseInt((n8.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(n8.TERM_PROGRAM){case"iTerm.app":return P>=3?3:2;case"Apple_Terminal":return 2}}if(/-256(color)?$/i.test(n8.TERM))return 2;if(/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(n8.TERM))return 1;if("COLORTERM"in n8)return 1;return f}function YY(q,_={}){let j=kA(q,{streamIsTTY:q&&q.isTTY,..._});return ZA(j)}var XA={stdout:YY({isTTY:PY.isatty(1)}),stderr:YY({isTTY:PY.isatty(2)})},fY=XA;function $Y(q,_,j){let K=q.indexOf(_);if(K===-1)return q;let Y=_.length,f=0,P="";do P+=q.slice(f,K)+_+j,f=K+Y,K=q.indexOf(_,f);while(K!==-1);return P+=q.slice(f),P}function wY(q,_,j,K){let Y=0,f="";do{let P=q[K-1]==="\r";f+=q.slice(Y,P?K-1:K)+_+(P?`\r +`:` +`)+j,Y=K+1,K=q.indexOf(` +`,Y)}while(K!==-1);return f+=q.slice(Y),f}var{stdout:OY,stderr:vY}=fY,S2=Symbol("GENERATOR"),jK=Symbol("STYLER"),eK=Symbol("IS_EMPTY"),zY=["ansi","ansi","ansi256","ansi16m"],PK=Object.create(null),AA=(q,_={})=>{if(_.level&&!(Number.isInteger(_.level)&&_.level>=0&&_.level<=3))throw new Error("The `level` option should be an integer from 0 to 3");let j=OY?OY.level:0;q.level=_.level===void 0?j:_.level};var GA=(q)=>{let _=(...j)=>j.join(" ");return AA(_,q),Object.setPrototypeOf(_,FK.prototype),_};function FK(q){return GA(q)}Object.setPrototypeOf(FK.prototype,Function.prototype);for(let[q,_]of Object.entries(Oq))PK[q]={get(){let j=$7(this,R2(_.open,_.close,this[jK]),this[eK]);return Object.defineProperty(this,q,{value:j}),j}};PK.visible={get(){let q=$7(this,this[jK],!0);return Object.defineProperty(this,"visible",{value:q}),q}};var E2=(q,_,j,...K)=>{if(q==="rgb"){if(_==="ansi16m")return Oq[j].ansi16m(...K);if(_==="ansi256")return Oq[j].ansi256(Oq.rgbToAnsi256(...K));return Oq[j].ansi(Oq.rgbToAnsi(...K))}if(q==="hex")return E2("rgb",_,j,...Oq.hexToRgb(...K));return Oq[j][q](...K)},uA=["rgb","hex","ansi256"];for(let q of uA){PK[q]={get(){let{level:j}=this;return function(...K){let Y=R2(E2(q,zY[j],"color",...K),Oq.color.close,this[jK]);return $7(this,Y,this[eK])}}};let _="bg"+q[0].toUpperCase()+q.slice(1);PK[_]={get(){let{level:j}=this;return function(...K){let Y=R2(E2(q,zY[j],"bgColor",...K),Oq.bgColor.close,this[jK]);return $7(this,Y,this[eK])}}}}var hA=Object.defineProperties(()=>{},{...PK,level:{enumerable:!0,get(){return this[S2].level},set(q){this[S2].level=q}}}),R2=(q,_,j)=>{let K,Y;if(j===void 0)K=q,Y=_;else K=j.openAll+q,Y=_+j.closeAll;return{open:q,close:_,openAll:K,closeAll:Y,parent:j}},$7=(q,_,j)=>{let K=(...Y)=>DA(K,Y.length===1?""+Y[0]:Y.join(" "));return Object.setPrototypeOf(K,hA),K[S2]=q,K[jK]=_,K[eK]=j,K},DA=(q,_)=>{if(q.level<=0||!_)return q[eK]?"":_;let j=q[jK];if(j===void 0)return _;let{openAll:K,closeAll:Y}=j;if(_.includes("\x1B"))while(j!==void 0)_=$Y(_,j.close,j.open),j=j.parent;let f=_.indexOf(` +`);if(f!==-1)_=wY(_,Y,K,f);return K+_+Y};Object.defineProperties(FK.prototype,PK);var CA=FK(),eV=FK({level:vY?vY.level:0});var e=CA;var p2=o6(AY(),1),Z6=(...q)=>{let _,j;if(q.length===0)throw new Error("Missing gradient colors");if(!Array.isArray(q[0])){if(q.length===1)throw new Error(`Expected an array of colors, received ${JSON.stringify(q[0])}`);_=p2.default(...q)}else _=p2.default(q[0]),j=L2(q[1]);let K=(Y,f)=>{return VA(Y?Y.toString():"",_,f??j)};return K.multiline=(Y,f)=>MA(Y?Y.toString():"",_,f??j),K},GY=(q,_,j)=>{return _.interpolation?.toLowerCase()==="hsv"?q.hsv(j,_.hsvSpin?.toLowerCase()||!1):q.rgb(j)};function VA(q,_,j){let K=L2(j),Y=Math.max(q.replace(/\s/g,"").length,_.stops.length),f=GY(_,K,Y),P="";for(let $ of q)P+=$.match(/\s/g)?$:e.hex(f.shift()?.toHex()||"#000")($);return P}function MA(q,_,j){let K=L2(j),Y=q.split(` +`),f=Math.max(...Y.map((O)=>O.length),_.stops.length),P=GY(_,K,f),$=[];for(let O of Y){let w=P.slice(0),v="";for(let z of O)v+=e.hex(w.shift()?.toHex()||"#000")(z);$.push(v)}return $.join(` +`)}function L2(q){let _={interpolation:"rgb",hsvSpin:"short",...q};if(q!==void 0&&typeof q!=="object")throw new TypeError(`Expected \`options\` to be an \`object\`, got \`${typeof q}\``);if(typeof _.interpolation!=="string")throw new TypeError(`Expected \`options.interpolation\` to be \`rgb\` or \`hsv\`, got \`${typeof _.interpolation}\``);if(_.interpolation.toLowerCase()==="hsv"&&typeof _.hsvSpin!=="string")throw new TypeError(`Expected \`options.hsvSpin\` to be a \`short\` or \`long\`, got \`${typeof _.hsvSpin}\``);return _}var L6={atlas:{colors:["#feac5e","#c779d0","#4bc0c8"],options:{}},cristal:{colors:["#bdfff3","#4ac29a"],options:{}},teen:{colors:["#77a1d3","#79cbca","#e684ae"],options:{}},mind:{colors:["#473b7b","#3584a7","#30d2be"],options:{}},morning:{colors:["#ff5f6d","#ffc371"],options:{interpolation:"hsv"}},vice:{colors:["#5ee7df","#b490ca"],options:{interpolation:"hsv"}},passion:{colors:["#f43b47","#453a94"],options:{}},fruit:{colors:["#ff4e50","#f9d423"],options:{}},instagram:{colors:["#833ab4","#fd1d1d","#fcb045"],options:{}},retro:{colors:["#3f51b1","#5a55ae","#7b5fac","#8f6aae","#a86aa4","#cc6b8e","#f18271","#f3a469","#f7c978"],options:{}},summer:{colors:["#fdbb2d","#22c1c3"],options:{}},rainbow:{colors:["#ff0000","#ff0100"],options:{interpolation:"hsv",hsvSpin:"long"}},pastel:{colors:["#74ebd5","#74ecd5"],options:{interpolation:"hsv",hsvSpin:"long"}}};function l6(q){let _=(j)=>Z6(...q.colors)(j,q.options);return _.multiline=(j="")=>Z6(...q.colors).multiline(j,q.options),_}var v_=Z6,NA=l6(L6.atlas),bA=l6(L6.cristal),SA=l6(L6.teen),EA=l6(L6.mind),RA=l6(L6.morning),mA=l6(L6.vice),IA=l6(L6.passion),gA=l6(L6.fruit),yA=l6(L6.instagram),dA=l6(L6.retro),pA=l6(L6.summer),LA=l6(L6.rainbow),lA=l6(L6.pastel);Z6.atlas=NA;Z6.cristal=bA;Z6.teen=SA;Z6.mind=EA;Z6.morning=RA;Z6.vice=mA;Z6.passion=IA;Z6.fruit=gA;Z6.instagram=yA;Z6.retro=dA;Z6.summer=pA;Z6.rainbow=LA;Z6.pastel=lA;import J7 from"node:process";function l2({onlyFirst:q=!1}={}){return new RegExp("(?:\\u001B\\][\\s\\S]*?(?:\\u0007|\\u001B\\u005C|\\u009C))|[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]",q?void 0:"g")}var nA=l2();function n2(q){if(typeof q!=="string")throw new TypeError(`Expected a \`string\`, got \`${typeof q}\``);return q.replace(nA,"")}function uY(q){return q===161||q===164||q===167||q===168||q===170||q===173||q===174||q>=176&&q<=180||q>=182&&q<=186||q>=188&&q<=191||q===198||q===208||q===215||q===216||q>=222&&q<=225||q===230||q>=232&&q<=234||q===236||q===237||q===240||q===242||q===243||q>=247&&q<=250||q===252||q===254||q===257||q===273||q===275||q===283||q===294||q===295||q===299||q>=305&&q<=307||q===312||q>=319&&q<=322||q===324||q>=328&&q<=331||q===333||q===338||q===339||q===358||q===359||q===363||q===462||q===464||q===466||q===468||q===470||q===472||q===474||q===476||q===593||q===609||q===708||q===711||q>=713&&q<=715||q===717||q===720||q>=728&&q<=731||q===733||q===735||q>=768&&q<=879||q>=913&&q<=929||q>=931&&q<=937||q>=945&&q<=961||q>=963&&q<=969||q===1025||q>=1040&&q<=1103||q===1105||q===8208||q>=8211&&q<=8214||q===8216||q===8217||q===8220||q===8221||q>=8224&&q<=8226||q>=8228&&q<=8231||q===8240||q===8242||q===8243||q===8245||q===8251||q===8254||q===8308||q===8319||q>=8321&&q<=8324||q===8364||q===8451||q===8453||q===8457||q===8467||q===8470||q===8481||q===8482||q===8486||q===8491||q===8531||q===8532||q>=8539&&q<=8542||q>=8544&&q<=8555||q>=8560&&q<=8569||q===8585||q>=8592&&q<=8601||q===8632||q===8633||q===8658||q===8660||q===8679||q===8704||q===8706||q===8707||q===8711||q===8712||q===8715||q===8719||q===8721||q===8725||q===8730||q>=8733&&q<=8736||q===8739||q===8741||q>=8743&&q<=8748||q===8750||q>=8756&&q<=8759||q===8764||q===8765||q===8776||q===8780||q===8786||q===8800||q===8801||q>=8804&&q<=8807||q===8810||q===8811||q===8814||q===8815||q===8834||q===8835||q===8838||q===8839||q===8853||q===8857||q===8869||q===8895||q===8978||q>=9312&&q<=9449||q>=9451&&q<=9547||q>=9552&&q<=9587||q>=9600&&q<=9615||q>=9618&&q<=9621||q===9632||q===9633||q>=9635&&q<=9641||q===9650||q===9651||q===9654||q===9655||q===9660||q===9661||q===9664||q===9665||q>=9670&&q<=9672||q===9675||q>=9678&&q<=9681||q>=9698&&q<=9701||q===9711||q===9733||q===9734||q===9737||q===9742||q===9743||q===9756||q===9758||q===9792||q===9794||q===9824||q===9825||q>=9827&&q<=9829||q>=9831&&q<=9834||q===9836||q===9837||q===9839||q===9886||q===9887||q===9919||q>=9926&&q<=9933||q>=9935&&q<=9939||q>=9941&&q<=9953||q===9955||q===9960||q===9961||q>=9963&&q<=9969||q===9972||q>=9974&&q<=9977||q===9979||q===9980||q===9982||q===9983||q===10045||q>=10102&&q<=10111||q>=11094&&q<=11097||q>=12872&&q<=12879||q>=57344&&q<=63743||q>=65024&&q<=65039||q===65533||q>=127232&&q<=127242||q>=127248&&q<=127277||q>=127280&&q<=127337||q>=127344&&q<=127373||q===127375||q===127376||q>=127387&&q<=127404||q>=917760&&q<=917999||q>=983040&&q<=1048573||q>=1048576&&q<=1114109}function hY(q){return q===12288||q>=65281&&q<=65376||q>=65504&&q<=65510}function DY(q){return q>=4352&&q<=4447||q===8986||q===8987||q===9001||q===9002||q>=9193&&q<=9196||q===9200||q===9203||q===9725||q===9726||q===9748||q===9749||q>=9776&&q<=9783||q>=9800&&q<=9811||q===9855||q>=9866&&q<=9871||q===9875||q===9889||q===9898||q===9899||q===9917||q===9918||q===9924||q===9925||q===9934||q===9940||q===9962||q===9970||q===9971||q===9973||q===9978||q===9981||q===9989||q===9994||q===9995||q===10024||q===10060||q===10062||q>=10067&&q<=10069||q===10071||q>=10133&&q<=10135||q===10160||q===10175||q===11035||q===11036||q===11088||q===11093||q>=11904&&q<=11929||q>=11931&&q<=12019||q>=12032&&q<=12245||q>=12272&&q<=12287||q>=12289&&q<=12350||q>=12353&&q<=12438||q>=12441&&q<=12543||q>=12549&&q<=12591||q>=12593&&q<=12686||q>=12688&&q<=12773||q>=12783&&q<=12830||q>=12832&&q<=12871||q>=12880&&q<=42124||q>=42128&&q<=42182||q>=43360&&q<=43388||q>=44032&&q<=55203||q>=63744&&q<=64255||q>=65040&&q<=65049||q>=65072&&q<=65106||q>=65108&&q<=65126||q>=65128&&q<=65131||q>=94176&&q<=94180||q===94192||q===94193||q>=94208&&q<=100343||q>=100352&&q<=101589||q>=101631&&q<=101640||q>=110576&&q<=110579||q>=110581&&q<=110587||q===110589||q===110590||q>=110592&&q<=110882||q===110898||q>=110928&&q<=110930||q===110933||q>=110948&&q<=110951||q>=110960&&q<=111355||q>=119552&&q<=119638||q>=119648&&q<=119670||q===126980||q===127183||q===127374||q>=127377&&q<=127386||q>=127488&&q<=127490||q>=127504&&q<=127547||q>=127552&&q<=127560||q===127568||q===127569||q>=127584&&q<=127589||q>=127744&&q<=127776||q>=127789&&q<=127797||q>=127799&&q<=127868||q>=127870&&q<=127891||q>=127904&&q<=127946||q>=127951&&q<=127955||q>=127968&&q<=127984||q===127988||q>=127992&&q<=128062||q===128064||q>=128066&&q<=128252||q>=128255&&q<=128317||q>=128331&&q<=128334||q>=128336&&q<=128359||q===128378||q===128405||q===128406||q===128420||q>=128507&&q<=128591||q>=128640&&q<=128709||q===128716||q>=128720&&q<=128722||q>=128725&&q<=128727||q>=128732&&q<=128735||q===128747||q===128748||q>=128756&&q<=128764||q>=128992&&q<=129003||q===129008||q>=129292&&q<=129338||q>=129340&&q<=129349||q>=129351&&q<=129535||q>=129648&&q<=129660||q>=129664&&q<=129673||q>=129679&&q<=129734||q>=129742&&q<=129756||q>=129759&&q<=129769||q>=129776&&q<=129784||q>=131072&&q<=196605||q>=196608&&q<=262141}function xA(q){if(!Number.isSafeInteger(q))throw new TypeError(`Expected a code point, got \`${typeof q}\`.`)}function CY(q,{ambiguousAsWide:_=!1}={}){if(xA(q),hY(q)||DY(q)||_&&uY(q))return 2;return 1}var NY=o6(MY(),1),cA=new Intl.Segmenter,rA=/^\p{Default_Ignorable_Code_Point}$/u;function V6(q,_={}){if(typeof q!=="string"||q.length===0)return 0;let{ambiguousIsNarrow:j=!0,countAnsiEscapeCodes:K=!1}=_;if(!K)q=n2(q);if(q.length===0)return 0;let Y=0,f={ambiguousAsWide:!j};for(let{segment:P}of cA.segment(q)){let $=P.codePointAt(0);if($<=31||$>=127&&$<=159)continue;if($>=8203&&$<=8207||$===65279)continue;if($>=768&&$<=879||$>=6832&&$<=6911||$>=7616&&$<=7679||$>=8400&&$<=8447||$>=65056&&$<=65071)continue;if($>=55296&&$<=57343)continue;if($>=65024&&$<=65039)continue;if(rA.test(P))continue;if(NY.default().test(P)){Y+=2;continue}Y+=CY($,f)}return Y}function O7(q){let _=0;for(let j of q.split(` +`))_=Math.max(_,V6(j));return _}var jf=o6(c2(),1);var oA=/[\p{Lu}]/u,aA=/[\p{Ll}]/u,EY=/^[\p{Lu}](?![\p{Lu}])/gu,IY=/([\p{Alpha}\p{N}_]|$)/u,r2=/[_.\- ]+/,BA=new RegExp("^"+r2.source),RY=new RegExp(r2.source+IY.source,"gu"),mY=new RegExp("\\d+"+IY.source,"gu"),tA=(q,_,j,K)=>{let Y=!1,f=!1,P=!1,$=!1;for(let O=0;O2?q[O-3]==="-":!0,Y&&oA.test(w))q=q.slice(0,O)+"-"+q.slice(O),Y=!1,P=f,f=!0,O++;else if(f&&P&&aA.test(w)&&(!$||K))q=q.slice(0,O-1)+"-"+q.slice(O-1),P=f,f=!1,Y=!0;else Y=_(w)===w&&j(w)!==w,P=f,f=j(w)===w&&_(w)!==w}return q},eA=(q,_)=>{return EY.lastIndex=0,q.replaceAll(EY,(j)=>_(j))},FA=(q,_)=>{return RY.lastIndex=0,mY.lastIndex=0,q.replaceAll(mY,(j,K,Y)=>["_","-"].includes(q.charAt(Y+j.length))?j:_(j)).replaceAll(RY,(j,K)=>_(K))};function i2(q,_){if(!(typeof q==="string"||Array.isArray(q)))throw new TypeError("Expected the input to be `string | string[]`");if(_={pascalCase:!1,preserveConsecutiveUppercase:!1,..._},Array.isArray(q))q=q.map((f)=>f.trim()).filter((f)=>f.length).join("-");else q=q.trim();if(q.length===0)return"";let j=_.locale===!1?(f)=>f.toLowerCase():(f)=>f.toLocaleLowerCase(_.locale),K=_.locale===!1?(f)=>f.toUpperCase():(f)=>f.toLocaleUpperCase(_.locale);if(q.length===1){if(r2.test(q))return"";return _.pascalCase?K(q):j(q)}if(q!==j(q))q=tA(q,j,K,_.preserveConsecutiveUppercase);if(q=q.replace(BA,""),q=_.preserveConsecutiveUppercase?eA(q,j):j(q),_.pascalCase)q=K(q.charAt(0))+q.slice(1);return FA(q,K)}var U2=o6(oY(),1);function B2({onlyFirst:q=!1}={}){return new RegExp("(?:\\u001B\\][\\s\\S]*?(?:\\u0007|\\u001B\\u005C|\\u009C))|[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]",q?void 0:"g")}var PG=B2();function t2(q){if(typeof q!=="string")throw new TypeError(`Expected a \`string\`, got \`${typeof q}\``);return q.replace(PG,"")}var aY=(q=0)=>(_)=>`\x1B[${_+q}m`,BY=(q=0)=>(_)=>`\x1B[${38+q};5;${_}m`,tY=(q=0)=>(_,j,K)=>`\x1B[${38+q};2;${_};${j};${K}m`,x8={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}},VM=Object.keys(x8.modifier),YG=Object.keys(x8.color),fG=Object.keys(x8.bgColor),MM=[...YG,...fG];function $G(){let q=new Map;for(let[_,j]of Object.entries(x8)){for(let[K,Y]of Object.entries(j))x8[K]={open:`\x1B[${Y[0]}m`,close:`\x1B[${Y[1]}m`},j[K]=x8[K],q.set(Y[0],Y[1]);Object.defineProperty(x8,_,{value:j,enumerable:!1})}return Object.defineProperty(x8,"codes",{value:q,enumerable:!1}),x8.color.close="\x1B[39m",x8.bgColor.close="\x1B[49m",x8.color.ansi=aY(),x8.color.ansi256=BY(),x8.color.ansi16m=tY(),x8.bgColor.ansi=aY(10),x8.bgColor.ansi256=BY(10),x8.bgColor.ansi16m=tY(10),Object.defineProperties(x8,{rgbToAnsi256:{value:(_,j,K)=>{if(_===j&&j===K){if(_<8)return 16;if(_>248)return 231;return Math.round((_-8)/247*24)+232}return 16+36*Math.round(_/255*5)+6*Math.round(j/255*5)+Math.round(K/255*5)},enumerable:!1},hexToRgb:{value:(_)=>{let j=/[a-f\d]{6}|[a-f\d]{3}/i.exec(_.toString(16));if(!j)return[0,0,0];let[K]=j;if(K.length===3)K=[...K].map((f)=>f+f).join("");let Y=Number.parseInt(K,16);return[Y>>16&255,Y>>8&255,Y&255]},enumerable:!1},hexToAnsi256:{value:(_)=>x8.rgbToAnsi256(...x8.hexToRgb(_)),enumerable:!1},ansi256ToAnsi:{value:(_)=>{if(_<8)return 30+_;if(_<16)return 90+(_-8);let j,K,Y;if(_>=232)j=((_-232)*10+8)/255,K=j,Y=j;else{_-=16;let $=_%36;j=Math.floor(_/36)/5,K=Math.floor($/6)/5,Y=$%6/5}let f=Math.max(j,K,Y)*2;if(f===0)return 30;let P=30+(Math.round(Y)<<2|Math.round(K)<<1|Math.round(j));if(f===2)P+=60;return P},enumerable:!1},rgbToAnsi:{value:(_,j,K)=>x8.ansi256ToAnsi(x8.rgbToAnsi256(_,j,K)),enumerable:!1},hexToAnsi:{value:(_)=>x8.ansi256ToAnsi(x8.hexToAnsi256(_)),enumerable:!1}}),x8}var wG=$G(),eY=wG;var z7=new Set(["\x1B","›"]),OG=39,F2="\x07",sY="[",vG="]",QY="m",v7=`${vG}8;;`,FY=(q)=>`${z7.values().next().value}${sY}${q}${QY}`,UY=(q)=>`${z7.values().next().value}${v7}${q}${F2}`,zG=(q)=>q.split(" ").map((_)=>V6(_)),e2=(q,_,j)=>{let K=[..._],Y=!1,f=!1,P=V6(t2(q.at(-1)));for(let[$,O]of K.entries()){let w=V6(O);if(P+w<=j)q[q.length-1]+=O;else q.push(O),P=0;if(z7.has(O))Y=!0,f=K.slice($+1,$+1+v7.length).join("")===v7;if(Y){if(f){if(O===F2)Y=!1,f=!1}else if(O===QY)Y=!1;continue}if(P+=w,P===j&&$0&&q.length>1)q[q.length-2]+=q.pop()},WG=(q)=>{let _=q.split(" "),j=_.length;while(j>0){if(V6(_[j-1])>0)break;j--}if(j===_.length)return q;return _.slice(0,j).join(" ")+_.slice(j).join("")},JG=(q,_,j={})=>{if(j.trim!==!1&&q.trim()==="")return"";let K="",Y,f,P=zG(q),$=[""];for(let[z,W]of q.split(" ").entries()){if(j.trim!==!1)$[$.length-1]=$.at(-1).trimStart();let J=V6($.at(-1));if(z!==0){if(J>=_&&(j.wordWrap===!1||j.trim===!1))$.push(""),J=0;if(J>0||j.trim===!1)$[$.length-1]+=" ",J++}if(j.hard&&P[z]>_){let k=_-J,H=1+Math.floor((P[z]-k-1)/_);if(Math.floor((P[z]-1)/_)_&&J>0&&P[z]>0){if(j.wordWrap===!1&&J<_){e2($,W,_);continue}$.push("")}if(J+P[z]>_&&j.wordWrap===!1){e2($,W,_);continue}$[$.length-1]+=W}if(j.trim!==!1)$=$.map((z)=>WG(z));let O=$.join(` +`),w=[...O],v=0;for(let[z,W]of w.entries()){if(K+=W,z7.has(W)){let{groups:k}=new RegExp(`(?:\\${sY}(?\\d+)m|\\${v7}(?.*)${F2})`).exec(O.slice(v))||{groups:{}};if(k.code!==void 0){let H=Number.parseFloat(k.code);Y=H===OG?void 0:H}else if(k.uri!==void 0)f=k.uri.length===0?void 0:k.uri}let J=eY.codes.get(Number(Y));if(w[z+1]===` +`){if(f)K+=UY("");if(Y&&J)K+=FY(J)}else if(W===` +`){if(Y&&J)K+=FY(Y);if(f)K+=UY(f)}v+=W.length}return K};function W7(q,_,j){return String(q).normalize().replaceAll(`\r +`,` +`).split(` +`).map((K)=>JG(K,_,j)).join(` +`)}var hG=o6(c2(),1),aq=` +`,n6=" ",sK="none",Pf=()=>{let{env:q,stdout:_,stderr:j}=J7;if(_?.columns)return _.columns;if(j?.columns)return j.columns;if(q.COLUMNS)return Number.parseInt(q.COLUMNS,10);return 80},qf=(q)=>typeof q==="number"?{top:q,right:q*3,bottom:q,left:q*3}:{top:0,right:0,bottom:0,left:0,...q},QK=(q)=>q===sK?0:2,HG=(q)=>{let _=["topLeft","topRight","bottomRight","bottomLeft","left","right","top","bottom"],j;if(q===sK){q={};for(let K of _)q[K]=""}if(typeof q==="string"){if(j=jf.default[q],!j)throw new TypeError(`Invalid border style: ${q}`)}else{if(typeof q?.vertical==="string")q.left=q.vertical,q.right=q.vertical;if(typeof q?.horizontal==="string")q.top=q.horizontal,q.bottom=q.horizontal;for(let K of _)if(q[K]===null||typeof q[K]!=="string")throw new TypeError(`Invalid border style: ${K}`);j=q}return j},TG=(q,_,j)=>{let K="",Y=V6(q);switch(j){case"left":{K=q+_.slice(Y);break}case"right":{K=_.slice(Y)+q;break}default:{if(_=_.slice(Y),_.length%2===1)_=_.slice(Math.floor(_.length/2)),K=_.slice(1)+q+_;else _=_.slice(_.length/2),K=_+q+_;break}}return K},ZG=(q,{padding:_,width:j,textAlignment:K,height:Y})=>{q=U2.default(q,{align:K});let f=q.split(aq),P=O7(q),$=j-_.left-_.right;if(P>$){let v=[];for(let z of f){let W=W7(z,$,{hard:!0}),k=U2.default(W,{align:K}).split(` +`),H=Math.max(...k.map((X)=>V6(X)));for(let X of k){let A;switch(K){case"center":{A=n6.repeat(($-H)/2)+X;break}case"right":{A=n6.repeat($-H)+X;break}default:{A=X;break}}v.push(A)}}f=v}if(K==="center"&&P<$)f=f.map((v)=>n6.repeat(($-P)/2)+v);else if(K==="right"&&P<$)f=f.map((v)=>n6.repeat($-P)+v);let O=n6.repeat(_.left),w=n6.repeat(_.right);if(f=f.map((v)=>{let z=O+v+w;return z+n6.repeat(j-V6(z))}),_.top>0)f=[...Array.from({length:_.top}).fill(n6.repeat(j)),...f];if(_.bottom>0)f=[...f,...Array.from({length:_.bottom}).fill(n6.repeat(j))];if(Y&&f.length>Y)f=f.slice(0,Y);else if(Y&&f.length{let K=(v)=>{let z=j.borderColor?GG(j.borderColor)(v):v;return j.dimBorder?e.dim(z):z},Y=(v)=>j.backgroundColor?uG(j.backgroundColor)(v):v,f=HG(j.borderStyle),P=Pf(),$=n6.repeat(j.margin.left);if(j.float==="center"){let v=Math.max((P-_-QK(j.borderStyle))/2,0);$=n6.repeat(v)}else if(j.float==="right"){let v=Math.max(P-_-j.margin.right-QK(j.borderStyle),0);$=n6.repeat(v)}let O="";if(j.margin.top)O+=aq.repeat(j.margin.top);if(j.borderStyle!==sK||j.title)O+=K($+f.topLeft+(j.title?TG(j.title,f.top.repeat(_),j.titleAlignment):f.top.repeat(_))+f.topRight)+aq;let w=q.split(aq);if(O+=w.map((v)=>$+K(f.left)+Y(v)+K(f.right)).join(aq),j.borderStyle!==sK)O+=aq+K($+f.bottomLeft+f.bottom.repeat(_)+f.bottomRight);if(j.margin.bottom)O+=aq.repeat(j.margin.bottom);return O},XG=(q)=>{if(q.fullscreen&&J7?.stdout){let _=[J7.stdout.columns,J7.stdout.rows];if(typeof q.fullscreen==="function")_=q.fullscreen(..._);q.width||=_[0],q.height||=_[1]}return q.width&&=Math.max(1,q.width-QK(q.borderStyle)),q.height&&=Math.max(1,q.height-QK(q.borderStyle)),q},_f=(q,_)=>_===sK?q:` ${q} `,AG=(q,_)=>{_=XG(_);let j=_.width!==void 0,K=Pf(),Y=QK(_.borderStyle),f=K-_.margin.left-_.margin.right-Y,P=O7(W7(q,K-Y,{hard:!0,trim:!1}))+_.padding.left+_.padding.right;if(_.title&&j)_.title=_.title.slice(0,Math.max(0,_.width-2)),_.title&&=_f(_.title,_.borderStyle);else if(_.title){if(_.title=_.title.slice(0,Math.max(0,f-2)),_.title){if(_.title=_f(_.title,_.borderStyle),V6(_.title)>P)_.width=V6(_.title)}}if(_.width||=P,!j){if(_.margin.left&&_.margin.right&&_.width>f){let O=(K-_.width-Y)/(_.margin.left+_.margin.right);_.margin.left=Math.max(0,Math.floor(_.margin.left*O)),_.margin.right=Math.max(0,Math.floor(_.margin.right*O))}_.width=Math.min(_.width,K-Y-_.margin.left-_.margin.right)}if(_.width-(_.padding.left+_.padding.right)<=0)_.padding.left=0,_.padding.right=0;if(_.height&&_.height-(_.padding.top+_.padding.bottom)<=0)_.padding.top=0,_.padding.bottom=0;return _},s2=(q)=>q.match(/^#(?:[0-f]{3}){1,2}$/i),Kf=(q)=>typeof q==="string"&&(e[q]??s2(q)),GG=(q)=>s2(q)?e.hex(q):e[q],uG=(q)=>s2(q)?e.bgHex(q):e[i2(["bg",q])];function k6(q,_){if(_={padding:0,borderStyle:"single",dimBorder:!1,textAlignment:"left",float:"left",titleAlignment:"left",..._},_.align)_.textAlignment=_.align;if(_.borderColor&&!Kf(_.borderColor))throw new Error(`${_.borderColor} is not a valid borderColor`);if(_.backgroundColor&&!Kf(_.backgroundColor))throw new Error(`${_.backgroundColor} is not a valid backgroundColor`);return _.padding=qf(_.padding),_.margin=qf(_.margin),_=AG(q,_),q=ZG(q,_),kG(q,_.width,_)}C6();function q9(q){let _,j=0,K=["⠋","⠙","⠹","⠸","⠼","⠴","⠦","⠧","⠇","⠏"];return{start(){_=setInterval(()=>{process.stdout.write(`\r${e.cyan(K[j%K.length])} ${q}`),j++},50)},stop(Y,f=!0){clearInterval(_);let P=f?e.green("✓"):e.red("✗");process.stdout.write(`\r${P} ${Y} +`)}}}var z6=(q)=>new Promise((_)=>setTimeout(_,q)),q3=v_(["#ff0000","#ff4500","#ffa500","#ffff00","#00ff00","#00ffff","#0000ff","#8b00ff"]),H7=v_(["#ff006e","#fb5607","#ffbe0b","#8338ec","#3a86ff"]);async function MG(){let q=[{name:"Node.js version",check:async()=>{let j=process.versions.node,[K]=j.split(".").map(Number);return{success:K>=18,message:K>=18?"":`Node.js ${j} is below required version 18.0.0`}}},{name:"Claude Code CLI",check:async()=>{try{return W_("which claude",{stdio:"ignore"}),{success:!0,message:""}}catch{return{success:!1,message:"Claude Code CLI not found. Please install: https://docs.anthropic.com/claude/docs/claude-code"}}}},{name:"uv (Python package manager)",check:async()=>{try{return W_("which uv",{stdio:"ignore"}),{success:!0,message:""}}catch{return{success:!0,message:"",needsInstall:!0}}}},{name:"Write permissions",check:async()=>{let j=D8(_8.getDataDirectory(),"test-permissions");try{return $K(j,{recursive:!0}),H_(D8(j,"test"),"test"),W_(`rm -rf ${j}`,{stdio:"ignore"}),{success:!0,message:""}}catch{return{success:!1,message:"No write permissions to claude-mem data directory"}}}}],_=!1;for(let{name:j,check:K}of q){let Y=await K();if(!Y.success)return console.log(k6(e.red(`❌ ${j} check failed! + +${Y.message}`),{padding:1,margin:1,borderStyle:"double",borderColor:"red"})),!1;if(Y.needsInstall&&j==="uv (Python package manager)")_=!0}if(_){let j=q9("Installing uv (Python package manager)...");j.start();try{W_("curl -LsSf https://astral.sh/uv/install.sh | sh",{stdio:"pipe",shell:"/bin/sh"}),process.env.PATH=`${Q2()}/.cargo/bin:${process.env.PATH}`,j.stop("uv installed successfully",!0)}catch(K){return j.stop("Failed to install uv automatically",!1),console.log(k6(e.yellow(`⚠️ Please install uv manually: + +${e.cyan("curl -LsSf https://astral.sh/uv/install.sh | sh")} + +Or visit: ${e.cyan("https://docs.astral.sh/uv/getting-started/installation/")}`),{padding:1,margin:1,borderStyle:"round",borderColor:"yellow"})),!1}}return!0}function Yf(){try{return W_("which claude",{encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim()||null}catch{return null}}function NG(){let q={hasHooks:!1,hasChromaMcp:!1,hasSettings:!1,scope:void 0},_=_8.getHooksDirectory();q.hasHooks=R8(_)&&R8(D8(_,"pre-compact.js"))&&R8(D8(_,"session-start.js"));let j=_8.getInstance(),K=j.getMcpConfigPath(),Y=j.getProjectMcpConfigPath();if(R8(K))try{if(JSON.parse(YK(K,"utf8")).mcpServers?.["claude-mem"])q.hasChromaMcp=!0,q.scope="user"}catch{}if(R8(Y))try{if(JSON.parse(YK(Y,"utf8")).mcpServers?.["claude-mem"])q.hasChromaMcp=!0,q.scope="project"}catch{}let f=j.getUserSettingsPath();return q.hasSettings=R8(f),q}async function bG(q){let _={};if(q.hasHooks||q.hasChromaMcp){let f=await gq({message:`\uD83E\uDDE0 Existing claude-mem installation detected. Your memories and data are safe! + +Reinstall to update hooks and configuration?`,initialValue:!0});if(K6(f))return p6("Installation cancelled"),null;if(!f)return p6("Installation cancelled"),null;_.forceReinstall=!0}else _.forceReinstall=!1;let j=await oq({message:"Select installation scope",options:[{value:"user",label:"User (Recommended)",hint:"Install for current user (~/.claude)"},{value:"project",label:"Project",hint:"Install for current project only (./.mcp.json)"},{value:"local",label:"Local",hint:"Custom local installation"}],initialValue:q.scope||"user"});if(K6(j))return p6("Installation cancelled"),null;if(_.scope=j,j==="local"){let f=await sP({message:"Enter custom installation directory",placeholder:D8(process.cwd(),".claude-mem"),validate:(P)=>{if(!P)return"Path is required";if(!P.startsWith("/")&&!P.startsWith("~"))return"Please provide an absolute path"}});if(K6(f))return p6("Installation cancelled"),null;_.customPath=f}_.hookTimeout=180000;let K=await gq({message:'Enable Smart Trash? This creates an alias for "rm" that moves files to ~/.claude-mem/trash instead of permanently deleting them. You can restore files anytime by typing "claude-mem restore".',initialValue:!0});if(K6(K))return p6("Installation cancelled"),null;_.enableSmartTrash=K;let Y=await gq({message:`claude-mem is designed to save "memories" when you type /compact. The official compact summary + claude-mem produces the best ongoing results, but sometimes you may want to completely clear the context and still retain the "memories" from your last conversation. + +Would you like to save memories when you type "/clear" in Claude Code? When running /clear with this on, it takes about a minute to save memories before your new session starts.`,initialValue:!1});if(K6(Y))return p6("Installation cancelled"),null;return _.saveMemoriesOnClear=Y,_}async function SG(){let q=_8.getInstance(),_=D8(q.getBackupsDirectory(),new Date().toISOString().replace(/[:.]/g,"-"));try{$K(_,{recursive:!0});let j=q.getHooksDirectory();if(R8(j))_9(j,D8(_,"hooks"));let K=q.getUserSettingsPath();if(R8(K))J_(K,D8(_,"settings.json"));let Y=q.getClaudeSettingsPath();if(R8(Y))J_(Y,D8(_,"claude-settings.json"));return _}catch(j){return null}}function EG(){let q=_8.getInstance();q.ensureAllDataDirectories(),q.ensureAllClaudeDirectories();let _=D8(q.getDataDirectory(),"package.json");if(!R8(_))H_(_,JSON.stringify({name:"claude-mem-data",type:"module"},null,2))}function _9(q,_){if(CG(q).isDirectory()){if(!R8(_))$K(_,{recursive:!0});VG(q).forEach((Y)=>{_9(D8(q,Y),D8(_,Y))})}else J_(q,_)}function RG(q=180000){let _=_8.getInstance(),j=_.getHooksDirectory(),K=ff(import.meta.url),f=fK(K),P=null;for(let W=0;W<10;W++){let J=D8(f,"hooks");if(R8(D8(J,"pre-compact.js"))){P=J;break}let k=fK(f);if(k===f)break;f=k}if(!P)try{P=_.findPackageHooksDirectory()}catch(W){throw new Error("Cannot dynamically locate hooks directory. The package may be corrupted.")}let $=["pre-compact.js","session-start.js","session-end.js"];for(let W of $){let J=D8(P,W),k=D8(j,W);if(R8(J))J_(J,k),DG(k,493)}let O=D8(P,"shared"),w=D8(j,"shared");if(R8(O))_9(O,w);let v=D8(j,"config.json");H_(v,JSON.stringify({packageName:pq,cliCommand:pq,backend:"chroma",timeout:q},null,2))}function mG(){let _=_8.getInstance().getClaudeMdPath(),j=fK(_);if(!R8(j))$K(j,{recursive:!0});let K=` + +- You have access to a persistent memory system via the Chroma MCP server (installed as "claude-mem") +- The memory system automatically compresses and stores context from your sessions +- Available MCP tools: + - \`mcp__claude-mem__chroma_add_documents\`: Store new knowledge as documents in the "claude_memories" collection + - \`mcp__claude-mem__chroma_query_documents\`: Search for relevant memories using semantic search in the "claude_memories" collection + - \`mcp__claude-mem__chroma_get_documents\`: Retrieve specific documents by IDs from the "claude_memories" collection +- **Document Structure:** + - Documents are stored as natural language descriptions of knowledge + - Each document has metadata including: timestamp, session_id, keywords, entity_type + - Use descriptive content that captures the essence of what was learned or accomplished +- **Search Tips:** + - Use semantic queries: \`chroma_query_documents\` with natural language queries + - Search by metadata: Use \`where\` parameter to filter by entity_type, timestamp, etc. + - Use keywords in metadata for precise filtering +- **Storage Format:** + - Store knowledge as readable documents rather than structured entities + - Include context, rationale, and outcomes in document content + - Use metadata to categorize and filter memories +- **Smart Retrieval Commands:** + - **Find similar concepts**: \`chroma_query_documents(["your search terms"])\` + - Example: \`chroma_query_documents(["websocket", "connection"])\` - finds all websocket-related memories + - **Load specific memory**: \`chroma_get_documents(["document_id"])\` + - Example: \`chroma_get_documents(["project_session_1"])\` - loads exact memory by ID + - **Search by metadata**: Use keywords from memories to find related items + - The system uses semantic search, so "auth" will find "authentication", "login", etc. + - **Find connected memories**: Look for memories with related_to fields linking them together +- Collection name: "claude_memories" +- Compressed session archives are stored in ~/.claude-mem/archives/ +- **Optimal Search Strategies:** + - **Most Effective Patterns:** + - Session continuity: \`where: {session_id: "xxx"}\` - precise retrieval of all session work + - Find specific fixes: \`where: {type: "fix"}\` - filters to only bug fixes + - Natural language queries: "fixing overview display in templates" beats "fix AND overview AND template" + - Include file/function names: "extractOverview ContextTemplates" for precise code location + - **Search by Intent:** + - Debug: Use exact error messages or symptom descriptions + - Find code: Include function names + file names when known + - Architecture: Search "migration from X to Y" or "refactored X" + - Agent work: Search agent names directly (e.g., "steve-krug-ux") + - **What Doesn't Work:** + - Boolean operators (AND/OR) - treated as literal text + - Timestamp filtering with strings - needs numeric values + - Generic tech terms alone - too broad, add context + - Complex where clauses - only basic operators supported ($eq, $ne, $in) + - **Best Practice:** Semantic search for discovery, metadata filtering for precision. Combine both when possible. +`,Y="";if(R8(_))if(Y=YK(_,"utf8"),Y.includes("")){let $=Y.indexOf(""),O=Y.indexOf("")+33;if($!==-1&&O!==-1)Y=Y.substring(0,$)+K.trim()+Y.substring(O)}else Y=Y.trim()+` +`+K;else Y=K.trim();H_(_,Y)}async function IG(){let q=q9("Installing Chroma MCP server...");q.start();try{await z6(400);try{W_("claude mcp remove claude-mem",{stdio:"pipe"}),await z6(200)}catch{}let _=`${Q2()}/.cargo/bin`;if(R8(_)&&!process.env.PATH?.includes(_))process.env.PATH=`${_}:${process.env.PATH}`;let j=`claude mcp add claude-mem -- uvx chroma-mcp --client-type persistent --data-dir ${_8.getInstance().getChromaDirectory()}`;return W_(j,{stdio:"pipe",env:process.env}),await z6(300),q.stop(H7("Chroma MCP server installed successfully! \uD83D\uDE80"),!0),!0}catch(_){return q.stop("Chroma MCP server installation failed",!1),console.log(k6(e.yellow(`⚠️ Manual installation required: + +${e.cyan(`claude mcp add claude-mem -- uvx chroma-mcp --client-type persistent --data-dir ${_8.getInstance().getChromaDirectory()}`)} + +Make sure uv is installed: ${e.cyan("https://docs.astral.sh/uv/getting-started/installation/")}`),{padding:1,margin:1,borderStyle:"round",borderColor:"yellow"})),!1}}async function gG(q,_){let K=_8.getInstance().getHooksDirectory(),Y=D8(K,"pre-compact.js"),f=D8(K,"session-start.js"),P=D8(K,"session-end.js"),$={};if(R8(q)){let w=YK(q,"utf8");$=JSON.parse(w)}let O=fK(q);if(!R8(O))$K(O,{recursive:!0});if(!$.hooks)$.hooks={};if($.hooks.PreCompact){if($.hooks.PreCompact=$.hooks.PreCompact.filter((w)=>!w.hooks?.some((v)=>v.command?.includes(pq)||v.command?.includes("pre-compact.js"))),!$.hooks.PreCompact.length)delete $.hooks.PreCompact}if($.hooks.SessionStart){if($.hooks.SessionStart=$.hooks.SessionStart.filter((w)=>!w.hooks?.some((v)=>v.command?.includes(pq)||v.command?.includes("session-start.js"))),!$.hooks.SessionStart.length)delete $.hooks.SessionStart}if($.hooks.SessionEnd){if($.hooks.SessionEnd=$.hooks.SessionEnd.filter((w)=>!w.hooks?.some((v)=>v.command?.includes(pq)||v.command?.includes("session-end.js"))),!$.hooks.SessionEnd.length)delete $.hooks.SessionEnd}if(!$.hooks.PreCompact)$.hooks.PreCompact=[];if($.hooks.PreCompact.push({hooks:[{type:"command",command:Y,timeout:180}]}),!$.hooks.SessionStart)$.hooks.SessionStart=[];if($.hooks.SessionStart.push({hooks:[{type:"command",command:f,timeout:180}]}),R8(P)){if(!$.hooks.SessionEnd)$.hooks.SessionEnd=[];$.hooks.SessionEnd.push({hooks:[{type:"command",command:P,timeout:180}]})}H_(q,JSON.stringify($,null,2))}async function yG(){let q=Q2(),_=[D8(q,".bashrc"),D8(q,".zshrc"),D8(q,".bash_profile")],j='alias rm="claude-mem trash"',K="# claude-mem smart trash alias";for(let Y of _){if(!R8(Y))continue;try{let f=YK(Y,"utf8");if(f.includes('alias rm="claude-mem trash"'))continue;f+=` +# claude-mem smart trash alias +alias rm="claude-mem trash" +`,H_(Y,f)}catch(f){}}}function dG(q){let j=new Date().toISOString().replace(/T/,"-").replace(/:/g,"").replace(/\..+/,"").replace(/-/g,""),K=`${j.slice(0,8)}-${j.slice(8)}`;return`${q}.backup.${K}`}function pG(q=!1){let _=_8.getInstance(),j=_.getClaudeCommandsDirectory(),K=ff(import.meta.url),f=fK(K),P=null;for(let z=0;z<10;z++){let W=D8(f,"commands");if(R8(D8(W,"save.md"))){P=W;break}let J=fK(f);if(J===f)break;f=J}if(!P)try{P=_.findPackageCommandsDirectory()}catch(z){throw new Error("Cannot dynamically locate commands directory. The package may be corrupted.")}if(!R8(j))$K(j,{recursive:!0});let $=["save.md","remember.md"],O=[],w=[],v=[];for(let z of $){let W=D8(P,z),J=D8(j,z);if(R8(W))if(R8(J))if(q){let k=dG(J);J_(J,k),J_(W,J),v.push(z)}else w.push(z);else J_(W,J),O.push(z)}if(O.length>0)console.log(` ${e.green("✓")} Copied commands: ${O.join(", ")}`);if(v.length>0)console.log(` ${e.blue("\uD83D\uDCE6")} Backed up and replaced commands: ${v.join(", ")}`);if(w.length>0)console.log(` ${e.yellow("→")} Skipped existing commands: ${w.join(", ")}`)}async function LG(){let q=Y7();q.start("Verifying installation");let _=[],K=_8.getInstance().getHooksDirectory();if(!R8(D8(K,"pre-compact.js")))_.push("Pre-compact hook not found");if(!R8(D8(K,"session-start.js")))_.push("Session-start hook not found");if(_.length>0)q.stop("Installation verification completed with issues"),Q8.warn("The following issues were detected:"),_.forEach((Y)=>Q8.error(` - ${Y}`)),Q8.info("The installation may not work correctly. Consider reinstalling with --force flag.");else q.stop("Installation verified successfully")}async function $f(q={}){console.log(q3(` +═══════════════════════════════════════`)),console.log(q3(" CLAUDE-MEM INSTALLER ")),console.log(q3("═══════════════════════════════════════")),console.log(k6(H7(`\uD83E\uDDE0 Persistent Memory System for Claude Code + +✨ Transform your Claude experience with seamless context preservation +\uD83D\uDE80 Never lose your conversation history again`),{padding:2,margin:1,borderStyle:"double",borderColor:"magenta",textAlignment:"center"})),await z6(500);let _=q.user||q.project||q.local||q.force,j;if(_)j={scope:q.local?"local":q.project?"project":"user",customPath:q.path,hookTimeout:q.timeout?parseInt(q.timeout):180,forceReinstall:!!q.force};else{if(!await MG())qY("Please fix the prerequisites issues and try again"),process.exit(1);let z=NG(),W=await bG(z);if(!W)process.exit(0);j=W}if(j.forceReinstall){let v=await SG();if(v)Q8.info(`Backup created at: ${v}`)}console.log(H7(` +\uD83D\uDE80 Beginning Installation Process +`));let K=[{name:"Creating directory structure",action:async()=>{await z6(200),EG(),await z6(100)}},{name:"Installing Chroma MCP server",action:async()=>{if(!await IG())throw new Error("MCP installation failed")}},{name:"Adding CLAUDE.md instructions",action:async()=>{await z6(300),mG(),await z6(200)}},{name:"Installing Claude commands",action:async()=>{await z6(200),pG(j.forceReinstall),await z6(100)}},{name:"Installing memory hooks",action:async()=>{await z6(400),RG(j.hookTimeout),await z6(200)}},{name:"Configuring Claude settings",action:async()=>{await z6(300);let v;if(j.scope==="local"&&j.customPath)v=D8(j.customPath,"settings.local.json");else if(j.scope==="project")v=D8(process.cwd(),".claude","settings.json");else v=_8.getInstance().getClaudeSettingsPath();await gG(v,j);let W=_8.getInstance().getUserSettingsPath(),J={};if(R8(W))try{J=JSON.parse(YK(W,"utf8"))}catch{}J.backend="chroma",J.installed=!0,J.embedded=!0,J.saveMemoriesOnClear=j.saveMemoriesOnClear||!1;let k=Yf();if(k)J.claudePath=k;else delete J.claudePath;H_(W,JSON.stringify(J,null,2)),await z6(200)}}];if(j.enableSmartTrash)K.push({name:"Configuring Smart Trash alias",action:async()=>{await z6(200),await yG(),await z6(100)}});for(let v=0;v!J.hooks?.some((k)=>k.command===Y||k.command?.includes("pre-compact.js")||k.command?.includes("claude-mem")));if(W.length!==v.hooks.PreCompact.length)v.hooks.PreCompact=W.length?W:void 0,z=!0,console.log(`✅ Removed PreCompact hook from ${O.name} settings`)}if(v.hooks.SessionStart){let W=v.hooks.SessionStart.filter((J)=>!J.hooks?.some((k)=>k.command===f||k.command?.includes("session-start.js")||k.command?.includes("claude-mem")));if(W.length!==v.hooks.SessionStart.length)v.hooks.SessionStart=W.length?W:void 0,z=!0,console.log(`✅ Removed SessionStart hook from ${O.name} settings`)}if(v.hooks.SessionEnd){let W=v.hooks.SessionEnd.filter((J)=>!J.hooks?.some((k)=>k.command===P||k.command?.includes("session-end.js")||k.command?.includes("claude-mem")));if(W.length!==v.hooks.SessionEnd.length)v.hooks.SessionEnd=W.length?W:void 0,z=!0,console.log(`✅ Removed SessionEnd hook from ${O.name} settings`)}if(v.hooks.PreCompact===void 0)delete v.hooks.PreCompact;if(v.hooks.SessionStart===void 0)delete v.hooks.SessionStart;if(v.hooks.SessionEnd===void 0)delete v.hooks.SessionEnd;if(!Object.keys(v.hooks).length)delete v.hooks;if(z){let W=O.path+".backup."+Date.now();wf(W,w),console.log(`\uD83D\uDCCB Created backup: ${W}`),wf(O.path,JSON.stringify(v,null,2)),$++,console.log(`✅ Updated ${O.name} settings: ${O.path}`)}else console.log(`ℹ️ No Claude Memory System hooks found in ${O.name} settings`)}catch(w){console.log(`⚠️ Could not process ${O.name} settings: ${w.message}`)}}if(console.log(""),$>0)console.log("✨ Uninstallation complete!"),console.log("The Claude Memory System hooks have been removed from your settings."),console.log(""),console.log("Note: Your compressed transcripts and archives are preserved."),console.log("To reinstall: claude-mem install");else console.log("ℹ️ No Claude Memory System hooks were found to remove.")}C6();import{readFileSync as K9,existsSync as K3,readdirSync as xG,statSync as cG}from"fs";import{join as T_,dirname as rG}from"path";import{execSync as iG}from"child_process";import{fileURLToPath as oG}from"url";var $N=rG(oG(import.meta.url));async function vf(){console.log("\uD83D\uDD0D Claude Memory System Status Check"),console.log(`===================================== +`),console.log("\uD83D\uDCC2 Installed Hook Scripts:");let q=_8.getInstance(),_=q.getHooksDirectory(),j=T_(_,"pre-compact.js"),K=T_(_,"session-start.js"),Y=T_(_,"session-end.js"),f=(J,k)=>{if(K3(J))console.log(` ✅ ${k}: Found at ${J}`);else console.log(` ❌ ${k}: Not found at ${J}`)};f(j,"pre-compact.js"),f(K,"session-start.js"),f(Y,"session-end.js"),console.log(""),console.log("⚙️ Settings Configuration:");let P=(J,k)=>{if(!K3(k)){console.log(` ⏭️ ${J}: No settings file`);return}console.log(` \uD83D\uDCCB ${J}: ${k}`);try{let H=JSON.parse(K9(k,"utf8")),X=H.hooks?.PreCompact?.some((h)=>h.hooks?.some((V)=>V.command?.includes("pre-compact.js")||V.command?.includes("claude-mem"))),A=H.hooks?.SessionStart?.some((h)=>h.hooks?.some((V)=>V.command?.includes("session-start.js")||V.command?.includes("claude-mem"))),G=H.hooks?.SessionEnd?.some((h)=>h.hooks?.some((V)=>V.command?.includes("session-end.js")||V.command?.includes("claude-mem")));console.log(` PreCompact: ${X?"✅":"❌"}`),console.log(` SessionStart: ${A?"✅":"❌"}`),console.log(` SessionEnd: ${G?"✅":"❌"}`)}catch(H){console.log(" ⚠️ Could not parse settings")}};P("Global",q.getClaudeSettingsPath()),P("Project",T_(process.cwd(),".claude","settings.json")),console.log(""),console.log("\uD83D\uDCE6 Compressed Transcripts:");let $=T_(q.getClaudeConfigDirectory(),"projects");if(K3($))try{let J=0,k=0,H=(X,A=0)=>{if(A>3)return;let G=xG(X);for(let h of G){let V=T_(X,h);if(cG(V).isDirectory()&&!h.startsWith("."))H(V,A+1);else if(h.endsWith(".jsonl.compressed"))J++;else if(h.endsWith(".jsonl.archive"))k++}};H($),console.log(` Compressed files: ${J}`),console.log(` Archive files: ${k}`)}catch(J){console.log(" ⚠️ Could not scan projects directory")}else console.log(" ℹ️ No Claude projects directory found");console.log(""),console.log("\uD83D\uDD27 Runtime Environment:");let O=(J,k)=>{try{let H=iG(`${J} --version`,{encoding:"utf8"}).trim();console.log(` ✅ ${k}: ${H}`)}catch{console.log(` ❌ ${k}: Not found`)}};O("node","Node.js"),O("bun","Bun"),console.log(""),console.log("\uD83E\uDDE0 Chroma Storage Status:"),console.log(" ✅ Storage backend: Chroma MCP"),console.log(` \uD83D\uDCCD Data location: ${q.getChromaDirectory()}`),console.log(" \uD83D\uDD0D Features: Vector search, semantic similarity, document storage"),console.log(""),console.log("\uD83D\uDCCA Summary:");let w=q.getClaudeSettingsPath(),v=T_(process.cwd(),".claude","settings.json"),z=!1,W="Not installed";try{if(K3(w)){let J=JSON.parse(K9(w,"utf8"));if(J.hooks?.PreCompact||J.hooks?.SessionStart||J.hooks?.SessionEnd)z=!0,W="Global"}if(K3(v)){let J=JSON.parse(K9(v,"utf8"));if(J.hooks?.PreCompact||J.hooks?.SessionStart||J.hooks?.SessionEnd)z=!0,W=W==="Global"?"Global + Project":"Project"}}catch{}if(z)console.log(` ✅ Claude Memory System is installed (${W})`),console.log(""),console.log("\uD83D\uDCA1 To test: Use /compact in Claude Code");else console.log(" ❌ Claude Memory System is not installed"),console.log(""),console.log("\uD83D\uDCA1 To install: claude-mem install")}C6();import{readFileSync as aG,readdirSync as BG,statSync as tG}from"fs";import{join as zf}from"path";async function eG(q,_,j){try{let f=aG(q,"utf8").split(` +`).filter((P)=>P.trim()).slice(-j);if(console.log(`\uD83D\uDCCB ${_} Logs (last ${j} lines):`),console.log(` File: ${q}`),console.log(""),f.length===0)console.log(" No log entries found");else f.forEach((P)=>{console.log(` ${P}`)});console.log("")}catch(K){console.log(`❌ Could not read ${_.toLowerCase()} log: ${q}`)}}async function Wf(q={}){let _=_8.getLogsDirectory(),j=parseInt(q.tail)||20;try{let Y=BG(_).filter((f)=>f.startsWith("claude-mem-")&&f.endsWith(".log")).map((f)=>({name:f,path:zf(_,f),mtime:tG(zf(_,f)).mtime})).sort((f,P)=>P.mtime.getTime()-f.mtime.getTime());if(Y.length===0){console.log("❌ No log files found in ~/.claude-mem/logs/");return}if(await eG(Y[0].path,"Most Recent",j),q.all&&Y.length>1)console.log(`\uD83D\uDCDA Found ${Y.length} total log files`)}catch(K){console.log("❌ Could not read logs directory: ~/.claude-mem/logs/"),console.log(" Run a compression first to generate logs")}if(q.follow)console.log("Following logs... (Press Ctrl+C to stop)"),setInterval(()=>{},1000)}j9();import{renameSync as ph,existsSync as w$,mkdirSync as Lh,statSync as lh}from"fs";import{join as nh,basename as xh}from"path";var P9=(q,_,j)=>{let K=q instanceof RegExp?Jf(q,j):q,Y=_ instanceof RegExp?Jf(_,j):_,f=K!==null&&Y!=null&&QG(K,Y,j);return f&&{start:f[0],end:f[1],pre:j.slice(0,f[0]),body:j.slice(f[0]+K.length,f[1]),post:j.slice(f[1]+Y.length)}},Jf=(q,_)=>{let j=_.match(q);return j?j[0]:null},QG=(q,_,j)=>{let K,Y,f,P=void 0,$,O=j.indexOf(q),w=j.indexOf(_,O+1),v=O;if(O>=0&&w>0){if(q===_)return[O,w];K=[],f=j.length;while(v>=0&&!$){if(v===O)K.push(v),O=j.indexOf(q,v+1);else if(K.length===1){let z=K.pop();if(z!==void 0)$=[z,w]}else{if(Y=K.pop(),Y!==void 0&&Y=0?O:w}if(K.length&&P!==void 0)$=[f,P]}return $};var Hf="\x00SLASH"+Math.random()+"\x00",Tf="\x00OPEN"+Math.random()+"\x00",f9="\x00CLOSE"+Math.random()+"\x00",Zf="\x00COMMA"+Math.random()+"\x00",kf="\x00PERIOD"+Math.random()+"\x00",qu=new RegExp(Hf,"g"),_u=new RegExp(Tf,"g"),Ku=new RegExp(f9,"g"),ju=new RegExp(Zf,"g"),Pu=new RegExp(kf,"g"),Yu=/\\\\/g,fu=/\\{/g,$u=/\\}/g,wu=/\\,/g,Ou=/\\./g;function Y9(q){return!isNaN(q)?parseInt(q,10):q.charCodeAt(0)}function vu(q){return q.replace(Yu,Hf).replace(fu,Tf).replace($u,f9).replace(wu,Zf).replace(Ou,kf)}function zu(q){return q.replace(qu,"\\").replace(_u,"{").replace(Ku,"}").replace(ju,",").replace(Pu,".")}function Xf(q){if(!q)return[""];let _=[],j=P9("{","}",q);if(!j)return q.split(",");let{pre:K,body:Y,post:f}=j,P=K.split(",");P[P.length-1]+="{"+Y+"}";let $=Xf(f);if(f.length)P[P.length-1]+=$.shift(),P.push.apply(P,$);return _.push.apply(_,P),_}function Af(q){if(!q)return[];if(q.slice(0,2)==="{}")q="\\{\\}"+q.slice(2);return P3(vu(q),!0).map(zu)}function Wu(q){return"{"+q+"}"}function Ju(q){return/^-?0\d/.test(q)}function Hu(q,_){return q<=_}function Tu(q,_){return q>=_}function P3(q,_){let j=[],K=P9("{","}",q);if(!K)return[q];let Y=K.pre,f=K.post.length?P3(K.post,!1):[""];if(/\$$/.test(K.pre))for(let P=0;P=0;if(!O&&!w){if(K.post.match(/,(?!,).*\}/))return q=K.pre+"{"+K.body+f9+K.post,P3(q);return[q]}let v;if(O)v=K.body.split(/\.\./);else if(v=Xf(K.body),v.length===1&&v[0]!==void 0){if(v=P3(v[0],!1).map(Wu),v.length===1)return f.map((W)=>K.pre+v[0]+W)}let z;if(O&&v[0]!==void 0&&v[1]!==void 0){let W=Y9(v[0]),J=Y9(v[1]),k=Math.max(v[0].length,v[1].length),H=v.length===3&&v[2]!==void 0?Math.abs(Y9(v[2])):1,X=Hu;if(J0){let M=new Array(E+1).join("0");if(h<0)V="-"+M+V.slice(1);else V=M+V}}z.push(V)}}else{z=[];for(let W=0;W{if(typeof q!=="string")throw new TypeError("invalid pattern");if(q.length>65536)throw new TypeError("pattern is too long")};var Zu={"[:alnum:]":["\\p{L}\\p{Nl}\\p{Nd}",!0],"[:alpha:]":["\\p{L}\\p{Nl}",!0],"[:ascii:]":["\\x00-\\x7f",!1],"[:blank:]":["\\p{Zs}\\t",!0],"[:cntrl:]":["\\p{Cc}",!0],"[:digit:]":["\\p{Nd}",!0],"[:graph:]":["\\p{Z}\\p{C}",!0,!0],"[:lower:]":["\\p{Ll}",!0],"[:print:]":["\\p{C}",!0],"[:punct:]":["\\p{P}",!0],"[:space:]":["\\p{Z}\\t\\r\\n\\v\\f",!0],"[:upper:]":["\\p{Lu}",!0],"[:word:]":["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}",!0],"[:xdigit:]":["A-Fa-f0-9",!1]},f3=(q)=>q.replace(/[[\]\\-]/g,"\\$&"),ku=(q)=>q.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),Gf=(q)=>q.join(""),uf=(q,_)=>{let j=_;if(q.charAt(j)!=="[")throw new Error("not in a brace expression");let K=[],Y=[],f=j+1,P=!1,$=!1,O=!1,w=!1,v=j,z="";q:while(fz)K.push(f3(z)+"-"+f3(H));else if(H===z)K.push(f3(H));z="",f++;continue}if(q.startsWith("-]",f+1)){K.push(f3(H+"-")),f+=2;continue}if(q.startsWith("-",f+1)){z=H,f+=2;continue}K.push(f3(H)),f++}if(v{return _?q.replace(/\[([^\/\\])\]/g,"$1"):q.replace(/((?!\\).|^)\[([^\/\\])\]/g,"$1$2").replace(/\\([^\/])/g,"$1")};var Xu=new Set(["!","?","+","*","@"]),hf=(q)=>Xu.has(q),Au="(?!(?:^|/)\\.\\.?(?:$|/))",Z7="(?!\\.)",Gu=new Set(["[","."]),uu=new Set(["..","."]),hu=new Set("().*{}+?[]^$\\!"),Du=(q)=>q.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),$9="[^/]",Df=$9+"*?",Cf=$9+"+?";class W6{type;#q;#_;#Y=!1;#P=[];#f;#G;#X;#v=!1;#$;#W;#z=!1;constructor(q,_,j={}){if(this.type=q,q)this.#_=!0;if(this.#f=_,this.#q=this.#f?this.#f.#q:this,this.#$=this.#q===this?j:this.#q.#$,this.#X=this.#q===this?[]:this.#q.#X,q==="!"&&!this.#q.#v)this.#X.push(this);this.#G=this.#f?this.#f.#P.length:0}get hasMagic(){if(this.#_!==void 0)return this.#_;for(let q of this.#P){if(typeof q==="string")continue;if(q.type||q.hasMagic)return this.#_=!0}return this.#_}toString(){if(this.#W!==void 0)return this.#W;if(!this.type)return this.#W=this.#P.map((q)=>String(q)).join("");else return this.#W=this.type+"("+this.#P.map((q)=>String(q)).join("|")+")"}#w(){if(this!==this.#q)throw new Error("should only call on root");if(this.#v)return this;this.toString(),this.#v=!0;let q;while(q=this.#X.pop()){if(q.type!=="!")continue;let _=q,j=_.#f;while(j){for(let K=_.#G+1;!j.type&&Ktypeof _==="string"?_:_.toJSON()):[this.type,...this.#P.map((_)=>_.toJSON())];if(this.isStart()&&!this.type)q.unshift([]);if(this.isEnd()&&(this===this.#q||this.#q.#v&&this.#f?.type==="!"))q.push({});return q}isStart(){if(this.#q===this)return!0;if(!this.#f?.isStart())return!1;if(this.#G===0)return!0;let q=this.#f;for(let _=0;_{let[J,k,H,X]=typeof W==="string"?W6.#u(W,this.#_,$):W.toRegExpSource(q);return this.#_=this.#_||H,this.#Y=this.#Y||X,J}).join(""),w="";if(this.isStart()){if(typeof this.#P[0]==="string"){if(!(this.#P.length===1&&uu.has(this.#P[0]))){let J=Gu,k=_&&J.has(O.charAt(0))||O.startsWith("\\.")&&J.has(O.charAt(2))||O.startsWith("\\.\\.")&&J.has(O.charAt(4)),H=!_&&!q&&J.has(O.charAt(0));w=k?Au:H?Z7:""}}}let v="";if(this.isEnd()&&this.#q.#v&&this.#f?.type==="!")v="(?:$|\\/)";return[w+O+v,vq(O),this.#_=!!this.#_,this.#Y]}let j=this.type==="*"||this.type==="+",K=this.type==="!"?"(?:(?!(?:":"(?:",Y=this.#H(_);if(this.isStart()&&this.isEnd()&&!Y&&this.type!=="!"){let $=this.toString();return this.#P=[$],this.type=null,this.#_=void 0,[$,vq(this.toString()),!1,!1]}let f=!j||q||_||!Z7?"":this.#H(!0);if(f===Y)f="";if(f)Y=`(?:${Y})(?:${f})*?`;let P="";if(this.type==="!"&&this.#z)P=(this.isStart()&&!_?Z7:"")+Cf;else{let $=this.type==="!"?"))"+(this.isStart()&&!_&&!q?Z7:"")+Df+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&f?")":this.type==="*"&&f?")?":`)${this.type}`;P=K+Y+$}return[P,vq(Y),this.#_=!!this.#_,this.#Y]}#H(q){return this.#P.map((_)=>{if(typeof _==="string")throw new Error("string type in extglob ast??");let[j,K,Y,f]=_.toRegExpSource(q);return this.#Y=this.#Y||f,j}).filter((_)=>!(this.isStart()&&this.isEnd())||!!_).join("|")}static#u(q,_,j=!1){let K=!1,Y="",f=!1;for(let P=0;P{return _?q.replace(/[?*()[\]]/g,"[$&]"):q.replace(/[?*()[\]\\]/g,"\\$&")};var M6=(q,_,j={})=>{if(Y3(_),!j.nocomment&&_.charAt(0)==="#")return!1;return new Q6(_,j).match(q)},Cu=/^\*+([^+@!?\*\[\(]*)$/,Vu=(q)=>(_)=>!_.startsWith(".")&&_.endsWith(q),Mu=(q)=>(_)=>_.endsWith(q),Nu=(q)=>{return q=q.toLowerCase(),(_)=>!_.startsWith(".")&&_.toLowerCase().endsWith(q)},bu=(q)=>{return q=q.toLowerCase(),(_)=>_.toLowerCase().endsWith(q)},Su=/^\*+\.\*+$/,Eu=(q)=>!q.startsWith(".")&&q.includes("."),Ru=(q)=>q!=="."&&q!==".."&&q.includes("."),mu=/^\.\*+$/,Iu=(q)=>q!=="."&&q!==".."&&q.startsWith("."),gu=/^\*+$/,yu=(q)=>q.length!==0&&!q.startsWith("."),du=(q)=>q.length!==0&&q!=="."&&q!=="..",pu=/^\?+([^+@!?\*\[\(]*)?$/,Lu=([q,_=""])=>{let j=Nf([q]);if(!_)return j;return _=_.toLowerCase(),(K)=>j(K)&&K.toLowerCase().endsWith(_)},lu=([q,_=""])=>{let j=bf([q]);if(!_)return j;return _=_.toLowerCase(),(K)=>j(K)&&K.toLowerCase().endsWith(_)},nu=([q,_=""])=>{let j=bf([q]);return!_?j:(K)=>j(K)&&K.endsWith(_)},xu=([q,_=""])=>{let j=Nf([q]);return!_?j:(K)=>j(K)&&K.endsWith(_)},Nf=([q])=>{let _=q.length;return(j)=>j.length===_&&!j.startsWith(".")},bf=([q])=>{let _=q.length;return(j)=>j.length===_&&j!=="."&&j!==".."},Sf=typeof process==="object"&&process?typeof process.env==="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",Vf={win32:{sep:"\\"},posix:{sep:"/"}},cu=Sf==="win32"?Vf.win32.sep:Vf.posix.sep;M6.sep=cu;var J6=Symbol("globstar **");M6.GLOBSTAR=J6;var ru="[^/]",iu=ru+"*?",ou="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",au="(?:(?!(?:\\/|^)\\.).)*?",Bu=(q,_={})=>(j)=>M6(j,q,_);M6.filter=Bu;var s6=(q,_={})=>Object.assign({},q,_),tu=(q)=>{if(!q||typeof q!=="object"||!Object.keys(q).length)return M6;let _=M6;return Object.assign((K,Y,f={})=>_(K,Y,s6(q,f)),{Minimatch:class K extends _.Minimatch{constructor(Y,f={}){super(Y,s6(q,f))}static defaults(Y){return _.defaults(s6(q,Y)).Minimatch}},AST:class K extends _.AST{constructor(Y,f,P={}){super(Y,f,s6(q,P))}static fromGlob(Y,f={}){return _.AST.fromGlob(Y,s6(q,f))}},unescape:(K,Y={})=>_.unescape(K,s6(q,Y)),escape:(K,Y={})=>_.escape(K,s6(q,Y)),filter:(K,Y={})=>_.filter(K,s6(q,Y)),defaults:(K)=>_.defaults(s6(q,K)),makeRe:(K,Y={})=>_.makeRe(K,s6(q,Y)),braceExpand:(K,Y={})=>_.braceExpand(K,s6(q,Y)),match:(K,Y,f={})=>_.match(K,Y,s6(q,f)),sep:_.sep,GLOBSTAR:J6})};M6.defaults=tu;var Ef=(q,_={})=>{if(Y3(q),_.nobrace||!/\{(?:(?!\{).)*\}/.test(q))return[q];return Af(q)};M6.braceExpand=Ef;var eu=(q,_={})=>new Q6(q,_).makeRe();M6.makeRe=eu;var Fu=(q,_,j={})=>{let K=new Q6(_,j);if(q=q.filter((Y)=>K.match(Y)),K.options.nonull&&!q.length)q.push(_);return q};M6.match=Fu;var Mf=/[?*]|[+@!]\(.*?\)|\[|\]/,Uu=(q)=>q.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&");class Q6{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;regexp;constructor(q,_={}){if(Y3(q),_=_||{},this.options=_,this.pattern=q,this.platform=_.platform||Sf,this.isWindows=this.platform==="win32",this.windowsPathsNoEscape=!!_.windowsPathsNoEscape||_.allowWindowsEscape===!1,this.windowsPathsNoEscape)this.pattern=this.pattern.replace(/\\/g,"/");this.preserveMultipleSlashes=!!_.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!_.nonegate,this.comment=!1,this.empty=!1,this.partial=!!_.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=_.windowsNoMagicRoot!==void 0?_.windowsNoMagicRoot:!!(this.isWindows&&this.nocase),this.globSet=[],this.globParts=[],this.set=[],this.make()}hasMagic(){if(this.options.magicalBraces&&this.set.length>1)return!0;for(let q of this.set)for(let _ of q)if(typeof _!=="string")return!0;return!1}debug(...q){}make(){let q=this.pattern,_=this.options;if(!_.nocomment&&q.charAt(0)==="#"){this.comment=!0;return}if(!q){this.empty=!0;return}if(this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],_.debug)this.debug=(...Y)=>console.error(...Y);this.debug(this.pattern,this.globSet);let j=this.globSet.map((Y)=>this.slashSplit(Y));this.globParts=this.preprocess(j),this.debug(this.pattern,this.globParts);let K=this.globParts.map((Y,f,P)=>{if(this.isWindows&&this.windowsNoMagicRoot){let $=Y[0]===""&&Y[1]===""&&(Y[2]==="?"||!Mf.test(Y[2]))&&!Mf.test(Y[3]),O=/^[a-z]:/i.test(Y[0]);if($)return[...Y.slice(0,4),...Y.slice(4).map((w)=>this.parse(w))];else if(O)return[Y[0],...Y.slice(1).map((w)=>this.parse(w))]}return Y.map(($)=>this.parse($))});if(this.debug(this.pattern,K),this.set=K.filter((Y)=>Y.indexOf(!1)===-1),this.isWindows)for(let Y=0;Y=2)q=this.firstPhasePreProcess(q),q=this.secondPhasePreProcess(q);else if(_>=1)q=this.levelOneOptimize(q);else q=this.adjascentGlobstarOptimize(q);return q}adjascentGlobstarOptimize(q){return q.map((_)=>{let j=-1;while((j=_.indexOf("**",j+1))!==-1){let K=j;while(_[K+1]==="**")K++;if(K!==j)_.splice(j,K-j)}return _})}levelOneOptimize(q){return q.map((_)=>{return _=_.reduce((j,K)=>{let Y=j[j.length-1];if(K==="**"&&Y==="**")return j;if(K===".."){if(Y&&Y!==".."&&Y!=="."&&Y!=="**")return j.pop(),j}return j.push(K),j},[]),_.length===0?[""]:_})}levelTwoFileOptimize(q){if(!Array.isArray(q))q=this.slashSplit(q);let _=!1;do{if(_=!1,!this.preserveMultipleSlashes){for(let K=1;KK)j.splice(K+1,f-K);let P=j[K+1],$=j[K+2],O=j[K+3];if(P!=="..")continue;if(!$||$==="."||$===".."||!O||O==="."||O==="..")continue;_=!0,j.splice(K,1);let w=j.slice(0);w[K]="**",q.push(w),K--}if(!this.preserveMultipleSlashes){for(let f=1;f_.length)}partsMatch(q,_,j=!1){let K=0,Y=0,f=[],P="";while(KG)_=_.slice(h);else if(G>h)q=q.slice(G)}}}let{optimizationLevel:Y=1}=this.options;if(Y>=2)q=this.levelTwoFileOptimize(q);this.debug("matchOne",this,{file:q,pattern:_}),this.debug("matchOne",q.length,_.length);for(var f=0,P=0,$=q.length,O=_.length;f<$&&P>> no match, partial?`,q,z,_,W),z===$)return!0}return!1}let k;if(typeof w==="string")k=v===w,this.debug("string match",w,v,k);else k=w.test(v),this.debug("pattern match",w,v,k);if(!k)return!1}if(f===$&&P===O)return!0;else if(f===$)return j;else if(P===O)return f===$-1&&q[f]==="";else throw new Error("wtf?")}braceExpand(){return Ef(this.pattern,this.options)}parse(q){Y3(q);let _=this.options;if(q==="**")return J6;if(q==="")return"";let j,K=null;if(j=q.match(gu))K=_.dot?du:yu;else if(j=q.match(Cu))K=(_.nocase?_.dot?bu:Nu:_.dot?Mu:Vu)(j[1]);else if(j=q.match(pu))K=(_.nocase?_.dot?lu:Lu:_.dot?nu:xu)(j);else if(j=q.match(Su))K=_.dot?Ru:Eu;else if(j=q.match(mu))K=Iu;let Y=W6.fromGlob(q,this.options).toMMPattern();if(K&&typeof Y==="object")Reflect.defineProperty(Y,"test",{value:K});return Y}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let q=this.set;if(!q.length)return this.regexp=!1,this.regexp;let _=this.options,j=_.noglobstar?iu:_.dot?ou:au,K=new Set(_.nocase?["i"]:[]),Y=q.map(($)=>{let O=$.map((w)=>{if(w instanceof RegExp)for(let v of w.flags.split(""))K.add(v);return typeof w==="string"?Uu(w):w===J6?J6:w._src});return O.forEach((w,v)=>{let z=O[v+1],W=O[v-1];if(w!==J6||W===J6)return;if(W===void 0)if(z!==void 0&&z!==J6)O[v+1]="(?:\\/|"+j+"\\/)?"+z;else O[v]=j;else if(z===void 0)O[v-1]=W+"(?:\\/|"+j+")?";else if(z!==J6)O[v-1]=W+"(?:\\/|\\/"+j+"\\/)"+z,O[v+1]=J6}),O.filter((w)=>w!==J6).join("/")}).join("|"),[f,P]=q.length>1?["(?:",")"]:["",""];if(Y="^"+f+Y+P+"$",this.negate)Y="^(?!"+Y+").+$";try{this.regexp=new RegExp(Y,[...K].join(""))}catch($){this.regexp=!1}return this.regexp}slashSplit(q){if(this.preserveMultipleSlashes)return q.split("/");else if(this.isWindows&&/^\/\/[^\/]+/.test(q))return["",...q.split(/\/+/)];else return q.split(/\/+/)}match(q,_=this.partial){if(this.debug("match",q,this.pattern),this.comment)return!1;if(this.empty)return q==="";if(q==="/"&&_)return!0;let j=this.options;if(this.isWindows)q=q.split("\\").join("/");let K=this.slashSplit(q);this.debug(this.pattern,"split",K);let Y=this.set;this.debug(this.pattern,"set",Y);let f=K[K.length-1];if(!f)for(let P=K.length-2;!f&&P>=0;P--)f=K[P];for(let P=0;P{typeof w9.emitWarning==="function"?w9.emitWarning(q,_,j,K):console.error(`[${j}] ${_}: ${q}`)},k7=globalThis.AbortController,Rf=globalThis.AbortSignal;if(typeof k7==="undefined"){Rf=class j{onabort;_onabort=[];reason;aborted=!1;addEventListener(K,Y){this._onabort.push(Y)}},k7=class j{constructor(){_()}signal=new Rf;abort(K){if(this.signal.aborted)return;this.signal.reason=K,this.signal.aborted=!0;for(let Y of this.signal._onabort)Y(K);this.signal.onabort?.(K)}};let q=w9.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",_=()=>{if(!q)return;q=!1,If("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",_)}}var Qu=(q)=>!mf.has(q),LN=Symbol("type"),Bq=(q)=>q&&q===Math.floor(q)&&q>0&&isFinite(q),gf=(q)=>!Bq(q)?null:q<=Math.pow(2,8)?Uint8Array:q<=Math.pow(2,16)?Uint16Array:q<=Math.pow(2,32)?Uint32Array:q<=Number.MAX_SAFE_INTEGER?$3:null;class $3 extends Array{constructor(q){super(q);this.fill(0)}}class OK{heap;length;static#q=!1;static create(q){let _=gf(q);if(!_)return[];OK.#q=!0;let j=new OK(q,_);return OK.#q=!1,j}constructor(q,_){if(!OK.#q)throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new _(q),this.length=0}push(q){this.heap[this.length++]=q}pop(){return this.heap[--this.length]}}class w3{#q;#_;#Y;#P;#f;#G;#X;#v;get perf(){return this.#v}ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#$;#W;#z;#w;#K;#H;#u;#A;#T;#b;#Z;#D;#M;#k;#h;#N;#J;#j;static unsafeExposeInternals(q){return{starts:q.#M,ttls:q.#k,sizes:q.#D,keyMap:q.#z,keyList:q.#w,valList:q.#K,next:q.#H,prev:q.#u,get head(){return q.#A},get tail(){return q.#T},free:q.#b,isBackgroundFetch:(_)=>q.#O(_),backgroundFetch:(_,j,K,Y)=>q.#r(_,j,K,Y),moveToTail:(_)=>q.#p(_),indexes:(_)=>q.#E(_),rindexes:(_)=>q.#m(_),isStale:(_)=>q.#V(_)}}get max(){return this.#q}get maxSize(){return this.#_}get calculatedSize(){return this.#W}get size(){return this.#$}get fetchMethod(){return this.#G}get memoMethod(){return this.#X}get dispose(){return this.#Y}get onInsert(){return this.#P}get disposeAfter(){return this.#f}constructor(q){let{max:_=0,ttl:j,ttlResolution:K=1,ttlAutopurge:Y,updateAgeOnGet:f,updateAgeOnHas:P,allowStale:$,dispose:O,onInsert:w,disposeAfter:v,noDisposeOnSet:z,noUpdateTTL:W,maxSize:J=0,maxEntrySize:k=0,sizeCalculation:H,fetchMethod:X,memoMethod:A,noDeleteOnFetchRejection:G,noDeleteOnStaleGet:h,allowStaleOnFetchRejection:V,allowStaleOnFetchAbort:E,ignoreFetchAbort:M,perf:b}=q;if(b!==void 0){if(typeof b?.now!=="function")throw new TypeError("perf option must have a now() method if specified")}if(this.#v=b??su,_!==0&&!Bq(_))throw new TypeError("max option must be a nonnegative integer");let g=_?gf(_):Array;if(!g)throw new Error("invalid max value: "+_);if(this.#q=_,this.#_=J,this.maxEntrySize=k||this.#_,this.sizeCalculation=H,this.sizeCalculation){if(!this.#_&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!=="function")throw new TypeError("sizeCalculation set to non-function")}if(A!==void 0&&typeof A!=="function")throw new TypeError("memoMethod must be a function if defined");if(this.#X=A,X!==void 0&&typeof X!=="function")throw new TypeError("fetchMethod must be a function if specified");if(this.#G=X,this.#N=!!X,this.#z=new Map,this.#w=new Array(_).fill(void 0),this.#K=new Array(_).fill(void 0),this.#H=new g(_),this.#u=new g(_),this.#A=0,this.#T=0,this.#b=OK.create(_),this.#$=0,this.#W=0,typeof O==="function")this.#Y=O;if(typeof w==="function")this.#P=w;if(typeof v==="function")this.#f=v,this.#Z=[];else this.#f=void 0,this.#Z=void 0;if(this.#h=!!this.#Y,this.#j=!!this.#P,this.#J=!!this.#f,this.noDisposeOnSet=!!z,this.noUpdateTTL=!!W,this.noDeleteOnFetchRejection=!!G,this.allowStaleOnFetchRejection=!!V,this.allowStaleOnFetchAbort=!!E,this.ignoreFetchAbort=!!M,this.maxEntrySize!==0){if(this.#_!==0){if(!Bq(this.#_))throw new TypeError("maxSize must be a positive integer if specified")}if(!Bq(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#L()}if(this.allowStale=!!$,this.noDeleteOnStaleGet=!!h,this.updateAgeOnGet=!!f,this.updateAgeOnHas=!!P,this.ttlResolution=Bq(K)||K===0?K:1,this.ttlAutopurge=!!Y,this.ttl=j||0,this.ttl){if(!Bq(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#I()}if(this.#q===0&&this.ttl===0&&this.#_===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#q&&!this.#_){if(Qu("LRU_CACHE_UNBOUNDED"))mf.add("LRU_CACHE_UNBOUNDED"),If("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning","LRU_CACHE_UNBOUNDED",w3)}}getRemainingTTL(q){return this.#z.has(q)?1/0:0}#I(){let q=new $3(this.#q),_=new $3(this.#q);this.#k=q,this.#M=_,this.#x=(Y,f,P=this.#v.now())=>{if(_[Y]=f!==0?P:0,q[Y]=f,f!==0&&this.ttlAutopurge){let $=setTimeout(()=>{if(this.#V(Y))this.#R(this.#w[Y],"expire")},f+1);if($.unref)$.unref()}},this.#S=(Y)=>{_[Y]=q[Y]!==0?this.#v.now():0},this.#C=(Y,f)=>{if(q[f]){let P=q[f],$=_[f];if(!P||!$)return;Y.ttl=P,Y.start=$,Y.now=j||K();let O=Y.now-$;Y.remainingTTL=P-O}};let j=0,K=()=>{let Y=this.#v.now();if(this.ttlResolution>0){j=Y;let f=setTimeout(()=>j=0,this.ttlResolution);if(f.unref)f.unref()}return Y};this.getRemainingTTL=(Y)=>{let f=this.#z.get(Y);if(f===void 0)return 0;let P=q[f],$=_[f];if(!P||!$)return 1/0;let O=(j||K())-$;return P-O},this.#V=(Y)=>{let f=_[Y],P=q[Y];return!!P&&!!f&&(j||K())-f>P}}#S=()=>{};#C=()=>{};#x=()=>{};#V=()=>!1;#L(){let q=new $3(this.#q);this.#W=0,this.#D=q,this.#g=(_)=>{this.#W-=q[_],q[_]=0},this.#y=(_,j,K,Y)=>{if(this.#O(j))return 0;if(!Bq(K))if(Y){if(typeof Y!=="function")throw new TypeError("sizeCalculation must be a function");if(K=Y(j,_),!Bq(K))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return K},this.#l=(_,j,K)=>{if(q[_]=j,this.#_){let Y=this.#_-q[_];while(this.#W>Y)this.#d(!0)}if(this.#W+=q[_],K)K.entrySize=j,K.totalCalculatedSize=this.#W}}#g=(q)=>{};#l=(q,_,j)=>{};#y=(q,_,j,K)=>{if(j||K)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#E({allowStale:q=this.allowStale}={}){if(this.#$)for(let _=this.#T;;){if(!this.#c(_))break;if(q||!this.#V(_))yield _;if(_===this.#A)break;else _=this.#u[_]}}*#m({allowStale:q=this.allowStale}={}){if(this.#$)for(let _=this.#A;;){if(!this.#c(_))break;if(q||!this.#V(_))yield _;if(_===this.#T)break;else _=this.#H[_]}}#c(q){return q!==void 0&&this.#z.get(this.#w[q])===q}*entries(){for(let q of this.#E())if(this.#K[q]!==void 0&&this.#w[q]!==void 0&&!this.#O(this.#K[q]))yield[this.#w[q],this.#K[q]]}*rentries(){for(let q of this.#m())if(this.#K[q]!==void 0&&this.#w[q]!==void 0&&!this.#O(this.#K[q]))yield[this.#w[q],this.#K[q]]}*keys(){for(let q of this.#E()){let _=this.#w[q];if(_!==void 0&&!this.#O(this.#K[q]))yield _}}*rkeys(){for(let q of this.#m()){let _=this.#w[q];if(_!==void 0&&!this.#O(this.#K[q]))yield _}}*values(){for(let q of this.#E())if(this.#K[q]!==void 0&&!this.#O(this.#K[q]))yield this.#K[q]}*rvalues(){for(let q of this.#m())if(this.#K[q]!==void 0&&!this.#O(this.#K[q]))yield this.#K[q]}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(q,_={}){for(let j of this.#E()){let K=this.#K[j],Y=this.#O(K)?K.__staleWhileFetching:K;if(Y===void 0)continue;if(q(Y,this.#w[j],this))return this.get(this.#w[j],_)}}forEach(q,_=this){for(let j of this.#E()){let K=this.#K[j],Y=this.#O(K)?K.__staleWhileFetching:K;if(Y===void 0)continue;q.call(_,Y,this.#w[j],this)}}rforEach(q,_=this){for(let j of this.#m()){let K=this.#K[j],Y=this.#O(K)?K.__staleWhileFetching:K;if(Y===void 0)continue;q.call(_,Y,this.#w[j],this)}}purgeStale(){let q=!1;for(let _ of this.#m({allowStale:!0}))if(this.#V(_))this.#R(this.#w[_],"expire"),q=!0;return q}info(q){let _=this.#z.get(q);if(_===void 0)return;let j=this.#K[_],K=this.#O(j)?j.__staleWhileFetching:j;if(K===void 0)return;let Y={value:K};if(this.#k&&this.#M){let f=this.#k[_],P=this.#M[_];if(f&&P){let $=f-(this.#v.now()-P);Y.ttl=$,Y.start=Date.now()}}if(this.#D)Y.size=this.#D[_];return Y}dump(){let q=[];for(let _ of this.#E({allowStale:!0})){let j=this.#w[_],K=this.#K[_],Y=this.#O(K)?K.__staleWhileFetching:K;if(Y===void 0||j===void 0)continue;let f={value:Y};if(this.#k&&this.#M){f.ttl=this.#k[_];let P=this.#v.now()-this.#M[_];f.start=Math.floor(Date.now()-P)}if(this.#D)f.size=this.#D[_];q.unshift([j,f])}return q}load(q){this.clear();for(let[_,j]of q){if(j.start){let K=Date.now()-j.start;j.start=this.#v.now()-K}this.set(_,j.value,j)}}set(q,_,j={}){if(_===void 0)return this.delete(q),this;let{ttl:K=this.ttl,start:Y,noDisposeOnSet:f=this.noDisposeOnSet,sizeCalculation:P=this.sizeCalculation,status:$}=j,{noUpdateTTL:O=this.noUpdateTTL}=j,w=this.#y(q,_,j.size||0,P);if(this.maxEntrySize&&w>this.maxEntrySize){if($)$.set="miss",$.maxEntrySizeExceeded=!0;return this.#R(q,"set"),this}let v=this.#$===0?void 0:this.#z.get(q);if(v===void 0){if(v=this.#$===0?this.#T:this.#b.length!==0?this.#b.pop():this.#$===this.#q?this.#d(!1):this.#$,this.#w[v]=q,this.#K[v]=_,this.#z.set(q,v),this.#H[this.#T]=v,this.#u[v]=this.#T,this.#T=v,this.#$++,this.#l(v,w,$),$)$.set="add";if(O=!1,this.#j)this.#P?.(_,q,"add")}else{this.#p(v);let z=this.#K[v];if(_!==z){if(this.#N&&this.#O(z)){z.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:W}=z;if(W!==void 0&&!f){if(this.#h)this.#Y?.(W,q,"set");if(this.#J)this.#Z?.push([W,q,"set"])}}else if(!f){if(this.#h)this.#Y?.(z,q,"set");if(this.#J)this.#Z?.push([z,q,"set"])}if(this.#g(v),this.#l(v,w,$),this.#K[v]=_,$){$.set="replace";let W=z&&this.#O(z)?z.__staleWhileFetching:z;if(W!==void 0)$.oldValue=W}}else if($)$.set="update";if(this.#j)this.onInsert?.(_,q,_===z?"update":"replace")}if(K!==0&&!this.#k)this.#I();if(this.#k){if(!O)this.#x(v,K,Y);if($)this.#C($,v)}if(!f&&this.#J&&this.#Z){let z=this.#Z,W;while(W=z?.shift())this.#f?.(...W)}return this}pop(){try{while(this.#$){let q=this.#K[this.#A];if(this.#d(!0),this.#O(q)){if(q.__staleWhileFetching)return q.__staleWhileFetching}else if(q!==void 0)return q}}finally{if(this.#J&&this.#Z){let q=this.#Z,_;while(_=q?.shift())this.#f?.(..._)}}}#d(q){let _=this.#A,j=this.#w[_],K=this.#K[_];if(this.#N&&this.#O(K))K.__abortController.abort(new Error("evicted"));else if(this.#h||this.#J){if(this.#h)this.#Y?.(K,j,"evict");if(this.#J)this.#Z?.push([K,j,"evict"])}if(this.#g(_),q)this.#w[_]=void 0,this.#K[_]=void 0,this.#b.push(_);if(this.#$===1)this.#A=this.#T=0,this.#b.length=0;else this.#A=this.#H[_];return this.#z.delete(j),this.#$--,_}has(q,_={}){let{updateAgeOnHas:j=this.updateAgeOnHas,status:K}=_,Y=this.#z.get(q);if(Y!==void 0){let f=this.#K[Y];if(this.#O(f)&&f.__staleWhileFetching===void 0)return!1;if(!this.#V(Y)){if(j)this.#S(Y);if(K)K.has="hit",this.#C(K,Y);return!0}else if(K)K.has="stale",this.#C(K,Y)}else if(K)K.has="miss";return!1}peek(q,_={}){let{allowStale:j=this.allowStale}=_,K=this.#z.get(q);if(K===void 0||!j&&this.#V(K))return;let Y=this.#K[K];return this.#O(Y)?Y.__staleWhileFetching:Y}#r(q,_,j,K){let Y=_===void 0?void 0:this.#K[_];if(this.#O(Y))return Y;let f=new k7,{signal:P}=j;P?.addEventListener("abort",()=>f.abort(P.reason),{signal:f.signal});let $={signal:f.signal,options:j,context:K},O=(k,H=!1)=>{let{aborted:X}=f.signal,A=j.ignoreFetchAbort&&k!==void 0;if(j.status)if(X&&!H){if(j.status.fetchAborted=!0,j.status.fetchError=f.signal.reason,A)j.status.fetchAbortIgnored=!0}else j.status.fetchResolved=!0;if(X&&!A&&!H)return v(f.signal.reason);let G=W;if(this.#K[_]===W)if(k===void 0)if(G.__staleWhileFetching!==void 0)this.#K[_]=G.__staleWhileFetching;else this.#R(q,"fetch");else{if(j.status)j.status.fetchUpdated=!0;this.set(q,k,$.options)}return k},w=(k)=>{if(j.status)j.status.fetchRejected=!0,j.status.fetchError=k;return v(k)},v=(k)=>{let{aborted:H}=f.signal,X=H&&j.allowStaleOnFetchAbort,A=X||j.allowStaleOnFetchRejection,G=A||j.noDeleteOnFetchRejection,h=W;if(this.#K[_]===W){if(!G||h.__staleWhileFetching===void 0)this.#R(q,"fetch");else if(!X)this.#K[_]=h.__staleWhileFetching}if(A){if(j.status&&h.__staleWhileFetching!==void 0)j.status.returnedStale=!0;return h.__staleWhileFetching}else if(h.__returned===h)throw k},z=(k,H)=>{let X=this.#G?.(q,Y,$);if(X&&X instanceof Promise)X.then((A)=>k(A===void 0?void 0:A),H);f.signal.addEventListener("abort",()=>{if(!j.ignoreFetchAbort||j.allowStaleOnFetchAbort){if(k(void 0),j.allowStaleOnFetchAbort)k=(A)=>O(A,!0)}})};if(j.status)j.status.fetchDispatched=!0;let W=new Promise(z).then(O,w),J=Object.assign(W,{__abortController:f,__staleWhileFetching:Y,__returned:void 0});if(_===void 0)this.set(q,J,{...$.options,status:void 0}),_=this.#z.get(q);else this.#K[_]=J;return J}#O(q){if(!this.#N)return!1;let _=q;return!!_&&_ instanceof Promise&&_.hasOwnProperty("__staleWhileFetching")&&_.__abortController instanceof k7}async fetch(q,_={}){let{allowStale:j=this.allowStale,updateAgeOnGet:K=this.updateAgeOnGet,noDeleteOnStaleGet:Y=this.noDeleteOnStaleGet,ttl:f=this.ttl,noDisposeOnSet:P=this.noDisposeOnSet,size:$=0,sizeCalculation:O=this.sizeCalculation,noUpdateTTL:w=this.noUpdateTTL,noDeleteOnFetchRejection:v=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:z=this.allowStaleOnFetchRejection,ignoreFetchAbort:W=this.ignoreFetchAbort,allowStaleOnFetchAbort:J=this.allowStaleOnFetchAbort,context:k,forceRefresh:H=!1,status:X,signal:A}=_;if(!this.#N){if(X)X.fetch="get";return this.get(q,{allowStale:j,updateAgeOnGet:K,noDeleteOnStaleGet:Y,status:X})}let G={allowStale:j,updateAgeOnGet:K,noDeleteOnStaleGet:Y,ttl:f,noDisposeOnSet:P,size:$,sizeCalculation:O,noUpdateTTL:w,noDeleteOnFetchRejection:v,allowStaleOnFetchRejection:z,allowStaleOnFetchAbort:J,ignoreFetchAbort:W,status:X,signal:A},h=this.#z.get(q);if(h===void 0){if(X)X.fetch="miss";let V=this.#r(q,h,G,k);return V.__returned=V}else{let V=this.#K[h];if(this.#O(V)){let y=j&&V.__staleWhileFetching!==void 0;if(X){if(X.fetch="inflight",y)X.returnedStale=!0}return y?V.__staleWhileFetching:V.__returned=V}let E=this.#V(h);if(!H&&!E){if(X)X.fetch="hit";if(this.#p(h),K)this.#S(h);if(X)this.#C(X,h);return V}let M=this.#r(q,h,G,k),g=M.__staleWhileFetching!==void 0&&j;if(X){if(X.fetch=E?"stale":"refresh",g&&E)X.returnedStale=!0}return g?M.__staleWhileFetching:M.__returned=M}}async forceFetch(q,_={}){let j=await this.fetch(q,_);if(j===void 0)throw new Error("fetch() returned undefined");return j}memo(q,_={}){let j=this.#X;if(!j)throw new Error("no memoMethod provided to constructor");let{context:K,forceRefresh:Y,...f}=_,P=this.get(q,f);if(!Y&&P!==void 0)return P;let $=j(q,P,{options:f,context:K});return this.set(q,$,f),$}get(q,_={}){let{allowStale:j=this.allowStale,updateAgeOnGet:K=this.updateAgeOnGet,noDeleteOnStaleGet:Y=this.noDeleteOnStaleGet,status:f}=_,P=this.#z.get(q);if(P!==void 0){let $=this.#K[P],O=this.#O($);if(f)this.#C(f,P);if(this.#V(P)){if(f)f.get="stale";if(!O){if(!Y)this.#R(q,"expire");if(f&&j)f.returnedStale=!0;return j?$:void 0}else{if(f&&j&&$.__staleWhileFetching!==void 0)f.returnedStale=!0;return j?$.__staleWhileFetching:void 0}}else{if(f)f.get="hit";if(O)return $.__staleWhileFetching;if(this.#p(P),K)this.#S(P);return $}}else if(f)f.get="miss"}#i(q,_){this.#u[_]=q,this.#H[q]=_}#p(q){if(q!==this.#T){if(q===this.#A)this.#A=this.#H[q];else this.#i(this.#u[q],this.#H[q]);this.#i(this.#T,q),this.#T=q}}delete(q){return this.#R(q,"delete")}#R(q,_){let j=!1;if(this.#$!==0){let K=this.#z.get(q);if(K!==void 0)if(j=!0,this.#$===1)this.#n(_);else{this.#g(K);let Y=this.#K[K];if(this.#O(Y))Y.__abortController.abort(new Error("deleted"));else if(this.#h||this.#J){if(this.#h)this.#Y?.(Y,q,_);if(this.#J)this.#Z?.push([Y,q,_])}if(this.#z.delete(q),this.#w[K]=void 0,this.#K[K]=void 0,K===this.#T)this.#T=this.#u[K];else if(K===this.#A)this.#A=this.#H[K];else{let f=this.#u[K];this.#H[f]=this.#H[K];let P=this.#H[K];this.#u[P]=this.#u[K]}this.#$--,this.#b.push(K)}}if(this.#J&&this.#Z?.length){let K=this.#Z,Y;while(Y=K?.shift())this.#f?.(...Y)}return j}clear(){return this.#n("delete")}#n(q){for(let _ of this.#m({allowStale:!0})){let j=this.#K[_];if(this.#O(j))j.__abortController.abort(new Error("deleted"));else{let K=this.#w[_];if(this.#h)this.#Y?.(j,K,q);if(this.#J)this.#Z?.push([j,K,q])}}if(this.#z.clear(),this.#K.fill(void 0),this.#w.fill(void 0),this.#k&&this.#M)this.#k.fill(0),this.#M.fill(0);if(this.#D)this.#D.fill(0);if(this.#A=0,this.#T=0,this.#b.length=0,this.#W=0,this.#$=0,this.#J&&this.#Z){let _=this.#Z,j;while(j=_?.shift())this.#f?.(...j)}}}import{posix as vh,win32 as X9}from"node:path";import{fileURLToPath as zh}from"node:url";import{lstatSync as Wh,readdir as Jh,readdirSync as Hh,readlinkSync as Th,realpathSync as Zh}from"fs";import*as kh from"node:fs";import{lstat as Ah,readdir as Gh,readlink as uh,realpath as hh}from"node:fs/promises";import{EventEmitter as H9}from"node:events";import lf from"node:stream";import{StringDecoder as qh}from"node:string_decoder";var yf=typeof process==="object"&&process?process:{stdout:null,stderr:null},_h=(q)=>!!q&&typeof q==="object"&&(q instanceof k_||q instanceof lf||Kh(q)||jh(q)),Kh=(q)=>!!q&&typeof q==="object"&&q instanceof H9&&typeof q.pipe==="function"&&q.pipe!==lf.Writable.prototype.pipe,jh=(q)=>!!q&&typeof q==="object"&&q instanceof H9&&typeof q.write==="function"&&typeof q.end==="function",yq=Symbol("EOF"),dq=Symbol("maybeEmitEnd"),tq=Symbol("emittedEnd"),X7=Symbol("emittingEnd"),O3=Symbol("emittedError"),A7=Symbol("closed"),df=Symbol("read"),G7=Symbol("flush"),pf=Symbol("flushChunk"),zq=Symbol("encoding"),vK=Symbol("decoder"),f6=Symbol("flowing"),v3=Symbol("paused"),zK=Symbol("resume"),$6=Symbol("buffer"),N6=Symbol("pipes"),w6=Symbol("bufferLength"),O9=Symbol("bufferPush"),u7=Symbol("bufferShift"),X6=Symbol("objectMode"),e8=Symbol("destroyed"),v9=Symbol("error"),z9=Symbol("emitData"),Lf=Symbol("emitEnd"),W9=Symbol("emitEnd2"),Aq=Symbol("async"),J9=Symbol("abort"),h7=Symbol("aborted"),z3=Symbol("signal"),Z_=Symbol("dataListeners"),x6=Symbol("discarded"),W3=(q)=>Promise.resolve().then(q),Ph=(q)=>q(),Yh=(q)=>q==="end"||q==="finish"||q==="prefinish",fh=(q)=>q instanceof ArrayBuffer||!!q&&typeof q==="object"&&q.constructor&&q.constructor.name==="ArrayBuffer"&&q.byteLength>=0,$h=(q)=>!Buffer.isBuffer(q)&&ArrayBuffer.isView(q);class T9{src;dest;opts;ondrain;constructor(q,_,j){this.src=q,this.dest=_,this.opts=j,this.ondrain=()=>q[zK](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(q){}end(){if(this.unpipe(),this.opts.end)this.dest.end()}}class nf extends T9{unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(q,_,j){super(q,_,j);this.proxyErrors=(K)=>_.emit("error",K),q.on("error",this.proxyErrors)}}var wh=(q)=>!!q.objectMode,Oh=(q)=>!q.objectMode&&!!q.encoding&&q.encoding!=="buffer";class k_ extends H9{[f6]=!1;[v3]=!1;[N6]=[];[$6]=[];[X6];[zq];[Aq];[vK];[yq]=!1;[tq]=!1;[X7]=!1;[A7]=!1;[O3]=null;[w6]=0;[e8]=!1;[z3];[h7]=!1;[Z_]=0;[x6]=!1;writable=!0;readable=!0;constructor(...q){let _=q[0]||{};super();if(_.objectMode&&typeof _.encoding==="string")throw new TypeError("Encoding and objectMode may not be used together");if(wh(_))this[X6]=!0,this[zq]=null;else if(Oh(_))this[zq]=_.encoding,this[X6]=!1;else this[X6]=!1,this[zq]=null;if(this[Aq]=!!_.async,this[vK]=this[zq]?new qh(this[zq]):null,_&&_.debugExposeBuffer===!0)Object.defineProperty(this,"buffer",{get:()=>this[$6]});if(_&&_.debugExposePipes===!0)Object.defineProperty(this,"pipes",{get:()=>this[N6]});let{signal:j}=_;if(j)if(this[z3]=j,j.aborted)this[J9]();else j.addEventListener("abort",()=>this[J9]())}get bufferLength(){return this[w6]}get encoding(){return this[zq]}set encoding(q){throw new Error("Encoding must be set at instantiation time")}setEncoding(q){throw new Error("Encoding must be set at instantiation time")}get objectMode(){return this[X6]}set objectMode(q){throw new Error("objectMode must be set at instantiation time")}get["async"](){return this[Aq]}set["async"](q){this[Aq]=this[Aq]||!!q}[J9](){this[h7]=!0,this.emit("abort",this[z3]?.reason),this.destroy(this[z3]?.reason)}get aborted(){return this[h7]}set aborted(q){}write(q,_,j){if(this[h7])return!1;if(this[yq])throw new Error("write after end");if(this[e8])return this.emit("error",Object.assign(new Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;if(typeof _==="function")j=_,_="utf8";if(!_)_="utf8";let K=this[Aq]?W3:Ph;if(!this[X6]&&!Buffer.isBuffer(q)){if($h(q))q=Buffer.from(q.buffer,q.byteOffset,q.byteLength);else if(fh(q))q=Buffer.from(q);else if(typeof q!=="string")throw new Error("Non-contiguous data written to non-objectMode stream")}if(this[X6]){if(this[f6]&&this[w6]!==0)this[G7](!0);if(this[f6])this.emit("data",q);else this[O9](q);if(this[w6]!==0)this.emit("readable");if(j)K(j);return this[f6]}if(!q.length){if(this[w6]!==0)this.emit("readable");if(j)K(j);return this[f6]}if(typeof q==="string"&&!(_===this[zq]&&!this[vK]?.lastNeed))q=Buffer.from(q,_);if(Buffer.isBuffer(q)&&this[zq])q=this[vK].write(q);if(this[f6]&&this[w6]!==0)this[G7](!0);if(this[f6])this.emit("data",q);else this[O9](q);if(this[w6]!==0)this.emit("readable");if(j)K(j);return this[f6]}read(q){if(this[e8])return null;if(this[x6]=!1,this[w6]===0||q===0||q&&q>this[w6])return this[dq](),null;if(this[X6])q=null;if(this[$6].length>1&&!this[X6])this[$6]=[this[zq]?this[$6].join(""):Buffer.concat(this[$6],this[w6])];let _=this[df](q||null,this[$6][0]);return this[dq](),_}[df](q,_){if(this[X6])this[u7]();else{let j=_;if(q===j.length||q===null)this[u7]();else if(typeof j==="string")this[$6][0]=j.slice(q),_=j.slice(0,q),this[w6]-=q;else this[$6][0]=j.subarray(q),_=j.subarray(0,q),this[w6]-=q}if(this.emit("data",_),!this[$6].length&&!this[yq])this.emit("drain");return _}end(q,_,j){if(typeof q==="function")j=q,q=void 0;if(typeof _==="function")j=_,_="utf8";if(q!==void 0)this.write(q,_);if(j)this.once("end",j);if(this[yq]=!0,this.writable=!1,this[f6]||!this[v3])this[dq]();return this}[zK](){if(this[e8])return;if(!this[Z_]&&!this[N6].length)this[x6]=!0;if(this[v3]=!1,this[f6]=!0,this.emit("resume"),this[$6].length)this[G7]();else if(this[yq])this[dq]();else this.emit("drain")}resume(){return this[zK]()}pause(){this[f6]=!1,this[v3]=!0,this[x6]=!1}get destroyed(){return this[e8]}get flowing(){return this[f6]}get paused(){return this[v3]}[O9](q){if(this[X6])this[w6]+=1;else this[w6]+=q.length;this[$6].push(q)}[u7](){if(this[X6])this[w6]-=1;else this[w6]-=this[$6][0].length;return this[$6].shift()}[G7](q=!1){do;while(this[pf](this[u7]())&&this[$6].length);if(!q&&!this[$6].length&&!this[yq])this.emit("drain")}[pf](q){return this.emit("data",q),this[f6]}pipe(q,_){if(this[e8])return q;this[x6]=!1;let j=this[tq];if(_=_||{},q===yf.stdout||q===yf.stderr)_.end=!1;else _.end=_.end!==!1;if(_.proxyErrors=!!_.proxyErrors,j){if(_.end)q.end()}else if(this[N6].push(!_.proxyErrors?new T9(this,q,_):new nf(this,q,_)),this[Aq])W3(()=>this[zK]());else this[zK]();return q}unpipe(q){let _=this[N6].find((j)=>j.dest===q);if(_){if(this[N6].length===1){if(this[f6]&&this[Z_]===0)this[f6]=!1;this[N6]=[]}else this[N6].splice(this[N6].indexOf(_),1);_.unpipe()}}addListener(q,_){return this.on(q,_)}on(q,_){let j=super.on(q,_);if(q==="data"){if(this[x6]=!1,this[Z_]++,!this[N6].length&&!this[f6])this[zK]()}else if(q==="readable"&&this[w6]!==0)super.emit("readable");else if(Yh(q)&&this[tq])super.emit(q),this.removeAllListeners(q);else if(q==="error"&&this[O3]){let K=_;if(this[Aq])W3(()=>K.call(this,this[O3]));else K.call(this,this[O3])}return j}removeListener(q,_){return this.off(q,_)}off(q,_){let j=super.off(q,_);if(q==="data"){if(this[Z_]=this.listeners("data").length,this[Z_]===0&&!this[x6]&&!this[N6].length)this[f6]=!1}return j}removeAllListeners(q){let _=super.removeAllListeners(q);if(q==="data"||q===void 0){if(this[Z_]=0,!this[x6]&&!this[N6].length)this[f6]=!1}return _}get emittedEnd(){return this[tq]}[dq](){if(!this[X7]&&!this[tq]&&!this[e8]&&this[$6].length===0&&this[yq]){if(this[X7]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[A7])this.emit("close");this[X7]=!1}}emit(q,..._){let j=_[0];if(q!=="error"&&q!=="close"&&q!==e8&&this[e8])return!1;else if(q==="data")return!this[X6]&&!j?!1:this[Aq]?(W3(()=>this[z9](j)),!0):this[z9](j);else if(q==="end")return this[Lf]();else if(q==="close"){if(this[A7]=!0,!this[tq]&&!this[e8])return!1;let Y=super.emit("close");return this.removeAllListeners("close"),Y}else if(q==="error"){this[O3]=j,super.emit(v9,j);let Y=!this[z3]||this.listeners("error").length?super.emit("error",j):!1;return this[dq](),Y}else if(q==="resume"){let Y=super.emit("resume");return this[dq](),Y}else if(q==="finish"||q==="prefinish"){let Y=super.emit(q);return this.removeAllListeners(q),Y}let K=super.emit(q,..._);return this[dq](),K}[z9](q){for(let j of this[N6])if(j.dest.write(q)===!1)this.pause();let _=this[x6]?!1:super.emit("data",q);return this[dq](),_}[Lf](){if(this[tq])return!1;return this[tq]=!0,this.readable=!1,this[Aq]?(W3(()=>this[W9]()),!0):this[W9]()}[W9](){if(this[vK]){let _=this[vK].end();if(_){for(let j of this[N6])j.dest.write(_);if(!this[x6])super.emit("data",_)}}for(let _ of this[N6])_.end();let q=super.emit("end");return this.removeAllListeners("end"),q}async collect(){let q=Object.assign([],{dataLength:0});if(!this[X6])q.dataLength=0;let _=this.promise();return this.on("data",(j)=>{if(q.push(j),!this[X6])q.dataLength+=j.length}),await _,q}async concat(){if(this[X6])throw new Error("cannot concat in objectMode");let q=await this.collect();return this[zq]?q.join(""):Buffer.concat(q,q.dataLength)}async promise(){return new Promise((q,_)=>{this.on(e8,()=>_(new Error("stream destroyed"))),this.on("error",(j)=>_(j)),this.on("end",()=>q())})}[Symbol.asyncIterator](){this[x6]=!1;let q=!1,_=async()=>{return this.pause(),q=!0,{value:void 0,done:!0}};return{next:()=>{if(q)return _();let K=this.read();if(K!==null)return Promise.resolve({done:!1,value:K});if(this[yq])return _();let Y,f,P=(v)=>{this.off("data",$),this.off("end",O),this.off(e8,w),_(),f(v)},$=(v)=>{this.off("error",P),this.off("end",O),this.off(e8,w),this.pause(),Y({value:v,done:!!this[yq]})},O=()=>{this.off("error",P),this.off("data",$),this.off(e8,w),_(),Y({done:!0,value:void 0})},w=()=>P(new Error("stream destroyed"));return new Promise((v,z)=>{f=z,Y=v,this.once(e8,w),this.once("error",P),this.once("end",O),this.once("data",$)})},throw:_,return:_,[Symbol.asyncIterator](){return this}}}[Symbol.iterator](){this[x6]=!1;let q=!1,_=()=>{return this.pause(),this.off(v9,_),this.off(e8,_),this.off("end",_),q=!0,{done:!0,value:void 0}},j=()=>{if(q)return _();let K=this.read();return K===null?_():{done:!1,value:K}};return this.once("end",_),this.once(v9,_),this.once(e8,_),{next:j,throw:_,return:_,[Symbol.iterator](){return this}}}destroy(q){if(this[e8]){if(q)this.emit("error",q);else this.emit(e8);return this}this[e8]=!0,this[x6]=!0,this[$6].length=0,this[w6]=0;let _=this;if(typeof _.close==="function"&&!this[A7])_.close();if(q)this.emit("error",q);else this.emit(e8);return this}static get isStream(){return _h}}var Xh=Zh.native,H3={lstatSync:Wh,readdir:Jh,readdirSync:Hh,readlinkSync:Th,realpathSync:Xh,promises:{lstat:Ah,readdir:Gh,readlink:uh,realpath:hh}},af=(q)=>!q||q===H3||q===kh?H3:{...H3,...q,promises:{...H3.promises,...q.promises||{}}},Bf=/^\\\\\?\\([a-z]:)\\?$/i,Dh=(q)=>q.replace(/\//g,"\\").replace(Bf,"$1\\"),Ch=/[\\\/]/,_q=0,tf=1,ef=2,Gq=4,Ff=6,Uf=8,X_=10,sf=12,qq=15,J3=~qq,Z9=16,xf=32,T3=64,Wq=128,D7=256,V7=512,cf=T3|Wq|V7,Vh=1023,k9=(q)=>q.isFile()?Uf:q.isDirectory()?Gq:q.isSymbolicLink()?X_:q.isCharacterDevice()?ef:q.isBlockDevice()?Ff:q.isSocket()?sf:q.isFIFO()?tf:_q,rf=new Map,Z3=(q)=>{let _=rf.get(q);if(_)return _;let j=q.normalize("NFKD");return rf.set(q,j),j},of=new Map,C7=(q)=>{let _=of.get(q);if(_)return _;let j=Z3(q.toLowerCase());return of.set(q,j),j};class A9 extends w3{constructor(){super({max:256})}}class Qf extends w3{constructor(q=16384){super({maxSize:q,sizeCalculation:(_)=>_.length+1})}}var q$=Symbol("PathScurry setAsCwd");class b6{name;root;roots;parent;nocase;isCWD=!1;#q;#_;get dev(){return this.#_}#Y;get mode(){return this.#Y}#P;get nlink(){return this.#P}#f;get uid(){return this.#f}#G;get gid(){return this.#G}#X;get rdev(){return this.#X}#v;get blksize(){return this.#v}#$;get ino(){return this.#$}#W;get size(){return this.#W}#z;get blocks(){return this.#z}#w;get atimeMs(){return this.#w}#K;get mtimeMs(){return this.#K}#H;get ctimeMs(){return this.#H}#u;get birthtimeMs(){return this.#u}#A;get atime(){return this.#A}#T;get mtime(){return this.#T}#b;get ctime(){return this.#b}#Z;get birthtime(){return this.#Z}#D;#M;#k;#h;#N;#J;#j;#I;#S;#C;get parentPath(){return(this.parent||this).fullpath()}get path(){return this.parentPath}constructor(q,_=_q,j,K,Y,f,P){if(this.name=q,this.#D=Y?C7(q):Z3(q),this.#j=_&Vh,this.nocase=Y,this.roots=K,this.root=j||this,this.#I=f,this.#k=P.fullpath,this.#N=P.relative,this.#J=P.relativePosix,this.parent=P.parent,this.parent)this.#q=this.parent.#q;else this.#q=af(P.fs)}depth(){if(this.#M!==void 0)return this.#M;if(!this.parent)return this.#M=0;return this.#M=this.parent.depth()+1}childrenCache(){return this.#I}resolve(q){if(!q)return this;let _=this.getRootString(q),K=q.substring(_.length).split(this.splitSep);return _?this.getRoot(_).#x(K):this.#x(K)}#x(q){let _=this;for(let j of q)_=_.child(j);return _}children(){let q=this.#I.get(this);if(q)return q;let _=Object.assign([],{provisional:0});return this.#I.set(this,_),this.#j&=~Z9,_}child(q,_){if(q===""||q===".")return this;if(q==="..")return this.parent||this;let j=this.children(),K=this.nocase?C7(q):Z3(q);for(let $ of j)if($.#D===K)return $;let Y=this.parent?this.sep:"",f=this.#k?this.#k+Y+q:void 0,P=this.newChild(q,_q,{..._,parent:this,fullpath:f});if(!this.canReaddir())P.#j|=Wq;return j.push(P),P}relative(){if(this.isCWD)return"";if(this.#N!==void 0)return this.#N;let q=this.name,_=this.parent;if(!_)return this.#N=this.name;let j=_.relative();return j+(!j||!_.parent?"":this.sep)+q}relativePosix(){if(this.sep==="/")return this.relative();if(this.isCWD)return"";if(this.#J!==void 0)return this.#J;let q=this.name,_=this.parent;if(!_)return this.#J=this.fullpathPosix();let j=_.relativePosix();return j+(!j||!_.parent?"":"/")+q}fullpath(){if(this.#k!==void 0)return this.#k;let q=this.name,_=this.parent;if(!_)return this.#k=this.name;let K=_.fullpath()+(!_.parent?"":this.sep)+q;return this.#k=K}fullpathPosix(){if(this.#h!==void 0)return this.#h;if(this.sep==="/")return this.#h=this.fullpath();if(!this.parent){let K=this.fullpath().replace(/\\/g,"/");if(/^[a-z]:\//i.test(K))return this.#h=`//?/${K}`;else return this.#h=K}let q=this.parent,_=q.fullpathPosix(),j=_+(!_||!q.parent?"":"/")+this.name;return this.#h=j}isUnknown(){return(this.#j&qq)===_q}isType(q){return this[`is${q}`]()}getType(){return this.isUnknown()?"Unknown":this.isDirectory()?"Directory":this.isFile()?"File":this.isSymbolicLink()?"SymbolicLink":this.isFIFO()?"FIFO":this.isCharacterDevice()?"CharacterDevice":this.isBlockDevice()?"BlockDevice":this.isSocket()?"Socket":"Unknown"}isFile(){return(this.#j&qq)===Uf}isDirectory(){return(this.#j&qq)===Gq}isCharacterDevice(){return(this.#j&qq)===ef}isBlockDevice(){return(this.#j&qq)===Ff}isFIFO(){return(this.#j&qq)===tf}isSocket(){return(this.#j&qq)===sf}isSymbolicLink(){return(this.#j&X_)===X_}lstatCached(){return this.#j&xf?this:void 0}readlinkCached(){return this.#S}realpathCached(){return this.#C}readdirCached(){let q=this.children();return q.slice(0,q.provisional)}canReadlink(){if(this.#S)return!0;if(!this.parent)return!1;let q=this.#j&qq;return!(q!==_q&&q!==X_||this.#j&D7||this.#j&Wq)}calledReaddir(){return!!(this.#j&Z9)}isENOENT(){return!!(this.#j&Wq)}isNamed(q){return!this.nocase?this.#D===Z3(q):this.#D===C7(q)}async readlink(){let q=this.#S;if(q)return q;if(!this.canReadlink())return;if(!this.parent)return;try{let _=await this.#q.promises.readlink(this.fullpath()),j=(await this.parent.realpath())?.resolve(_);if(j)return this.#S=j}catch(_){this.#c(_.code);return}}readlinkSync(){let q=this.#S;if(q)return q;if(!this.canReadlink())return;if(!this.parent)return;try{let _=this.#q.readlinkSync(this.fullpath()),j=this.parent.realpathSync()?.resolve(_);if(j)return this.#S=j}catch(_){this.#c(_.code);return}}#V(q){this.#j|=Z9;for(let _=q.provisional;_j(null,q))}readdirCB(q,_=!1){if(!this.canReaddir()){if(_)q(null,[]);else queueMicrotask(()=>q(null,[]));return}let j=this.children();if(this.calledReaddir()){let Y=j.slice(0,j.provisional);if(_)q(null,Y);else queueMicrotask(()=>q(null,Y));return}if(this.#R.push(q),this.#n)return;this.#n=!0;let K=this.fullpath();this.#q.readdir(K,{withFileTypes:!0},(Y,f)=>{if(Y)this.#E(Y.code),j.provisional=0;else{for(let P of f)this.#d(P,j);this.#V(j)}this.#a(j.slice(0,j.provisional));return})}#o;async readdir(){if(!this.canReaddir())return[];let q=this.children();if(this.calledReaddir())return q.slice(0,q.provisional);let _=this.fullpath();if(this.#o)await this.#o;else{let j=()=>{};this.#o=new Promise((K)=>j=K);try{for(let K of await this.#q.promises.readdir(_,{withFileTypes:!0}))this.#d(K,q);this.#V(q)}catch(K){this.#E(K.code),q.provisional=0}this.#o=void 0,j()}return q.slice(0,q.provisional)}readdirSync(){if(!this.canReaddir())return[];let q=this.children();if(this.calledReaddir())return q.slice(0,q.provisional);let _=this.fullpath();try{for(let j of this.#q.readdirSync(_,{withFileTypes:!0}))this.#d(j,q);this.#V(q)}catch(j){this.#E(j.code),q.provisional=0}return q.slice(0,q.provisional)}canReaddir(){if(this.#j&cf)return!1;let q=qq&this.#j;if(!(q===_q||q===Gq||q===X_))return!1;return!0}shouldWalk(q,_){return(this.#j&Gq)===Gq&&!(this.#j&cf)&&!q.has(this)&&(!_||_(this))}async realpath(){if(this.#C)return this.#C;if((V7|D7|Wq)&this.#j)return;try{let q=await this.#q.promises.realpath(this.fullpath());return this.#C=this.resolve(q)}catch(q){this.#l()}}realpathSync(){if(this.#C)return this.#C;if((V7|D7|Wq)&this.#j)return;try{let q=this.#q.realpathSync(this.fullpath());return this.#C=this.resolve(q)}catch(q){this.#l()}}[q$](q){if(q===this)return;q.isCWD=!1,this.isCWD=!0;let _=new Set([]),j=[],K=this;while(K&&K.parent)_.add(K),K.#N=j.join(this.sep),K.#J=j.join("/"),K=K.parent,j.push("..");K=q;while(K&&K.parent&&!_.has(K))K.#N=void 0,K.#J=void 0,K=K.parent}}class M7 extends b6{sep="\\";splitSep=Ch;constructor(q,_=_q,j,K,Y,f,P){super(q,_,j,K,Y,f,P)}newChild(q,_=_q,j={}){return new M7(q,_,this.root,this.roots,this.nocase,this.childrenCache(),j)}getRootString(q){return X9.parse(q).root}getRoot(q){if(q=Dh(q.toUpperCase()),q===this.root.name)return this.root;for(let[_,j]of Object.entries(this.roots))if(this.sameRoot(q,_))return this.roots[q]=j;return this.roots[q]=new k3(q,this).root}sameRoot(q,_=this.root.name){return q=q.toUpperCase().replace(/\//g,"\\").replace(Bf,"$1\\"),q===_}}class N7 extends b6{splitSep="/";sep="/";constructor(q,_=_q,j,K,Y,f,P){super(q,_,j,K,Y,f,P)}getRootString(q){return q.startsWith("/")?"/":""}getRoot(q){return this.root}newChild(q,_=_q,j={}){return new N7(q,_,this.root,this.roots,this.nocase,this.childrenCache(),j)}}class G9{root;rootPath;roots;cwd;#q;#_;#Y;nocase;#P;constructor(q=process.cwd(),_,j,{nocase:K,childrenCacheSize:Y=16384,fs:f=H3}={}){if(this.#P=af(f),q instanceof URL||q.startsWith("file://"))q=zh(q);let P=_.resolve(q);this.roots=Object.create(null),this.rootPath=this.parseRootPath(P),this.#q=new A9,this.#_=new A9,this.#Y=new Qf(Y);let $=P.substring(this.rootPath.length).split(j);if($.length===1&&!$[0])$.pop();if(K===void 0)throw new TypeError("must provide nocase setting to PathScurryBase ctor");this.nocase=K,this.root=this.newRoot(this.#P),this.roots[this.rootPath]=this.root;let O=this.root,w=$.length-1,v=_.sep,z=this.rootPath,W=!1;for(let J of $){let k=w--;O=O.child(J,{relative:new Array(k).fill("..").join(v),relativePosix:new Array(k).fill("..").join("/"),fullpath:z+=(W?"":v)+J}),W=!0}this.cwd=O}depth(q=this.cwd){if(typeof q==="string")q=this.cwd.resolve(q);return q.depth()}childrenCache(){return this.#Y}resolve(...q){let _="";for(let Y=q.length-1;Y>=0;Y--){let f=q[Y];if(!f||f===".")continue;if(_=_?`${f}/${_}`:f,this.isAbsolute(f))break}let j=this.#q.get(_);if(j!==void 0)return j;let K=this.cwd.resolve(_).fullpath();return this.#q.set(_,K),K}resolvePosix(...q){let _="";for(let Y=q.length-1;Y>=0;Y--){let f=q[Y];if(!f||f===".")continue;if(_=_?`${f}/${_}`:f,this.isAbsolute(f))break}let j=this.#_.get(_);if(j!==void 0)return j;let K=this.cwd.resolve(_).fullpathPosix();return this.#_.set(_,K),K}relative(q=this.cwd){if(typeof q==="string")q=this.cwd.resolve(q);return q.relative()}relativePosix(q=this.cwd){if(typeof q==="string")q=this.cwd.resolve(q);return q.relativePosix()}basename(q=this.cwd){if(typeof q==="string")q=this.cwd.resolve(q);return q.name}dirname(q=this.cwd){if(typeof q==="string")q=this.cwd.resolve(q);return(q.parent||q).fullpath()}async readdir(q=this.cwd,_={withFileTypes:!0}){if(typeof q==="string")q=this.cwd.resolve(q);else if(!(q instanceof b6))_=q,q=this.cwd;let{withFileTypes:j}=_;if(!q.canReaddir())return[];else{let K=await q.readdir();return j?K:K.map((Y)=>Y.name)}}readdirSync(q=this.cwd,_={withFileTypes:!0}){if(typeof q==="string")q=this.cwd.resolve(q);else if(!(q instanceof b6))_=q,q=this.cwd;let{withFileTypes:j=!0}=_;if(!q.canReaddir())return[];else if(j)return q.readdirSync();else return q.readdirSync().map((K)=>K.name)}async lstat(q=this.cwd){if(typeof q==="string")q=this.cwd.resolve(q);return q.lstat()}lstatSync(q=this.cwd){if(typeof q==="string")q=this.cwd.resolve(q);return q.lstatSync()}async readlink(q=this.cwd,{withFileTypes:_}={withFileTypes:!1}){if(typeof q==="string")q=this.cwd.resolve(q);else if(!(q instanceof b6))_=q.withFileTypes,q=this.cwd;let j=await q.readlink();return _?j:j?.fullpath()}readlinkSync(q=this.cwd,{withFileTypes:_}={withFileTypes:!1}){if(typeof q==="string")q=this.cwd.resolve(q);else if(!(q instanceof b6))_=q.withFileTypes,q=this.cwd;let j=q.readlinkSync();return _?j:j?.fullpath()}async realpath(q=this.cwd,{withFileTypes:_}={withFileTypes:!1}){if(typeof q==="string")q=this.cwd.resolve(q);else if(!(q instanceof b6))_=q.withFileTypes,q=this.cwd;let j=await q.realpath();return _?j:j?.fullpath()}realpathSync(q=this.cwd,{withFileTypes:_}={withFileTypes:!1}){if(typeof q==="string")q=this.cwd.resolve(q);else if(!(q instanceof b6))_=q.withFileTypes,q=this.cwd;let j=q.realpathSync();return _?j:j?.fullpath()}async walk(q=this.cwd,_={}){if(typeof q==="string")q=this.cwd.resolve(q);else if(!(q instanceof b6))_=q,q=this.cwd;let{withFileTypes:j=!0,follow:K=!1,filter:Y,walkFilter:f}=_,P=[];if(!Y||Y(q))P.push(j?q:q.fullpath());let $=new Set,O=(v,z)=>{$.add(v),v.readdirCB((W,J)=>{if(W)return z(W);let k=J.length;if(!k)return z();let H=()=>{if(--k===0)z()};for(let X of J){if(!Y||Y(X))P.push(j?X:X.fullpath());if(K&&X.isSymbolicLink())X.realpath().then((A)=>A?.isUnknown()?A.lstat():A).then((A)=>A?.shouldWalk($,f)?O(A,H):H());else if(X.shouldWalk($,f))O(X,H);else H()}},!0)},w=q;return new Promise((v,z)=>{O(w,(W)=>{if(W)return z(W);v(P)})})}walkSync(q=this.cwd,_={}){if(typeof q==="string")q=this.cwd.resolve(q);else if(!(q instanceof b6))_=q,q=this.cwd;let{withFileTypes:j=!0,follow:K=!1,filter:Y,walkFilter:f}=_,P=[];if(!Y||Y(q))P.push(j?q:q.fullpath());let $=new Set([q]);for(let O of $){let w=O.readdirSync();for(let v of w){if(!Y||Y(v))P.push(j?v:v.fullpath());let z=v;if(v.isSymbolicLink()){if(!(K&&(z=v.realpathSync())))continue;if(z.isUnknown())z.lstatSync()}if(z.shouldWalk($,f))$.add(z)}}return P}[Symbol.asyncIterator](){return this.iterate()}iterate(q=this.cwd,_={}){if(typeof q==="string")q=this.cwd.resolve(q);else if(!(q instanceof b6))_=q,q=this.cwd;return this.stream(q,_)[Symbol.asyncIterator]()}[Symbol.iterator](){return this.iterateSync()}*iterateSync(q=this.cwd,_={}){if(typeof q==="string")q=this.cwd.resolve(q);else if(!(q instanceof b6))_=q,q=this.cwd;let{withFileTypes:j=!0,follow:K=!1,filter:Y,walkFilter:f}=_;if(!Y||Y(q))yield j?q:q.fullpath();let P=new Set([q]);for(let $ of P){let O=$.readdirSync();for(let w of O){if(!Y||Y(w))yield j?w:w.fullpath();let v=w;if(w.isSymbolicLink()){if(!(K&&(v=w.realpathSync())))continue;if(v.isUnknown())v.lstatSync()}if(v.shouldWalk(P,f))P.add(v)}}}stream(q=this.cwd,_={}){if(typeof q==="string")q=this.cwd.resolve(q);else if(!(q instanceof b6))_=q,q=this.cwd;let{withFileTypes:j=!0,follow:K=!1,filter:Y,walkFilter:f}=_,P=new k_({objectMode:!0});if(!Y||Y(q))P.write(j?q:q.fullpath());let $=new Set,O=[q],w=0,v=()=>{let z=!1;while(!z){let W=O.shift();if(!W){if(w===0)P.end();return}w++,$.add(W);let J=(H,X,A=!1)=>{if(H)return P.emit("error",H);if(K&&!A){let G=[];for(let h of X)if(h.isSymbolicLink())G.push(h.realpath().then((V)=>V?.isUnknown()?V.lstat():V));if(G.length){Promise.all(G).then(()=>J(null,X,!0));return}}for(let G of X)if(G&&(!Y||Y(G))){if(!P.write(j?G:G.fullpath()))z=!0}w--;for(let G of X){let h=G.realpathCached()||G;if(h.shouldWalk($,f))O.push(h)}if(z&&!P.flowing)P.once("drain",v);else if(!k)v()},k=!0;W.readdirCB(J,!0),k=!1}};return v(),P}streamSync(q=this.cwd,_={}){if(typeof q==="string")q=this.cwd.resolve(q);else if(!(q instanceof b6))_=q,q=this.cwd;let{withFileTypes:j=!0,follow:K=!1,filter:Y,walkFilter:f}=_,P=new k_({objectMode:!0}),$=new Set;if(!Y||Y(q))P.write(j?q:q.fullpath());let O=[q],w=0,v=()=>{let z=!1;while(!z){let W=O.shift();if(!W){if(w===0)P.end();return}w++,$.add(W);let J=W.readdirSync();for(let k of J)if(!Y||Y(k)){if(!P.write(j?k:k.fullpath()))z=!0}w--;for(let k of J){let H=k;if(k.isSymbolicLink()){if(!(K&&(H=k.realpathSync())))continue;if(H.isUnknown())H.lstatSync()}if(H.shouldWalk($,f))O.push(H)}}if(z&&!P.flowing)P.once("drain",v)};return v(),P}chdir(q=this.cwd){let _=this.cwd;this.cwd=typeof q==="string"?this.cwd.resolve(q):q,this.cwd[q$](_)}}class k3 extends G9{sep="\\";constructor(q=process.cwd(),_={}){let{nocase:j=!0}=_;super(q,X9,"\\",{..._,nocase:j});this.nocase=j;for(let K=this.cwd;K;K=K.parent)K.nocase=this.nocase}parseRootPath(q){return X9.parse(q).root.toUpperCase()}newRoot(q){return new M7(this.rootPath,Gq,void 0,this.roots,this.nocase,this.childrenCache(),{fs:q})}isAbsolute(q){return q.startsWith("/")||q.startsWith("\\")||/^[a-z]:(\/|\\)/i.test(q)}}class X3 extends G9{sep="/";constructor(q=process.cwd(),_={}){let{nocase:j=!1}=_;super(q,vh,"/",{..._,nocase:j});this.nocase=j}parseRootPath(q){return"/"}newRoot(q){return new N7(this.rootPath,Gq,void 0,this.roots,this.nocase,this.childrenCache(),{fs:q})}isAbsolute(q){return q.startsWith("/")}}class b7 extends X3{constructor(q=process.cwd(),_={}){let{nocase:j=!0}=_;super(q,{..._,nocase:j})}}var FN=process.platform==="win32"?M7:N7,_$=process.platform==="win32"?k3:process.platform==="darwin"?b7:X3;var Mh=(q)=>q.length>=1,Nh=(q)=>q.length>=1;class WK{#q;#_;#Y;length;#P;#f;#G;#X;#v;#$;#W=!0;constructor(q,_,j,K){if(!Mh(q))throw new TypeError("empty pattern list");if(!Nh(_))throw new TypeError("empty glob list");if(_.length!==q.length)throw new TypeError("mismatched pattern list and glob list lengths");if(this.length=q.length,j<0||j>=this.length)throw new TypeError("index out of range");if(this.#q=q,this.#_=_,this.#Y=j,this.#P=K,this.#Y===0){if(this.isUNC()){let[Y,f,P,$,...O]=this.#q,[w,v,z,W,...J]=this.#_;if(O[0]==="")O.shift(),J.shift();let k=[Y,f,P,$,""].join("/"),H=[w,v,z,W,""].join("/");this.#q=[k,...O],this.#_=[H,...J],this.length=this.#q.length}else if(this.isDrive()||this.isAbsolute()){let[Y,...f]=this.#q,[P,...$]=this.#_;if(f[0]==="")f.shift(),$.shift();let O=Y+"/",w=P+"/";this.#q=[O,...f],this.#_=[w,...$],this.length=this.#q.length}}}pattern(){return this.#q[this.#Y]}isString(){return typeof this.#q[this.#Y]==="string"}isGlobstar(){return this.#q[this.#Y]===J6}isRegExp(){return this.#q[this.#Y]instanceof RegExp}globString(){return this.#G=this.#G||(this.#Y===0?this.isAbsolute()?this.#_[0]+this.#_.slice(1).join("/"):this.#_.join("/"):this.#_.slice(this.#Y).join("/"))}hasMore(){return this.length>this.#Y+1}rest(){if(this.#f!==void 0)return this.#f;if(!this.hasMore())return this.#f=null;return this.#f=new WK(this.#q,this.#_,this.#Y+1,this.#P),this.#f.#$=this.#$,this.#f.#v=this.#v,this.#f.#X=this.#X,this.#f}isUNC(){let q=this.#q;return this.#v!==void 0?this.#v:this.#v=this.#P==="win32"&&this.#Y===0&&q[0]===""&&q[1]===""&&typeof q[2]==="string"&&!!q[2]&&typeof q[3]==="string"&&!!q[3]}isDrive(){let q=this.#q;return this.#X!==void 0?this.#X:this.#X=this.#P==="win32"&&this.#Y===0&&this.length>1&&typeof q[0]==="string"&&/^[a-z]:$/i.test(q[0])}isAbsolute(){let q=this.#q;return this.#$!==void 0?this.#$:this.#$=q[0]===""&&q.length>1||this.isDrive()||this.isUNC()}root(){let q=this.#q[0];return typeof q==="string"&&this.isAbsolute()&&this.#Y===0?q:""}checkFollowGlobstar(){return!(this.#Y===0||!this.isGlobstar()||!this.#W)}markFollowGlobstar(){if(this.#Y===0||!this.isGlobstar()||!this.#W)return!1;return this.#W=!1,!0}}var bh=typeof process==="object"&&process&&typeof process.platform==="string"?process.platform:"linux";class A3{relative;relativeChildren;absolute;absoluteChildren;platform;mmopts;constructor(q,{nobrace:_,nocase:j,noext:K,noglobstar:Y,platform:f=bh}){this.relative=[],this.absolute=[],this.relativeChildren=[],this.absoluteChildren=[],this.platform=f,this.mmopts={dot:!0,nobrace:_,nocase:j,noext:K,noglobstar:Y,optimizationLevel:2,platform:f,nocomment:!0,nonegate:!0};for(let P of q)this.add(P)}add(q){let _=new Q6(q,this.mmopts);for(let j=0;j<_.set.length;j++){let K=_.set[j],Y=_.globParts[j];if(!K||!Y)throw new Error("invalid pattern object");while(K[0]==="."&&Y[0]===".")K.shift(),Y.shift();let f=new WK(K,Y,0,this.platform),P=new Q6(f.globString(),this.mmopts),$=Y[Y.length-1]==="**",O=f.isAbsolute();if(O)this.absolute.push(P);else this.relative.push(P);if($)if(O)this.absoluteChildren.push(P);else this.relativeChildren.push(P)}}ignored(q){let _=q.fullpath(),j=`${_}/`,K=q.relative()||".",Y=`${K}/`;for(let f of this.relative)if(f.match(K)||f.match(Y))return!0;for(let f of this.absolute)if(f.match(_)||f.match(j))return!0;return!1}childrenIgnored(q){let _=q.fullpath()+"/",j=(q.relative()||".")+"/";for(let K of this.relativeChildren)if(K.match(j))return!0;for(let K of this.absoluteChildren)if(K.match(_))return!0;return!1}}class u9{store;constructor(q=new Map){this.store=q}copy(){return new u9(new Map(this.store))}hasWalked(q,_){return this.store.get(q.fullpath())?.has(_.globString())}storeWalked(q,_){let j=q.fullpath(),K=this.store.get(j);if(K)K.add(_.globString());else this.store.set(j,new Set([_.globString()]))}}class K${store=new Map;add(q,_,j){let K=(_?2:0)|(j?1:0),Y=this.store.get(q);this.store.set(q,Y===void 0?K:K&Y)}entries(){return[...this.store.entries()].map(([q,_])=>[q,!!(_&2),!!(_&1)])}}class j${store=new Map;add(q,_){if(!q.canReaddir())return;let j=this.store.get(q);if(j){if(!j.find((K)=>K.globString()===_.globString()))j.push(_)}else this.store.set(q,[_])}get(q){let _=this.store.get(q);if(!_)throw new Error("attempting to walk unknown path");return _}entries(){return this.keys().map((q)=>[q,this.store.get(q)])}keys(){return[...this.store.keys()].filter((q)=>q.canReaddir())}}class G3{hasWalkedCache;matches=new K$;subwalks=new j$;patterns;follow;dot;opts;constructor(q,_){this.opts=q,this.follow=!!q.follow,this.dot=!!q.dot,this.hasWalkedCache=_?_.copy():new u9}processPatterns(q,_){this.patterns=_;let j=_.map((K)=>[q,K]);for(let[K,Y]of j){this.hasWalkedCache.storeWalked(K,Y);let f=Y.root(),P=Y.isAbsolute()&&this.opts.absolute!==!1;if(f){K=K.resolve(f==="/"&&this.opts.root!==void 0?this.opts.root:f);let v=Y.rest();if(!v){this.matches.add(K,!0,!1);continue}else Y=v}if(K.isENOENT())continue;let $,O,w=!1;while(typeof($=Y.pattern())==="string"&&(O=Y.rest()))K=K.resolve($),Y=O,w=!0;if($=Y.pattern(),O=Y.rest(),w){if(this.hasWalkedCache.hasWalked(K,Y))continue;this.hasWalkedCache.storeWalked(K,Y)}if(typeof $==="string"){let v=$===".."||$===""||$===".";this.matches.add(K.resolve($),P,v);continue}else if($===J6){if(!K.isSymbolicLink()||this.follow||Y.checkFollowGlobstar())this.subwalks.add(K,Y);let v=O?.pattern(),z=O?.rest();if(!O||(v===""||v===".")&&!z)this.matches.add(K,P,v===""||v===".");else if(v===".."){let W=K.parent||K;if(!z)this.matches.add(W,P,!0);else if(!this.hasWalkedCache.hasWalked(W,z))this.subwalks.add(W,z)}}else if($ instanceof RegExp)this.subwalks.add(K,Y)}return this}subwalkTargets(){return this.subwalks.keys()}child(){return new G3(this.opts,this.hasWalkedCache)}filterEntries(q,_){let j=this.subwalks.get(q),K=this.child();for(let Y of _)for(let f of j){let P=f.isAbsolute(),$=f.pattern(),O=f.rest();if($===J6)K.testGlobstar(Y,f,O,P);else if($ instanceof RegExp)K.testRegExp(Y,$,O,P);else K.testString(Y,$,O,P)}return K}testGlobstar(q,_,j,K){if(this.dot||!q.name.startsWith(".")){if(!_.hasMore())this.matches.add(q,K,!1);if(q.canReaddir()){if(this.follow||!q.isSymbolicLink())this.subwalks.add(q,_);else if(q.isSymbolicLink()){if(j&&_.checkFollowGlobstar())this.subwalks.add(q,j);else if(_.markFollowGlobstar())this.subwalks.add(q,_)}}}if(j){let Y=j.pattern();if(typeof Y==="string"&&Y!==".."&&Y!==""&&Y!==".")this.testString(q,Y,j.rest(),K);else if(Y===".."){let f=q.parent||q;this.subwalks.add(f,j)}else if(Y instanceof RegExp)this.testRegExp(q,Y,j.rest(),K)}}testRegExp(q,_,j,K){if(!_.test(q.name))return;if(!j)this.matches.add(q,K,!1);else this.subwalks.add(q,j)}testString(q,_,j,K){if(!q.isNamed(_))return;if(!j)this.matches.add(q,K,!1);else this.subwalks.add(q,j)}}var Sh=(q,_)=>typeof q==="string"?new A3([q],_):Array.isArray(q)?new A3(q,_):q;class h9{path;patterns;opts;seen=new Set;paused=!1;aborted=!1;#q=[];#_;#Y;signal;maxDepth;includeChildMatches;constructor(q,_,j){if(this.patterns=q,this.path=_,this.opts=j,this.#Y=!j.posix&&j.platform==="win32"?"\\":"/",this.includeChildMatches=j.includeChildMatches!==!1,j.ignore||!this.includeChildMatches){if(this.#_=Sh(j.ignore??[],j),!this.includeChildMatches&&typeof this.#_.add!=="function")throw new Error("cannot ignore child matches, ignore lacks add() method.")}if(this.maxDepth=j.maxDepth||1/0,j.signal)this.signal=j.signal,this.signal.addEventListener("abort",()=>{this.#q.length=0})}#P(q){return this.seen.has(q)||!!this.#_?.ignored?.(q)}#f(q){return!!this.#_?.childrenIgnored?.(q)}pause(){this.paused=!0}resume(){if(this.signal?.aborted)return;this.paused=!1;let q=void 0;while(!this.paused&&(q=this.#q.shift()))q()}onResume(q){if(this.signal?.aborted)return;if(!this.paused)q();else this.#q.push(q)}async matchCheck(q,_){if(_&&this.opts.nodir)return;let j;if(this.opts.realpath){if(j=q.realpathCached()||await q.realpath(),!j)return;q=j}let Y=q.isUnknown()||this.opts.stat?await q.lstat():q;if(this.opts.follow&&this.opts.nodir&&Y?.isSymbolicLink()){let f=await Y.realpath();if(f&&(f.isUnknown()||this.opts.stat))await f.lstat()}return this.matchCheckTest(Y,_)}matchCheckTest(q,_){return q&&(this.maxDepth===1/0||q.depth()<=this.maxDepth)&&(!_||q.canReaddir())&&(!this.opts.nodir||!q.isDirectory())&&(!this.opts.nodir||!this.opts.follow||!q.isSymbolicLink()||!q.realpathCached()?.isDirectory())&&!this.#P(q)?q:void 0}matchCheckSync(q,_){if(_&&this.opts.nodir)return;let j;if(this.opts.realpath){if(j=q.realpathCached()||q.realpathSync(),!j)return;q=j}let Y=q.isUnknown()||this.opts.stat?q.lstatSync():q;if(this.opts.follow&&this.opts.nodir&&Y?.isSymbolicLink()){let f=Y.realpathSync();if(f&&(f?.isUnknown()||this.opts.stat))f.lstatSync()}return this.matchCheckTest(Y,_)}matchFinish(q,_){if(this.#P(q))return;if(!this.includeChildMatches&&this.#_?.add){let Y=`${q.relativePosix()}/**`;this.#_.add(Y)}let j=this.opts.absolute===void 0?_:this.opts.absolute;this.seen.add(q);let K=this.opts.mark&&q.isDirectory()?this.#Y:"";if(this.opts.withFileTypes)this.matchEmit(q);else if(j){let Y=this.opts.posix?q.fullpathPosix():q.fullpath();this.matchEmit(Y+K)}else{let Y=this.opts.posix?q.relativePosix():q.relative(),f=this.opts.dotRelative&&!Y.startsWith(".."+this.#Y)?"."+this.#Y:"";this.matchEmit(!Y?"."+K:f+Y+K)}}async match(q,_,j){let K=await this.matchCheck(q,j);if(K)this.matchFinish(K,_)}matchSync(q,_,j){let K=this.matchCheckSync(q,j);if(K)this.matchFinish(K,_)}walkCB(q,_,j){if(this.signal?.aborted)j();this.walkCB2(q,_,new G3(this.opts),j)}walkCB2(q,_,j,K){if(this.#f(q))return K();if(this.signal?.aborted)K();if(this.paused){this.onResume(()=>this.walkCB2(q,_,j,K));return}j.processPatterns(q,_);let Y=1,f=()=>{if(--Y===0)K()};for(let[P,$,O]of j.matches.entries()){if(this.#P(P))continue;Y++,this.match(P,$,O).then(()=>f())}for(let P of j.subwalkTargets()){if(this.maxDepth!==1/0&&P.depth()>=this.maxDepth)continue;Y++;let $=P.readdirCached();if(P.calledReaddir())this.walkCB3(P,$,j,f);else P.readdirCB((O,w)=>this.walkCB3(P,w,j,f),!0)}f()}walkCB3(q,_,j,K){j=j.filterEntries(q,_);let Y=1,f=()=>{if(--Y===0)K()};for(let[P,$,O]of j.matches.entries()){if(this.#P(P))continue;Y++,this.match(P,$,O).then(()=>f())}for(let[P,$]of j.subwalks.entries())Y++,this.walkCB2(P,$,j.child(),f);f()}walkCBSync(q,_,j){if(this.signal?.aborted)j();this.walkCB2Sync(q,_,new G3(this.opts),j)}walkCB2Sync(q,_,j,K){if(this.#f(q))return K();if(this.signal?.aborted)K();if(this.paused){this.onResume(()=>this.walkCB2Sync(q,_,j,K));return}j.processPatterns(q,_);let Y=1,f=()=>{if(--Y===0)K()};for(let[P,$,O]of j.matches.entries()){if(this.#P(P))continue;this.matchSync(P,$,O)}for(let P of j.subwalkTargets()){if(this.maxDepth!==1/0&&P.depth()>=this.maxDepth)continue;Y++;let $=P.readdirSync();this.walkCB3Sync(P,$,j,f)}f()}walkCB3Sync(q,_,j,K){j=j.filterEntries(q,_);let Y=1,f=()=>{if(--Y===0)K()};for(let[P,$,O]of j.matches.entries()){if(this.#P(P))continue;this.matchSync(P,$,O)}for(let[P,$]of j.subwalks.entries())Y++,this.walkCB2Sync(P,$,j.child(),f);f()}}class S7 extends h9{matches=new Set;constructor(q,_,j){super(q,_,j)}matchEmit(q){this.matches.add(q)}async walk(){if(this.signal?.aborted)throw this.signal.reason;if(this.path.isUnknown())await this.path.lstat();return await new Promise((q,_)=>{this.walkCB(this.path,this.patterns,()=>{if(this.signal?.aborted)_(this.signal.reason);else q(this.matches)})}),this.matches}walkSync(){if(this.signal?.aborted)throw this.signal.reason;if(this.path.isUnknown())this.path.lstatSync();return this.walkCBSync(this.path,this.patterns,()=>{if(this.signal?.aborted)throw this.signal.reason}),this.matches}}class E7 extends h9{results;constructor(q,_,j){super(q,_,j);this.results=new k_({signal:this.signal,objectMode:!0}),this.results.on("drain",()=>this.resume()),this.results.on("resume",()=>this.resume())}matchEmit(q){if(this.results.write(q),!this.results.flowing)this.pause()}stream(){let q=this.path;if(q.isUnknown())q.lstat().then(()=>{this.walkCB(q,this.patterns,()=>this.results.end())});else this.walkCB(q,this.patterns,()=>this.results.end());return this.results}streamSync(){if(this.path.isUnknown())this.path.lstatSync();return this.walkCBSync(this.path,this.patterns,()=>this.results.end()),this.results}}var Rh=typeof process==="object"&&process&&typeof process.platform==="string"?process.platform:"linux";class uq{absolute;cwd;root;dot;dotRelative;follow;ignore;magicalBraces;mark;matchBase;maxDepth;nobrace;nocase;nodir;noext;noglobstar;pattern;platform;realpath;scurry;stat;signal;windowsPathsNoEscape;withFileTypes;includeChildMatches;opts;patterns;constructor(q,_){if(!_)throw new TypeError("glob options required");if(this.withFileTypes=!!_.withFileTypes,this.signal=_.signal,this.follow=!!_.follow,this.dot=!!_.dot,this.dotRelative=!!_.dotRelative,this.nodir=!!_.nodir,this.mark=!!_.mark,!_.cwd)this.cwd="";else if(_.cwd instanceof URL||_.cwd.startsWith("file://"))_.cwd=Eh(_.cwd);if(this.cwd=_.cwd||"",this.root=_.root,this.magicalBraces=!!_.magicalBraces,this.nobrace=!!_.nobrace,this.noext=!!_.noext,this.realpath=!!_.realpath,this.absolute=_.absolute,this.includeChildMatches=_.includeChildMatches!==!1,this.noglobstar=!!_.noglobstar,this.matchBase=!!_.matchBase,this.maxDepth=typeof _.maxDepth==="number"?_.maxDepth:1/0,this.stat=!!_.stat,this.ignore=_.ignore,this.withFileTypes&&this.absolute!==void 0)throw new Error("cannot set absolute and withFileTypes:true");if(typeof q==="string")q=[q];if(this.windowsPathsNoEscape=!!_.windowsPathsNoEscape||_.allowWindowsEscape===!1,this.windowsPathsNoEscape)q=q.map(($)=>$.replace(/\\/g,"/"));if(this.matchBase){if(_.noglobstar)throw new TypeError("base matching requires globstar");q=q.map(($)=>$.includes("/")?$:`./**/${$}`)}if(this.pattern=q,this.platform=_.platform||Rh,this.opts={..._,platform:this.platform},_.scurry){if(this.scurry=_.scurry,_.nocase!==void 0&&_.nocase!==_.scurry.nocase)throw new Error("nocase option contradicts provided scurry option")}else{let $=_.platform==="win32"?k3:_.platform==="darwin"?b7:_.platform?X3:_$;this.scurry=new $(this.cwd,{nocase:_.nocase,fs:_.fs})}this.nocase=this.scurry.nocase;let j=this.platform==="darwin"||this.platform==="win32",K={..._,dot:this.dot,matchBase:this.matchBase,nobrace:this.nobrace,nocase:this.nocase,nocaseMagicOnly:j,nocomment:!0,noext:this.noext,nonegate:!0,optimizationLevel:2,platform:this.platform,windowsPathsNoEscape:this.windowsPathsNoEscape,debug:!!this.opts.debug},Y=this.pattern.map(($)=>new Q6($,K)),[f,P]=Y.reduce(($,O)=>{return $[0].push(...O.set),$[1].push(...O.globParts),$},[[],[]]);this.patterns=f.map(($,O)=>{let w=P[O];if(!w)throw new Error("invalid pattern object");return new WK($,w,0,this.platform)})}async walk(){return[...await new S7(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).walk()]}walkSync(){return[...new S7(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).walkSync()]}stream(){return new E7(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).stream()}streamSync(){return new E7(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).streamSync()}iterateSync(){return this.streamSync()[Symbol.iterator]()}[Symbol.iterator](){return this.iterateSync()}iterate(){return this.stream()[Symbol.asyncIterator]()}[Symbol.asyncIterator](){return this.iterate()}}var D9=(q,_={})=>{if(!Array.isArray(q))q=[q];for(let j of q)if(new Q6(j,_).hasMagic())return!0;return!1};function m7(q,_={}){return new uq(q,_).streamSync()}function Y$(q,_={}){return new uq(q,_).stream()}function f$(q,_={}){return new uq(q,_).walkSync()}async function P$(q,_={}){return new uq(q,_).walk()}function I7(q,_={}){return new uq(q,_).iterateSync()}function $$(q,_={}){return new uq(q,_).iterate()}var mh=m7,Ih=Object.assign(Y$,{sync:m7}),gh=I7,yh=Object.assign($$,{sync:I7}),dh=Object.assign(f$,{stream:m7,iterate:I7}),R7=Object.assign(P$,{glob:P$,globSync:f$,sync:dh,globStream:Y$,stream:Ih,globStreamSync:m7,streamSync:mh,globIterate:$$,iterate:yh,globIterateSync:I7,iterateSync:gh,Glob:uq,hasMagic:D9,escape:wK,unescape:vq});R7.glob=R7;C6();async function O$(q,_={}){let j=_8.getInstance().getTrashDirectory();if(!w$(j))Lh(j,{recursive:!0});let K=Array.isArray(q)?q:[q];for(let Y of K){let f=await R7(Y),P=f.length>0?f:[Y];for(let $ of P)try{if(!w$($)){if(!_.force){console.error(`trash: ${$}: No such file or directory`);continue}continue}if(lh($).isDirectory()&&!_.recursive){if(!_.force){console.error(`trash: ${$}: is a directory`);continue}}let w=xh($),v=Date.now(),z=nh(j,`${w}.${v}`);ph($,z),console.log(`Moved ${w} to trash`)}catch(O){if(!_.force){let w=O instanceof Error?O.message:String(O);console.error(`trash: ${$}: ${w}`)}}}}KK();C6();import{readdirSync as ch,renameSync as rh}from"fs";import{join as v$}from"path";async function z$(){let q=_8.getInstance().getTrashDirectory(),_=ch(q);if(_.length===0){console.log("Trash is empty");return}let j=await oq({message:"Select file to restore:",options:_.map((K)=>({value:K,label:K}))});if(K6(j))return;rh(v$(q,j),v$(process.cwd(),j)),console.log(`Restored ${j}`)}C6();import{appendFileSync as ih}from"fs";function oh(q){let j=q.toLowerCase().replace(/[^\w\s]/g," ").split(/\s+/).filter((f)=>f.length>2).slice(0,4).join("-"),K=j.length>30?j.substring(0,27)+"...":j,Y=new Date().toISOString().substring(11,19).replace(/:/g,"");return`${K}-${Y}`}async function W$(q,_={}){if(!q||q.trim()==="")console.error("Error: Message is required"),process.exit(1);let j=_8.getInstance(),K=new Date().toISOString(),Y=_8.getCurrentProjectName(),f=oh(q),P=`${Y}_${f}_overview`,$=j.getIndexPath(),O={type:"overview",content:q,session_id:f,project:Y,timestamp:K};j.ensureDirectory(j.getDataDirectory()),ih($,JSON.stringify(O)+` +`,"utf8"),console.log(JSON.stringify({success:!0,document_id:P,session_id:f,project:Y,timestamp:K,suppressOutput:!0}))}e3();C6();import A_ from"fs";import C9 from"path";class V9{async parseConversation(q){let j=A_.readFileSync(q,"utf-8").trim().split(` +`).filter((z)=>z.trim()),K=[],Y=0;for(let z=0;zthis.convertMessage(z));return E8.debug(`Parsed ${q}: ${v.length} messages, ${Y} errors`),{sessionId:P,filePath:q,messageCount:v.length,timestamp:$,gitBranch:O,cwd:w,messages:v}}convertMessage(q){let _={type:q.type,uuid:q.uuid,session_id:q.sessionId,timestamp:q.timestamp,subtype:q.subtype};if(q.message){if(_.message={role:q.message.role,timestamp:q.timestamp},Array.isArray(q.message.content))_.message.content=q.message.content.map((j)=>({text:j.text||j.thinking||"",content:j.text||j.thinking||""}));else if(typeof q.message.content==="string")_.message.content=q.message.content}return _}async scanConversationFiles(){let q=_8.getInstance(),_=C9.join(q.getClaudeConfigDirectory(),"projects");if(!A_.existsSync(_))return[];let j=A_.readdirSync(_),K=[];for(let Y of j){let f=C9.join(_,Y);if(!A_.statSync(f).isDirectory())continue;let P=A_.readdirSync(f);for(let $ of P)if($.endsWith(".jsonl"))K.push(C9.join(f,$))}return K}async getConversationMetadata(q){let _=A_.statSync(q),K=A_.readFileSync(q,"utf-8").trim().split(` +`).filter((f)=>f.trim()),Y;try{Y=JSON.parse(K[0])}catch(f){throw new Error(`Invalid JSONL format in ${q}`)}return{sessionId:Y.sessionId,timestamp:Y.timestamp,messageCount:K.length,gitBranch:Y.gitBranch,cwd:Y.cwd,fileSize:_.size}}}U3();e3();KK();import JK from"path";import H$ from"fs";C6();var M9=v_(["#7D56F4","#8338ec","#3a86ff"]),N9=v_(["#50fa7b","#8be9fd"]),ah=v_(["#ff5555","#ff79c6"]);function b9(q){let _,j=0,K=["⠋","⠙","⠹","⠸","⠼","⠴","⠦","⠧","⠇","⠏"];return{start(){_=setInterval(()=>{process.stdout.write(`\r${e.cyan(K[j%K.length])} ${q}`),j++},50)},stop(Y,f=!0){clearInterval(_);let P=f?e.green("✓"):e.red("✗");process.stdout.write(`\r${P} ${Y} +`)}}}var g7=(q)=>new Promise((_)=>setTimeout(_,q));function Bh(q,_){if(q){let j=new Date(q);if(!isNaN(j.getTime()))return j}try{return H$.statSync(_).mtime}catch{return new Date}}function th(q){let j=new Date().getTime()-q.getTime(),K=Math.floor(j/60000),Y=Math.floor(j/3600000),f=Math.floor(j/86400000),P=Math.floor(f/7),$=Math.floor(f/30);if(K<1)return"just now";if(K<60)return`${K}m ago`;if(Y<24)return`${Y}h ago`;if(f<7)return`${f}d ago`;if(P<4)return`${P}w ago`;if($<12)return`${$}mo ago`;return`${Math.floor($/12)}y ago`}function eh(q){let _=new Date,j=new Date(_.getFullYear(),_.getMonth(),_.getDate()),K=new Date(j.getTime()-86400000),Y=new Date(j.getTime()-j.getDay()*24*60*60*1000),f=new Date(q.getFullYear(),q.getMonth(),q.getDate());if(f.getTime()>=j.getTime())return"Today";else if(f.getTime()>=K.getTime())return"Yesterday";else if(f.getTime()>=Y.getTime())return"This Week";else return"Older"}function T$(q){if(q<1024)return`${q}B`;if(q<1048576)return`${Math.round(q/1024)}KB`;return`${(q/1048576).toFixed(1)}MB`}function J$(q,_,j){let K=e.magenta,Y=e.cyan,f=e.gray,P=e.yellow,$=K(`[${q.projectName}]`),O=Y(q.relativeDate),w=f(`${q.messageCount} msgs`),v=f(T$(q.fileSize)),z=q.gitBranch?P(` • ${q.gitBranch}`):"";return`${$} ${O} • ${w} • ${v}${z}`}async function Fh(){console.log(M9(` +═══════════════════════════════════════`)),console.log(M9(" MEMORY IMPORT ")),console.log(M9("═══════════════════════════════════════")),console.log(k6(e.gray(`Import your Claude conversation history into the memory system + +`)+e.cyan(`• Browse past conversations +`)+e.cyan(`• Select what to import +`)+e.cyan("• Preserve your knowledge base"),{padding:1,margin:1,borderStyle:"round",borderColor:"magenta"})),await g7(500)}function Uh(){let q=_8.getInstance().getIndexPath();try{let j=H$.readFileSync(q,"utf-8").trim().split(` +`).filter((Y)=>Y.trim()),K=new Set;for(let Y of j)try{let f=JSON.parse(Y);if(f.session_id)K.add(f.session_id)}catch{}return K}catch{return new Set}}async function Z$(q={}){await Fh();let _=q.multi||!1;try{let j=new V9,K=new _K({verbose:q.verbose||!1}),Y=Uh(),f=b9("Scanning for conversation history...");f.start();let P=await j.scanConversationFiles();if(P.length===0){f.stop("No conversation files found",!1),console.log(k6(e.yellow(`No conversation files found in ~/.claude/projects/ + +`)+e.gray("Start using Claude Code to generate conversation history"),{padding:1,margin:1,borderStyle:"round",borderColor:"yellow"}));return}let $=[],O=0;for(let A of P)try{let G=await j.getConversationMetadata(A),h=JK.basename(JK.dirname(A)),V=Bh(G.timestamp,A),E=th(V),M=eh(V);if(Y.has(G.sessionId)){O++;continue}$.push({filePath:A,...G,projectName:h,parsedDate:V,relativeDate:E,dateGroup:M,displayName:""})}catch{}if($.length===0){let A=O>0?`No new conversations found (${O} already imported)`:"No valid conversation files found";if(f.stop(A,!1),O>0)console.log(k6(e.green(`All conversations have already been imported! + +`)+e.gray(`${O} conversation${O===1?"":"s"} found in memory system`),{padding:1,margin:1,borderStyle:"round",borderColor:"green"}));return}let w=O>0?`Found ${$.length} new conversation${$.length===1?"":"s"} (${O} already imported)`:`Found ${$.length} conversation${$.length===1?"":"s"}`;f.stop(w,!0),await g7(300),$.sort((A,G)=>G.parsedDate.getTime()-A.parsedDate.getTime());let v=$;if($.length>50){let A=await oq({message:e.bold(`Found ${$.length} conversations. How would you like to proceed?`),options:[{value:"recent",label:"Show Recent",hint:"Last 30 conversations"},{value:"project",label:"Filter by Project",hint:"Select a specific project"},{value:"all",label:"Show All",hint:`Display all ${$.length} conversations`}]});if(K6(A)){p6("Import cancelled");return}if(A==="recent")v=$.slice(0,30);else if(A==="project"){let G=[...new Set($.map((V)=>V.projectName))].sort(),h=await oq({message:e.bold("Select project:"),options:G.map((V)=>{let E=$.filter((M)=>M.projectName===V).length;return{value:V,label:V,hint:`${E} conversation${E===1?"":"s"}`}})});if(K6(h)){p6("Import cancelled");return}v=$.filter((V)=>V.projectName===h)}}let z=[];if(_){console.log(e.blue(` +\uD83D\uDCCB Multi-select mode (Space to toggle, Enter to confirm) +`));let A=v.map((V,E)=>({value:E,label:J$(V,E,v.length),hint:JK.basename(V.cwd)})),G=await QP({message:e.bold("Select conversations to import:"),options:A,required:!1});if(K6(G)){p6("Import cancelled");return}z=G.map((V)=>v[V])}else{console.log(e.blue(` +\uD83D\uDCCB Browse and import conversations one at a time +`));let A=!0,G=new Set;while(A){let h=v.filter((g)=>!G.has(g.sessionId));if(h.length===0){console.log(e.green(` +✅ All conversations have been imported! +`));break}let V=h.map((g,y)=>({value:g,label:J$(g,y,h.length),hint:JK.basename(g.cwd)}));V.push({value:null,label:e.red("Exit"),hint:"Finish importing"});let E=await oq({message:e.bold(`Select a conversation to import (${G.size} imported so far):`),options:V});if(K6(E)||E===null){A=!1;break}if(!E||typeof E!=="object"||!("sessionId"in E)){A=!1;break}let M=E,b=b9(`Importing ${M.projectName}...`);b.start();try{let g=JK.basename(M.cwd),y=await K.compress(M.filePath,M.sessionId,g);G.add(M.sessionId),b.stop(N9(`✨ Imported ${M.projectName} (${M.relativeDate})`),!0),await g7(500);let c=await gq({message:e.bold("Import another conversation?"),initialValue:!0});if(K6(c)||!c)A=!1}catch(g){let y=g instanceof Error?g.message:String(g);b.stop(`Failed: ${y}`,!1),E8.error(`Failed to import ${M.projectName}:`,y)}}if(G.size>0)console.log(k6(N9(`\uD83C\uDF89 Import Complete! + +`)+e.white(`Successfully imported ${G.size} conversation${G.size===1?"":"s"} + +`)+e.gray("Your memories are now preserved in the system"),{padding:1,margin:1,borderStyle:"double",borderColor:"green"}));return}if(z.length===0){p6("No conversations selected");return}let W=z.reduce((A,G)=>A+G.fileSize,0),J=[...new Set(z.map((A)=>A.projectName))];console.log(k6(e.bold(`Ready to import: + +`)+e.cyan(`• ${z.length} conversation${z.length===1?"":"s"} +`)+e.cyan(`• ${J.length} project${J.length===1?"":"s"}: ${J.slice(0,3).join(", ")}${J.length>3?"...":""} +`)+e.cyan(`• Total size: ${T$(W)}`),{padding:1,margin:1,borderStyle:"round",borderColor:"cyan"}));let k=await gq({message:e.bold("Proceed with import?"),initialValue:!0});if(K6(k)||!k){p6("Import cancelled");return}console.log(e.blue(` +\uD83D\uDE80 Importing conversations... +`));let H=0,X=0;for(let A=0;A0?N9(`✨ ${H} conversations imported successfully +`):"")+(X>0?ah(`⚠️ ${X} conversations failed +`):"")+` +`+e.gray("Your conversation history is now part of your memory system"),{padding:1,margin:1,borderStyle:"double",borderColor:H>X?"green":"yellow"}))}catch(j){let K=j instanceof Error?j.message:String(j);throw console.log(k6(e.red(`❌ Import failed! + +${K}`),{padding:1,margin:1,borderStyle:"double",borderColor:"red"})),j}}U3();var A6=new Y5;A6.name(pq).description(J5).version(W5);A6.command("compress [transcript]").description("Compress a Claude Code transcript into memory").option("--output ","Output directory for compressed files").option("--dry-run","Show what would be compressed without doing it").option("-v, --verbose","Show detailed output").action(oK);A6.command("install").description("Install Claude Code hooks for automatic compression").option("--user","Install for current user (default)").option("--project","Install for current project only").option("--local","Install to custom local directory").option("--path ","Custom installation path (with --local)").option("--timeout ","Hook execution timeout in milliseconds","180000").option("--skip-mcp","Skip Chroma MCP server installation").option("--force","Force installation even if already installed").action($f);A6.command("uninstall").description("Remove Claude Code hooks").option("--user","Remove from user settings (default)").option("--project","Remove from project settings").option("--all","Remove from both user and project settings").action(Of);A6.command("status").description("Check installation status of Claude Memory System").action(vf);A6.command("logs").description("View claude-mem operation logs").option("--debug","Show debug logs only").option("--error","Show error logs only").option("--tail [n]","Show last n lines","50").option("--follow","Follow log output").action(Wf);A6.command("load-context").description("Load compressed memories for current session").option("--project ","Filter by project name").option("--count ","Number of memories to load","10").option("--raw","Output raw JSON instead of formatted text").option("--format ","Output format: json, session-start, or default").action(T7);var S9=A6.command("trash").description("Manage trash bin for safe file deletion").argument("[files...]","Files to move to trash").option("-r, --recursive","Remove directories recursively").option("-R","Remove directories recursively (same as -r)").option("-f, --force","Suppress errors for nonexistent files").action(async(q,_)=>{if(!q||q.length===0){S9.outputHelp();return}if(_.R)_.recursive=!0;await O$(q,{force:_.force,recursive:_.recursive})});S9.command("view").description("View contents of trash bin").action(async()=>{let{viewTrash:q}=await Promise.resolve().then(() => (D$(),h$));await q()});S9.command("empty").description("Permanently delete all files in trash").option("-f, --force","Skip confirmation prompt").action(async(q)=>{let{emptyTrash:_}=await Promise.resolve().then(() => (M$(),V$));await _(q)});A6.command("restore").description("Restore files from trash interactively").action(z$);A6.command("save ").description("Save a message to the memory system").action(W$);A6.command("import-history").description("Import historical Claude Code conversations into memory").option("-v, --verbose","Show detailed output").option("-m, --multi","Enable multi-select mode (default is single-select)").action(Z$);A6.command("hook:pre-compact",{hidden:!0}).description("Internal pre-compact hook handler").action(async()=>{let{preCompactHook:q}=await Promise.resolve().then(() => (d7(),y7));await q()});A6.command("hook:session-start",{hidden:!0}).description("Internal session-start hook handler").action(async()=>{let{sessionStartHook:q}=await Promise.resolve().then(() => (d7(),y7));await q()});A6.command("hook:session-end",{hidden:!0}).description("Internal session-end hook handler").action(async()=>{let{sessionEndHook:q}=await Promise.resolve().then(() => (d7(),y7));await q()});A6.command("debug-filter").description("Show filtered transcript output (first 5 messages)").argument("","Path to transcript file").action((q)=>{new _K().showFilteredOutput(q)});A6.parse(); diff --git a/hooks/pre-compact.js b/hooks/pre-compact.js index 38e09407..0da55ff6 100755 --- a/hooks/pre-compact.js +++ b/hooks/pre-compact.js @@ -9,6 +9,7 @@ */ import { loadCliCommand } from './shared/config-loader.js'; +import { getLogsDir } from './shared/path-resolver.js'; import { createHookResponse, executeCliCommand, @@ -16,7 +17,9 @@ import { debugLog } from './shared/hook-helpers.js'; -const cliCommand = loadCliCommand(); +// Set up stdin immediately before any async operations +process.stdin.setEncoding('utf8'); +process.stdin.resume(); // Explicitly enter flowing mode to prevent data loss // Read input from stdin let input = ''; @@ -26,6 +29,9 @@ process.stdin.on('data', chunk => { process.stdin.on('end', async () => { try { + // Load CLI command inside try-catch to handle config errors properly + const cliCommand = loadCliCommand(); + const payload = JSON.parse(input); debugLog('Pre-compact hook started', { payload }); @@ -33,17 +39,18 @@ process.stdin.on('end', async () => { const validation = validateHookPayload(payload, 'PreCompact'); if (!validation.valid) { const response = createHookResponse('PreCompact', false, { reason: validation.error }); - console.log(JSON.stringify(response)); + debugLog('Validation failed', { response }); + // Exit silently - validation failure is expected flow control process.exit(0); } // Check for environment-based blocking conditions if (payload.trigger === 'auto' && process.env.DISABLE_AUTO_COMPRESSION === 'true') { - debugLog('Auto-compression disabled by configuration'); const response = createHookResponse('PreCompact', false, { reason: 'Auto-compression disabled by configuration' }); - console.log(JSON.stringify(response)); + debugLog('Auto-compression disabled', { response }); + // Exit silently - disabled compression is expected flow control process.exit(0); } @@ -56,26 +63,24 @@ process.stdin.on('end', async () => { const result = await executeCliCommand(cliCommand, ['compress', payload.transcript_path]); if (!result.success) { - debugLog('Compression command failed', { stderr: result.stderr }); const response = createHookResponse('PreCompact', false, { reason: `Compression failed: ${result.stderr || 'Unknown error'}` }); - console.log(JSON.stringify(response)); - process.exit(0); + debugLog('Compression command failed', { stderr: result.stderr, response }); + console.log(`claude-mem error: compression failed, see logs at ${getLogsDir()}`); + process.exit(1); // Exit with error code for actual compression failure } - // Success - create standardized approval response using HookTemplates + // Success - exit silently (suppressOutput is true) debugLog('Compression completed successfully'); - const response = createHookResponse('PreCompact', true); - console.log(JSON.stringify(response)); process.exit(0); } catch (error) { - debugLog('Pre-compact hook error', { error: error.message }); const response = createHookResponse('PreCompact', false, { reason: `Hook execution error: ${error.message}` }); - console.log(JSON.stringify(response)); + debugLog('Pre-compact hook error', { error: error.message, response }); + console.log(`claude-mem error: hook failed, see logs at ${getLogsDir()}`); process.exit(1); } }); \ No newline at end of file diff --git a/hooks/session-end.js b/hooks/session-end.js index 68d1783f..56d8e749 100644 --- a/hooks/session-end.js +++ b/hooks/session-end.js @@ -5,16 +5,15 @@ */ import { loadCliCommand } from './shared/config-loader.js'; +import { getSettingsPath, getArchivesDir } from './shared/path-resolver.js'; import { execSync } from 'child_process'; -import { join } from 'path'; -import { homedir } from 'os'; import { existsSync, readFileSync } from 'fs'; const cliCommand = loadCliCommand(); // Check if save-on-clear is enabled function isSaveOnClearEnabled() { - const settingsPath = join(homedir(), '.claude-mem', 'settings.json'); + const settingsPath = getSettingsPath(); if (existsSync(settingsPath)) { try { const settings = JSON.parse(readFileSync(settingsPath, 'utf8')); @@ -26,6 +25,10 @@ function isSaveOnClearEnabled() { return false; } +// Set up stdin immediately before any async operations +process.stdin.setEncoding('utf8'); +process.stdin.resume(); // Explicitly enter flowing mode to prevent data loss + // Read input let input = ''; process.stdin.on('data', chunk => { @@ -41,7 +44,7 @@ process.stdin.on('end', async () => { try { // Use the CLI to compress current transcript - execSync(`${cliCommand} compress --output ${homedir()}/.claude-mem/archives`, { + execSync(`${cliCommand} compress --output ${getArchivesDir()}`, { stdio: 'inherit', env: { ...process.env, CLAUDE_MEM_SILENT: 'true' } }); diff --git a/hooks/session-start.js b/hooks/session-start.js index b690511d..c4e8bd3e 100755 --- a/hooks/session-start.js +++ b/hooks/session-start.js @@ -21,6 +21,10 @@ import { const cliCommand = loadCliCommand(); +// Set up stdin immediately before any async operations +process.stdin.setEncoding('utf8'); +process.stdin.resume(); // Explicitly enter flowing mode to prevent data loss + // Read input from stdin let input = ''; process.stdin.on('data', chunk => { @@ -47,14 +51,14 @@ process.stdin.on('end', async () => { // Skip load-context when source is "resume" to avoid duplicate context if (payload.source === 'resume') { debugLog('Skipping load-context for resume source'); - // Output nothing at all for resume - no message, no context + // Output valid JSON response with suppressOutput for resume + const response = createHookResponse('SessionStart', true); + console.log(JSON.stringify(response)); process.exit(0); } - // Extract project name from current working directory and sanitize - const rawProjectName = path.basename(process.cwd()); - const projectName = rawProjectName.replace(/-/g, '_'); - debugLog('Extracted project name', { rawProjectName, projectName }); + // Extract project name from current working directory + const projectName = path.basename(process.cwd()); // Load context using standardized CLI execution helper const contextResult = await executeCliCommand(cliCommand, [ @@ -152,7 +156,7 @@ function extractProjectName(transcriptPath) { // Look for project pattern: /path/to/PROJECT_NAME/.claude/ // Need to get PROJECT_NAME, not the parent directory - const parts = transcriptPath.split('/'); + const parts = transcriptPath.split(path.sep); const claudeIndex = parts.indexOf('.claude'); if (claudeIndex > 0) { diff --git a/hooks/shared/hook-helpers.js b/hooks/shared/hook-helpers.js index d07a7f6f..2f5cd488 100644 --- a/hooks/shared/hook-helpers.js +++ b/hooks/shared/hook-helpers.js @@ -47,13 +47,10 @@ export function createHookResponse(hookType, success, options = {}) { } }; } else if (success) { + // No context - just suppress output without any message return { continue: true, - suppressOutput: true, - hookSpecificOutput: { - hookEventName: 'SessionStart', - additionalContext: 'Starting fresh session - no previous context available' - } + suppressOutput: true }; } else { return { diff --git a/hooks/shared/path-resolver.js b/hooks/shared/path-resolver.js new file mode 100644 index 00000000..bb653ec6 --- /dev/null +++ b/hooks/shared/path-resolver.js @@ -0,0 +1,54 @@ +#!/usr/bin/env node + +/** + * Path resolver utility for Claude Memory hooks + * Provides proper path handling using environment variables + */ + +import { join } from 'path'; +import { homedir } from 'os'; + +/** + * Gets the base data directory for claude-mem + * @returns {string} Data directory path + */ +export function getDataDir() { + return process.env.CLAUDE_MEM_DATA_DIR || join(homedir(), '.claude-mem'); +} + +/** + * Gets the settings file path + * @returns {string} Settings file path + */ +export function getSettingsPath() { + return join(getDataDir(), 'settings.json'); +} + +/** + * Gets the archives directory path + * @returns {string} Archives directory path + */ +export function getArchivesDir() { + return process.env.CLAUDE_MEM_ARCHIVES_DIR || join(getDataDir(), 'archives'); +} + +/** + * Gets the logs directory path + * @returns {string} Logs directory path + */ +export function getLogsDir() { + return process.env.CLAUDE_MEM_LOGS_DIR || join(getDataDir(), 'logs'); +} + +/** + * Gets all common paths used by hooks + * @returns {Object} Object containing all common paths + */ +export function getPaths() { + return { + dataDir: getDataDir(), + settingsPath: getSettingsPath(), + archivesDir: getArchivesDir(), + logsDir: getLogsDir() + }; +} \ No newline at end of file diff --git a/install.sh b/install.sh deleted file mode 100755 index 31878c5d..00000000 --- a/install.sh +++ /dev/null @@ -1,58 +0,0 @@ -#!/bin/bash -# Claude Mem Installation Script - -set -e - -VERSION="${1:-latest}" -PLATFORM="" -ARCH=$(uname -m) -OS=$(uname -s) - -# Detect platform -case "$OS" in - Darwin) - if [ "$ARCH" = "arm64" ]; then - PLATFORM="macos-arm64" - BINARY="claude-mem-macos-arm64" - else - PLATFORM="macos-x64" - BINARY="claude-mem-macos-x64" - fi - ;; - Linux) - if [ "$ARCH" = "aarch64" ]; then - PLATFORM="linux-arm64" - BINARY="claude-mem-linux-arm64" - else - PLATFORM="linux-x64" - BINARY="claude-mem-linux" - fi - ;; - MINGW*|MSYS*|CYGWIN*) - PLATFORM="windows-x64" - BINARY="claude-mem.exe" - ;; - *) - echo "Unsupported platform: $OS $ARCH" - exit 1 - ;; -esac - -echo "📥 Downloading Claude Mem for $PLATFORM..." - -# Download binary from GitHub releases -if [ "$VERSION" = "latest" ]; then - DOWNLOAD_URL="https://github.com/thedotmack/claude-mem/releases/latest/download/${BINARY}" -else - DOWNLOAD_URL="https://github.com/thedotmack/claude-mem/releases/download/${VERSION}/${BINARY}" -fi - -curl -L -o claude-mem "$DOWNLOAD_URL" - -# Make executable (non-Windows) -if [ "$OS" != "MINGW" ] && [ "$OS" != "MSYS" ] && [ "$OS" != "CYGWIN" ]; then - chmod +x claude-mem -fi - -echo "✅ Claude Mem installed successfully!" -echo "Run ./claude-mem --help to get started" diff --git a/package.json b/package.json new file mode 100644 index 00000000..aca3671a --- /dev/null +++ b/package.json @@ -0,0 +1,57 @@ +{ + "name": "claude-mem", + "version": "3.5.4", + "description": "Memory compression system for Claude Code - persist context across sessions", + "keywords": [ + "claude", + "claude-code", + "mcp", + "memory", + "compression", + "knowledge-graph", + "transcript", + "cli", + "typescript", + "bun" + ], + "author": "Alex Newman", + "license": "SEE LICENSE IN LICENSE", + "repository": { + "type": "git", + "url": "https://github.com/thedotmack/claude-mem.git" + }, + "homepage": "https://github.com/thedotmack/claude-mem#readme", + "bugs": { + "url": "https://github.com/thedotmack/claude-mem/issues" + }, + "publishConfig": { + "access": "public", + "registry": "https://registry.npmjs.org/" + }, + "type": "module", + "engines": { + "node": ">=18.0.0" + }, + "bin": { + "claude-mem": "./dist/claude-mem.min.js" + }, + "dependencies": { + "@anthropic-ai/claude-code": "^1.0.88", + "@clack/prompts": "^0.11.0", + "@modelcontextprotocol/sdk": "^0.5.0", + "boxen": "^8.0.1", + "chalk": "^5.6.0", + "chromadb": "^3.0.14", + "commander": "^14.0.0", + "glob": "^11.0.3", + "gradient-string": "^3.0.0", + "handlebars": "^4.7.8", + "oh-my-logo": "^0.3.2" + }, + "files": [ + "dist", + "hooks", + "commands", + ".mcp.json" + ] +}